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

# List ASNs

> Retrieve a paginated list of ASNs with filtering options

### Query Parameters

<ParamField query="limit" type="integer">
  Number of ASNs to return (default: 20, max: 100)
</ParamField>

<ParamField query="offset" type="integer">
  Number of ASNs to skip (for pagination)
</ParamField>

<ParamField query="cursor" type="string">
  Cursor for pagination (alternative to offset)
</ParamField>

<ParamField query="status" type="string">
  Filter by status: "pending", "in\_transit", "delivered", "received", "partially\_received", "cancelled"
</ParamField>

<ParamField query="purchase_order_id" type="string">
  Filter by purchase order ID
</ParamField>

<ParamField query="supplier_id" type="string">
  Filter by supplier ID
</ParamField>

<ParamField query="warehouse_id" type="string">
  Filter by destination warehouse ID
</ParamField>

<ParamField query="carrier" type="string">
  Filter by shipping carrier
</ParamField>

<ParamField query="expected_arrival_after" type="string">
  Filter ASNs with expected arrival after this date (ISO 8601)
</ParamField>

<ParamField query="expected_arrival_before" type="string">
  Filter ASNs with expected arrival before this date (ISO 8601)
</ParamField>

<ParamField query="created_after" type="string">
  Filter ASNs created after this date (ISO 8601)
</ParamField>

<ParamField query="created_before" type="string">
  Filter ASNs created before this date (ISO 8601)
</ParamField>

<ParamField query="has_discrepancies" type="boolean">
  Filter ASNs with receiving discrepancies
</ParamField>

<ParamField query="search" type="string">
  Search by ASN number, tracking number, or supplier name
</ParamField>

<ParamField query="sort_by" type="string">
  Sort field: "created\_at", "expected\_arrival\_date", "asn\_number", "status" (default: "created\_at")
</ParamField>

<ParamField query="sort_order" type="string">
  Sort order: "asc" or "desc" (default: "desc")
</ParamField>

### Response

<ResponseField name="object" type="string">
  Always "list"
</ResponseField>

<ResponseField name="data" type="array">
  Array of ASN objects
</ResponseField>

<ResponseField name="has_more" type="boolean">
  Whether there are more ASNs to retrieve
</ResponseField>

<ResponseField name="total_count" type="integer">
  Total number of ASNs matching the filters
</ResponseField>

<ResponseField name="next_cursor" type="string">
  Cursor for retrieving the next page
</ResponseField>

<RequestExample>
  ```bash cURL theme={null}
  curl --location --request GET 'https://api.stateset.com/v1/asns?status=in_transit&warehouse_id=wh_001&limit=10' \
  --header 'Authorization: Bearer YOUR_API_KEY'
  ```

  ```graphQL GraphQL theme={null}
  query ListASNs(
    $limit: Int
    $offset: Int
    $status: ASNStatus
    $warehouse_id: String
    $expected_arrival_after: DateTime
  ) {
    asns(
      limit: $limit
      offset: $offset
      status: $status
      warehouse_id: $warehouse_id
      expected_arrival_after: $expected_arrival_after
    ) {
      data {
        id
        asn_number
        status
        supplier {
          id
          name
        }
        warehouse {
          id
          name
        }
        expected_arrival_date
        tracking_info {
          carrier
          tracking_number
          current_status
        }
        item_summary {
          total_items
          total_quantity
        }
      }
      has_more
      total_count
    }
  }
  ```

  ```javascript Node.js theme={null}
  const asns = await stateset.asns.list({
    status: 'in_transit',
    warehouse_id: 'wh_001',
    expected_arrival_after: '2024-01-15T00:00:00Z',
    limit: 10,
    sort_by: 'expected_arrival_date',
    sort_order: 'asc'
  });

  // Iterate through all ASNs
  for await (const asn of stateset.asns.list()) {
    console.log(asn.asn_number, asn.status);
  }
  ```

  ```python Python theme={null}
  asns = stateset.asns.list(
      status='in_transit',
      warehouse_id='wh_001',
      expected_arrival_after='2024-01-15T00:00:00Z',
      limit=10,
      sort_by='expected_arrival_date',
      sort_order='asc'
  )

  # Iterate through all ASNs
  for asn in stateset.asns.list():
      print(asn.asn_number, asn.status)
  ```
</RequestExample>

<ResponseExample>
  ```json Response theme={null}
  {
    "object": "list",
    "data": [
      {
        "id": "asn_0901f083-aa1c-43c5-af5c-0a9d2fc64e30",
        "object": "asn",
        "asn_number": "ASN-2024-00001",
        "status": "in_transit",
        "created_at": "2024-01-15T14:30:00Z",
        "updated_at": "2024-01-16T08:00:00Z",
        "purchase_order_id": "po_123456789",
        "purchase_order_number": "PO-2024-00123",
        "supplier": {
          "id": "sup_abc123",
          "name": "AudioTech Suppliers Inc."
        },
        "warehouse": {
          "id": "wh_001",
          "name": "Main Distribution Center"
        },
        "shipment_date": "2024-01-15T14:00:00Z",
        "expected_arrival_date": "2024-01-18T10:00:00Z",
        "tracking_info": {
          "carrier": "UPS",
          "tracking_number": "1Z999AA10123456784",
          "current_status": "In Transit",
          "last_update": "2024-01-16T08:00:00Z"
        },
        "item_summary": {
          "total_items": 2,
          "total_quantity": 1500,
          "total_value": {
            "amount": 4200000,
            "currency": "USD"
          }
        }
      },
      {
        "id": "asn_xyz789def456",
        "object": "asn",
        "asn_number": "ASN-2024-00002",
        "status": "in_transit",
        "created_at": "2024-01-16T09:00:00Z",
        "updated_at": "2024-01-16T15:00:00Z",
        "purchase_order_id": "po_987654321",
        "purchase_order_number": "PO-2024-00124",
        "supplier": {
          "id": "sup_def456",
          "name": "TechConnect Wholesale"
        },
        "warehouse": {
          "id": "wh_001",
          "name": "Main Distribution Center"
        },
        "shipment_date": "2024-01-16T08:00:00Z",
        "expected_arrival_date": "2024-01-19T14:00:00Z",
        "tracking_info": {
          "carrier": "FedEx",
          "tracking_number": "123456789012",
          "current_status": "In Transit",
          "last_update": "2024-01-16T15:00:00Z"
        },
        "item_summary": {
          "total_items": 5,
          "total_quantity": 2500,
          "total_value": {
            "amount": 1875000,
            "currency": "USD"
          }
        }
      }
    ],
    "has_more": true,
    "total_count": 15,
    "next_cursor": "eyJpZCI6ImFzbl94eXo3ODlkZWY0NTYifQ=="
  }
  ```
</ResponseExample>
