Writing records over the API: create, update, upsert, delete
Create, update, upsert and delete records over the API: 100 to a batch, all-or-nothing, upsert matched on fields you name, delete to a 7-day trash.
Updated November 2026
One endpoint, /api/tables/:id/records, takes four methods. POST creates,
PATCH updates by id, PUT upserts and DELETE moves records to the trash.
Each call carries up to 100 records and is all-or-nothing. It runs as one
transaction, so a batch that fails on record 97 leaves records 1 through 96
unwritten too.
Creating records, and a failed batch
POST takes {"records":[{"fields":{…}},…]}. Send three plants where the
third names a select choice that doesn't exist:
curl -X POST "https://tabladb.com/api/tables/tbl_jukzu86nxtcj/records" \
-H "Authorization: Bearer key_xxxx.your-secret" \
-H "Content-Type: application/json" \
-d '{"records":[{"fields":{"Name":"Spider plant","Price":14}},
{"fields":{"Name":"Jade plant","Price":16}},
{"fields":{"Name":"Calathea","Price":34,"Light":"Shade"}}]}'
{"error":{"code":"bad_request","message":"\"Shade\" is not a valid choice for field \"Light\"."}}
The two valid records were not written either. We filtered for them right
after and got {"records":[]}. Fix the batch and send the whole thing again.
There is no partial state to sort out.
Update by id
PATCH takes the same shape plus each record's id. Only the fields you
send change. An optional if_updated_at on each record makes the write fail
with a 409 if the record changed since you loaded it.
Errors and limits shows what that conflict
looks like.
Upsert: match, then update or create
PUT adds merge_on, the field or fields that identify a record:
curl -X PUT "https://tabladb.com/api/tables/tbl_jukzu86nxtcj/records" \
-H "Authorization: Bearer key_xxxx.your-secret" \
-H "Content-Type: application/json" \
-d '{"merge_on":["Name"],"records":[
{"fields":{"Name":"Fiddle-leaf fig","In stock":9}},
{"fields":{"Name":"Calathea orbifolia","Price":34,"Light":"Low light","In stock":5}}]}'
Each incoming record is matched against the table on its merge_on values.
If exactly one record matches, that record is updated, and if none matches, a
new one is created. The response tells you which happened in two places, on
each record and in lists of ids. Here the fig existed and the calathea
didn't:
{"records": [
{"id": "rec_utf767j36rpj", "created": false, "fields": {"Name": "Fiddle-leaf fig", "…": "…"}},
{"id": "rec_janiuq4ei9up", "created": true, "fields": {"Name": "Calathea orbifolia", "…": "…"}}],
"created_records": ["rec_janiuq4ei9up"],
"updated_records": ["rec_utf767j36rpj"]}
Use created on the record when you're looping. An automation tool holding
one record can read that record's own flag, while finding the same id in a
separate array takes a search the tool usually can't express. The two arrays
carry the same information, grouped, for anything that prefers it that way.
Attachments behave differently in an upsert. On a record the upsert
matched, an attachment cell is appended to, not replaced. An upsert is
usually a repeated sync, and a sync that deleted the files already on a record
it had only seen again would be the more expensive surprise. This is the only
place where upsert treats a cell differently from PATCH. To clear or shorten
an attachment cell, use PATCH.
Three cases are refused, with nothing written:
- Two existing records already share the key:
2 records already have Name="Fiddle-leaf fig", so this can't identify one.Tabla doesn't guess which one you meant. - Two records in the batch share a key:
Two records in this batch have the same Name="Calathea orbifolia". - A record leaves out a
merge_onfield entirely, so there is no key to match on.
merge_on takes any stored field that holds a single value: text, number,
date, checkbox or single select (a member field counts as text). A link, a
multi-select, an attachment or any computed field can't identify a record and
is refused by name. A date key is read the same way as every date write (see
Dates under the cell shapes below) before it's matched. So a sync that has
always sent "2026-08-12" still finds its record after Include time is
switched on, because switching it on gives that record the same instant the
bare date now means.
Deleting records
curl -X DELETE "https://tabladb.com/api/tables/tbl_jukzu86nxtcj/records" \
-H "Authorization: Bearer key_xxxx.your-secret" \
-H "Content-Type: application/json" \
-d '{"records":["rec_gjb32pptrttb"]}'
{"records":[{"id":"rec_gjb32pptrttb","deleted":true}]}
Deleted records stay in the trash for 7 days, and
POST /api/tables/:id/trash/restore brings them back with their links and
attachments. A client that can't send a body with DELETE can use
?records=rec_a,rec_b instead.
Cell shapes for the tricky types
We checked every shape below by writing it and reading it back.
- Linked records: write a list of
rec_…ids, as in"Customer": ["rec_ugnu6fgyhpsw"]. It comes back with each linked record's name added, as"Customer": [{"id": "rec_ugnu6fgyhpsw", "display": "Dina Aziz"}], and a PATCH may send that object form back unchanged. A link field set to a single record enforces it, and two ids getField "Customer" links a single record; got 2. - Selects: write the choice name (
"Status": "New") or its id. Either one is accepted, the id is what's stored, and reads return names (cell_format=idsfor ids). - Attachments: a list whose items can be an
att_…id, anhttps://URL, or{"url": "…", "filename": "…"}, mixed freely and kept in the order you send. Tabla fetches a URL during the write, so a file you have a link to needs no upload call and no second request.{"Photos": ["https://example.com/fig.png"]}works on create, update and upsert alike. If you have raw bytes instead of a link, upload them first withPOST /api/tables/:id/attachments(multipart:file,field_id,record_id, and the record must already exist). It returns{"id": "att_s86mde8pwzay", "filename": "fig.png", "size_bytes": 69, …}, and you then write that id into the cell. An id you didn't upload is refused withUnknown attachment id(s): att_000000000000. Upload the file first, or send its URL and Tabla will fetch it.The fetch is anonymous, so the link has to be publicly reachable. A request can carry 20 URLs, with 30s for each and 60s in total. If one of them fails, the whole batch fails and every file already fetched for it is deleted again. Be careful with retries here. Fetching is not idempotent, so a call that succeeds twice stores the file twice. A retry after a failure is safe, since a failed batch keeps nothing. - Member: write the person's email, as in
"Assigned to": "omar@sakkaraplants.com". The API stores the address as sent and doesn't check it against the member list. An address that belongs to no member shows in the grid as the bare address, with no name or photo to go with it. - Dates:
"2026-08-12", or a full timestamp for date-and-time fields, both read in the database's time zone. A bare"2026-08-12"written to a date-and-time field is the start of August 12 there. That's midnight, or the first moment the day has on the rare day the clocks jump forward at midnight. A timestamp that names its zone (Z,+02:00) written to a date-only field keeps the day it falls on there, so"2026-08-09T22:30:00Z"is August 10 in a Cairo database. A timestamp with no zone is read as the local clock time there."2026-08-12T10:00"is 10:00 on August 12 in the database's time zone on a date-and-time field, and just August 12 on a date-only one. Always write a date year first. On a date-only field,31.12.2025or12/31/2025is refused, not guessed at, withField "Due" expects a real date like "2026-07-02".Checkbox:trueorfalse. Duration: seconds, or"1:30". - Formula, lookup, rollup, button: computed, not written. A write to one
gets
"To collect" is a formula — it's computed automatically and can't be written to directly.
null clears any cell. The full field-by-field reference is at
/docs/api. When a mapping has to survive renames, key everything
by id (names and ids).