Skip to content

Create Token

POST
/api/v1/auth/token
curl --request POST \
--url https://example.com/api/v1/auth/token \
--header 'Content-Type: application/json' \
--data '{ "username": "example", "password": "example" }'

Create a new access token.

This endpoint generates a JWT access token for authenticated users. The token can be used to access protected endpoints.

Args: request: Token request containing username and password auth_service: Authentication service dependency

Returns: TokenResponse with access token and expiration info

Raises: HTTPException: If authentication fails

X-Environment-Id
Any of:
string
Media typeapplication/json
TokenRequest

Request model for obtaining access token.

object
username
required
Username

Snowflake username

string
password
required
Password

Snowflake password

string
Examplegenerated
{
"username": "example",
"password": "example"
}

Successful Response

Media typeapplication/json
TokenResponse

Response model for access token.

object
access_token
required
Access Token

JWT access token

string
token_type
Token Type

Token type

string
default: bearer
expires_in
required
Expires In

Token expiration time in seconds

integer
expires_at
required
Expires At

Token expiration timestamp

string format: date-time
Example
{
"token_type": "bearer"
}

Validation Error

Media typeapplication/json
HTTPValidationError
object
detail
Detail
Array<object>
ValidationError
object
loc
required
Location
Array
msg
required
Message
string
type
required
Error Type
string
Examplegenerated
{
"detail": [
{
"loc": [
"example"
],
"msg": "example",
"type": "example"
}
]
}