Skip to main content

Assets API

A document names the files it uses by path: a font in fonts/, a picture in images/, a file to embed in attachments/. Upload them here, once, and every document of your organization can use them. The same store holds the documents you generate, which is where a generation's downloadUrl points.

All endpoints require authentication and are scoped to a tenant. Reading needs only a valid token; uploading, deleting and managing folders need the asset:upload scope, which API keys hold.


Asset types​

Each file belongs to one asset type, the first segment of its path.

Asset typeExtensionsLargest file
images.jpg, .jpeg, .png2 MB
fonts.ttf, .otf20 MB
attachments.xml, .xsd, .csv, .json, .txt, .pdf5 MB
certs.p12, .pfx64 KB
docsGenerated documents: read only

A file's content must match its extension: a .png that is not a PNG is refused. SVG is not accepted, since it can carry active content; draw vector graphics with the document's own svg element instead.

certs holds PKCS#12 signing keys. Uploading one needs the config:manage scope, which no API key is issued, and a key is never served back: it can be listed and deleted, never downloaded.


POST /assets/{assetType}​

Upload a file. A file of the same name in the same folder is replaced.

Endpoint​

POST /v1/{tenantId}/assets/{assetType}?folder={folder}
Content-Type: multipart/form-data
ParameterWhereDescription
assetTypepathimages, fonts, attachments or certs
fileformThe file
folderqueryOptional subfolder, such as brand/2026
curl -X POST "https://api.docpayload.com/v1/{tenantId}/assets/fonts?folder=brand" \
-H "Authorization: Bearer {token}" \
-F "file=@Inter-Regular.ttf"

Response​

Success (201 Created)

HTTP/1.1 201 Created
Content-Type: application/json
Location: /v1/{tenantId}/assets/fonts/brand/Inter-Regular.ttf

{ "path": "fonts/brand/Inter-Regular.ttf" }

The path is what a document names to use the file; Location is where it is downloaded.

400 Bad Request: an unsupported asset type or extension, a file over the size limit, content that does not match its extension, or an invalid file name or folder.


GET /assets/{assetType}/{path}​

Download a file: one you uploaded, or a generated document from docs.

GET /v1/{tenantId}/assets/{assetType}/{path}

The response carries an ETag. Send it back as If-None-Match and an unchanged file is answered 304 Not Modified, with no body.


GET /assets​

Every file and folder of the tenant.

GET /v1/{tenantId}/assets

Success (200 OK)

{
"folders": ["images", "fonts", "attachments", "certs", "images/brand"],
"items": [
{
"fileName": "logo.png",
"size": 18342,
"contentType": "image/png",
"lastModified": "2026-11-20T14:02:11Z",
"path": "images/brand/logo.png"
}
]
}

GET /assets/{assetType}​

The files of one asset type in value, each as in items above.

GET /v1/{tenantId}/assets/{assetType}

GET /assets/{assetType}/{fileName}/metadata​

A file's size, type and dates, for a file at the root of its asset type.

GET /v1/{tenantId}/assets/{assetType}/{fileName}/metadata

Success (200 OK)

{
"fileName": "logo.png",
"size": 18342,
"contentType": "image/png",
"created": "2026-11-20T14:02:11Z",
"modified": "2026-11-20T14:02:11Z",
"path": "images/logo.png"
}

DELETE /assets/{assetType}/{fileName}​

Delete a file at the root of its asset type. A document still naming it is generated without it, and the answer's errorCodes names what is missing (IMAGE_NOT_LOADED, FONT_NOT_LOADED, ATTACHMENT_NOT_EMBEDDED), until the file is uploaded again. A signing key is the exception: a document asking for a signature whose certificate is gone is refused, 400 SIGNATURE_NOT_APPLIED.

DELETE /v1/{tenantId}/assets/{assetType}/{fileName}

Success (204 No Content)


Folders​

EndpointBody or queryAnswer
POST /v1/{tenantId}/assets/folders{ "path": "images/brand" }201 with { "path": "images/brand" }
POST /v1/{tenantId}/assets/folders:rename{ "oldPath": "images/brand", "newName": "logos" }200 with { "path": "images/logos" }; 409 when the name is taken
DELETE /v1/{tenantId}/assets/folders?path=images/brand204, the folder and everything in it

A folder path starts with its asset type. The asset types themselves cannot be renamed or deleted.

Every upload, deletion and folder change is recorded in your organization's audit log, under Activity in the app.