{"templateId":"openapi_docs","sharedDataIds":{"openAPIDocsStore":"oas-sai/content-transfer-api/index.yaml","sidebar":"sidebar-sidebar.yaml__sai_content-transfer-api","current-catalog-info":"current-catalog-info-/sai/content-transfer-api"},"props":{"definitionId":"sai/content-transfer-api/index.yaml","dynamicMarkdocComponents":[],"baseSlug":"/sai/content-transfer-api","seo":{"title":"Content Transfer API","siteUrl":"https://api-docs.sitecore.com","image":"/assets/favicon.19b81ef710429ff2169b164acdb39de23d65db39632db445eeef84aa38980a00.db81178d.svg","keywords":"documentation, api","lang":"en-US","jsonLd":{"@context":"https://schema.org","@type":"Website","url":"http://api-docs.sitecore.com","name":"Sitecore APIs Documentation"},"llmstxt":{"hide":false,"sections":[{"title":"Table of contents","includeFiles":["**/*"],"excludeFiles":[]}],"excludeFiles":[]}},"itemId":"","disableAutoScroll":true,"metadata":{"type":"openapi","title":"Content Transfer API","description":"The Content Transfer REST API allows SitecoreAI *Organization Admins* and *Organization Owners* to initiate, monitor, and finalize content transfer operations for migrating content data from one SitecoreAI environment (the *source*) to another (the *destination*). This enables efficient transfer of data between environments using chunked data streaming with encryption and compression support.\n\nEach transfer operation includes at least one set of chunked data, where each chunk set represents a single data tree that was nominated for transfer. When an operation is complete, each of its chunk sets will be represented by a `.raif` file in the *destination* environment. To finish integrating the transferred data, use the separate [Item Transfer API](https://api-docs.sitecore.com/sai/item-transfer) to have the destination database consume the `.raif` files.\n\nNote the following:\n- To use this REST API, you must authorize your API requests.\n- You must be an *Organization Admin* or *Organization Owner* to use this API. \n- Different endpoints in this API are called against different environments. You will switch between a *source* base URL and a *destination* base URL depending on the step in the workflow. Each endpoint description specifies which environment to use.\n\n# Migrating content\n\nThe Content Transfer API covers the *source* side of a content migration. After completing the steps in this API, use the [Item Transfer API](https://api-docs.sitecore.com/sai/item-transfer) to incorporate the transferred data into the destination database.\n\nBefore you begin, ensure you have the *Organization Admin* or *Organization Owner* role, and that you have determined your *source* and *destination* [base URLs](#section/base-url) and created a [JWT](#section/authorization) for each environment. \n\n## Create the transfer\n\nIn your *source* environment, [create a content transfer operation](#operation/ContentTransfer_CreateContentTransfer) using a unique transfer ID of your choice. For each item you want to transfer, specify the item path, whether to include descendants, and how to handle conflicts with existing items in the destination. Depending on how much data is being transferred, the operation creates one or more chunk sets.\n\n## Wait for the transfer to be ready\n\n[Poll the operation details](#operation/ContentTransfer_GetContentTransferStatus) in your *source* environment until `State` is `Completed`. If `State` is `Failed`, create a new transfer operation. For each chunk set in the response, record the `ChunkSetId` and `ChunkCount` because you'll need them to retrieve and save the chunks.\n\n## Transfer chunks\n\nFor each chunk set, repeat the following for every chunk in the set:\n\n1. In your *source* environment, [retrieve the chunk](#operation/ContentTransfer_GetChunkAsync). Make one request per chunk, using `chunkId` values `0` through `ChunkCount - 1`. Note the `IsMedia` value from the `Content-Disposition` response header because you'll need it when saving the chunk. You can retrieve multiple chunks in parallel.\n2. In your *destination* environment, [save the chunk](#operation/ContentTransfer_SaveChunkAsync), forwarding the binary stream exactly as received without modification. You can save chunks in parallel with retrieval, but every chunk must be saved before completing the chunk set.\n\nAfter all chunks in a set are saved, [complete the chunk set](#operation/ContentTransfer_CompleteChunkSetAsync) in your *destination* environment. This generates a `.raif` file and returns its name. Record the name for use in the Item Transfer API. Repeat for every chunk set in the operation.\n\n## Delete the transfer\n\n[Delete the transfer operation](#operation/ContentTransfer_DeleteContentTransfer) from your *source* environment to clean up all associated resources. You can do this immediately after downloading all chunks from the *source* environment. \n\n## Next steps\n\nProceed to the [Item Transfer API](https://api-docs.sitecore.com/sai/item-transfer) to incorporate the `.raif` files into the destination database.\n\n# Base URL\nIn the base URL, replace `{host}` with your environment host name. You need two base URLs: one for your *source* environment (where you're migrating data from) and one for your *destination* environment (where you're migrating data to). You will switch between them as you follow the migration workflow.\n\nFind the environment host name in SitecoreAI Deploy > **Projects** > your project > **Authoring environments** > your environment > **Details** > **Environment host name**.\n\nExample environment host name: `your-environment.sitecorecloud.io`\n\n# Authorization\nTo authorize your requests, use environment automation client credentials and generate a JSON Web Token (JWT).\n\nNote: To create client credentials, you must be an [Organization Admin or Organization Owner](https://doc.sitecore.com/portal/en/developers/sitecore-cloud-portal/roles.html).\n\n## Create an automation client\n1. In the Sitecore Cloud Portal, open SitecoreAI Deploy.\n2. Click **Credentials** > **Environment** > **Create credentials** > **Automation**.\n3. Fill out the automation client details, then click **Create**.\n4. Copy the client ID and the client secret because you won't be able to view them again in SitecoreAI Deploy. You'll use them to request a JWT.\n\n## Request a JWT\n\nRun the following cURL command to request a JWT. Replace the placeholder values with your client ID and client secret.\n```curl\n  curl -X POST 'https://auth.sitecorecloud.io/oauth/token' \\\n  --header 'Content-Type: application/x-www-form-urlencoded' \\\n  --data-urlencode 'client_id={YOUR_CLIENT_ID}' \\\n  --data-urlencode 'client_secret={YOUR_CLIENT_SECRET}' \\\n  --data-urlencode 'grant_type=client_credentials' \\\n  --data-urlencode 'audience=https://api.sitecorecloud.io'\n```\n\nThe JWT expires in 24 hours. If your requests unexpectedly return a response with status `403 Forbidden`, request a new JWT by repeating this `POST` request.\n\nWe recommend that you cache the JWT for 24 hours to avoid repeating this `POST` request while the JWT is still valid.\n\n## Include the JWT in the request header\n\nYou can now start making REST API requests. You must include the JWT in the request header of every request. For example:\n```curl\n  curl -X GET '{YOUR_BASE_URL}/...' \\\n  -H 'Authorization: Bearer {YOUR_JWT}' \\\n  -H 'Accept: application/json'\n```\n","product":"SitecoreAI"},"compilationErrors":[],"markdown":{"partials":{},"variables":{"rbac":{"teams":["anonymous"]},"user":{},"remoteAddr":{"hostname":"api-docs.sitecore.com","port":4000,"ipAddress":"216.73.217.10"},"lang":"default_locale","env":{"PUBLIC_REDOCLY_BRANCH_NAME":"master"}}},"pagePropGetterError":{"message":"","name":""}},"slug":"/sai/content-transfer-api","userData":{"isAuthenticated":false,"teams":["anonymous"]},"isPublic":true}