---
title: "Exchange credentials for an access token"
method: POST
path: "/api/auth/token"
tags: ["auth"]
---

# Exchange credentials for an access token

`POST /api/auth/token`

[cloud-only] Exchanges authentication credentials (e.g. an authorization code) for an access token.

## Request body

- object
  - `grant_type` 'authorization_code' | 'refresh_token', required — OAuth2 grant type
  - `code` string — Authorization code (for authorization_code grant)
  - `refresh_token` string — Refresh token (for refresh_token grant)
  - `redirect_uri` string, uri — Redirect URI used in the authorization request

## Response `200`

Token response

- AuthTokenResponse — [cloud-only] OAuth2 token response.
  - `access_token` string, required
  - `token_type` string, required — Always "Bearer"
  - `expires_in` integer — Token lifetime in seconds
  - `refresh_token` string, nullable
  - `scope` string

## Other responses

- `400` — Bad request
- `401` — Unauthorized

## Changes

- **2026-05-08** `c9640fded659` — 1 info
  - endpoint added

[Change history](https://skmtc.dev/comfy-org/apis/comfyui-api/changes/api/auth/token/post.md)

---

[API](https://skmtc.dev/comfy-org/apis/comfyui-api.md) · [All operations](https://skmtc.dev/comfy-org/apis/comfyui-api/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/comfy-org/comfyui-api/revisions/2f69d843959c/schema)
