---
title: "Token"
method: POST
path: "/api/v1/login"
tags: ["auth"]
---

# Token

`POST /api/v1/login`

OAuth2 token endpoint.

Args:
    request: The request object.
    response: The response object.
    auth_form_data: The OAuth 2.0 authentication form data.

Returns:
    An access token or a redirect response.

Raises:
    ValueError: If the grant type is invalid.

## Response `200`

Successful Response

- union
  - OAuthTokenResponse — OAuth2 device authorization token response.
    - `access_token` string, required
    - `token_type` string, required
    - `expires_in` integer, nullable
    - `refresh_token` string, nullable
    - `scope` string, nullable
  - OAuthRedirectResponse — Redirect response.
    - `authorization_url` string, required

## Other responses

- `401` — Unauthorized
- `422` — Validation Error

---

[API](https://skmtc.net/zenml-io/apis/zenml-2.md) · [All operations](https://skmtc.net/zenml-io/apis/zenml-2/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/zenml-io/zenml-2/versions/febb01b8bce3/schema)
