---
title: "Exchange a code, a refresh token, a device code or a client secret for an access token"
url: https://xovris.ai/docs/api/operations/postoauthtoken/
---

# Exchange a code, a refresh token, a device code or a client secret for an access token

`POST /v1/oauth/token`

Open to anyone, so no Idempotency-Key is kept: nobody is signed in to keep it for, and replaying one caller's answer to another would hand it over.

No token needed: anyone may call this.

## Request body

### `application/json`

- `client_id` (string)
- `client_secret` (string)
- `grant_type` (string)
- `code` (string)
- `code_verifier` (string)
- `redirect_uri` (string)
- `refresh_token` (string)
- `scope` (string)
- `device_code` (string)

Example:

```json
{
  "client_id": "string",
  "client_secret": "string",
  "grant_type": "string",
  "code": "string",
  "code_verifier": "string",
  "redirect_uri": "string",
  "refresh_token": "string",
  "scope": "string",
  "device_code": "string"
}
```

## Answers

- `200`: Done. (application/json: T91d1f784ff5a)
- `400`: Refused, as OAuth 2.0 says (RFC 6749, RFC 7591, RFC 8628). (application/json: OAuthError)
- `401`: Refused, as OAuth 2.0 says (RFC 6749, RFC 7591, RFC 8628). (application/json: OAuthError)
- `404`: Nothing with that id here, or it belongs to another workspace. Nothing was changed. (application/json: Problem)
- `default`: Refused or failed: an OAuth 2.0 error from the standard's own checks, otherwise the Problem with what to do next. (application/json: Problem | OAuthError; application/problem+json: Problem)

## A call

The address is https://api.xovris.ai/v1/oauth/token - put your own value in place of each part in braces.

```sh
curl --request POST \
  --url 'https://api.xovris.ai/v1/oauth/token' \
  --header 'Content-Type: application/json' \
  --data '{"client_id":"string","client_secret":"string","grant_type":"string","code":"string","code_verifier":"string","redirect_uri":"string","refresh_token":"string","scope":"string","device_code":"string"}'
```
