> ## Documentation Index
> Fetch the complete documentation index at: https://docs.entityml.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Create Portal Session

> Create a Stripe Customer Portal session.

## Request

<ParamField body="user_id" type="string" required>
  User ID whose subscription should be managed.
</ParamField>

<ParamField body="return_url" type="string" required>
  URL Stripe should redirect to after the portal session.
</ParamField>

## Response

<ResponseField name="portal_url" type="string">
  Stripe-hosted customer portal URL.
</ResponseField>

## Example

<CodeGroup>
  ```python Python SDK theme={null}
  from entityml import EntityMLClient

  client = EntityMLClient()
  portal = client.billing.create_portal_session(
      user_id="YOUR_USER_ID",
      return_url="https://entityml.com/dashboard",
  )
  print(portal["portal_url"])
  ```

  ```bash CLI theme={null}
  entityml billing portal \
    --user-id YOUR_USER_ID \
    --return-url https://entityml.com/dashboard
  ```

  ```bash Raw HTTP (cURL) theme={null}
  curl -X POST "https://api.entityml.com/api/v1/subscriptions/portal" \
    -H "Content-Type: application/json" \
    -d '{"user_id":"YOUR_USER_ID","return_url":"https://entityml.com/dashboard"}'
  ```
</CodeGroup>

### Example response

```json theme={null}
{
  "portal_url": "https://billing.stripe.com/p/session/..."
}
```
