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

# Create Subscription Portal

> Create a subscription management session for the authenticated account. Returns a hosted URL where the customer can update payment method, view invoices, or cancel. The client should redirect the user to that URL.



## OpenAPI

````yaml api-reference/openapi/accounts.json POST /api/subscriptions/portal
openapi: 3.1.0
info:
  title: Recoup API - Accounts
  description: >-
    API documentation for the Recoup platform - an AI agent platform for the
    music industry
  license:
    name: MIT
  version: 1.0.0
servers:
  - url: https://api.recoupable.dev
security: []
paths:
  /api/subscriptions/portal:
    post:
      description: >-
        Create a subscription management session for the authenticated account.
        Returns a hosted URL where the customer can update payment method, view
        invoices, or cancel. The client should redirect the user to that URL.
      requestBody:
        description: Portal session parameters
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateSubscriptionPortalRequest'
      responses:
        '200':
          description: Portal session created successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CreateSubscriptionPortalResponse'
        '400':
          description: Bad request - missing or invalid parameters
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SubscriptionPortalErrorResponse'
        '401':
          description: Unauthorized - invalid or missing authentication
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SubscriptionPortalErrorResponse'
      security:
        - apiKeyAuth: []
        - bearerAuth: []
components:
  schemas:
    CreateSubscriptionPortalRequest:
      type: object
      required:
        - returnUrl
      description: >-
        Request body for creating a billing portal session. The account is
        determined from authentication (API key or session), not from this
        payload.
      properties:
        returnUrl:
          type: string
          format: uri
          description: The URL to redirect to when the customer leaves the portal.
          example: https://chat.recoupable.com/settings/billing
    CreateSubscriptionPortalResponse:
      type: object
      required:
        - id
        - url
      properties:
        id:
          type: string
          description: The portal session ID.
          example: portal_sess_a1b2c3d4
        url:
          type: string
          format: uri
          description: >-
            The hosted portal URL. Redirect to this URL so the customer can
            manage their subscription.
          example: https://billing.example.com/manage/portal_sess_a1b2c3d4
    SubscriptionPortalErrorResponse:
      type: object
      required:
        - error
      properties:
        error:
          type: string
          description: Human-readable error message.
          example: returnUrl is required
  securitySchemes:
    apiKeyAuth:
      type: apiKey
      in: header
      name: x-api-key
      description: Your Recoup API key. [Learn more](/quickstart#api-keys).
    bearerAuth:
      type: http
      scheme: bearer

````