# GET /foreign/archives

First published 14 Oct 2026 (release 0.2.0) · Unchanged since publication

UrbeStack release 0.2.35 API operation in the foreign group.

List tracked hosting account archives

- Who may call it: administrator, reseller
- Token scope, any of: users, read, all
- Answers: 200 OK

Returns tracked archives in archives and the default scan directory in dir. Each entry includes the directory, filename, size, modification time, whether the file is still present or has changed since it was last recorded, and the choices used for the last inspection or import.

An archive in the new state is awaiting inspection. The read state includes the proposed account, the check counts, and counts of archive contents. The importing state includes the job, current step, and progress percentage. The imported state identifies the account created. The failed state gives the reason the import failed, and unreadable gives the reason the inspection failed.

Administrators and resellers need a token with the users scope. Other roles receive 403. Administrators see all tracked archives and the default directory from import.dir, which falls back to /root/import. Resellers see their own archives, with paths relative to the root of their home directory and /import as the default scan directory.

## As a command

- [urbestack-foreign-import](https://urbestack.com/docs/commands/urbestack-foreign-import.md): Imports a hosting account into UrbeStack from a pkgacct archive or a full backup downloaded from the customer's panel on the source server.

## Example

Set $API to the base URL and $TOKEN to the token, as the [API overview](https://urbestack.com/docs/api.md) shows.

```
curl -sS -X GET "$API/foreign/archives" \
  -H "Authorization: Bearer $TOKEN"
```

Response, 200 OK:

```
{
  "archives": [
    {
      "account": "text",
      "changed": true,
      "choices": {
        "as": "alice",
        "default_mailbox": "text",
        "paths": "rewrite",
        "skip_databases": [
          "text"
        ]
      },
      "dir": "text",
      "error": "Domain 'example.com' already exists",
      "id": 1,
      "import": {},
      "job": {},
      "mtime": "text",
      "name": "alice",
      "owner": "text",
      "path": "public_html/index.php",
      "present": true,
      "read_at": "text",
      "read_error": "text",
      "seen_at": "text",
      "size": 1,
      "state": "new",
      "summary": {}
    }
  ],
  "dir": "text"
}
```

## Errors

- 400: '<_>' is not a database name
- 400: --archive takes --show, --inspect or --queue, or --file with --job for the import itself
- 400: --file is required
- 400: <_> is set per domain, on the PHP page's Domains tab, never as a server default
- 400: <name> has an owner: move them to the administrator before changing their role
- 400: <name> is an administrator: administrators have no home, so nothing to back up
- 400: <name> is an administrator: administrators have no system account, so no shell
- 400: <user.name> is an administrator: administrators have no home, so no FTP accounts
- 400: A new job is queued or running
- 400: A subdomain belongs to the same user as its parent
- 400: A subdomain cannot have a subdomain as its parent
- 400: An administrator has no shell: only a customer has a system account
- 400: Cannot demote or suspend the last active administrator
- 400: Domain name required
- 400: Domain name too long
- 400: Domains belong to users with role 'user'
- 400: Invalid IPv4 address
- 400: Invalid IPv6 address
- 400: Invalid PHP version, expected e.g. 8.2
- 400: Invalid boolean
- 400: Invalid domain name
- 400: Invalid email address
- 400: Invalid id
- 400: Invalid password hash
- 400: Invalid password: 8 to 128 printable characters
- 400: Invalid port
- 400: Invalid role: admin, user or reseller
- 400: Invalid setting key
- 400: Invalid status
- 400: Invalid system password hash
- 400: Invalid template name
- 400: Invalid username: 2 to 32 lowercase letters, digits or underscores, starting with a letter
- 400: Job parameters must be an object
- 400: Only a customer has an owner: an administrator or a reseller is the administrator's own
- 400: PHP settings must be an object of setting: value
- 400: Subdomain '<name>' does not sit under '<parent.name>'
- 400: The second factor can only be turned off here; a user enrols from their own page
- 400: Unknown PHP version '<version>'
- 400: Unknown job type
- 400: Username '<value>' is reserved
- 400: default_mailbox is the local part of an address under the main domain
- 400: paths is rewrite or leave
- 400: skip_databases may name at most 100 databases
- 401: Authentication required
- 403: Cannot read 
- 403: Insufficient privileges
- 404: Domain '<name>' not found
- 404: No archive at 
- 404: Parent domain '<parent>' not found
- 404: Setting '<key>' not found
- 404: User '<name>' not found
- 404: User '<owner>' not found
- 409: '<alias>' is already a domain here
- 409: '<alias>' is already an alias
- 409: '<name>' is already an alias here
- 409: <login> is the customer's own login
- 409: <msg> Nothing was changed.
- 409: <name> is being imported (job <job_id>): wait for the job
- 409: <name> is being imported already (job <job_id>)
- 409: <name> is on the package <p.name> of the reseller <p.owner>: change the package before the move
- 409: <name> owns <owned> 
- 409: <name> was imported already, as <account>, which is on this server
- 409: <who> and its bandwidth for the month is used up: 
- 409: <who> and its disk is used up: 
- 409: A system account named '<name>' already exists
- 409: Domain '<name>' already exists
- 409: The FTP account <login> exists already
- 409: The package <p.name> allows <limit> 
- 409: User '<name>' already exists
