# eSIMPricing Partner API

Version 1

The Partner API lets a brand's own systems do what the partner area does: read and change the profile facts shown on the brand's pages (refund terms, payment methods, support channels, apps), connect and run the plan feed, follow the listing, and count the clicks sent to the brand's site. Webhooks report feed reads and review decisions as they happen. The rules are the partner area's. Plans and prices do not go through it; they come from the [plan feed](https://esimpricing.com/partners/feed-format).

## Quick start

1. Sign in to the [partner area](https://esimpricing.com/partners), open your brand and make a key under "API keys". The key is shown once.
2. Read the profile:

   ```bash
   curl https://esimpricing.com/partners/api/v1/profile \
     -H "Authorization: Bearer esp_YOUR_KEY"
   ```

3. Change a fact:

   ```bash
   curl -X PATCH https://esimpricing.com/partners/api/v1/profile \
     -H "Authorization: Bearer esp_YOUR_KEY" \
     -H "Content-Type: application/json" \
     -d '{
       "facts": { "terms.hotspot": "yes" }
     }'
   ```

4. Read the answer. Each fact comes back as `saved`, `in_review` or `refused`, and a refusal says which values the fact takes.

Every fact, with its identifier, the values it accepts and an example, is listed under [Fields](#fields) at the end of this page.

## 1. Basics

| Item | Value |
|---|---|
| Base URL | `https://esimpricing.com/partners/api/v1` |
| Format | JSON in, JSON out, UTF-8 |
| Authentication | `Authorization: Bearer esp_…` on every request except `/fields`, `/options` and `/feed-check` |
| Content type | `Content-Type: application/json` on every `POST`, `PUT`, `PATCH` and `DELETE`, also when the request has no body. Without it the request is refused with `403` before it reaches the API. |
| Scope | A key belongs to one brand. It reads and changes that brand only. |
| Caching | Responses are never cached. |

Every endpoint, under the base URL:

| Endpoint | Methods | For |
|---|---|---|
| `/me` | `GET` | The key's brand and limits |
| `/profile` | `GET`, `PATCH` | All facts of the profile |
| `/profile/{fact}` | `GET`, `PUT`, `DELETE` | One fact |
| `/profile/history` | `GET` | What was sent and what came of it |
| `/fields`, `/options`, `/options/{fact}` | `GET` | The facts and the values they take (no key) |
| `/feed` | `GET`, `PUT`, `DELETE` | The plan feed |
| `/feed/run`, `/feed/confirm`, `/feed/pause`, `/feed/resume` | `POST` | Feed actions |
| `/feed-check` | `POST` | Check a feed without connecting it (key optional) |
| `/listing` | `GET` | Progress into the price tables |
| `/program` | `GET`, `PUT` | Affiliate program page or tracking link |
| `/logo` | `GET`, `PUT` | The brand's logo |
| `/webhook`, `/webhook/test` | `GET`, `PUT`, `DELETE`, `POST` | Event notifications |
| `/clicks` | `GET` | Clicks sent to the brand |

## 2. Keys

A key is made in the partner area by a member of the brand and acts in that member's name. A brand can hold 5 keys at a time.

- The key is shown once, when it is made. We store only its hash and cannot show it again.
- A key stops working when it is revoked, or when the member who made it no longer manages the brand.
- Send it only in the `Authorization` header, never in a URL.
- A request without a valid key answers `401`.

## 3. Read the profile

`GET /partners/api/v1/profile`

```json
{
  "brand": {
    "slug": "example-mobile",
    "name": "Example Mobile",
    "site": "https://example-mobile.com/",
    "profile_url": "https://esimpricing.com/providers/example-mobile"
  },
  "facts": [
    {
      "id": "terms.refund",
      "group": "support",
      "label": "Refunds",
      "type": "refund",
      "value": {
        "policy": "unused",
        "days": 30,
        "excludes": []
      },
      "standing": "confirmed",
      "confirmed_at": "2026-03-12T08:00:00.000Z",
      "in_review": null
    },
    {
      "id": "terms.hotspot",
      "group": "policies",
      "label": "Hotspot",
      "type": "option",
      "value": null,
      "standing": "none",
      "confirmed_at": null,
      "in_review": null
    }
  ]
}
```

| Field | Meaning |
|---|---|
| `id` | The fact's identifier. Use it as the key when changing the fact. |
| `group`, `label` | Where the fact sits in the profile and what it is called. |
| `type` | The kind of value the fact takes (section 5). |
| `value` | The value in effect, or `null` when nothing is stated. |
| `standing` | `confirmed`: stated by you and in effect. `research`: what our own research found; you have not confirmed it. `none`: nothing is shown. |
| `confirmed_at` | When the value in effect was stored, for a confirmed fact. |
| `in_review` | A value you sent that waits for our review, or `null`. |

## 4. Change the profile

`PATCH /partners/api/v1/profile` (`PUT` is accepted and does the same)

Send the facts to change, keyed by id. Facts you leave out are not touched.

```json
{
  "facts": {
    "terms.refund": {
      "policy": "unused",
      "days": 30
    },
    "terms.hotspot": "yes",
    "facts.idCheck": false
  }
}
```

The answer has one result per fact, in the order sent, and the changed facts as they now stand:

```json
{
  "accepted": 3,
  "results": [
    {
      "id": "terms.refund",
      "status": "saved"
    },
    {
      "id": "terms.hotspot",
      "status": "saved"
    },
    {
      "id": "facts.idCheck",
      "status": "saved"
    }
  ],
  "profile": [
    {
      "id": "terms.refund",
      "value": {
        "policy": "unused",
        "days": 30,
        "excludes": []
      },
      "standing": "confirmed"
    }
  ]
}
```

| `status` | Meaning |
|---|---|
| `saved` | Stored and in effect. It shows on the site with the next data update. |
| `in_review` | Stored and waiting for our review. Values typed freely, such as a payment method of your own, are looked at before they show. |
| `refused` | Not stored. `message` says why, `expected` describes the value the fact takes, `allowed` lists its option values and `example` is a value that would be stored. |
| `unknown_field` | There is no fact with that id. `did_you_mean` names the closest one when there is one. |
| `valid` | Only in a dry run: the value would be stored. |

A refusal reads like this:

```json
{
  "id": "terms.starts",
  "status": "refused",
  "code": "value",
  "message": "Pick one of the options.",
  "expected": "One of the option values, as a string.",
  "allowed": ["connect", "install", "purchase", "varies"],
  "example": "connect"
}
```

### Dry run

Add `"dry_run": true` beside `facts` to check a request without storing anything. Every value is validated and answers `valid` or `refused`; the profile is not touched and the hourly limit is not used.

```json
{
  "dry_run": true,
  "facts": {
    "terms.starts": "connect"
  }
}
```

Rules:

- At most 30 facts in one request, and 30 changes per brand in an hour.
- To withdraw a statement, `DELETE` the fact (section 7).
- Changes are recorded with the key and the member behind it.

## 5. Value types

`GET /partners/api/v1/fields` lists every fact with its type, an example and, for the option types, the values it accepts. It needs no key. The same list is under [Fields](#fields) on this page.

| `type` | JSON value | Example |
|---|---|---|
| `option` | One of the fact's option values, as a string | `"connect"` |
| `options` | A list of the fact's option values, at least one. Where the catalogue says `own_entries`, an entry of your own is written `other:your-name` and goes to review. | `["card", "paypal"]` |
| `boolean` | `true` or `false` | `false` |
| `text` | A string, no longer than the fact's `max_length` | `"Example Mobile Ltd"` |
| `seller` | Who runs the brand. A company: its legal name, as a string. An individual (a sole trader): `{ "type": "individual", "name": … }`, where `name` is a trading name or `null`. A person's own name is never shown. | `"Example Mobile Ltd"`, `{ "type": "individual", "name": null }` |
| `country` | An ISO 3166-1 alpha-2 code | `"SG"` |
| `store_url` | The URL of your own App Store or Google Play listing | `"https://apps.apple.com/app/id123456789"` |
| `refund` | An object: `policy` is `unused` (refund while the eSIM is not installed), `case` (case by case) or `never`; `days` is the refund window or `null`; `excludes` is `[]` or `["unlimited"]` | `{ "policy": "unused", "days": 30 }` |
| `activate` | An object: `days` is the deadline after purchase, `0` for no deadline, or `"varies"`; `at` is `auto` (the plan then starts on its own), `expires` or `null` | `{ "days": 180, "at": "expires" }` |

## 6. Lists of values

The values a fact accepts are their own resource, so a system can load them to fill a dropdown or to check a value before sending it. They need no key.

`GET /partners/api/v1/options` answers every list at once: `lists` describes them and `options` holds the values, keyed by fact id.

`GET /partners/api/v1/options/{fact}` answers one list. The fact is named by its id, or by the last part of the id:

```bash
curl https://esimpricing.com/partners/api/v1/options/facts.payments
curl https://esimpricing.com/partners/api/v1/options/payments
```

```json
{
  "version": "1",
  "field": "facts.payments",
  "label": "Payment methods",
  "type": "options",
  "multiple": true,
  "own_entries": true,
  "count": 204,
  "values": [
    {
      "value": "card",
      "label": "Card"
    },
    {
      "value": "card:visa",
      "label": "Card · Visa"
    },
    {
      "value": "paypal",
      "label": "PayPal"
    }
  ]
}
```

The example is shortened to three of the values.

| Field | Meaning |
|---|---|
| `values` | Every value the fact takes. Send `value`; `label` is the name people see. |
| `multiple` | `true`: the fact takes a list of values. `false`: one value. |
| `own_entries` | `true`: a value that is not in the list can be sent as `other:your-name`. It goes to review. |

Lists grow as methods, currencies and languages are added. A value is never renamed or removed within version 1. A name that is not a list answers `404` with the names that exist.

## 7. One fact

`GET /partners/api/v1/profile/{fact}` answers one fact, in the shape of section 3.

`PUT /partners/api/v1/profile/{fact}` states it. The body is `{ "value": … }`, with `"dry_run": true` to check only.

```bash
curl -X PUT https://esimpricing.com/partners/api/v1/profile/terms.hotspot \
  -H "Authorization: Bearer esp_YOUR_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "value": "yes" }'
```

The answer is `{ "result": …, "fact": … }`: the result of section 4 and the fact as it now stands. A refused value answers `422`.

`DELETE /partners/api/v1/profile/{fact}` withdraws what you stated. The profile then shows what our own research has for the fact, or nothing. The answer is `{ "withdrawn": true, "fact": … }`.

### History

`GET /partners/api/v1/profile/history` lists what was sent for your facts and what came of it, newest first. `?fact=terms.refund` narrows it to one fact; `?limit=` takes 1 to 200 (50 when left out).

```json
{
  "fact": "terms.refund",
  "count": 1,
  "entries": [
    {
      "id": 412,
      "fact": "terms.refund",
      "value": {
        "policy": "unused",
        "days": 30,
        "excludes": []
      },
      "status": "saved",
      "reason": null,
      "sent_at": "2026-03-12T08:00:00.000Z",
      "in_effect_since": "2026-03-12T08:00:00.000Z",
      "sent_by": "ops@example-mobile.com"
    }
  ]
}
```

An entry's `status` is `saved`, `in_review`, `declined` (with the `reason` our reviewer gave), `replaced` (a newer value was sent while it waited) or `refused`.

## 8. Plan feed

The feed itself follows the [Plan Feed API](https://esimpricing.com/partners/feed-format). These endpoints connect it and watch it.

| Request | What it does |
|---|---|
| `GET /feed` | How the feed stands, its last read with the full report, and the eight reads before it. |
| `PUT /feed` | Connects the feed or changes its address, then reads it at once. |
| `POST /feed/run` | Reads the feed now. Use it after you change prices. |
| `POST /feed/confirm` | Releases a read that was held back. |
| `POST /feed/pause`, `POST /feed/resume` | Stops and restarts the scheduled reads. |
| `DELETE /feed` | Disconnects the feed. |

`PUT /feed` takes the address and, when the feed needs one, a token header:

```json
{
  "url": "https://example-mobile.com/.well-known/esimpricing/plans.json",
  "token": {
    "header": "Authorization",
    "value": "Bearer abc123"
  }
}
```

Leave `token` out to keep the one on record; send `"token": null` to remove it. The token is stored encrypted and is never in an answer; `token_header` names the header only.

Every feed endpoint answers the same shape:

```json
{
  "health": {
    "level": "ok",
    "title": "Healthy",
    "detail": "The last read was accepted with 412 plans and 3 warnings.",
    "failed_in_a_row": 0
  },
  "feed": {
    "url": "https://example-mobile.com/.well-known/esimpricing/plans.json",
    "status": "live",
    "token_header": "Authorization",
    "read_every_hours": 6,
    "connected_at": "2026-03-06T09:00:00.000Z",
    "last_good_read_at": "2026-03-12T06:00:04.000Z",
    "next_read_at": "2026-03-12T12:00:00.000Z"
  },
  "last_run": {
    "id": 88,
    "status": "ok",
    "plans": 412,
    "errors": 0,
    "warnings": 3,
    "reasons": [],
    "report": {}
  },
  "runs": [
    {
      "id": 88,
      "started_at": "2026-03-12T06:00:00.000Z",
      "status": "ok",
      "plans": 412,
      "errors": 0,
      "warnings": 3,
      "reasons": []
    }
  ]
}
```

`health.level` says whether our reads are going well: `ok`, `warn` (the last read failed or is held back, and an earlier one still prices the plans), `bad` (four reads in a row failed, or no read has been accepted for seven days or ever), `off` (paused) or `new` (not read yet). `feed.status` says whether the feed's plans are in use. Everyone on the brand is also mailed when a scheduled read is held back and when four in a row fail, then once a day while it stays that way ([Plan Feed API, section 6](https://esimpricing.com/partners/feed-format#6-what-happens-to-a-read)).

| Value | Meaning |
|---|---|
| `feed.status` `draft` | Connected; no read has been accepted yet. |
| `feed.status` `live` | The last accepted read prices the brand. |
| `feed.status` `quarantined` | A read was held back because far fewer plans or very different prices came in. The last accepted read stays in effect until you confirm or the feed is corrected. |
| `feed.status` `paused` | No scheduled reads. |
| run `status` `ok` | Accepted. |
| run `status` `rejected` | The document has errors; nothing was taken from it. `report` lists them. |
| run `status` `quarantined` | Held back; `reasons` says why. |
| run `status` `error` | The feed could not be fetched. |

```bash
curl -X POST https://esimpricing.com/partners/api/v1/feed/run \
  -H "Authorization: Bearer esp_YOUR_KEY" \
  -H "Content-Type: application/json"
```

`POST /feed/run` and `POST /feed/confirm` add `"read"` with the run's status. A feed can be read on request 6 times an hour; the scheduled reads do not count. `confirm` answers `409` when nothing is held back, `run` answers `409` while the feed is paused, and every feed endpoint but `PUT` answers `404` with code `no_feed` before a feed is connected.

## 9. Listing

`GET /partners/api/v1/listing` says where the brand stands on the way into the price tables and what the site shows for it.

```json
{
  "brand": "example-mobile",
  "listed": false,
  "ready": false,
  "missing": ["feed-runs", "tracking"],
  "next_step": "program",
  "steps": [
    {
      "id": "claim",
      "done": true
    },
    {
      "id": "facts",
      "done": true,
      "confirmed": 17,
      "confirmed_needed": 15
    },
    {
      "id": "program",
      "done": false,
      "status": null
    },
    {
      "id": "feed",
      "done": false,
      "status": "live",
      "good_reads": 1,
      "good_reads_needed": 2,
      "plans_that_fit": 412
    }
  ],
  "on_site": null,
  "profile_url": "https://esimpricing.com/providers/example-mobile"
}
```

`profile_url` is null for a brand added in the portal until it is accepted into the directory and the next data update publishes its profile. `listed` is true once the brand is in the price tables; `on_site` then holds `plans`, `destinations`, `prices_as_of` and `prices_from` (`feed` or `capture`). `ready` is true when all four steps are done (15 of the profile facts confirmed among them) and the brand joins the tables with the next data update. `missing` names what is left: `claim`, `facts`, `feed`, `feed-runs`, `feed-plans`, `tracking`.

## 10. Affiliate program and logo

`GET /partners/api/v1/program` answers the program page or tracking link on record, with `reason` when its check did not pass. `PUT` checks and stores one:

```json
{
  "program_url": "https://example-mobile.com/affiliates"
}
```

```json
{
  "program_url": "https://example-mobile.com/affiliates",
  "tracking_link": "https://example-mobile.com/?ref=esimpricing&to={url}&sub={subid}"
}
```

The program page is required: a tracking link counts only beside the affiliate or referral program behind it, and alone answers `400`. A tracking link is on your own domain. A program page is on your own domain and reads as an affiliate or referral program, or is your program's own page on an affiliate network: the network's home page is refused, and the page has to name the brand or carry the program's id in its address. A link that does not pass the check answers `422` with the reason and is kept on record as rejected.

`GET /partners/api/v1/logo` answers the logo on record and one waiting for review. `PUT` sets it:

```json
{
  "url": "https://example-mobile.com/assets/logo.png"
}
```

```json
{
  "auto": true
}
```

`url` is an image on your own site: a raster image (not SVG), at least 64 px, at most 1 MB. It waits for our review (`"status": "in_review"`). `auto` takes your site's icon or your own app store icon and is in effect at once (`"status": "saved"`).

## 11. Webhooks

A webhook is one https address of yours that we POST to when something happens to the brand. Set it with `PUT /partners/api/v1/webhook`:

```json
{
  "url": "https://example-mobile.com/hooks/esimpricing",
  "events": ["feed.failed", "feed.held", "fact.declined"]
}
```

The answer holds `secret` (`whsec_…`) once, when the webhook is first set. Send `"rotate_secret": true` for a new one. Leave `events` out for every event except `feed.ok`.

| Event | When | `data` |
|---|---|---|
| `feed.ok` | A read was accepted. | `run`, `status`, `plans`, `errors`, `warnings`, `feed_status` |
| `feed.failed` | A read was rejected or the feed could not be fetched. | the same, with `reasons` |
| `feed.held` | A read was held back. | the same, with `reasons` |
| `fact.approved` | A value that waited for review is in effect. | `fact`, `value` |
| `fact.declined` | A value that waited for review was declined. | `fact`, `value`, `reason` |
| `logo.approved`, `logo.declined` | A logo that waited for review was decided. | `reason` when declined |

A delivery is a POST with a JSON body:

```json
{
  "id": "evt_1042",
  "event": "feed.failed",
  "brand": "example-mobile",
  "created_at": "2026-03-12T12:00:07.000Z",
  "data": {
    "run": 89,
    "status": "rejected",
    "plans": 0,
    "errors": 4,
    "warnings": 0,
    "reasons": [],
    "feed_status": "live"
  }
}
```

It is sent with `User-Agent: eSIMPricing-Webhooks/1` and carries `X-eSIMPricing-Event`, `X-eSIMPricing-Delivery` and `X-eSIMPricing-Signature: t=<unix seconds>,v1=<signature>`. The signature is the hex HMAC-SHA256 of `<t>.<body>` under your secret. Check it before trusting the body, and refuse a `t` more than five minutes old:

```js
import { createHmac, timingSafeEqual } from "node:crypto";

function verify(secret, header, rawBody) {
  const { t, v1 } = Object.fromEntries((header ?? "").split(",").map((p) => p.split("=")));
  if (!t || !v1 || Math.abs(Date.now() / 1000 - Number(t)) > 300) return false;
  const want = createHmac("sha256", secret).update(`${t}.${rawBody}`).digest("hex");
  return v1.length === want.length && timingSafeEqual(Buffer.from(v1), Buffer.from(want));
}
```

The same in Python:

```python
import hashlib, hmac, time

def verify(secret: str, header: str, raw_body: bytes) -> bool:
    parts = dict(p.split("=", 1) for p in (header or "").split(",") if "=" in p)
    t, v1 = parts.get("t"), parts.get("v1")
    if not t or not v1 or abs(time.time() - int(t)) > 300:
        return False
    want = hmac.new(secret.encode(), t.encode() + b"." + raw_body, hashlib.sha256).hexdigest()
    return hmac.compare_digest(v1, want)
```

Use the body exactly as received: parsing and re-serialising the JSON changes the bytes the signature covers.

Answer `2xx` within 5 seconds. Anything else is retried up to 6 times over about a day, each retry signed afresh. The same event can arrive twice; use `id` to tell. The events and their body are also in the OpenAPI description, under `webhooks`.

`GET /partners/api/v1/webhook` answers the webhook and its last 20 deliveries. `POST /partners/api/v1/webhook/test` sends a `test` event now and answers what your address returned. `DELETE /partners/api/v1/webhook` removes it.

## 12. Clicks

`GET /partners/api/v1/clicks?days=30` answers how many people clicked from eSIMPricing to your site, by day and by destination. `days` takes 1 to 90. Crawlers are not counted.

```json
{
  "brand": "example-mobile",
  "days": 30,
  "total": 184,
  "by_day": [
    {
      "day": "2026-03-11",
      "clicks": 9
    }
  ],
  "by_destination": [
    {
      "destination": "japan",
      "clicks": 41
    }
  ]
}
```

A click with no destination (from the brand's profile, for example) is counted under `other`. Numbers are refreshed every ten minutes.

## 13. The key itself

`GET /partners/api/v1/me` says which brand the key belongs to and what it may still do this hour. It is the request to start an integration with.

```json
{
  "brand": {
    "slug": "example-mobile",
    "name": "Example Mobile",
    "site": "https://example-mobile.com/"
  },
  "key": {
    "name": "CMS sync",
    "ends_with": "x7Qa",
    "made_at": "2026-03-12T08:00:00.000Z",
    "made_by": "ops@example-mobile.com"
  },
  "limits": {
    "facts_per_request": 30,
    "changes_per_hour": 30,
    "changes_left": 30,
    "feed_reads_per_hour": 6,
    "feed_reads_left": 6
  }
}
```

## 14. Errors

An error answers with a status and a body of the form `{ "error": { "code": "…", "message": "…" } }`.

| Status | `code` | Meaning |
|---|---|---|
| `400` | `json`, `body`, `empty`, `too_many` | The body is not JSON, has no `facts` object, has no facts, or has more than 30. |
| `401` | `unauthorized` | No key, a header in another form than `Bearer esp_…`, an unknown or revoked key, or the key's maker left the brand. The message says which. |
| `403` | | A `POST`, `PUT`, `PATCH` or `DELETE` without `Content-Type: application/json`. The body of this answer is plain text. |
| `404` | `not_found`, `unknown_field`, `no_list`, `no_feed`, `no_webhook` | No such endpoint, no such fact or list of values, or nothing of that kind is set yet. |
| `405` | `method` | The endpoint does not take that method. `Allow` lists the ones it does. |
| `409` | `not_held`, `paused` | The feed is not in the state the action needs. |
| `413` | `too_large` | The body is over 100 kB. |
| `415` | `content_type` | The body was not sent as `application/json`. |
| `422` | | Nothing in the request could be stored. The body is the usual answer of section 4, with a result per fact. |
| `429` | `rate` | An hourly limit: 30 changes of facts, 6 feed reads on request, 10 test events. `Retry-After` says when to try again. |
| `503` | `unavailable` | The data behind the endpoint cannot be read right now. |

A request in which some facts are stored and others refused answers `200`; read `results`.

## 15. Reference

- Base: `GET https://esimpricing.com/partners/api/v1` answers with the addresses below.
- OpenAPI 3.1: `https://esimpricing.com/partners/api-v1.json`
- This document as Markdown: `https://esimpricing.com/partners/api-docs.md`
- Field catalogue: `https://esimpricing.com/partners/api/v1/fields`
- Lists of values: `https://esimpricing.com/partners/api/v1/options`
- Feed checker: `POST https://esimpricing.com/partners/api/v1/feed-check` checks a plan feed (a URL, or the document itself) and answers with the report. The one keyless endpoint that takes POST; a key is optional and raises its limits. See the Plan Feed API, section 7.1: `https://esimpricing.com/partners/feed-format#71-check-from-code`.

## 16. Versions

The version is part of the path. Fields may be added to answers and new facts to the catalogue within version 1; a client must ignore what it does not know. A change that would break existing clients gets a new path (`/v2`), and version 1 keeps answering for at least six months after that.

