Skip to content
SupportLogin
Launch document preprocessing

Launch document preprocessing

POST/api/v1/datasets/{dataset_id}/launch-preprocessing

Extracts the text, tables and figures of an uploaded document dataset (pdf, docx, pptx, xlsx, html, or a zip of them) into rows. After the upload completes, such a dataset reports awaiting_input until this is called. Reserves credits from the page count of the selected documents — quote them first with GET /datasets/{dataset_id}/preprocessing-credits — then starts extraction. Poll GET /datasets/{dataset_id}/status: it reports pending while extracting and awaiting_input once the rows are ready, at which point call POST /datasets/{dataset_id}/adapt.

Path ParametersExpand Collapse
dataset_id: string
Body ParametersJSONExpand Collapse
pages_to_process: optional number

Maximum number of pages to process. Documents are included until this budget is reached. If omitted, all pages are processed.

minimum1
documents_to_process: optional number

Maximum number of documents to process. If omitted, all documents are processed.

minimum1
preprocessing_mode: optional "per_document" or "per_page"

How extracted content becomes rows: per_document (default) makes one row per document, per_page one row per page. Omit to keep the mode already set on the dataset.

One of the following:
"per_document"
"per_page"
ReturnsExpand Collapse
dataset_id: string

ID of the dataset

status: string

Dataset status after the launch. Poll GET /datasets/{dataset_id}/status until it reports awaiting_input, then call POST /datasets/{dataset_id}/adapt.

credits_escrowed: optional number

Credits reserved for extracting the selected documents

pages_to_process: optional number

Total pages across the documents selected for extraction

documents_selected: optional number

Number of documents selected for extraction

documents_total: optional number

Number of documents in the dataset

Launch document preprocessing

curl https://api.prod.adaptionlabs.ai/api/v1/datasets/$DATASET_ID/launch-preprocessing \
    -H 'Content-Type: application/json' \
    -H "Authorization: Bearer $ADAPTION_API_KEY" \
    -d '{
          "preprocessing_mode": "per_document"
        }'
{
  "dataset_id": "dataset_id",
  "status": "pending",
  "credits_escrowed": 0,
  "pages_to_process": 0,
  "documents_selected": 0,
  "documents_total": 0
}
Returns Examples
{
  "dataset_id": "dataset_id",
  "status": "pending",
  "credits_escrowed": 0,
  "pages_to_process": 0,
  "documents_selected": 0,
  "documents_total": 0
}