# Open a Stripe Billing Portal session

> Open a Stripe Billing Portal session: CustomDomain™ API reference in the billing group. Covers request parameters, the request body, responses and error codes.

Source: https://docs.customdomain.ai/docs/api-reference/billing/createPortalSession

## `POST https://api.customdomain.ai/v1/billing/portal`

Opens the Stripe Billing Portal (invoices, the card, cancellation) for the caller's workspace. Requires `billing:manage` (owners and admins) and a Stripe customer (a completed checkout). `flow` deep-links into one task: `payment_method_update` (the "update your card" link of a payment failure email) or `subscription_cancel`.

### Authentication

`apiKey`

### Request body (JSON)

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `return_url` | string | yes |  |
| `flow` | `payment_method_update`, `subscription_cancel` | no |  |

### Responses

| Status | Description |
| --- | --- |
| `200` | Portal session |
| `400` | Error envelope: {code, title, details}. |
| `401` | Error envelope: {code, title, details}. |
| `403` | Error envelope: {code, title, details}. |
| `503` | Error envelope: {code, title, details}. |

### `200` response body

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `id` | string | no |  |
| `url` | string | no |  |

The full specification is served at `GET https://api.customdomain.ai/v1/openapi.json`.
