SQL
Query SQL
Changed onQuery records and lists with SQL. Your workspace must be on the Enterprise plan in order to access this endpoint.
This endpoint is rate limited to 2 requests per second.
This endpoint is in beta. We will aim to avoid breaking changes, but small updates may be made as we roll out to more users.
Required scopes: record_permission:read, object_configuration:read.
Supported token levels: workspace, user.
post/v2/sql
Request
- Base URLhttps://api.attio.com
- URLhttps://api.attio.com/v2/sql
- AuthOAuth 2Authorization code: https://app.attio.com/authorizeToken URL: https://app.attio.com/oauth/token scopes: record_permission:read, object_configuration:read
Request body
Example request
{
"sql": "SELECT * FROM companies WHERE (name = $name OR name = ANY($names)) AND created_at >= $since",
"parameters": {
"name": {
"type": "string",
"value": "Fundstack"
},
"since": {
"type": "timestamp",
"value": "2023-01-01T15:00:00.000000000Z"
},
"names": {
"type": "list",
"item_type": "string",
"value": [
"Fundstack",
"Acme"
]
}
}
}Response
Success
Example response
{
"data": {
"rows": [
{
"record_id": "bf071e1f-6035-429d-b874-d83ea64ea13b",
"created_at": "2023-01-01T15:00:00.000000000Z",
"name": "Fundstack",
"created_by": {
"type": "workspace-member",
"id": "50cf242c-7fa3-4cad-87d0-75b1af71c57b"
},
"domains": [
"fundstack.com"
]
}
]
}
}Changes
- info
added the new optional request property
- info
- info
endpoint added
- info