graphlife Docs graphlife.app

Graph data

11. Inbox (encrypted, review-on-device delivery)

The inbox is a write-only delivery channel for graphs whose owner wants to review every addition on their own device. A sender holding an inbox token submits items; the server encrypts each item at once with the mailbox's public key and stores only ciphertext; the owner's device later fetches, decrypts and reviews them. Nothing submitted through the inbox appears in a server-readable graph, and it cannot be read back through the API in clear text.

For server-to-server integration with a readable graph, use the live endpoint instead.

11.1 Mailbox management (session token)#

Method Path Purpose
PUT /v1/inbox/graphs/{graphId}/key Register or rotate the mailbox's X25519 public key
POST /v1/inbox/graphs/{graphId}/tokens Create an inbox token for that graph
GET /v1/inbox/tokens List active inbox tokens
DELETE /v1/inbox/tokens/{tokenId} Revoke a token
GET /v1/inbox/graphs/{graphId} Fetch pending encrypted items
POST /v1/inbox/{itemId}/ack Mark an item as collected
DELETE /v1/inbox/graphs/{graphId} Retire the mailbox: revoke its tokens, drop its items and key

Two account-wide routes from an earlier version remain for existing data: PUT /v1/inbox/key and GET /v1/inbox. POST /v1/inbox/tokens (creating an account-wide token) has been withdrawn and answers 410 unbound_tokens_retired.

Route Request Response 200 (or as stated)
PUT…/key {"public_key": "<base64 of 32 bytes>"} {"status": "ok", "orphaned_items_dropped": 0, "graph_id": "…"}. Rotating to a different key deletes uncollected items, which could no longer be decrypted.
POST…/tokens {"label": "…"} (optional) 201 {"token_id": "…", "token": "glin_…", "graph_id": "…"}. The token is shown once.
GET/v1/inbox/tokens — {"tokens": [{"token_id", "label", "graph_id", "created_at", "last_used_at", "use_count"}]}
DELETE/v1/inbox/tokens/{id} — {"revoked": "<id>"}
GET/v1/inbox/graphs/{id} — {"items": [{"item_id", "sealed", "kind", "created_at"}], "pending": 12, "returned": 5}
POST/v1/inbox/{itemId}/ack — {"acked": "<itemId>"}
DELETE/v1/inbox/graphs/{id} — {"status": "ok", "tokens_revoked": 1, "items_dropped": 4}

Paging of pending items: one response holds at most 100 items and at most about 6 MB of ciphertext (always at least one item), oldest first. pending is the true number outstanding. Acknowledge the items you have processed and call again to receive the next page; items are returned again until acknowledged.

Errors: 400 bad_graph_id, 400 missing_public_key, 400 bad_public_key, 401 unauthorized.

11.2 Delivery (inbox token)#

POST /v1/mcp accepts JSON-RPC 2.0 requests authenticated with an inbox token. It is intended for AI assistants but can be called by any HTTP client.

JSON-RPC method Purpose
initialize Handshake.
tools/list Describes the four tools below with their input schemas.
tools/call Submits an item. params is {"name": "<tool>", "arguments": { … }}.
Tool Arguments
add_to_graph entities, relations (as in section 5.5), optional sourceText
add_capture text (required)
update_node sourceText (required), target {"label" (required), "kind"}, optional label, attributes, aliases, validFrom, validTo
add_document filename and dataBase64 (required), optional mediaType, docType, label, attributes, sourceText. Maximum file size 4 MB.

A successful call returns a JSON-RPC result confirming that the item was queued. The arguments are only checked for presence, size and valid base64; the content of entities and relations is validated later, on the owner's device, so a queued item is not a guarantee that anything will be added. Invalid arguments and an unknown tool name return a JSON-RPC error with code -32602; a missing mailbox key returns -32000; an unknown method returns -32601. These JSON-RPC errors are delivered with HTTP status 200. HTTP-level errors: 401 unauthorized, 429 rate_limited.