Document APIs

The Document APIs enable you to manage document uploads, processing, and retrieval. For detailed information about document processing capabilities, see our Document Processing guide.

Upload Document Flow


POST/v1/management/documents/upload/presign

Get Upload Presigned URL

Generates a presigned URL for secure document upload.

Required headers

  • Name
    Authorization
    Type
    string
    Description

    Bearer token for authentication

Request body

  • Name
    fileName
    Type
    string
    Description

    Name of the file to upload

  • Name
    contentType
    Type
    string
    Description

    MIME type of the file

Request

POST
/v1/management/documents/upload/presign
curl -X POST https://api.example.com/v1/management/documents/upload/presign \
  -H "Authorization: Bearer {token}" \
  -H "Content-Type: application/json" \
  -d '{
    "fileName": "document.pdf",
    "contentType": "application/pdf"
  }'

Response

{
  "url": "https://storage.example.com/presigned-url",
  "key": "abc123xyz"
}

POST/v1/management/documents/upload/finalize

Finalize Upload

Finalizes the document upload by providing metadata and initiating processing.

Required headers

  • Name
    Authorization
    Type
    string
    Description

    Bearer token for authentication

Request body

  • Name
    key
    Type
    string
    Description

    Document identifier from presigned URL response

  • Name
    fileName
    Type
    string
    Description

    Original file name

  • Name
    fileExtension
    Type
    string
    Description

    File extension (e.g., "pdf", "docx")

  • Name
    classification
    Type
    string
    Description

    Document classification level. Possible values are:

    • "external"
    • "internal"
    • "confidential"
  • Name
    tags
    Type
    string
    Description

    Comma-separated tags for the document

  • Name
    fileSizeKb
    Type
    number
    Description

    File size in kilobytes

Search Logic

The search logic for documents combines different fields with AND conditions, while multiple tags within the Tags field are combined with OR conditions.

Example:

  • Classification="internal" AND (Tags="finance" OR Tags="report")

Response

  • Name
    status
    Type
    number
    Description

    HTTP 201 on success

Request

POST
/v1/management/documents/upload/finalize
curl -X POST https://api.example.com/v1/management/documents/upload/finalize \
  -H "Authorization: Bearer {token}" \
  -H "Content-Type: application/json" \
  -d '{
    "key": "abc123xyz",
    "fileName": "document.pdf",
    "fileExtension": "pdf",
    "classification": "confidential",
    "tags": "contract,legal",
    "fileSizeKb": 1024
  }'

Response

201 Created

Document Management


GET/v1/management/documents

List Documents

Retrieves a paginated list of documents.

Required headers

  • Name
    Authorization
    Type
    string
    Description

    Bearer token for authentication

Query parameters

  • Name
    status
    Type
    string
    Description

    Filter by processing status

  • Name
    page
    Type
    number
    Description

    Page number (default: 1)

  • Name
    pageSize
    Type
    number
    Description

    Items per page (default: 10, max: 100)

Request

GET
/v1/management/documents
curl https://api.example.com/v1/management/documents?page=1&pageSize=10 \
  -H "Authorization: Bearer {token}"

Response

{
  "items": [
    {
      "fileName": "document.pdf",
      "fileExtension": "pdf",
      "classification": "confidential",
      "tags": "contract,legal",
      "documentIdentifier": "abc123xyz",
      "fileSizeKB": 1024,
      "processingStatus": "completed",
      "createdOnUtc": "2024-03-15T10:30:00Z",
      "updatedOnUtc": "2024-03-15T10:35:00Z"
    }
  ],
  "page": 1,
  "pageSize": 10,
  "totalCount": 45,
  "totalPages": 5
}

POST/v1/management/documents/status

Check Document Status

Checks the processing status of one or more documents.

Required headers

  • Name
    Authorization
    Type
    string
    Description

    Bearer token for authentication

Request body

  • Name
    documentIdentifiers
    Type
    array
    Description

    Array of document identifiers to check

Response

  • Name
    error
    Type
    boolean
    Description

    Indicates if there was an error processing the request

  • Name
    message
    Type
    string
    Description

    Error message if error is true

  • Name
    data
    Type
    array
    Description

    Array of document statuses

Request

POST
/v1/management/documents/status
curl -X POST https://api.example.com/v1/management/documents/status \
  -H "Authorization: Bearer {token}" \
  -H "Content-Type: application/json" \
  -d '{
    "documentIdentifiers": ["abc123xyz", "def456uvw"]
  }'

Response

{
  "error": false,
  "data": [
    {
      "documentIdentifier": "abc123xyz",
      "status": "completed"
    },
    {
      "documentIdentifier": "def456uvw",
      "status": "processing"
    }
  ]
}

PUT/v1/management/documents

Update Document Metadata

Updates document metadata such as classification and tags.

Required headers

  • Name
    Authorization
    Type
    string
    Description

    Bearer token for authentication

Request body

  • Name
    key
    Type
    string
    Description

    Document identifier

  • Name
    classification
    Type
    string
    Description

    New classification level

  • Name
    tags
    Type
    string
    Description

    Updated comma-separated tags

Search Logic

The search logic for documents combines different fields with AND conditions, while multiple tags within the Tags field are combined with OR conditions.

Example:

  • Classification="internal" AND (Tags="finance" OR Tags="report")

Response

  • Name
    status
    Type
    number
    Description

    HTTP 200 on success

Request

PUT
/v1/management/documents
curl -X PUT https://api.example.com/v1/management/documents \
  -H "Authorization: Bearer {token}" \
  -H "Content-Type: application/json" \
  -d '{
    "key": "abc123xyz",
    "classification": "restricted",
    "tags": "contract,legal,updated"
  }'

Response

200 OK

DELETE/v1/management/documents

Delete Document

Deletes a document from the system.

Required headers

  • Name
    Authorization
    Type
    string
    Description

    Bearer token for authentication

Request body

  • Name
    documentIdentifier
    Type
    string
    Description

    Identifier of the document to delete

Response

  • Name
    status
    Type
    number
    Description

    HTTP 200 on success

Request

DELETE
/v1/management/documents
curl -X DELETE https://api.example.com/v1/management/documents \
  -H "Authorization: Bearer {token}" \
  -H "Content-Type: application/json" \
  -d '{
    "documentIdentifier": "abc123xyz"
  }'

Response

200 OK

POST/v1/management/documents/process

Process Document

Initiates or restarts document processing. This endpoint can be used to process documents that are in a failed state or to reprocess documents with updated settings.

Required headers

  • Name
    Authorization
    Type
    string
    Description

    Bearer token for authentication

Response

  • Name
    status
    Type
    number
    Description

    HTTP 200 on success

Request

POST
/v1/management/documents/process
curl -X POST https://api.example.com/v1/management/documents/process \
  -H "Authorization: Bearer {token}"

Response

200 OK

POST/v1/management/documents/download/presign

Get Download URL

Generates a presigned URL for secure document download.

Required headers

  • Name
    Authorization
    Type
    string
    Description

    Bearer token for authentication

Request body

  • Name
    documentIdentifier
    Type
    string
    Description

    Identifier of the document to download

Response

  • Name
    url
    Type
    string
    Description

    Presigned URL for downloading the document

  • Name
    key
    Type
    string
    Description

    Document identifier

Request

POST
/v1/management/documents/download/presign
curl -X POST https://api.example.com/v1/management/documents/download/presign \
  -H "Authorization: Bearer {token}" \
  -H "Content-Type: application/json" \
  -d '{
    "documentIdentifier": "abc123xyz"
  }'

Response

{
  "url": "https://storage.example.com/download-presigned-url",
  "key": "abc123xyz"
}

Was this page helpful?