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

# Get Shipment Audit History

> Returns paginated audit history showing all changes made to a shipment

## Request Parameters

### Path Parameters

<ParamField path="id" type="string" required>
  The unique identifier of the shipment (UUID format)
</ParamField>

### Query Parameters

<ParamField query="page" type="integer" default="1">
  Page number for pagination
</ParamField>

<ParamField query="page_size" type="integer" default="20">
  Items per page (maximum: 100)
</ParamField>

<RequestExample>
  ```bash theme={null}
  curl -X GET \
    'https://platform.returnqueen.dev/api/shipments/123e4567-e89b-12d3-a456-426614174000/versions?page=1&page_size=20' \
    -H 'X-API-KEY: your-api-key'
  ```
</RequestExample>

<ResponseExample>
  ```json theme={null}
  {
    "versions": [
      {
        "id": 456,
        "action": "update",
        "recorded_at": "2024-01-15T10:30:00Z",
        "changes": {
          "status": {
            "from": "scheduled",
            "to": "cancelled"
          },
          "cancelled_at": "2024-01-15T10:30:00Z",
          "cancelled_reason": "Partner requested cancellation"
        },
        "metadata": {
          "user_type": "api",
          "api_key_id": "550e8400-e29b-41d4-a716-446655440000",
          "partner_id": "660e8400-e29b-41d4-a716-446655440001",
          "change_reason": "Partner requested cancellation"
        }
      },
      {
        "id": 123,
        "action": "insert",
        "recorded_at": "2024-01-15T08:00:00Z",
        "changes": {
          "order_number": "ORD-123",
          "shipment_type": "delivery",
          "status": "pending"
        },
        "metadata": {
          "user_type": "api",
          "api_key_id": "550e8400-e29b-41d4-a716-446655440000",
          "partner_id": "660e8400-e29b-41d4-a716-446655440001"
        }
      }
    ],
    "pagination": {
      "page": 1,
      "page_size": 20,
      "total_count": 2,
      "total_pages": 1
    }
  }
  ```
</ResponseExample>

## Response Fields

<ResponseField name="versions" type="array">
  List of version entries showing changes to the shipment

  <Expandable title="version properties">
    <ResponseField name="id" type="integer">
      Version ID
    </ResponseField>

    <ResponseField name="action" type="string">
      Type of change: `insert`, `update`, or `delete`
    </ResponseField>

    <ResponseField name="recorded_at" type="string">
      When the change was recorded (ISO 8601 format)
    </ResponseField>

    <ResponseField name="changes" type="object">
      Fields that changed with their from/to values
    </ResponseField>

    <ResponseField name="metadata" type="object">
      Additional information about who made the change

      <Expandable title="metadata properties">
        <ResponseField name="user_type" type="string">
          Type of user: `api`, `admin`, or `system`
        </ResponseField>

        <ResponseField name="api_key_id" type="string">
          ID of the API key used (UUID format)
        </ResponseField>

        <ResponseField name="partner_id" type="string">
          ID of the partner (UUID format)
        </ResponseField>

        <ResponseField name="change_reason" type="string">
          Reason for the change
        </ResponseField>
      </Expandable>
    </ResponseField>
  </Expandable>
</ResponseField>

<ResponseField name="pagination" type="object">
  Pagination information

  <Expandable title="pagination properties">
    <ResponseField name="page" type="integer">
      Current page number
    </ResponseField>

    <ResponseField name="page_size" type="integer">
      Items per page
    </ResponseField>

    <ResponseField name="total_count" type="integer">
      Total number of versions
    </ResponseField>

    <ResponseField name="total_pages" type="integer">
      Total number of pages
    </ResponseField>
  </Expandable>
</ResponseField>
