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

# Data API

> Send orders, customers, product variants and refunds from your own backend to Eyk over HTTPS, and correct orders and variants from a second system.

Send your orders, customers, product variants and refunds to Eyk over HTTPS, one object or a batch per request. Eyk stores every request and processes it in the night run.

Every field, with its type and meaning, is in the [Data API reference](https://data-api.eykdata.com/docs).

## Before you start

You need:

* The [Custom data](https://docs.eykdata.com/sources/custom-data.md) page, read once.
* The Custom Data API source added in Eyk under **Sources**.
* An API key, created on the **Configure** tab of that source with **Create API key**. The key is shown once.
* Your organization id, the UUID after `/org/` in the URL of your Eyk environment.

## Endpoints

| Object | Endpoint | Key field |
| - | - | - |
| Product variant | `POST https://data-api.eykdata.com/v1/product_variants` | `id` |
| Customer | `POST https://data-api.eykdata.com/v1/customers` | `id` |
| Order | `POST https://data-api.eykdata.com/v1/orders` | `id` |
| Refund | `POST https://data-api.eykdata.com/v1/refunds` | `id` |
| Order update | `POST https://data-api.eykdata.com/v1/order_updates` | `order_id` |
| Product variant update | `POST https://data-api.eykdata.com/v1/product_variant_updates` | `id`, with `id_type` |
| Shipping method rate card | `POST https://data-api.eykdata.com/v1/shipping_methods` | `method_id` |
| Payment method rate card | `POST https://data-api.eykdata.com/v1/payment_methods` | `method_id` |

Every request carries the header `X-API-Key` and a JSON body: one object, or an array of up to 100 objects. Every object carries your `organization_id`. Timestamps are ISO 8601 with a timezone offset, for example `2026-03-14T10:15:00Z`.

**1. Validate a first object**

Send one product variant with `debug=true`. Eyk validates the object and your key and stores nothing. A `200` means the object is accepted.

```bash theme={null}
curl -X POST 'https://data-api.eykdata.com/v1/product_variants?debug=true' \
  -H 'X-API-Key: YOUR_API_KEY' \
  -H 'Content-Type: application/json' \
  -d '{
    "organization_id": "5f6a0c1e-2b3d-4e5f-8a9b-0c1d2e3f4a5b",
    "id": "VASE-BLU",
    "sku": "VB-001",
    "name": "Blue",
    "parent_id": "VASE",
    "parent_name": "Ceramic vase",
    "fallback_unit_cost": 8.50,
    "category_path": ["Home", "Vases"],
    "created_at": "2025-06-01T08:00:00Z",
    "updated_at": "2026-02-20T12:00:00Z"
  }'
```

**2. Send variants and customers**

Repeat without `debug=true` for every variant your order lines refer to, in batches of up to 100. Then send your customers to `/v1/customers`. `email` is optional on a customer; without it Eyk identifies the customer by `id` only.

**3. Send orders**

Refer to the customer and the variants by id. Every amount excludes tax.

```bash theme={null}
curl -X POST 'https://data-api.eykdata.com/v1/orders' \
  -H 'X-API-Key: YOUR_API_KEY' \
  -H 'Content-Type: application/json' \
  -d '{
    "organization_id": "5f6a0c1e-2b3d-4e5f-8a9b-0c1d2e3f4a5b",
    "id": "NV-10432",
    "order_number": "#1043",
    "payment_status": "paid",
    "store_view_id": "nl",
    "store_view_name": "Noor & Vos NL",
    "sales_channel": "web",
    "created_at": "2026-03-14T10:15:00Z",
    "updated_at": "2026-03-14T10:15:00Z",
    "currency": "EUR",
    "subtotal": 90.00,
    "discounts": 10.00,
    "discount_codes": ["SPRING10"],
    "shipping": 5.00,
    "shipping_tax": 1.05,
    "taxes": 17.85,
    "customer": "CUST-8842",
    "shipping_address": { "country": "NL" },
    "meta_data": [{ "key": "carrier", "value": "postnl" }],
    "items": [
      { "id": "NV-10432-1", "quantity": 2, "unit_price": 20.00, "taxes": 8.40, "product_variant": "VASE-BLU" },
      { "id": "NV-10432-2", "quantity": 1, "unit_price": 50.00, "discounts": 10.00, "taxes": 8.40, "product_variant": "TRAY-OAK" }
    ]
  }'
```

`meta_data` holds extra order details, such as the carrier or the pickup point, as key and value pairs. Eyk shows them as **Meta Data**, so you can filter revenue on them. Never send personal data.

> [!NOTE]
>
> `customer` and `product_variant` also take the full object instead of the id. Then you can skip the separate customer and variant requests.

**4. Send refunds**

Send each refund to `/v1/refunds` with the `order_id` of the refunded order, the `amount` refunded for goods, and the refunded lines in `items` when you have them.

**5. Add rate cards**

Optional. Send what a shipping or payment method costs you to `/v1/shipping_methods` or `/v1/payment_methods`. Eyk applies the rate to orders whose `shipping_method_id` or `payment_method_id` names the method and that carry no cost of their own.

```bash theme={null}
curl -X POST 'https://data-api.eykdata.com/v1/shipping_methods' \
  -H 'X-API-Key: YOUR_API_KEY' \
  -H 'Content-Type: application/json' \
  -d '{
    "organization_id": "5f6a0c1e-2b3d-4e5f-8a9b-0c1d2e3f4a5b",
    "method_id": "postnl-standard",
    "method_name": "PostNL standard",
    "flat_cost": 4.35,
    "valid_from": "2026-01-01T00:00:00Z"
  }'
```

A rate applies from `valid_from` until the next rate for the same `method_id`. A rate without costs ends the previous rate.

**6. Send changes as they happen**

Send a record again, in full, with a later `updated_at` whenever it changes. Per `id` the latest `updated_at` wins.

**7. Send corrections from a second system**

Optional. When a second system, such as an ERP, knows the real shipping cost or cost of goods, send an order update. Only the fields you name change. Per field, the update with the highest `priority` wins, then the latest `occurred_at`.

```bash theme={null}
curl -X POST 'https://data-api.eykdata.com/v1/order_updates' \
  -H 'X-API-Key: YOUR_API_KEY' \
  -H 'Content-Type: application/json' \
  -d '{
    "organization_id": "5f6a0c1e-2b3d-4e5f-8a9b-0c1d2e3f4a5b",
    "order_id": "NV-10432",
    "occurred_at": "2026-03-16T07:00:00Z",
    "source_system": "erp",
    "priority": 10,
    "shipping_cost": 4.35,
    "items": [{ "id": "NV-10432-2", "unit_cost": 21.00 }],
    "meta_data": [{ "key": "carrier", "value": "dhl" }]
  }'
```

In `meta_data`, only the keys you send change. Send `null` as a value to withdraw it, so the order's own value applies again.

**8. Update variants by SKU or barcode**

Optional. When a second system, such as a PIM, holds the brand, supplier or cost of your variants, send a product variant update. Set `id_type` to `sku` or `barcode` when that system has no variant `id`. A SKU or barcode updates every variant that carries it, in every store.

```bash theme={null}
curl -X POST 'https://data-api.eykdata.com/v1/product_variant_updates' \
  -H 'X-API-Key: YOUR_API_KEY' \
  -H 'Content-Type: application/json' \
  -d '{
    "organization_id": "5f6a0c1e-2b3d-4e5f-8a9b-0c1d2e3f4a5b",
    "id": "VB-001",
    "id_type": "sku",
    "occurred_at": "2026-03-16T07:00:00Z",
    "source_system": "pim",
    "priority": 10,
    "supplier_id": "SUP-12",
    "supplier_name": "Keramiek Groothandel"
  }'
```

SKUs match regardless of case and surrounding spaces. Barcodes match as GTIN. A UPC also matches its EAN-13. Eyk updates only variants still in your store's catalog.

At equal `priority`, `variant_id` beats `sku`, which beats `barcode`, whatever the `occurred_at`. Send a variant `id` for an exception in one store. Set a field to `null` to clear only the value sent through that `id`. A value sent through a less specific `id` then applies again.

> [!NOTE]
>
> Without `id_type`, Eyk reads `id` as a variant id.

A field that was removed from the API is accepted and ignored, and the response carries a `Warning` header that names it.

## Check it worked

Open the Custom Data API source in Eyk under **Sources**. The **Monitor** tab lists orders, refunds, product variants and customers received per day. Data appears in reports the morning after Eyk's night run.

## Troubleshooting

> [accordion] 422 with a message about the timestamp
>
> A timestamp has no timezone offset. Send `2026-03-14T10:15:00Z` or `2026-03-14T12:15:00+02:00`.

> [accordion] 403 Forbidden
>
> The API key does not belong to this `organization_id`. Check the id after `/org/` in your Eyk URL, and the scope chosen when the key was created.

> [accordion] 422 batch size exceeds maximum
>
> The array holds more than 100 objects. Split it.

> [accordion] 422 duplicate item IDs
>
> Two lines in one order share an `id`. Line ids must be unique within the order.

> [accordion] 200 but the order is missing in reports
>
> Reports update once a night. If the order is still missing the next morning, check the Monitor tab for the day you sent it. Then check that its `variant_id` and `customer_id` values match records you sent.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.