Sign-in and sessions
MarkdownMethods, request fields, and responses.
Full guide
This section contains 14 methods. Open a method to view access requirements, request fields, and the response.
| Method and path | Description | Access |
|---|---|---|
POST /api/v1/auth/forgot-password | Request a password reset | No sign-in required; additional requirements are listed for the method |
POST /api/v1/auth/login | Sign in with email and password | No sign-in required; additional requirements are listed for the method |
POST /api/v1/auth/login/2fa | Complete sign-in with TOTP | No sign-in required; additional requirements are listed for the method |
POST /api/v1/auth/logout | Sign out and revoke a refresh token | No sign-in required; additional requirements are listed for the method |
GET /api/v1/auth/me | Current user, balance, and limits | Dashboard token |
POST /api/v1/auth/passkey/login/begin | Begin passkey sign-in | No sign-in required; additional requirements are listed for the method |
POST /api/v1/auth/passkey/login/finish | Complete passkey sign-in | No sign-in required; additional requirements are listed for the method |
POST /api/v1/auth/refresh | Refresh tokens | No sign-in required; additional requirements are listed for the method |
POST /api/v1/auth/register | Sign up | No sign-in required; additional requirements are listed for the method |
POST /api/v1/auth/reset-password | Reset password | No sign-in required; additional requirements are listed for the method |
POST /api/v1/auth/revoke-all-sessions | Revoke all sessions | Dashboard token |
POST /api/v1/auth/send-verify-code | Send a verification code | No sign-in required; additional requirements are listed for the method |
POST /api/v1/auth/validate-invitation-code | Validate an invitation | No sign-in required; additional requirements are listed for the method |
POST /api/v1/auth/validate-promo-code | Validate a promo code | No sign-in required; additional requirements are listed for the method |
POST /api/v1/auth/forgot-password — Request a password reset
Access: no sign-in required; additional requirements are listed for the method
Rate limit: 5 requests per 60 seconds per address.
/api/v1/auth/forgot-passwordJSON / form fields
| The field | Type | Required | Validation / description |
|---|---|---|---|
email | string | yes | required,email |
turnstile_token | string | no |
{
"email": "PLACEHOLDER_EMAIL (string)",
"turnstile_token": "PLACEHOLDER_TURNSTILE_TOKEN (string)"
}PLACEHOLDER represents your input and its type. Replace the values and keep only the optional fields you need. Do not send string placeholders in place of numbers, booleans, objects, or arrays.
Request schema: ForgotPasswordRequest
Response
The JSON response contains code, message, and data. The data contents are described in the schemas below.
Response data schemas: ForgotPasswordResponse. See the Data schemas pages for fields and types.
{
"code": 0,
"message": "success",
"data": {
"message": "PLACEHOLDER_MESSAGE (string)"
}
}Note: this operation changes state or continues a one-time authentication flow. The example describes the contract and is not executed.
POST /api/v1/auth/login — Sign in with email and password
Access: no sign-in required; additional requirements are listed for the method
Feature availability and additional access requirements are checked when the request is processed.
Rate limit: 20 requests per 60 seconds per address.
/api/v1/auth/loginJSON / form fields
| The field | Type | Required | Validation / description |
|---|---|---|---|
email | string | yes | required,email |
password | string | yes | required |
turnstile_token | string | no |
{
"email": "PLACEHOLDER_EMAIL (string)",
"password": "PLACEHOLDER_PASSWORD (string)",
"turnstile_token": "PLACEHOLDER_TURNSTILE_TOKEN (string)"
}PLACEHOLDER represents your input and its type. Replace the values and keep only the optional fields you need. Do not send string placeholders in place of numbers, booleans, objects, or arrays.
Request schema: LoginRequest
Response
The JSON response contains code, message, and data. The data contents are described in the schemas below.
Response data schemas: TotpLoginResponse, User, AuthResponse. See the Data schemas pages for fields and types.
Where several response variants are possible, their fields are listed in separate schemas; do not combine them into one object.
Note: this operation changes state or continues a one-time authentication flow. The example describes the contract and is not executed.
POST /api/v1/auth/login/2fa — Complete sign-in with TOTP
Access: no sign-in required; additional requirements are listed for the method
Feature availability and additional access requirements are checked when the request is processed.
Rate limit: 20 requests per 60 seconds per address.
/api/v1/auth/login/2faJSON / form fields
| The field | Type | Required | Validation / description |
|---|---|---|---|
temp_token | string | yes | required |
totp_code | string | yes | required,len=6 |
{
"temp_token": "PLACEHOLDER_TEMP_TOKEN (string)",
"totp_code": "PLACEHOLDER_TOTP_CODE (string)"
}PLACEHOLDER represents your input and its type. Replace the values and keep only the optional fields you need. Do not send string placeholders in place of numbers, booleans, objects, or arrays.
Request schema: Login2FARequest
Response
The JSON response contains code, message, and data. The data contents are described in the schemas below.
Response data schemas: User, AuthResponse. See the Data schemas pages for fields and types.
Where several response variants are possible, their fields are listed in separate schemas; do not combine them into one object.
Note: this operation changes state or continues a one-time authentication flow. The example describes the contract and is not executed.
POST /api/v1/auth/logout — Sign out and revoke a refresh token
Access: no sign-in required; additional requirements are listed for the method
/api/v1/auth/logoutJSON / form fields
| The field | Type | Required | Validation / description |
|---|---|---|---|
refresh_token | string | no | ; Optional: revoke the specified refresh token |
{
"refresh_token": "PLACEHOLDER_REFRESH_TOKEN (string)"
}PLACEHOLDER represents your input and its type. Replace the values and keep only the optional fields you need. Do not send string placeholders in place of numbers, booleans, objects, or arrays.
Request schema: LogoutRequest
Response
The JSON response contains code, message, and data. The data contents are described in the schemas below.
Response data schemas: LogoutResponse. See the Data schemas pages for fields and types.
{
"code": 0,
"message": "success",
"data": {
"message": "PLACEHOLDER_MESSAGE (string)"
}
}Note: this operation changes state or continues a one-time authentication flow. The example describes the contract and is not executed.
GET /api/v1/auth/me — Current user, balance, and limits
Access: Dashboard token
/api/v1/auth/mecurl --fail-with-body "https://ailoot.ai/api/v1/auth/me" \
-H "Authorization: Bearer $TOKEN"No request body is required. Send the parameters listed above in the URL.
Response
The JSON response contains code, message, and data. The data contents are described in the schemas below.
Response data schemas: User, UserProfileResponse. See the Data schemas pages for fields and types.
{
"code": 0,
"message": "success",
"data": {
"id": "PLACEHOLDER_ID (integer)",
"email": "PLACEHOLDER_EMAIL (string)",
"username": "PLACEHOLDER_USERNAME (string)",
"role": "PLACEHOLDER_ROLE (string)",
"balance": "PLACEHOLDER_BALANCE (number)",
"frozen_balance": "PLACEHOLDER_FROZEN_BALANCE (number)",
"concurrency": "PLACEHOLDER_CONCURRENCY (integer)",
"status": "PLACEHOLDER_STATUS (string)",
"last_active_at": "PLACEHOLDER_LAST_ACTIVE_AT (string)",
"created_at": "PLACEHOLDER_CREATED_AT (string)",
"updated_at": "PLACEHOLDER_UPDATED_AT (string)",
"deleted_at": "PLACEHOLDER_DELETED_AT (string)",
"balance_notify_enabled": "PLACEHOLDER_BALANCE_NOTIFY_ENABLED (boolean)",
"balance_notify_threshold_type": "PLACEHOLDER_BALANCE_NOTIFY_THRESHOLD_TYPE (string)",
"balance_notify_threshold": "PLACEHOLDER_BALANCE_NOTIFY_THRESHOLD (number)",
"balance_notify_extra_emails": "PLACEHOLDER_BALANCE_NOTIFY_EXTRA_EMAILS (array)",
"total_recharged": "PLACEHOLDER_TOTAL_RECHARGED (number)",
"rpm_limit": "PLACEHOLDER_RPM_LIMIT (integer)",
"api_keys": "PLACEHOLDER_API_KEYS (array)",
"avatar_url": "PLACEHOLDER_AVATAR_URL (string)",
"email_bound": "PLACEHOLDER_EMAIL_BOUND (boolean)"
}
}Note: all personal data and objects are scoped to the JWT subject.
Note: key spending limits (quota, quota_used) are returned in key responses, not in the profile. frozen_balance is the reserved amount; do not treat it as available balance.
POST /api/v1/auth/passkey/login/begin — Begin passkey sign-in
Access: no sign-in required; additional requirements are listed for the method
Feature availability and additional access requirements are checked when the request is processed.
Rate limit: 20 requests per 60 seconds per address.
/api/v1/auth/passkey/login/beginJSON / form fields
| The field | Type | Required | Validation / description |
|---|---|---|---|
turnstile_token | string | no |
{
"turnstile_token": "PLACEHOLDER_TURNSTILE_TOKEN (string)"
}PLACEHOLDER represents your input and its type. Replace the values and keep only the optional fields you need. Do not send string placeholders in place of numbers, booleans, objects, or arrays.
Request schema: PasskeyBeginLoginRequest
Response
The JSON response contains code, message, and data. The data contents are described in the schemas below.
Response data schemas: PasskeyOptionsResponse. See the Data schemas pages for fields and types.
{
"code": 0,
"message": "success",
"data": {
"session_token": "PLACEHOLDER_SESSION_TOKEN (string)",
"options": "PLACEHOLDER_OPTIONS (any)"
}
}Note: this operation changes state or continues a one-time authentication flow. The example describes the contract and is not executed.
Note: credential comes from navigator.credentials; session_token comes from begin. The finish body must be <=65536 bytes. Registration and deletion require a password.
POST /api/v1/auth/passkey/login/finish — Complete passkey sign-in
Access: no sign-in required; additional requirements are listed for the method
Feature availability and additional access requirements are checked when the request is processed.
Rate limit: 20 requests per 60 seconds per address.
/api/v1/auth/passkey/login/finishJSON / form fields
| The field | Type | Required | Validation / description |
|---|---|---|---|
session_token | string | yes | required |
name | string | no | |
credential | object | yes | required |
{
"session_token": "PLACEHOLDER_SESSION_TOKEN (string)",
"name": "PLACEHOLDER_NAME (string)",
"credential": "PLACEHOLDER_CREDENTIAL (object)"
}PLACEHOLDER represents your input and its type. Replace the values and keep only the optional fields you need. Do not send string placeholders in place of numbers, booleans, objects, or arrays.
Request schema: PasskeyFinishRequest
Response
The JSON response contains code, message, and data. The data contents are described in the schemas below.
Response data schemas: User, AuthResponse. See the Data schemas pages for fields and types.
Where several response variants are possible, their fields are listed in separate schemas; do not combine them into one object.
Note: this operation changes state or continues a one-time authentication flow. The example describes the contract and is not executed.
Note: credential comes from navigator.credentials; session_token comes from begin. The finish body must be <=65536 bytes. Registration and deletion require a password.
POST /api/v1/auth/refresh — Refresh tokens
Access: no sign-in required; additional requirements are listed for the method
Feature availability and additional access requirements are checked when the request is processed.
Rate limit: 30 requests per 60 seconds per address.
/api/v1/auth/refreshJSON / form fields
| The field | Type | Required | Validation / description |
|---|---|---|---|
refresh_token | string | yes | required |
{
"refresh_token": "PLACEHOLDER_REFRESH_TOKEN (string)"
}PLACEHOLDER represents your input and its type. Replace the values and keep only the optional fields you need. Do not send string placeholders in place of numbers, booleans, objects, or arrays.
Request schema: RefreshTokenRequest
Response
The JSON response contains code, message, and data. The data contents are described in the schemas below.
Response data schemas: RefreshTokenResponse. See the Data schemas pages for fields and types.
{
"code": 0,
"message": "success",
"data": {
"access_token": "PLACEHOLDER_ACCESS_TOKEN (string)",
"refresh_token": "PLACEHOLDER_REFRESH_TOKEN (string)",
"expires_in": "PLACEHOLDER_EXPIRES_IN (integer)",
"token_type": "PLACEHOLDER_TOKEN_TYPE (string)"
}
}Note: this operation changes state or continues a one-time authentication flow. The example describes the contract and is not executed.
POST /api/v1/auth/register — Sign up
Access: no sign-in required; additional requirements are listed for the method
Rate limit: 5 requests per 60 seconds per address.
/api/v1/auth/registerJSON / form fields
| The field | Type | Required | Validation / description |
|---|---|---|---|
email | string | yes | required,email |
password | string | yes | required,min=6 |
verify_code | string | no | |
turnstile_token | string | no | |
promo_code | string | no | ; Registration promo code |
invitation_code | string | no | ; Invitation code |
{
"email": "PLACEHOLDER_EMAIL (string)",
"password": "PLACEHOLDER_PASSWORD (string)",
"verify_code": "PLACEHOLDER_VERIFY_CODE (string)",
"turnstile_token": "PLACEHOLDER_TURNSTILE_TOKEN (string)",
"promo_code": "PLACEHOLDER_PROMO_CODE (string)",
"invitation_code": "PLACEHOLDER_INVITATION_CODE (string)"
}PLACEHOLDER represents your input and its type. Replace the values and keep only the optional fields you need. Do not send string placeholders in place of numbers, booleans, objects, or arrays.
Request schema: RegisterRequest
Response
The JSON response contains code, message, and data. The data contents are described in the schemas below.
Response data schemas: User, AuthResponse. See the Data schemas pages for fields and types.
Where several response variants are possible, their fields are listed in separate schemas; do not combine them into one object.
Note: this operation changes state or continues a one-time authentication flow. The example describes the contract and is not executed.
POST /api/v1/auth/reset-password — Reset password
Access: no sign-in required; additional requirements are listed for the method
Rate limit: 10 requests per 60 seconds per address.
/api/v1/auth/reset-passwordJSON / form fields
| The field | Type | Required | Validation / description |
|---|---|---|---|
email | string | yes | required,email |
token | string | yes | required |
new_password | string | yes | required,min=6 |
{
"email": "PLACEHOLDER_EMAIL (string)",
"token": "PLACEHOLDER_TOKEN (string)",
"new_password": "PLACEHOLDER_NEW_PASSWORD (string)"
}PLACEHOLDER represents your input and its type. Replace the values and keep only the optional fields you need. Do not send string placeholders in place of numbers, booleans, objects, or arrays.
Request schema: ResetPasswordRequest
Response
The JSON response contains code, message, and data. The data contents are described in the schemas below.
Response data schemas: ResetPasswordResponse. See the Data schemas pages for fields and types.
{
"code": 0,
"message": "success",
"data": {
"message": "PLACEHOLDER_MESSAGE (string)"
}
}Note: this operation changes state or continues a one-time authentication flow. The example describes the contract and is not executed.
POST /api/v1/auth/revoke-all-sessions — Revoke all sessions
Access: Dashboard token
/api/v1/auth/revoke-all-sessionsNo request body is required.
Response
The JSON response contains code, message, and data. The data contents are described in the schemas below.
Response data schemas: RevokeAllSessionsResponse. See the Data schemas pages for fields and types.
{
"code": 0,
"message": "success",
"data": {
"message": "PLACEHOLDER_MESSAGE (string)"
}
}Note: all personal data and objects are scoped to the JWT subject.
Note: this operation changes state or continues a one-time authentication flow. The example describes the contract and is not executed.
POST /api/v1/auth/send-verify-code — Send a verification code
Access: no sign-in required; additional requirements are listed for the method
Rate limit: 5 requests per 60 seconds per address.
/api/v1/auth/send-verify-codeJSON / form fields
| The field | Type | Required | Validation / description |
|---|---|---|---|
email | string | yes | required,email |
turnstile_token | string | no |
{
"email": "PLACEHOLDER_EMAIL (string)",
"turnstile_token": "PLACEHOLDER_TURNSTILE_TOKEN (string)"
}PLACEHOLDER represents your input and its type. Replace the values and keep only the optional fields you need. Do not send string placeholders in place of numbers, booleans, objects, or arrays.
Request schema: SendVerifyCodeRequest
Response
The JSON response contains code, message, and data. The data contents are described in the schemas below.
Response data schemas: SendVerifyCodeResponse. See the Data schemas pages for fields and types.
{
"code": 0,
"message": "success",
"data": {
"message": "PLACEHOLDER_MESSAGE (string)",
"countdown": "PLACEHOLDER_COUNTDOWN (integer)"
}
}Note: this operation changes state or continues a one-time authentication flow. The example describes the contract and is not executed.
POST /api/v1/auth/validate-invitation-code — Validate an invitation
Access: no sign-in required; additional requirements are listed for the method
Feature availability and additional access requirements are checked when the request is processed.
Rate limit: 10 requests per 60 seconds per address.
/api/v1/auth/validate-invitation-codeJSON / form fields
| The field | Type | Required | Validation / description |
|---|---|---|---|
code | string | yes | required |
{
"code": "PLACEHOLDER_CODE (string)"
}PLACEHOLDER represents your input and its type. Replace the values and keep only the optional fields you need. Do not send string placeholders in place of numbers, booleans, objects, or arrays.
Request schema: ValidateInvitationCodeRequest
Response
The JSON response contains code, message, and data. The data contents are described in the schemas below.
Response data schemas: ValidateInvitationCodeResponse. See the Data schemas pages for fields and types.
{
"code": 0,
"message": "success",
"data": {
"valid": "PLACEHOLDER_VALID (boolean)",
"error_code": "PLACEHOLDER_ERROR_CODE (string)"
}
}Notes: This method checks the invitation without redeeming the code; the example describes the contract and is not executed.
POST /api/v1/auth/validate-promo-code — Validate a promo code
Access: no sign-in required; additional requirements are listed for the method
Feature availability and additional access requirements are checked when the request is processed.
Rate limit: 10 requests per 60 seconds per address.
/api/v1/auth/validate-promo-codeJSON / form fields
| The field | Type | Required | Validation / description |
|---|---|---|---|
code | string | yes | required |
{
"code": "PLACEHOLDER_CODE (string)"
}PLACEHOLDER represents your input and its type. Replace the values and keep only the optional fields you need. Do not send string placeholders in place of numbers, booleans, objects, or arrays.
Request schema: ValidatePromoCodeRequest
Response
The JSON response contains code, message, and data. The data contents are described in the schemas below.
Response data schemas: ValidatePromoCodeResponse. See the Data schemas pages for fields and types.
{
"code": 0,
"message": "success",
"data": {
"valid": "PLACEHOLDER_VALID (boolean)",
"bonus_amount": "PLACEHOLDER_BONUS_AMOUNT (number)",
"error_code": "PLACEHOLDER_ERROR_CODE (string)",
"message": "PLACEHOLDER_MESSAGE (string)"
}
}Notes: This method checks the promo code without awarding a bonus; the example describes the contract and is not executed.
Sign-in and sessions · 2FA
POST /api/v1/auth/login → data
data.requires_2fa === true→ TotpLoginResponse →data.temp_token→POST /api/v1/auth/login/2fa·{"temp_token": "…", "totp_code": "…"}→data.access_tokendata.access_token→ AuthResponse →Authorization: Bearer $TOKEN
totp_code: string, len = 6. temp_token ≠ access_token. User