Authentication
Authentication to the Ampere API is required for all endpoints (unless explicitly marked as public).
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
| Method | Path | Auth required | Purpose |
|---|---|---|---|
POST | /login | No | Exchange email + password for access and refresh tokens |
POST | /refresh | No (refresh token in body) | Rotate the token pair |
GET | /me | Bearer access token | Return the authenticated user profile and role |
POST | /logout | Bearer access token | Revoke the current access token and clear the refresh credential |
Token model
| Property | Value |
|---|---|
| Transport | Authorization: Bearer <accessToken> |
| Access token lifetime | 30 minutes |
| Refresh token lifetime | 7 days |
| Refresh transport | JSON 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
- Call
POST /auth/loginonce to obtain credentials. - Attach the access token to all protected requests.
- Call
POST /auth/refreshbefore access-token expiry (or on401after a failed protected call). - Call
POST /auth/logoutwhen ending a session deliberately. - Keep refresh tokens in a secure store; do not log tokens in plaintext.
Updated about 2 months ago
What’s Next
Did this page help you?