API Reference
Auth
Auth API endpoints
POST /auth/device-code
Create a device code for CLI authentication
Request Body
| Field | Type | Required | Description |
|---|---|---|---|
intent | string | No |
Example Request
{
"intent": "login"
}Responses
200 — Device code created
| Field | Type | Required | Description |
|---|---|---|---|
code | string | Yes | |
verification_url | string | Yes | |
expires_at | number | Yes |
{
"code": "A1B2C3",
"verification_url": "https://nextpay-v3-dev.nextfinancial.io/auth/device?code=A1B2C3",
"expires_at": 1742472000
}Example
curl -X POST \
-H "Content-Type: application/json" \
-d '{"intent":"login"}' \
https://api.nextpay.world/v1/auth/device-codeGET /auth/device-code/{code}
Poll device code status
Path Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
code | string | Yes | The 6-character device code |
Responses
200 — Device code status
| Field | Type | Required | Description |
|---|---|---|---|
status | string | Yes | |
token | string | No |
{
"status": "pending"
}Example
curl \
https://api.nextpay.world/v1/auth/device-code/A1B2C3POST /auth/token
Exchange API key for a session JWT
Send a Bearer token in the Authorization header with an API key (npk_...) to receive a JWT.
Responses
200 — JWT token
| Field | Type | Required | Description |
|---|---|---|---|
ok | boolean | Yes | |
data | object | Yes |
{
"ok": true,
"data": {
"token": "eyJhbGciOiJSUzI1NiIs...",
"user_id": "usr_abc123"
}
}401 — Invalid API key
| Field | Type | Required | Description |
|---|---|---|---|
ok | boolean | Yes | |
error | object | Yes |
{
"ok": false,
"error": {
"code": "UNAUTHORIZED",
"message": "Invalid API key"
}
}Example
curl -X POST \
https://api.nextpay.world/v1/auth/tokenGET /auth/me
Get current authenticated user
Authentication: Bearer token required
Responses
200 — Current user info
| Field | Type | Required | Description |
|---|---|---|---|
ok | boolean | Yes | |
data | object | Yes |
{
"ok": true,
"data": {
"id": "usr_abc123",
"email": "don@nextfinancial.io",
"name": "Don Masakayan"
}
}401 — Not authenticated
| Field | Type | Required | Description |
|---|---|---|---|
ok | boolean | Yes | |
error | object | Yes |
{
"ok": false,
"error": {
"code": "UNAUTHORIZED",
"message": "Not authenticated"
}
}Example
curl \
-H "Authorization: Bearer YOUR_TOKEN" \
https://api.nextpay.world/v1/auth/me