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

# Update ASN

> Update an existing ASN with new tracking information or status

<Note>
  This endpoint supports partial updates. Only include the fields you want to change. Once an ASN is received, only certain fields can be updated.
</Note>

### Path Parameters

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

### Request Body

<ParamField body="expected_arrival_date" type="string">
  Updated expected delivery date (ISO 8601)
</ParamField>

<ParamField body="actual_arrival_date" type="string">
  Actual delivery date when shipment arrives (ISO 8601)
</ParamField>

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

<ParamField body="tracking_info" type="object">
  Updated tracking information

  <Expandable title="Tracking info properties">
    <ParamField body="carrier" type="string">
      Carrier name
    </ParamField>

    <ParamField body="tracking_number" type="string">
      Primary tracking number
    </ParamField>

    <ParamField body="service_type" type="string">
      Service level
    </ParamField>

    <ParamField body="current_status" type="string">
      Current tracking status
    </ParamField>

    <ParamField body="additional_tracking_numbers" type="array">
      Additional tracking numbers
    </ParamField>
  </Expandable>
</ParamField>

<ParamField body="packaging_details" type="object">
  Updated packaging information

  <Expandable title="Packaging properties">
    <ParamField body="total_packages" type="integer">
      Total number of packages
    </ParamField>

    <ParamField body="total_pallets" type="integer">
      Total number of pallets
    </ParamField>

    <ParamField body="total_weight" type="object">
      Total shipment weight
    </ParamField>
  </Expandable>
</ParamField>

<ParamField body="shipping_documents" type="array">
  Updated or additional shipping documents

  <Expandable title="Document properties">
    <ParamField body="type" type="string" required>
      Document type
    </ParamField>

    <ParamField body="document_number" type="string">
      Document reference number
    </ParamField>

    <ParamField body="url" type="string">
      URL to access the document
    </ParamField>
  </Expandable>
</ParamField>

<ParamField body="notes" type="string">
  Updated notes or instructions
</ParamField>

<ParamField body="metadata" type="object">
  Updated custom metadata
</ParamField>

### Response

Returns the updated ASN object with all fields.

<RequestExample>
  ```bash cURL theme={null}
  curl --location --request PUT 'https://api.stateset.com/v1/asns/asn_0901f083-aa1c-43c5-af5c-0a9d2fc64e30' \
  --header 'Content-Type: application/json' \
  --header 'Authorization: Bearer YOUR_API_KEY' \
  --data-raw '{
      "status": "delivered",
      "actual_arrival_date": "2024-01-18T09:30:00Z",
      "tracking_info": {
          "current_status": "Delivered"
      },
      "shipping_documents": [
          {
              "type": "proof_of_delivery",
              "document_number": "POD-2024-00001",
              "url": "https://documents.stateset.com/pod/POD-2024-00001.pdf"
          }
      ]
  }'
  ```

  ```graphQL GraphQL theme={null}
  mutation UpdateASN($id: ID!, $input: UpdateASNInput!) {
    updateASN(id: $id, input: $input) {
      id
      asn_number
      status
      actual_arrival_date
      tracking_info {
        current_status
        last_update
      }
      shipping_documents {
        type
        document_number
        url
      }
    }
  }
  ```

  ```javascript Node.js theme={null}
  const asn = await stateset.asns.update(
    'asn_0901f083-aa1c-43c5-af5c-0a9d2fc64e30',
    {
      status: 'delivered',
      actual_arrival_date: '2024-01-18T09:30:00Z',
      tracking_info: {
        current_status: 'Delivered'
      },
      shipping_documents: [
        {
          type: 'proof_of_delivery',
          document_number: 'POD-2024-00001',
          url: 'https://documents.stateset.com/pod/POD-2024-00001.pdf'
        }
      ]
    }
  );
  ```

  ```python Python theme={null}
  asn = stateset.asns.update(
      'asn_0901f083-aa1c-43c5-af5c-0a9d2fc64e30',
      status='delivered',
      actual_arrival_date='2024-01-18T09:30:00Z',
      tracking_info={
          'current_status': 'Delivered'
      },
      shipping_documents=[
          {
              'type': 'proof_of_delivery',
              'document_number': 'POD-2024-00001',
              'url': 'https://documents.stateset.com/pod/POD-2024-00001.pdf'
          }
      ]
  )
  ```
</RequestExample>

<ResponseExample>
  ```json Response theme={null}
  {
    "id": "asn_0901f083-aa1c-43c5-af5c-0a9d2fc64e30",
    "object": "asn",
    "asn_number": "ASN-2024-00001",
    "status": "delivered",
    "created_at": "2024-01-15T14:30:00Z",
    "updated_at": "2024-01-18T09:35:00Z",
    "purchase_order_id": "po_123456789",
    "supplier_id": "sup_abc123",
    "warehouse_id": "wh_001",
    "shipment_date": "2024-01-15T14:00:00Z",
    "expected_arrival_date": "2024-01-18T10:00:00Z",
    "actual_arrival_date": "2024-01-18T09:30:00Z",
    "tracking_info": {
      "carrier": "UPS",
      "tracking_number": "1Z999AA10123456784",
      "service_type": "Ground",
      "tracking_url": "https://www.ups.com/track?tracknum=1Z999AA10123456784",
      "current_status": "Delivered",
      "last_update": "2024-01-18T09:30:00Z"
    },
    "items": [
      {
        "id": "asn_item_123",
        "sku": "WBH-001",
        "product_name": "Wireless Bluetooth Headphones",
        "quantity_shipped": 500,
        "quantity_ordered": 500,
        "quantity_received": 0,
        "unit_cost": {
          "amount": 7500,
          "currency": "USD"
        },
        "lot_number": "LOT-2024-001",
        "status": "pending_receipt"
      },
      {
        "id": "asn_item_124",
        "sku": "USB-C-001",
        "product_name": "USB-C Charging Cable",
        "quantity_shipped": 1000,
        "quantity_ordered": 1000,
        "quantity_received": 0,
        "unit_cost": {
          "amount": 450,
          "currency": "USD"
        },
        "lot_number": "LOT-2024-002",
        "status": "pending_receipt"
      }
    ],
    "packaging_details": {
      "total_packages": 10,
      "total_pallets": 2,
      "total_weight": {
        "value": 250,
        "unit": "lb"
      }
    },
    "shipping_documents": [
      {
        "type": "packing_list",
        "document_number": "PL-2024-00001",
        "url": "https://documents.stateset.com/packing-lists/PL-2024-00001.pdf"
      },
      {
        "type": "proof_of_delivery",
        "document_number": "POD-2024-00001",
        "url": "https://documents.stateset.com/pod/POD-2024-00001.pdf"
      }
    ],
    "notes": "Please schedule receiving appointment. Fragile electronics.",
    "metadata": {}
  }
  ```
</ResponseExample>
