See the Authentication API reference for the interactive playground.
Principal types
DynamoSQL recognizes two principal types:| Type | Description | How to authenticate |
|---|---|---|
| Portal user | Human user who logged in via the DynamoSQL portal | Passkey or password + TOTP; portal issues a session |
| API client | Machine-to-machine service account created in the portal | POST /v1/auth/token with clientId + clientSecret |
/v1/query endpoint is intended for API clients. Portal users typically interact through the portal’s SQL editor.
Getting a token
API clients authenticate by posting their credentials to the token endpoint:accessToken— JWT valid for one hour. Pass asAuthorization: Bearer <accessToken>.refreshToken— use to obtain a new access token without re-sending credentials.expiresIn— token lifetime in seconds.
Scopes
Scopes control which endpoints an API client can access. They are assigned when the client is created in the portal.| Scope | Required for |
|---|---|
query | POST /v1/query (both execute and plan modes) |
schemas:read | GET /v1/schemas, GET /v1/schemas/{name} |
schemas:write | POST /v1/schemas, PATCH /v1/schemas/{name}, DELETE /v1/schemas/{name}, POST /v1/schemas/{name}/refresh-metadata, POST /v1/schemas/{name}/validate-role |
usage:read | GET /v1/usage/summary |
query and schemas:read by default.
Passing the bearer token
Include the token in theAuthorization header on every request:
Token refresh
When your access token expires, exchange the refresh token for a new access token instead of re-authenticating with credentials:accessToken and expiresIn. No new refresh token is issued.
Token caching example
Tenant scoping
Every JWT carries atenantId claim. The server reads this claim and scopes all DynamoDB access to that tenant’s tables. You cannot query another tenant’s data.
The tenantId field in the request body is optional. If provided, it must match the tenantId in the JWT — a mismatch returns 403.