Get your free beta license ↗
API operation · foreign group
POST

/foreign/archives/{id}/import

First published 14 Oct 20260.2.0Unchanged since publication

Queue an import for a tracked archive

Who may call it
AdministratorResellerCustomer
Token scope, any of
usersall
Answers202 Accepted

Queues the same import job as POST /foreign/import using the tracked archive and the supplied choices. The archive file must be present. The operation returns 409 if an import for the archive is already queued or running, or if the account created by an earlier import of the archive still exists on this server.

A successful request returns 202 with job and archive and links the job to the tracked archive. While the import runs, the archive shows the current step and progress percentage. When the job finishes, the archive records the account created or the reason for failure. That result remains available after the job record is removed. Blocking conflicts and missing requirements stop the import before account creation. The job stops at the first failure, reports the completed steps and leaves any partially imported account in place.

Use as to override the original account name. By default, paths is rewrite, which replaces references to the old home path in .htaccess, .user.ini and php.ini. Use leave to preserve those references. The account's own mailbox is restored under the main domain if the destination email address is available. It defaults to <name>@<main domain>. Use default_mailbox to supply a different local part, which UrbeStack converts to lowercase. It can contain 1 to 64 ASCII letters, digits, periods, underscores or hyphens and must begin and end with a letter or digit. Use skip_databases to omit up to 100 databases by their names in the archive. Each name can contain 1 to 64 ASCII letters, digits or underscores. The import also omits users associated only with skipped databases. Invalid paths, default_mailbox or skip_databases values return 400.

Administrators and resellers can call this operation with a token that has the users scope. Resellers can import only their own tracked archives in their home directory, and the new account must fit within their limits.

As a command

Run as root on the server

Parameters

idpath ·integer, 1 or moreRequired

Request body

JSON ·ForeignArchiveChoices· 4 fields
Username to assign to the imported account. Defaults to the username in the archive.
default_mailboxstring, matching ^[a-z0-9]([a-z0-9._-]{0,62}[a-z0-9])?$
pathsstring, one of rewrite, leave
skip_databasesarray of string, matching ^[A-Za-z0-9_]{1,64}$

Example

See the API overview for how to set $API and $TOKEN.
Request
curl -sS -X POST "$API/foreign/archives/1/import" \
  -H "Authorization: Bearer $TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "as": "alice",
    "default_mailbox": "text",
    "paths": "rewrite",
    "skip_databases": [
      "text"
    ]
  }'
Response · 202 Accepted
{
  "archive": {
    "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": {}
  },
  "job": {
    "created_at": "2026-09-09T10:15:00Z",
    "created_by": 1,
    "created_by_name": "text",
    "dismissed_at": "text",
    "finished_at": "2026-09-09T10:15:04Z",
    "id": 1,
    "lane": "short",
    "log": "",
    "params": {},
    "progress": 100,
    "result": {},
    "started_at": "2026-09-09T10:15:01Z",
    "status": "queued",
    "type": "rebuild",
    "usual_seconds": 1
  }
}

Errors

71 errors, each a status and a sentence
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
400A new job is queued or running
400A subdomain belongs to the same user as its parent
400A subdomain cannot have a subdomain as its parent
400An administrator has no shell: only a customer has a system account
400Cannot demote or suspend the last active administrator
400Domain name required
400Domain name too long
400Domains belong to users with role 'user'
400Invalid IPv4 address
400Invalid IPv6 address
400Invalid PHP version, expected e.g. 8.2
400Invalid boolean
400Invalid domain name
400Invalid email address
400Invalid id
400Invalid password hash
400Invalid password: 8 to 128 printable characters
400Invalid port
400Invalid role: admin, user or reseller
400Invalid setting key
400Invalid status
400Invalid system password hash
400Invalid template name
400Invalid username: 2 to 32 lowercase letters, digits or underscores, starting with a letter
400Job parameters must be an object
400Only a customer has an owner: an administrator or a reseller is the administrator's own
400PHP settings must be an object of setting: value
400Subdomain '<name>' does not sit under '<parent.name>'
400The second factor can only be turned off here; a user enrols from their own page
400Unknown PHP version '<version>'
400Unknown job type
400Username '<value>' is reserved
400default_mailbox is the local part of an address under the main domain
400paths is rewrite or leave
400skip_databases is a list of database names
400skip_databases may name at most 100 databases
400skip_databases names databases as the archive names them
401Authentication required
403Cannot read
403Insufficient privileges
404Domain '<name>' not found
404No archive at
404Parent domain '<parent>' not found
404Setting '<key>' not found
404User '<name>' not found
404User '<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:
409A system account named '<name>' already exists
409Domain '<name>' already exists
409The FTP account <login> exists already
409The package <p.name> allows <limit>
409User '<name>' already exists
Generated from release 0.2.35 (current) · the API’s own descriptionThis entry has been unchanged since it was first published in release 0.2.0 on 14 Oct 2026.
urbestack.com/docs/api/post-foreign-archives-id-import/