# POST /api/v1/oauth2/refresh

> Refresh Token

- **Tag:** oauth
- **Operation ID:** `refresh_token_api_v1_oauth2_refresh_post`

## Description

Exchange refresh token for new access token.

## Authentication

Bearer token in `Authorization` header.
Required header: `x-business-id: <business uuid>`.

## Responses

### 200 — Successful Response

Schema: `OAuthTokenResponse`

- `access_token` (string · required) — The access token (JWT)
- `token_type` (string) — Token type (always 'Bearer')
- `expires_in` (integer · required) — Access token lifetime in seconds
- `refresh_token` (string) — Refresh token for obtaining new access tokens
- `scope` (string) — Granted scope (may differ from requested)

### 422 — Validation Error

Schema: `HTTPValidationError`

- `detail` (array · ValidationError) → `ValidationError`
  - `loc` (array · string | integer · required)
  - `msg` (string · required)
  - `type` (string · required)
  - `input` (object)
  - `ctx` (object)

## Code samples

### cURL

```bash
curl -X POST 'https://api.ondayzero.com/api/v1/oauth2/refresh' \
  -H 'Authorization: Bearer dz_your_token' \
  -H 'x-business-id: YOUR_BUSINESS_ID' \
  -H 'Content-Type: application/json' \
  -d ''
```

### JavaScript

```javascript
const response = await fetch('https://api.ondayzero.com/api/v1/oauth2/refresh', {
  method: 'POST',
  headers: {
    Authorization: 'Bearer dz_your_token',
    'x-business-id': 'YOUR_BUSINESS_ID',
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({}),
});
const data = await response.json();
```

### Python

```python
import httpx

headers = {
    "Authorization": "Bearer dz_your_token",
    "x-business-id": "YOUR_BUSINESS_ID",
}

payload = {}

response = httpx.post("https://api.ondayzero.com/api/v1/oauth2/refresh", headers=headers, json=payload)
data = response.json()
```

## See also

- HTML version: https://www.ondayzero.com/docs/reference/oauth/refresh-token
- OpenAPI slice: https://www.ondayzero.com/docs/reference/oauth/refresh-token/openapi.json
- Other endpoints in **oauth**: https://www.ondayzero.com/docs/reference/oauth
