Upsert a record
curl --request POST \
--url https://{host}/v2/workspaces/slug:ai-collection-v3/webhooks/v1/collections/{collection_id}/data/upsert \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"data": {
"product_name": "Laptop Pro 16",
"price": 2199.9,
"stock": 42,
"active": true
},
"match_fields": [
"email"
]
}
'const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
data: {product_name: 'Laptop Pro 16', price: 2199.9, stock: 42, active: true},
match_fields: ['email']
})
};
fetch('https://{host}/v2/workspaces/slug:ai-collection-v3/webhooks/v1/collections/{collection_id}/data/upsert', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://{host}/v2/workspaces/slug:ai-collection-v3/webhooks/v1/collections/{collection_id}/data/upsert"
payload = {
"data": {
"product_name": "Laptop Pro 16",
"price": 2199.9,
"stock": 42,
"active": True
},
"match_fields": ["email"]
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text){
"operation": "upserted",
"result": {}
}{
"error": "InvalidArguments",
"message": "<string>"
}Records
Upsert a record
Inserts the record, or updates the existing one matching the
match_fields values (e.g. an email or a SKU).
Rate limit: 50 requests/min per user.
POST
/
v1
/
collections
/
{collection_id}
/
data
/
upsert
Upsert a record
curl --request POST \
--url https://{host}/v2/workspaces/slug:ai-collection-v3/webhooks/v1/collections/{collection_id}/data/upsert \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"data": {
"product_name": "Laptop Pro 16",
"price": 2199.9,
"stock": 42,
"active": true
},
"match_fields": [
"email"
]
}
'const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
data: {product_name: 'Laptop Pro 16', price: 2199.9, stock: 42, active: true},
match_fields: ['email']
})
};
fetch('https://{host}/v2/workspaces/slug:ai-collection-v3/webhooks/v1/collections/{collection_id}/data/upsert', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://{host}/v2/workspaces/slug:ai-collection-v3/webhooks/v1/collections/{collection_id}/data/upsert"
payload = {
"data": {
"product_name": "Laptop Pro 16",
"price": 2199.9,
"stock": 42,
"active": True
},
"match_fields": ["email"]
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text){
"operation": "upserted",
"result": {}
}{
"error": "InvalidArguments",
"message": "<string>"
}Authorizations
BearerAuthOrgApiKeyAuth
User session JWT. Send as Authorization: Bearer <token>.
Path Parameters
Collection identifier returned at creation.
Body
application/json
Record fields matching the collection schema. Unknown fields are accepted (flexible schema); system fields are ignored.
Example:
{
"product_name": "Laptop Pro 16",
"price": 2199.9,
"stock": 42,
"active": true
}
Fields identifying the record to update if it exists.
Example:
["email"]
Required range:
x >= 0Was this page helpful?