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

# Create portal session

> Create a Stripe customer portal session for subscription management.



## OpenAPI

````yaml openapi.json POST /v1/subscription/portal
openapi: 3.0.3
info:
  title: Quickshops Headless API
  version: 1.0.0
  description: >
    Headless commerce API for Quickshops custom storefronts and @quickshops/sdk.


    ## Versioning


    All routes are prefixed with `/v1`. The current version is also sent as
    `X-API-Version: v1`. Breaking changes ship under `/v2`. `v1` remains
    available during a deprecation window.


    ## Deprecation


    Deprecated operations are marked `deprecated: true`. When a version or
    operation is scheduled for removal, responses include RFC 8594 `Deprecation`
    and `Sunset` headers at least 90 days before removal.


    ## Errors


    4xx and 5xx bodies are JSON `{ "error": string, "code": string }`. `code` is
    machine-readable; `error` is human-readable.


    ## Rate limits


    Authenticated routes are limited per API key. Responses include IETF
    `RateLimit-Limit`, `RateLimit-Remaining`, `RateLimit-Reset`, and combined
    `RateLimit` headers. HTTP 429 also includes `Retry-After`.


    Per-minute limits: global 120; product reads 240; cart writes 60; checkout
    30; billing portal 30.
  contact:
    name: Quickshops
    email: valtteri@quickshops.app
    url: https://quickshops.app/developers
servers:
  - url: https://api.quickshops.app
    description: Production. Paths include the /v1 prefix.
security:
  - BearerAuth: []
paths:
  /v1/subscription/portal:
    post:
      tags:
        - subscription
      summary: Create subscription portal session
      description: >-
        Creates a Stripe billing portal session for a member so they can manage
        a subscription.
      operationId: subscription.createPortalSession
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - memberSessionId
              properties:
                memberSessionId:
                  type: string
          application/x-www-form-urlencoded:
            schema:
              type: object
              required:
                - memberSessionId
              properties:
                memberSessionId:
                  type: string
          multipart/form-data:
            schema:
              type: object
              required:
                - memberSessionId
              properties:
                memberSessionId:
                  type: string
      responses:
        '200':
          description: Response for status 200
          content:
            application/json:
              schema:
                type: object
                required:
                  - data
                properties:
                  data:
                    type: object
                    required:
                      - url
                    properties:
                      url:
                        type: string
          headers:
            RateLimit-Limit:
              schema:
                type: integer
              description: Maximum requests allowed in the current window.
            RateLimit-Remaining:
              schema:
                type: integer
              description: Requests remaining in the current window.
            RateLimit-Reset:
              schema:
                type: integer
              description: Seconds until the current window resets.
            RateLimit:
              schema:
                type: string
              description: >-
                Combined RateLimit header, for example `limit=120,
                remaining=119, reset=60`.
            X-API-Version:
              schema:
                type: string
                enum:
                  - v1
              description: API version that served this response.
        '400':
          description: Response for status 400
          content:
            application/json:
              schema:
                type: object
                required:
                  - error
                  - code
                properties:
                  error:
                    type: string
                    description: Human-readable error message.
                  code:
                    type: string
                    enum:
                      - UNAUTHORIZED
                      - FORBIDDEN
                      - PRO_PLAN_REQUIRED
                      - NOT_FOUND
                      - VALIDATION_ERROR
                      - RATE_LIMITED
                      - CONFLICT
                      - INTERNAL_ERROR
          headers:
            RateLimit-Limit:
              schema:
                type: integer
              description: Maximum requests allowed in the current window.
            RateLimit-Remaining:
              schema:
                type: integer
              description: Requests remaining in the current window.
            RateLimit-Reset:
              schema:
                type: integer
              description: Seconds until the current window resets.
            RateLimit:
              schema:
                type: string
              description: >-
                Combined RateLimit header, for example `limit=120,
                remaining=119, reset=60`.
            X-API-Version:
              schema:
                type: string
                enum:
                  - v1
              description: API version that served this response.
        '401':
          description: Response for status 401
          content:
            application/json:
              schema:
                type: object
                required:
                  - error
                  - code
                properties:
                  error:
                    type: string
                    description: Human-readable error message.
                  code:
                    type: string
                    enum:
                      - UNAUTHORIZED
                      - FORBIDDEN
                      - PRO_PLAN_REQUIRED
                      - NOT_FOUND
                      - VALIDATION_ERROR
                      - RATE_LIMITED
                      - CONFLICT
                      - INTERNAL_ERROR
          headers:
            RateLimit-Limit:
              schema:
                type: integer
              description: Maximum requests allowed in the current window.
            RateLimit-Remaining:
              schema:
                type: integer
              description: Requests remaining in the current window.
            RateLimit-Reset:
              schema:
                type: integer
              description: Seconds until the current window resets.
            RateLimit:
              schema:
                type: string
              description: >-
                Combined RateLimit header, for example `limit=120,
                remaining=119, reset=60`.
            X-API-Version:
              schema:
                type: string
                enum:
                  - v1
              description: API version that served this response.
        '403':
          description: Response for status 403
          content:
            application/json:
              schema:
                type: object
                required:
                  - error
                  - code
                properties:
                  error:
                    type: string
                    description: Human-readable error message.
                  code:
                    type: string
                    enum:
                      - UNAUTHORIZED
                      - FORBIDDEN
                      - PRO_PLAN_REQUIRED
                      - NOT_FOUND
                      - VALIDATION_ERROR
                      - RATE_LIMITED
                      - CONFLICT
                      - INTERNAL_ERROR
          headers:
            RateLimit-Limit:
              schema:
                type: integer
              description: Maximum requests allowed in the current window.
            RateLimit-Remaining:
              schema:
                type: integer
              description: Requests remaining in the current window.
            RateLimit-Reset:
              schema:
                type: integer
              description: Seconds until the current window resets.
            RateLimit:
              schema:
                type: string
              description: >-
                Combined RateLimit header, for example `limit=120,
                remaining=119, reset=60`.
            X-API-Version:
              schema:
                type: string
                enum:
                  - v1
              description: API version that served this response.
        '404':
          description: Resource not found.
          headers:
            RateLimit-Limit:
              schema:
                type: integer
              description: Maximum requests allowed in the current window.
            RateLimit-Remaining:
              schema:
                type: integer
              description: Requests remaining in the current window.
            RateLimit-Reset:
              schema:
                type: integer
              description: Seconds until the current window resets.
            RateLimit:
              schema:
                type: string
              description: >-
                Combined RateLimit header, for example `limit=120,
                remaining=119, reset=60`.
            X-API-Version:
              schema:
                type: string
                enum:
                  - v1
              description: API version that served this response.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiError'
        '409':
          description: Response for status 409
          content:
            application/json:
              schema:
                type: object
                required:
                  - error
                  - code
                properties:
                  error:
                    type: string
                    description: Human-readable error message.
                  code:
                    type: string
                    enum:
                      - UNAUTHORIZED
                      - FORBIDDEN
                      - PRO_PLAN_REQUIRED
                      - NOT_FOUND
                      - VALIDATION_ERROR
                      - RATE_LIMITED
                      - CONFLICT
                      - INTERNAL_ERROR
          headers:
            RateLimit-Limit:
              schema:
                type: integer
              description: Maximum requests allowed in the current window.
            RateLimit-Remaining:
              schema:
                type: integer
              description: Requests remaining in the current window.
            RateLimit-Reset:
              schema:
                type: integer
              description: Seconds until the current window resets.
            RateLimit:
              schema:
                type: string
              description: >-
                Combined RateLimit header, for example `limit=120,
                remaining=119, reset=60`.
            X-API-Version:
              schema:
                type: string
                enum:
                  - v1
              description: API version that served this response.
        '429':
          description: Response for status 429
          content:
            application/json:
              schema:
                type: object
                required:
                  - error
                  - code
                properties:
                  error:
                    type: string
                    description: Human-readable error message.
                  code:
                    type: string
                    enum:
                      - UNAUTHORIZED
                      - FORBIDDEN
                      - PRO_PLAN_REQUIRED
                      - NOT_FOUND
                      - VALIDATION_ERROR
                      - RATE_LIMITED
                      - CONFLICT
                      - INTERNAL_ERROR
          headers:
            RateLimit-Limit:
              schema:
                type: integer
              description: Maximum requests allowed in the current window.
            RateLimit-Remaining:
              schema:
                type: integer
              description: Requests remaining in the current window.
            RateLimit-Reset:
              schema:
                type: integer
              description: Seconds until the current window resets.
            RateLimit:
              schema:
                type: string
              description: >-
                Combined RateLimit header, for example `limit=120,
                remaining=119, reset=60`.
            X-API-Version:
              schema:
                type: string
                enum:
                  - v1
              description: API version that served this response.
            Retry-After:
              schema:
                type: integer
              description: Seconds to wait before retrying.
        '500':
          description: Internal error.
          headers:
            RateLimit-Limit:
              schema:
                type: integer
              description: Maximum requests allowed in the current window.
            RateLimit-Remaining:
              schema:
                type: integer
              description: Requests remaining in the current window.
            RateLimit-Reset:
              schema:
                type: integer
              description: Seconds until the current window resets.
            RateLimit:
              schema:
                type: string
              description: >-
                Combined RateLimit header, for example `limit=120,
                remaining=119, reset=60`.
            X-API-Version:
              schema:
                type: string
                enum:
                  - v1
              description: API version that served this response.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiError'
components:
  schemas:
    ApiError:
      type: object
      required:
        - error
        - code
      properties:
        error:
          type: string
          description: Human-readable error message.
        code:
          type: string
          description: Machine-readable error code.
          enum:
            - UNAUTHORIZED
            - FORBIDDEN
            - PRO_PLAN_REQUIRED
            - NOT_FOUND
            - VALIDATION_ERROR
            - RATE_LIMITED
            - CONFLICT
            - INTERNAL_ERROR
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer
      description: Headless API key (qk_...). Pro plan required.

````