Documents

Template Move

Markdown for LLMs
PUT
/documents/template/{documentTemplateId}/move

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

Send the target folder's id as documentTemplate.folderId, or send folderId as null to take the document template out of its current folder and place it at the root. The folder must be one of the caller's own folders for document templates — one created with folderEntityId DOCUMENT_TEMPLATES. Any other is rejected with 400, and the document template 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 document template at the root, as null does.

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

A well-formed documentTemplateId that matches no document template fails with 500 DOCUMENT_TEMPLATE_NOT_FOUND, as does a deleted document template, a body without documentTemplate with 500 EDIT_DOCUMENT_TEMPLATE_ERROR, and a documentTemplate.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

documentTemplateId*string

Id of the document template to move, as returned by documents-template-create in result.data.documentTemplate.id.

Formatuuid

Request Body

application/json

The document template's new folder under documentTemplate, alongside an optional externalContext. documentTemplate 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/template/2b7c9e14-5a63-4f08-9d21-7c4e0b8a3f52/move" \  -H "Content-Type: application/json" \  -d '{    "documentTemplate": {      "folderId": "123e4567-e89b-12d3-a456-426614174000"    },    "externalContext": {      "id": "12345"    }  }'
{  "result": {    "statusCode": 200,    "message": "OK"  },  "origin": "PUT https://api.doctavian.com/v1/documents/template/{documentTemplateId}/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/template/{documentTemplateId}/move",  "dateTime": "2026-10-21T09:04:24.000Z",  "userId": "1fa93f1d-07e8-4e08-84e6-c0098f3b6ed5",  "operationId": "6d2a9c4e1b7f43a08e5c3d2b1a9f7e64"}
{  "error": {    "statusCode": 403,    "message": "Forbidden",    "innerErrors": [      {        "code": "DOCUMENT_TEMPLATE_FORBIDDEN",        "message": "The document template belongs to another user.",        "userMessage": "The document template belongs to another user."      }    ],    "externalErrors": []  },  "origin": "PUT https://api.doctavian.com/v1/documents/template/{documentTemplateId}/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_DOCUMENT_TEMPLATE_ERROR",        "message": "The document template could not be moved.",        "userMessage": "Something went wrong. Please try again or contact support."      }    ]  },  "origin": "PUT https://api.doctavian.com/v1/documents/template/{documentTemplateId}/move",  "dateTime": "2026-10-08T09:30:12.000Z",  "userId": "1a2b3c4d-5e6f-4a1b-8c2d-3e4f5a6b7c8d",  "operationId": "c6b8f2a0d9e34175a8c1e5f7b2d09a4e"}