Skip to content

Send data via the API

This page walks through each request. To choose how to send data, or to make a script faster and safe to rerun, start with Push data to Ronja.

  1. Open API Tokens in the admin sidebar, under People & Access.
  2. Click Create token, fill in Token name (e.g. CI pipeline) and pick a Role. The role bounds everything the token can do.
  3. Leave access on Limited to scopes and grant only what your integration needs: each scope (Data, Structure, Analytics, Automation, Agents, Secrets, Admin) can be None, Read or Write. Full access skips scope limits and shows a red warning.
  4. Click Create token, then Copy token in the Token created dialog, then Done.

The Token created modal showing the one-time secret with a copy control Copy the token before closing this dialog; you cannot display it again.

If the token is created but its role can’t be assigned, keep the dialog open and click Retry role assignment, which retries on the same token. You can also change its role later in the list.

Send the token on every request in the Authorization header. $RONJA_BASE_URL below is your organization’s Ronja URL, and a token can never read or write another organization’s tables. The interactive API reference is at /docs/api on your Ronja domain, and a summary is in the API reference.

An Integration table can be filled with files you push from your own systems instead of a connection. It takes Parquet files only, sent as the raw request body, up to your organization’s upload limit, 1 GB per file unless Ronja has changed it. Convert CSV first, for example:

Terminal window
python -c "import pandas as pd; pd.read_csv('sales.csv').to_parquet('sales.parquet')"
  1. Create the table once. featureID, the feature that will own it, is required in the body with name. The response holds the table ID, table-…, which is also in the table’s URL in the app:

    Terminal window
    curl -X POST "$RONJA_BASE_URL/api/v2/feature/model" \
    -H "Authorization: $RONJA_API_TOKEN" \
    -d '{"name":"sales_pushes","kind":"manual_integration","featureID":"<your feature ID>"}'
  2. Upload a file. Re-uploading a filename replaces that file; different filenames accumulate and are built together:

    Terminal window
    curl -X PUT \
    "$RONJA_BASE_URL/api/v2/feature/model/table-a1b2c3d4e5/file/sales_2026.parquet" \
    -H "Authorization: $RONJA_API_TOKEN" \
    --data-binary @./sales_2026.parquet
    # -> 200 {"filename":"sales_2026.parquet","size":48230}
  3. List or delete files as needed:

    Terminal window
    curl "$RONJA_BASE_URL/api/v2/feature/model/table-a1b2c3d4e5/files" \
    -H "Authorization: $RONJA_API_TOKEN"
    curl -X DELETE \
    "$RONJA_BASE_URL/api/v2/feature/model/table-a1b2c3d4e5/file/old.parquet" \
    -H "Authorization: $RONJA_API_TOKEN"
  4. Run Build to make the data queryable. Uploading alone is not enough:

    Terminal window
    curl -X POST "$RONJA_BASE_URL/api/v2/feature/model/table-a1b2c3d4e5/build" \
    -H "Authorization: $RONJA_API_TOKEN"
  5. Poll GET /api/v2/feature/model/table-a1b2c3d4e5 until the build ends, and branch on buildVerdict, not status: a table that already held data reads ready again after a failed rebuild, because it keeps serving its last good data.

    • "building" or "pending": keep polling.
    • "ok": the build landed.
    • "ok_partial": it landed but skipped source files it couldn’t read, so the table holds less than you uploaded.
    • "failed" or "failed_stale": it didn’t land. lastBuildError on the same response says why.

    The other values are in the API reference. The schema is detected from the Parquet files. From the CLI, ronja api with --wait-until runs this poll; ronja api --help shows how.

A Build of a table that is still building is refused with a 409, and the running build may not include your new files: wait for it, then build again. When a build lands, the tables built from this one rebuild on their own clock; see Wait for a Derived table to catch up.

A Dynamic table holds records your own app or scheduled script produces, sent as JSON rows or, for bulk loads, as a Parquet file. There is no build step: when the write returns, the rows are queryable.

  1. Create the table once. It takes an Admin, the owner of a Private Feature, or a maintainer of an Organization Feature:

    Terminal window
    curl -X POST "$RONJA_BASE_URL/api/v2/feature/model" \
    -H "Authorization: $RONJA_API_TOKEN" \
    -d '{"name":"order_events","kind":"dynamic","featureID":"<your feature ID>","fields":[{"name":"sku"},{"name":"qty"}]}'

    fields is optional: pass it if a query names the columns before the first write, such as a UNION with your history table at go-live. Each entry is an object with a name, never a bare string, and the column you query is the name lowercased and sanitized (Qty becomes qty). The rules, including which names the first write keeps, are under Row push API.

  2. Write rows. writeMode is append (the default) or replace:

    Terminal window
    curl -X POST \
    "$RONJA_BASE_URL/api/v2/feature/model/table-a1b2c3d4e5/rows" \
    -H "Authorization: $RONJA_API_TOKEN" \
    -d '{"rows":[{"sku":"A1","qty":3},{"sku":"B2","qty":7}],"writeMode":"append"}'
    # -> 200 {"tableID":"table-a1b2c3d4e5","rowsWritten":2,"writeMode":"append","partitionCount":1,"schemaChange":{},"cascade":"immediate","version":"1792483200123456"}
  3. Read it back, no build needed:

    Terminal window
    curl -X POST "$RONJA_BASE_URL/api/v2/duckdb/query" \
    -H "Authorization: $RONJA_API_TOKEN" \
    -d '{"sql":"SELECT sku, qty FROM {{ ref('"'"'table-a1b2c3d4e5'"'"') }}"}'

    A query takes the table’s ID, never its name; find an ID in the table’s URL, or with GET /api/v2/search?q=orders. ronja query from the CLI does the same and fails loudly where this endpoint answers success with an error inside; see Query your data.

A write takes effect at once and whole: anyone reading the table sees it as it was before the write or after it, never half of it. The answer’s version is the table’s version after your write.

Name the columns rather than writing SELECT * in a query you deploy before the first write: the column order changes with that write, and a UNION pairs columns by position, so SELECT * starts pairing the wrong ones without an error.

Columns take their names and types from the JSON values: a string is text ("020" keeps its leading zero), true/false is a boolean, and a number is a number. Send numbers as numbers: "qty": "3" makes a text column, and on a column of numbers it is a type change. A column a write leaves empty (null in every row) keeps the type the table stores.

JSON has no date or time type, so send dates and times as text: 2026-10-01 for a date, and for a date-and-time the time with its offset, 2026-10-01T12:00:00Z or 2026-10-01 14:00:00+02, the way a query shows it (a column with no time zone takes it without the offset). Send a date-and-time before 1935, or one whose offset isn’t a whole quarter hour, in UTC, ending in Z.

On a column the table already stores as a date or a date-and-time, the text keeps that type when every value in the write reads as one; otherwise the whole column is stored as text, exactly as sent, and warnings names the value.

When you add rows, new columns are added and a column whose type changes is widened, or in a few cases refused, as When a column changes type describes. When you replace the rows, the table takes exactly the columns and types you send: a column can be added, dropped or change type, and nothing is refused or stored as text for it.

Either way, warnings on a write that lands names each column that changed, for a person to read, and schemaChange lists the same for your code: added (with each column’s type), dropped (columns a replace left out), missing (columns the added rows didn’t carry, so those rows have no value there) and retyped (with each column’s from and to). {} means no column changed. A refusal is a 400 whose error names the column. Under the Strict schema policy, an added, missing or retyped column is refused instead.

A table with the Legacy typing marker reads JSON the older way, storing "020" as the number 20 and true/false as text, and every write’s warnings counts the values that reading re-typed. Cast the named columns in the Derived tables that compute on them (amount::DOUBLE), fix your payload to send real types (the legacy warnings stop once it is ready). Dates and times, and a column a write leaves empty, already keep their stored type on such a table, as on any other.

Then send PUT /api/v2/feature/model/{tableID} with {"jsonTyping":"typed"}, or empty the table. What a payload that isn’t ready does after the switch, and how to switch back, is under Row push API.

Add ?dryRun=true to the row push or the Parquet upload to see what a write would do, without doing it:

Terminal window
curl -X POST \
"$RONJA_BASE_URL/api/v2/feature/model/table-a1b2c3d4e5/rows?dryRun=true" \
-H "Authorization: $RONJA_API_TOKEN" \
-d '{"rows":[{"sku":"A1","qty":"3"},{"sku":"B2","qty":"7"}],"writeMode":"replace"}'
# -> 200 {"tableID":"table-a1b2c3d4e5","rowsWritten":0,"writeMode":"replace","partitionCount":2,"warnings":["…"],"schemaChange":{"retyped":[{"name":"qty","from":"int","to":"string"}]},"dryRun":true,"dependents":[{"id":"table-f6g7h8i9j0","name":"daily_orders"}]}

A dry run checks everything the write checks and answers as the write would, the same 400 included, but writes nothing, rebuilds nothing and fires no Automation. It answers "dryRun": true, rowsWritten of 0, the write’s warnings and schemaChange, and dependents: the Derived tables you can see that are built directly from this one, which the write would rebuild.

Tables further down, and the Automations and Apps that read the table, aren’t listed. A dry run doesn’t hold the table, so a write that lands in between can change the answer. In one rare case only the real write is refused: a decimal or time-of-day column that would have to be stored as text.

dryRun goes in the URL and is true or false. Any other value, a misspelling such as dry_run, "dryRun" in the row push’s body, or dryRun on a request that has no dry run, such as emptying a table, is refused with a 400, and nothing is written. An answer without "dryRun": true was a real write. Every write keeps a snapshot of the table as it was, so you can put it back as under Empty and restore a table.

To change, delete or add a few rows without sending the whole table, send SQL to POST /api/v2/feature/model/{tableID}/modify:

Terminal window
curl -X POST \
"$RONJA_BASE_URL/api/v2/feature/model/table-a1b2c3d4e5/modify" \
-H "Authorization: $RONJA_API_TOKEN" \
-H "Idempotency-Key: close-order-42" \
-d '{"sql":"UPDATE target SET status = $1 WHERE id = $2; DELETE FROM target WHERE expired","params":["closed",42]}'
# -> 200 {"tableID":"table-a1b2c3d4e5","counts":[1,3],"version":"1792483260654321","partitionCount":4,"replayed":false,"cascade":"immediate"}
  • The statements are INSERT, UPDATE, DELETE or MERGE, separated by ;. In them the table is target; another table you can read is {{ ref('table-…') }}. They run in order and land together or not at all. Anything else, such as a SELECT or a DROP, is refused with a 400 and nothing runs.
  • params fill $1, $2, … in every statement, as JSON strings, numbers, true/false or null. Never paste values into the SQL.
  • counts says how many rows each statement changed, in order; 0 is an answer, not an error.
  • What it can change. The columns the table already has, on a table whose columns have types: one you have written rows to, or one set up with column types. A table with only named columns, or one emptied with /clear, is refused until you write rows to it again. To add a column, push a row with it first. A {{ ref() }} to the table itself is refused (write target), and so is one to a table with no rows yet.
  • Only the data files holding a changed row are rewritten, so a small change to a large table stays quick. A snapshot of the table as it was is kept first, with your statements as its reason, so you can put it back.
  • Make a retry safe with an Idempotency-Key header, any text up to 255 characters. Sending the same key with the same body to the same table again within 24 hours changes nothing and answers the first write’s counts and version with "replayed": true, so a retry after a lost answer can’t apply your change twice. A key is yours alone: another person or token using the same key makes a write of its own. The same key with a different body or table is refused with a 409 naming the table it was first used for. Without the header, a retry runs the statements again.
  • It takes the same access as writing rows, plus read access to every table you {{ ref() }}, and fires the same rebuilds and Automations; ?cascade=defer works as for rows (Send several tables at once).

When your script reads a table, changes it and sends it back with replace, another write in between would be lost without an error. Pass the version you read as expectedVersion, and the replace lands only if the table hasn’t changed since:

  1. Read the table with POST /api/v2/duckdb/query. The answer’s tableVersions holds the version of each table the query read, by table ID, taken at the same moment as the rows.
  2. Send the replace with that version: {"rows":[…],"writeMode":"replace","expectedVersion":"1792483200123456"} on /rows, or ?expectedVersion=… on either endpoint (on /rows, a different value in the body and the URL is refused).
  3. If another write landed in between, the answer is a 409 with "code": "version_mismatch" and the table’s currentVersion, and nothing is written: read the table again and redo your change.

Every write answers the table’s new version (/rows, /rows/parquet, /modify, emptying, copying and restoring), and GET /api/v2/feature/model/{tableID} shows the current one, so a script can chain guarded writes without reading the table again. The version changes on every write; Ronja’s background tidying of a table’s data files doesn’t change it.

If you already have a Parquet file, or the 50,000-row / 8 MiB JSON limits are in your way, send the file to the same table. The limit rises to your organization’s upload limit (1 GB per request unless Ronja has changed it) with no row cap, and the same rows take a small fraction of the bytes:

Terminal window
curl -X POST \
"$RONJA_BASE_URL/api/v2/feature/model/table-a1b2c3d4e5/rows/parquet?writeMode=append" \
-H "Authorization: $RONJA_API_TOKEN" \
-H "Content-Type: application/octet-stream" \
--data-binary @data.parquet
# -> 200 {"tableID":"table-a1b2c3d4e5","bytesReceived":48219,"writeMode":"append","partitionCount":2,"schemaChange":{},"cascade":"immediate","version":"1792483320000001"}

writeMode is a query parameter here. Send the file as the raw body, never as a form upload (-F), which is refused with a 400; a body that isn’t a readable Parquet file is refused before anything is written. Everything else works as for rows: the same access, automations, snapshots, partition ceiling and dry run. A Parquet file carries its own column types, so the date and time rule above is for JSON only.

To empty a Dynamic table, POST /api/v2/feature/model/{tableID}/clear, with an optional {"reason":"..."}. The contents are snapshotted first: list snapshots with GET .../dynamic-versions and put one back with POST .../dynamic-versions/{versionID}/restore. Snapshots expire after 7 days. Clearing and restoring take the same access as writing rows.

  • Column names stay, but their types come back only with the next write; until then, cast (some_column::TIMESTAMP) before a date function.
  • Automations fire. An Automation watching the table can run against the empty table, so pause it first or make sure it copes with zero rows.
  • Derived tables keep their old data, marked Not updating, until the next write rebuilds them. You can clear and reload back to back. A restore rebuilds them too.

Writing rows, changing them with SQL, clearing and restoring need write access to the table’s Feature: for a Private Feature, its owner or an Admin; for an Organization Feature, an Admin or a maintainer. Any other colleague who can write the table inside Ronja still gets a 403 over the API. If a second person needs to push to a table, keep it in an Organization Feature and make them a maintainer of it.

Each write, and each build that lands, rebuilds the Derived tables built from the table and fires any Automation watching it, unless it was held back. GET /api/v2/feature/model/{tableID}/dependents lists the tables built from it, one level down, that you can see. Those rebuilds run on their own clock, so a dependent may briefly serve its previous rows. When a read of one has to reflect your data:

  1. Before you write or build, note the Derived table’s lastBuiltAt and lastBuildError. If it is already rebuilding (buildVerdict reads "building" or "invalidated"), let that rebuild finish first: it read its inputs before your write.
  2. Afterwards, poll it, with a timeout, until one of the two changes.
    • A moved lastBuiltAt means the new rows are queryable. If you need the column list too, also wait for buildVerdict to leave building.
    • A new lastBuildError with lastBuiltAt unchanged means the rebuild failed (one that failed after its data landed moves both).
  3. If the timeout passes, read buildVerdict and lastBuildError rather than treating it as a failure. Neither field moving after buildVerdict left building means the rebuild saved no result. A table built from several inputs may be waiting, healthy, for the last of them: poll again. A table whose inputs aren’t all there doesn’t rebuild; the first time, its lastBuildError names the missing input.

Don’t poll buildVerdict alone: a quick rebuild can go from "ok" back to "ok" between two polls. From the CLI, ronja api --wait-until runs this wait.

When one run of your script sends several tables that a Derived table reads together, such as orders and customers joined in a report, each table rebuilds the report as it lands. The first rebuild joins the new orders with the old customers, publishes it and fires any Automation watching the report. To land the set as one change, hold back each table’s rebuild and release them together:

  1. Add ?cascade=defer to every write:

    • for a Dynamic table, to the row push (/rows), the Parquet upload (/rows/parquet) and emptying the table (/clear);
    • for an Integration table you push files to, to Build (/build). Start every build before you wait on any of them, then wait for each, as in Push data files.

    The data lands as usual and is queryable at once, and each table’s own Automations and health checks run now. Only the Derived tables built from it wait.

  2. Check the cascade field on each response. "deferred" means the rebuild is held. "immediate" means that write has already rebuilt its Derived tables, because the hold couldn’t be recorded; the data landed either way, so carry on. On a Build, the field echoes what you asked for, because the build runs afterwards.

  3. Release them in one call, naming every table you sent:

    Terminal window
    curl -X POST "$RONJA_BASE_URL/api/v2/feature/model/cascade" \
    -H "Authorization: $RONJA_API_TOKEN" \
    -d '{"tableIds":["table-a1b2c3d4e5","table-f6g7h8i9j0"]}'
    # -> 200 {"released":["table-a1b2c3d4e5","table-f6g7h8i9j0"],"notPending":[]}

    Every Derived table built from them rebuilds once, over all of them together, and any Automation watching it runs once.

A complete nightly push shows the loop in Python, with retries. What to expect:

  • Releasing is safe to repeat. It releases only what is still held. A table under notPending had nothing held: it was never deferred, its response said "immediate", its Build failed before its data landed, or it was already released, by an earlier call, the automatic release, or an ordinary write to that table.
  • A table still building is refused. If any table you name is still building, the call answers 409 and releases nothing: wait for that build, then call again. ?cascade=defer on a Build of a table already building is a 409 too.
  • The release is automatic after 15–20 minutes from a table’s first held write, so a forgotten release costs only that delay. A batch that takes longer has its oldest tables released partway through: send everything first and release straight after.
  • Derived tables normally keep their previous data while they wait, and held writes don’t move their lastBuiltAt. One that also reads a table someone else changes after your first held write waits for your release, for at most the same 15–20 minutes; the Data map’s Builds lens shows it as Waiting on an input, naming your table.
  • Refusals. Releasing needs write access to every table you name. A table you can’t write, one that doesn’t exist and one from another organization all get the same 404. Only a Dynamic table, or an Integration table you push files to, can be released; any other table is a 400, as is an empty list or more than 100 tables. A 503 is safe to retry: if the retry lists the tables under notPending, the first call had released them.
  • If a write fails partway, retry it before you release. A hold can’t be cancelled: if you give up, the tables already written are released after 15–20 minutes anyway, and the Derived tables rebuild over the part that landed. A replace write is safe to resend, and a 409 on a write means the table was busy and nothing was written.

A Ronja API credential is a scoped API token sealed inside a secret and pointed back at your own organization, so Ronja’s agents and workflows can call your Ronja API for what the built-in tools don’t cover.

  1. In a chat, ask Ronja to “create a Ronja API credential”. It goes in your working feature, read-only on Data, Structure and Analytics, unless you say otherwise; the other settings are in the API reference.
  2. Approve it as a person signed in to Ronja. Creating one and approving it refuse automated callers, so curl, a token, the CLI or a chat driven from a coding agent get "code": "human_required".

The token is never shown, to anyone; for another scope or role, create a new credential. An agent or workflow references the secret and Ronja adds the Authorization header.

  • Referencing one from a workflow takes an Admin. A non-Admin’s save drops the reference, with a warning.
  • Using one in a chat is Admin-only. To delegate, an Admin attaches it to an automation or a Saved Agent that lists it among its references, which then runs for whoever triggers it.
  • Its token shows in API Tokens as Managed by secret and can’t be deleted there. Deleting the secret revokes it within 30 seconds. The secret’s page shows a Ronja API token badge and, for Admins, a View token link.

For reads, no credential is needed: an Admin can ask Ronja to fetch an endpoint in a chat, as themselves and read-only.