v1
Guide

Authentication

Every call carries the key and the secret of an API key. The key's scopes decide which routes it reaches.

The two headers

HeaderWhat it carries
X-API-KEYThe public key of the credential, created in Settings → API keys.
X-API-SECRETThe secret of the credential. It is shown only once, when the key is created.
An authenticated call
curl "https://api.guria.io/api/v1/contacts" \
  -H "X-API-KEY: $GURIA_API_KEY" \
  -H "X-API-SECRET: $GURIA_API_SECRET"

Scopes

Each key is created with the scopes you pick, and only gets through the routes they cover. A scope is a panel permission: View contacts is contacts.read, Send messages is messages.send.

  • Each route's page says which scope it requires.
  • Dependent scopes come along: picking Create contacts already includes View contacts.
  • Whoever creates the key can only grant what their own profile has.
  • Changing a key's scopes takes effect from its next call.

When authentication fails

StatusWhat happenedWhat to do
401One of the headers is missing, the key does not exist, was revoked, or the secret is wrong. A key that does not exist, a revoked key and a wrong secret all get the same response; without the key header, the 401 comes with no body.Check both values and that the key is still active.
403The key authenticated, but it lacks the route's scope, or the company's plan does not include the feature.Add the scope to the key, in Settings → API keys.
401
{
  "error": "unauthorized",
  "message": "Credenciais de API inválidas."
}

Looking after the secret

  • The secret is shown only once, when the key is created. Guria stores only its hash.
  • Keep it in an environment variable or a secrets vault (GURIA_API_KEY and GURIA_API_SECRET in the examples here), never in the repository.
  • Revoking a key is immediate: the integrations using it start getting 401.