Documents

Data Source Move

Markdown for LLMs
PUT
/documents/datasource/{dataSourceId}/move

Moves a data source into a folder, or back to the root. This is the only thing it changes: to change anything else about a data source, use documents-data-source-update.

Send the target folder's id as dataSource.folderId, or send folderId as null to take the data source out of its current folder and place it at the root. The folder must be one of the caller's own folders for data sources — one created with folderEntityId DATA_SOURCES. Any other is rejected with 400, and the data source stays where it was: FOLDER_ID_INVALID for an id that matches no folder, FOLDER_FORBIDDEN for another user's folder, FOLDER_NAMESPACE_MISMATCH for an envelope template folder, and FOLDER_ENTITY_TYPE_MISMATCH for a Documents folder that holds another kind of record. Leaving folderId out places the data source at the root, as null does.

Only the data source's owner can move it. Anyone else in the subscription is rejected with 403 DATA_SOURCE_FORBIDDEN. documents-data-source-list returns folderId for a data source in a folder.

A well-formed dataSourceId that matches no data source fails with 500 DATA_SOURCE_NOT_FOUND, as does a deleted data source, a body without dataSource with 500 EDIT_DATA_SOURCE_ERROR, and a dataSource.folderId that is not a GUID with 500.

Authorization

AuthorizationBearer <token>

JWT token to authenticate the request.

In: header

X-Api-Key<token>

API key, sent as a request header.

In: header

Path Parameters

dataSourceId*string

Id of the data source to move, as returned by documents-data-source-create in result.data.dataSource.id.

Formatuuid

Request Body

application/json

The data source's new folder under dataSource, alongside an optional externalContext. dataSource is mandatory.

TypeScript Definitions

Use the request body type in TypeScript.

Response Body

application/json

application/json

application/json

application/json

curl -X PUT "https://example.com/documents/datasource/3f2504e0-4f89-41d3-9a0c-0305e82c3301/move" \  -H "Content-Type: application/json" \  -d '{    "dataSource": {      "folderId": "123e4567-e89b-12d3-a456-426614174000"    },    "externalContext": {      "id": "12345"    }  }'
{  "result": {    "statusCode": 200,    "message": "OK"  },  "origin": "PUT https://api.doctavian.com/v1/documents/datasource/{dataSourceId}/move",  "dateTime": "2026-10-08T09:30:12.000Z",  "externalContext": {    "id": "12345"  },  "userId": "1a2b3c4d-5e6f-4a1b-8c2d-3e4f5a6b7c8d",  "operationId": "d41c7e09a2b84f63915e0c8b27f3a6d1"}
{  "error": {    "statusCode": 400,    "message": "Bad Request",    "innerErrors": [      {        "code": "FOLDER_ID_INVALID",        "message": "No folder matches the given folderId.",        "userMessage": "No folder matches the given folderId."      }    ],    "externalErrors": []  },  "origin": "PUT https://api.doctavian.com/v1/documents/datasource/{dataSourceId}/move",  "dateTime": "2026-10-21T09:04:24.000Z",  "userId": "1fa93f1d-07e8-4e08-84e6-c0098f3b6ed5",  "operationId": "6d2a9c4e1b7f43a08e5c3d2b1a9f7e64"}
{  "error": {    "statusCode": 403,    "message": "Forbidden",    "innerErrors": [      {        "code": "DATA_SOURCE_FORBIDDEN",        "message": "The data source belongs to another user.",        "userMessage": "The data source belongs to another user."      }    ],    "externalErrors": []  },  "origin": "PUT https://api.doctavian.com/v1/documents/datasource/{dataSourceId}/move",  "dateTime": "2026-10-21T09:04:24.000Z",  "userId": "1fa93f1d-07e8-4e08-84e6-c0098f3b6ed5",  "operationId": "6d2a9c4e1b7f43a08e5c3d2b1a9f7e64"}
Empty
{  "error": {    "statusCode": 500,    "message": "Internal Server Error",    "innerErrors": [      {        "code": "EDIT_DATA_SOURCE_ERROR",        "message": "The data source could not be moved.",        "userMessage": "Something went wrong. Please try again or contact support."      }    ]  },  "origin": "PUT https://api.doctavian.com/v1/documents/datasource/{dataSourceId}/move",  "dateTime": "2026-10-08T09:30:12.000Z",  "userId": "1a2b3c4d-5e6f-4a1b-8c2d-3e4f5a6b7c8d",  "operationId": "2d9c4f71e8a3460bb5e1a7c3f0d28e94"}