> ## 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.

# Claim Subscription

> Attach a subscription bought through [Create Subscription Session](/api-reference/subscriptions/sessions-create) (anonymous path) to the authenticated account. Needed only when the signed-in email differs from the email typed into Stripe Checkout; when they match, the webhook already linked the subscription and this call is a no-op that returns 200.



## OpenAPI

````yaml api-reference/openapi/accounts.json POST /api/subscriptions/claim
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/claim:
    post:
      description: >-
        Attach a subscription bought through [Create Subscription
        Session](/api-reference/subscriptions/sessions-create) (anonymous path)
        to the authenticated account. Needed only when the signed-in email
        differs from the email typed into Stripe Checkout; when they match, the
        webhook already linked the subscription and this call is a no-op that
        returns 200.
      requestBody:
        description: The Checkout session to claim
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ClaimSubscriptionRequest'
      responses:
        '200':
          description: Subscription attached to the authenticated account (or already was)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ClaimSubscriptionResponse'
        '400':
          description: >-
            Bad request - missing `session_id`, or the session has no
            subscription
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ClaimSubscriptionErrorResponse'
        '401':
          description: Unauthorized - invalid or missing authentication
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ClaimSubscriptionErrorResponse'
        '404':
          description: Unknown Checkout session
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ClaimSubscriptionErrorResponse'
              example:
                status: error
                error: session_not_found
        '409':
          description: The subscription belongs to another account that has signed in
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ClaimSubscriptionErrorResponse'
              example:
                status: error
                error: already_claimed
        '500':
          description: Internal server error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ClaimSubscriptionErrorResponse'
      security:
        - apiKeyAuth: []
        - bearerAuth: []
components:
  schemas:
    ClaimSubscriptionRequest:
      type: object
      required:
        - session_id
      properties:
        session_id:
          type: string
          description: >-
            The Stripe Checkout session id from the `session_id` query parameter
            on the success URL.
          example: cs_live_a1b2c3d4e5f6g7h8i9j0
    ClaimSubscriptionResponse:
      type: object
      required:
        - status
        - subscription_id
        - plan
      properties:
        status:
          type: string
          enum:
            - success
        subscription_id:
          type: string
          description: The Stripe subscription now attached to the authenticated account.
          example: sub_1Rz0abc123
        plan:
          type: string
          enum:
            - starter
            - pro
          description: The plan the subscription is on, resolved from its Stripe price.
          example: pro
    ClaimSubscriptionErrorResponse:
      type: object
      required:
        - status
        - error
      properties:
        status:
          type: string
          enum:
            - error
        error:
          type: string
          description: >-
            Machine-readable code (`session_not_found`, `already_claimed`,
            `no_subscription`) or a validation message.
          example: already_claimed
  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

````