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

# Attach Shipments to Appointment

> Link one or more shipments to an appointment

Attach one or more shipments to this appointment. Idempotent — shipments already linked are
silently skipped. Mirror of [Attach Appointments to
Shipment](/api/shipments/attach-appointments-to-shipment).

The mutation rule (per shipment) is: the link can be created when EITHER

* the appointment is past blood-draw (`blood_drawn`), or
* the shipment was created less than 24 hours ago.

Outside that window the call is rejected with `409 Conflict`.

## Request

### Path parameters

<ParamField path="id" type="string" required>
  Appointment UUID.
</ParamField>

### Body parameters

<ParamField body="shipment_ids" type="string[]" required>
  Array of shipment reference IDs to attach. Must contain at least one item.
</ParamField>

## Response

On success, the API returns `200 OK` with the full shipment list for the appointment, ordered
newest-first by creation. Each entry has the same shape as [Get
Shipment](/api/shipments/get-shipment).

## Error responses

| Status | Description                                                                                                                      |
| ------ | -------------------------------------------------------------------------------------------------------------------------------- |
| `400`  | Validation error — e.g., empty `shipment_ids` or malformed reference.                                                            |
| `403`  | Forbidden — missing scope, appointment outside access context, or shipment outside access context.                               |
| `404`  | Appointment not found, or one or more shipments not found.                                                                       |
| `409`  | Mutation rule failed — appointment not past blood-draw and at least one shipment is older than 24 hours. Response lists the IDs. |
| `500`  | Internal server error.                                                                                                           |

<RequestExample>
  ```bash cURL theme={null}
  curl --request POST \
    --url https://anivahealth.com/api/v1/appointments/c9f3e2a1-7d6b-4c5e-b3a2-1f0e9d8c7b6a/shipments \
    --header 'x-api-key: YOUR_API_KEY' \
    --header 'Content-Type: application/json' \
    --data '{
      "shipment_ids": ["P2604154821"]
    }'
  ```
</RequestExample>

<ResponseExample>
  ```json 200 theme={null}
  [
    {
      "id": "P2604154821",
      "status": "pending",
      "logistics_provider": "go",
      "tracking_number": null,
      "origin": null,
      "destination": null,
      "pickup": null,
      "notes": null,
      "status_updates": [],
      "appointments": [
        {
          "id": "c9f3e2a1-7d6b-4c5e-b3a2-1f0e9d8c7b6a",
          "added_at": "2026-04-15T08:30:00Z"
        }
      ],
      "created_at": "2026-04-15T07:00:00Z",
      "updated_at": "2026-04-15T08:30:00Z"
    }
  ]
  ```
</ResponseExample>
