---
title: "Automap Document"
method: POST
path: "/api/batch/{batch_id}/document/{document_id}/automap"
tags: ["Batch Processing"]
---

# Automap Document

`POST /api/batch/{batch_id}/document/{document_id}/automap`

## Request

- Base URL: `https://api.qomplement.com` (the document declares no server; this is the origin it was published from)
- URL: `https://api.qomplement.com/api/batch/{batch_id}/document/{document_id}/automap`
- Auth: HTTP bearer

Aggregate data from multiple pages and map to Excel template fields.

This endpoint:
1. Retrieves selected pages from the document
2. Aggregates structured data across pages
3. Uses OpenAI to intelligently map aggregated data to Excel fields
4. Returns mapping suggestions with confidence scores

## Path parameters

- `batch_id` string, required
- `document_id` string, required

## Request body

- AutomapRequest: Request model for automap operation
  - `batch_id` string, required
  - `document_id` string, required
  - `selected_page_numbers` integer[], required
  - `excel_fields` ExcelFieldSchema[], required
    - `name` string, required
    - `type` string, required
    - `description` string, nullable
    - `required` boolean
  - `openai_api_key` string, required

## Response `200`

Successful Response

- unknown

## Other responses

- `422`: Validation Error

---

[API](https://skmtc.dev/qomplement/apis/qomplement-api.md) - [All operations](https://skmtc.dev/qomplement/apis/qomplement-api/llms.txt) - [OpenAPI document](https://skmtc.dev/qomplement/apis/qomplement-api/revisions/6fe617c112ef?raw)
