Base URL
https://queryapis.grainql.com/v1/api/queryAuthentication
Every request carries an API key in theX-API-Key header and a JSON content type.
- Open Settings, then API keys, at
https://grainql.com/dashboard/settings/api-keys. - Click Create key.
- Enter a name for the key.
- Under Access, select Query API.
- Copy the key. The dashboard shows it one time.
authStrategy. The key works when the
SDK uses NONE, SERVER_SIDE, or JWT. Read Authentication.
Endpoints
{tenantAlias} is the tenant alias that the dashboard shows. It is not the tenant UUID. A UUID
in the path returns 404.
Filters are the same on the query and count endpoints. Read
Filters.
The Query API does not write events. Send events with the GrainQL Tag or Analytics Web. Analytics
Web has no Query API methods, so call these endpoints with an HTTP client.
Rate limits
The limit applies per workspace. Every API key of the workspace counts against the same limit. The limit is the same on every plan.Rate limit headers
Every response carries three headers:
A request over the limit gets
429 and a Retry-After header with a number of seconds:
429, wait Retry-After seconds, then retry the request one time.
Errors
Every error body is a JSON object with anerror string. A 429 body also has message and
retryAfter.
A filter with an unknown property path, an unknown operator, or a value of the wrong type also
returns an error body. Read Filters.
Request format
The twoPOST endpoints take a JSON body. GET /events/{tenantAlias} takes no body.
Response format
POST /{tenantAlias} returns an array of event objects:
POST /count/{tenantAlias} returns one object:
GET /events/{tenantAlias} returns an array of strings: