---
title: "Create a Stripe Customer Portal Session"
method: POST
path: "/billing/portal-sessions"
tags: ["Billing"]
---

# Create a Stripe Customer Portal Session

`POST /billing/portal-sessions`

## Request

- Base URL: `https://api.flashdata.dev/v2`
- URL: `https://api.flashdata.dev/v2/billing/portal-sessions`
- Auth: API key in cookie `__Host-fd_session` and API key in header `X-CSRF-Token`

## Headers

- `Idempotency-Key` string, required

## Response `201`

Stripe Customer Portal Session

- HostedSession
  - `id` string, required
  - `url` string, uri, required: Provider-hosted HTTPS URL on a Stripe-controlled *.stripe.com host. Web clients must validate the origin and redirect from a server-only boundary.
  - `expiresAt` string, date-time, required

## Other responses

- `401`: Authentication required or invalid
- `403`: Authenticated but not permitted, or CSRF validation failed
- `404`: Resource not found or not owned by the caller
- `409`: Resource state or idempotency conflict
- `502`: An upstream provider failed
- `503`: The billing catalog or provider is not configured or is temporarily unavailable

---

[API](https://skmtc.dev/flashdata/apis/flashdata-customer-api.md) · [All operations](https://skmtc.dev/flashdata/apis/flashdata-customer-api/llms.txt) · [OpenAPI document](https://skmtc.dev/flashdata/apis/flashdata-customer-api/revisions/109179fe9313?raw)
