Request
Binary uploads are handled out-of-band through a signed URL flow. This endpoint records the metadata for a document whose bytes have already been uploaded to the workspace’s object store at storage_path. To obtain a signed upload URL, use POST /v1/documents/upload-url (documented separately under Storage).
Authorization: Bearer wbk_your_api_key_here
Content-Type: application/json
Optional UUID for retry deduplication within 24 hours.
Body Parameters
Display name of the document. 1 - 255 characters.
IANA media type of the file (e.g. application/pdf, image/png).
Object storage key where the uploaded bytes live. Usually returned by the signed-upload flow.
Size of the uploaded file, in bytes. Used for quota tracking.
Optional folder path. Created on demand. Example: /clients/acme/ndas.
Optional array of tag strings.
Response
The created document record (same shape as GET /v1/documents/{id}).
Responses include X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, and X-Request-ID.
curl -X POST \
https://data.leadlex.com/functions/v1/api-gateway/v1/documents \
-H "Authorization: Bearer wbk_your_api_key_here" \
-H "Content-Type: application/json" \
-d '{
"name": "Acme-NDA-2026.pdf",
"mime_type": "application/pdf",
"storage_path": "workspaces/ws_123/documents/new-upload.pdf",
"size_bytes": 183204,
"folder": "/clients/acme/ndas",
"tags": ["nda", "confidentiality"]
}'
Example Response
{
"data": {
"id": "doc_01HY1",
"name": "Acme-NDA-2026.pdf",
"description": null,
"mime_type": "application/pdf",
"size_bytes": 183204,
"storage_path": "workspaces/ws_123/documents/new-upload.pdf",
"folder": "/clients/acme/ndas",
"tags": ["nda", "confidentiality"],
"created_by": "usr_01HW0",
"created_at": "2026-04-17T10:45:00Z",
"updated_at": "2026-04-17T10:45:00Z"
}
}
Errors
| Status | Code | Description |
|---|
| 400 | validation_error | Missing required fields or invalid MIME type |
| 401 | invalid_key | Invalid or expired API key |
| 403 | insufficient_permissions | Missing write:documents permission |
| 409 | storage_conflict | A document already exists at the supplied storage_path |
| 429 | rate_limited | Rate limit exceeded |