Project Transfer API

Prev Next

The Project Transfer API moves a project from one SESTEK AI Agents environment to another, for example from your test environment to production. It takes the project's Draft or its Published version from the source environment and writes it into the Draft of an existing project on the target, or creates a new project there. Before anything is written, a precheck shows what the target will gain, lose or keep. Unlike the manual export and import in the user interface, which always create a new project, a transfer can update an existing one. There is no screen for it: you call the API and poll a job for the result.

📝 Note: Before you start, you need an API client in both environments that carries the dataservice_external_transfer scope, and also dataservice_external_transfer_tenant_resources if you will move tenant resources. Request these clients from SESTEK support. A call made without the right scope returns 403. The target must run the same product version as the source or a newer one, patch number included: the precheck refuses a package from a newer version.

To run a transfer by asking Claude Code in plain words instead of making these calls yourself, see Project Transfer with Claude Code.

Every step runs against one of the two environments, and the placeholders mean that environment's addresses:

Placeholder Meaning
{identityServerUrl} The identity server of the environment, which issues access tokens.
{baseUrl} The address of the SESTEK AI Agents installation of the environment.

All transfer calls sit under {baseUrl}/api/external/transfers and return 200 on success. The full request and response schemas are in each environment's OpenAPI document at {baseUrl}/api/swagger.

The example throughout moves the Published version of a project called CustomerSupport from test to production, into the existing CustomerSupport project there.


Step 1: Get an access token on each side

Request one token from the source's identity server with the source client, and one from the target's identity server with the target client. The body is form-urlencoded, not JSON.

Endpoint: POST {identityServerUrl}/connect/token
Content type: application/x-www-form-urlencoded

curl --location '{identityServerUrl}/connect/token' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--data-urlencode 'grant_type=client_credentials' \
--data-urlencode 'client_id={clientId}' \
--data-urlencode 'client_secret={clientSecret}' \
--data-urlencode 'scope=dataservice_external_transfer dataservice_external_transfer_tenant_resources'

Expected response:

{
  "access_token": "{accessToken}",
  "token_type": "Bearer",
  "expires_in": {expiresInSeconds},
  "scope": "dataservice_external_transfer dataservice_external_transfer_tenant_resources"
}

Send the token as Authorization: Bearer {accessToken} on every transfer call. The examples below write {sourceAccessToken} or {targetAccessToken} so you can tell which one goes where. The token also decides the tenant, so no request names one.


Step 2: Export the project (source)

Endpoint: POST {baseUrl}/api/external/transfers/exports

curl --location '{baseUrl}/api/external/transfers/exports' \
--header 'Authorization: Bearer {sourceAccessToken}' \
--header 'Content-Type: application/json' \
--data-raw '{
  "projectId": "{sourceProjectId}",
  "versionSelector": "Published"
}'
Field Description
projectId Id of the project on the source.
versionSelector Draft or Published. A project that has never been published cannot be exported as Published.

The export changes nothing in the source project. The response is a job. Poll it until it finishes:

curl --location '{baseUrl}/api/external/transfers/jobs/{exportJobId}' \
--header 'Authorization: Bearer {sourceAccessToken}'
Status Meaning
Queued Waiting to start.
Running In progress.
Succeeded Finished.
SucceededWithWarnings Finished. warnings lists what to check, each item with a code, message, entityType and entityName.
Failed Stopped. errorCode and errorMessage say why. errorMessage is always in English.

On an export job, expirationTime tells you until when the package can be downloaded.


Step 3: Download the package and the manifest (source)

When the export job has succeeded, download both files:

curl --location '{baseUrl}/api/external/transfers/jobs/{exportJobId}/package' \
--header 'Authorization: Bearer {sourceAccessToken}' \
--output 'transfer-{exportJobId}.zip'

curl --location '{baseUrl}/api/external/transfers/jobs/{exportJobId}/manifest' \
--header 'Authorization: Bearer {sourceAccessToken}' \
--output 'transfer-{exportJobId}.manifest.json'

Keep the manifest exactly as downloaded. The precheck, the tenant-resource export and the import all take it unchanged.


Step 4: Run the precheck (target)

The precheck writes nothing. It tells you whether the target can take the package and what the import would change.

Endpoint: POST {baseUrl}/api/external/transfers/prechecks

curl --location '{baseUrl}/api/external/transfers/prechecks' \
--header 'Authorization: Bearer {targetAccessToken}' \
--header 'Content-Type: application/json' \
--data-raw '{
  "projectId": "{targetProjectId}",
  "manifest": {manifestJson}
}'

Replace {manifestJson} with the content of the manifest file, sent as a JSON object rather than as a string. To create a new project on the target instead of updating one, set projectId to null.

Expected response:

{
  "canImport": false,
  "target": { "projectId": "{targetProjectId}", "action": "UpdateDraft" },
  "findings": [
    { "code": "LlmConfigurationMissing", "severity": "Error", "message": "{message}", "entityType": "{entityType}", "entityName": "Support GPT" },
    { "code": "AiAgentRemoved", "severity": "Warning", "message": "{message}", "entityType": "{entityType}", "entityName": "Billing Assistant" }
  ]
}

target.action is UpdateDraft when you named a target project and CreateProject when you did not. canImport is false while any finding has severity Error. Fix each Error and run the precheck again. Warnings do not block the import, but read them: they name what the target will lose or keep.

What you do Findings
Wait and retry ImportInProgress, VirtualAgentTraining, KnowledgeBaseBusy, AiTestingRunInProgress
Create or move the resource on the target LlmConfigurationMissing, McpServerMissing, CredentialMissing, CertificateMissing, DataTableMissing, GlobalEntityMissing, ServiceIntegrationMissing, ChannelIntegrationMissing, DataTableColumnMissing, DataTableColumnTypeDiffers, IntegrationPlatformDiffers, IntegrationLanguageDiffers. See Step 5.
Change the target TargetProjectNotFound, TargetProjectDeleting, ProjectNameInUse, PrimaryLanguageDiffers, OutboundMismatch, LanguageMissing, FeatureMissing, ChannelIntegrationInUse, KnowledgeBaseNameInUse, AiTestingNameInUse, DataTableLimitExceeded, KnowledgeBaseRetrievalProviderNotAllowed; for ProductVersionNewer and PaletteVersionNewer, upgrade the target
Export again and send the manifest unchanged ManifestInvalid, FormatVersionUnsupported
Read and accept (Warnings) AiAgentRemoved, GuardrailRemoved, LanguageRemoved, KnowledgeBaseKept, AiTestingKept, ProjectRenameAffectsPublished, ProductVersionOlder, PaletteVersionOlder, AiInsightsLlmNotConfigured, AiTestingLlmNotConfigured, AnalyticsIntegrationNotEnabled, LlmConfigurationProviderDiffers, CertificateExpired

Step 5: Move tenant resources (only when the precheck reports missing ones)

The project package does not carry tenant-level resources. Two calls move seven kinds of them, with their secrets encrypted: LLM configurations, MCP servers, credentials, certificates, service integrations, channel integrations, and data tables (schema only, no rows). Create anything else the precheck reports as missing on the target by hand.

You choose the encryption key yourself, and the server never generates one. It must be exactly 32 random bytes in Base64 (44 characters), for example:

openssl rand -base64 32

Together, the key and the tenant-resource package expose the credentials and secrets they carry: treat both as secrets, and discard both once the import is done.

Export on the source: POST {baseUrl}/api/external/transfers/tenant-resources/exports

curl --location '{baseUrl}/api/external/transfers/tenant-resources/exports' \
--header 'Authorization: Bearer {sourceAccessToken}' \
--header 'Content-Type: application/json' \
--data-raw '{
  "manifest": {manifestJson},
  "encryptionKey": "{encryptionKey}"
}'
Response field Description
package The tenant resources as a JSON object. Pass it to the import as it is.
notFound Resources the manifest names that the source tenant no longer has, each with a type and name. Create these on the target by hand.
findings Warnings about resources that are skipped, such as system MCP servers.

Import on the target, as a dry run first: POST {baseUrl}/api/external/transfers/tenant-resources/imports

curl --location '{baseUrl}/api/external/transfers/tenant-resources/imports' \
--header 'Authorization: Bearer {targetAccessToken}' \
--header 'Content-Type: application/json' \
--data-raw '{
  "package": {tenantResourcePackage},
  "encryptionKey": "{encryptionKey}",
  "dryRun": true,
  "projectId": "{targetProjectId}",
  "existingResourcePolicy": "Skip"
}'
Field Description
package The package object from the export.
encryptionKey The same key you used for the export. A different key is refused.
dryRun true writes nothing and returns the plan. false applies it.
projectId Optional. The target project a channel integration may already belong to.
existingResourcePolicy For a resource the target already has: Skip (the default) leaves it as it is, Update overwrites it with the package's values.

Resources are matched by name, ignoring case. A resource the target does not have is created, and target resources the package does not name are never touched. The response lists each resource in items with an action of Create, Update, Skip or Error.

When the dry run shows no Error, send the same request with "dryRun": false. The real run is all or nothing: if any item has an Error, nothing is written. Then run the precheck (Step 4) again. The errors for the resources you moved are gone.


Step 6: Import (target)

⚠️ Warning: The import replaces the target project's Draft with the package's content. Flows, AI Agents, guardrails, intents and the other items listed under What an import does to the target Draft are deleted from the Draft when the package does not carry them. Check the precheck's Warnings before you import.

Endpoint: POST {baseUrl}/api/external/transfers/imports
Content type: multipart/form-data

curl --location '{baseUrl}/api/external/transfers/imports' \
--header 'Authorization: Bearer {targetAccessToken}' \
--header 'Idempotency-Key: customersupport-prod-20261123-01' \
--form 'package=@"transfer-{exportJobId}.zip"' \
--form 'manifest=@"transfer-{exportJobId}.manifest.json"' \
--form 'projectId="{targetProjectId}"'
Field Required Description
package Yes The package file from Step 3.
manifest Yes The manifest file from Step 3.
projectId No The target project whose Draft is updated. Leave it out to create a new project.
Idempotency-Key (header) No Your own key for this import. If the connection drops, send the same request with the same key and you get the same job back instead of a second import. Without the key, a retry starts a second import.

The import runs the precheck again and is refused with 422 if it finds any Error. A large package can take minutes before the response comes back, so set a long timeout on your client. The response is a job.


Step 7: Poll the import, then publish (target)

Poll GET {baseUrl}/api/external/transfers/jobs/{importJobId} with the target token, as in Step 2. On an import job, projectId is the project that was updated or created. A Failed import leaves the target Draft unchanged.

Two warnings can appear only on the import job:

  • Transfer:EffectFailed: a step after the import, such as preparing an AI Agent, failed. The import itself stands. Prepare the named item again from the user interface.
  • AiTestingScheduleSkipped: an AI Testing schedule with no run left (a one-off run in the past, or an end date that has passed) was not written.

📝 Note: The import does not publish the Draft and does not train virtual agents, also when it creates a new project. Check the Draft on the target, train its virtual agents, and publish it yourself.


What moves and what does not

Content
In the package Project settings and languages; flows, including audio and file responses; project entities and confirmation phrases; virtual agents (intents, utterances, entities); custom data keys; system messages; AI Insights; outbound settings; channel and service integration assignments; guardrails; knowledge base settings and tag definitions; AI Agents with their tools, sub-agents and avatar; AI Testing datasets, test definitions and schedules.
Tenant resources (Step 5) LLM configurations, MCP servers, credentials, certificates, service integrations, channel integrations, data table schemas. They must already exist on the target or be moved separately.
Never moved Knowledge base documents and websites; AI Testing runs and results; data table rows; custom dashboards.

What an import does to the target Draft

Only the target project's Draft changes. Its Published version (including integration assignments), its other versions and the target's tenant resources stay as they are. The project takes the source project's name.

In the target Draft What happens
Not in the package: deleted Flows, contexts, project entities, confirmation phrases, custom data keys, custom AI Insights, outbound time intervals, intents, guardrails, AI Agents with their tools. Languages the package lacks are removed.
Not in the package: kept Knowledge bases, with their documents. AI Testing definitions, with their run history and schedules.
In both: updated in place Knowledge bases, AI Agents, guardrails and AI Testing definitions keep their ids. Knowledge base documents, AI Testing run history and AI Agent instruction history are kept.

While an import runs, the target Draft is locked. Save, Publish and Delete are refused in the user interface, and a second import into the project or a Draft export of it returns 409. Importing the same package into the same project again gives the same Draft.


Limits and time windows

Limit Value
Package size 256 MB
Manifest size 512 KB
Package download window 1 day after the export
Job running time 60 minutes. After that, the job is stopped and ends Failed.
Start window A job that has not started within 10 minutes of being queued ends Failed.
Job result Readable for 30 days
Idempotency-Key Up to 128 characters
encryptionKey 32 random bytes, Base64 (44 characters)

Errors

Status Meaning
400 The request, the encryption key or the package is not valid.
401 The token is missing or not valid.
403 The token does not carry the scope the call needs.
403 "Tenant information could not be resolved from the token being used." The client is not bound to a tenant.
404 The job or project belongs to another tenant.
409 "The package of transfer job {jobId} is not available (status {status})." The export has not succeeded yet, it failed, or the job is an import.
409 "Project {projectId} has no published version to export." Export the Draft instead, or publish first.
409 "Project '{projectName}' has a transfer import in progress." Wait for the import to finish.
409 The Idempotency-Key was already used for a different import, or another request is still using it. Use a new key, or retry shortly.
410 "The package of transfer job {jobId} expired on {expirationTime}." Export again.
413 The package or the manifest is over its size limit.
422 "The transfer package was rejected: {reason}" The import found a precheck Error. Run the precheck to see every finding.
422 "The tenant resource package was rejected: {reason}" Nothing was written. Run the dry run to see which resource fails.
429 Too many transfer jobs are waiting to start, or too many calls. Try again in a few minutes.