---
title: "Replace subscription cart"
method: POST
path: "/api/public/v1/subscriptions/{id}/replace"
tags: ["Subscriptions"]
---

# Replace subscription cart

`POST /api/public/v1/subscriptions/{id}/replace`

## Request

- Base URL: `http://localhost:3009`
- URL: `http://localhost:3009/api/public/v1/subscriptions/{id}/replace`
- Auth: HTTP basic

Replaces the subscription's current cart with a new one built from the submitted customer data and, when supplied, a new set of cart items. The outgoing cart and its link are voided. No SMS is sent: call POST /api/public/v1/subscriptions/{id}/send_sms afterwards to hand the new link to the shopper.

## Path parameters

- `id` string, required

## Headers

- `Authorization` string, required

## Request body

- object
  - `reference` string: Merchant reference for the new cart. Merchants whose references are auto-generated keep the outgoing cart's reference and this field is ignored.
  - `mobile_phone` string, required
  - `operator_ref` string: Email of the operator the replacement is attributed to, as POST /api/public/v1/subscriptions takes it.
  - `given_names` string
  - `surnames` string: Customer's combined surnames. Use first_surname + second_surname instead for Mexican merchants.
  - `first_surname` string
  - `second_surname` string
  - `date_of_birth` string
  - `nin` string
  - `nin_control` string
  - `address` string
  - `postal_code` string
  - `city` string
  - `colony` string
  - `email` string
  - `joint_customer` string
  - `cart_items` union[]: Omit to keep the outgoing cart's items and the subscription's discounts. When supplied, both are rebuilt from this payload.
    - union
      - PublicCreateSubscriptionMaterial
        - `reference` string
        - `reference_uuid` string, nullable
        - `type` string, required
        - `name` string, required
        - `quantity` integer, required
        - `price_with_tax` integer, required
        - `subscription_price` integer
        - `subscription_vat_rate` integer
        - `box_count` integer
        - `product_data` object, nullable
        - `consumable_data` object, nullable: Deprecated: ignored.
          - `delivery_periodicity` string
          - `quantity_per_delivery` integer
        - `product_type` 'rx' | 'contact_lenses' | 'sunglasses' | 'complement' | 'others': Classifies the subscribed product.
      - PublicCreateSubscriptionPackage
        - `name` string
        - `type` string, required
        - `quantity` integer, required
        - `price_with_tax` integer, required
        - `subscription_price` integer
        - `subscription_vat_rate` integer
        - `product_data` unknown
        - `consumable_data` object, nullable: Deprecated: ignored.
          - `delivery_periodicity` string
          - `quantity_per_delivery` integer
        - `items` PublicCreateSubscriptionMaterial[]
          - `reference` string
          - `reference_uuid` string, nullable
          - `type` string, required
          - `name` string, required
          - `quantity` integer, required
          - `price_with_tax` integer, required
          - `subscription_price` integer
          - `subscription_vat_rate` integer
          - `box_count` integer
          - `product_data` object, nullable
          - `consumable_data` object, nullable: Deprecated: ignored.
            - `delivery_periodicity` string
            - `quantity_per_delivery` integer
          - `product_type` 'rx' | 'contact_lenses' | 'sunglasses' | 'complement' | 'others': Classifies the subscribed product.

## Response `200`

cart replaced - the subscription resource, as POST /api/public/v1/subscriptions returns it

## Other responses

- `401`: the credentials are missing or wrong
- `404`: no subscription with that id is reachable with these credentials
- `409`: the cart can no longer be replaced
- `422`: the body is refused - here a customer block missing a required field

---

[API](https://skmtc.dev/sequra/apis/instore-api.md) - [All operations](https://skmtc.dev/sequra/apis/instore-api/llms.txt) - [OpenAPI document](https://skmtc.dev/sequra/apis/instore-api/revisions/29430b803abc?raw)
