# Reads and pagination

Reads take the key alone: a prefixed key (`ow_w_`, `ow_r_`) never needs the PIN to read. See [Keys and PINs](/docs/getting-started/keys).

## Lists

`GET /api/v2/{type}` returns one page of that element type's elements in an envelope:

<!-- shape: CharacterList -->
```json
{ "data": [], "has_more": false, "next_cursor": null }
```

<!-- shape: CharacterList -->
| Key | Meaning |
|:--|:--|
| `data` | The elements on this page |
| `has_more` | `true` if more pages remain |
| `next_cursor` | Pass it back as `?cursor=` for the next page; `null` on the last page |

## Pagination

Page with `?limit=` (default 100) and `?cursor=`. A `limit` outside 1 to 1000 is clamped into that range; a non-integer is a `422`.

```bash
# first page
curl -s "https://www.onlyworlds.com/api/v2/character?limit=100" -H "API-Key: {key}"

# next page: pass back the next_cursor you received
curl -s "https://www.onlyworlds.com/api/v2/character?limit=100&cursor={next_cursor}" -H "API-Key: {key}"
```

Treat the cursor as opaque: do not parse or build it. Pages come in change order, the order the cursor walks, so each element appears exactly once in a walk. To pull a whole world, or to keep a local copy in sync, use the [change feed](/docs/development/api/changes) instead.

## Single elements

`GET /api/v2/{type}/{id}` returns the bare element object, with no `data` wrapper. An id not in this world is `404` [`not_found`](/api/errors/#not_found), and one this world deleted is `410` [`gone`](/api/errors/#gone), with the deletion's `change_seq` and `deleted_at`; a malformed id is a `422`. An element [hidden](/docs/development/api/hidden) from the key is a `404`, the same answer as an id not in this world, never a `410`. These answers carry `Cache-Control: no-store`, as every answer does that sets none of its own, so a page in a browser that deletes an element and writes it again under the same id reads the element, not a kept `410`.

```bash
curl -s "https://www.onlyworlds.com/api/v2/character/{id}" -H "API-Key: {key}"
```

## What an element carries

Besides its element type's fields (see [the schema](/docs/schema/)), every element read carries:

<!-- shape: Character partial -->
| Field | Meaning |
|:--|:--|
| `type` | The element's type slug, as the first key, so a body identifies itself |
| `id` | The element's UUID |
| `created_at`, `updated_at` | Server timestamps; `updated_at` is always present |
| `change_seq` | The world's change sequence at this element's last write |
| `created_by` | The membership that created the element, or `null` when the owner did ([Members](/docs/development/api/members)). Served to the world's members only: a [keyless read](/docs/development/api/public) carries no such key |
| `changed_by`, `changed_via`, `changed_client` | Who made the last change, through which way in (its door: `site`, `api`, `mcp`, `seat`, `declared`, `v1`, `sync` or `server`), and the name the client gave in `X-OW-Client` (`null` when none); `seat`, `mcp` and `declared` are the doors the platform marks as an AI's ([Agent writes](/docs/development/api/writes#agent-writes)). Served to the world's members only: a [keyless read](/docs/development/api/public) carries none of them |
| `doors` | Each tool that wrote the element, with the time of its last write there: one key per tool, the name it sent in `X-OW-Client` or else the door of that write (`site`, `api`, `mcp`, …), each value the `updated_at` that write left, at most 16 keys (the oldest dropped past that). Stamped from 2026-10-29 on, so an element not written since has none. Members only, like the three above; not on a known-of stub, in the [change feed](/docs/development/api/changes)'s bodies or in a world file. Ignored in a write |
| `hidden` | `true` when the element is [hidden](/docs/development/api/hidden#the-hidden-flag) and this reader still sees it; absent otherwise, never `false`. Ignored in an update; on a create, `true` [creates the element hidden](/docs/development/api/hidden#creating-an-element-hidden) |
| `known_of` | `true` when this reader knows of the element but does not see it whole: a guest's or player's stub, one step out from its own Character ([Known of](/docs/development/api/members#known-of)); absent otherwise. Never writable |

Fields under the extension namespaces `atlas_*`, `shadow_*` and `x_*` appear inline, exactly as they were written. Links read as bare UUIDs: see [Link fields](/docs/development/api/links). Files attached to an element are never in its body: they have their own routes ([Files](/docs/development/api/files)).

## Filters

<!-- shape: GET /api/v2/collective query partial -->
| Parameter | Matches |
|:--|:--|
| `name` | Exact name |
| `name__icontains` | Case-insensitive substring of the name |
| `supertype` | The whole supertype, trimmed and compared without regard to case, as the profiles read it: ` message ` and `MESSAGE` match `Message`, `Messages` does not. Case is compared by simple case folding, from the same Unicode table every reader of the standard uses (since 2026-11-15): `MEſſAGE`, written with two long s, matches `Message`, and `Meßage` does not. An empty value lists the elements with no supertype (since 2026-10-29) |
| `subtype` | The whole subtype, read the same way; an empty value lists the elements with no subtype |
| `characters` | On the six element types with a `characters` link (collective, construct, event, narrative, relation, title): the elements whose `characters` contain that Character id. An empty value lists those with none, such as the [Messages](/docs/schema/profiles/messages) addressed to everyone (since 2026-10-29): since 2026-11-10, every element you are served with `characters` empty and no `x_served_trimmed` naming it, so stored empty or every Character in it hidden from you. A Message whose addressees were all left out for you carries that mark (it is to someone hidden from you, not to everyone) and stays out |
| `operator` | A collective's single link, and since 2026-10-29 each single link of every element type is a filter on its list: `?parent_location=<id>` lists a place's rooms, `?birthplace=<id>` the Characters born there. An empty value lists the elements you are served with that link empty: unset, aimed at an element you cannot see, or a link an element you [know of](/docs/development/api/members#known-of) does not show you (since 2026-11-10; before, it read the stored link, so those were left out). A key with no member behind it (an `ow_r_` or `ow_w_` key the owner made, a classic or demo key) or the owner's account token (with `as`, the reader it names instead), a co-builder's, and a contributor's while no element of the world is hidden are served the stored link, whatever it names, and match on it. Any other reader matches only what it is served: a linked element it cannot see gives the same empty list as an id that names nothing, never a `404`. A malformed id is a `422` naming the field. The API document lists each type's single-link filters on its list operation |
| `ids` | Comma-separated ids, 1 to 200: only these elements, in the list's own order. An id the key cannot see, or that names nothing of this element type, is simply absent. More than 200, or a malformed id, is a `422` with `param` `ids` |
| `created_by` | A membership id, as [`GET /api/v2/members`](/docs/development/api/members#the-roster) lists them: the elements that member created. `owner` selects the owner's own writes (`created_by` `null`). An element the key knows only as [known-of](/docs/development/api/members#known-of) never matches. Anything else is a `422` with `param` `created_by`, and so is the filter on a [keyless read](/docs/development/api/public) |

The Pin list takes one more, for a Pin's [generic link](/docs/schema/element_categories/pin) to the element it places (since 2026-11-12):

<!-- shape: GET /api/v2/pin query partial -->
| Parameter | Matches |
|:--|:--|
| `element` | The Pins you are served whose element is that id, of any element type, so one call gives an element the maps it is pinned on. With `map=<id>` beside it, it says whether that element is on that map; with `expand=map`, each Pin carries its map's name where you can see the map. An empty value lists the Pins you are served with no element. The readers served the stored link (above, at `operator`) match the stored element, whatever it names; for any other reader an element it cannot see, or an id that names nothing, gives an empty list; a malformed id is a `422` with `param` `element` |

```bash
curl -s "https://www.onlyworlds.com/api/v2/character?name__icontains=consul" -H "API-Key: 0000000000"
```

Besides these filters, a list takes the parameters `limit`, `cursor`, `expand`, `fields`, [`as`](/docs/development/api/hidden#view-as) and [`world`](/docs/development/api/public). Any other query parameter is a `422` [`invalid_request`](/api/errors/#invalid_request) whose message lists the element type's filters, so a typo fails loudly instead of returning the unfiltered list:

```json
{ "error": { "type": "invalid_request", "code": "invalid_request",
  "message": "Unknown filter 'foo'. Filters: name, name__icontains, supertype, subtype, ids, created_by, birthplace, location.",
  "param": "foo", "doc_url": "https://onlyworlds.github.io/api/errors/#invalid_request" } }
```

The [TypeScript SDK](/docs/development/typescript) sends these under `filter`: `client.list('character', { filter: { name__icontains: 'consul' } })`. An empty value under `filter` is sent as `key=` (since 4.108.1; until then it was dropped and the list came back whole). A filter written at the top level of the parameters instead, or any key `list` does not know, is a `TypeError` before anything is sent (since 4.51.0; until then the key was dropped without a word and the list came back whole).

**Ordering is not supported.** `?ordering=` is a `422`, and pages always come in change order. Sort on your side.

## Search

`GET /api/v2/search?q=` finds the elements whose name or text holds every word of `q` as a whole word, ignoring case. The text is the name, the description and each element type's own prose fields, such as a Character's background or a Narrative's story; supertype, subtype and `image_url` are not searched. There is no stemming: `drip` does not find "Drippers", and `quiet valley` needs both words somewhere in the element. A word is a run of letters, digits or underscores, so a key like `APP-142` is searched as the two words `APP` and `142`: when a key must appear whole, read the elements found and keep those whose text holds it.

<!-- shape: GET /api/v2/search query partial -->
| Parameter | Meaning |
|:--|:--|
| `q` | Required: 2 to 200 characters, with at least one word of letters or digits |
| `type` | One element type slug; without it, all 22 are searched |
| `limit` | Default 50, clamped into 1 to 200; a non-integer is a `422` |

Any other parameter is a `422` [`invalid_request`](/api/errors/#invalid_request) naming the three.

```bash
curl -s "https://www.onlyworlds.com/api/v2/search?q=drippers&limit=3" -H "API-Key: 0000000001"
```

<!-- shape: GET /api/v2/search -->
```json
{ "query": "drippers",
  "results": [
    { "type": "collective", "id": "069959a3-e99e-7862-8000-f1fb6761af2c", "name": "The Drippers",
      "supertype": "Covert", "subtype": "Cabal", "field": "name", "snippet": "The Drippers" },
    { "type": "pin", "id": "01a1ccc7-9797-7cb3-9ff5-da13873e3fe4", "name": "The Drippers (layout)",
      "supertype": "", "subtype": "", "field": "name", "snippet": "The Drippers (layout)" },
    { "type": "construct", "id": "069945ca-acf6-7764-8000-e085272bf98f", "name": "Puddle Futures",
      "supertype": "Society", "subtype": "Economy", "field": "description",
      "snippet": "is, well, eternal. A small group of traders called 'the Drippers' have noticed micro-fluctuations in delivery volume and are quietly buying long-term" } ],
  "count": 3, "truncated": true }
```

Elements whose name matches come first, then the rest, each by element type and then by name. `field` is where the words were found, and `snippet` is up to 160 characters of that field around the first match. `truncated` is `true` when more elements matched than `limit`; there are no further pages, so narrow the query or raise the limit. A row for an element the reader only [knows of](/docs/development/api/members#known-of) carries `known_of: true` (it matches on what the stub keeps). A guest key searches only what it may read, and no key finds an element hidden from it. The MCP server's [`search_elements`](/docs/development/mcp#read-a-key-or-a-sign-in) runs the same search, and both packages call it: `client.search(q, { type, limit })` in [TypeScript](/docs/development/typescript#read-a-world), `client.search(q, element_type=..., limit=...)` in [Python](/docs/development/python#read-a-world).

## Expansion and sparse fields

Both work on lists and on single elements.

- **`?expand=location,friends`** replaces those links' ids with stub objects, one level deep: `{id, name, supertype, subtype, image_url}`. A field that is not a link is a `422`.
- **`?fields=id,name,description`** returns only the named keys. A name the element type does not have is one `422` for the whole list, `param` `fields`. Since 2026-11-17 it names every unknown name where it named the first: the message lists them, and the error carries `unknown_fields` (each unknown name once, in the order sent), `types_with_field` (for each one another element type has, those types) and `allowed_fields` (the names this type takes), so the list can be corrected in one try. A name under an extension namespace (`atlas_*`, `shadow_*`, `x_*`) is never unknown.

```bash
curl -s "https://www.onlyworlds.com/api/v2/character/{id}?expand=location,institutions" -H "API-Key: {key}"
```

## The world

`GET /api/v2/world` returns the world named by the key, with `counts` beside its fields: how many elements that reader may read, counted as that reader reads them (every reader since 2026-10-27; before, the keyless read only). A world its owner opened to everyone is also read with no key, as `?world=<id>`, and then carries an `owner_character` of `null` ([Public worlds](/docs/development/api/public#the-world-keyless)):

<!-- shape: GET /api/v2/world -->
```json
{ "id": "…", "name": "Hyperion", "description": "", "image_url": "https://i.imgur.com/Damdiwv.jpeg",
  "time_format_names": [], "time_format_equivalents": [], "time_basic_unit": "Year",
  "time_range_min": -300, "time_range_max": 100, "time_range_current": 0,
  "length_unit": "", "mass_unit": "", "distance_unit": "",
  "public_read": true, "agent_narrator_rule": false, "agent_writes_proposed": false, "owner_character": null,
  "slug": null, "public_page": { "on": false, "palette": null, "hero": "", "sections": [], "pin": null, "index": false },
  "origin": { "source": null, "producer": null },
  "created_at": "…", "updated_at": "…",
  "counts": { "total": 35, "types": { "ability": 1, "character": 3, "collective": 1, "…": "…", "zone": 1 } } }
```

`origin` (2026-10-23) is where the world first came from: `{source, producer}`, both keys always present, each the [folder format's provenance line](/docs/schema/folders#worldjson) as the tool that made the world from a folder gave it, or `null`. It is read-only under that name (`origin` in a `PATCH` is a `422`); a tool sets it by sending `source` and `producer` ([Writes](/docs/development/api/writes#the-world)).

**Extension keys** (since 2026-10-23): a World carries keys starting `x_`, `atlas_` or `shadow_` at the top level of its body, as an element does: a tool's own settings on the world, any JSON value up to 200 levels deep (the World record as the first), kept as given. What a key means is its profile's; the first published one is [`x_names`](/docs/schema/conventions), a world's own words for the types. Values come back equal, but the keys inside an object may come back in another order than they were sent.

`agent_writes_proposed` (2026-10-22) is the world's **AI seats propose, a person accepts** switch as its owner set it on the world page: read-only here, a `422` in a `PATCH` like `public_read`, `false` by default; with it `true`, an AI seat's changes to existing elements become [proposals](/docs/development/api/proposals) a keeper accepts.

`slug` and `public_page` (2026-10-22) are the world's public page as its owner set it, read-only here and a `422` in a `PATCH` like `public_read`: `slug` is the page's address, `onlyworlds.com/w/<slug>`, `null` while the page is off; `public_page` carries `on` and the levers (`palette`, one of `midnight`, `daylight`, `parchment`, `brass`, `dusk` or `null` for the house's; `hero`, one line; `sections`, the types shown in their order, empty for all; `pin`, one element's id or `null`; `index`, `false` for now), every key present with the page off. The page is live since 2026-10-23, and each owner turns on their own world's: see [Public worlds](/docs/development/api/public). A tool that writes a world body back strips the two fields. `owner_character` is the Character that is the owner, or `null`. `agent_narrator_rule` is the owner's switch on the world page (AI seats narrate as themselves, [Agents](/docs/development/agents)), read-only here. The response carries an `ETag`; send it back as `If-None-Match` and an unchanged world answers `304`. A `200` validates the key. Updating these fields is on [Writes](/docs/development/api/writes#the-world).

## Guests

A key with the guest role reads only part of a world, and everything else answers as if it did not exist. See [Guests](/docs/development/api/members#guests). An element the owner or a co-builder hid answers the same way to every key it is hidden from: see [Hidden elements](/docs/development/api/hidden).