Define a contact variable.
curl --request POST \
--url https://omni-api.sendblue.com/variables \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--header 'Idempotency-Key: <idempotency-key>' \
--data '
{
"name": "Birthday",
"type": "date"
}
'const options = {
method: 'POST',
headers: {
'Idempotency-Key': '<idempotency-key>',
Authorization: 'Bearer <token>',
'Content-Type': 'application/json'
},
body: JSON.stringify({name: 'Birthday', type: 'date'})
};
fetch('https://omni-api.sendblue.com/variables', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://omni-api.sendblue.com/variables"
payload = {
"name": "Birthday",
"type": "date"
}
headers = {
"Idempotency-Key": "<idempotency-key>",
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text){
"id": "var-1",
"name": "Birthday",
"type": "date",
"created_at": null
}{
"error": {
"code": "invalid_request",
"message": "Unknown field",
"details": {
"field": "colour"
}
}
}Define a contact variable.
If completion is unknown, replay the same body with its original Idempotency-Key to recover the original result.
Required permission: variables:write. Accepted credentials: a signed-in person, an API key, the account token.
POST
/
variables
Define a contact variable.
curl --request POST \
--url https://omni-api.sendblue.com/variables \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--header 'Idempotency-Key: <idempotency-key>' \
--data '
{
"name": "Birthday",
"type": "date"
}
'const options = {
method: 'POST',
headers: {
'Idempotency-Key': '<idempotency-key>',
Authorization: 'Bearer <token>',
'Content-Type': 'application/json'
},
body: JSON.stringify({name: 'Birthday', type: 'date'})
};
fetch('https://omni-api.sendblue.com/variables', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://omni-api.sendblue.com/variables"
payload = {
"name": "Birthday",
"type": "date"
}
headers = {
"Idempotency-Key": "<idempotency-key>",
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text){
"id": "var-1",
"name": "Birthday",
"type": "date",
"created_at": null
}{
"error": {
"code": "invalid_request",
"message": "Unknown field",
"details": {
"field": "colour"
}
}
}Authorizations
personbearerlegacyKeyId & legacyKeySecret
Headers
Body
application/json