# Ingest API

> Push notes, exports and transcripts into a workspace's sources over HTTP.

The ingest API saves documents as sources without setting up a connector.
Re-pushing a document with the same ID updates it, so imports are safe to
run again.

## Authentication [#authentication]

Create a credential with **Read, write, and ingest sources** access in
**Agents**. See [Credentials](/docs/credentials). Then:

```sh
export COZY_WORKSPACE="WORKSPACE_UUID"
export COZY_TOKEN="cozy_..."
```

To save one thing without a workspace ID, use `POST /api/save`. See
[Save to Cozy](/docs/agents/save#with-one-request).

## Push JSON [#push-json]

```sh
curl -X POST "https://cozy.cloud/api/wiki/workspaces/$COZY_WORKSPACE/ingest" \
  -H "Authorization: Bearer $COZY_TOKEN" \
  -H "content-type: application/json" \
  -d '{"documents":[{"id":"https://example.com/post","content":"# Post\n..."}]}'
```

| Field | |
| --- | --- |
| `documents` | Up to 25 documents |
| `documents[].content` | Required. Markdown, text, CSV or JSON, up to 1.5 MB |
| `documents[].id` | A stable ID, such as a URL, file path or message ID. Defaults to the content's SHA-256 |
| `documents[].title` | Defaults to the frontmatter title, first heading or first line. Clipped at 200 characters |
| `documents[].url` | Where the original lives |
| `documents[].updatedAt` | ISO 8601 time the original last changed |
| `connectorId` | A Files connection. Defaults to the Inbox |

## Push raw text [#push-raw-text]

Send one file as the body, with metadata in the query string:

```sh
curl -X POST "https://cozy.cloud/api/wiki/workspaces/$COZY_WORKSPACE/ingest?id=notes/2026-11-08.md" \
  -H "Authorization: Bearer $COZY_TOKEN" \
  -H "content-type: text/markdown" \
  --data-binary @notes/2026-11-08.md
```

Raw bodies can be `text/plain`, `text/markdown`, `text/csv` or
`application/octet-stream`, and need a bearer credential. A signed-in browser
session must send JSON, which keeps other sites from pushing on your behalf.

## The response [#the-response]

The response counts what happened to each document: `created`, `updated`,
`unchanged`, `suppressed`, `retired` and `skipped`, and lists the source
`files`.

- **unchanged**: the content matched what's stored. A changed `updatedAt`
  alone isn't a new revision.
- **suppressed**: someone deleted that source in Cozy, so it's never imported
  again.
- **skipped**: the document was malformed, such as missing content, not text,
  too large or a repeated ID. It's listed with a reason and the rest of the
  batch still saves.

Pushes are your own files, so the last push wins, even if its `updatedAt` is
older.

## Large documents [#large-documents]

A single document can be up to 1.5 MB. Send a longer one in parts, with
`group` set to the base ID, and `parts`. When a later push sends fewer parts,
Cozy retires the parts it no longer sends, and the old unsplit document, and
brings them back if they're sent again.

## The Inbox [#the-inbox]

Documents without a `connectorId` go to the built-in **Inbox**, created the
first time it's needed. If you pause it in **Connectors**, pushes are
refused until it's resumed. If it's disconnected, default pushes stop for
good: pass another Files connection's `connectorId` instead. The Inbox counts
toward the workspace's 50 connections.

Agents push with `cozy_ingest`, which takes the same documents. See
[MCP server](/docs/mcp#ingest).

