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

# Export Fulfillments

> Download all issued codes for a completed order as a CSV file

Returns a time-limited pre-signed download URL for the full code set of a completed order in CSV format. Use this for large or bulk orders where downloading individual items via `GET /v2/orders/{orderId}/items` would be inefficient.

<Note>
  The download URL is time-limited and expires at `expiresAt`. Download the file promptly after receiving the response.
</Note>

## Endpoint

**GET /v2/orders/\{orderId}/fulfillments/export**

## Path Parameters

| Name      | Type   | Required | Description                                |
| --------- | ------ | -------- | ------------------------------------------ |
| `orderId` | string | Yes      | The order ID returned by `POST /v2/orders` |

## Example Request

```bash theme={null}
curl -X GET "https://partner.orbt.com/v2/orders/ORD-123456/fulfillments/export" \
  -H "x-api-key: YOUR_API_KEY" \
  -H "x-client-id: YOUR_CLIENT_ID" \
  -H "x-timestamp: 2026-08-13T10:00:00.000Z" \
  -H "x-body-hash: BODY_HASH" \
  -H "x-signature: SIGNATURE"
```

```javascript theme={null}
const orderId = 'ORD-123456';

// Step 1 — get the download URL
const response = await fetch(
  `https://partner.orbt.com/v2/orders/${orderId}/fulfillments/export`,
  {
    method: 'GET',
    headers: {
      'x-api-key': 'YOUR_API_KEY',
      'x-client-id': 'YOUR_CLIENT_ID',
      'x-timestamp': timestamp,
      'x-body-hash': bodyHash,
      'x-signature': signature
    }
  }
);

const { data } = await response.json();

// Step 2 — download the CSV directly (no auth headers needed)
const csv = await fetch(data.downloadUrl);
const text = await csv.text();
```

## Response — 200 OK

```json theme={null}
{
  "data": {
    "format": "csv",
    "downloadUrl": "https://orbt-fulfillments.s3.amazonaws.com/ORD-123456.csv?X-Amz-Expires=3600&X-Amz-Signature=...",
    "expiresAt": "2026-08-13T11:00:00Z"
  }
}
```

## Response Fields

| Field         | Type     | Description                                                         |
| ------------- | -------- | ------------------------------------------------------------------- |
| `format`      | string   | File format — always `csv`                                          |
| `downloadUrl` | string   | Pre-signed S3 URL. No additional auth headers required to download. |
| `expiresAt`   | datetime | URL expiry timestamp. Download before this time.                    |

## CSV Structure

The exported CSV contains one row per issued code with the following columns:

| Column           | Description                             |
| ---------------- | --------------------------------------- |
| `itemNo`         | Sequential item number within the order |
| `productId`      | Product identifier                      |
| `brand`          | Brand name                              |
| `currency`       | Currency of the issued code             |
| `faceValue`      | Face value of this code                 |
| `cardIdentifier` | Unique internal identifier              |
| `giftCardNumber` | The redemption code                     |
| `giftCardPin`    | PIN, if applicable                      |
| `barCodeNumber`  | Barcode number, if applicable           |
| `redemptionUrl`  | Redemption URL                          |

## Error Responses

| Status | Code                      | Description                               |
| ------ | ------------------------- | ----------------------------------------- |
| `401`  | `AUTHENTICATION_ERROR`    | Missing or invalid authentication headers |
| `404`  | `RESOURCE_NOT_FOUND`      | Order not found                           |
| `409`  | `BUSINESS_RULE_VIOLATION` | Order not yet completed                   |
