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

# Change Product EPC State

> Updates the status of a product EPC. If the EPC belongs to a group (same group_id), all EPCs in that group will be updated to the new state.



## OpenAPI

````yaml https://app.buylo.ai/api/documentation/swagger/openapi.yaml patch /api/product-epc/{product_epc_hash}/state
openapi: 3.1.1
info:
  title: Buylo - company external API
  version: 1.0.0
  description: >-
    API endpoints for managing products and EPCs in the Buylo system. Use
    company token for authentication.
servers:
  - url: https://app.buylo.ai/
security:
  - bearerAuth: []
paths:
  /api/product-epc/{product_epc_hash}/state:
    patch:
      tags:
        - Product EPC
      summary: Change Product EPC State
      description: >-
        Updates the status of a product EPC. If the EPC belongs to a group (same
        group_id), all EPCs in that group will be updated to the new state.
      parameters:
        - in: path
          name: product_epc_hash
          required: true
          schema:
            type: string
          description: The hash of the product EPC to update
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - status
              properties:
                status:
                  type: string
                  enum:
                    - registered
                    - stored
                    - transit
                    - in_store
                    - for_sale
                    - sold
                    - stolen
                    - cancelled
                    - reserved
                    - returned
                    - damaged
                  description: The new status for the EPC
                  example: sold
      responses:
        '200':
          description: State updated successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                    example: Product EPC state has been successfully updated
                  updated_count:
                    type: integer
                    description: Number of EPCs updated (includes grouped EPCs)
                    example: 3
                  updated_hashes:
                    type: array
                    items:
                      type: string
                    description: List of all updated EPC hashes
                    example:
                      - 8aaedfc3559d0ce545ca55bcea31aad2
                      - 2b1c7f8c2aab4e33a5e09a2d77f3b611
                      - a7d9c4e8b3f2a1c5e7b9d4f8a2c6e9b1
                required:
                  - message
                  - updated_count
                  - updated_hashes
        '400':
          description: Validation error - invalid status value
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/InvalidResponse'
        '403':
          description: Invalid token
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/InvalidResponse'
        '404':
          description: Product EPC not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/InvalidResponse'
      security:
        - bearerAuth: []
components:
  schemas:
    InvalidResponse:
      type: object
      properties:
        message:
          type: string
          description: Error message describing the issue
      required:
        - message
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer

````