Authentication request with token and type. authType defaults to "user" if not specified.
- Authentication & Authorization
PERS-api Documentation (2.0.13)
PERS API Documentation
This RESTful API enables seamless integration of Web3 loyalty, token management, and engagement features into your applications.
Usage Guidelines:
- RESTful Design: Resources are accessed via standard HTTP methods (GET, POST, PUT, DELETE) with predictable, resource-oriented URLs.
- Authentication: Secure access is enforced via Bearer Tokens (JWT) and Project Keys (defining the Tenant context).
- Data Format: All requests and responses utilize standard JSON formatting.
Explore the modules below for detailed endpoint specifications, schemas, and testing capabilities.
Request
Universal token creation with consistent token-in-body pattern.
USER AUTHENTICATION:
- Header: x-project-key (tenant identification)
- Body:
{ authToken: "jwt_from_provider", authType: "user" } - Returns: User session with PERS JWT tokens
BUSINESS AUTHENTICATION:
- Header: x-project-key (tenant identification)
- Body:
{ authToken: "jwt_from_provider", authType: "business", context: { businessId: "uuid" } } - Returns: Business session with PERS JWT tokens (includes
rolein JWT) - If user has single business membership,
context.businessIdis auto-selected - If user has multiple memberships without
context.businessId, returnsMULTIPLE_CONTEXT_SELECTION_REQUIREDerror with available options
ADMIN AUTHENTICATION:
- Header: x-project-key (tenant identification)
- Body:
{ authToken: "firebase_jwt", authType: "tenant" } - Returns: Admin session with PERS JWT tokens
Authentication token from WebAuthn provider (e.g., PERS Signer API)
Authentication context type - explicitly declares intent for admin vs user auth
Optional context for explicit business/tenant selection. Required when user has multiple memberships of that type.
if Tenant settings allowJWTForUnauthenticatedUsers is true, this field contains data to create user and setup unauthenticated user session instead of token verification. Useful for sandbox or trial modes. For now it is only used to create unauthenticated users.
- Mock serverhttps://docs.pers.ninja/_mock/swagger/auth/token
- https://api.pers.ninja/v2/auth/token
- curl
- JavaScript
- Node.js
- Python
- Java
- C#
- PHP
- Go
- Ruby
- R
- Payload
curl -i -X POST \
https://docs.pers.ninja/_mock/swagger/auth/token \
-H 'Content-Type: application/json' \
-H 'x-project-key: YOUR_API_KEY_HERE' \
-d '{
"authToken": "eyJ0eXAiOiJKV1QiLCJhbGciOiJFZERTQSJ9...",
"authType": "user",
"context": {
"businessId": "550e8400-e29b-41d4-a716-446655440000",
"tenantId": "550e8400-e29b-41d4-a716-446655440001"
},
"rawLoginData": {
"someKey": "someValue"
}
}'{ "refreshToken": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ0ZW5hbnRJZCI6IjEiLCJpYXQiOjE2MjYxNzUwNzksImV4cCI6MTYyNjE3NTI3OX0.5w8A6t7b5lBx8D3FmLwJQgJ9z1D9c9Vz7A3f7BvzH2A", "accessToken": "string" }
- Mock serverhttps://docs.pers.ninja/_mock/swagger/auth/refresh
- https://api.pers.ninja/v2/auth/refresh
- curl
- JavaScript
- Node.js
- Python
- Java
- C#
- PHP
- Go
- Ruby
- R
- Payload
curl -i -X POST \
https://docs.pers.ninja/_mock/swagger/auth/refresh \
-H 'Content-Type: application/json' \
-H 'x-project-key: YOUR_API_KEY_HERE' \
-d '{
"refreshToken": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ0ZW5hbnRJZCI6IjEiLCJpYXQiOjE2MjYxNzUwNzksImV4cCI6MTYyNjE3NTI3OX0.5w8A6t7b5lBx8D3FmLwJQgJ9z1D9c9Vz7A3f7BvzH2A"
}'{ "refreshToken": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ0ZW5hbnRJZCI6IjEiLCJpYXQiOjE2MjYxNzUwNzksImV4cCI6MTYyNjE3NTI3OX0.5w8A6t7b5lBx8D3FmLwJQgJ9z1D9c9Vz7A3f7BvzH2A", "accessToken": "string" }
- Mock serverhttps://docs.pers.ninja/_mock/swagger/auth/verify
- https://api.pers.ninja/v2/auth/verify
- curl
- JavaScript
- Node.js
- Python
- Java
- C#
- PHP
- Go
- Ruby
- R
- Payload
curl -i -X POST \
https://docs.pers.ninja/_mock/swagger/auth/verify \
-H 'Content-Type: application/json' \
-H 'x-project-key: YOUR_API_KEY_HERE' \
-d '{
"authToken": "eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9..."
}'{ "valid": true, "payload": null, "tenantId": "Invalid token", "identifierEmail": "user-c8e619a4f7f8419d94320d403213ef49@id.pers.ninja", "errorMessage": "Invalid token" }