---
url: https://docs.dataflair.ai/marketplace/ad-server-api/testing.md
description: >-
  How to check your ad server API before you connect it, with the conformance
  check and the fixtures, and where the Verify button is in DataFlair.
---

# Testing your implementation

Check your API in three steps. Do the first two before you connect. The third is the real check, and it runs in DataFlair.

## 1. Run it locally, before you deploy

Run the [conformance check](/marketplace/ad-server-api/conformance) against your server. It replays the fixtures and prints a pass or a fail for each case, with a link to the section that explains each failure. It runs against localhost and needs no DataFlair account.

```bash
node tools/adserver-check/bin/adserver-check.mjs http://localhost:3000/api/v1 --key sk_test_local
```

The checker is not published to npm yet. [Conformance check](/marketplace/ad-server-api/conformance) says where it is and how to run it. Add `--only orders` to check one endpoint.

A failing case shows the value it found and links to the rule. This is the first failing case of a server that returns its orders as `ACTIVE`:

```text
✗ POST /orders         201  Creates a draft order
    Order "ord_55021" returned as "ACTIVE". It must come back as DRAFT and must not serve.
    Line item "li_88012" returned as "ACTIVE". Every line item must come back as DRAFT and must not serve.
    → See https://docs.dataflair.ai/marketplace/ad-server-api/operations/orders#draft-only
```

### Or by hand

Send each request to your own server with `curl`. Every endpoint page has a `curl` tab that you can copy:

| Endpoint | Page |
| --- | --- |
| `GET /health` | [Health](/marketplace/ad-server-api/operations/health) |
| `GET /inventory` | [Inventory](/marketplace/ad-server-api/operations/inventory) |
| `POST /forecast` | [Forecast](/marketplace/ad-server-api/operations/forecast) |
| `POST /orders` | [Orders](/marketplace/ad-server-api/operations/orders) |
| `POST /reports` | [Reports](/marketplace/ad-server-api/operations/reports/) |

Set `BASE_URL` and `API_KEY` first:

```bash
export BASE_URL=http://localhost:3000/api/v1
export API_KEY=sk_test_local
```

Check each answer against the fields table on the page. Then check these rules, which are the ones that break most often:

* `GET /health` returns `timezone` as a real IANA name, `currency` as three uppercase letters, and `capabilities` as booleans with `reporting` and `draft_booking` set to `true`.
* `POST /orders` returns `status: "DRAFT"` for the order and every line. It does not activate anything. See [Draft only](/marketplace/ad-server-api/operations/orders#draft-only).
* A repeat of the same `idempotency_key` and body returns the same ids. The same key with a different body returns `409`.
* `line_item_id` values do not change when a line is renamed.

## 2. Compare with the fixtures

The [fixtures](/marketplace/ad-server-api/fixtures) are the requests DataFlair sends, each with an answer that passes. `exemplary/` holds the happy path. `supplemental/` holds errors and edge cases.

[Download all fixtures (.zip)](/downloads/ad-server-api-fixtures.zip)

## 3. Connect and verify in DataFlair

The Verify button is in the DataFlair Marketplace app. Only workspace owners and admins can use it.

1. Go to **Settings**, then **Ad server**.
2. Choose the **Custom ad server** card. Its description is "Connect over a bearer API key."
3. Enter your **Base URL**, for example `https://ads.example.com`. It is the HTTPS root DataFlair calls `/health` against.
4. Enter your **API key**.
5. Click **Connect & verify**.

DataFlair then runs a short read-only probe. It creates nothing.

1. It calls `GET /health` with your key. This decides whether the connection is **Connected**.
2. If `/health` succeeds, it calls `GET /inventory?limit=1`. This confirms **Inventory read**.

The card then shows your account name, timezone and currency, the time of the last verification, and a capability checklist.

| Capability | State today |
| --- | --- |
| Inventory read | **Confirmed** when `GET /inventory` returns a `data` array. Otherwise **Not verified**. |
| Forecast | **Not verified**. "Not built yet." |
| Reporting | **Not verified**. "Not built yet." |
| Draft booking | **Not verified**. "Not built yet." |

After you change your API, click **Re-verify** on the card. To start again, click **Disconnect**.

If the card shows an error, see [Errors](/marketplace/ad-server-api/errors#what-the-dataflair-connection-card-shows) and [Troubleshooting](/marketplace/ad-server-api/troubleshooting).
