Skip to main content

Protekt API (1.0.0)

Download OpenAPI specification:Download

Protekt is a developer-friendly authentication platform. This specification covers two APIs:

  • Account API: Lets you manage your Protekt organization, including projects, API keys, team members, and usage metrics. Authenticated via a Management Token.
  • Authentication API: Handles all end-user identity operations such as signup, login, passwordless flows, SSO, MFA, and session management. Authenticated via a project API key.

Projects

Create and manage Protekt projects

List all projects

Returns a paginated list of all projects belonging to the authenticated organization.

Authorizations:
ManagementToken
query Parameters
limit
integer <= 100
Default: 20

Max number of results per page

cursor
string

Pagination cursor from the previous response

Responses

Response samples

Content type
application/json
{
  • "data": [
    ],
  • "next_cursor": "cur_abc123",
  • "has_more": true
}

Create a project

Create a new Protekt project. A unique login_id is automatically generated and returned.

Authorizations:
ManagementToken
Request Body schema: application/json
required
name
required
string
allowed_origins
required
Array of strings
redirect_url
required
string <uri>
description
string
token_expiry
integer
Default: 3600
refresh_token_expiry
integer
Default: 2592000
mfa_required
boolean
Default: false

Responses

Request samples

Content type
application/json
{}

Response samples

Content type
application/json
{
  • "id": "proj_01jk8abc",
  • "login_id": "lp_7xqm9xyz",
  • "name": "My App – Production",
  • "description": "string",
  • "redirect_url": "https://myapp.com/dashboard",
  • "allowed_origins": [],
  • "token_expiry": 3600,
  • "refresh_token_expiry": 2592000,
  • "mfa_required": false,
  • "created_at": "2019-08-24T14:15:22Z",
  • "updated_at": "2019-08-24T14:15:22Z"
}

Get a project

Retrieve a single project by its ID, including current configuration and generated login_id.

Authorizations:
ManagementToken
path Parameters
id
required
string

The unique project ID (for example, proj_01jk8abc)

Responses

Response samples

Content type
application/json
{
  • "id": "proj_01jk8abc",
  • "login_id": "lp_7xqm9xyz",
  • "name": "My App – Production",
  • "description": "string",
  • "redirect_url": "https://myapp.com/dashboard",
  • "allowed_origins": [],
  • "token_expiry": 3600,
  • "refresh_token_expiry": 2592000,
  • "mfa_required": false,
  • "created_at": "2019-08-24T14:15:22Z",
  • "updated_at": "2019-08-24T14:15:22Z"
}

Update a project

Update one or more configuration fields on an existing project. Only the fields you provide will be changed.

Authorizations:
ManagementToken
path Parameters
id
required
string

The unique project ID (for example, proj_01jk8abc)

Request Body schema: application/json
required
name
string
allowed_origins
Array of strings
redirect_url
string <uri>
token_expiry
integer
mfa_required
boolean

Responses

Request samples

Content type
application/json
{
  • "name": "string",
  • "allowed_origins": [
    ],
  • "redirect_url": "http://example.com",
  • "token_expiry": 0,
  • "mfa_required": true
}

Response samples

Content type
application/json
{
  • "id": "proj_01jk8abc",
  • "login_id": "lp_7xqm9xyz",
  • "name": "My App – Production",
  • "description": "string",
  • "redirect_url": "https://myapp.com/dashboard",
  • "allowed_origins": [],
  • "token_expiry": 3600,
  • "refresh_token_expiry": 2592000,
  • "mfa_required": false,
  • "created_at": "2019-08-24T14:15:22Z",
  • "updated_at": "2019-08-24T14:15:22Z"
}

Delete a project

Permanently deletes a project and all associated configuration, users, and sessions. This action is irreversible. All active JWTs issued by this project will be immediately invalidated.

Authorizations:
ManagementToken
path Parameters
id
required
string

The unique project ID (for example, proj_01jk8abc)

Responses

Response samples

Content type
application/json
{
  • "deleted": true,
  • "id": "proj_01jk8abc"
}

Management Tokens

Issue and revoke Management Tokens

Request a Management Token

Authenticate with your Protekt account credentials to obtain a Management Token. This token is required for all Account API requests.

Request Body schema: application/json
required
email
required
string <email>
password
required
string <password>

Responses

Request samples

Content type
application/json
{
  • "email": "user@example.com",
  • "password": "pa$$word"
}

Response samples

Content type
application/json
{
  • "management_token": "mgmt_eyJhbGciOiJIUz...",
  • "expires_at": "2019-08-24T14:15:22Z"
}

Revoke the current Management Token

Immediately invalidate the current Management Token. Use this when rotating credentials or ending an admin session.

Authorizations:
ManagementToken

Responses

Response samples

Content type
application/json
{
  • "revoked": true
}

API Keys

Generate and manage project API keys

List API keys

List all API keys for the organization. Key values are never returned — only metadata.

Authorizations:
ManagementToken
query Parameters
project_id
string

Filter keys by a specific project

limit
integer <= 100
Default: 20

Max number of results per page

Responses

Response samples

Content type
application/json
{
  • "data": [
    ]
}

Create an API key

Generate a new API key scoped to a specific project. The raw key value is only returned once at creation time — store it securely.

Authorizations:
ManagementToken
Request Body schema: application/json
required
project_id
required
string
label
required
string
scopes
Array of strings
Default: ["auth:read","auth:write","users:read","users:write"]
Items Enum: "auth:read" "auth:write" "users:read" "users:write"
expires_at
string or null <date-time>

Responses

Request samples

Content type
application/json
{
  • "project_id": "string",
  • "label": "string",
  • "scopes": [
    ],
  • "expires_at": "2019-08-24T14:15:22Z"
}

Response samples

Content type
application/json
{
  • "id": "key_xk901abc",
  • "key": "pk_live_AbCdEfGh...",
  • "label": "Backend server – production",
  • "project_id": "proj_01jk8abc",
  • "scopes": [
    ],
  • "expires_at": "2019-08-24T14:15:22Z",
  • "created_at": "2019-08-24T14:15:22Z"
}

Revoke an API key

Permanently revoke an API key. Any service using this key will immediately lose access to the Authentication API.

Authorizations:
ManagementToken
path Parameters
id
required
string

The unique API key ID (for example, key_xk901abc)

Responses

Response samples

Content type
application/json
{
  • "revoked": true,
  • "id": "key_xk901abc"
}

Members

Manage organization team members

List organization members

List all members of the organization with their roles and access levels.

Authorizations:
ManagementToken

Responses

Response samples

Content type
application/json
{
  • "data": [
    ]
}

Invite a member

Send an invitation email to add a new member to the organization.

Authorizations:
ManagementToken
Request Body schema: application/json
required
email
required
string <email>
role
required
string
Enum: "admin" "developer"

Responses

Request samples

Content type
application/json
{
  • "email": "user@example.com",
  • "role": "admin"
}

Response samples

Content type
application/json
{
  • "message": "Invitation sent to dev@acme.com"
}

Remove a member

Remove a member from the organization. They immediately lose all dashboard and API access.

Authorizations:
ManagementToken
path Parameters
id
required
string

The unique member ID (for example, mem_001)

Responses

Response samples

Content type
application/json
{
  • "removed": true
}

Usage

Retrieve usage and MAU metrics

Get usage statistics

Retrieve usage stats for the organization or a specific project, including Monthly Active Users (MAU) and login event counts.

Authorizations:
ManagementToken
query Parameters
project_id
string

Scope metrics to a specific project

from
string <date>

ISO 8601 start date for the reporting window

to
string <date>

ISO 8601 end date. Defaults to today.

Responses

Response samples

Content type
application/json
{
  • "period": {
    },
  • "mau": 1842,
  • "total_logins": 9231,
  • "tokens_issued": 11004,
  • "passwordless_logins": 3120,
  • "sso_logins": 894
}

Auth

Email/password signup, login, and logout

Sign up a new user

Register a new user with email and password. Protekt hashes and stores credentials internally. Optionally triggers an email verification flow.

Authorizations:
ApiKey
Request Body schema: application/json
required
email
required
string <email>
password
required
string <password> >= 8 characters
object

Arbitrary key-value pairs stored alongside the user profile

send_verification
boolean

If true, sends an email verification link. Defaults to project setting.

Responses

Request samples

Content type
application/json
{
  • "email": "user@example.com",
  • "password": "pa$$word",
  • "metadata": { },
  • "send_verification": true
}

Response samples

Content type
application/json
{
  • "access_token": "eyJhbGci...",
  • "refresh_token": "rt_xYz...",
  • "expires_in": 3600,
  • "token_type": "Bearer",
  • "user": {
    }
}

Log in a user

Authenticate a user with email and password. Returns a signed JWT and refresh token on success. If MFA is required, returns a mfa_required challenge response instead of tokens.

Authorizations:
ApiKey
Request Body schema: application/json
required
email
required
string <email>
password
required
string <password>

Responses

Request samples

Content type
application/json
{
  • "email": "user@example.com",
  • "password": "pa$$word"
}

Response samples

Content type
application/json
Example
{
  • "access_token": "eyJhbGci...",
  • "refresh_token": "rt_xYz...",
  • "expires_in": 3600,
  • "token_type": "Bearer",
  • "user": {
    }
}

Log out a user

End a user session by revoking the current access token and its associated refresh token.

Authorizations:
ApiKeyUserToken

Responses

Response samples

Content type
application/json
{
  • "logged_out": true
}

Tokens

JWT refresh, verification, and revocation

Refresh an access token

Obtain a new access token using a valid refresh token. The old refresh token is rotated and invalidated on each successful call.

Authorizations:
ApiKey
Request Body schema: application/json
required
refresh_token
required
string

Responses

Request samples

Content type
application/json
{
  • "refresh_token": "rt_xYz..."
}

Response samples

Content type
application/json
{
  • "access_token": "string",
  • "refresh_token": "string",
  • "expires_in": 3600
}

Verify an access token

Validate an access token and return its decoded claims. Use this on your backend to confirm a user is authenticated before granting access to protected resources.

Authorizations:
ApiKey
Request Body schema: application/json
required
token
required
string

The JWT access token to verify

Responses

Request samples

Content type
application/json
{
  • "token": "string"
}

Response samples

Content type
application/json
{
  • "valid": true,
  • "claims": {
    }
}

Revoke a token

Immediately invalidate a specific access or refresh token without ending the entire session.

Authorizations:
ApiKey
Request Body schema: application/json
required
token
required
string

The token to revoke

Responses

Request samples

Content type
application/json
{
  • "token": "string"
}

Response samples

Content type
application/json
{
  • "revoked": true
}

Passwords

Password reset, confirmation, and change

Request a password reset

Trigger a password reset email. Protekt sends a one-time reset link to the user's registered email, expiring after 15 minutes. Always returns 200 OK regardless of whether the email exists, to prevent user enumeration attacks.

Authorizations:
ApiKey
Request Body schema: application/json
required
email
required
string <email>

Responses

Request samples

Content type
application/json
{
  • "email": "user@example.com"
}

Response samples

Content type
application/json
{
  • "message": "If that email is registered, a reset link has been sent."
}

Confirm a password reset

Complete the password reset flow by submitting the reset token (from the email link) and the new password.

Authorizations:
ApiKey
Request Body schema: application/json
required
reset_token
required
string

One-time reset token from the email link

new_password
required
string <password> >= 8 characters

Responses

Request samples

Content type
application/json
{
  • "reset_token": "string",
  • "new_password": "pa$$word"
}

Response samples

Content type
application/json
{
  • "message": "Password has been reset successfully."
}

Change password (authenticated)

Allow an authenticated user to change their own password by providing their current password and the desired new password.

Authorizations:
ApiKeyUserToken
Request Body schema: application/json
required
current_password
required
string <password>
new_password
required
string <password> >= 8 characters

Responses

Request samples

Content type
application/json
{
  • "current_password": "pa$$word",
  • "new_password": "pa$$word"
}

Response samples

Content type
application/json
{
  • "message": "Password changed successfully."
}

OTP

One-time passcode (passwordless) flows

Send an OTP

Send a one-time passcode to a user's email or phone for passwordless authentication or as a second factor. OTPs expire after 10 minutes.

Authorizations:
ApiKey
Request Body schema: application/json
required
email
string <email>

Required if phone is not provided

phone
string

E.164 format. Required if email is not provided

channel
string
Default: "email"
Enum: "email" "sms"

Responses

Request samples

Content type
application/json
{
  • "email": "user@example.com",
  • "phone": "+2348012345678",
  • "channel": "email"
}

Response samples

Content type
application/json
{
  • "message": "OTP sent",
  • "expires_in": 600
}

Verify an OTP

Verify an OTP code sent via POST /auth/otp/send. Returns a JWT and refresh token on success.

Authorizations:
ApiKey
Request Body schema: application/json
required
email
string <email>

Required if OTP was sent to an email

phone
string

Required if OTP was sent to a phone number

otp
required
string

The 6-digit OTP

Responses

Request samples

Content type
application/json
{
  • "email": "user@example.com",
  • "phone": "string",
  • "otp": "482910"
}

Response samples

Content type
application/json
{
  • "access_token": "eyJhbGci...",
  • "refresh_token": "rt_xYz...",
  • "expires_in": 3600,
  • "token_type": "Bearer",
  • "user": {
    }
}

Send a magic link

Send a magic link to the user's email. When clicked, the link authenticates the user without a password. The link expires after 15 minutes and is single-use.

Authorizations:
ApiKey
Request Body schema: application/json
required
email
required
string <email>
redirect_url
string <uri>

Override the project's default redirect URL for this request

Responses

Request samples

Content type
application/json
{}

Response samples

Content type
application/json
{
  • "message": "Magic link sent",
  • "expires_in": 900
}

Verify a magic link token

Verify a magic link token extracted from the URL after the user clicks the emailed link. Returns a JWT and refresh token on success.

Authorizations:
ApiKey
Request Body schema: application/json
required
token
required
string

The magic link token from the email URL parameter

Responses

Request samples

Content type
application/json
{
  • "token": "string"
}

Response samples

Content type
application/json
{
  • "access_token": "eyJhbGci...",
  • "refresh_token": "rt_xYz...",
  • "expires_in": 3600,
  • "token_type": "Bearer",
  • "user": {
    }
}

SSO

Single Sign-On (OIDC / SAML) flows

Initiate an SSO login

Initiate an SSO login flow. Redirects the user to their configured identity provider (IdP). Supports OIDC and SAML 2.0 providers configured in the Protekt Dashboard.

Authorizations:
ApiKey
query Parameters
provider
required
string
Example: provider=google

The SSO provider slug (for example, google, okta, azure-ad)

redirect_url
string <uri>

Override the post-login redirect URL for this request

state
string

Opaque string passed back in the callback for CSRF protection

Responses

Response samples

Content type
application/json
{
  • "error": {
    }
}

SSO callback

The redirect target for the SSO provider after authentication. Protekt exchanges the authorization code for a session and redirects with tokens. Register https://auth.protekt.io/v1/auth/sso/callback as the callback URL in your IdP configuration.

Authorizations:
ApiKey
query Parameters
code
required
string

Authorization code from the IdP

state
string

The state value originally passed to /auth/sso/authorize

Responses

MFA

Multi-factor authentication enrollment and verification

Enroll in MFA

Begin enrolling a user in MFA. Enrollment is not finalized until the user verifies a code via POST /auth/mfa/verify.

Authorizations:
ApiKeyUserToken
Request Body schema: application/json
required
method
required
string
Enum: "totp" "sms"
phone
string

E.164 phone number. Required when method is sms.

Responses

Request samples

Content type
application/json
{
  • "method": "totp",
  • "phone": "string"
}

Response samples

Content type
application/json
{
  • "method": "totp",
  • "totp_uri": "otpauth://totp/Protekt:user@example.com?secret=BASE32SECRET&issuer=Protekt",
  • "qr_code": "data:image/png;base64,..."
}

Verify an MFA code

Verify an MFA code. Used both to finalize MFA enrollment and to complete a login challenge. On a successful login challenge, returns a full JWT session.

Authorizations:
ApiKey
Request Body schema: application/json
required
mfa_token
string

Temporary MFA challenge token from POST /auth/login. Required during login.

code
required
string

The 6-digit TOTP or SMS code

Responses

Request samples

Content type
application/json
{
  • "mfa_token": "mfa_tmp_abc...",
  • "code": "482910"
}

Response samples

Content type
application/json
{
  • "access_token": "eyJhbGci...",
  • "refresh_token": "rt_xYz...",
  • "expires_in": 3600,
  • "token_type": "Bearer",
  • "user": {
    }
}

Remove an MFA method

Remove an MFA method from a user's account. Requires a valid user access token. Returns 403 if the project enforces MFA (mfa_required: true).

Authorizations:
ApiKeyUserToken
Request Body schema: application/json
required
method
required
string
Enum: "totp" "sms"

Responses

Request samples

Content type
application/json
{
  • "method": "totp"
}

Response samples

Content type
application/json
{
  • "unenrolled": true
}

Users

User profile management

List users

List all users registered within a project. Intended for admin/backend use. Requires an API key with users:read scope.

Authorizations:
ApiKey
query Parameters
limit
integer <= 100
Default: 20

Max number of results per page

cursor
string

Pagination cursor from the previous response

search
string

Filter by email (partial match)

Responses

Response samples

Content type
application/json
{
  • "data": [
    ],
  • "next_cursor": "cur_abc123",
  • "has_more": true
}

Get a user

Retrieve a user's full profile by ID, including metadata, MFA status, and account state.

Authorizations:
ApiKey
path Parameters
id
required
string

The unique user ID (for example, usr_9klabc)

Responses

Response samples

Content type
application/json
{
  • "id": "usr_9klabc",
  • "email": "user@example.com",
  • "email_verified": true,
  • "mfa_enabled": true,
  • "mfa_methods": [
    ],
  • "metadata": { },
  • "disabled": true,
  • "created_at": "2019-08-24T14:15:22Z",
  • "last_login_at": "2019-08-24T14:15:22Z"
}

Update a user

Update a user's profile or metadata. Admins can update any user; users can update their own profile via their access token.

Authorizations:
ApiKeyUserToken
path Parameters
id
required
string

The unique user ID (for example, usr_9klabc)

Request Body schema: application/json
required
email
string <email>

New email address. Triggers a re-verification email.

object

Merged (not replaced) into existing metadata

disabled
boolean

Set to true to lock the account. Admin only.

Responses

Request samples

Content type
application/json
{
  • "email": "user@example.com",
  • "metadata": { },
  • "disabled": true
}

Response samples

Content type
application/json
{
  • "id": "usr_9klabc",
  • "email": "user@example.com",
  • "email_verified": true,
  • "mfa_enabled": true,
  • "mfa_methods": [
    ],
  • "metadata": { },
  • "disabled": true,
  • "created_at": "2019-08-24T14:15:22Z",
  • "last_login_at": "2019-08-24T14:15:22Z"
}

Delete a user

Permanently delete a user and all their sessions, tokens, and stored data from the project. This is irreversible.

Authorizations:
ApiKey
path Parameters
id
required
string

The unique user ID (for example, usr_9klabc)

Responses

Response samples

Content type
application/json
{
  • "deleted": true,
  • "id": "usr_9klabc"
}

Sessions

Session listing and revocation

List active sessions

List all active sessions for the currently authenticated user, including device, IP address, and last active time.

Authorizations:
ApiKeyUserToken

Responses

Response samples

Content type
application/json
{
  • "data": [
    ]
}

Revoke all sessions

Revoke all active sessions for the current user — "sign out everywhere". The current session is also terminated unless keep_current is true.

Authorizations:
ApiKeyUserToken
Request Body schema: application/json
keep_current
boolean
Default: false

If true, the current session is preserved

Responses

Request samples

Content type
application/json
{
  • "keep_current": false
}

Response samples

Content type
application/json
{
  • "revoked_count": 4
}

Revoke a session

Terminate a specific session by ID. Useful for "sign out this device" functionality.

Authorizations:
ApiKeyUserToken
path Parameters
id
required
string

The unique session ID (for example, sess_kl8abc)

Responses

Response samples

Content type
application/json
{
  • "revoked": true,
  • "session_id": "sess_kl8abc"
}