REST API
This page covers the conventions that apply to every REST endpoint. Individual endpoints are documented under Endpoints.
Requests
- All request bodies are
application/json. SetContent-Type: application/json. - Query parameters are used for filtering and pagination on
GETrequests. - Path parameters (e.g.
:id) identify a specific resource.
Responses
- All responses are
application/json. - Successful list responses are wrapped:
{ "data": [...], "limit", "offset" }. - Successful create responses return the new resource (or its id/status) with
HTTP
201. - Successful delete responses return
{ "success": true }. - Errors follow a consistent shape — see Errors.
Pagination
List endpoints accept two query parameters:
| Parameter | Type | Default | Range |
|---|---|---|---|
limit | integer | 25 | 1–100 |
offset | integer | 0 | ≥ 0 |
curl "https://<your-api-origin>/api/v1/posts?limit=10&offset=20" \
-H "Authorization: Bearer gx_live_YOUR_API_KEY"
{
"data": [
/* ...up to 10 posts... */
],
"limit": 10,
"offset": 20
}
Validation
Each route validates its input (query, body, or path params) against a schema
before the handler runs. Invalid input short-circuits with 400 and a
details array describing exactly what failed:
{
"error": "Invalid request",
"details": [{ "path": ["accountIds"], "message": "Required" }]
}
Creating a post runs an additional layer of validation against
platform limits — a 400 (constraint violation) or
403 (ownership/forbidden) is returned if the post would break a platform
rule.
Versioning
The API is versioned in the path (/v1/...). Breaking changes will ship under
a new version; non-breaking additions (new fields, new endpoints) happen within
v1.
Endpoints
Next
- Authentication — if you skipped it.
- Errors — status codes and error shapes.
- Examples — ready-to-run recipes.