# Open the billing portal

`POST /api/v1/workspaces/{workspaceId}/billing/portal`

A link to the payment provider's portal, for the person who pays: invoices, card, address.

Sign-in: a dashboard session only. API tokens and OAuth sign-ins get `403 token.not_allowed`.

Section: Plans and billing. Operation id in openapi.json: `open_billing_portal`.

## Parameters

| Name | In | Required | Type | Description |
|---|---|---|---|---|
| `workspaceId` | path | yes | string (uuid) | The workspace's id. |

## Responses

Errors are `application/problem+json` (`Problem`); branch on `type`.

### 200

The portal's address.

`application/json`: PortalView

| Field | Type | Required | Description |
|---|---|---|---|
| `url` | string | yes | Short-lived; open it right away. |

### 400

Bad Request.

- `auth.credentials_conflict`: the request carries both a session cookie and a token

### 401

Unauthorized.

- `auth.unauthenticated`, `auth.session_expired`: no session, or it ended
- `token.invalid`: the token is malformed, unknown, revoked or expired, or its creator left the workspace

### 403

Forbidden.

- `auth.forbidden`: your role is too low for this
- `token.not_allowed`: this operation needs a signed-in session; tokens cannot call it
- `request.origin_mismatch`, `request.header_required`: a changing request with a session comes from another site or lacks `X-Monitorly-Request: 1`
- `billing.payer_only`: only the person who pays for the subscription can open its billing portal

### 404

Not Found.

- `request.not_found`: it does not exist, or you cannot see it

### 409

Conflict.

- `billing.no_subscription`: the workspace has no subscription to change, cancel or manage

### 429

Too Many Requests.

- `session.rate_limited`: more than 5 changes a second from your sessions

### 502

Bad Gateway.

- `billing.provider_failed`: the payment provider refused or did not answer; nothing changed

### 503

Service Unavailable.

- `billing.unavailable`: this installation takes no payments

Schemas named above are listed with their fields in [the schema list](https://docs.monitorly.cloud/api/reference/schemas.md).
