# POST /api/v1/billing/migrate-from-grandfathered

> Migrate grandfathered account to a paid plan

- **Tag:** billing
- **Operation ID:** `migrate_from_grandfathered_api_v1_billing_migrate_from_grandfathered_post`

## Description

Create a Stripe Checkout session to move from a grandfathered plan to a paid plan.

**Request Body:**
- `target_plan`: Plan tier to migrate to (`self_directed` or `managed`)
- `success_url`: Redirect URL after successful payment
- `cancel_url`: Redirect URL if checkout is canceled

**Prerequisites:**
- Business must currently be on the `grandfathered` plan tier

**Effect:**
- Creates a Stripe Checkout session
- On payment completion, `plan_tier` is updated to the target plan

## Authentication

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

## Request body

Schema: `GrandfatheredMigrateRequest`

- `target_plan` (string · required) — Target plan tier: 'self_directed' or 'managed'.
- `success_url` (string · required) — URL to redirect after successful payment.
- `cancel_url` (string · required) — URL to redirect if checkout is canceled.

## Responses

### 201 — Successful Response

### 400 — Bad Request - Invalid input

### 403 — Forbidden - Insufficient permissions

### 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/billing/migrate-from-grandfathered' \
  -H 'Authorization: Bearer dz_your_token' \
  -H 'x-business-id: YOUR_BUSINESS_ID' \
  -H 'Content-Type: application/json' \
  -d '{
  "target_plan": "string",
  "success_url": "string",
  "cancel_url": "string"
}'
```

### JavaScript

```javascript
const response = await fetch('https://api.ondayzero.com/api/v1/billing/migrate-from-grandfathered', {
  method: 'POST',
  headers: {
    Authorization: 'Bearer dz_your_token',
    'x-business-id': 'YOUR_BUSINESS_ID',
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
  "target_plan": "string",
  "success_url": "string",
  "cancel_url": "string"
}),
});
const data = await response.json();
```

### Python

```python
import httpx

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

payload = {
  "target_plan": "string",
  "success_url": "string",
  "cancel_url": "string"
}

response = httpx.post("https://api.ondayzero.com/api/v1/billing/migrate-from-grandfathered", headers=headers, json=payload)
data = response.json()
```

## See also

- HTML version: https://www.ondayzero.com/docs/reference/billing/migrate-from-grandfathered
- OpenAPI slice: https://www.ondayzero.com/docs/reference/billing/migrate-from-grandfathered/openapi.json
- Other endpoints in **billing**: https://www.ondayzero.com/docs/reference/billing
