Trait

List trait elements

Changed on

Lists every element, a parlor's room included: the room profile (https://github.com/OnlyWorlds/schema-dist/blob/main/profiles/room.md) names the elements a room is made of, which the site's lore views and the MCP tools leave out by default, and this route serves them like any element, for sync clients and writers. A tool that signs you in with OnlyWorlds may read with that sign-in instead of a key: send its account token as Authorization: Bearer ow_a_... with world=<id>, and the read answers as your own access in that world.

get/api/v2/trait

Request

  • Base URL
    https://www.onlyworlds.com
  • Auth
    • API key in header API-Key
    • or API key in header API-Key and API key in header API-Pin
    • or HTTP bearer
    • or none

Query parameters

limit, integer

Page size; clamped to 1-1000 (/changes refuses over 1000 instead). A non-integer is a 422.

cursor, string

Opaque: the next_cursor of the previous page.

expand, string[]

Comma-separated link fields whose ids are replaced by ElementStub objects (one level deep). A field that is not a link is a 422.

fields, string[]

Comma-separated sparse fieldset: only these keys are returned, so type and id only when named. Accepts: type, id, name, description, supertype, subtype, image_url, social_effects, physical_effects, functional_effects, personality_effects, behaviour_effects, significance, charisma, coercion, competence, compassion, creativity, courage, anti_trait, empowered_abilities, created_at, updated_at, change_seq, created_by, changed_by, changed_via, changed_client, doors, or any extension field name. Anything else is one 422 for the whole list: its message names every unknown name, and its error carries unknown_fields (those names), types_with_field (for each one another type has, those types) and allowed_fields (this type's field names). With expand, a link is expanded only if it is also named here.

name, string

Exact match on name.

name__icontains, string

Case-insensitive substring match on name.

supertype, string

The whole value, trimmed and compared without regard to case, as the profiles read a supertype or subtype: message and MESSAGE match Message, Messages does not; a stored value is trimmed too. An empty value lists the elements with no supertype (or subtype): one that is empty once trimmed.

subtype, string

The whole value, trimmed and compared without regard to case, as the profiles read a supertype or subtype: message and MESSAGE match Message, Messages does not; a stored value is trimmed too. An empty value lists the elements with no supertype (or subtype): one that is empty once trimmed.

anti_trait, union
string uuid
OR
string

A Trait id: the elements whose anti_trait is this id. 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 anti_trait, whatever it names, and match on it. Any other reader is served anti_trait null where it names no Trait it can see, and on an element it knows of only as a stub (known_of), whatever the stub stores; it matches only what it is served: a Trait it cannot see gives the same empty list as an id that names nothing. An empty value: the elements this reader is served with anti_trait null. A malformed id is a 422 (param anti_trait).

ids, string[]

Comma-separated ids: only these elements, in the list's own order. An id this key cannot see, or that names nothing of this type, is simply absent. Combines with the other filters. More than 200, or a malformed id, is a 422 (param ids).

created_by, string

A membership id (as GET /members lists them): the elements that member created. owner selects the owner's own writes (created_by null). Reads within what this key may see; an element this key knows only as known_of never matches (its created_by reads null). Anything else is a 422 (param created_by).

as, string

View as (the owner's keys only: a key with no member): read as another reader would. A membership id of this world (a person, an AI seat or a player seat) reads as that member's own key, its own creations included; a Character id reads as a guest of that Character with no membership (what it knows, the roster, nothing counted as its own); public reads everything that is not hidden. A hidden element is the plain 404, never a 410. An unknown value is a 422 (param as); a member key sending it is a 403 view_as_owner_only. Writes, /changes, /members, /me, the world and the files routes do not take it (422).

world, string uuid

The id of a world to read without the key that owns it, by one of two readers: keyless, the id of a world its owner opened to the public (only while the public reader is on); or with an account token, the id of a world the account holds. Keyless (the public reader), the read answers what anyone may read there: every element not hidden, with links to hidden elements stripped and its pictures as fields; no files, no roster, no tombstones (a deleted id is the plain 404), and Cache-Control: no-store. A world that is not open, and an id that names no world, are the same 404. A keyless request counts against the per-address budget. With a key, world may name the key's own world by its id (ignored); any other value, the key's own slug and its id without hyphens included, is a 422 (param world). While the public reader is off, world beside a key is no parameter: a list route refuses it as an unknown filter (422, param world) and a get route ignores it. With an account token instead of a key (Authorization: Bearer ow_a_...), world names the world it reads: the owner reads it whole, a member as its own member key reads, and an account with no access there as the public reads (the same 404 for a world that is not open).

Response

A page, oldest change first (by change_seq, then id). With ?fields= the body holds only the named keys (not this schema's required set); with ?expand= each named link holds ElementStub objects instead of ids.

TraitList required
data, Trait[] required
has_more, boolean required
next_cursor, string nullable required

Pass back as cursor for the next page; null on the last.

Changes

    • info

      added the optional property error/limit to the response with the status

    • info

      added the optional property error/limit to the response with the status

    • info

      added the optional property error/limit to the response with the status

    4 more changes in this revision