Skip to main content
Authentication uses JWT Bearer tokens generated via the /v1/auth/generate-token endpoint. Tokens are scoped to specific permissions and expire after a set time (e.g., 1 hour).

Generate Token

POST /v1/auth/generate-token Generates a JWT token for authenticating subsequent API calls.

Request Body

  • Content-Type: application/json
FieldTypeRequiredDescription
userIdstringYesUnique user ID (e.g., Clerk user ID).
merchantIdintegerYesMerchant identifier.
permissionsarrayYesList of permissions (e.g., ["ais:accounts:read", "ais:balance:read", "ais:transactions:read"]).

Example Request

curl --request POST \
  --url https://acount-apis-staging-a8cdb2402163.herokuapp.com/v1/auth/generate-token \
  --header 'Content-Type: application/json' \
  --data '{
    "userId": "user_35100188",
    "merchantId": 1,
    "permissions": ["ais:accounts:read", "ais:balance:read", "ais:transactions:read"]
  }'

Responses

  • 200 OK: Token generated successfully.
    {
      "token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..."
    }
    
  • 400 Bad Request: Invalid input (e.g., missing fields).
  • 500 Internal Server Error: Server issue.
Use the generated token in the Authorization: Bearer <token> header for other endpoints.