Skip to content

Internal Auth API

The Internal Auth API provides endpoints for user registration, login, logout, and session management.

Creates a new user account with email and password.

POST /internal/v1/auth/register

Requires InternalSecret.

FieldTypeRequiredDescription
emailstringYesUser’s email address
passwordstringYesPassword (min 8 characters)
namestringNoUser’s display name
Terminal window
curl -X POST "https://api.veriglob.com/internal/v1/auth/register" \
-H "X-Internal-Secret: your-internal-secret" \
-H "Content-Type: application/json" \
-d '{
"email": "newuser@example.com",
"password": "secure-password",
"name": "New User"
}'

201 Created

{
"status": "success",
"message": "User registered successfully",
"data": {
"user_id": "user_abc123def456",
"email": "newuser@example.com",
"name": "New User",
"tier": "free",
"created_at": "2024-01-15T10:30:00Z"
}
}
StatusDescription
400Invalid email format or password too weak
409Email already registered

Authenticates a user with email and password, returns a session token.

POST /internal/v1/auth/login

None required.

FieldTypeRequiredDescription
emailstringYesUser’s email address
passwordstringYesUser’s password
Terminal window
curl -X POST "https://api.veriglob.com/internal/v1/auth/login" \
-H "Content-Type: application/json" \
-d '{
"email": "user@example.com",
"password": "secure-password"
}'

200 OK

{
"status": "success",
"message": "Login successful",
"data": {
"user_id": "user_abc123def456",
"email": "user@example.com",
"name": "User Name",
"tier": "basic",
"token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...",
"refresh_token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...",
"expires_at": "2024-01-15T22:30:00Z"
}
}
StatusDescription
400Invalid request body
401Invalid email or password

Invalidates the current session token.

POST /internal/v1/auth/logout

Requires InternalSecret.

FieldTypeRequiredDescription
tokenstringYesThe session token to invalidate
Terminal window
curl -X POST "https://api.veriglob.com/internal/v1/auth/logout" \
-H "X-Internal-Secret: your-internal-secret" \
-H "Content-Type: application/json" \
-d '{
"token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..."
}'

200 OK

{
"status": "success",
"message": "Logout successful",
"data": {
"logged_out_at": "2024-01-15T14:30:00Z"
}
}
StatusDescription
400Invalid or missing token

Refreshes an existing session token.

POST /internal/v1/auth/refresh

Requires InternalSecret.

FieldTypeRequiredDescription
refresh_tokenstringYesThe refresh token
Terminal window
curl -X POST "https://api.veriglob.com/internal/v1/auth/refresh" \
-H "X-Internal-Secret: your-internal-secret" \
-H "Content-Type: application/json" \
-d '{
"refresh_token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..."
}'

200 OK

{
"status": "success",
"message": "Token refreshed successfully",
"data": {
"token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...",
"refresh_token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...",
"expires_at": "2024-01-16T10:30:00Z"
}
}
StatusDescription
400Invalid request body
401Invalid or expired refresh token

Returns the details of the currently authenticated user.

GET /internal/v1/auth/me

Requires InternalSecret and Authorization header with Bearer token.

Terminal window
curl -X GET "https://api.veriglob.com/internal/v1/auth/me" \
-H "X-Internal-Secret: your-internal-secret" \
-H "Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..."

200 OK

{
"status": "success",
"message": "User retrieved successfully",
"data": {
"user_id": "user_abc123def456",
"email": "user@example.com",
"name": "User Name",
"tier": "basic",
"created_at": "2024-01-01T00:00:00Z",
"last_login_at": "2024-01-15T10:30:00Z"
}
}
StatusDescription
401Invalid or expired token

Session tokens are JWTs containing:

ClaimDescription
subUser ID
emailUser’s email
tierSubscription tier
iatIssued at timestamp
expExpiration timestamp
Token TypeDefault Expiration
Access Token12 hours
Refresh Token30 days
  1. Store tokens securely - Use secure storage mechanisms (HttpOnly cookies, secure storage APIs)
  2. Implement token refresh - Refresh tokens before expiration to maintain session
  3. Handle token revocation - Logout users and clear tokens when session ends
  4. Use HTTPS only - Never transmit tokens over unencrypted connections