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

> Update shipment details before shipping

<Note>
  This endpoint updates shipment details. Only shipments with status "label\_created" can be modified. Once picked up, use the cancel endpoint to void.
</Note>

## Authentication

This endpoint requires a valid API key with `shipments:write` permissions.

```bash theme={null}
Authorization: Bearer YOUR_API_KEY
```

## Path Parameters

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

## Request Body

<ParamField body="ship_date" type="string">
  New scheduled ship date (ISO 8601)
</ParamField>

<ParamField body="service_type" type="string">
  Updated service level
</ParamField>

<ParamField body="signature_required" type="boolean">
  Update signature requirement
</ParamField>

<ParamField body="saturday_delivery" type="boolean">
  Update Saturday delivery option
</ParamField>

<ParamField body="insurance" type="object">
  Update insurance options

  <Expandable title="Insurance properties">
    <ParamField body="enabled" type="boolean">
      Enable/disable insurance
    </ParamField>

    <ParamField body="amount" type="integer">
      Insurance value in cents
    </ParamField>
  </Expandable>
</ParamField>

<ParamField body="reference_numbers" type="object">
  Update reference numbers
</ParamField>

<ParamField body="metadata" type="object">
  Update custom fields
</ParamField>

### Response

Returns the updated shipment object.

<RequestExample>
  ```bash cURL theme={null}
  curl --location --request PUT 'https://api.stateset.com/v1/shipments/ship_0901f083-aa1c-43c5-af5c-0a9d2fc64e30' \
  --header 'Content-Type: application/json' \
  --header 'Authorization: Bearer YOUR_API_KEY' \
  --data-raw '{
      "ship_date": "2024-01-21T08:00:00Z",
      "service_type": "express",
      "insurance": {
          "enabled": true,
          "amount": 20000
      }
  }'
  ```

  ```javascript Node.js theme={null}
  const shipment = await stateset.shipments.update(
    'ship_0901f083-aa1c-43c5-af5c-0a9d2fc64e30',
    {
      ship_date: "2024-01-21T08:00:00Z",
      service_type: "express",
      insurance: {
        enabled: true,
        amount: 20000
      }
    }
  );
  ```
</RequestExample>

<ResponseExample>
  ```json Response theme={null}
  {
    "id": "ship_0901f083-aa1c-43c5-af5c-0a9d2fc64e30",
    "object": "shipment",
    "status": "label_created",
    "updated_at": "2024-01-19T16:00:00Z",
    "ship_date": "2024-01-21T08:00:00Z",
    "carrier": "ups",
    "service_type": "express",
    "rate": {
      "amount": 2850,
      "currency": "USD",
      "estimated_delivery_date": "2024-01-22T18:00:00Z"
    },
    "insurance": {
      "enabled": true,
      "amount": 20000,
      "currency": "USD"
    }
  }
  ```
</ResponseExample>
