Object

Get a ticket to attach a file to a object

Changed on

A write key and its PIN that may change the element (the write rule of PATCH; an AI seat answers as its sponsor). Body: the file's name, kind and size, and an optional label. Returns a single-use ticket in the image lane's shape with kind file: send the bytes to upload_url with it. The file is listed once the upload host has checked and stored it. Kinds: text (txt, md, json, csv, yaml, toml), pdf, an image (png, jpg, webp, avif), and zip only as a world's own bundle. An image is a file like any other: private to the element's readers and served as a download; the upload host stores its bytes as they arrive, and nothing re-encodes or strips them. At most 25 MB a file; a world holds 250 MB of files; 200 tickets a world a day. This route takes no Idempotency-Key: the single-use ticket is the idempotency (a second POST is a second ticket). Files on elements answer only where the server has them switched on; elsewhere every files route is a 404.

post/api/v2/object/{id}/files

Request

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

Path parameters

id, string uuid required

The object's id (a malformed id is a 422).

Headers

X-OW-Agent, string

Send it (any non-empty value) when an AI makes this write: the change is recorded with added_via declared. An AI seat's key is recorded as seat and MCP as mcp without it. The value is never stored.

Request body

object required
name, string required

The file's name, ending in its kind's extension (.yml, .markdown and .jpeg are taken too).

kind, 'pdf' | 'txt' | 'md' | 'json' | 'csv' | 'yaml' | 'toml' | 'zip' | 'png' | 'jpg' | 'webp' | 'avif' required
size, integer required

Bytes.

label, string nullable

Response

A ticket for one file upload. Cache-Control: no-store.

object required

The image lane's ticket shape, with kind file and the file's id.

ticket, string required

Opaque to clients: send it to upload_url as Authorization: Bearer <ticket>, the file's raw bytes as the body.

upload_url, string required
prefix, string required

w/<world_id>/<element_id>/

key, string required

The object key the file lands under.

max_bytes, integer required

The most this ticket accepts: 25 MB, or what the world has left, whichever is smaller.

exp, integer required

Unix seconds after which the ticket is refused (10 minutes).

uses, 1 required
issued_to, object required
kind, 'file' required
file_id, string uuid required

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