---
title: "Exchange code or refresh token"
method: POST
path: "/api/workos/authenticate"
tags: ["Private Authentication"]
---

# Exchange code or refresh token

`POST /api/workos/authenticate`

Exchanges an authorization code or refresh token for access tokens via WorkOS.

## Request body

- object
  - `code` string
  - `grant_type` 'refresh_token'
  - `refresh_token` string
  - `code_verifier` string

## Response `200`

Authentication result with tokens

- object
  - `accessToken` string
  - `refreshToken` string
  - `user` object
  - `expiresIn` integer — Token expiry in seconds
  - `expirationDate` integer — Token expiry date in milliseconds

## Other responses

- `400` — Invalid request

---

[API](https://skmtc.net/dust-tt/apis/dust-api-documentation.md) · [All operations](https://skmtc.net/dust-tt/apis/dust-api-documentation/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/dust-tt/dust-api-documentation/revisions/5fb378acc79f/schema)
