Skip to content

Authentication

The Vidivo authentication system uses JWT RS256 tokens. Access tokens expire after 15 minutes; refresh tokens expire after 30 days and are rotated on each use.

All auth endpoints are unauthenticated (no Bearer token required).


Create a new user account.

Rate limit: 3 requests per hour per IP.

POST /v1/auth/register
Content-Type: application/json
{
"email": "jane@example.com",
"password": "SecureP@ssw0rd!",
"display_name": "Jane Smith"
}
FieldTypeRequiredDescription
emailstringYesValid email address. Must be unique.
passwordstringYesMinimum 8 characters.
display_namestringNoPublic name shown to guests. Max 80 characters.
HTTP/1.1 201 Created
Content-Type: application/json
{
"user": {
"id": "01JN2X4K8M3F7QPZRVWT6YBHCE",
"email": "jane@example.com",
"display_name": "Jane Smith",
"role": "user",
"email_verified": false,
"created_at": "2026-03-15T10:00:00Z"
},
"access_token": "eyJhbGciOiJSUzI1NiJ9...",
"refresh_token": "rt_01JN2X4K8M3F7QPZRVWT6YBHCE",
"expires_in": 900
}

A verification email is sent automatically. The user must verify their email before accessing host features.

CodeStatusDescription
validation_error400Missing or invalid fields
conflict409Email already registered
rate_limited429Too many registration attempts

Authenticate with email and password.

Rate limit: 5 requests per 15 minutes per IP.

POST /v1/auth/login
Content-Type: application/json
{
"email": "jane@example.com",
"password": "SecureP@ssw0rd!"
}
HTTP/1.1 200 OK
Content-Type: application/json
{
"user": {
"id": "01JN2X4K8M3F7QPZRVWT6YBHCE",
"email": "jane@example.com",
"display_name": "Jane Smith",
"role": "verified_user",
"email_verified": true,
"created_at": "2026-03-15T10:00:00Z"
},
"access_token": "eyJhbGciOiJSUzI1NiJ9...",
"refresh_token": "rt_01JN2X4K8M3F7QPZRVWT6YBHCE",
"expires_in": 900
}
CodeStatusDescription
invalid_credentials401Email or password is incorrect
rate_limited429Too many login attempts

Exchange a refresh token for a new access token. The refresh token is rotated on each call — the old refresh token is invalidated immediately.

POST /v1/auth/refresh
Content-Type: application/json
{
"refresh_token": "rt_01JN2X4K8M3F7QPZRVWT6YBHCE"
}
HTTP/1.1 200 OK
Content-Type: application/json
{
"access_token": "eyJhbGciOiJSUzI1NiJ9...",
"refresh_token": "rt_01JN2X5L9N4G8RQASWU7ZCIDFE",
"expires_in": 900
}
CodeStatusDescription
invalid_token401Refresh token is invalid, expired, or already used

Invalidate the current session. The refresh token is revoked and cannot be used again.

Requires: Authorization: Bearer <access_token>

POST /v1/auth/logout
Authorization: Bearer eyJhbGciOiJSUzI1NiJ9...
Content-Type: application/json
{
"refresh_token": "rt_01JN2X5L9N4G8RQASWU7ZCIDFE"
}
HTTP/1.1 204 No Content
CodeStatusDescription
unauthorized401Missing or invalid access token

Terminal window
# Register
curl -X POST https://api.vidivo.app/v1/auth/register \
-H "Content-Type: application/json" \
-d '{"email":"jane@example.com","password":"SecureP@ssw0rd!","display_name":"Jane Smith"}'
# Login
curl -X POST https://api.vidivo.app/v1/auth/login \
-H "Content-Type: application/json" \
-d '{"email":"jane@example.com","password":"SecureP@ssw0rd!"}'
# Refresh
curl -X POST https://api.vidivo.app/v1/auth/refresh \
-H "Content-Type: application/json" \
-d '{"refresh_token":"rt_01JN2X4K8M3F7QPZRVWT6YBHCE"}'
# Logout
curl -X POST https://api.vidivo.app/v1/auth/logout \
-H "Authorization: Bearer eyJhbGciOiJSUzI1NiJ9..." \
-H "Content-Type: application/json" \
-d '{"refresh_token":"rt_01JN2X5L9N4G8RQASWU7ZCIDFE"}'

Register / Login
access_token (15 min TTL)
refresh_token (30 day TTL)
│ access_token expires
POST /auth/refresh
├── Old refresh_token invalidated
└── New access_token + refresh_token issued
│ logout / session revoked
refresh_token invalidated
All sessions for token invalidated

Access tokens contain the following claims:

{
"sub": "01JN2X4K8M3F7QPZRVWT6YBHCE",
"email": "jane@example.com",
"role": "verified_user",
"iat": 1710000000,
"exp": 1710000900,
"iss": "api.vidivo.app"
}
ClaimDescription
subUser ID (ULID format)
emailUser email address
roleCurrent role: guest, user, verified_user, host, admin
iatIssued-at timestamp (Unix)
expExpiry timestamp (Unix)
issIssuer — always api.vidivo.app