POST
/v1/audiences/sqlCreate a SQL audience
Creates an audience from a read-only SQL query over modeled customer data.
Authentication
Requires Authorization: Bearer ${API_KEY}. Create and rotate keys from the TrackLayer dashboard.
Request body schema
{
"name": "string",
"sql": "string",
"refresh_interval": "hourly | daily"
}Response schema · 201
{
"id": "aud_456",
"type": "sql",
"status": "validating"
}Response example
{
"id": "aud_456",
"type": "sql",
"status": "validating"
}Code examples
curl https://api.tracklayer.com/v1/audiences/sql \
-X POST \
-H "Authorization: Bearer ${API_KEY}" \
-H "Content-Type: application/json" \
-d '{"name":"VIP purchasers","sql":"select identity_id from customers where lifetime_value > 500","refresh_interval":"daily"}'Try it out
Use the dashboard to create an API key, then run one of the examples above with TRACKLAYER_API_KEY set in your environment.