# upsertrow: Update or insert a row in a data table

> upsertrow (Update or insert a row in a data table) is a 1001fx API function in the group Data tables: POST https://api.1001fx.com/datatables/upsertrow, 1 credit per call. It works as a ready-made module in Make or as a plain HTTP call.

Updates the rows that match the conditions; if none matches, inserts a new row. For the new row, eq conditions on columns that are not in the values are taken over (e.g. orderId eq A-17). Returns action (updated or inserted) and the rows. Parallel calls on the same table can overwrite each other (last write wins): in Make, process bundles one after another for writing functions.

- Group: Data tables
- Endpoint: `POST https://api.1001fx.com/datatables/upsertrow`
- Authentication: header `X-API-KEY: YOURSECRETAPIKEY`
- Content type: application/json
- Credits: 1 credit per call
- Ready-made in: Make
- Docs: https://1001fx.com/functions/upsertrow

## Parameters

- `table` (string, required) – Table: ID or name of the data table.
- `filters` (array<object>, required) – Conditions: At least one condition.
  - `column` (string, required) – Column: Column name; id, createdAt and updatedAt work too.
  - `condition` (enum, required, one of `eq`, `neq`, `gt`, `gte`, `lt`, `lte`, `contains`, `isEmpty`, `isNotEmpty`) – Condition: contains ignores upper/lower case; isEmpty and isNotEmpty need no value.
  - `value` (any, optional) – Value: Compared by the type of the column.
- `match` (enum, optional, one of `all`, `any`, default `all`) – Match: all (default): every condition must match; any: one is enough.
- `data` (object, required) – Values: Columns to set.
- `ignoreUnknownColumns` (boolean, optional, default `false`) – Ignore unknown columns: Skip keys that are not columns of the table instead of an error.

## Example: Update or insert a row in a data table

```bash
curl -X POST 'https://api.1001fx.com/datatables/upsertrow' \
  -H 'X-API-KEY: YOURSECRETAPIKEY' \
  -H 'Content-Type: application/json' \
  -d '{"table":"processed_orders","filters":[{"column":"orderId","condition":"eq","value":"A-17"}],"data":{"total":49.9}}'
```
