Bondery Docs

Authentication

Authenticate REST API requests with sessions or long-lived API keys.

The Bondery API supports two authentication methods depending on how you call it.

Replace https://api.usebondery.com with your self-hosted API domain when applicable.

Session authentication

Use this when building on top of the webapp or mobile app, or when you have a Better Auth access token.

  1. Sign in at app.usebondery.com (or your instance).
  2. The browser sends session cookies automatically, or you can send the access token in the Authorization header.
curl -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \
  https://api.usebondery.com/api/contacts

Session auth works on all authenticated endpoints, including profile settings, chat, subscriptions, and API key management.

Create an API key

Use API keys for scripts, automation tools, and server-side integrations. Send the key as a Bearer token on every request.

  1. Sign in to the webapp (app.usebondery.com or your instance).
  2. Open Settings → API keys.
  3. Click Create API key, choose a label and permission level, then copy the key when it is shown.

The full key is shown once. Store it in a secrets manager. Bondery only keeps a masked prefix for identification.

Each account can have up to 5 keys. Deleting a key takes effect immediately.

Local development: ensure Postgres, Redis, and BONDERY_PRIVATE_BETTER_AUTH_SECRETS are configured — see Local development setup.

Send the key

Keys use the bondery_key_ prefix:

bondery_key_<keyId>_<secret>
curl -H "Authorization: Bearer bondery_key_abc123_your_secret_here" \
  https://api.usebondery.com/api/contacts

Permission levels

Access level is fixed when the key is created. Create a new key if you need a different level.

LevelHTTP methodsUse when
Read onlyGET, HEADListing or exporting data without writes
Full accessAll methodsImports, creates, updates, and deletes

A read-only key that calls POST, PATCH, or DELETE receives 403 with api_key_method_forbidden.

Which routes accept API keys

Only routes marked for integrations (openApiArea: integration) accept API keys. That includes contacts, groups, tags, interactions, contact share, import endpoints, and geocode. The full contract is in the API reference.

API keys do not work on session-only routes: account settings, merge, relationships, per-contact enrichment, sync, chat, subscriptions, admin, webhooks, or extension internals. A valid key on those paths returns 403 (api_key_route_forbidden).

Error codes

HTTPcodeWhen
401invalid_api_keyMalformed key, wrong secret, deleted key, or dev pepper mismatch
401auth_requiredNo credentials on a session-only route
403api_key_route_forbiddenValid key on a non-integration route
403api_key_method_forbiddenRead-only key used for a write
409api_key_limit_exceededAccount already has 5 keys

See Error codes for the full catalog.

Security

  • Do not commit API keys or paste them in public channels.
  • Prefer read-only keys when an integration only reads data.
  • Rotate by creating a new key, updating the integration, then deleting the old one.

On this page