# Exchange a code or refresh token for an access token

> Source: https://elaichi.ai/docs/api-reference/mcp-oauth/oauth/issueoauthtoken/

`POST /oauth/token`

Resource: **Oauth** · API: **MCP OAuth**

## Response body

- **`access_token`** _(string)_
  Bearer token for `POST /mcp`. Short-lived; re-check `expires_in` rather than assuming.
- **`token_type`** _(string)_
  Allowed: `Bearer`
- **`expires_in`** _(integer)_
  Access token lifetime in seconds.
- **`refresh_token`** _(string)_
  Single-use — rotated on every refresh.
- **`scope`** _(string)_
  Space-delimited granted scopes.

## Code examples

### curl

```bash
curl -X POST 'https://api.elaichi.ai/oauth/token' \
  -H 'Content-Type: application/json'
```

### JavaScript

```javascript
const response = await fetch('https://api.elaichi.ai/oauth/token', {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json',
  },
});

const data = await response.json();
console.log(data);
```

### Python

```python
import os
import requests

url = "https://api.elaichi.ai/oauth/token"
headers = {
    "Content-Type": "application/json",
}

response = requests.post(url, headers=headers)
print(response.json())
```
