Python package
New to OnlyWorlds? Your first hour reads a world, writes to the practice world and deletes again, in one short page. This page covers the whole package.
onlyworlds is the Python package for OnlyWorlds. It reads and writes the world folder format, pushes a folder’s changes to a world, and has a client for the REST API v2. It needs Python 3.12 or later and has no runtime dependencies.
The element types and the kind of every field are generated from schema-dist, never listed by hand. The package’s version is its own and does not track the schema’s.
Install
Section titled “Install”pip install onlyworldsReleases are on PyPI, each listed in the changelog. Until 1.0, the interface can still change between minor versions.
Read a world
Section titled “Read a world”from onlyworlds import Client
client = Client("0000000001") # the public demo key for Moppetopia; your own world's ow_r_ key works the same, no PIN
for character in client.iter_elements("character"):
print(character["name"])This runs as written. A write key also takes a PIN: Client(key, 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 the PIN. The client sends it only where the server checks it (since 0.27.0): on writes, on me(), and on every call with a 10-digit legacy key; a prefixed key’s reads go without it.
Elements are plain dicts. Two demo keys read public sample worlds: 0000000000 (Hyperion) and 0000000001 (Moppetopia). client.search("Fluffington", limit=200) finds the elements whose name or text holds every word you give (Search).
client.get_world()["counts"] says how many elements the key may read, in all and per type: {"total": …, "types": {"character": …, "location": …}}. client.get("character", element_id) reads one element. To keep a whole world as files, export_world("moppetopia", api_key="0000000001") writes it as a folder (one that does not exist yet), and read_folder("moppetopia") reads it back; both are imported from onlyworlds.
The example reads the write key and PIN from the environment. These two are the practice world’s, which anyone may write to and which goes back to the same copy every night; for your own world, put in its ow_w_ key and your PIN.
export OW_API_KEY=ow_w_QRRMlAFPF9vPZSqmiV6QJm2HDJH_sP28x2RccPmYP1A
export OW_API_PIN=1234import os
from onlyworlds import Client
# the write key and its PIN from the environment (OW_API_KEY, OW_API_PIN), never in the code
writer = Client(os.environ["OW_API_KEY"], os.environ["OW_API_PIN"])
ranger = writer.create("character", {"name": "Ilse the Ranger"})
peak = writer.create("location", {"name": "Dragon Peak"})
writer.patch("location", peak["id"], {"supertype": "Mountain"})
# add or remove links on a multi-link field without replacing the list
writer.edit_links("location", peak["id"], "founders", add=[ranger["id"]])
# read one back, then delete it
print(writer.get("character", ranger["id"])["name"])
writer.delete("character", ranger["id"])delete removes the element and takes its id out of every link to it. A read of it afterwards raises ApiError with status 410 and code "gone", not a 404.
create gives an element without an id one, and always sends an Idempotency-Key. So retrying a create after a lost answer is safe: it replays the stored result instead of making a second element. patch replaces every field it sends, and a list replaces the whole list. Use edit_links to add or remove links. bulk takes up to about 1,000 {"type", "element"} items: it succeeds partly by default (check each slot’s status), or all or nothing with atomic=True.
Since 0.43.0 create, upsert and bulk send hidden as the element carries it, so an element hidden in a folder is created hidden from its first moment. Before, they stripped it and such an element was created visible: a behaviour change. Only the owner’s keys and a co-builder’s may send true; any other key gets a 403 hidden_not_allowed (ApiError.is_hidden_not_allowed; in bulk, that slot’s 403) and nothing is created. An update never sends it: patch, propose and push strip it as before.
If your script is an AI agent, say so: Client("ow_w_...", "1234", agent=True) (since 0.3.0) sends X-OW-Agent on its element writes, and OnlyWorlds records your writes as an AI’s. A tool people use leaves it off. Each element read carries changed_by and changed_via, the last write’s member and door (seat, mcp and declared are the doors marked as an AI’s). See Agents.
Name your tool: Client("ow_w_...", "1234", client="atlas") (since 0.21.0) sends X-OW-Client on every element write (and on a proposal, its accept and a review), never on a read or another write, and OnlyWorlds keeps the name on the element as changed_client (a write can name its client). The default is python; a name outside lower case letters, digits and hyphens, 1 to 32 characters, is a ValueError at construction. changed_client and a tombstone’s deleted_client are read-only and never pushed.
Follow changes
Section titled “Follow changes”walk = client.walk_changes(saved_cursor) # None for everything
for op in walk:
... # op["op"] is "upsert" or "delete"
saved_cursor = walk.cursor # opaque: persist it, never parse itTo poll cheaply, client.head() (since 0.22.0) reads GET /changes?head=true and answers {head, cursor, epoch, unchanged} without reading any element. The poll is conditional: the client keeps the ETag of its last 200 and sends it back as If-None-Match, so an unmoved head is a 304 keel does not count against your budget, answered as the head it holds with unchanged=True; a 409 clears the tag. Walk only when head or epoch differs from what you last applied, so a walk that failed is walked again on the next tick.
A delete’s op["reason"] is deleted, or hidden for an element hidden from the key: remove it from your copy either way. If the feed refuses a cursor (is_resync_required on the error), walk again from the start and keep what your copy holds that the new walk does not name. The error’s resync_reason says which: "role" (your own role or membership moved), keep it; "view" (something left your view), drop it. A tool never empties a copy on its own (What a reset keeps). See Sync with changes.
Export to OKF
Section titled “Export to OKF”Since 0.6.0 a world folder can be exported as a valid Open Knowledge Format (OKF) 0.2 bundle, as that spec stands at one pinned commit (onlyworlds.okf.OKF_COMMIT; the format has since moved to this repository and to 0.3). It needs the okf extra, which adds PyYAML; the rest of the package stays dependency-free.
pip install "onlyworlds[okf]"
python -m onlyworlds.okf my-world my-world-okfEach element becomes one markdown file: its fields and links in the frontmatter, its text under headings, its links again as markdown links (in-prose ow:// references included, in every address form that names one of the world’s elements since 0.74.1: with a moment, a lens, or the world’s own id, and since 0.124.0 only a type word that is one of the 22 in lowercase; one to another world stays as written). The World becomes world.md (without its api block), and there is an index per type and one for the bundle. A known-of stub keeps known_of: true in its frontmatter (since 0.10.2), so it never reads as a whole element. Since 0.43.0 a hidden element (any value of hidden but absent, null and false, the test folder.is_hidden) is left out unless --hidden (hidden=True on build_bundle or export_okf), since a bundle is handed on: no file, no index line, every link to it left out (never a urn:uuid:), an in-prose reference reduced to its own label, and the count in OkfReport.hidden_left_out and in world.md’s onlyworlds_export block. Kept, its frontmatter carries hidden: true and every link and index line to it says (hidden). A world with no hidden element exports byte for byte as before. The same folder always gives the same bytes, and anything left out is listed in the report (on stderr from the command line). A bundle is a copy to read elsewhere, never a folder to sync: it carries no change_seq, no record of who wrote what, and not the world’s key.
Proposed changes
Section titled “Proposed changes”Since 0.26.0 a member can propose a change for a keeper to accept instead of writing it, and a world’s owner can make every AI seat work that way.
row = client.propose("character", cid, {"reputation": "Feared"}, evidence="Chapter 12", expires=None)
page = client.world_proposals(state="open") # newest first; keepers see every row, others their own
for p in client.walk_world_proposals(state="open"): ... # every page
accepted = client.accept_proposal("character", cid, row["id"]) # {"proposal", "element"}: the keeper's own write, one feed row
client.decline_proposal("character", cid, row["id"], reason="not yet")
client.withdraw_proposal("character", cid, row["id"]) # the proposer's
client.review_new_element("character", eid, "accept") # a seat's new element: accept clears the mark, "decline" deletes itSince 0.35.0 the queue holds two kinds of row, told apart by kind: proposals ("proposal", fields only what differs, omitted what a PUT left empty) and a seat’s marked new elements ("new_element"), settled with review_new_element; an unmarked element raises an ApiError with is_not_proposed. The walker sends next_cursor back as it came.
propose cleans its fields as patch does and always sends an Idempotency-Key; accept_proposal sends none, as the document declares none. With AI seats propose, a person accepts on for the world (agent_writes_proposed on get_world(), read-only; patch_world drops it), an AI seat’s patch, upsert or link edit answers 202 and the client raises ProposedError (err.is_proposed, err.proposal) rather than returning a body that is not the element; a bulk slot with status 202 stays in the result, listed on BulkResult.proposed; push counts a 202 as proposed, never as pushed, and never files the same proposal twice. An accept that finds a proposed field moved raises StaleProposal (409, .conflicts, .current); the other codes are is_own_proposal, is_proposed_only, is_too_many_open and is_field_not_visible. The doctor’s flag 12 reports the queue’s open and lapsed rows through the API.
The Markdown pack
Section titled “The Markdown pack”Since 0.25.0 a world can be packed as a few merged Markdown files for an AI notebook that caps its sources: NotebookLM (50 sources a notebook, 500,000 words a source) and Claude Projects (30 MB a file). No extra is needed.
python -m onlyworlds.pack my-world my-world-pack # a world folder
OW_API_KEY=... python -m onlyworlds.pack --api my-world-pack # an account world; a read key needs no PIN
python -m onlyworlds.pack my-world OUT --rooms --extensions # keep room elements and x_ fields
python -m onlyworlds.pack my-world OUT --proposed # keep unreviewed AI elements, labelled
python -m onlyworlds.pack my-world OUT --hidden # keep hidden elements, labelled (0.43.0)00-world.md opens with a line saying which kind of key made the pack (since 0.26.1: the owner’s, a member’s with its role, a Character’s view, or the public view; from /me or the folder’s exported_as, no line when neither says, never the key: a pack holds only what its key was served), then holds the world’s own fields and an index of every element by type (name, supertype and subtype, the first sentence of the description); then one file per element type present, in schema order, each element a ## Name section with its id, its fields in schema order as **Field:** paragraphs, and every link written as the name and type of the element it points to, so a reader needs no other file to follow it. Prose is escaped so a line inside a field never reads as a heading. A known-of stub carries one line saying that only the fields shown are known. Room elements are left out unless --rooms, and x_*, atlas_* and shadow_* fields unless --extensions; the command’s sentence counts both. A file past --words (400,000) or --bytes (25,000,000) splits at element boundaries into numbered parts; when the parts would pass --files (50), the smallest adjacent whole files merge into one named by their types; an element larger than a cap is written alone and named, never cut or dropped. Only a pack that cannot meet --files exits 1, and every file is still written. The same world gives the same bytes. Beside it: an OKF bundle is one file per element with frontmatter and links as paths, for a knowledge tool that follows links; the pack is merged prose for a notebook that reads it whole.
A world with its own words for the types (the names profile, x_names in world.json) is packed in them, the standard’s name in brackets for the AI reading it: ### Employees (Character), *AI agent (Character, Agent) · id …* (since 0.31.0). File names and links keep the standard’s type, and the map itself is never printed among the world’s fields.
An element marked proposed that no keeper has settled yet (it carries x_review_proposed with a value, whoever wrote the mark) is not canon, so since 0.36.0 the pack leaves it out unless you pass --proposed (proposed=True from Python). 00-world.md’s opening lines say how many were left out, as “marked proposed and not yet reviewed by a keeper” (since 0.117.1). A kept one is labelled “proposed, not yet reviewed” under its id line, on its index line and on every link to it, and a link to one left out names it with the same label. This is the reader rule for any tool that hands a world on to an AI: an unreviewed element passed on as canon is where a planted instruction would get through.
A hidden element is hidden from whoever the world is handed to, never from its holder, and a pack is handed on: since 0.43.0 the pack leaves one out unless you pass --hidden (hidden=True on build_pack, pack_world, pack_folder and pack_api). 00-world.md’s opening lines count what was left out (*1 hidden element is left out of this pack.*), as do PackReport.hidden_left_out and the command’s line. Unlike a proposed element, one left out is never named: a link to it is left out (PackReport.hidden_links_left_out) and an in-prose reference keeps only its own label. A kept one is labelled hidden under its id line, on its index line and on every link to it (Cy (character, hidden)). A world with no hidden element packs byte for byte as before. export_world and write_folder copy a world and keep the mark.
Check a world
Section titled “Check a world”The doctor (since 0.11.0) reads a world and reports what its keeper should look at, each finding with the element and the reason. It never writes: no file, no API write; its only product is the report.
python -m onlyworlds.doctor PATH/TO/WORLD-FOLDER # a folder
OW_API_KEY=... OW_API_PIN=... python -m onlyworlds.doctor --api # an account world; a read key needs no PIN
python -m onlyworlds.doctor PATH --json # the same report for a tool
python -m onlyworlds.doctor PATH --packet # the findings as work packets (0.12.0)What it checks: a link to an element that is not there; an Event ending before it starts; an element with no links in or out; two elements whose names collide once folded (within one type); a known-of stub never filled, and an element with no text in any of its type’s text fields (a Law’s text is in declaration and purpose, a Narrative’s in story, so description alone is never read); a charter untouched after many changes (through the API); the world’s own house rules (since 0.24.0: the checks profile, x_checks_rules on the Charter: each rule’s sentence with how many elements it scoped and which fall short, and a rule the doctor cannot apply named as not checked, never passed; only the world’s Charter counts: since 0.82.0 the newest marked Charter (the charter profile), through the API the one keel names in front_door, and every other marked Charter is reported with its rules not applied; only a keeper sets the mark, so a seat cannot write the rules it is judged by); a world that maps a software ecosystem (since 0.45.0, on a world whose elements carry x_spine_ keys: each element read under the spine profile, an off-list kind, a value the reader left out and a probe off the probe form named, then each row kept by exactly one Seat through the Title’s field for the row’s own type, every x_spine_depends_on id in the world, a legacy or provenance row named by an Event with supertype Retirement in x_spine_retires and linked through its typed field where the type has one (a Law by the key alone, since 0.48.0), a row still at gone, and no two rows of one type sharing a name once folded; on a projection, a World carrying x_spine_projection (its source a world’s UUID, its at an ISO time), only the projection’s checks run: x_spine_owner on every row and nothing hidden; whether a probe passes is named as not checked); and, on a folder, a stale format_version and a key committed in a tracked world.json. Each flag says how much it could compare, and a flag that cannot run on that door is listed with its reason, never counted as clean. Findings on messages and room things are listed apart and kept out of the headline count: a message by the message profile, a room element by the room profile’s type and supertype pairs (Work item, Report, Board and the like) together with its mark x_room_of (since 0.118.0). A room pair without the mark is read as lore by every tool, so a finding on it counts with the rest; a house rule that asks for the mark lists each element made without it. Exit code 0 when clean, 1 with findings, 2 when nothing could be read. The judgement half, re-reading a claim against its source, is a separate recipe that takes the doctor’s findings as its targets.
The lint (since 0.51.0) checks a world folder’s shape rather than what it says: a file outside the 22 type folders, a missing or duplicate id, a key that is not a field of its type, a value of the wrong shape, a link that does not resolve inside the folder or points at the wrong type.
python -m onlyworlds.lint PATH/TO/WORLD-FOLDERIt is schema-dist’s own folder checker, carried inside the package at its schema pin, so it gives the same report as the dist’s command and needs no YAML library or copy of the repository. One line per problem, then the count it checked; exit 0 when clean, 1 with problems, 2 when the folder is not a world folder. From code, onlyworlds.lint.lint(folder) returns the report.
--packet (since 0.12.0) prints the same findings as work packets, the packet extension profile (schema-dist profiles/packet.md): a JSON array of Relations with supertype Work item and no id, each with one entry per element under x_packet_elements ({type, id, reason}, in flag order), the same ids on the Relation’s typed link fields, x_packet_source ({server, world}, the server null for a folder) and x_packet_producer (onlyworlds doctor and its version). Empty when clean; split past the extension cap into (i of n) packets. Findings on messages and room things, and a finding on the world itself, stay in the report. A tool that lands a packet in a world or a parlor mints its id; the doctor still writes nothing.
What it covers
Section titled “What it covers”- World folders:
read_folderandwrite_folderimplement the folder format (v0.3.24 since 0.126.0,FORMAT_VERSION; a folder’s existing stamp is kept, older stamps read as before). A world’soriginis carried as given, fromGET /worldor a readworld.json, and never derived. An export writes theproducerline as the folder’s maker ({"tool": "onlyworlds", "version", "input": "server"}); a tool that runs the export in its own name passesproducer=with its own line. A folder written from another folder keeps the line it carries. Since 0.37.0pushsends nothing for an element whose folder copy carrieshidden: truewhile the server’s does not, and names it inPushResult.hidden: the server takes the hidden mark only through its own route, so a patch would edit an element every reader still sees.patch_worldnever sends the folder-only keys (format_version,source,exported_as,producer,writable,api,snapshot_*) and pass its shared conformance fixture. Since 0.9.0 a known-of stub is written without its unset fields (since 0.10.0 with every field it was served with a value, such as a Character’s public fields;PUBLIC_FIELDSlists them per type), flagged on read (folder.known_of,is_known_of), never pushed (PushPlan.known_oflists it), and refused by the client’s writes before anything is sent. The reader never changes a folder. It skips a file that is not JSON, not an object or has noid, and since 0.5.1 a dot-prefixed file in a type folder (a tool’s litter, not an element);folder.skippedlists each with the reason. An element found in both the currentelements/layout and Atlas’s olderspatial/one is served fromelements/, andfolder.in_both_layoutslists it (since 0.5.0). - Archives (since 0.17.0):
read_world_file(path_or_bytes)opens a.owworldfile as the folder format’s archive rules say (the directory checked before anything is inflated; a refusal isWorldFileErrorwithreasonone of the twelve causes, under the same names as the TypeScript SDK’s; since 0.45.1 two names that are one after NFC and simple case folding are compared at Unicode 15.1, built from Unicode’s own files rather than the interpreter’s, and the NFC is exported asonlyworlds.worldfile.nfc) and.to_folder(dest)writes it out as a folder;write_world_file(folder, path, top_dir=None, private_dir=None)andworld_file_bytes(folder)write one: themimetypemarker first and stored, every entry stamped 1980-01-01 in UTF-8 byte order, onlyworld.json,elements/,spatial/,media/,records/and the one dot-folder named inprivate_dir, the same folder giving the same bytes (within one zlib build). From 0.32.0 the records a producer marks"private": trueinrecords/RECORDS.jsonstay home: left out whole,RECORDS.jsonkept as it is, unlessinclude_private_records=True; a manifest it cannot read raisesValueErrorunless you pass that (private records). From 0.43.0 both takeinclude_hidden=True: a world file is a copy, and a hidden element’s file travels byte for byte. For a file made to hand to someone else,include_hidden=Falseleaves every element file (one directly in a type folder ofelements/orspatial/, since 0.90.1 only those) whose JSON object carries the mark out whole, nothing else rewritten (a link to it keeps the id, which dangles); a list passed ashidden_left_out=receives the left-out files’ paths, sorted, so its length is the count. From 0.90.0 a world file leaves out who wrote each element:created_by,changed_by,changed_via,changed_clientanddoorsleave every element file that holds them, which is written in the folder’s own form (two-space indent, a trailing newline, its other keys in their order);include_author_fields=Truewrites every file byte for byte, for an archive of your own world. The package’s own test runs the conformance set from its schema pin; the directory it writes matches the TypeScript writer’s entry for entry. - Import from other apps: importers for Campfire, Kanka, LegendKeeper, Notion and World Anvil read each app’s export into a world folder (LegendKeeper’s also through its API), as
python -m onlyworlds.<app>or from Python asimport_campfire,import_kanka,import_legendkeeper,import_notionandimport_worldanvil. Each has its own section on Import from other apps. - The calendar profile (since 0.68.0):
onlyworlds.calendarreads a world’s own calendars as the calendar profile defines them.read_calendar_value(raw)reads anatlas_calendarvalue (an object, or the same object as a JSON string) and givesNonefor anything the profile refuses;world_calendars(elements)finds every calendar in a world by the field, andresolve_calendarpicks the one to read dates through (namedresolve_calendar_lensbefore 0.69.0; the old name still answers, with a deprecation warning).breakdown_step(cfg, step)andformat_step(cfg, step)turn an integer step into the calendar’s date (months, days outside the months, weekdays, eras, and version 2’s leap exceptions and offset), andparse_date(cfg, text)reads written words back to a step. It is the TypeScript SDK’s calendar reader under snake_case names, gives the same answers (both replay the profile’s fixture, and the two were compared on 175,705 inputs before the release), and reads the calendars the LegendKeeper door writes. - The lens profile (since 0.74.0):
resolve_lens(world, lens, reader, as_of=, clock=)reads a world through a lens for one reader (the kept elements in order, the cut by reason, the mail part), withis_lens,is_templateandlenses_in_use, as Lenses describes. Since 0.77.0,world_graph(world, reader, *, lens=None, as_of=None, clock=None, rooms=False, hidden=False, proposed=False, map_space=False, reading_aids=False)(reading_aidssince 0.103.0: the charter, its guide and its domains back in a graph without a lens, each markedreading_aid) reads the same snapshot as nodes and edges, withedges_cutcounting by reason the links it leaves out; a refused flag raisesValueErrornaming it. Since 0.78.0,degree_of(graph)gives each node’s count of edges, in or out: rank by it for “most linked”. Since 0.79.0,DATE_FIELDis the profile’s date table anddate_of(el)an element’s date as that table reads it (the whole number in its type’s date field, elseNone), so a timeline dates elements exactly as the lens’s fence does. Since 0.82.0 a lens’s rows for a reader below the owner are the bodies the API serves that reader, the owner’s the bodies as stored; since 0.82.1 a contributor’s or a guest’s row keeps a link to a proposed element it sees, and a lens’s note keyed to one, the public rung loses both, and no row carries a storedx_served_trimmed. Since 0.136.0 a reader’s rung may also beco-builder(the whole world as the owner reads it, without the owner’s cut counts), and a contributor’s view holds the hidden elements it made, listed inwhole, as the TypeScript SDK’s rungs say. - The address profile (since 0.73.0):
parse_ow_link(text)reads an element’s link in any of the three spellings, with its moment and lens, andelement_address(address)writes one; a refused string raisesAddressErrorwith the profile’sreason, as Addresses describes. Since 0.122.0read_ow_link_at(text, index=0)finds an address in prose: the address that starts atindex, as anAddressAt(reading, andend, the index just past it), orNonewhen none starts there (since 0.125.0 also when it would begin inside a word); what follows it is prose, a full stop included. Since 0.125.0find_ow_links(text)finds every address in a text, in order, each anAddressFound(start,end,reading). Since 0.86.0openers_for(tools, kind, address, surface)gives an Open with menu’s rows (onlyworlds.com, then each listed tool with a door for it, each with its state word), the same rows as the TypeScript SDK’sopenersFor, andTOOLSis the tools list baked at the release; since 0.96.0 the surface takesonline, and withFalseevery row whose link is a web address says “Needs a connection”; since 0.99.0 a surface whosetoolisonlyworlds(the site itself) gets its own row as “You are here”; since 0.101.0element=takes the element as served, and a tool whose element door does not open what it carries (the list’selement_skips, read asworld_graphreads it) has no row; since 0.106.0 a tool whoseelement_typesleaves out the element’s type (read from the address) has no row on that element’s menu, its world door included; since 0.105.0 thepublicaudience gets each tool that needs an account as a row that says “Needs an account”, and since 0.107.0 a row that opens there when itsopen.opens_publicis true. Since 0.87.0doors_of(element, tools=TOOLS)reads an element’s door history (itsdoors, served to a world’s members): which tools wrote it, newest first, each{door, at, tool, last, from}, the same entries as the TypeScript SDK’sdoorsOf. Since 0.89.0door_where(door)gives one entry’s where in the same words asdoorWhere(in Atlas,on onlyworlds.com,with an AI,by OnlyWorlds, elsein code). - The message profile (since 0.63.0):
is_message,recipients_of,is_addressed_to(an emptycharactersis every member),is_to_everyone(since 0.64.0),is_sent_by,sender_status(message, members)(verified,mismatchorunverifiable, fromcreated_byand the members list),read_mark_of(a reader’sReadRelation, in their own hand only;Nonewithkeyless=Truesince 0.95.0),unread_forandthread_of, as Messages between members describes. Since 0.72.0 (serial 76): a list the server trimmed for its reader (has_unseen_recipients, the sender statusunseen,keyless=Truefor a body read with no key),edited_by, and Notes (is_note,note_of), each the npm SDK’s rule;pushnever sends the served-only mark. - The report profile (since 0.120.0):
report_threads_of(narratives)groups the reports among the Narratives you give it by theparent_narrativethey name, read as written (rule 9):parents(what each report’s parent is:none,report,board,missing,otherorself),groups(a thread under its first report, or a closed talk’s reports under their board entry, bycreated_at) andlints(chain,self). Give it the board entries too, or a closed talk’s parent readsmissing; only a Narrative with the pair and the room’s mark is a report or a board entry. A list read withexpand=parent_narrativeserves the parent as an object, which reads as no parent: give it the reports with the id. - A report’s lines (since 0.128.0):
read_report_lines(text, world=world_id)splits a report’sconsequencesand reads each line as the report profile says, each aReportLine:words(what to show),address(the element the line names,ow://<type>/<id>, or None),reading,startandend;read_report_line(line, world=...)reads one. It is the TypeScript SDK’sreadReportLinesreading, held to one table in both. - The review profile (since 0.66.0):
proposed_mark_of(element, today=None)gives an element’s proposed mark as a viewer shows it,{"by", "expires", "lapsed"}, orNonefor a settled element (no mark,None, or a value that is not an object);byis the mark’s own word, read as stored and never trimmed since 0.117.0 (Nonewhen it is not a string or is whitespace alone), to be shown as the review profile says, as the mark’s word and never as a fact;lapsedis true from theexpiresday on, in UTC as onlyworlds.com reads it.hands_on_as_proposed(element)is what a reader that hands a world on leaves out: the mark with any value butNone, so a malformed value is left out too. The Markdown pack reads the same function. - The room profile (since 0.20.0):
ROOM_PAIRSlists the ten(type, supertype)pairs a world’s chat room (a parlor) and its working layer keep as elements (the ninth, Take, since 0.52.0; the tenth, Report, since 0.112.0), andis_room_element(element)is true when a body or aFolderElementmatches one (trimmed, case-blind) and carries a non-emptyx_room_of, the id of the world or workshop session the room belongs to (since 0.124.0 an empty list or an empty object is no mark). A pair without the mark is lore, so a novel’s Message Narratives stay in view; a lore view leaves room elements out unless the person asks. The room profile, schema-dist serial 45. - Talks (since 0.135.0, serial 135):
talks_of(element)answers the talks on an Object or a Construct that a line in the room is in, each{type, id}from itsobjectsandconstructs(each id as written; a Message without the mark, a board entry and a report are in none), andreport_talks_of(narrative)the talks a report is shown with, read the same way. The room profile and the report profile. - The reading aids (since 0.80.0):
is_charter_element(element)is true for the world’s Charter (a Law, supertypeCharter), its Guide or one of its Domains (Constructs, supertypeGuideorDomain), matched as a room pair is and carrying the markx_charter_of; the pair without the mark is lore. A tool’s front door shows them first and its lore views leave them out;resolve_lenskeeps one only whentypesnames its pair or the lens anchors it, andworld_graphwithout a lens leaves them out asreading_aid. Since 0.82.0 the mark is read by its presence (any value butNone, a string only when something is left after trimming, and since 0.124.0 an empty list or an empty object is no mark), andcharter_of(world, reader)returns what a front door shows first,{charter, guide, domains}, as that reader sees them (since 0.133.0 each carriestype,lawon the Charter andconstructon the Guide and each Domain, and a Domain’s hub is an element of the kind its field links to);domains_of(world, reader)returns the Domains alone; the doctor reads the marked Charter, and its flag 14 names a Guide or Domain entry that points at a hidden or deleted element. The charter profile, schema-dist serial 83. Since 0.82.0 a lens’s rows for a reader below the owner are the bodies the API serves that reader. Since 0.83.0reading_aid_of(element)answers which aid an element’s type and supertype make it,"charter","guide","domain"orNone, with the mark ignored: what a tool offers to mark it as. Since 0.135.0design_parts_of(world, reader)answers the design parts that reader reads (serial 135), each{type, id, state}: an Object or a Construct served whole whosesubtype, trimmed and in any case, isin designorlocked, only wherecharter_offinds a Charter for the same reader, else[]. - The strand profile (since 0.97.0):
strand_of(world, reader)reads a world’s strand, the story itsx_strandnames in miniature, as one reader sees it:{narrative, event, location, character, now, same}, each filled slot{id, type, name}(type, since 0.133.0, the kind the slot holds:narrative,event,locationorcharacter, andlocationfornow) and an empty oneNone, the hero from the story’sprotagonistand now from the hero’slocation,samewhether then and now are one place. The world and the reader areresolve_lens’s, so a slot the reader cannot see stays empty; only the story is required since 0.98.0 (eventandlocationNoneor absent read as unset), and any other shape is no mark.STRAND_FIELDis the mark’s name. The server serves the same reading at the front door,me()["reading_aids"]["strand"](since 2026-10-31). - The record profile (since 0.100.0):
records_of(character_id, elements)reads one Character’s records, the game runs they took part in, newest first: each an Event whosex_recordnames the game (tool) and when it was played (played_at), as{event, tool, played_at, version, seed, outcome, seat, stories},storiesbeing the Narratives that list the run and name them asprotagonist,narratororboth. Who took part is the Event’scharacters; a run or a story still proposed is not read (since 0.102.0 exactly whatproposed_mark_ofreads as proposed, so one with an empty mark,{},""or[], is settled and read), and an Event or a Narrative whoseidis not a string is never read.record_mark_of(element)reads one Event’s mark, orNone;RECORD_FIELDis the mark’s name. Since 0.122.0played_atis read by the message profile’s time grammar: a lower-casetandz, an offset and no zone read, and a time without its seconds is no record. The npm SDK’srecordsOfgives the same answers. - The landing profile (since 0.102.0):
landing_of(graph, *, heads=None, hops=None, size=None)reads whatworld_graphanswered as a world’s first picture at a door (the landing). It returns{mode, size, clusters, unclustered, gaps}: the most-linked Characters with at least one link (at mostheads, 5 by default), each with the nodes withinhopssteps (1 by default) that are nearest to it, a tie going to the higher-ranked head; the rest unclustered; the gaps (orphan,near_orphan,no_place,nobody_here); andmode,gapsundersizenodes (24 by default), elsegraph. An option that is not a whole number of 1 or more raisesValueErrornaming it. It returns structure only, never coordinates. Any door may serve the answer, keyless or signed in, each read from the graph that door’s reader is served; a key beside the five (keel’sbaked, itslenses) is the door’s own and outside the profile, so a reader reads the five and passes the rest through. The npm SDK’slandingOfanswers the same. - The map-space profile (since 0.104.0):
map_space(elements)reads a world’s Maps, Zones, Markers and Pins as the map-space profile defines, from the elements as the reader is served them. It returns{maps, zones, pins, out}: each Map’s frame (width,height,depth,z_max,scalein metres per pixel fromx_metres_per_pixel,location,parent_map; a missingwidthorheightis measured from the Map’s own placed points, withextent: "points"), one outline per Map a Zone has Markers on (its points inorder, then by id, withshapepolygonorline), each Pin’s point with its element aselement_typeandelement_id, andout, what the reading left aside counted byno_point,no_markers,danglingandno_map, a reason with nothing counted absent.zis an elevation, never a height. A number counts when it is whole by value (2.0reads as 2; a boolean or a fraction is no point), and a row without an id is ignored; since 0.104.1 (serial 106) two rows of one type with one id read as the last one served. TypesMapSpace,MapSpaceMap,MapSpaceOutlineandMapSpacePin. The npm SDK’smapSpaceanswers the same. - The layout of a map (since 0.110.0):
layout_of(map, maps, pins)answers{"layout", "ground", "hand"}from a Map’sx_layoutand its Pins’x_hand, the TypeScript SDK’slayoutOfwith the same answer: the method orNone, the served ground Map’s id orNone, and the ids of the Pins a new lay-out keeps (x_handexactlyTrue, never1; every Pin of a"hand"board), in code point order. - A child Map on its parent (since 0.137.0):
carry_of(map, point, maps)carries a point on a Map up itsparent_mapchain by each level’sx_parent_frame, the TypeScript SDK’scarryOfwith the same answer:{"parent_frame", "lint", "points", "stop"}, every point in 64-bit floats. - A world’s default picture (since 0.127.0):
layout_by_kind(graph)andlayout_around(graph, focus, steps=1), the TypeScript SDK’slayoutByKindandlayoutAround, the same points to the bit. Since 0.129.0,unplaced_by_kind(graph, placed)andunplaced_around(graph, focus, placed, steps=1)answer the ids a saved layout Map has no Pin for, the same lists as the SDK’s; the methods and that reading are the standard’s default layouts profile, whose fixture both packages replay. - A world laid out in 3D (since 0.130.0):
layout_by_links_3d(graph, elements=None, *, held=None, held_unit=None), the TypeScript SDK’slayoutByLinks3dwith the same answer: the same points to the bit for a centre, a grouped element and a pinned one off the ring, within a billionth of a rest for the rest.pointsis one flat list, x, y, z a placed node. Since 0.136.0 every piece of linked elements is laid out, the pieces beside the main one on a ring round it, and an element linked to no other and pinned on no map is answered inunplacedinstead of placed on a shelf;BY_LINKS_3D_VERSION(2) says when a release moved the points, as the TypeScript SDK’s does. It is plain Python, so a world of several thousand elements takes minutes.unplaced_by_links_3d(graph, placed)(since 0.131.0) answers what a savedby-links-3dlayout map does not place, asunplacedByLinks3ddoes. - A layout along a route (since 0.108.0):
trail_by_place(input)lays a world out along a route on a ground map, the TypeScript SDK’strailByPlacewith the same input and the same answer: a Map frame and one Pin per element in the standard’s own fields (somap_spacereads it back), the route, and the recipe it ran with. You hand it the places in travel order and what hangs where; it places them.TRAIL_TIERSis the default floors. - A world’s own words (since 0.30.0):
type_word(world, element_type, supertype=None, many=False)gives the word a world’sx_namesmap prints for a type (Employee for Character in a work world), orNonefor the standard’s name; a supertype’s own word wins over the type’s. The names profile, schema-dist serial 48; its 29 shared test cases (the fixture every reader of the profile passes) are the package’s test. - The spine profile (since 0.44.0):
read_spine_element(element_type, element)reads one element of a world that maps a software ecosystem and returns aSpineRead: its kind (the closed list’s spelling,off-list, orfreefor a Character, Institution or Collective), eachx_spine_*key as read orNone, the audience’s primary, the probe’s verb orunsupported, anddropped, every value it left out, each as{"key", "value"}with the value as the element held it (since 0.44.1), andretires, the retired row’s id fromx_spine_retiresas given, on whatever element carries it (since 0.50.0; whether it sits on a Retirement Event and names a row is the doctor’s to check). Trimmed and case-blind as the room profile defines it.SPINE_KINDSis the closed list. The spine profile, schema-dist serial 61; its 46 fixture cases are the package’s test. The calendar the profile ships is checked withonlyworlds.calendar(since 0.68.0). - Push:
plan_pushandpushcompare a folder with a baseline and PATCH only the fields that changed. An empty field is no change whichever way it is written: for a text field, absent,""andnullare one; for a link list, absent,[]andnullare one (since 0.123.1), so a folder that leaves empty fields out plans nothing against an export that writes them. A rerun skips what already landed. A push creates nothing and never sends the hidden mark: it patches only elements already in the baseline (an element only in the folder is listed asonly_in_folder), so an element new to the server goes throughcreate,upsertorbulk, which since 0.43.0 sendhidden: trueas the folder has it. A world’soriginis its birth line, written once: since 0.34.0 a push sets it from the folder’ssourceandproduceronly on a first fill from a folder made elsewhere (the world’soriginempty, the folder not exported from this same world), never over a first import; a key that may not write the world (a contributor’s) skips it without failing the push (PushResult.originholds what was set). - Client (
patch_worldtakes back aget_world()body,originstripped, and sends extension keys as given; a folderworld.json’s ownsourceandproducerit leaves out, andsource=andproducer=send them when you name them, since 0.35.0):health,get_world,patch_world,list_page,iter_elements,get,create,upsert,patch,delete,edit_links,bulk,changes,headandwalk_changes;me(Who am I),draught(The draught),world_lensesandset_my_lenses(Lenses on the API), andproposewith the proposal calls (Proposed changes).createandbulkalways send anIdempotency-Key, so a retry after a lost answer is safe: it never creates an element twice. A retry that meets the first request still running (409idempotency_in_flight) waits and tries again until the stored answer replays (since 0.4.0). The client retries a 429 (neverrate_limited, a wrong PIN), a 5xx and a lost answer itself, waitingRetry-Afterwhen one is sent, up to 6 tries in all by default;Client(key, pin, retry=RetryPolicy(attempts=1))turns it off. The TypeScript SDK never retries, on purpose. - Errors:
ApiErrorcarries the envelope’scode,paramanddoc_url, with flags such asis_id_conflict,is_not_author,is_resync_required,is_idempotency_in_flight,is_validation_errorandis_hidden_not_allowed(since 0.43.0: a create carriedhidden: truefrom a key that may not hide, and nothing was created). Since 0.112.0refusalsreads a 422answer_not_parsed: each answer an AI use refused, in order, as{"word", "stop_reason", "output_tokens"};Nonefor any other error. Passif_match=el["change_seq"]topatchoredit_linksto write only if nobody changed the element since you read it (since 0.2.0); if it moved,PreconditionFailedcarriescurrent, the element as it is now. See Only if unchanged. - Export:
export_world(an account world to a folder; since 0.7.0 itsworld.jsonsays where it came from and which part of the world it is,sourceandexported_as, read from/me), andonlyworlds.okf.export_okf(a folder to an OKF bundle, since 0.6.0).
Not in the Python package yet: typed element models, the account routes, members(), hiding, adopt (moving who made an element), images and files, set_my_character, sign-in, and the snapshot writer. For these, use the TypeScript SDK, which has them, or call the REST API directly. To ask for one, open an issue on python-sdk.