Account

Quick API key verification

get

Verify API Key

This endpoint provides quick verification of API key validity. It checks whether the provided API key exists in the system and has not expired, returning a simple boolean response.


Authentication

  • Type: Bearer Token

  • Required: Yes

  • Header: Authorization: Bearer <API_KEY>

  • Dependency: Depends(APIKeyBearer())


Request Headers

Header Name
Type
Required
Description

Authorization

string

Yes

Bearer token containing the API key to verify (e.g., Bearer <API_KEY>).


Path Parameters

No path parameters required for this endpoint.


Query Parameters

No query parameters required for this endpoint.


Responses

Status Code
Description

200

Success - Returns boolean value indicating API key validity (true or false).

400

Bad Request - Error occurred during API key verification process.

401

Unauthorized - Invalid or missing authentication token.

422

Validation Error - The request contains invalid data.


Response Format

The endpoint returns a simple boolean response:

Valid API key:

Invalid or expired API key:


Technical Process

The endpoint performs the following verification steps:

  1. Authentication Extraction: Retrieves the API key from the bearer token

  2. Database Query: Searches for the API key in the 'api_keys' collection

  3. Existence Check: Verifies the API key exists in the system

  4. Expiration Validation: Checks if the API key has an expiration date and validates it against current date

  5. Boolean Response: Returns true for valid keys, false for invalid or expired keys


Validation Checks

Check Type
Result
Description

API Key Existence

false

API key not found in database

API Key Expired

false

Current date is after expiration date

API Key Valid

true

Key exists and is not expired


Expiration Handling

  • API keys without expiration dates are considered valid indefinitely

  • API keys with expiration dates are validated against the current server time

  • Expiration dates are expected in "YYYY-MM-DD" format


Example Use Cases

  • API Key Validation: Quick check if an API key is valid before making other API calls

  • Health Check: Verify API key status in monitoring systems

  • Client Setup: Confirm API key works during application configuration

  • Access Control: Preliminary check before granting access to sensitive operations


Example Request


Example Responses

Valid API key:

Invalid or expired API key:


Error Scenarios

Scenario
HTTP Status
Error Message

Database error

400

"Erreur lors de la vérification de la clé API"

Missing authentication

401

"Unauthorized"


Performance Notes

  • Lightweight database query with single document retrieval

  • Efficient expiration date comparison

  • Minimal response payload for fast verification

  • Suitable for frequent validation checks


Security Considerations

  • Only verifies existence and expiration, not specific permissions

  • Does not reveal why a key is invalid (security through obscurity)

  • Suitable for preliminary checks before more extensive authentication

  • Expired keys are automatically rejected without manual intervention

Authorizations
AuthorizationstringRequired
Bearer authentication header of the form Bearer <token>.
Responses
chevron-right
200

Successful Response

application/json
Responseany
get
/account/verify-apikey

No content

Retrieve user profile information

get

Retrieve User Profile Information

This endpoint allows users to retrieve comprehensive profile information including subscription details, usage statistics, team membership, and plan limitations. It provides a complete overview of the user's account status and capabilities.


Authentication

  • Type: Bearer Token

  • Required: Yes

  • Header: Authorization: Bearer <JWT_TOKEN>

  • Dependency: Depends(APIKeyBearer())

  • External Usage Requirement: To retrieve profile information on behalf of an external user, the API key used for authentication must itself be configured for external usage (i.e., accept_external_client must be true).


Request Headers

Header Name
Type
Required
Description

accept_language

LanguageEnum

Yes

Specifies the preferred language for response messages (e.g., "fr-FR").


Query Parameters

Parameter Name
Type
Required
Description

acting_user_email

string

No

Email of the user acting on the owner's behalf (for external usage). Requires the authenticating API key to have external usage enabled.


Responses

Status Code
Description

200

Success - Returns comprehensive user profile information in UserProfileSchema format.

400

Bad Request - Various validation errors including permission issues or database errors.

401

Unauthorized - Invalid or missing authentication token.

422

Validation Error - The request contains invalid data.


Response Format (JSON)

The endpoint returns a JSON response with the following structure:


Technical Process

The endpoint performs the following comprehensive operations:

  1. Authentication Validation: Verifies user credentials and external usage permissions

  2. Team Membership Check: Validates that acting users are part of the owner's teams for external usage

  3. User Profile Retrieval: Fetches basic user information from the database

  4. Model Statistics: Calculates created models, public models, and total prompts

  5. Usage Analysis: Retrieves daily usage statistics for private and public prompts

  6. Plan Details: Fetches subscription plan limitations and capabilities

  7. Team Analysis: Calculates team seat usage and external team memberships

  8. Encryption Status: Checks if user has enterprise encryption capabilities

  9. Data Formatting: Converts all values to appropriate string formats for display


Data Fields Explanation

Field
Description
Format

created_at

Account creation timestamp

ISO 8601 datetime

models_accepted_public

Number of models made public

Integer

models_created

Total models created by user

Integer

total_prompts

Total prompts processed

Integer

subscription_plan

Current subscription tier

String ("Freemium", "Premium", "Enterprise")

teams_count

Team seat usage (used/total)

String "X/Y"

is_external

Whether user is external team member

Boolean

private_limit

Private prompt usage (used/limit)

String "X/Y"

public_limit

Public prompt usage (used/limit)

String "X/Y"

max_assistants_create

Maximum assistants allowed

String

max_pages_per_request

Maximum pages per processing request

String

max_data_per_month

Data upload usage (GB used/limit)

String "X.Y/Z"

llms_chat

Available chat models

String

llms_build

Available build models

String

has_encryption

Enterprise encryption capability

Boolean


Plan-Based Limitations

Different subscription plans provide different capabilities:

  • Freemium: Basic limits, no team functionality

  • Premium: Enhanced limits, limited team seats

  • Enterprise: Maximum limits, full team functionality, encryption capabilities


Validation Checks

Check Type
Error Message

Acting user not authorized

"User {acting_user_email} is not in your teams"

Database error

"An error occurred while processing your request"


Example Use Cases

  • Account Dashboard: Display comprehensive user information in web interface

  • Usage Monitoring: Track prompt usage and data upload limits

  • Plan Management: Review subscription benefits and limitations

  • Team Administration: Monitor team seat usage and external memberships

  • Feature Discovery: Understand available AI models and capabilities


Example Request


Example Response

Enterprise User:

Premium User:


Error Scenarios

Scenario
HTTP Status
Error Message

Acting user not authorized

400

"User [email protected] is not in your teams"

Database connection error

400

"An error occurred while processing your request"

Authorizations
AuthorizationstringRequired
Bearer authentication header of the form Bearer <token>.
Query parameters
acting_user_emailstringOptional

Email of the end user initiating this action

Header parameters
accept-languagestring · enumRequiredPossible values:
Responses
chevron-right
200

Successful Response

application/json
Responseany of
or
nullOptional
get
/account

Generate user api key

post

Generate User API Key

This endpoint allows authenticated users to generate one or more API keys to access the platform's services. The keys can be configured with a custom name, an expiration date, and a usage type (internal or external). It includes a mechanism for authorized partners to generate keys on behalf of users within their teams.


Authentication

  • Type: Bearer Token (API_KEY)

  • Required: Yes

  • Header: Authorization: Bearer <API_KEY>

  • Dependency: Depends(APIKeyBearer())

  • External Usage Requirement: To generate an API key for an external user, the API key used for authentication must itself be configured for external usage (i.e., is_external_usage must be true).


Request Headers

Header Name
Type
Required
Description

accept_language

LanguageEnum

Yes

Specifies the preferred language for response messages (e.g., "fr-FR").


Body Parameters (JSON Schema)

Parameter Name
Type
Required
Description

api_key_name

string

Yes

A custom name to identify the API key.

expiration_date

string

No

An optional expiration date for the API key in YYYY-MM-DD format. If not provided, defaults to current date + 60 days.

is_external_usage

boolean

No

Indicates if the key is intended for external usage (default: false).

acting_user_email

string

No

Email of the user acting on the owner's behalf (for external usage). Requires the authenticating API key to have external usage enabled.


Responses

Status Code
Description

200

Success - Returns the generated API key object (ApiKeySchema).

400

Bad Request - The acting user is not in the owner's teams, the authenticating API key doesn't have external usage permissions, or another application error occurred.

401

Unauthorized - Invalid or missing API key.

422

Validation Error - The request body contains invalid data.


Example Use Case

An authenticated partner needs to generate a new API key for a third-party integration. They use this endpoint to create a key with a descriptive name, set it to expire at the end of the year, and specify it for external use. If the partner is generating a key for a specific user (acting_user_email), the system validates that the user belongs to the partner's teams and that the authenticating API key has external usage permissions.


Example Request

Authorizations
AuthorizationstringRequired
Bearer authentication header of the form Bearer <token>.
Header parameters
accept-languagestring · enumRequiredPossible values:
Body
api_key_nameany ofOptional
stringOptional
or
nullOptional
expiration_dateany ofOptional
stringOptional
or
nullOptional
is_external_usageany ofOptionalDefault: false
booleanOptional
or
nullOptional
acting_user_emailany ofOptional
stringOptional
or
nullOptional
Responses
chevron-right
200

Successful Response

application/json
post
/account/apikey

Last updated