Build on Acontactz
Everything the Acontactz app does goes through one API: REST for straightforward calls, GraphQL to get exactly the data you need in one request. Try both here with your own credential.
Quick start
-
Make an API key
A program signs in with an API key of its own, not with a person's account. A key belongs to one workspace and can do what its roles allow, nothing more. The owner or an administrator of the workspace makes it in the app, under Settings › Integrations › API keys, and it is shown only once: keep it somewhere safe.
-
Call the REST API
Send the key as a bearer token. It names its workspace, so no other header is needed.
curl "{{base}}/tables/contacts/records?limit=5" \ -H "Authorization: Bearer $API_KEY" -
Or ask GraphQL
curl {{base}}/graphql \ -H "Authorization: Bearer $API_KEY" \ -H "Content-Type: application/json" \ -d '{"query": "{ records(table: \"contacts\", limit: 5) { id values } }"}'
Authentication
Every request carries Authorization: Bearer <credential>. Two kinds work:
- API key (
ak_…) - For programs and integrations. Send the key itself on every request; the API trades it for a short-lived token and reuses it. Revoking a key stops it within five minutes. What a key does is recorded in the workspace's audit log as the key.
- A person's token
- For apps that act as someone who signed in:
GET /api/auth/tokenonce a workspace is active answers a token good for 15 minutes. Fetch a new one before it runs out.
Paste either one with to try the API from these pages. It stays in this browser tab only and is sent only to the base URL above.
REST
Resources are JSON over HTTPS: GET to read, POST to create, PATCH to
change, DELETE to remove. Lists take where (JSON), sort,
limit and offset. The whole API is described as OpenAPI 3.1 at
/openapi.json: load it in Postman or
Insomnia, or generate a client from it.
GraphQL
One endpoint, POST /graphql, with the same operations as REST and more. Ask for several things
in one request; a field that fails answers null with an error, and the rest still answers.
Errors carry extensions.code (NOT_FOUND, FORBIDDEN,
BAD_REQUEST…) and extensions.status.
query {
records(table: "contacts", limit: 5) { id values }
}
Rate limits
Each workspace has a number of requests a minute, whoever sends them. Every answer says where you stand in
RateLimit-Limit, RateLimit-Remaining and RateLimit-Reset (seconds).
Past the limit the answer is 429 with Retry-After: wait that long, then try again.
Errors
An error answers its HTTP status with a stable code next to a readable message.
Match on the code; the wording may change.
{
"statusCode": 403,
"error": "Forbidden",
"code": "plan.records.limit_reached",
"message": "The plan allows 100 contacts records. Upgrade to add more.",
"params": { "limit": 100, "table": "contacts" }
}
Every code, with its status and parameters, is listed at
/messages/catalog.