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

# Modify package (V2)

> Partially update a package by slug. At least one modifiable field is required. Package settings and category rules live under `rules` (not top-level). Omit `rules` to leave both unchanged. When `rules` is present: omit `rules.package` to leave package settings unchanged; omit `rules.categories` to leave categories unchanged; send a partial `rules.package` object to update only included fields (siblings are not wiped). Empty `rules.package: {}` is rejected. When `skuLines` is present, replaces stored SKU line regions and re-syncs `package_region`. Omit `skuLines` to leave line regions unchanged. When `bundleRefs` is present, replaces stored package bundle lines (empty list clears); omit to leave unchanged. Returns 403 when the redesigned packages are not enabled for your organization.



## OpenAPI

````yaml /openapi.json patch /api/v2/packages/{slug}
openapi: 3.1.0
info:
  title: Firstbase API Specification
  description: Integration endpoints for Firstbase
  version: 0.1.0
servers:
  - url: https://apipub.firstbasehq.com
    description: Production
security:
  - ApiKey: []
tags:
  - name: Bundles
    description: Manage product-group bundles
  - name: Catalog
    description: Browse SKUs, brands, and categories
  - name: Inventory
    description: Query and manage inventory items and assets
  - name: Inventory Levels
    description: Configure inventory levels by SKU and warehouse
  - name: Inventory Orders
    description: Create and manage inventory orders
  - name: ITAD
    description: IT asset disposition requests
  - name: New Joiners
    description: Track and remind new joiners
  - name: Offices
    description: Manage office locations
  - name: Orders
    description: Create and track equipment orders
  - name: Packages
    description: Manage equipment packages
  - name: People
    description: Provision and manage users
  - name: Regions
    description: Query regions
  - name: Replacements
    description: Create and manage equipment replacements
  - name: Returns
    description: Create and manage returns
  - name: Shipment
    description: Look up shipments and carriers
  - name: Shipment Notices
    description: Create and manage shipment notices
  - name: Warehouses
    description: Query warehouses
paths:
  /api/v2/packages/{slug}:
    patch:
      tags:
        - Packages
      summary: Modify package (V2)
      description: >-
        Partially update a package by slug. At least one modifiable field is
        required. Package settings and category rules live under `rules` (not
        top-level). Omit `rules` to leave both unchanged. When `rules` is
        present: omit `rules.package` to leave package settings unchanged; omit
        `rules.categories` to leave categories unchanged; send a partial
        `rules.package` object to update only included fields (siblings are not
        wiped). Empty `rules.package: {}` is rejected. When `skuLines` is
        present, replaces stored SKU line regions and re-syncs `package_region`.
        Omit `skuLines` to leave line regions unchanged. When `bundleRefs` is
        present, replaces stored package bundle lines (empty list clears); omit
        to leave unchanged. Returns 403 when the redesigned packages are not
        enabled for your organization.
      operationId: patchPackageV2
      parameters:
        - name: slug
          in: path
          required: true
          schema:
            type: string
          description: Unique slug of the package.
      requestBody:
        description: >-
          Partial update body. Nested `rules` for package settings and
          categories.
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/PatchPackageV2Request'
            examples:
              patchPackageSettingsOnly:
                summary: Update only approvalRequired under rules.package
                description: patchPackageSettingsOnly
                value:
                  rules:
                    package:
                      approvalRequired: true
              patchCategoriesOnly:
                summary: Replace category rules only
                description: patchCategoriesOnly
                value:
                  rules:
                    categories:
                      - categoryCode: MONITOR
                        quantity: 2
                        optional: false
              patchFullRules:
                summary: Update package settings and replace categories
                description: patchFullRules
                value:
                  rules:
                    package:
                      automaticOrder: false
                      approvalRequired: true
                      deliverySetting: PERSON
                    categories:
                      - categoryCode: COMPUTER
                        quantity: 1
                        optional: true
              patchBundleRefs:
                summary: Replace package bundle references
                description: patchBundleRefs
                value:
                  bundleRefs:
                    - productGroupId: 7b21c8e0-1a2b-4c3d-9e5f-0123456789ab
                      sortOrder: 0
        required: true
      responses:
        '200':
          description: Package updated (response uses nested `rules`)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PackageV2DetailResponse'
              examples:
                patchedPackage:
                  summary: Updated package detail
                  description: patchedPackage
                  value:
                    id: 3a68a467-8733-4c8d-a942-16ed7ec33018
                    friendlyId: PKG-260914-TEST0001
                    slug: engineering-starter-kit
                    name: Engineering Starter Kit
                    active: true
                    itCloset: false
                    regions: []
                    skuLines:
                      - skuId: 7b21c8e0-1a2b-4c3d-9e5f-0123456789ab
                        vendorCode: DELL
                        vendorSku: LAT-7420
                        regions: []
                    bundleLines: []
                    fallbackLines: []
                    rules:
                      package:
                        automaticOrder: false
                        approvalRequired: false
                        requireJustification: false
                        deliverySetting: PERSON
                        defaultOfficeId: null
                      categories:
                        - id: 9c34d9f1-2b3c-5d4e-0f6a-1234567890bc
                          categoryCode: COMPUTER
                          quantity: 1
                          optional: true
                          allowedProductIds: null
                    instructions: Bring your own dongle
                    assignedTo:
                      people: []
                      peopleCount: 0
                    createdAt: '2026-01-01T00:00:00Z'
                    updatedAt: '2026-01-02T00:00:00Z'
        '400':
          description: >-
            Empty body, invalid field values, empty rules.package, or explicit
            null for guarded scalar fields
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PublicApiHttpErrors'
        '403':
          description: Endpoint not available for this organization
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PublicApiHttpErrors'
        '404':
          description: Package not found for the authenticated organization
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PublicApiHttpErrors'
        '409':
          description: >-
            Package cannot be modified (illegal automatic order, duplicate name,
            archive blocked, etc.)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PublicApiHttpErrors'
      x-codeSamples:
        - lang: curl
          label: cURL
          source: >-
            curl -sS -X PATCH
            'https://apipub.firstbasehq.com/api/v2/packages/{slug}' \
              -H 'Authorization: ApiKey YOUR_API_KEY' \
              -H 'Accept: application/json' \
              -H 'Content-Type: application/json' \
              -d '{
                "rules": {
                  "package": {
                    "approvalRequired": true
                  }
                }
              }'
components:
  schemas:
    PatchPackageV2Request:
      type: object
      description: >-
        Partial update body for Packages V2. At least one modifiable field is
        required. Package settings and category rules live under `rules` — not
        as top-level fields. Omit `rules` to leave both package settings and
        categories unchanged. When `rules` is present: omit `rules.package` to
        leave package settings unchanged; omit `rules.categories` to leave
        category rules unchanged; send a partial `rules.package` object to
        update only the fields included (sibling package fields are not wiped).
        An empty `rules.package: {}` is rejected (no modifiable field).
      properties:
        name:
          type: string
          description: Package name
          example: Engineering Starter Kit
        active:
          type: boolean
          description: Set to false to soft-delete the package
          example: true
        skuLines:
          type: array
          description: >-
            Per-SKU region lines. Omitted means no change; present list replaces
            stored lines.
          items:
            $ref: '#/components/schemas/PackageSkuLineV2Request'
        bundleRefs:
          type: array
          description: >-
            Bundle references. Omitted means no change; present list replaces
            stored bundle lines; empty list clears all bundle refs.
          items:
            $ref: '#/components/schemas/PackageBundleRefV2Request'
        instructions:
          type: string
          description: >-
            Employee-facing instructions shown at order time. Omit to leave
            unchanged; send null or a blank string to clear; a non-blank value
            creates or updates the package's instruction text.
          example: Bring your own dongle
        usedEquipmentPreferences:
          type: array
          description: >-
            Used-equipment preferences per category (e.g. NEW_ONLY, used-first,
            in-stock-only). Omit to leave unchanged.
          items:
            $ref: '#/components/schemas/PublicAPIPatchUsedEquipmentPrefRequest'
        rules:
          $ref: '#/components/schemas/PackageRulesV2PatchRequest'
          description: >-
            Nested rules. Omitted means no change to package settings or
            categories. See type description for partial-update semantics.
      required:
        - active
        - instructions
        - name
    PackageV2DetailResponse:
      type: object
      description: >-
        Full package returned by V2 get / create / patch. Package settings and
        category rules are nested under `rules` (not top-level). Shape:
        `rules.package` (automaticOrder, approvalRequired, requireJustification,
        deliverySetting, defaultOfficeId) and `rules.categories` (categoryCode,
        quantity, optional, …).
      properties:
        id:
          type: string
          format: uuid
          description: Unique identifier of the package
          example: 3a68a467-8733-4c8d-a942-16ed7ec33018
        friendlyId:
          type: string
          description: Human-friendly package identifier (PKG-*)
          example: PKG-260914-TEST0001
        slug:
          type: string
          description: URL-safe unique identifier for the package
          example: engineering-starter-kit
        name:
          type: string
          description: Display name of the package
          example: Engineering Starter Kit
        active:
          type: boolean
          description: Whether the package is active
          example: true
        itCloset:
          type: boolean
          description: When true, the package is intended for IT closet / office stock
          example: false
        regions:
          type: array
          description: Stored regions for this package (from package_region)
          items:
            $ref: '#/components/schemas/PackageRegionV2Response'
        skuLines:
          type: array
          description: Category SKU lines with per-SKU region scoping
          items:
            $ref: '#/components/schemas/PackageSkuLineV2Response'
        bundleLines:
          type: array
          description: Bundle references attached to this package
          items:
            $ref: '#/components/schemas/PackageBundleLineV2Response'
        fallbackLines:
          type: array
          description: Fallback lines placeholder for future package redesign phases
          items:
            $ref: '#/components/schemas/PackageFallbackLineV2Response'
        rules:
          $ref: '#/components/schemas/PackageRulesV2Response'
          description: >-
            Nested rules object. Always present on detail. `package` holds
            order/approval/justification/delivery settings; `categories` holds
            per-category quantity rules (empty list when none).
        usedEquipmentPreferences:
          type: array
          description: Used-equipment preferences per category
          items:
            $ref: '#/components/schemas/UsedEquipmentPrefResponse'
        instructions:
          type: string
          description: >-
            Optional employee-facing instructions shown at order time (max 2000
            characters). Null on the detail response when the package has none.
          example: Bring your own dongle
        assignedTo:
          $ref: '#/components/schemas/PackageAssignedToV2Response'
          description: People assigned to this package
        createdAt:
          type: string
          format: date-time
          description: Timestamp when the package was created
          example: '2026-01-01T00:00:00Z'
        updatedAt:
          type: string
          format: date-time
          description: Timestamp when the package was last updated
          example: '2026-01-02T00:00:00Z'
      required:
        - active
        - assignedTo
        - bundleLines
        - fallbackLines
        - id
        - itCloset
        - name
        - regions
        - rules
        - skuLines
        - slug
        - usedEquipmentPreferences
    PublicApiHttpErrors:
      type: object
      properties:
        errors:
          type: array
          items:
            $ref: '#/components/schemas/PublicApiError'
          description: List of error details.
      required:
        - errors
    PackageSkuLineV2Request:
      type: object
      description: Per-SKU region selection for a package line (V2)
      properties:
        vendorCode:
          type: string
          description: Vendor code for the SKU.
          example: DELL
          minLength: 1
        vendorSku:
          type: string
          description: Vendor SKU identifier.
          example: LAT-7420
          minLength: 1
        regionIds:
          type: array
          description: Region UUIDs selected for this SKU line.
          example:
            - 3a68a467-8733-4c8d-a942-16ed7ec33018
          items:
            type: string
            format: uuid
          minItems: 1
      required:
        - regionIds
        - vendorCode
        - vendorSku
    PackageBundleRefV2Request:
      type: object
      description: Bundle reference for a package (product group id + display sort order).
      properties:
        productGroupId:
          type: string
          format: uuid
          description: Product group UUID of type BUNDLE in the authenticated organization.
          example: 3a68a467-8733-4c8d-a942-16ed7ec33018
        sortOrder:
          type: integer
          format: int32
          description: Display order within the package. Defaults to 0.
          example: 0
      required:
        - productGroupId
        - sortOrder
    PublicAPIPatchUsedEquipmentPrefRequest:
      type: object
      description: >-
        Used-equipment preference entry. Shared by the V1 create/patch bodies
        and the V2 create/patch bodies.
      properties:
        category_code:
          type: string
          description: Category code identifying which preference to set (e.g. LAPTOP)
          minLength: 1
        preference:
          type: string
          description: Used-equipment preference value
          enum:
            - NEW_FIRST
            - NEW_ONLY
            - USED_FIRST
            - USED_ONLY
        in_stock_only:
          type: boolean
          description: >-
            When true, people on this package only see products in stock for
            their warehouse region. On create, omitted defaults to false; on
            PATCH, omitted leaves the stored value unchanged.
          example: false
      required:
        - category_code
        - preference
    PackageRulesV2PatchRequest:
      type: object
      description: >-
        Nested PATCH rules for Packages V2. Omit `package` to leave package
        settings unchanged. Omit `categories` to leave category rules unchanged.
        Present `categories` list replaces all category rules.
      properties:
        package:
          $ref: '#/components/schemas/PackagePackageRulesV2PatchRequest'
          description: >-
            Partial package-level settings. Include only the fields to update.
            Omitted fields keep their current values.
        categories:
          type: array
          description: >-
            Category rules. Omitted means no change; present list replaces
            package category rules.
          items:
            $ref: '#/components/schemas/PackageRuleV2Request'
    PackageRegionV2Response:
      type: object
      description: Region summary stored on a package
      properties:
        id:
          type: string
          format: uuid
          description: Unique identifier of the region
          example: 3a68a467-8733-4c8d-a942-16ed7ec33018
        name:
          type: string
          description: Human-readable name of the region
          example: United States
        code:
          type: string
          description: Short code identifying the region
          example: US
      required:
        - code
        - id
        - name
    PackageSkuLineV2Response:
      type: object
      description: SKU line with region scoping for a package
      properties:
        skuId:
          type: string
          format: uuid
          description: SKU UUID
          example: 3a68a467-8733-4c8d-a942-16ed7ec33018
        vendorCode:
          type: string
          description: Vendor code for the SKU; null when the SKU has no vendor
          example: DELL
        vendorSku:
          type: string
          description: Vendor SKU identifier
          example: LAT-7420
        regions:
          type: array
          description: Regions selected for this SKU line
          items:
            $ref: '#/components/schemas/PackageRegionV2Response'
      required:
        - regions
        - skuId
        - vendorSku
    PackageBundleLineV2Response:
      type: object
      description: Bundle reference line on a package
      properties:
        productGroupId:
          type: string
          format: uuid
          description: Product group UUID
          example: 3a68a467-8733-4c8d-a942-16ed7ec33018
        friendlyId:
          type: string
          description: Human-friendly product group identifier (GRP-*)
          example: GRP-260914-TEST0001
        name:
          type: string
          description: Display name of the bundle
          example: Laptop Bundle
        sortOrder:
          type: integer
          format: int32
          description: Sort order of this bundle within the package
          example: 0
      required:
        - friendlyId
        - name
        - productGroupId
        - sortOrder
    PackageFallbackLineV2Response:
      type: object
      description: Fallback line placeholder for future package redesign phases
      properties:
        id:
          type: string
          format: uuid
          description: Placeholder identifier reserved for future fallback content
    PackageRulesV2Response:
      type: object
      description: >-
        Nested package + category rules returned on V2 detail. JSON key
        `package` is a reserved keyword in Kotlin but serializes as "package".
      properties:
        package:
          $ref: '#/components/schemas/PackagePackageRulesV2Response'
          description: Package-level order, approval, justification, and delivery settings
        categories:
          type: array
          description: >-
            Per-category quantity / optional rules. Empty list when the package
            has no category rules. Field names are camelCase (`categoryCode`),
            not snake_case.
          items:
            $ref: '#/components/schemas/PackageCategoryRuleV2Response'
      required:
        - categories
        - package
    UsedEquipmentPrefResponse:
      type: object
      description: Used-equipment preference for a category
      properties:
        categoryCode:
          type: string
          description: Product category code
        preference:
          type: string
          description: Used-equipment preference value
          enum:
            - NEW_FIRST
            - NEW_ONLY
            - USED_FIRST
            - USED_ONLY
        inStockOnly:
          type: boolean
          description: When true, only in-stock products are shown for this category
      required:
        - categoryCode
        - inStockOnly
        - preference
    PackageAssignedToV2Response:
      type: object
      description: People assigned to a package
      properties:
        people:
          type: array
          description: Person UUIDs assigned to this package
          items:
            type: string
            format: uuid
        peopleCount:
          type: integer
          format: int32
          description: Count of people assigned to this package
          example: 0
      required:
        - peopleCount
    PublicApiError:
      type: object
      properties:
        detail:
          type: string
          description: Human-readable description of the error
          example: Invalid request
        source:
          type: string
          description: >-
            Entity or field path that caused the error (for example order,
            shipmentNotice, or person:email)
          example: request
      required:
        - detail
        - source
    PackagePackageRulesV2PatchRequest:
      type: object
      description: >-
        Partial package-level settings under `rules.package` on PATCH. Only
        fields present in the JSON are updated. Explicit null is rejected for
        each field.
      properties:
        approvalRequired:
          type: boolean
          description: Whether package orders require approval
          example: true
        requireJustification:
          type: boolean
          description: Whether order items in this package require justification
          example: false
        automaticOrder:
          type: boolean
          description: Whether orders for this package are placed automatically
          example: false
        defaultOfficeId:
          type: string
          format: uuid
          description: Default office UUID for OFFICE/FLEXIBLE delivery
          example: 3a68a467-8733-4c8d-a942-16ed7ec33018
        deliverySetting:
          type: string
          description: Package delivery setting (PERSON, OFFICE, FLEXIBLE)
          enum:
            - PERSON
            - OFFICE
            - FLEXIBLE
          example: PERSON
      required:
        - approvalRequired
        - automaticOrder
        - defaultOfficeId
        - deliverySetting
        - requireJustification
    PackageRuleV2Request:
      type: object
      description: >-
        A category rule under `rules.categories` (create or patch). Uses
        camelCase `categoryCode`.
      properties:
        categoryCode:
          type: string
          description: Product category code this rule applies to.
          example: COMPUTER
          minLength: 1
        quantity:
          type: integer
          format: int32
          description: Number of items allowed or required for this category. Must be >= 1.
          example: 1
          minimum: 1
        optional:
          type: boolean
          description: When true, this category rule is optional for people on the package.
          example: false
      required:
        - categoryCode
        - optional
        - quantity
    PackagePackageRulesV2Response:
      type: object
      description: Package-level rule settings under `rules.package` on V2 detail responses
      properties:
        automaticOrder:
          type: boolean
          description: >-
            When true, assigning this package can trigger automatic equipment
            ordering
          example: false
        approvalRequired:
          type: boolean
          description: When true, orders from this package require admin approval
          example: false
        requireJustification:
          type: boolean
          description: When true, requesters must provide a justification when ordering
          example: false
        deliverySetting:
          type: string
          description: Where package equipment should be delivered
          enum:
            - PERSON
            - OFFICE
            - FLEXIBLE
          example: PERSON
        defaultOfficeId:
          type: string
          format: uuid
          description: Default office UUID when delivery targets an office
          example: 3a68a467-8733-4c8d-a942-16ed7ec33018
      required:
        - approvalRequired
        - automaticOrder
        - requireJustification
    PackageCategoryRuleV2Response:
      type: object
      description: Category quantity rule under `rules.categories` (V2 camelCase)
      properties:
        id:
          type: string
          format: uuid
          description: Unique identifier of the rule
          example: 3a68a467-8733-4c8d-a942-16ed7ec33018
        categoryCode:
          type: string
          description: Product category code this rule applies to
          example: COMPUTER
        quantity:
          type: integer
          format: int32
          description: Number of items allowed or required for this category
          example: 1
        optional:
          type: boolean
          description: When true, this category rule is optional
          example: true
        allowedProductIds:
          type: array
          description: >-
            Product UUIDs allowed by this rule; null/empty means no product
            restriction
          items:
            type: string
            format: uuid
      required:
        - categoryCode
        - id
        - optional
        - quantity
  securitySchemes:
    ApiKey:
      type: apiKey
      description: Prefix the value with "ApiKey" to indicate the custom authorization type
      name: Authorization
      in: header

````

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