GuidesAPI ReferenceChangelogDiscussions
Log In
Guides

Authentication

Authentication to the Ampere API is required for all endpoints (unless explicitly marked as public).

⚠️

Important: Always use HTTPS to protect credentials in transit.

Token-based (Bearer) Authentication

Clients must include an Authorization header with a bearer token.

Authorization: Bearer <accessToken>

Ampere authenticates partners with short-lived JWT access tokens. There is no API-key authentication on the HTTP API.

Base path: /api/v2/auth

What we provide

MethodPathAuth requiredPurpose
POST/loginNoExchange email + password for access and refresh tokens
POST/refreshNo (refresh token in body)Rotate the token pair
GET/meBearer access tokenReturn the authenticated user profile and role
POST/logoutBearer access tokenRevoke the current access token and clear the refresh credential

Token model

PropertyValue
TransportAuthorization: Bearer <accessToken>
Access token lifetime30 minutes
Refresh token lifetime7 days
Refresh transportJSON body field refreshToken (not the Authorization header)

Login and refresh responses include the token pair plus user identity fields such as uuid and role.

Behaviour partners should rely on

  • Access tokens are validated on every protected request.
  • Refresh tokens are rotated: a successful refresh issues a new pair and invalidates the previous refresh credential.
  • Logout blacklists the access token for the remainder of its lifetime and clears the stored refresh credential.
  • Inactive accounts cannot authenticate.
  • A refresh token cannot be used as an access token.

Integration guidance

  1. Call POST /auth/login once to obtain credentials.
  2. Attach the access token to all protected requests.
  3. Call POST /auth/refresh before access-token expiry (or on 401 after a failed protected call).
  4. Call POST /auth/logout when ending a session deliberately.
  5. Keep refresh tokens in a secure store; do not log tokens in plaintext.

Did this page help you?