---
title: "Exchange grant for OAuth2 tokens"
method: POST
path: "/oauth/token"
tags: ["oauth"]
---

# Exchange grant for OAuth2 tokens

`POST /oauth/token`

Token endpoint that dispatches by grant_type: authorization_code, urn:ietf:params:oauth:grant-type:device_code, or refresh_token.

## Response `200`

OK

- OauthTokenResponse
  - `access_token` string
  - `expires_in` integer
  - `refresh_token` string
  - `token_type` string
  - `workspace_id` string

## Other responses

- `400` — Bad Request
- `500` — Internal Server Error

## Changes

- **2026-05-27** `a0acb3a6a101` — 1 info
  - added the optional property `workspace_id` to the response with the `200` status
- **2026-04-30** `99490d1e837e` — 1 info
  - endpoint added

[Change history](https://skmtc.dev/langchain-ai/apis/langsmith/changes/oauth/token/post.md)

---

[API](https://skmtc.dev/langchain-ai/apis/langsmith.md) · [All operations](https://skmtc.dev/langchain-ai/apis/langsmith/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/langchain-ai/langsmith/revisions/a0acb3a6a101/schema)
