Insert a row or update the existing row that conflicts on a selected unique column.
WARNING — the update branch REPLACES the row, it does not merge. data is treated as the complete new row value, so every column you omit is cleared on the matched row. Upserting 2 of 10 columns blanks the other 8. This differs from PATCH /api/v2/tables/{tableId}/rows/{rowId}, which merges the patch into the existing row data. Send the full row here, or use PATCH when you only mean to change a subset.
/api/v2/tables/{tableId}/rows/upsertAuthorization
apiKey Your Sim API key, personal or workspace-scoped. Generate one from the Sim dashboard under Settings > API Keys. A workspace API key is not accepted everywhere: operations that act on behalf of a specific human — administrative reads, secret access, and irreversible or governance-affecting writes — always reject it, whatever role the key carries. Each such operation says so in its own description, and the rejection surfaces as 403 unless the operation conceals unauthorized resources, in which case it is reported as 404. Use a personal API key for those.
In: header
Path Parameters
Unique table identifier.
1 <= lengthRequest Body
application/json
Workspace scope, row data, and optional unique-column conflict target.
TypeScript Definitions
Use the request body type in TypeScript.
Response Body
application/json
application/json
application/json
application/json
application/json
application/json
application/json
application/json
application/json
curl -X POST "https://www.sim.ai/api/v2/tables/string/rows/upsert" \ -H "Content-Type: application/json" \ -d '{ "workspaceId": "a91c4b2e-6d3f-4e8a-b5c7-0d9e2f1a8c64", "data": { "email": "jane@example.com", "status": "active" }, "conflictTarget": "email" }'{
"data": {
"row": {
"id": "string",
"data": {
"email": "jane@example.com",
"name": "Jane Doe",
"age": 30
},
"createdAt": "2019-08-24T14:15:22Z",
"updatedAt": "2019-08-24T14:15:22Z"
},
"operation": "insert"
}
}{
"error": {
"code": "BAD_REQUEST",
"message": "The request is invalid."
}
}{
"error": {
"code": "BAD_REQUEST",
"message": "The request is invalid."
}
}{
"error": {
"code": "BAD_REQUEST",
"message": "The request is invalid."
}
}{
"error": {
"code": "BAD_REQUEST",
"message": "The request is invalid."
}
}{
"error": {
"code": "BAD_REQUEST",
"message": "The request is invalid."
}
}{
"error": {
"code": "BAD_REQUEST",
"message": "The request is invalid."
}
}{
"error": {
"code": "BAD_REQUEST",
"message": "The request is invalid."
}
}{
"error": {
"code": "BAD_REQUEST",
"message": "The request is invalid."
}
}