---
title: "Retry document ingestion"
method: POST
path: "/v1/knowledgebases/{id}/documents/{docId}/retry"
tags: ["Knowledge Bases"]
---

# Retry document ingestion

`POST /v1/knowledgebases/{id}/documents/{docId}/retry`

## Request

- Base URL: `https://api.pyai.com`
- URL: `https://api.pyai.com/v1/knowledgebases/{id}/documents/{docId}/retry`
- Auth: one of:
  - HTTP bearer
  - API key in header `x-api-key`

Re-queue a `pending` or `failed` document for chunking + embedding. Requires the `kb:manage` scope.

## Path parameters

- `id` string, required
- `docId` string, required

## Response `202`

Re-queued for ingestion

- KbDocument: A knowledge base document and its ingestion state.
  - `id` string
  - `kbId` string
  - `orgId` string
  - `source` 'upload' | 'url' | 'api': upload = file, url = fetched page, api = pasted text.
  - `uri` string, nullable
  - `title` string, nullable
  - `filename` string, nullable
  - `mime` string, nullable
  - `sizeBytes` integer
  - `chunks` integer: Indexed chunk count (0 until indexed).
  - `status` 'pending' | 'indexed' | 'failed'
  - `error` string, nullable: Human-readable failure/stall reason.
  - `indexedAt` integer, nullable: Unix ms.
  - `createdAt` integer: Unix ms.

## Other responses

- `404`: Resource not found (`code: not_found`)
- `503`: Document indexing is not configured on this deployment.

---

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