---
title: "Create Billing Portal Session"
method: POST
path: "/billing/team/{team_id}/billing-portal"
tags: ["billing"]
---

# Create Billing Portal Session

`POST /billing/team/{team_id}/billing-portal`

Create a Stripe Billing Portal session for a team.

Allows users with billing permissions to manage their subscription,
payment methods, and invoices through Stripe's hosted portal.

Args:
    team_id: Team UUID.
    return_url: URL to redirect the user back to after the portal.
    auth: Authenticated user context.

Returns:
    BillingPortalResponse with the portal URL.

Raises:
    HTTPException: 403 if not a member or lacks permission,
        400 if return_url is untrusted or no Stripe customer exists.

## Path parameters

- `team_id` string, required

## Query parameters

- `return_url` string, required — URL to redirect to after the portal session

## Response `200`

Successful Response

- BillingPortalResponse — Response containing a Stripe Billing Portal URL.
  - `url` string, required — Stripe Billing Portal session URL

## Other responses

- `422` — Validation Error

---

[API](https://skmtc.net/pioneer/apis/brain-api.md) · [All operations](https://skmtc.net/pioneer/apis/brain-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/pioneer/brain-api/revisions/b92f75fd3b61/schema)
