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

# Update a replenishment

> Updates the notes and the announced lines of a replenishment that has not started receiving.

- Allowed only while the status is `WITHOUT_SCHEDULING`, `PENDING` or `REQUESTED`. Once the
  shipment is in transit or at the warehouse the update is refused.
- Not available for sell-ahead replenishments, nor for replenishments bound to a Brazilian
  warehouse (code `br_warehouse_not_supported`): on the Brazilian path the declared values become
  the NF-e of entry and must not change afterwards.
- `products` is a partial update: each listed SKU either replaces the quantity (and, when sent,
  the `unit_value`) of its existing line, or is added as a new line. Lines you do not list are
  left untouched; lines cannot be removed through this endpoint. Omitting `unit_value` keeps the
  stored value.
- If the replenishment has a booked receiving appointment at a warehouse with native scheduling
  and the new quantities need more dock capacity than reserved, Cubbo tries to extend the booked
  time slots; when they cannot fit, the update is refused with code `reschedule_required` and
  nothing is changed. Reschedule the appointment first, then retry.
- Errors raised by business rules use the `{error, code, context}` envelope (`code` may be an
  empty string and `context` null); parameter errors use the plain `{error}` envelope.




## OpenAPI

````yaml /openapi.yaml patch /replenishments/{replenishment_id}
openapi: 3.1.0
info:
  title: Cubbo Clients API
  version: '1.0'
  summary: >-
    Orders, inventory, replenishments, returns, shipping and webhooks for Cubbo
    fulfillment.
  description: >
    The Cubbo Clients API connects your store, ERP or marketplace with Cubbo's
    fulfillment network.

    All endpoints except `POST /auth/token` require a bearer token; see the
    Authentication guide.

    Request and response bodies are JSON. Errors are JSON objects with an
    `error` key.
  contact:
    name: Cubbo integrations
    email: integraciones@cubbo.com
servers:
  - url: https://api.cubbo.com/v1
    description: Production
security:
  - bearerAuth: []
tags:
  - name: Authentication
    description: Exchange client credentials for a bearer token.
  - name: Orders
    description: Create, update, hold, cancel and read sales orders.
  - name: Shipping labels
    description: Read the shipping labels generated for an order.
  - name: Inventory
    description: Products and stock per store.
  - name: Lots
    description: Lot-level inventory for products with expiration or batch tracking.
  - name: Reports
    description: Bulk reports for reconciliation.
  - name: Replenishments
    description: Inbound shipments to the warehouse.
  - name: Returns
    description: Returns and exchanges.
  - name: Stores
    description: Store provisioning and settings.
  - name: Shipping methods
    description: Available shipping methods, coverage and quotes.
  - name: Click and collect
    description: Pickup points and in-store pickup orders.
paths:
  /replenishments/{replenishment_id}:
    patch:
      tags:
        - Replenishments
      summary: Update a replenishment
      description: >
        Updates the notes and the announced lines of a replenishment that has
        not started receiving.


        - Allowed only while the status is `WITHOUT_SCHEDULING`, `PENDING` or
        `REQUESTED`. Once the
          shipment is in transit or at the warehouse the update is refused.
        - Not available for sell-ahead replenishments, nor for replenishments
        bound to a Brazilian
          warehouse (code `br_warehouse_not_supported`): on the Brazilian path the declared values become
          the NF-e of entry and must not change afterwards.
        - `products` is a partial update: each listed SKU either replaces the
        quantity (and, when sent,
          the `unit_value`) of its existing line, or is added as a new line. Lines you do not list are
          left untouched; lines cannot be removed through this endpoint. Omitting `unit_value` keeps the
          stored value.
        - If the replenishment has a booked receiving appointment at a warehouse
        with native scheduling
          and the new quantities need more dock capacity than reserved, Cubbo tries to extend the booked
          time slots; when they cannot fit, the update is refused with code `reschedule_required` and
          nothing is changed. Reschedule the appointment first, then retry.
        - Errors raised by business rules use the `{error, code, context}`
        envelope (`code` may be an
          empty string and `context` null); parameter errors use the plain `{error}` envelope.
      operationId: updateReplenishment
      parameters:
        - name: replenishment_id
          in: path
          required: true
          description: Cubbo id of the replenishment.
          schema:
            type: integer
          example: 55001
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ReplenishmentUpdateRequest'
            example:
              notes: Arrives on two pallets
              products:
                - sku: SKU-RED-M
                  quantity: 120
                  unit_value: '12.50'
                - sku: SKU-GREEN-L
                  quantity: 30
      responses:
        '200':
          description: Replenishment updated
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ReplenishmentSummary'
              example:
                id: 55001
                status: REQUESTED
                store_id: 1234
                notes: Arrives on two pallets
                created_at: '2026-10-12T14:03:11.512Z'
                expected_arrived_at: '2026-11-02T15:00:00.000Z'
                sell_ahead: false
                declared_value: null
                warehouse_id: 7
                replenishment_products:
                  - product_id: 9001
                    expected_quantity: 120
                    unit_value: '12.5'
                    product:
                      id: 9001
                      name: Red T-shirt M
                      bar_code: '7501234567890'
                      is_scannable: true
                      product_codes:
                        - id: 31001
                          sku: SKU-RED-M
                  - product_id: 9003
                    expected_quantity: 30
                    unit_value: null
                    product:
                      id: 9003
                      name: Green T-shirt L
                      bar_code: '7501234567892'
                      is_scannable: true
                      product_codes:
                        - id: 31003
                          sku: SKU-GREEN-L
                warehouse:
                  id: 7
                  name: Mexico City
                  unique_code: MX-CDMX-1
                  address1: Av. Ejemplo 123
                  address2: null
                  zip_code: '01000'
                  city: Ciudad de México
                  state: CDMX
                  country: MX
        '401':
          $ref: '#/components/responses/Unauthorized'
        '422':
          description: Validation or business error
          content:
            application/json:
              schema:
                oneOf:
                  - $ref: '#/components/schemas/Error'
                  - $ref: '#/components/schemas/ReplenishmentUpdateError'
              examples:
                missingParam:
                  value:
                    error: Parameter quantity is required
                notFound:
                  value:
                    error: Couldn't find Replenishment with 'id'=55001
                brazilNotSupported:
                  value:
                    error: >-
                      Replenishment updates via API are not available for
                      Brazilian warehouses
                    code: br_warehouse_not_supported
                    context: null
                alreadyProcessing:
                  value:
                    error: >-
                      replenishment 55001 has started processing and cannot be
                      updated. Current status: PROCESSING
                    code: ''
                    context: null
                sellAhead:
                  value:
                    error: replenishment 55001 is sell_ahead and cannot be updated
                    code: ''
                    context: null
                skusNotUnique:
                  value:
                    error: provided skus are not unique
                    code: ''
                    context: null
                skuNotFound:
                  value:
                    error: SKU 'SKU-UNKNOWN-1' doesn't exist in Cubbo
                    code: ''
                    context: null
                skusOfSameProduct:
                  value:
                    error: >-
                      skus of same product were provided, make sure skus belong
                      to different products. Skus of same product: [SKU-RED-M,
                      SKU-RED-M-ALT]
                    code: ''
                    context: null
                unitValueFormat:
                  value:
                    error: >-
                      unit_value for SKU-RED-M must be a plain decimal number
                      with at most 2 decimal places, such as 12.50
                    code: UNIT_VALUE_INVALID_FORMAT
                    context: null
                unitValueOutOfRange:
                  value:
                    error: >-
                      unit_value for SKU-RED-M is out of range (must be below
                      100000000000000)
                    code: UNIT_VALUE_OUT_OF_RANGE
                    context: null
                unitValueNotPositive:
                  value:
                    error: unit_value for SKU-RED-M must be greater than 0
                    code: UNIT_VALUE_NOT_POSITIVE
                    context: null
                rescheduleRequired:
                  value:
                    error: >-
                      updated quantities need 12 units but only 8 fit the booked
                      franjas — reschedule the appointment
                    code: reschedule_required
                    context:
                      replenishment_id: 55001
                      inbound_appointment_id: 777
                appointmentChanged:
                  value:
                    error: appointment 777 changed concurrently — retry the update
                    code: reschedule_required
                    context:
                      replenishment_id: 55001
                      inbound_appointment_id: 777
        '500':
          $ref: '#/components/responses/InternalServerError'
      security:
        - bearerAuth: []
components:
  schemas:
    ReplenishmentUpdateRequest:
      type: object
      properties:
        notes:
          type: string
          description: New notes. Omitted or empty keeps the current notes.
          example: Arrives on two pallets
        products:
          type: array
          description: Lines to change or add. Lines not listed are left untouched.
          items:
            $ref: '#/components/schemas/ReplenishmentUpdateProduct'
    ReplenishmentSummary:
      type: object
      description: Replenishment as returned by create and update.
      properties:
        id:
          type: integer
          description: >-
            Replenishment id; use it as `replenishment_id` on the other
            endpoints.
          example: 55001
        status:
          $ref: '#/components/schemas/ReplenishmentStatus'
        store_id:
          type: integer
          description: Store the replenishment belongs to.
          example: 1234
        notes:
          type:
            - string
            - 'null'
          description: Free-text notes for the warehouse.
          example: Pallet 2 contains fragile items
        created_at:
          type: string
          format: date-time
          description: Creation time.
          example: '2026-10-12T14:03:11.512Z'
        expected_arrived_at:
          type:
            - string
            - 'null'
          format: date-time
          description: Expected arrival date declared on creation.
          example: '2026-11-02T15:00:00.000Z'
        sell_ahead:
          type:
            - boolean
            - 'null'
          description: Whether the announced units were made sellable before arrival.
          example: false
        declared_value:
          type:
            - string
            - 'null'
          description: >-
            Declared total value of the shipment, as a decimal string; not
            settable through this API, so usually `null`.
          example: null
        warehouse_id:
          type: integer
          description: Destination warehouse id.
          example: 7
        replenishment_products:
          type: array
          description: Announced lines.
          items:
            $ref: '#/components/schemas/ReplenishmentProduct'
        warehouse:
          $ref: '#/components/schemas/ReplenishmentWarehouse'
    Error:
      type: object
      description: Error body returned by every failed request.
      required:
        - error
      properties:
        error:
          type: string
          description: >-
            Human-readable description of the failure. For `401` responses it is
            always `Unauthorized`.
          example: Parameter store_id is required
        message:
          type: string
          description: >-
            Present on `401` responses only; the reason the request was
            rejected.
          example: invalid token
        code:
          type:
            - string
            - 'null'
          description: >-
            Stable machine-readable code, present on some order, return and
            replenishment errors.
          example: ORDER_ALREADY_EXISTS
        context:
          type:
            - object
            - 'null'
          description: >-
            Extra data about the failure when available, for example the id of
            the conflicting order.
          additionalProperties: true
          example:
            order_id: 987654
    ReplenishmentUpdateError:
      type: object
      description: Business error envelope of the update endpoint.
      properties:
        error:
          type: string
          description: Human-readable message.
          example: replenishment 55001 is sell_ahead and cannot be updated
        code:
          type: string
          description: >-
            Machine-readable code, or an empty string when the error has none.
            Known codes include `br_warehouse_not_supported`,
            `reschedule_required`, `UNIT_VALUE_INVALID_FORMAT`,
            `UNIT_VALUE_OUT_OF_RANGE`, `UNIT_VALUE_NOT_POSITIVE`.
          example: ''
        context:
          type:
            - object
            - 'null'
          description: >-
            Extra data for the code (for `reschedule_required`,
            `replenishment_id` and `inbound_appointment_id`).
          example: null
    ReplenishmentUpdateProduct:
      type: object
      description: A line to set on the replenishment.
      required:
        - sku
        - quantity
      properties:
        sku:
          type: string
          description: SKU of an existing line to change, or of a new line to add.
          example: SKU-RED-M
        quantity:
          type: integer
          description: New announced quantity for the line.
          example: 120
        unit_value:
          type:
            - number
            - string
          description: >-
            Optional declared unit cost (same rules as on create). Omit to keep
            the stored value.
          example: '12.50'
    ReplenishmentStatus:
      type: string
      description: >
        Lifecycle status of a replenishment.

        - `WITHOUT_SCHEDULING`: created at a warehouse that books receiving
        appointments natively, but no appointment has been scheduled yet.

        - `PENDING`: registered but not yet requested to the warehouse
        (pre-arrival).

        - `REQUESTED`: announced to the warehouse and awaiting arrival; the
        initial status at warehouses without native appointment scheduling, and
        the status after an appointment is booked.

        - `IN_TRANSIT`: the shipment is on its way to the warehouse.

        - `RECEIVED`: the shipment was recorded at the dock; counting has not
        started.

        - `PROCESSING`: the warehouse is receiving and counting the units (stock
        has arrived).

        - `IN_PUTAWAY`: received units are being placed in storage locations.

        - `COMPLETED`: receiving and putaway finished; `completed_at` is set.

        - `CANCELED`: the replenishment was canceled; it no longer counts for
        external-reference uniqueness.
      enum:
        - WITHOUT_SCHEDULING
        - PENDING
        - REQUESTED
        - IN_TRANSIT
        - RECEIVED
        - PROCESSING
        - IN_PUTAWAY
        - COMPLETED
        - CANCELED
      example: REQUESTED
    ReplenishmentProduct:
      type: object
      description: One announced line of a replenishment.
      properties:
        product_id:
          type: integer
          description: Cubbo product id of the line.
          example: 9001
        expected_quantity:
          type: integer
          description: Number of units announced for this product.
          example: 100
        unit_value:
          type:
            - string
            - 'null'
          description: >-
            Declared unit cost in the store currency, as a decimal string;
            `null` when not declared.
          example: '12.5'
        product:
          $ref: '#/components/schemas/ReplenishmentLineProduct'
    ReplenishmentWarehouse:
      type: object
      description: Destination warehouse of the replenishment.
      properties:
        id:
          type: integer
          description: Warehouse id.
          example: 7
        name:
          type: string
          description: Warehouse name.
          example: Mexico City
        unique_code:
          type:
            - string
            - 'null'
          description: Warehouse code.
          example: MX-CDMX-1
        address1:
          type:
            - string
            - 'null'
          description: Street address.
          example: Av. Ejemplo 123
        address2:
          type:
            - string
            - 'null'
          description: Address complement.
          example: null
        zip_code:
          type:
            - string
            - 'null'
          description: Postal code.
          example: '01000'
        city:
          type:
            - string
            - 'null'
          description: City.
          example: Ciudad de México
        state:
          type:
            - string
            - 'null'
          description: State or province.
          example: CDMX
        country:
          type:
            - string
            - 'null'
          description: Country code (`MX`, `BR`, `CO`, ...).
          example: MX
    ReplenishmentLineProduct:
      type: object
      description: Catalog product referenced by a replenishment line.
      properties:
        id:
          type: integer
          description: Cubbo product id.
          example: 9001
        name:
          type: string
          description: Product name.
          example: Red T-shirt M
        bar_code:
          type:
            - string
            - 'null'
          description: Barcode (UPC/EAN) of the product.
          example: '7501234567890'
        is_scannable:
          type: boolean
          description: >-
            Whether units of this product are identified by scanning at the
            warehouse.
          example: true
        product_codes:
          type: array
          description: SKUs registered for the product.
          items:
            type: object
            properties:
              id:
                type: integer
                description: Id of the SKU record.
                example: 31001
              sku:
                type: string
                description: SKU.
                example: SKU-RED-M
  responses:
    Unauthorized:
      description: >-
        Missing or invalid token, wrong credentials, or no access to the
        requested store.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          examples:
            invalidToken:
              value:
                error: Unauthorized
                message: invalid token
            noHeader:
              value:
                error: Unauthorized
                message: no authorization header found
            storeNotAllowed:
              value:
                error: Unauthorized
                message: not allowed to show? this Store
    InternalServerError:
      description: >-
        Unexpected error. Retry with backoff; if it persists, send the timestamp
        to Cubbo support.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            error: 'unexpected error, timestamp: 1760000000'
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT
      description: >-
        Token returned by `POST /auth/token`, sent as `Authorization: Bearer
        <token>`.

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.