NextSign API
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/convert

Request Body

FieldTypeRequiredDescription
tagsarrayNoTag replacements used when converting DOCX files
documentsarrayYesArray of documents to convert

Tag Fields

FieldTypeDescription
tagstringTemplate tag name
valuestring | numberReplacement value
typestringTag type such as text, number, or date
formatstringOptional date format

Document Fields

FieldTypeDescription
filestringURL to the source document
namestringDocument name

Example Request

cURL
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

200 OK
{
  "status": {
    "code": 200,
    "message": "OK"
  },
  "documents": [
    {
      "file": "https://example.com/path/to/converted-contract.pdf",
      "name": "Contract Agreement.pdf"
    }
  ]
}

Response Fields

FieldTypeDescription
status.codenumberHTTP-style status code in the payload
status.messagestringStatus message
documentsarrayConverted documents
documents[].filestringURL to the converted file
documents[].namestringConverted 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"
    }
  ]
}