Create Token
POST
/api/v1/auth/token
const url = 'https://example.com/api/v1/auth/token';const options = { method: 'POST', headers: {'Content-Type': 'application/json'}, body: '{"username":"example","password":"example"}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}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
Parameters
Section titled “Parameters”Header Parameters
Section titled “Header Parameters”Request Bodyrequired
Section titled “Request Bodyrequired”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"}Responses
Section titled “Responses”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
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>
ValidationErrorobject
loc
required
Location
Array
msg
required
Message
string
type
required
Error Type
string
Examplegenerated
{ "detail": [ { "loc": [ "example" ], "msg": "example", "type": "example" } ]}