Authentication
Every request to the Sync GTM API is authenticated with an organization API key, sent as a Bearer token:
Authorization: Bearer sgtm_live_4f9KxQ2mT7vLp0aZcB3nYw8eRjH6sD1uCreate keys in Settings → API keys, keep them on your server, and revoke any key that leaks. A request without a valid key gets 401 invalid_api_key and is never charged.
- Header
- Authorization: Bearer <key>
- Key format
- sgtm_live_ + 32 characters
- Scope
- Your whole organization
- Who can create
- Owners and admins
Create a key
Open API keys
Go to Settings → API keys and click Create key. Owners and admins can create and revoke keys; members can only view the list.
Name it for the integration
Use the system that will hold the key: “CRM sync”, “Signup webhook”, “Data team notebook”. Give each integration its own key, so you can revoke one without breaking the rest.
Copy it now
The full key is shown once. Sync GTM keeps only a hash, so it can never be displayed again — lose it and you revoke it and create a new one. Paste it straight into an environment variable or your secret manager. Afterwards the list shows just the prefix, like sgtm_live_4f9K…, so you can tell keys apart.
Send the key
Put the key in the Authorization header of every request, after the word Bearer and a single space. Read it from the environment rather than writing it into your code:
export SYNCGTM_API_KEY="sgtm_live_..."Then call any endpoint. This one verifies an email, the cheapest way to confirm a new key works:
cURL
curl https://api.syncgtm.com/v1/api/enrich/verify-email \
-H "Authorization: Bearer $SYNCGTM_API_KEY" \
-H "Content-Type: application/json" \
-d '{"email": "jane@stripe.com"}'A 200 means the key works. A 401 means it does not — see Fix a 401.
Keep it secret
Anyone who holds a key can spend your organization’s credits. Treat it like a password:
- Call the API from a server only. Never ship a key in a browser app, a mobile app or anything else a user can download and inspect.
- Keep it out of source control. Load it from an environment variable or a secret manager, and keep
.envfiles in.gitignore. - Keep it out of logs. Do not log request headers, and redact
Authorizationin error reports and traces. - One key per integration. If one system leaks its key, you revoke that key and nothing else goes down.
Never paste an API key into a support message. Quote the visible prefix from the key list instead.
Who a call is billed to
A key belongs to the organization, not to a workspace or a single table. Every call draws on the organization’s credit balance and is recorded against the person who created the key.
A key works only while its creator can still create keys. It turns inactive — shown in the list, and rejected with 401 — when its creator:
- is removed from the organization, or
- is moved to a role below admin.
This is deliberate: a key never outlives the authority of the person who made it. If an admin is leaving or changing role, have an admin who is staying create replacement keys before the change, and swap them into your integrations first.
Rotate a key
An organization can hold several keys at once, so you can replace one without downtime:
Create the new key
Name it after the same integration so the pair is easy to spot in the list.
Deploy it
Update the environment variable or secret, and restart or redeploy whatever reads it.
Confirm traffic on the new key
Make a test call, or check the integration is still running normally.
Revoke the old key
Only once nothing depends on it anymore.
Revoke a key
In Settings → API keys, click revoke on the key. It stops working on the next request. Revoking cannot be undone; create a new key if you need access again.
Revoke a key immediately if it was committed to a repository, pasted into a chat or written to a log — then rotate the integration onto a fresh key. Keys start with sgtm_live_ so secret scanners can recognise them.
Fix a 401
A 401 returns the code invalid_api_key and is never charged. Work through these in order:
| Check | Fix |
|---|---|
| The header is missing or misspelled | Send exactly Authorization: Bearer <key>, with one space after Bearer. |
| The environment variable is empty where the code runs | Log the first few characters of the key at startup — never the whole key — and confirm it starts with sgtm_live_. |
| The key picked up quotes, whitespace or a line break when it was pasted | Trim it, or copy it again from your secret manager. |
| The key was revoked | Create a new key. |
| The key shows as inactive | Its creator left the organization or lost admin rights. An admin who is staying creates a replacement. |
Next steps
- Endpoint reference — the four lookups, their inputs and credit costs
- Errors — every status code and what to do about it
- Rate limits and retries — request limits, idempotency and timeouts