Documents
Document Convert
Convert documents using POST /api/v2/document/convert.
Document Convert
Use this endpoint to convert DOCX documents to PDF and replace tags before sending or previewing a document.
Authorization
All requests to this endpoint require authentication using a Bearer Token.
Use your NextSign API key as the bearer token for this endpoint.
Endpoint
POST https://www.nextsign.dk/api/v2/document/convertRequest Body
| Field | Type | Required | Description |
|---|---|---|---|
tags | array | No | Tag replacements used when converting DOCX files |
documents | array | Yes | Array of documents to convert |
Tag Fields
| Field | Type | Description |
|---|---|---|
tag | string | Template tag name |
value | string | number | Replacement value |
type | string | Tag type such as text, number, or date |
format | string | Optional date format |
Document Fields
| Field | Type | Description |
|---|---|---|
file | string | URL to the source document |
name | string | Document name |
Example Request
curl --location 'https://www.nextsign.dk/api/v2/document/convert' \
-H 'Authorization: Bearer YOUR_API_KEY' \
-H 'Content-Type: application/json' \
--data '{
"tags": [
{
"tag": "customer_name",
"value": "Andreas",
"type": "text"
},
{
"tag": "contract_number",
"value": 200,
"type": "number"
}
],
"documents": [
{
"file": "https://example.com/path/to/contract.docx",
"name": "Contract Agreement.docx"
}
]
}'Example Response
{
"status": {
"code": 200,
"message": "OK"
},
"documents": [
{
"file": "https://example.com/path/to/converted-contract.pdf",
"name": "Contract Agreement.pdf"
}
]
}Response Fields
| Field | Type | Description |
|---|---|---|
status.code | number | HTTP-style status code in the payload |
status.message | string | Status message |
documents | array | Converted documents |
documents[].file | string | URL to the converted file |
documents[].name | string | Converted file name |
PDF files are passed through, while DOCX files are converted to PDF.
Common Error Responses
Missing documents array:
{
"message": "Bad request",
"errors": [
{
"status": "error",
"message": "minimum of 1 documents is required"
}
]
}