---
title: "Write Document Internal"
method: POST
path: "/api/internal/write-document"
tags: ["internal"]
---

# Write Document Internal

`POST /api/internal/write-document`

## Request

- Base URL: `https://api.tintin-x.com` (the document declares no server; this is the origin it was published from)
- URL: `https://api.tintin-x.com/api/internal/write-document`
- Auth: none declared

Write a text document on behalf of an agent. Used by analyzer-worker
atoms that produce markdown / JSON / YAML the agent needs to read back
via `storage.py read-document` (same StorageFile rows the agent's own
`storage.py write-document` creates).

Mirrors track-file's auth + agent-resolution shape; delegates to
`storage_document_service.write_document` so upsert-on-filename, quota
check, and team-scope semantics match the agent's CLI path.

## Request body

- SrcApiRoutesInternalWriteDocumentRequest
  - `agent_id` string, uuid, required
  - `filename` string, required
  - `content` string, required
  - `content_type` string
  - `description` string, nullable
  - `metadata` object, nullable

## Response `200`

Successful Response

- unknown

## Other responses

- `422`: Validation Error

---

[API](https://skmtc.dev/tintin-x/apis/tintin-api.md) · [All operations](https://skmtc.dev/tintin-x/apis/tintin-api/llms.txt) · [OpenAPI document](https://skmtc.dev/tintin-x/apis/tintin-api/revisions/8839a8d0a66c?raw)
