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

# Get the variance report of a replenishment

> Compares, per declared lot, the quantity you announced with the quantity the warehouse actually
received. Available only for replenishments that declared expected quantities per lot, either
through `products[].lots` on creation or derived from an attached NF-e (see attach-invoice).

- By default the replenishment must be `COMPLETED`. Send `ignore_not_completed=true` to read a
  partial report while receiving is still in progress.
- `variance` is `received_quantity - expected_quantity`: negative means units are missing,
  positive means more units than announced were received.
- A declared lot that was never matched to a received lot is reported with `lot_id: null`,
  `received_quantity: 0` and a variance equal to minus its expected quantity.




## OpenAPI

````yaml /openapi.yaml get /replenishments/{replenishment_id}/variance-report
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}/variance-report:
    get:
      tags:
        - Replenishments
      summary: Get the variance report of a replenishment
      description: >
        Compares, per declared lot, the quantity you announced with the quantity
        the warehouse actually

        received. Available only for replenishments that declared expected
        quantities per lot, either

        through `products[].lots` on creation or derived from an attached NF-e
        (see attach-invoice).


        - By default the replenishment must be `COMPLETED`. Send
        `ignore_not_completed=true` to read a
          partial report while receiving is still in progress.
        - `variance` is `received_quantity - expected_quantity`: negative means
        units are missing,
          positive means more units than announced were received.
        - A declared lot that was never matched to a received lot is reported
        with `lot_id: null`,
          `received_quantity: 0` and a variance equal to minus its expected quantity.
      operationId: getReplenishmentVarianceReport
      parameters:
        - name: replenishment_id
          in: path
          required: true
          description: Cubbo id of the replenishment.
          schema:
            type: integer
          example: 55001
        - name: ignore_not_completed
          in: query
          required: false
          description: >-
            When `true`, returns the report even if the replenishment is not
            `COMPLETED` yet.
          schema:
            type: boolean
            default: false
          example: false
      responses:
        '200':
          description: One row per declared lot
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ReplenishmentVarianceReport'
              example:
                - product_id: 9002
                  expected_quantity: 24
                  box_sku: SKU-BOX-BLUE
                  received_quantity: 24
                  lot_id: 4101
                  variance: 0
                - product_id: 9002
                  expected_quantity: 24
                  box_sku: SKU-BOX-BLUE
                  received_quantity: 20
                  lot_id: 4102
                  variance: -4
                - product_id: 9004
                  expected_quantity: 10
                  box_sku: SKU-BOX-RED
                  received_quantity: 0
                  lot_id: null
                  variance: -10
        '401':
          $ref: '#/components/responses/Unauthorized'
        '422':
          description: Validation or business error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              examples:
                notFound:
                  value:
                    error: Couldn't find Replenishment with 'id'=55001
                notCompleted:
                  value:
                    error: replenishment 55001 is not in COMPLETED
                notCompatible:
                  value:
                    error: >-
                      this replenishment is not compatible with variance report,
                      no expected_replenishment_product_quantities were found
        '500':
          $ref: '#/components/responses/InternalServerError'
      security:
        - bearerAuth: []
components:
  schemas:
    ReplenishmentVarianceReport:
      type: array
      description: One row per declared lot.
      items:
        $ref: '#/components/schemas/ReplenishmentVarianceReportRow'
    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
    ReplenishmentVarianceReportRow:
      type: object
      description: Expected versus received quantity for one declared lot.
      properties:
        product_id:
          type: integer
          description: Cubbo product id.
          example: 9002
        expected_quantity:
          type: integer
          description: Units announced for this lot.
          example: 24
        box_sku:
          type: string
          description: SKU the lot was declared under.
          example: SKU-BOX-BLUE
        received_quantity:
          type: integer
          description: Units received for the lot; `0` when the lot was never matched.
          example: 20
        lot_id:
          type:
            - integer
            - 'null'
          description: >-
            Id of the received lot in Cubbo; `null` when no received lot matched
            the declaration.
          example: 4102
        variance:
          type: integer
          description: '`received_quantity - expected_quantity`.'
          example: -4
  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.