> ## 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.

# Receive ASN

> Process the receiving of items from an ASN and update inventory

<Note>
  This endpoint processes the receiving of items from an ASN. It updates inventory levels, records any discrepancies, and can trigger automated workflows for putaway and quality control.
</Note>

### Path Parameters

<ParamField path="id" type="string" required>
  The unique identifier of the ASN to receive
</ParamField>

### Request Body

<ParamField body="received_date" type="string" required>
  Date and time when items were received (ISO 8601)
</ParamField>

<ParamField body="received_by" type="string" required>
  User ID or name of the person processing the receipt
</ParamField>

<ParamField body="items" type="array" required>
  Array of received items with quantities and conditions

  <Expandable title="Item object properties">
    <ParamField body="item_id" type="string" required>
      ASN item ID being received
    </ParamField>

    <ParamField body="quantity_received" type="integer" required>
      Actual quantity received
    </ParamField>

    <ParamField body="condition" type="string">
      Condition of received items: "new", "damaged", "defective"
    </ParamField>

    <ParamField body="lot_number" type="string">
      Lot number for tracking (can override ASN lot number)
    </ParamField>

    <ParamField body="expiration_date" type="string">
      Expiration date for perishable items
    </ParamField>

    <ParamField body="serial_numbers" type="array">
      Array of serial numbers for serialized items
    </ParamField>

    <ParamField body="location" type="string">
      Warehouse location where items are placed
    </ParamField>

    <ParamField body="discrepancy_notes" type="string">
      Notes about any discrepancies found
    </ParamField>
  </Expandable>
</ParamField>

<ParamField body="quality_check" type="object">
  Quality control information

  <Expandable title="Quality check properties">
    <ParamField body="performed" type="boolean">
      Whether quality check was performed
    </ParamField>

    <ParamField body="passed" type="boolean">
      Whether items passed quality check
    </ParamField>

    <ParamField body="notes" type="string">
      Quality check notes
    </ParamField>

    <ParamField body="failed_items" type="array">
      List of items that failed quality check
    </ParamField>
  </Expandable>
</ParamField>

<ParamField body="discrepancies" type="array">
  Overall discrepancies found during receiving

  <Expandable title="Discrepancy properties">
    <ParamField body="type" type="string" required>
      Type: "quantity", "damage", "wrong\_item", "missing\_item"
    </ParamField>

    <ParamField body="description" type="string" required>
      Description of the discrepancy
    </ParamField>

    <ParamField body="resolution" type="string">
      How the discrepancy was resolved
    </ParamField>
  </Expandable>
</ParamField>

<ParamField body="notes" type="string">
  General receiving notes
</ParamField>

<ParamField body="complete_receipt" type="boolean">
  Whether this completes the ASN receipt (default: true)
</ParamField>

### Response

<ResponseField name="id" type="string">
  ASN ID
</ResponseField>

<ResponseField name="status" type="string">
  Updated ASN status
</ResponseField>

<ResponseField name="receiving_summary" type="object">
  Summary of the receiving process
</ResponseField>

<ResponseField name="inventory_updates" type="array">
  Details of inventory updates made
</ResponseField>

<ResponseField name="discrepancy_report" type="object">
  Summary of any discrepancies found
</ResponseField>

<RequestExample>
  ```bash cURL theme={null}
  curl --location --request POST 'https://api.stateset.com/v1/asns/asn_0901f083-aa1c-43c5-af5c-0a9d2fc64e30/receive' \
  --header 'Content-Type: application/json' \
  --header 'Authorization: Bearer YOUR_API_KEY' \
  --data-raw '{
      "received_date": "2024-01-18T11:00:00Z",
      "received_by": "john.doe@warehouse.com",
      "items": [
          {
              "item_id": "asn_item_123",
              "quantity_received": 498,
              "condition": "new",
              "lot_number": "LOT-2024-001",
              "location": "A-12-3",
              "discrepancy_notes": "2 units damaged in transit"
          },
          {
              "item_id": "asn_item_124",
              "quantity_received": 1000,
              "condition": "new",
              "lot_number": "LOT-2024-002",
              "location": "B-5-1"
          }
      ],
      "quality_check": {
          "performed": true,
          "passed": true,
          "notes": "All items meet quality standards"
      },
      "discrepancies": [
          {
              "type": "damage",
              "description": "2 units of WBH-001 damaged in transit",
              "resolution": "Filed claim with carrier"
          }
      ],
      "notes": "Shipment received in good condition except for noted damages",
      "complete_receipt": true
  }'
  ```

  ```graphQL GraphQL theme={null}
  mutation ReceiveASN($id: ID!, $input: ReceiveASNInput!) {
    receiveASN(id: $id, input: $input) {
      id
      status
      receiving_summary {
        total_items_expected
        total_items_received
        discrepancy_count
        receipt_completed
      }
      inventory_updates {
        sku
        quantity_added
        new_total
        location
      }
      discrepancy_report {
        has_discrepancies
        total_discrepancies
        discrepancies {
          type
          description
          impact
        }
      }
    }
  }
  ```

  ```javascript Node.js theme={null}
  const receipt = await stateset.asns.receive(
    'asn_0901f083-aa1c-43c5-af5c-0a9d2fc64e30',
    {
      received_date: '2024-01-18T11:00:00Z',
      received_by: 'john.doe@warehouse.com',
      items: [
        {
          item_id: 'asn_item_123',
          quantity_received: 498,
          condition: 'new',
          lot_number: 'LOT-2024-001',
          location: 'A-12-3',
          discrepancy_notes: '2 units damaged in transit'
        },
        {
          item_id: 'asn_item_124',
          quantity_received: 1000,
          condition: 'new',
          lot_number: 'LOT-2024-002',
          location: 'B-5-1'
        }
      ],
      quality_check: {
        performed: true,
        passed: true,
        notes: 'All items meet quality standards'
      },
      complete_receipt: true
    }
  );
  ```

  ```python Python theme={null}
  receipt = stateset.asns.receive(
      'asn_0901f083-aa1c-43c5-af5c-0a9d2fc64e30',
      received_date='2024-01-18T11:00:00Z',
      received_by='john.doe@warehouse.com',
      items=[
          {
              'item_id': 'asn_item_123',
              'quantity_received': 498,
              'condition': 'new',
              'lot_number': 'LOT-2024-001',
              'location': 'A-12-3',
              'discrepancy_notes': '2 units damaged in transit'
          },
          {
              'item_id': 'asn_item_124',
              'quantity_received': 1000,
              'condition': 'new',
              'lot_number': 'LOT-2024-002',
              'location': 'B-5-1'
          }
      ],
      quality_check={
          'performed': True,
          'passed': True,
          'notes': 'All items meet quality standards'
      },
      complete_receipt=True
  )
  ```
</RequestExample>

<ResponseExample>
  ```json Response theme={null}
  {
    "id": "asn_0901f083-aa1c-43c5-af5c-0a9d2fc64e30",
    "asn_number": "ASN-2024-00001",
    "status": "received",
    "receiving_summary": {
      "total_items_expected": 1500,
      "total_items_received": 1498,
      "discrepancy_count": 1,
      "receipt_completed": true,
      "received_date": "2024-01-18T11:00:00Z",
      "received_by": "john.doe@warehouse.com"
    },
    "inventory_updates": [
      {
        "sku": "WBH-001",
        "product_name": "Wireless Bluetooth Headphones",
        "quantity_added": 498,
        "previous_quantity": 145,
        "new_total": 643,
        "location": "A-12-3",
        "lot_number": "LOT-2024-001"
      },
      {
        "sku": "USB-C-001",
        "product_name": "USB-C Charging Cable",
        "quantity_added": 1000,
        "previous_quantity": 487,
        "new_total": 1487,
        "location": "B-5-1",
        "lot_number": "LOT-2024-002"
      }
    ],
    "discrepancy_report": {
      "has_discrepancies": true,
      "total_discrepancies": 1,
      "discrepancies": [
        {
          "type": "damage",
          "description": "2 units of WBH-001 damaged in transit",
          "expected_quantity": 500,
          "received_quantity": 498,
          "impact": "inventory_shortage",
          "resolution": "Filed claim with carrier"
        }
      ]
    },
    "purchase_order_update": {
      "po_id": "po_123456789",
      "items_received": 1498,
      "items_outstanding": 2,
      "po_status": "partially_received"
    },
    "workflows_triggered": [
      {
        "type": "putaway",
        "status": "initiated",
        "assigned_to": "warehouse_team"
      },
      {
        "type": "carrier_claim",
        "status": "initiated",
        "reference": "CLAIM-2024-00123"
      }
    ]
  }
  ```
</ResponseExample>
