---
title: "Change the plan's tier, mode or cancellation"
---

> Documentation Index
> Fetch the complete documentation index at: https://docs.ezghcloud.com/llms.txt
> Use this file to discover all available pages before exploring further.

Path: Billing API › Billing

`PUT /v1/organizations/{orgId}/plan`

## Authentication

Requires one of the following:

- `apiKey`, http, header `Authorization`
- `oauth`, http, header `Authorization`
- `sessionCookie`, apiKey, in cookie

## Path parameters

- `UpdatePlan.path.orgId` (string, required) — The organization's UUID or prefixed ID (org_…).

## Header parameters

- `UpdatePlan.header.If-Match` (string, optional)

## Request body

_Required._

- `UpdatePlan.tier` (string, required) — A higher tier upgrades now (charging the prorated difference); a lower one takes effect next month.
  - one of `"p8"`, `"p20"`, `"p100"`
- `UpdatePlan.mode` (string, required)
  - one of `"cap"`, `"overage"`
- `UpdatePlan.cancelAtPeriodEnd` (boolean, required) — true cancels the plan at the end of the month.

## Example request

```json
{
  "tier": "p8",
  "mode": "cap",
  "cancelAtPeriodEnd": true
}
```

## Code samples

### cURL

```curl
curl --request PUT \
  --url https://billing.ezghcloud.com/v1/organizations/string/plan \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "tier": "p8",
  "mode": "cap",
  "cancelAtPeriodEnd": true
}
'
```

### TypeScript

```typescript
const url = 'https://billing.ezghcloud.com/v1/organizations/string/plan';
const options = {
  method: 'PUT',
  headers: {'Content-Type': 'application/json', Authorization: 'Bearer <token>'},
  body: JSON.stringify({tier: 'p8', mode: 'cap', cancelAtPeriodEnd: true})
};

fetch(url, options)
  .then(res => res.json())
  .then(json => console.log(json))
  .catch(err => console.error(err));
```

### Python

```python
import requests

url = "https://billing.ezghcloud.com/v1/organizations/string/plan"

payload = {
    "tier": "p8",
    "mode": "cap",
    "cancelAtPeriodEnd": True
}
headers = {
    "Content-Type": "application/json",
    "Authorization": "Bearer <token>"
}

response = requests.put(url, json=payload, headers=headers)

print(response.text)
```

## Responses

### 200

OK

#### Example

```json
{
  "plan": {
    "tier": "p8",
    "mode": "cap",
    "status": "scheduled",
    "currentPeriod": "string",
    "startsPeriod": "string",
    "pendingTier": "p8",
    "cancelAtPeriodEnd": true,
    "capSince": "2019-08-24T14:15:22Z",
    "credit": {
      "amount": "string",
      "used": "string",
      "remaining": "string"
    },
    "controls": {
      "blocked": true,
      "stopped": true
    },
    "updatedAt": "2019-08-24T14:15:22Z"
  },
  "tiers": [
    {
      "tier": "p8",
      "price": "string",
      "credit": "string",
      "currency": "USD"
    }
  ]
}
```

- `UpdatePlan.response.200.plan` (one of, required) — Null when the organization never subscribed.
  - one of: [Plan](/billing-api/schemas/Plan/), `null`
- `UpdatePlan.response.200.tiers` (array<object>, required)
  - `UpdatePlan.response.200.tiers.tier` (string, required)
    - one of `"p8"`, `"p20"`, `"p100"`
  - `UpdatePlan.response.200.tiers.price` (string, required) — Price per month, in dollars.
    - pattern `^[0-9]+\.[0-9]{2}$`
  - `UpdatePlan.response.200.tiers.credit` (string, required) — Credit per month, in dollars.
    - pattern `^[0-9]+\.[0-9]{2}$`
  - `UpdatePlan.response.200.tiers.currency` (string, required)

### 400

invalid_request: the request is malformed (with issues), or invalid_cursor.

#### Example

```json
{
  "error": {
    "code": "string",
    "message": "string",
    "issues": [
      {
        "path": "string",
        "message": "string"
      }
    ]
  }
}
```

- `UpdatePlan.response.400.error` (object, required)
  - `UpdatePlan.response.400.error.code` (string, required) — What went wrong, for programs: branch on this, never on message.
  - `UpdatePlan.response.400.error.message` (string, required) — What went wrong, for people.
  - `UpdatePlan.response.400.error.issues` (array<object>, optional) — With invalid_request: each invalid field.
    - `UpdatePlan.response.400.error.issues.path` (string, required)
    - `UpdatePlan.response.400.error.issues.message` (string, required)

### 401

unauthenticated: no valid credential.

#### Example

```json
{
  "error": {
    "code": "string",
    "message": "string",
    "issues": [
      {
        "path": "string",
        "message": "string"
      }
    ]
  }
}
```

- `UpdatePlan.response.401.error` (object, required)
  - `UpdatePlan.response.401.error.code` (string, required) — What went wrong, for programs: branch on this, never on message.
  - `UpdatePlan.response.401.error.message` (string, required) — What went wrong, for people.
  - `UpdatePlan.response.401.error.issues` (array<object>, optional) — With invalid_request: each invalid field.
    - `UpdatePlan.response.401.error.issues.path` (string, required)
    - `UpdatePlan.response.401.error.issues.message` (string, required)

### 402

payment_failed: an upgrade's charge was declined.

#### Example

```json
{
  "error": {
    "code": "string",
    "message": "string",
    "issues": [
      {
        "path": "string",
        "message": "string"
      }
    ]
  }
}
```

- `UpdatePlan.response.402.error` (object, required)
  - `UpdatePlan.response.402.error.code` (string, required) — What went wrong, for programs: branch on this, never on message.
  - `UpdatePlan.response.402.error.message` (string, required) — What went wrong, for people.
  - `UpdatePlan.response.402.error.issues` (array<object>, optional) — With invalid_request: each invalid field.
    - `UpdatePlan.response.402.error.issues.path` (string, required)
    - `UpdatePlan.response.402.error.issues.message` (string, required)

### 403

access_denied: the caller isn't allowed to (the message names the action); forbidden_origin: a cookie-authenticated write from another site.

#### Example

```json
{
  "error": {
    "code": "string",
    "message": "string",
    "issues": [
      {
        "path": "string",
        "message": "string"
      }
    ]
  }
}
```

- `UpdatePlan.response.403.error` (object, required)
  - `UpdatePlan.response.403.error.code` (string, required) — What went wrong, for programs: branch on this, never on message.
  - `UpdatePlan.response.403.error.message` (string, required) — What went wrong, for people.
  - `UpdatePlan.response.403.error.issues` (array<object>, optional) — With invalid_request: each invalid field.
    - `UpdatePlan.response.403.error.issues.path` (string, required)
    - `UpdatePlan.response.403.error.issues.message` (string, required)

### 404

not_found: the organization (or one the caller doesn't belong to), or the resource, doesn't exist.

#### Example

```json
{
  "error": {
    "code": "string",
    "message": "string",
    "issues": [
      {
        "path": "string",
        "message": "string"
      }
    ]
  }
}
```

- `UpdatePlan.response.404.error` (object, required)
  - `UpdatePlan.response.404.error.code` (string, required) — What went wrong, for programs: branch on this, never on message.
  - `UpdatePlan.response.404.error.message` (string, required) — What went wrong, for people.
  - `UpdatePlan.response.404.error.issues` (array<object>, optional) — With invalid_request: each invalid field.
    - `UpdatePlan.response.404.error.issues.path` (string, required)
    - `UpdatePlan.response.404.error.issues.message` (string, required)

### 409

plan_lapsed: subscribe again to choose a plan.

#### Example

```json
{
  "error": {
    "code": "string",
    "message": "string",
    "issues": [
      {
        "path": "string",
        "message": "string"
      }
    ]
  }
}
```

- `UpdatePlan.response.409.error` (object, required)
  - `UpdatePlan.response.409.error.code` (string, required) — What went wrong, for programs: branch on this, never on message.
  - `UpdatePlan.response.409.error.message` (string, required) — What went wrong, for people.
  - `UpdatePlan.response.409.error.issues` (array<object>, optional) — With invalid_request: each invalid field.
    - `UpdatePlan.response.409.error.issues.path` (string, required)
    - `UpdatePlan.response.409.error.issues.message` (string, required)

### 412

precondition_failed: the plan changed since it was read.

#### Example

```json
{
  "error": {
    "code": "string",
    "message": "string",
    "issues": [
      {
        "path": "string",
        "message": "string"
      }
    ]
  }
}
```

- `UpdatePlan.response.412.error` (object, required)
  - `UpdatePlan.response.412.error.code` (string, required) — What went wrong, for programs: branch on this, never on message.
  - `UpdatePlan.response.412.error.message` (string, required) — What went wrong, for people.
  - `UpdatePlan.response.412.error.issues` (array<object>, optional) — With invalid_request: each invalid field.
    - `UpdatePlan.response.412.error.issues.path` (string, required)
    - `UpdatePlan.response.412.error.issues.message` (string, required)

### 429

too_many_requests: slow down.

#### Example

```json
{
  "error": {
    "code": "string",
    "message": "string",
    "issues": [
      {
        "path": "string",
        "message": "string"
      }
    ]
  }
}
```

- `UpdatePlan.response.429.error` (object, required)
  - `UpdatePlan.response.429.error.code` (string, required) — What went wrong, for programs: branch on this, never on message.
  - `UpdatePlan.response.429.error.message` (string, required) — What went wrong, for people.
  - `UpdatePlan.response.429.error.issues` (array<object>, optional) — With invalid_request: each invalid field.
    - `UpdatePlan.response.429.error.issues.path` (string, required)
    - `UpdatePlan.response.429.error.issues.message` (string, required)

### 500

internal_error: a bug; the details are in the logs, under the request ID.

#### Example

```json
{
  "error": {
    "code": "string",
    "message": "string",
    "issues": [
      {
        "path": "string",
        "message": "string"
      }
    ]
  }
}
```

- `UpdatePlan.response.500.error` (object, required)
  - `UpdatePlan.response.500.error.code` (string, required) — What went wrong, for programs: branch on this, never on message.
  - `UpdatePlan.response.500.error.message` (string, required) — What went wrong, for people.
  - `UpdatePlan.response.500.error.issues` (array<object>, optional) — With invalid_request: each invalid field.
    - `UpdatePlan.response.500.error.issues.path` (string, required)
    - `UpdatePlan.response.500.error.issues.message` (string, required)

### 503

billing_busy, or a dependency is unavailable.

#### Example

```json
{
  "error": {
    "code": "string",
    "message": "string",
    "issues": [
      {
        "path": "string",
        "message": "string"
      }
    ]
  }
}
```

- `UpdatePlan.response.503.error` (object, required)
  - `UpdatePlan.response.503.error.code` (string, required) — What went wrong, for programs: branch on this, never on message.
  - `UpdatePlan.response.503.error.message` (string, required) — What went wrong, for people.
  - `UpdatePlan.response.503.error.issues` (array<object>, optional) — With invalid_request: each invalid field.
    - `UpdatePlan.response.503.error.issues.path` (string, required)
    - `UpdatePlan.response.503.error.issues.message` (string, required)


Source: https://docs.ezghcloud.com/billing-api/Billing/UpdatePlan/index.md
