---
title: "Trigger document processing"
method: POST
path: "/api/v1/knowledge-base/process-document"
tags: ["main", "knowledge-base"]
---

# Trigger document processing

`POST /api/v1/knowledge-base/process-document`

## Request

- Base URL: `https://app.dograh.com`
- URL: `https://app.dograh.com/api/v1/knowledge-base/process-document`
- Auth: none declared

Trigger asynchronous processing of an uploaded document.

This endpoint should be called after successfully uploading a file to the presigned URL.
It will:
1. Create a document record in the database with the specified UUID
2. Enqueue a background task to process the document (chunking and embedding)

The document status will be updated from 'pending' -> 'processing' -> 'completed' or 'failed'.

Embedding:
Uses OpenAI text-embedding-3-small (1536-dimensional embeddings, requires API key configured in Model Configurations).

Access Control:
* Users can only process documents in their organization.

## Headers

- `authorization` string, nullable
- `X-API-Key` string, nullable

## Request body

- ProcessDocumentRequestSchema: Request schema for triggering document processing.
  - `document_uuid` string, required: Document UUID to process
  - `s3_key` string, required: S3 key of the uploaded file
  - `retrieval_mode` string: Retrieval mode: 'chunked' for vector search or 'full_document' for full text retrieval

## Response `200`

Successful Response

- DocumentResponseSchema: Response schema for document metadata.
  - `id` integer, required
  - `document_uuid` string, required
  - `filename` string, required
  - `file_size_bytes` integer, required
  - `file_hash` string, required
  - `mime_type` string, required
  - `processing_status` string, required
  - `processing_error` string, nullable
  - `total_chunks` integer, required
  - `retrieval_mode` string
  - `custom_metadata` object, required
  - `docling_metadata` object, required
  - `source_url` string, nullable
  - `created_at` string, date-time, required
  - `updated_at` string, date-time, required
  - `organization_id` integer, required
  - `created_by` integer, required
  - `is_active` boolean, required
  - `has_live_content` boolean: Whether agents can currently retrieve this document's content. Stays true while an edited document is re-indexed or after its re-index fails, because the previous version keeps serving until a new one succeeds.

## Other responses

- `404`: Not found
- `422`: Validation Error

## Changes

- **2026-11-03** `faa00cf76fcb`: 1 info
  - endpoint added

[Operation history](https://skmtc.dev/dograh/apis/dograh-api/changes/api/v1/knowledge-base/process-document/post.md)

---

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