# Documents & content (part 2)

> A section of the Kumkuat API 1.0.0 reference. The rest of it: https://product.tech/docs-kumkuat-ai/api-reference.md (API Reference). Base URL: `https://api.kumkuat.ai`.

## Upload and ingest a file

`POST /api/v1/documents/upload`

Upload and ingest a file with document enrichment and auto tags

### Responses

- `422`: Unprocessable Entity

### Example request

```bash
curl https://api.kumkuat.ai/api/v1/documents/upload \
  -X POST \
  -H 'X-API-Key: <api key>'
```

## Get a specific document

`GET /api/v1/documents/{doc_id}`

Get a document by ID

### Path parameters

- `doc_id` (string, required): Document id.

### Returns (200, object)

OK

- `document` (object, required)
  - `auto_tags` (array of object)
    - `applied_at` (string, nullable)
    - `confidence_score` (number, nullable)
    - `extracted_value` (string, required, for example "Jane Doe")
    - `name` (string, required, for example "Executives")
    - `tag_type` (string, nullable)
  - `character_count` (integer, nullable)
  - `communication_type` (string, nullable)
  - `company` (string, nullable)
  - `content` (string, nullable): Full text; omitted by list endpoints in light mode.
  - `content_type` (string, nullable, for example "transcript")
  - `created_at` (string, nullable)
  - `executive` (string, nullable): Executive the document is attributed to.
  - `extracted_at` (string, nullable)
  - `extracted_date` (string, nullable): When the content was published, as extracted.
  - `id` (string, required, for example "c0a8e2f4-1b7d-4e2a-8c9f-5d6e7a8b9c01")
  - `is_narrative_testing_upload` (boolean, nullable)
  - `media_provenance` (string, nullable): owned, earned or paid.
  - `processing_status` (string, nullable): fetching or enhancing while ingestion runs, failed on error, null when done.
  - `source_url` (string, nullable, for example "https://investors.example.com/q3-call")
  - `tags` (array of string)
  - `title` (string, required, for example "Acme Q3 earnings call transcript")
  - `updated_at` (string, nullable)
  - `url` (string, nullable)
  - `word_count` (integer, nullable, for example 4210)
  - `workspace_id` (string, required)

### Responses

- `200`: OK
- `422`: Unprocessable Entity

### Example request

```bash
curl --globoff 'https://api.kumkuat.ai/api/v1/documents/{doc_id}' \
  -H 'X-API-Key: <api key>'
```

### Example response

```json
{
  "document": {
    "auto_tags": [
      {}
    ],
    "character_count": 0,
    "communication_type": "string",
    "company": "string",
    "content": "string",
    "content_type": "transcript"
  }
}
```

## Update a document

`PATCH /api/v1/documents/{doc_id}`

Only `title` and `extracted_date` can be changed.

### Path parameters

- `doc_id` (string, required): Document id.

### Request body (application/json, required)

- `extracted_date` (string, nullable, for example "2026-09-30"): ISO-8601 publication date to set.
- `title` (string, nullable)

### Returns (200, object)

OK

- `document` (object, required)
  - `auto_tags` (array of object)
    - `applied_at` (string, nullable)
    - `confidence_score` (number, nullable)
    - `extracted_value` (string, required, for example "Jane Doe")
    - `name` (string, required, for example "Executives")
    - `tag_type` (string, nullable)
  - `character_count` (integer, nullable)
  - `communication_type` (string, nullable)
  - `company` (string, nullable)
  - `content` (string, nullable): Full text; omitted by list endpoints in light mode.
  - `content_type` (string, nullable, for example "transcript")
  - `created_at` (string, nullable)
  - `executive` (string, nullable): Executive the document is attributed to.
  - `extracted_at` (string, nullable)
  - `extracted_date` (string, nullable): When the content was published, as extracted.
  - `id` (string, required, for example "c0a8e2f4-1b7d-4e2a-8c9f-5d6e7a8b9c01")
  - `is_narrative_testing_upload` (boolean, nullable)
  - `media_provenance` (string, nullable): owned, earned or paid.
  - `processing_status` (string, nullable): fetching or enhancing while ingestion runs, failed on error, null when done.
  - `source_url` (string, nullable, for example "https://investors.example.com/q3-call")
  - `tags` (array of string)
  - `title` (string, required, for example "Acme Q3 earnings call transcript")
  - `updated_at` (string, nullable)
  - `url` (string, nullable)
  - `word_count` (integer, nullable, for example 4210)
  - `workspace_id` (string, required)

### Responses

- `200`: OK
- `422`: Unprocessable Entity

### Example request

```bash
curl --globoff 'https://api.kumkuat.ai/api/v1/documents/{doc_id}' \
  -X PATCH \
  -H 'X-API-Key: <api key>' \
  -H 'Content-Type: application/json' \
  -d '{"extracted_date":"2026-09-30","title":"string"}'
```

### Example response

```json
{
  "document": {
    "auto_tags": [
      {}
    ],
    "character_count": 0,
    "communication_type": "string",
    "company": "string",
    "content": "string",
    "content_type": "transcript"
  }
}
```

## Delete a document

`DELETE /api/v1/documents/{doc_id}`

Delete a document by ID

### Path parameters

- `doc_id` (string, required): Document id.

### Responses

- `422`: Unprocessable Entity

### Example request

```bash
curl --globoff 'https://api.kumkuat.ai/api/v1/documents/{doc_id}' \
  -X DELETE \
  -H 'X-API-Key: <api key>'
```

## Get auto tags for a document

`GET /api/v1/documents/{doc_id}/auto-tags`

Get all auto tags applied to a specific document

### Path parameters

- `doc_id` (string, required): Document id.

### Returns (200, object)

OK

- `auto_tags` (array of object, required)
  - `auto_tag_id` (string, required)
  - `confidence_score` (number, nullable): 0 to 1.
  - `created_at` (string, nullable)
  - `description` (string, nullable)
  - `extracted_value` (string, required)
  - `extraction` (string, required): Same as extracted_value.
  - `id` (string, required)
  - `name` (string, required)

### Responses

- `200`: OK
- `422`: Unprocessable Entity

### Example request

```bash
curl --globoff 'https://api.kumkuat.ai/api/v1/documents/{doc_id}/auto-tags' \
  -H 'X-API-Key: <api key>'
```

### Example response

```json
{
  "auto_tags": [
    {
      "auto_tag_id": "string",
      "confidence_score": 0,
      "created_at": "string",
      "description": "string",
      "extracted_value": "string",
      "extraction": "string"
    }
  ]
}
```

## Update an applied auto tag value

`PUT /api/v1/documents/{doc_id}/auto-tags/{applied_tag_id}`

Update the extracted value of an applied auto tag for a specific document

### Path parameters

- `doc_id` (string, required): Document id.
- `applied_tag_id` (string, required): Id of the auto tag as applied to this document.

### Responses

- `422`: Unprocessable Entity

### Example request

```bash
curl --globoff 'https://api.kumkuat.ai/api/v1/documents/{doc_id}/auto-tags/{applied_tag_id}' \
  -X PUT \
  -H 'X-API-Key: <api key>'
```

## Download a document's stored file

`GET /api/v1/documents/{doc_id}/content`

Stream the stored file for a document, authorized per request.

### Path parameters

- `doc_id` (string, required): Document id.

### Responses

- `422`: Unprocessable Entity

### Example request

```bash
curl --globoff 'https://api.kumkuat.ai/api/v1/documents/{doc_id}/content' \
  -H 'X-API-Key: <api key>'
```

## Retag a document

`POST /api/v1/documents/{doc_id}/retag`

Retag a document by rerunning all auto tags

### Path parameters

- `doc_id` (string, required): Document id.

### Responses

- `422`: Unprocessable Entity

### Example request

```bash
curl --globoff 'https://api.kumkuat.ai/api/v1/documents/{doc_id}/retag' \
  -X POST \
  -H 'X-API-Key: <api key>'
```

## Get AI comparative analysis for executives or companies on a theme

`POST /api/v1/insights`

Compare what executives or companies say on a theme, with an optional audience read from your personas.

### Request body (application/json, required)

- `companies` (array of string, nullable): Companies to compare, for comparison_type=company.
- `comparison_type` (string, default "executive"): executive or company.
- `executives` (array of string, nullable): Executives to compare, by name.
- `focus_question` (string, nullable, for example "Who is most credible on margin durability?")
- `fresh` (boolean, nullable): Bypass the cache.
- `own_company` (string, nullable): Your company, for the audience layer's 'on you' quotes.
- `personas` (array of string, nullable): Persona ids whose audience read of the comparison to include.
- `strategic_map` (boolean, nullable): Also produce the attack / defend / whitespace map.
- `theme` (string, required, for example "Pricing power"): The theme (signal template) to compare on.
- `themes` (array of string, nullable): Compare across several themes at once.

### Returns (200, object)

OK

- `ai_analysis` (object, required): at_a_glance, similarities, differences, comparison_matrix, unique_perspectives.
- `audience_resonance` (array of object, nullable): Per persona: scores, verdicts, take and quotes; present when personas were given.
- `companies` (array of string, nullable)
- `company_summaries` (object, nullable)
- `executive_summaries` (object, nullable): Per executive: summary, statements, statement_count.
- `executives` (array of string, nullable)
- `focus_question` (string, nullable)
- `strategic_map` (object, nullable)
- `theme` (string, required)
- `themes` (array of string, nullable)
- `total_signals` (integer, default 0)

### Responses

- `200`: OK
- `422`: Unprocessable Entity

### Example request

```bash
curl https://api.kumkuat.ai/api/v1/insights \
  -H 'X-API-Key: <api key>' \
  -H 'Content-Type: application/json' \
  -d '{"theme":"Pricing power"}'
```

### Example response

```json
{
  "ai_analysis": {},
  "audience_resonance": [
    {}
  ],
  "companies": [
    "string"
  ],
  "company_summaries": {},
  "executive_summaries": {},
  "executives": [
    "string"
  ],
  "focus_question": "string",
  "strategic_map": {},
  "theme": "string",
  "themes": [
    "string"
  ],
  "total_signals": 0
}
```
