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

# List packages

> Retrieve all packages for an organization in ascending order by when the package was most recently updated. 50 packages will be returned at a time and may be paginated using the `startingAfterUpdatedAt` and `startingAfterId` query parameters.

This endpoint will return packages in ascending order by when they were most recently updated. A package update is when a property on a package changes such as its `status` or when an inventory transaction has occurred so that this package has a new inventory amount.

The reason we use ascending order is so that if a package is updated while you are querying this data, you will not miss that package and it will just be present in a later page.

## Pagination

In order to correctly paginate this endpoint, you should store the `updatedAt` and `id` property of the last package in the `data` array. Then, submit those values as `startingAfterUpdatedAt` and `startingAfterId` in order to get the next page of data.

The reason we use two pagination properties is because it is possible for two packages to have the exact same `updatedAt` value. Therefore, we paginate via `updatedAt ASC` first and then subsequently `id ASC`.

One note with `updatedAt` is that our API will return this value as a timestamp string to microsecond precision. We recommend storing this value as a string in case the environment you are in (such as Javascript) only supports millisecond precision and would truncate the date. If you store it as a string and then submit that same string as the query parameter, you will not have any issues.

## Voided packages

Packaged may be voided from time to time by the organization. When that happens, it will have its status set to `finished` and its `label` will be changed to have a unique value such as `void-STAGING01234567200000039-3154adaf`. Then, the package label (ex: `STAGING01234567200000039`) may show up again attached to a new package entity.

This may happen when an organization accidentally receives a package to the wrong product. Then, you may find a package that has been voided as well as a new package with the same original label that is now attributed to a different product.


## OpenAPI

````yaml GET /api/v1/packages
openapi: 3.0.1
info:
  title: Meadow Open API
  description: The API to connect to the Meadow platform
  version: 1.0.0
servers:
  - url: https://api-staging.getmeadow.com
  - url: https://api.getmeadow.com
security:
  - meadowConsumer: []
    meadowClient: []
paths:
  /api/v1/packages:
    get:
      description: >-
        Retrieve all packages for an organization in ascending order by when the
        package was most recently updated. 50 packages will be returned at a
        time and may be paginated using the `startingAfterUpdatedAt` and
        `startingAfterId` query parameters.
      parameters:
        - name: startingAfterUpdatedAt
          in: query
          description: >-
            The `updatedAt` for a package that you want to retrieve all packages
            that have been updated more recently than this value. Pass in the
            last `updatedAt` in a response to retrieve the next page. Please
            take careful consideration to pass the exact string that we return
            to you. Our dates have microsecond precision, so if you convert it
            to a Javascript date for example you will lose that precision and
            could cause duplicate responses.
          required: false
          schema:
            type: string
        - name: startingAfterId
          in: query
          description: >-
            When requesting subsequent pages, pair this parameter with
            `startingAfterUpdatedAt`. Pass in the `id` of the last package of a
            previous page. This will ensure proper pagination if two packages
            have the exact same `updatedAt`.
          required: false
          schema:
            type: integer
            format: int64
      responses:
        '200':
          description: List packages response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Package'
              example:
                data:
                  - id: 150
                    organizationId: 1
                    type: metrc
                    externalId: null
                    externalProductName: OG Kush - Eighth
                    label: STAGING01234567200000001
                    status: received
                    initialAmount: '150'
                    unit: Each
                    createdAt: '2023-01-10T21:35:10.732Z'
                    updatedAt: '2023-05-05 10:17:56.561-07'
                    receivedAt: '2023-05-05T17:17:56.561Z'
                    finishedAt: null
                    multiplier: '1'
                    expirationDate: '2024-03-07'
                    transferredAt: null
                    transferReturnedAt: null
                    shippedAt: null
                    costPerUnit: '24.9567'
                    voidReason: null
                    thcPercent: '24.5'
                    thcMg: null
                    cbdPercent: '2.7'
                    cbdMg: null
                    producerName: null
                    producerLicense: null
                    harvestDate: null
                    harvestFacilityName: null
                    harvestFacilityLicense: null
                    labName: null
                    labLicense: null
                    labDate: null
                    onHold: false
                    tradeSample: false
                    originalSourceLabel: null
                    productOptionId: 1250
                    locationInventory:
                      - inventoryLocationId: 3
                        amount: '74'
                      - inventoryLocationId: 4
                        amount: '0.0'
                      - inventoryLocationId: 41
                        amount: '3'
                    product:
                      id: 798
                      name: OG Kush
                      unit: item
                      strainType: hybrid-indica
                      isActive: true
                      isFeatured: false
                      inventoryType: option
                      movingAverageCostPerUnit: null
                      brandName: Meadow Farms
                      primaryCategory:
                        id: 8
                        name: Flower
                        cannabisType: non-concentrated
                      options:
                        - id: 1250
                          name: ''
                          amount: 1
                          price: 2400
                          salesPrice: null
                          content: 3.5
                          movingAverageCostPerUnit: 0
                  - id: 116
                    organizationId: 1
                    type: metrc
                    externalId: null
                    externalProductName: Fire OG
                    label: STAGING01234567100000006
                    status: received
                    initialAmount: '345.7'
                    unit: Grams
                    createdAt: '2023-01-10T21:34:00.851Z'
                    updatedAt: '2023-07-23 12:47:56.131-07'
                    receivedAt: '2023-07-23T19:47:56.131Z'
                    finishedAt: null
                    multiplier: '3.457'
                    expirationDate: '2024-02-13'
                    transferredAt: null
                    transferReturnedAt: null
                    shippedAt: null
                    costPerUnit: '15.00'
                    voidReason: null
                    thcPercent: null
                    thcMg: null
                    cbdPercent: null
                    cbdMg: null
                    producerName: null
                    producerLicense: null
                    harvestDate: null
                    harvestFacilityName: null
                    harvestFacilityLicense: null
                    itemStrain: null
                    labName: null
                    labLicense: null
                    labDate: null
                    onHold: false
                    tradeSample: false
                    originalSourceLabel: null
                    productOptionId: 10369
                    locationInventory:
                      - inventoryLocationId: 3
                        amount: '90'
                      - inventoryLocationId: 41
                        amount: '9'
                    product:
                      id: 9747
                      name: Fire OG Pre-Pack
                      unit: gram
                      strainType: indica
                      isActive: true
                      isFeatured: true
                      inventoryType: option
                      movingAverageCostPerUnit: null
                      brandName: Meadow Farms
                      primaryCategory:
                        id: 8
                        name: Flower
                        cannabisType: non-concentrated
                      options:
                        - id: 10369
                          name: Eighth
                          amount: 3.5
                          price: 3300
                          salesPrice: null
                          content: 3.5
                          movingAverageCostPerUnit: 15
        4XX:
          description: Unexpected error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/APIError'
components:
  schemas:
    Package:
      type: object
      properties:
        id:
          type: number
          description: The id for the package
        productOptionId:
          type: number
          description: >-
            If this package is for an `option` tracking product, this value will
            be set. You can lookup which product option has inventory for this
            package in `product.options[].id` of this response.
          nullable: true
        type:
          type: string
          description: >-
            The compliance system for this package. Only `metrc` is supported
            currently.
          enum:
            - metrc
        externalId:
          type: string
          description: The ID of the package in the external compliance system (Metrc)
          nullable: true
        externalProductName:
          type: string
          description: >-
            The name of the product for this package in the external compliance
            system (Metrc)
          nullable: true
        label:
          type: string
          description: The tag/label identifier for the package
        status:
          type: string
          description: >-
            The status of the package


            - `ready` is a package that has not been received into inventory
            yet.

            - `received` is a package that has been accepted into inventory for
            sale

            - `finished` is a package with 0 inventory and has been marked as
            finished

            - `shipped` is a package that is currently being shipped to another
            license and not available for sale

            - `transferred` is a package that was transferred out of this
            license and no longer has inventory

            - `transfer-returned` is a package that has been transferred back,
            but has not been received into inventory yet

            - `syncing` is a package that has been created, but not synced to
            Metrc yet
          enum:
            - ready
            - received
            - finished
            - shipped
            - transferred
            - transfer-returned
            - syncing
        initialAmount:
          type: string
          description: >-
            The amount of inventory this package had in Metrc when it was first
            imported into Meadow. This does not reflect how much inventory is
            currently available in Meadow.
        unit:
          type: string
          description: 'The Metrc unit of the package. (Example: `Each` or `Grams`)'
        createdAt:
          type: string
          description: When this package was first created in Meadow
        updatedAt:
          type: string
          description: >-
            The last time this package had a modification made to it or an
            inventory transaction associated with it
        receivedAt:
          type: string
          description: When this package was received into inventory
          nullable: true
        finishedAt:
          type: string
          description: When this package was set as finished
          nullable: true
        multiplier:
          type: string
          description: >-
            This number represents the relationship between 1 unit of inventory
            in Meadow and how many units that represents in the Metrc package.
            For example, if a Metrc package has a unit of `Grams`, then the
            multiplier may be something like `3.5` to represent that one
            pre-packed eighth in Meadow will use 3.5g of the Metrc package. This
            is only applicable for `option` tracking products. `product`
            tracking will always have a value of `1`. Please refer to the
            [Inventory Guide](/guides/inventory) for information on `option` and
            `product` tracking.
          nullable: true
        expirationDate:
          type: string
          description: The expiration date of the package
          nullable: true
        transferredAt:
          type: string
          description: When this package was transferred out of this organization
          nullable: true
        transferReturnedAt:
          type: string
          description: When this package was transferred back to this organization
          nullable: true
        shippedAt:
          type: string
          description: When this package was shipped out of this organization
          nullable: true
        costPerUnit:
          type: string
          description: The cost per unit for this package
          nullable: true
        voidReason:
          type: string
          description: If this package has been voided, it will always have a reason
          nullable: true
        thcPercent:
          type: string
          description: The THC percent of this package
          nullable: true
        thcMg:
          type: string
          description: The THC contents in mg of this package
          nullable: true
        cbdPercent:
          type: string
          description: The CBD percent of this package
          nullable: true
        cbdMg:
          type: string
          description: The CBD contents in mg of this package
          nullable: true
        producerName:
          type: string
          description: The name of the producer of this package
          nullable: true
        producerLicense:
          type: string
          description: 'The state license # of the producer'
          nullable: true
        harvestDate:
          type: string
          description: The harvest date of this package
          nullable: true
        harvestFacilityName:
          type: string
          description: The name of the facility that harvested this package
          nullable: true
        harvestFacilityLicense:
          type: string
          description: 'The state license # of the harvest facility'
          nullable: true
        labName:
          type: string
          description: The name of the lab testing facility
          nullable: true
        labLicense:
          type: string
          description: 'The state license # of the lab testing facility'
          nullable: true
        labDate:
          type: string
          description: The date of the lab testing results for this package
          nullable: true
        onHold:
          type: boolean
          description: Whether this package is on "administrative hold" in Metrc
        tradeSample:
          type: boolean
          description: Whether this package is designated as a trade sample
        originalSourceLabel:
          type: string
          description: >-
            The original source label for this package's root parent. Provided
            by Metrc for use in Retail ID context
          nullable: true
        locationInventory:
          type: array
          description: >-
            The Meadow inventory for this package broken out by inventory
            location. An empty array `[]` means that this package does not have
            any inventory.
          items:
            type: object
            properties:
              inventoryLocationId:
                type: number
                description: The id for this inventory location
              amount:
                type: string
                description: The amount of inventory available for sale
        product:
          type: object
          description: >-
            Information about the product this package has inventory for. This
            will be `null` if the package has not had its inventory received to
            a Meadow product yet.
          nullable: true
          properties:
            id:
              type: number
              description: The ID of the product
            name:
              type: string
              description: The name of the product
            unit:
              type: string
              description: Either `gram` or `item`
            strainType:
              type: string
              description: The strain type of the product
              enum:
                - sativa
                - indica
                - hybrid
                - hybrid-sativa
                - hybrid-indica
                - cbd
                - mixed
                - none
            isActive:
              type: boolean
              description: Whether the product is active on menus or not
            isFeatured:
              type: boolean
              description: Whether the product is featured or not
            inventoryType:
              type: string
              description: >-
                Either `option` or `product`. Please refer to the [Inventory
                Guide](/guides/inventory) for more information.
            movingAverageCostPerUnit:
              type: boolean
              description: >-
                The moving average cost per unit for this product if this
                products inventoryType is `product`
              nullable: true
            brandName:
              type: string
              description: The brand name of this product
              nullable: true
            primaryCategory:
              type: object
              description: The category for this product
              properties:
                id:
                  type: number
                  description: ID of the category
                name:
                  type: string
                  description: The name of the category
                cannabisType:
                  type: string
                  description: >-
                    One of the following values:

                    `non-concentrated` - Flower or other non-concentrated THC
                    products

                    `concentrated` - Concentrated THC products (Example:
                    Edibles, Concentrates)

                    `immature-plant` - Cannabis plants

                    `none` - This product does not contain cannabis

                    `mi-infused-solids` - Cannabis infused solids (only in
                    Michigan) (Example: edibles)

                    `mi-infused-fluids` - Cannabis infused fluids (only in
                    Michigan) (Example: drinks)

                    `edibles` - Edible product (only used in New Jersey &
                    Massachusetts)
            options:
              type: array
              description: All of the pricing options for this product
              items:
                properties:
                  id:
                    type: number
                    description: The ID of this option
                  name:
                    type: string
                    description: The name of this option
                    nullable: true
                  amount:
                    type: number
                    description: The amount of the underlying unit of this product
                  price:
                    type: number
                    description: The price in cents of this option
                  salesPrice:
                    type: number
                    description: The sales price in cents if one exists
                    nullable: true
                  content:
                    type: string
                    description: The cannabis content of this option
                  movingAverageCostPerUnit:
                    type: string
                    description: The moving average cost per unit for this product option
                    nullable: true
    APIError:
      required:
        - error
        - message
      type: object
      properties:
        error:
          type: object
          properties:
            message:
              type: string
              example: A description of the error code
            code:
              type: string
              example: CODE_OF_ERROR_WILL_BE_HERE
  securitySchemes:
    meadowConsumer:
      type: apiKey
      name: X-Consumer-Key
      description: The key assigned to your company and provided via Meadow
      in: header
    meadowClient:
      type: apiKey
      name: X-Client-Key
      description: The key generated and provided by our mutual client
      in: header

````