Make your first API call
Get an API key, read your account, create a contact and page through contacts with curl.
- Who can do this
- The account owner makes the key; anyone with the key can call the API within its scopes.
On this page
This takes about five minutes with a terminal and curl. Use a test account or a test contact you can delete later.
1. Get a key
In IA Compa, make an API key with workspace:read, crm:read and crm:write, confirm with a two-step code and copy it: it is shown once. Store it in an environment variable:
export IACOMPA_API_KEY="iac_live_…"2. Read your account
curl https://iac.manage.iacompa.com/api/v1/workspace \
-H "Authorization: Bearer $IACOMPA_API_KEY"The answer names the account, its features, the key's scopes and today's usage.
3. Create a contact
curl https://iac.manage.iacompa.com/api/v1/contacts \
-H "Authorization: Bearer $IACOMPA_API_KEY" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: quickstart-1" \
-d '{"first_name":"Test","last_name":"Contact","email":"test@example.com"}'You get 201 and the contact. Run the same command again: the same contact comes back with Idempotent-Replayed: true, not a duplicate.
4. Page through contacts
curl "https://iac.manage.iacompa.com/api/v1/contacts?limit=25" -H "Authorization: Bearer $IACOMPA_API_KEY"
# then pass next_cursor back:
curl "https://iac.manage.iacompa.com/api/v1/contacts?limit=25&cursor=<next_cursor>" -H "Authorization: Bearer $IACOMPA_API_KEY"Next
- Browse every endpoint in the REST API reference.
- Handle errors and rate limits.
- Revoke the test key when you're done.
Common answers on the first call
- 401
unauthorizedorinvalid_api_key - The header is missing or the key is wrong, revoked or expired. Send exactly
Authorization: Bearer <key>and check the variable holds the whole key. - 403
insufficient_scope - The key wasn't given the scope the endpoint needs. Make a new key with that scope.
- 400
invalid_requestwhen creating a contact - A field is unknown or malformed. The
issueslist names each path, such asemail. Bodies are strict, so remove any field the endpoint doesn't take. - 404 on every path
- The REST API isn't turned on yet. It is rolling out; this guide is ready for when it opens.
Related articles
- REST API guideRolling outAuthenticate with API keys and use scopes, errors, rate limits, idempotency, pagination and the OpenAPI document.
- REST API referenceRolling outEvery endpoint of the IA Compa REST API v1 with its method, path, scope, parameters and examples.
- Outbound webhooksRolling outReceive signed posts at your own HTTPS address when contacts, opportunities, tasks, bookings or forms change.