## Estimate credit cost for document preprocessing

**get** `/api/v1/datasets/{dataset_id}/preprocessing-credits`

Quotes the credits that extracting a document dataset (pdf, docx, pptx, xlsx, html, or a zip of them) will reserve, from the page count of each document. Pass the same `pages_to_process` or `documents_to_process` you intend to launch with. Page counting runs in the background after upload, so `isFinal: false` means the quote is still partial — poll until it is true. Start extraction with POST /datasets/{dataset_id}/launch-preprocessing.

### Path Parameters

- `dataset_id: string`

### Query Parameters

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

- `documents_to_process: optional number`

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

### Returns

- `availableCredits: number`

  User's total available credits (team balance)

- `extractionCost: number`

  Estimated or actual credit cost for document extraction

- `totalPages: number`

  Total pages across all documents (sum of page counts)

- `totalDocuments: number`

  Total documents in the dataset

- `completedDocuments: number`

  Number of documents with completed extraction (page counts known)

- `isFinal: boolean`

  Whether the cost is final (all extractions complete) or an estimate

- `insufficientCredits: optional object { creditsRequired, creditsAvailable }`

  Present when available credits are insufficient for the extraction cost

  - `creditsRequired: number`

    Credits the extraction would reserve

  - `creditsAvailable: number`

    Credits available to the team

### Example

```http
curl https://api.prod.adaptionlabs.ai/api/v1/datasets/$DATASET_ID/preprocessing-credits \
    -H "Authorization: Bearer $ADAPTION_API_KEY"
```

#### Response

```json
{
  "availableCredits": 0,
  "extractionCost": 0,
  "totalPages": 0,
  "totalDocuments": 0,
  "completedDocuments": 0,
  "isFinal": true,
  "insufficientCredits": {
    "creditsRequired": 0,
    "creditsAvailable": 0
  }
}
```
