Documents

Export documents

POST/documents/exports

Starts an export of the documents GET /documents would return and answers 202 with the job (type export). Poll GET /jobs/{id}; result.download_url works for 7 days. Ids you can't see are not selected. zip: files follow the /download rules; result.files counts them and result.skipped lists {id, name, code, message} of those left out. Over 5,000 files or 2 GB it fails too_large; with none left, nothing_to_download with error.details[0].skipped. Writes a download access record per zipped file, which can't be undone. No dry run.

Headers

  • Idempotency-Keystring#

    Makes a retry safe. Send a new UUID for each new request and reuse it only to retry that request; the first response is replayed for 24 hours.

Request body

application/json, optional

  • filterobject#

    The list's filters, as in GET /documents, such as { "deal_id": "…" }; operators nest, such as { "type": { "in": "pdf,doc" } }. filter[id][in] takes at most 100 ids; for larger zips select folders with within_folder_id (at most 50 per operator, each with its subtree; more is a 422).

  • sortstring#

    Comma-separated fields to sort by, as on the list. Prefix a field with - for descending.

  • formatstring#

    csv (default): one row per document, its fields then folder_path. zip: the files; one under a filter[within_folder_id] folder goes under {folder name}/{path below it}/, others at the root; duplicate names become name (1).ext; watermarked and masked PDFs are their transformed copy.

    One of: csv, zip
  • optionsobject#

    Settings for the chosen format. csv takes none.

{
  "filter": {
    "deal_id": "9f8e7d6c-5b4a-4938-8271-6a5b4c3d2e1f"
  }
}

Responses

202

The export job was started.

Job
{
  "data": {
    "id": "9a9d1c5e-4f2b-4c8e-9a7d-2f1e6b3c4d5a",
    "type": "string",
    "status": "queued",
    "progress": {
      "done": 1,
      "total": 1
    },
    "result": {},
    "error": {},
    "created_at": "2026-06-12T10:00:00+00:00",
    "updated_at": "2026-06-12T10:00:00+00:00",
    "completed_at": "2026-06-12T10:00:00+00:00"
  }
}
401

Authentication failed. error.code is one of invalid_token, expired, revoked.

Error
403

Authorization failed. error.code is one of org_disabled, ip_blocked, missing_scope, scope_disabled, user_disabled.

Error
422

The request can't be processed (HTTP 422): validation_failed with one ErrorDetail per problem, or a code documented on the operation.

Error
429

Rate limit exceeded (error.code = rate_limited).

Error

Examples

curl -X POST https://your-org-domain/kong/core/api/v2/documents/exports\
  -H "Authorization: Bearer $HELM_API_KEY"\
  -H "Content-Type: application/json"\
  -d '{
  "filter": {
    "deal_id": "9f8e7d6c-5b4a-4938-8271-6a5b4c3d2e1f"
  }
}'