BunnyDoc
APIE-Signing API

Get an access token

Exchange your API key for a short-lived bearer token — the first call every E-Signing API integration makes.

Every E-Signing API integration starts here. You send your API key once to this endpoint and get back a short-lived access token. From then on, every other request carries only the token — your key never travels again.

Endpoint

POST   https://api2.bunnydoc.com/v1/auth/token

Request

The key is sent in a header. There is no request body.

HeaderRequiredValue
X-API-KeyYesYour API key, e.g. bd_live_a1b2c3d4e5f6…. Create one under Settings → API Keys.

Example request

Request a token
curl -X POST https://api2.bunnydoc.com/v1/auth/token \
  -H "X-API-Key: bd_live_a1b2c3d4e5f6g7h8"

Response

A 200 OK returns the token and the scopes it carries.

200 OK
{
  "access_token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJrZXlfaWQiOiI…",
  "token_type": "Bearer",
  "expires_in": 3600,
  "scopes": ["templates:read", "contacts:read", "contacts:write", "envelopes:send"]
}
FieldTypeDescription
access_tokenstringThe bearer token. Send it as Authorization: Bearer <access_token> on every other request.
token_typestringAlways Bearer.
expires_inintegerSeconds until the token expires — always 3600 (one hour).
scopesstring[]The permissions this token carries, inherited from the key.

Using the token

Send the token in the Authorization header on every other call. For example, to list your templates:

Authenticated request
curl https://api2.bunnydoc.com/v1/templates \
  -H "Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9…"

Errors

Every error has the same shape — branch on error.code, never on the message text.

Example error
{
  "error": {
    "code": "invalid_api_key",
    "message": "The API key is invalid, revoked, expired, or not a live-mode key."
  }
}
Statuserror.codeWhen it happens
401missing_api_keyNo X-API-Key header was sent.
401invalid_api_keyThe key is unknown, revoked, expired, or not a live-mode key. All four return the same body — we don't reveal which.
403forbiddenAPI access isn't included in your company's current plan.
429rate_limitedMore than 20 token requests in 15 minutes from one IP. Request one token per hour, not one per call.

See the full error reference for every code the API can return.

Good to know

Tokens last one hour — cache and reuse them

expires_in is always 3600 seconds. Request a token, hold onto it, and only exchange your key again when the token is close to expiring. The token-exchange endpoint is rate limited to 20 requests per 15 minutes per IP precisely because a healthy integration needs about one token per hour, not one per request.

Revoking or rotating a key invalidates its tokens immediately

You don't have to wait for a token to expire. The moment a key is rotated or revoked in Settings → API Keys, every token minted from it stops working on its next request.

Next steps

On this page