Skip to main content
POST
/
v1
/
documents
Create Document Record
curl --request POST \
  --url https://api.example.com/v1/documents \
  --header 'Content-Type: application/json' \
  --data '
{
  "name": "<string>",
  "mime_type": "<string>",
  "storage_path": "<string>",
  "size_bytes": 123,
  "description": "<string>",
  "folder": "<string>",
  "tags": [
    {}
  ]
}
'
{
  "data": {}
}

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).

Headers

Authorization: Bearer wbk_your_api_key_here
Content-Type: application/json
Idempotency-Key
string
Optional UUID for retry deduplication within 24 hours.

Body Parameters

name
string
required
Display name of the document. 1 - 255 characters.
mime_type
string
required
IANA media type of the file (e.g. application/pdf, image/png).
storage_path
string
required
Object storage key where the uploaded bytes live. Usually returned by the signed-upload flow.
size_bytes
integer
Size of the uploaded file, in bytes. Used for quota tracking.
description
string
Optional description.
folder
string
Optional folder path. Created on demand. Example: /clients/acme/ndas.
tags
array
Optional array of tag strings.

Response

data
object
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

StatusCodeDescription
400validation_errorMissing required fields or invalid MIME type
401invalid_keyInvalid or expired API key
403insufficient_permissionsMissing write:documents permission
409storage_conflictA document already exists at the supplied storage_path
429rate_limitedRate limit exceeded