Create Api Key

Create a new API key for the current user.

Returns a temporary plain key for the user to store securely. This is not stored in the database.

Args:

db (AsyncSession): The database session. api_key_in (schemas.APIKeyCreate): The API key creation data. user (schemas.User): The current user.

Returns:

schemas.APIKeyWithPlainKey: The created API key object, including the key.

Headers

x-api-keystringOptional

Request

This endpoint expects an object.
expiration_datedatetimeOptional

Expiration date for the API key, defaults to 180 days from now

Response

Successful Response

idstringformat: "uuid"
key_prefixstring
organizationstringformat: "uuid"
created_atdatetime
modified_atdatetime
expiration_datedatetime
created_by_emailstringformat: "email"
modified_by_emailstringformat: "email"
plain_keystring
last_used_datedatetimeOptional

Errors