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

# Swap Subscription Product

> Swap one of the customer's current subscription items to a new product. The current item should come from GET /zaymo/customer-portal/subscription -> items[].id, and the new product should come from GET /zaymo/upsells/products. An optional discount code may be applied during the swap.



## OpenAPI

````yaml /openapi.json post /zaymo/customer-portal/swap-product
openapi: 3.0.1
info:
  title: Zaymo Custom Integration API
  description: >-
    API for managing product upsells, customer interactions, and custom actions
    in email campaigns
  license:
    name: MIT
  version: 1.0.0
servers:
  - url: https://api.your-domain.com/example/
security:
  - apiKeyAuth: []
tags:
  - name: Upsells
    description: Endpoints for managing product upsells in emails
  - name: Customer Portal
    description: Endpoints for customer subscription management portal
  - name: Swap Up
    description: Endpoints for swapping a customer's current subscription product
  - name: Reactivate
    description: Endpoints for reactivating cancelled subscriptions
  - name: Custom Actions
    description: Endpoints for executing custom actions from email buttons
  - name: Discounts
    description: Endpoints for retrieving discount information
paths:
  /zaymo/customer-portal/swap-product:
    post:
      tags:
        - Swap Up
      summary: Swap Subscription Product
      description: >-
        Swap one of the customer's current subscription items to a new product.
        The current item should come from GET
        /zaymo/customer-portal/subscription -> items[].id, and the new product
        should come from GET /zaymo/upsells/products. An optional discount code
        may be applied during the swap.
      requestBody:
        description: >-
          Customer information and swap details for changing a current
          subscription item to a new product
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/SwapProductRequest'
        required: true
      responses:
        '200':
          description: Subscription item successfully swapped
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SuccessResponse'
        '400':
          description: Invalid request or swap cannot be performed
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '401':
          description: Authentication error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '404':
          description: Customer, current subscription item, or new product not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
components:
  schemas:
    SwapProductRequest:
      type: object
      required:
        - email
        - current_item_id
        - new_product_id
      properties:
        email:
          type: string
          format: email
          description: The email address of the customer
        current_item_id:
          type: string
          description: >-
            The unique identifier of the customer's current subscription item,
            from GET /zaymo/customer-portal/subscription -> items[].id
        new_product_id:
          type: string
          description: >-
            The unique identifier for the product to swap to, from GET
            /zaymo/upsells/products
        discount_code:
          type: string
          description: >-
            Optional discount code to apply to the swapped product or
            subscription
    SuccessResponse:
      type: object
      required:
        - success
      properties:
        success:
          type: boolean
          example: true
          description: Indicates if the request was successful
    Error:
      type: object
      required:
        - success
        - error
      properties:
        success:
          type: boolean
          example: false
        error:
          type: object
          required:
            - code
            - message
          properties:
            code:
              type: string
              description: Error code identifier
            message:
              type: string
              description: Human-readable error message
  securitySchemes:
    apiKeyAuth:
      type: apiKey
      in: header
      name: X-Zaymo-API-Key
      description: Zaymo will authenticate requests using the API key you provide

````