Copy page
Copy original Markdown fileHow to Download a Document as Base64 Using the BoldSign API
You can retrieve a document in Base64 format by adding the x-response-format header with the value base64 to your request. When enabled, the API returns the document as a Base64‑encoded string along with its content type and file name.
Example cURL Request (Base64 Response)
curl -X GET 'https://api.boldsign.com/v1/document/download?documentId=YOUR_DOCUMENT_ID' \
-H 'accept: application/json' \
-H 'X-API-KEY: {your-api-key}' \
-H 'x-response-format: base64'
Header Parameter
| x-response-formatstring | Set this to base64 to receive the document content as a Base64‑encoded string. |
The response also includes a fileName field, which reflects the generated file name based on the uploaded document. By default, this includes the document title and its status (for example: Contract_Completed.pdf).
For more details, refer to: https://support.boldsign.com/kb/article/18128/customize-signed-document-naming
Base64 Response Format
200 – Success
{
"fileName": "Contract_Completed.pdf",
"contentType": "application/pdf",
"file": "JVBERi0xLjcNCiVi...base64encodedstring...ZCVFDQo="
}
Response Fields:
- fileName – The name of the downloaded file
- contentType – The MIME type of the document (e.g.,
application/pdf) - file – The Base64‑encoded content of the file
Other Endpoints Supporting Base64 Format
The x-response-format: base64 header can also be used with the following endpoints:
- DownloadAuditTrail
- DownloadAttachment
- Template Download endpoints
All of these endpoints follow the same Base64 retrieval pattern.