---
title: "Trigger AI field detection for a document"
method: POST
path: "/api/v1/documents/{documentId}/field-detection"
tags: ["Field Detection"]
---

# Trigger AI field detection for a document

`POST /api/v1/documents/{documentId}/field-detection`

## Request

- Base URL: `https://api.korala.ai`
- URL: `https://api.korala.ai/api/v1/documents/{documentId}/field-detection`
- Auth: one of:
  - API key in header `X-API-Key`
  - `bearer` (a scheme the document does not define)

## Path parameters

- `documentId` string, required

## Request body

- TriggerFieldDetectionDto
  - `minConfidence` number: Minimum confidence threshold (0-100)

## Response `201`

- FieldDetectionJobDto
  - `id` string, required: Job ID
  - `documentId` string: Document ID (if detecting for a document)
  - `templateId` string: Template ID (if detecting for a template)
  - `status` 'queued' | 'ocr_processing' | 'ai_processing' | 'completed' | 'failed', required: Current status of the field detection job
  - `ocrProcessingMs` number: OCR processing time in milliseconds
  - `aiProcessingMs` number: AI processing time in milliseconds
  - `proposedFieldCount` number: Number of proposed fields detected
  - `errorMessage` string: Error message if job failed
  - `createdAt` string, date-time, required: Job creation timestamp
  - `updatedAt` string, date-time, required: Job last update timestamp

## Other responses

- `400`: Malformed UUID in path parameter (`documentId`).

---

[API](https://skmtc.dev/korala/apis/korala-public-api.md) · [All operations](https://skmtc.dev/korala/apis/korala-public-api/llms.txt) · [OpenAPI document](https://skmtc.dev/korala/apis/korala-public-api/revisions/5c4d7810c507?raw)
