# Organization API: Organization deployments: Billing

> The 5 Organization API operations for billing.

Source: https://www.coritan.com/docs/api/reference/organizations/organization-deployments/billing/

Part of [Organization deployments](/docs/api/reference/organizations/organization-deployments/).

## Operations

| Method | Path | Summary |
| --- | --- | --- |
| GET | [`/api/v1/orgs/{org_slug}/billing/deployments/{app_uuid}`](#op-get-api-v1-orgs-org-slug-billing-deployments-app-uuid) | Get org deployment billing |
| PATCH | [`/api/v1/orgs/{org_slug}/billing/deployments/{app_uuid}`](#op-patch-api-v1-orgs-org-slug-billing-deployments-app-uuid) | Change org deployment billing |
| PUT | [`/api/v1/orgs/{org_slug}/billing/deployments/{app_uuid}/spend-limit`](#op-put-api-v1-orgs-org-slug-billing-deployments-app-uuid-spend-limit) | Set org deployment spend limit |
| DELETE | [`/api/v1/orgs/{org_slug}/billing/deployments/{app_uuid}/spend-limit`](#op-delete-api-v1-orgs-org-slug-billing-deployments-app-uuid-spend-limit) | Remove one of the organization's deployments' monthly spend limit, and lift what it held |
| GET | [`/api/v1/orgs/{org_slug}/billing/usage`](#op-get-api-v1-orgs-org-slug-billing-usage) | Org deployment usage |

### Get org deployment billing {#op-get-api-v1-orgs-org-slug-billing-deployments-app-uuid}

`GET /api/v1/orgs/{org_slug}/billing/deployments/{app_uuid}`

How one of the organization's deployments is billed and what it has
cost this month, in the shape ``GET /api/v1/billing/deployments/{uuid}``
answers. The organization's owner pays for every deployment of the
organization, so prices and limits are in the owner's currency.
``account_spend_limit``, the limit across the owner's whole account, is
left out for anyone but the owner.

A member with the Billing role or above reads it; any other member gets
403. Answers 404 for a deployment that is not the organization's own:
another's, a deleted one, or one its storefront sold to a customer.

#### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `app_uuid` | path | string | yes | The deployment's uuid |
| `org_slug` | path | string | yes |  |

#### Responses

| Status | Meaning |
| --- | --- |
| `200` | Success. |
| `422` | The request is not valid. `detail` lists each problem. |

### Change org deployment billing {#op-patch-api-v1-orgs-org-slug-billing-deployments-app-uuid}

`PATCH /api/v1/orgs/{org_slug}/billing/deployments/{app_uuid}`

Change how one of the organization's deployments is billed, as
``PATCH /api/v1/billing/deployments/{uuid}`` does: pay as you go or a
commit, how many instances a commit pays for, and what use past an
allowance does. These are the choices an admin makes when ordering for
the organization. What it charges or credits goes to the owner's
account. ``?preview=1`` prices the change and writes nothing; its
``payment`` says how what is due now would be paid, and the owner's
``credit_balance`` is left out for anyone but the owner.

A member with the Billing role or above may change it, and the change is
in the organization's audit log as theirs. Answers 402 when the owner's
prepaid credit does not cover what is due now (nothing changes), 403
below the Billing role, 404 for a deployment that is not the
organization's own, and the account route's 409 and 422 refusals.

#### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `app_uuid` | path | string | yes | The deployment's uuid |
| `org_slug` | path | string | yes |  |
| `preview` | query | boolean | no | Price the change and write nothing Default: `False`. |

#### Request body

`application/json` (required)

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `billing_mode` | string or null | no | payg bills each instance-hour; commit pays for a number of instances by the month |
| `commit_instances` | integer or null | no | The instances a commit pays for; a new commit takes its locations' minimum when left out |
| `overage_mode` | string or null | no | block stops use past an allowance; allow bills it per unit, up to the spend limit |

#### Responses

| Status | Meaning |
| --- | --- |
| `200` | Success. |
| `422` | The request is not valid. `detail` lists each problem. |

### Set org deployment spend limit {#op-put-api-v1-orgs-org-slug-billing-deployments-app-uuid-spend-limit}

`PUT /api/v1/orgs/{org_slug}/billing/deployments/{app_uuid}/spend-limit`

Set one of the organization's deployments' monthly spend limit, or
change it, as ``PUT /api/v1/billing/deployments/{uuid}/spend-limit``
does; the alerts go to the owner's account. A member with the Billing
role or above may. Answers 403 below it, 404 for a deployment that is not
the organization's own, 409 for one billed by its own service's plan and
422 for an amount that is not more than 0 and at most 1000000 with two
decimal places.

#### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `app_uuid` | path | string | yes | The deployment's uuid |
| `org_slug` | path | string | yes |  |

#### Request body

`application/json` (required)

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `monthly_limit` | number or string | yes | An amount in the account's currency, e.g. "50.00" |
| `policy` | string | no | At 100%: block sleeps previews and stops bursts, builds and overage; pause stops every instance |

#### Responses

| Status | Meaning |
| --- | --- |
| `200` | Success. |
| `422` | The request is not valid. `detail` lists each problem. |

### Remove one of the organization's deployments' monthly spend limit, and lift what it held {#op-delete-api-v1-orgs-org-slug-billing-deployments-app-uuid-spend-limit}

`DELETE /api/v1/orgs/{org_slug}/billing/deployments/{app_uuid}/spend-limit`

Remove one of the organization's deployments' monthly spend limit, and
lift what it held. A member with the Billing role or above may. Answers
204 whether or not it had one, 403 below the Billing role and 404 for a
deployment that is not the organization's own.

#### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `app_uuid` | path | string | yes | The deployment's uuid |
| `org_slug` | path | string | yes |  |

#### Responses

| Status | Meaning |
| --- | --- |
| `204` | Success. |
| `422` | The request is not valid. `detail` lists each problem. |

### Org deployment usage {#op-get-api-v1-orgs-org-slug-billing-usage}

`GET /api/v1/orgs/{org_slug}/billing/usage`

A month's metered use of the organization's own deployments, in the
shape ``GET /api/v1/billing/usage`` answers: by deployment and meter, in
the owner's currency. A member with the Billing role or above reads it;
any other member gets 403. Answers 422 for a month that is not
``YYYY-MM``.

#### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `org_slug` | path | string | yes |  |
| `month` | query | string or null | no | YYYY-MM; this month when left out |

#### Responses

| Status | Meaning |
| --- | --- |
| `200` | Success. |
| `422` | The request is not valid. `detail` lists each problem. |
