Guides/Quickstart

Quickstart

Mint a key, create a record, then attach a FILE. Five minutes.

Quickstart

This is the public Data API for workspace tables. It is not SQL, not Prisma, and not a second Postgres. You talk to live Onnie tables over HTTP.

You'll need an Onnie workspace with Database enabled. Mint a key, create a row, then (optionally) upload a FILE cell.

1. Mint an API key

Open your workspace → Settings → API Keys → Create new key. Give it a name, pick tables:read and/or tables:write (tables:write includes read), and copy the key when shown — it's only displayed once.

Your key looks like:

onn_live_a1b2c3d4e5f6g7h8i9j0k1l2m3n4o5p6q7r8s9t0u1v2w3x4

2. Create a record (canonical)

Work is not minted by this API. There is no mint_work. After the POST succeeds, an Automation on record.created (or record.updated) can mint Work.

curl -X POST https://api.onnie.ai/api/public/v1/tables/$TABLE_ID/records \
  -H "Authorization: Bearer onn_live_..." \
  -H "Content-Type: application/json" \
  -d '{"fields":{"Title":"Inbound lead"}}'

$TABLE_ID is the table UUID (from GET /tables). The row shows up in the Onnie grid. If you have an Automation on record.created, that rule mints Work.

Download types for this workspace:

curl https://api.onnie.ai/api/public/v1/schema.ts \
  -H "Authorization: Bearer onn_live_..."

3. FILE three-step (presign → PUT → register)

The record must already exist. Do not POST FileValue JSON on create/patch (file.use_upload).

# 1. Presign
curl -X POST \
  "https://api.onnie.ai/api/public/v1/tables/$TABLE_ID/records/$RECORD_ID/files/Attachment/presign" \
  -H "Authorization: Bearer onn_live_..." \
  -H "Content-Type: application/json" \
  -d '{"files":[{"filename":"invoice.pdf","mime_type":"application/pdf","size_bytes":12000}]}'

# 2. PUT bytes to presignedUrl from the response
curl -X PUT "$PRESIGNED_URL" \
  -H "Content-Type: application/pdf" \
  --data-binary @invoice.pdf

# 3. Register the object key onto the FILE cell
curl -X POST \
  "https://api.onnie.ai/api/public/v1/tables/$TABLE_ID/records/$RECORD_ID/files/Attachment/register" \
  -H "Authorization: Bearer onn_live_..." \
  -H "Content-Type: application/json" \
  -d '{"keys":["'"$OBJECT_KEY"'"]}'

Register appends metadata to the cell and can fire Automations record.updated. Presign does not.

Next steps