Elffuss BraidHub

kikocis/utopia public

dev · 4.8 KiBSourceRawPermalink

Ingest interfaces

Utopia pulls or receives documents through sources. Two source kinds speak JSON and are meant for integration: Custom (Utopia polls your service) and API (your service pushes to Utopia). Both share the same identity semantics: every item has a stable ID, and pushing or returning the same ID again updates the same document in place — the previous content is kept as a version, search re-indexes, and the knowledge graph re-extracts.

Choosing between them

Custom (pull)API (push)
Who initiatesUtopia, on a scheduleYour service, any time
AuthOptional header you configurePer-source Bearer token
FitsFeeds, exports, periodic snapshotsEvent-driven systems, scripts, CI
Deletion signaldeleted array in the responsedeleted: true in a push

Custom source — the pull interface

Create a Custom source and point it at any URL you control. On every sync (manual, interval, or cron) Utopia sends:

GET {endpoint}?since=2026-08-26T19:43:24Z
Authorization: <your configured header, if any>

Respond with JSON:

{
  "items": [
    {
      "id": "note-42",
      "title": "Deployment runbook",
      "content": "# Runbook\nRestart the ingest worker before each release.",
      "doc_time": "2026-08-20T09:00:00Z",
      "mime": "text/markdown"
    }
  ],
  "deleted": ["note-17"]
}

Field reference:

FieldRequiredMeaning
idyesStable identity within this source. Same id + new content → the document is updated in place.
titlenoDisplay name; the file extension is inferred from mime when missing. Defaults to id.
contentyesFull text of the item (not a diff).
doc_timenoRFC 3339. Becomes the document's time axis position — feed the real publish/effective time whenever you have it.
mimenotext/markdown (default), text/plain, or text/html.
deletednoArray of ids your source has retired. Matching documents are marked "Not in source", never auto-deleted — a person decides in the Library. Returning an item again clears the mark.

Notes:


API source — the push interface

Create an API source; it gets its own push token (view or rotate it from the source's Token dialog). Then:

POST {your-utopia-base}/api/v1/sources/{source_id}/ingest
Authorization: Bearer utp_…
Content-Type: application/json
{
  "filename": "runbook.md",
  "content": "# Runbook\nRestart the ingest worker before each release.",
  "doc_time": "2026-08-20T09:00:00Z",
  "external_id": "note-42"
}
FieldRequiredMeaning
filenameyesDisplay name; also the fallback identity when external_id is absent.
contentyes*Full text. Optional when deleted is true.
doc_timenoRFC 3339; the document's position on the time axis.
external_idnoStable identity. Same identity + new content → update in place. Without it, filename is the identity.
deletednotrue marks the identified document "Not in source" (tombstone). A later normal push of the same identity revives it.

The response tells you what happened:

{ "action": "created" }

created · updated · moved (same content, new name) · unchanged · marked_missing.

Example with curl:

curl -X POST "https://utopia.example.com/api/v1/sources/01a0…/ingest" \
  -H "Authorization: Bearer utp_…" \
  -H "Content-Type: application/json" \
  -d '{"filename":"runbook.md","content":"# Runbook v2 …","external_id":"note-42"}'

Shared semantics