Skip to content

Writes and bulk

Writes take a write key (ow_w_, a legacy key, a member’s or an AI seat’s key) and the PIN in API-Pin. The PIN is a 4-digit number (1000 to 9999) set on your account in account settings, and it guards writes to every world you own; a member writes with their own account PIN, and an AI seat sends its seat secret (ow_s_…) as API-Pin. A read key on a write route is 403 permission_error. The key names the world, so a body never carries one.

To try a write without an account, use the practice world: its key and PIN are published, anyone may write to it, and it goes back to the same copy every night.

POST /api/v2/{type} creates an element and returns 201 with the full element.

Run sends the sample to the practice world: anyone can read what it makes, and it resets every night at 03:00 UTC.

Terminal windowon the practice world
curl -s -X POST "https://www.onlyworlds.com/api/v2/location" \
-H "API-Key: {key}" -H "API-Pin: {pin}" -H "Content-Type: application/json" \
-d '{ "name": "The Time Tombs", "description": "Structures on Hyperion that move backward through time." }'
  • You may supply an id: any RFC 4122 UUID is accepted, and UUIDv7 is recommended. Omit it and the server mints a UUIDv7.
  • An id that already exists is 409 id_conflict. Element ids are unique across all worlds and every type, so the message says which case it is: the id exists in this world as this type (use PUT to upsert), in this world as another type (the message names it: PUT it there), or in another world (mint a new id). Since 2026-11-11 an id a membership holds (a member’s or a seat’s, in any world) is refused the same way, with a message that says only “in use”: mint a new id. The same holds for a PUT that would create, and for each /bulk item.
  • hidden: true creates the element hidden from its first moment. Only the owner’s keys and a co-builder’s may send it; any other key is 403 hidden_not_allowed and nothing is created.

PUT /api/v2/{type}/{id} creates the element if absent and replaces it whole if present: fields left out are reset to empty. It returns 201 when it created and 200 when it replaced. The path decides the id; an id in the body is dropped. An id held by an element in another world is 409 id_conflict. A PUT that creates takes hidden: true as POST does; one that replaces ignores hidden.

PATCH /api/v2/{type}/{id} changes only the fields sent and returns 200 with the full element.

  • Omitted fields are left untouched.
  • Arrays replace. A PATCH to friends sets the whole list; to add or remove single ids, use the link operations route. A list of links keeps each element once, in its first place, and a null entry in it is a 422 (Links).
  • Extension fields merge by key.
  • To clear a field, send its empty shape:
Kind Clear with
Text "" or null (stored as "")
Number null
Single link null
Multi link []

A client that edits offline, or holds a copy for a while, can ask for the update to land only if nobody else has changed the element since it was read. Send the element’s change_seq (on every element you read) in an If-Match header:

Terminal window
curl -X PATCH https://www.onlyworlds.com/api/v2/character/{id} \
-H "API-Key: ow_w_…" -H "API-Pin: 1234" -H 'If-Match: "41"' \
-H "Content-Type: application/json" -d '{"name": "Fluffington the Bold"}'

If the element is still at change_seq 41 the update applies and the reply’s change_seq is the new one. If it has moved, nothing is written and the reply is 412 precondition_failed, with the element as it is now beside the error, under current, so no second read is needed:

{"error": {"type": "invalid_request", "code": "precondition_failed", "param": "If-Match", "...": "..."},
"current": {"type": "character", "id": "…", "change_seq": 44, "name": "…", "...": "..."}}

The check is per element, not per field, and the server never merges. The client decides: when the fields it changed are not the ones that moved, re-send with the new change_seq; when the same field changed on both sides, ask the user which to keep. To know what moved, keep the copy you edited from beside the edit, not only the new values. A conditional write answered 404 means the element was deleted meanwhile. * or no header means unconditional, as before. The link operations route and DELETE take the same header; PUT and /bulk do not. A deleted element’s id is scrubbed from the elements that linked to it, and each of those takes a new change_seq, so a stale token is refused there too.

DELETE /api/v2/{type}/{id} returns 204. It is idempotent: deleting an element that is already gone also returns 204. Deleting an element removes its id from every other element’s links, and the change feed records the delete as a tombstone. With If-Match (since 2026-10-22) the delete lands only if the element is unchanged since you read it: a moved element answers 412 precondition_failed with current, and nothing is deleted; on an element already gone the tag is no matter and the answer is the same 204. Under a world’s proposals switch a delete is never turned into a proposal.

Every write records the door it came through. An element read carries changed_by (the membership that made the last change, null for the owner) and changed_via, one of:

changed_via The write came through
seat An AI seat’s key
mcp The MCP server
declared A request that sent the X-OW-Agent header
api The v2 API, without that header
v1 The v1 API
sync The mobile app’s sync
server The server, on its own behalf
site The owner, signed in on onlyworlds.com: a hide, a picture taken down, an element’s author changed (every edit the site makes to an element since 2026-10-22). In the TypeScript SDK’s door type from 4.50.0

The first three are the doors the platform marks as an AI’s. An AI writing on a person’s own key says so with X-OW-Agent (any non-empty value; it is never stored) on the element writes: create, upsert, partial update, delete, the link operations route and /bulk. An AI seat’s key is recorded as seat and MCP as mcp without it. A tool people use leaves the header off. A delete’s tombstone in the change feed carries the same pair as deleted_by and deleted_via. All four are null for anything last written before 2026-10-15, and they are ignored when sent in a write body.

A write can also name the tool that sent it (2026-10-22): the X-OW-Client header, the tool’s own name in lower case letters, digits and hyphens, 1 to 32 characters (atlas, lantern, sdk, python). It is read on the writes that record a door (the element writes, the link route, /bulk, adopt) and kept on the element as changed_client, null when no name was sent or the value broke the rule (a bad value is ignored, never a 422), and as that tool’s key in the element’s doors (since 2026-10-29; a write with no name keys its door instead, see Reads); a delete’s tombstone carries it as deleted_client. It is the client’s claim, never proof: it changes no door and no permission, and is ignored when echoed in a write. Recent changes reads a named row “through atlas”.

A seat’s writes can be held for a person’s word (2026-10-22). With AI seats propose, a person accepts on for the world (agent_writes_proposed on GET /world), an AI seat’s partial update, upsert, link edit or /bulk item on an existing element answers 202 with a proposal instead of writing, its new elements carry x_review_proposed, and it deletes only what it created. A person’s key is never held. The whole mechanism, the switch’s reach and the queue: Proposed changes.

The world page on onlyworlds.com shows both in Recent changes: who made each change, with an AI badge for a seat, and the door in words (“through the MCP server”, “through the API, sent by an agent”). An edit made on the site (a hide, a picture taken down, an author changed) reads “through the site”. Since 2026-10-22 an element made inside the window reads “added” rather than “changed”, a hidden one is marked hidden for the readers who see it, a deleted one says its name is not kept, and viewing as the public shows no writer. A new element an AI seat proposed reads “proposed” there until a keeper settles it, and “lapsed” once its expires day has passed (since 2026-10-23). A change by someone whose membership has ended (removed, left, or their account deleted) reads “a former member · through” its door: a changed_by id whose roster row has status removed is a former member’s, never the owner’s.

  • name is required on POST and PUT: the key must be present, and an empty string is accepted.
  • Unknown fields are a 422 naming the field. A misspelled field fails loudly instead of vanishing.
  • Extension fields under the namespaces atlas_*, shadow_* and x_* are accepted, stored as written and returned verbatim, up to 65,536 bytes of extensions per element (counted as compact UTF-8 JSON). More is a 422 with param extensions.
  • Server fields type, created_at, updated_at and change_seq appear on reads and are a 422 on writes. Strip them before sending a read body back.
  • Never write back a body read with ?expand=. Its links hold stub objects instead of ids, and a link field takes only ids. Read without expand when you mean to send the body back.
  • created_by and world in a body are ignored, whatever their value.
  • Text length: name holds up to 255 characters, supertype and subtype 128, image_url 1024. Longer is a 422.
  • Values are coerced where they can be: an integer field accepts "7" as 7, truncates 7.9 to 7, and reads true as 1; a value that cannot become an integer, or one outside -2147483648 to 2147483647, is a 422 naming the field. Text fields turn a number into its digits. Send the types the standard names.
  • A guest’s Narratives are notes narrated by its own Character, with rules of their own: see Guests.

POST /api/v2/{type} and POST /api/v2/bulk accept an Idempotency-Key header (up to 200 characters). The first successful response is stored for 24 hours under that key:

  • An identical replay returns the stored response, with an Idempotent-Replay: true header, and does not write again.
  • The same key with a different body is 409 idempotency_error.
  • While a request with that key is still running, a second one is 409 idempotency_in_flight with Retry-After: 1; retry with the same key and body.
  • Only successful (2xx) responses are stored; errors never are. A /bulk answer is a 200 even when items failed, so it is stored, item errors included, and a replay returns the same errors.

The rule for retries:

  • The answer was lost (a timeout, a dropped connection): retry with the same Idempotency-Key. A stored 2xx replays. On POST /api/v2/{type} the key also holds once the element is written, even when the first answer then failed: the retry returns that element as it is now, with the first status and Idempotent-Replay: true, and never writes a second one (a 409 idempotency_error if it has been deleted since). An error before anything was written frees the key, so the request runs again.
  • A /bulk answer had errors: true: fix the failed items and send them with a new key. Under the same key, an identical body replays the same errors, and a changed body is a 409 idempotency_error.
Terminal window
curl -s -X POST "https://www.onlyworlds.com/api/v2/character" \
-H "API-Key: {key}" -H "API-Pin: {pin}" -H "Content-Type: application/json" \
-H "Idempotency-Key: 6f1c2a9e-3b7d-4e0a-9c55-2f8d1b4a7e10" \
-d '{ "id": "0199a1c2-7d3e-7f00-8a11-3c5e7b9d2f40", "name": "The Consul" }'

A key is held while its request runs, so two sends with it do not both write; the hold and the store are best-effort, not a ledger. Without the header, mint the id on the client: two concurrent creates without client ids can make two elements.

POST /api/v2/bulk creates and upserts up to 1000 elements of mixed element types in one call.

{
"items": [
{ "type": "institution", "element": { "id": "0199a1c2-…", "name": "The Hegemony" } },
{ "type": "character", "element": { "id": "0199a1c3-…", "name": "The Consul", "institutions": ["0199a1c2-…"] } }
],
"atomic": false
}
{
"errors": false,
"items": [
{ "status": 201, "id": "0199a1c2-…", "created_at": "…", "updated_at": "…" },
{ "status": 201, "id": "0199a1c3-…", "created_at": "…", "updated_at": "…" }
]
}
  • An item whose element carries an id upserts that id as PUT does: an element the world holds is replaced whole, and every field and extension the item leaves out is cleared. To change some fields of an existing element, PATCH it. An item without an id creates.
  • Create only (since 2026-11-21): with "create_only": true on the body, every item with an id is created as POST creates it, never replaced. An id this world already holds answers that item’s 409 id_conflict, and the element stays as it was; the rest of the batch goes on as before, and under atomic that item fails the batch like any other. create_only is true, false or null. The packages send it as bulk(items, { createOnly: true }) in TypeScript (since 4.185.0) and bulk(items, create_only=True) in Python (since 0.139.0).
  • The body takes items, atomic and create_only, and an item only type and element. Any other key, on the body or on an item (an op included), a key sent twice, or any query parameter refuses the whole batch with 422 invalid_request naming it, before anything is written (since 2026-11-21). Inside an item’s element the fields are the type’s own, and a field name sent twice there is no 422: the last value is kept.
  • An item that creates may carry hidden: true in its element, as POST does; from a key that may not hide, that item fails 403 hidden_not_allowed.
  • The answer is HTTP 200 once the batch is read. Results are per item, in request order, and each status is what a single write would have returned (201, 200, or an error status).
  • Partial success is the default: one bad item does not stop the rest. Send "atomic": true for all or nothing. In atomic mode, if errors is true nothing was written, even though the items that would have succeeded show 201 or 200.
  • A failed item carries the standard error envelope under error; the top-level errors is true if any item failed. The codes seen per item are listed under Bulk errors.
  • Links are checked against the world plus the batch’s surviving items, in any order, so a batch may reference its own items without sorting. All checks run before any write, and an item that fails also fails the items linking to it.
  • Each success echoes the server’s created_at and updated_at, so a sync client can set its baseline from the bulk response alone.
  • A malformed request (not valid JSON, items not an array, over 1000 items) or an auth failure answers with its own status and the error envelope, not 200.

PATCH /api/v2/world updates the world’s own fields. It takes a write key and PIN and is the owner’s and a co-builder’s: a co-builder may send every writable field but owner_character (so a game master who isn’t the owner can move the world’s now, set its calendar and units, or rename it). A contributor’s or guest’s key, or a co-builder’s sending owner_character, gets 403 owner_only.

Field Type
name, description, image_url, time_basic_unit String
length_unit, mass_unit, distance_unit String of up to 64 characters (see Units)
time_format_names List of strings
time_format_equivalents List of whole numbers, as the standard types it. Strings are still accepted and kept as sent, so an older world may read back strings.
time_range_min, time_range_max, time_range_current Integer or null
owner_character A Character id in this world (the Character that is the owner), or null
x_…, atlas_…, shadow_… Any JSON value: the world’s extension keys (since 2026-10-23). A key sent is set, null removes it, and keys not sent are kept. All of them together hold at most 64 KB as compact JSON, else a 422 with param extensions.
source, producer An object or null each: the folder’s provenance lines, for a tool that makes the world from a folder (source.world and producer.tool strings when present). Read back under origin; origin itself is a 422 here. POST /api/v2/account/worlds takes the same two, and since 2026-10-31 the extension keys too (keys).
Terminal window
curl -s -X PATCH "https://www.onlyworlds.com/api/v2/world" \
-H "API-Key: {key}" -H "API-Pin: {pin}" -H "Content-Type: application/json" \
-d '{ "time_basic_unit": "Year", "time_range_current": 2732 }'
  • Unknown fields are a 422, and the whole patch is refused before anything is written.
  • The world’s name cannot be empty, unlike an element’s.
  • public_read, slug and public_page are the owner’s to set on the world page (Public worlds), and the PIN lives in account settings, not here.
  • Every field sent is applied, so an identical value still moves updated_at. Send only real changes.
  • World fields do not appear in /changes. To follow them, poll GET /api/v2/world and compare updated_at.