---
title: Testing
description: Check an access token with GET /v1/health, test a write request with a dry run, and check your integration before you go live.
---

## Check the access token

`GET https://api.optifeed.com/v1/health`

```bash
curl https://api.optifeed.com/v1/health \
  -H "Authorization: Bearer $OPTIFEED_TOKEN"
```

The answer is `200 OK`:

```json
{
  "status": "ok",
  "request_id": "6f1c0e5a-2b7d-4c1e-9a43-0d8f2c1b7e55"
}
```

- The health endpoint checks the access token and the company. It gives the same `401` and `403` codes as the other endpoints. [Errors](/docs/api/errors#error-codes) gives each code.
- It does not change your data.
- It does not check the catalog of the API, so it never gives `catalog_inactive`.
- It counts in the rate limit of the API user.

## Test a write request with a dry run

Add `?dry_run=true` to a write request. Optifeed checks the request and each record, and gives the answer of a real request. It stores nothing.

You can test each write endpoint:

- `POST /v1/orders`, `POST /v1/customers`, `POST /v1/products` and `POST /v1/campaigns`
- `DELETE /v1/products/{sku}`, `DELETE /v1/customers/{id}` and `DELETE /v1/campaigns/{id}`

This request sends one valid order and one order with a JSON number as `total`:

```bash
curl "https://api.optifeed.com/v1/orders?dry_run=true" \
  -H "Authorization: Bearer $OPTIFEED_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "orders": [
      {
        "id": "A-1",
        "created_at": "2026-11-20T14:05:00+03:00",
        "updated_at": "2026-11-20T14:05:00+03:00",
        "currency": "TRY",
        "total": "199.90",
        "customer": { "id": "C-9" },
        "line_items": [{ "sku": "SKU-1", "quantity": 1 }]
      },
      {
        "id": "A-2",
        "created_at": "2026-11-20T15:10:00+03:00",
        "updated_at": "2026-11-20T15:10:00+03:00",
        "currency": "TRY",
        "total": 199.9,
        "customer": { "id": "C-10" },
        "line_items": [{ "sku": "SKU-1", "quantity": 1 }]
      }
    ]
  }'
```

The answer is `202 Accepted`, with `"dry_run": true`:

```json
{
  "accepted": 1,
  "rejected": 1,
  "stale": 0,
  "errors": [
    {
      "position": "orders[1]",
      "id": "A-2",
      "param": "total",
      "code": "amount_not_text",
      "message": "Send the amount as decimal text, for example \"199.90\", not as a JSON number."
    }
  ],
  "warnings": [],
  "dry_run": true,
  "request_id": "6f1c0e5a-2b7d-4c1e-9a43-0d8f2c1b7e55"
}
```

### What a dry run checks

- The access token, the company and the rate limit.
- The size of the body, the JSON and the list.
- Each record, with the errors and the warnings of a real request.
- For products and campaigns: the state of the catalog. A catalog that is not active gives `409` with `catalog_inactive`.
- For a `DELETE`: the `sku` or the `id`. The answer is the `202` or the `404` of a real delete.

### What a dry run does not do

- It stores no record and deletes no record.
- It creates no catalog and starts no background job.
- It does not compare the records with the stored records. So `stale` is always `0`, and no product gets the warning `stale`. A real request can then count some records as stale, and `accepted` can be lower.
- It does not wait for the orders of your company, so it never gives `order_log_busy`.

### Rules of the parameter

- Send `dry_run` only in the query string. Optifeed ignores a `dry_run` key in the JSON body.
- Send only `true` or `false`. Another value, for example `dry_run=1` or `dry_run` with no value, gets `400` with the code `invalid_dry_run`. Optifeed then stores nothing.
- `dry_run=false` is a real request.
- `GET /v1/health` ignores `dry_run`.
- A dry run counts in the rate limit. Optifeed keeps the record of the request, with a mark that it was a dry run.

## Before you go live

Check each item before your system sends live data:

1. Each system has its own API user. The client secret is only on your server.
2. Your system uses one access token for its full hour, and signs in again after `token_expired`.
3. Each request has 1,000 records at most and 5 MB at most.
4. Each amount is decimal text, and each time has a time zone offset.
5. The `updated_at` of a record is newer after each change, and never more than 24 hours in the future.
6. Your system reads `rejected`, `stale`, `errors` and `warnings` of each `202` answer, and logs the `request_id`.
7. Your system sends the same request again after an error with `retryable: true`, for example `rate_limited` or `order_log_busy`. After `429`, it waits for the seconds in `Retry-After`.
8. After a record error, your system corrects the record before it sends the record again.
9. Your system reads a `404` of a `DELETE` as "the record is not in Optifeed", and does not send the delete again.
10. Your system sends contact hashes, never a plain email or phone number. The answers have no `invalid_hash` warning.
11. You read the `content_gap` warnings of your products and campaigns.
12. The settings of your live system do not have `dry_run=true`. The answers have no `dry_run` field.
