Reference

Authentication API

REST endpoints for user login and server-to-server token issuance.

All Breeze Buddy endpoints require a Bearer token in Authorization: Bearer <token>. For a conceptual overview of when to use which token, see Authentication.

POST /login

Exchange email and password for a short-lived JWT access token.

POST /login

Request

{
  "email": "user@example.com",
  "password": "your-password"
}
FieldTypeRequiredDescription
emailstringyesUser email.
passwordstringyesUser password.

Response — 200 OK

{
  "access_token": "eyJhbGciOiJIUzI1NiIs...",
  "token_type": "bearer",
  "user": {
    "id": "usr_abc123",
    "email": "user@example.com",
    "role": "admin",
    "reseller_id": "res_001"
  }
}
FieldTypeDescription
access_tokenstringJWT. Include as Authorization: Bearer <token> on subsequent requests.
token_typestringAlways bearer.
user.idstringStable user identifier.
user.emailstringEmail the user authenticated with.
user.rolestringOne of admin, reseller, merchant, user. See RBAC.
user.reseller_idstringReseller scope the user belongs to.

Errors

StatusMeaningCommon cause
401UnauthorizedMissing or expired token on a protected route (not thrown by /login itself).
403ForbiddenToken role lacks permission for the requested resource.
422Unprocessable EntityEmail or password missing, malformed, or incorrect.

Token expiry

Access tokens are short-lived. Call /login again to issue a new one — there is no refresh endpoint.


POST /s2s-token

Issue a long-lived server-to-server token. Use these for backend integrations that push leads or manage templates on behalf of a reseller or merchant.

POST /s2s-token

Request

{
  "name": "my-backend-integration",
  "role": "merchant",
  "reseller_id": "res_001",
  "merchant_id": "mer_abc"
}
FieldTypeRequiredDescription
namestringyesHuman-readable identifier for the token (shown in audit logs).
rolestringyesreseller, merchant, or user. Determines permission scope.
reseller_idstringyesReseller under which the token operates.
merchant_idstringwhen role is merchant or userMerchant the token is scoped to.

Response — 200 OK

{
  "token": "s2s_eyJhbGciOiJIUzI1NiIs...",
  "name": "my-backend-integration",
  "role": "merchant",
  "reseller_id": "res_001",
  "merchant_id": "mer_abc",
  "created_at": "2026-04-14T10:00:00Z"
}

Keep S2S tokens secure

S2S tokens grant persistent access. Store them in environment variables or a secrets manager — never commit them to source control.

Errors

StatusMeaningCommon cause
403ForbiddenCaller role cannot issue a token at the requested scope.
422Unprocessable EntityMissing merchant_id when role requires it, or unknown reseller_id.
Was this helpful?