> For the complete documentation index, see [llms.txt](https://docs.rtkdata.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.rtkdata.com/enterprise-portal/api/api-guide.md). Agents can also search and read this documentation through its [MCP server](https://docs.rtkdata.com/~gitbook/mcp).

# Enterprise API v2 Guide: Devices, Fleets & Webhooks

The API v2 guide for Enterprise accounts: devices, fleets, contingents, bills, events, signed webhooks and the test sandbox.

API v2 lets your own systems do what your team does in the Enterprise Portal: create device logins, buy stream contingents and cut fleets from them, read credentials, follow connections, reconcile your monthly bill and hear about all of it through events.

> The API is enabled per account by RTKdata. Ask your RTKdata contact or <support@rtkdata.com> to have it switched on.

|                    |                                                                                                                                                                                                                       |
| ------------------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Base URL           | `https://enterprise.rtkdata.com/v2`                                                                                                                                                                                   |
| OpenAPI document   | `https://enterprise.rtkdata.com/v2/openapi.json?accountKind=enterprise` (no key needed)                                                                                                                               |
| Version descriptor | `GET /v2/meta` (no key needed): status, deprecation and sunset dates, the timestamp format                                                                                                                            |
| In the portal      | **API > Docs**: every endpoint with a working curl, its fields and its errors, generated from the OpenAPI document. **Build with AI** downloads the whole reference as one Markdown file for your AI coding assistant |

This page is the guide: the concepts, the rules every call follows and an overview of the endpoints. The field-by-field reference is the OpenAPI document and **API > Docs** in the portal. Every refusal is explained in the [error catalogue](https://docs.rtkdata.com/enterprise-portal/api/api-guide/api-errors.md).

***

## Quickstart

1. In the portal, open **API** and create a **test key** under **Keys**. It starts with `rtk_test_` and only ever touches test data.
2. Read your account to check the key works:

   ```bash
   curl https://enterprise.rtkdata.com/v2/account \
     -H "Authorization: Bearer rtk_test_xxxxxxxxxxxx"
   ```
3. List the products agreed for your account and note the id of a device product:

   ```bash
   curl https://enterprise.rtkdata.com/v2/account/products \
     -H "Authorization: Bearer rtk_test_xxxxxxxxxxxx"
   ```
4. Create a device login with that product:

   ```bash
   curl -X POST https://enterprise.rtkdata.com/v2/licenses \
     -H "Authorization: Bearer rtk_test_xxxxxxxxxxxx" \
     -H "Idempotency-Key: asset-4711-login" \
     -H "Content-Type: application/json" \
     -d '{
       "kind": "paid",
       "productId": "prd_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
       "metadata": { "assetId": "4711" }
     }'
   ```
5. Read the login with `GET /v2/licenses/{id}/credentials` and hand it to the device or the person in the field.
6. Before the term ends, extend it with `POST /v2/licenses/{id}/extend`, or switch `autoRenew` on and let RTKdata renew it.

With a test key you can [move the license's clock forward](#test-sandbox) and watch the whole term pass in minutes. Going live changes the key and nothing else.

***

## Concepts

### Devices and fleets

Every NTRIP login of your account is a **license** in the API. Its `credentialType` says which kind it is:

| `credentialType` | What it is                                                     | How you get one                                                              |
| ---------------- | -------------------------------------------------------------- | ---------------------------------------------------------------------------- |
| `device`         | One login with one stream, for one receiver                    | `POST /v2/licenses`, at one of your device products or at the standard terms |
| `fleet`          | One login with several streams, shared by a group of receivers | Cut from a stream contingent with `POST /v2/contingents/{id}/fleets`         |

Your logins belong to your account directly, there are no customer records in between. Whether your account may hold devices, fleets or both is part of your contract; `GET /v2/account/capabilities` tells your software up front.

### Stream contingents

A **contingent** is a number of streams bought for a term. You cut fleets from its free streams, move streams between fleets, free them again, top the contingent up and renew it. Every fleet of a contingent ends with it, and a renewal gives every running fleet the new end first. A fleet carries its `contingentId`.

RTKdata can grant your account a **trial contingent**. Trial fleets and trial devices come from it, and `POST /v2/contingents/{id}/fleets/{licenseId}/convert` buys a contingent for a trial fleet so it keeps its login. You cannot start a trial on your own: `POST /v2/licenses` with `kind: "trial"` answers `not_available_for_account`.

### Products

`GET /v2/account/products` lists the products agreed for your account, each with its fixed price and term for a device or a fleet stream. Pass `productId` when you buy; the product then sets the term and price, so leave `months`, `days` and `expiresAt` out.

### A license has an end

A license is valid until an absolute end, `expiresAt`. You buy access time by creating it and by extending it; when nobody extends it and auto renew is off, it ends by itself.

| Field                                   | Meaning                                                                                                |
| --------------------------------------- | ------------------------------------------------------------------------------------------------------ |
| `credentialType`                        | `device` or `fleet`                                                                                    |
| `contingentId`                          | For a fleet, the contingent it was cut from                                                            |
| `productId`                             | The product it was bought with, `null` at the standard terms                                           |
| `validFrom`                             | Start of the first period                                                                              |
| `expiresAt`                             | End of the access time you bought                                                                      |
| `accessEndsAt`                          | When the login stops working, holds aside. Do not plan with any time after `expiresAt`                 |
| `reinstatableUntil`                     | Until when an expired or ended license can be brought back; `null` while it is running                 |
| `archivedAt`                            | When you archived it, `null` otherwise                                                                 |
| `holds`                                 | The open holds, each with its `owner` (`partner` for yours, `rtkdata` for RTKdata's), reason and start |
| `pendingOperation`                      | A change that is still running or unresolved, with its operation id; `null` otherwise                  |
| `firstConnectionAt`, `lastConnectionAt` | What the caster has seen of this login                                                                 |
| `autoRenew`                             | Whether RTKdata renews the license by its last term at the end                                         |
| `tagIds`                                | The tags on it                                                                                         |
| `metadata`                              | Up to 20 string pairs of your own (keys up to 40 characters, values up to 500)                         |
| `sequence`                              | The license's version, bumped by every change, the same number its events carry                        |

### Statuses

| `status`       | Meaning                                                      | Login                                  |
| -------------- | ------------------------------------------------------------ | -------------------------------------- |
| `provisioning` | A create is running or unresolved                            | Not usable yet                         |
| `active`       | Access is granted, no hold                                   | Works                                  |
| `suspended`    | At least one hold is open                                    | Refused                                |
| `expired`      | `expiresAt` has passed                                       | Refused once `accessEndsAt` has passed |
| `ended`        | You or RTKdata ended it early                                | Refused                                |
| `removed`      | The reinstatement deadline has passed                        | Refused; the license stays readable    |
| `failed`       | The create conclusively failed, nothing was bought or billed | None                                   |

Archiving is separate from the status: an archived license keeps its status, term, streams and bill, but the caster refuses its login until you unarchive it.

What each call does:

| Call                           | Running                     | `suspended`                                                   | `expired`          | `ended`                                       |
| ------------------------------ | --------------------------- | ------------------------------------------------------------- | ------------------ | --------------------------------------------- |
| `extend`                       | Adds time after `expiresAt` | Adds time                                                     | Adds time from now | `reinstate_required` unless `reinstate: true` |
| `end`                          | Ends now                    | Ends now                                                      | Ends now           | Unchanged, 200                                |
| `suspend`                      | Places your hold            | Unchanged if your hold is open                                | `invalid_state`    | `invalid_state`                               |
| `reactivate`                   | Unchanged, 200              | Clears your hold; `hold_by_rtkdata` if only RTKdata's remains | `invalid_state`    | `invalid_state`                               |
| `archive`, `unarchive`         | Yes                         | Yes                                                           | Yes                | Yes                                           |
| `PATCH` (metadata, auto renew) | Yes                         | Yes                                                           | Yes                | Yes                                           |

In `provisioning`, every changing call answers `operation_in_progress`; in `removed`, `license_removed`; in `failed`, `invalid_state` (make a new create with a new key). A call that changes nothing answers 200 with the unchanged license and produces no event.

### Grants

Every purchase is recorded as a **grant** with the price frozen at purchase, your idempotency key and the metadata of the purchase call. It never changes. Your monthly bill lists the grants not yet billed, one line each: `GET /v2/grants?invoiceId=` is the annex of a bill, `GET /v2/grants?unbilled=true` the next bill so far, `GET /v2/grants?licenseId=` the history of a license.

### Holds

A license is `suspended` while it has at least one hold. You place and clear your own with `suspend` and `reactivate`. RTKdata can place its own, and only RTKdata clears it. Buying time never clears a hold.

### Test and live

|                                                            | Test                               | Live                   |
| ---------------------------------------------------------- | ---------------------------------- | ---------------------- |
| Key prefix                                                 | `rtk_test_`                        | `rtk_live_`            |
| Credentials                                                | Valid in shape, never connect      | Real                   |
| Billing                                                    | Never; a bill preview is available | Yes                    |
| Clock                                                      | Can be advanced per license        | Real time              |
| Quotes, tickets, documents, team and notification settings | Empty, nothing changes             | Real                   |
| Data                                                       | Invisible to live keys             | Invisible to test keys |

Both environments run the same code. An id from the other environment answers 404. **API > Test data** in the portal shows everything your test keys created.

***

## Authentication and scopes

Send your key as a bearer token on every request:

```
Authorization: Bearer rtk_test_xxxxxxxxxxxx
```

A key carries one or more **scopes**; each endpoint names the one it needs.

| Scope                                       | Allows                                                                                                                       |
| ------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------- |
| `account:read`                              | Your account, products, prices, capabilities, support agreement, setup state, the activity feed                              |
| `account:write`                             | Ask RTKdata to change your company and contact details                                                                       |
| `licenses:read`                             | Read and list devices, fleets, contingents, tags, diagnostics, bulk orders and claimed hardware                              |
| `licenses:provision`                        | Buy devices and contingents, extend, convert, cut fleets, top up and renew, bulk orders, price previews, the sandbox helpers |
| `licenses:write`                            | End, suspend, reactivate, archive, metadata and auto renew, tags, stream transfers and releases, claim codes and slots       |
| `credentials:read`                          | Read logins, one at a time or up to 500 at once                                                                              |
| `bills:read`                                | Grants and bills                                                                                                             |
| `quotes:read`, `quotes:write`               | Quotes from RTKdata: read them; ask for one, order or decline it                                                             |
| `tickets:read`, `tickets:write`             | Support tickets: read them; open, answer and close them                                                                      |
| `documents:read`                            | The files RTKdata shared with your account                                                                                   |
| `events:read`                               | The event feed                                                                                                               |
| `stats:read`                                | The stats roll-ups and the request log                                                                                       |
| `requests:read`                             | One logged call with what it sent and received                                                                               |
| `sessions:read`                             | Caster sessions, live connections, tracks and usage per day                                                                  |
| `webhooks:manage`                           | Webhook endpoints and their deliveries                                                                                       |
| `keys:manage`                               | API keys of the key's own environment                                                                                        |
| `members:manage`                            | Your team: invite, change, remove (live keys only)                                                                           |
| `notifications:read`, `notifications:write` | The account's inbox and its settings (settings: live keys only)                                                              |

Give each integration only the scopes it needs, and harden live keys with an expiry or an IP allowlist. Rotate them on a schedule with `POST /v2/api-keys/{id}/rotate`: a successor with the same settings, the old key expires after an overlap of 24 hours by default. Creating and revoking keys in the portal needs the **API: Manage** right, see [Team & Rights](https://docs.rtkdata.com/enterprise-portal/team.md).

A missing scope answers `403 insufficient_scope`. If the API is switched off for your account, every key answers `403 api_disabled`.

***

## Conventions

* **Format.** JSON, UTF-8. Requests are strict: an unknown field answers `422 validation_failed`, so a typo never passes silently. Answers may gain fields, ignore the ones you do not know.
* **Timestamps.** `YYYY-MM-DDTHH:mm:ssZ`, UTC, whole seconds, in exactly that spelling.
* **Ids.** Opaque, prefixed strings: `lic_`, `ctg_`, `prd_`, `tag_`, `grt_`, `inv_`, `evt_`, `whe_`, `key_`, `ses_`, `dev_`, `op_`, ... Do not parse them.
* **Money.** An integer `amount` in the smallest unit with its `currency`.
* **Lists.** Take `limit` (1 to 100, default 25) and `cursor`, and answer one page with `data`, `hasMore`, `nextCursor` and `asOf`. A cursor remembers its filters and expires after a while with `410 cursor_expired`: start the list again.
* **CSV.** Many lists answer `text/csv` when your `Accept` header prefers it. `hasMore`, `nextCursor` and `asOf` then travel as the headers `RTK-Has-More`, `RTK-Next-Cursor` and `RTK-As-Of`.
* **Headers on every answer.** `RTK-Request-Id` identifies the request; quote it to support. `RateLimit-Limit`, `RateLimit-Remaining` and `RateLimit-Reset` describe your key's sliding window: 60 requests per minute unless the key has a higher tier. Past it, `429 rate_limited` with `Retry-After`.
* **Versioning.** Changes inside v2 are additive: new endpoints, new optional request fields, new response fields, new event types. A retiring version announces itself with `Deprecation` and `Sunset` headers and in `GET /v2/meta`.

***

## Idempotency

Every `POST` and `PATCH` that creates or changes something takes an `Idempotency-Key` header (1 to 200 characters). Use something stable from your own system, such as your asset or order id. Keys are scoped to your account and environment.

| Situation                             | Answer                                                              |
| ------------------------------------- | ------------------------------------------------------------------- |
| First use                             | The call runs                                                       |
| Same key, same request, finished      | The stored answer, with `Idempotency-Replayed: true`                |
| Same key, same request, still running | `409 operation_in_progress` with `Retry-After`                      |
| Same key, different request           | `409 idempotency_key_reused`; send the new request under a new key  |
| The outcome could not be confirmed    | `503 outcome_unknown` with `Retry-After`; repeat the identical call |

Some refusals use up the key, so the same answer is replayed and a different action needs a new key; all others do not, so fix the request or wait and send it again unchanged. The [error catalogue](https://docs.rtkdata.com/enterprise-portal/api/api-guide/api-errors.md) says which per code. Repeating a call can never create a second login, extend twice or charge twice.

***

## Endpoints

Every path below sits under `https://enterprise.rtkdata.com/v2`. **API > Docs** in the portal lists every field and error per endpoint.

### Meta

| Call                             | Scope   | Purpose                                                                                                                  |
| -------------------------------- | ------- | ------------------------------------------------------------------------------------------------------------------------ |
| `GET /meta`, `GET /openapi.json` | no key  | The version descriptor and the OpenAPI document                                                                          |
| `GET /products`                  | any key | The standard products, with their term and seat rules                                                                    |
| `GET /mountpoints`               | any key | The mountpoints every login serves and the frame each resolves to                                                        |
| `GET /casters`                   | any key | The caster the credentials name, with host, port and the GGA position rule                                               |
| `GET /coverage?lat=&lng=`        | any key | Whether RTK corrections reach a point: `precise` within 25 km of a base station, `standard` within 100 km, `none` beyond |

### Account and team

| Call                                                                                                | Scope            | Purpose                                                                                               |
| --------------------------------------------------------------------------------------------------- | ---------------- | ----------------------------------------------------------------------------------------------------- |
| `GET /account`                                                                                      | `account:read`   | The calling account                                                                                   |
| `GET /account/products`, `GET /account/products/{id}`                                               | `account:read`   | Your own products with their agreed prices                                                            |
| `GET /account/pricing`                                                                              | `account:read`   | The prices in effect now                                                                              |
| `GET /account/capabilities`                                                                         | `account:read`   | What the account may buy right now, the overdue stages and the purchase limits                        |
| `GET /account/setup`                                                                                | `account:read`   | Whether the account finished its setup in the portal; until then, purchases answer `setup_incomplete` |
| `GET /account/sla`                                                                                  | `account:read`   | Your support agreement, `null` while there is none                                                    |
| `GET /account/profile`                                                                              | `account:read`   | Company, contact and VAT details                                                                      |
| `POST /account/profile-change-requests`                                                             | `account:write`  | Ask RTKdata to change those details; RTKdata decides. Live keys only                                  |
| `GET /activity`                                                                                     | `account:read`   | The activity feed of the portal's dashboard                                                           |
| `GET /members`, `GET /members/presets`                                                              | `members:manage` | Your team and the presets a member can be given                                                       |
| `POST /members/invites`, `PATCH /members/{id}`, `DELETE /members/{id}`, `POST /members/{id}/resend` | `members:manage` | Invite, change, remove, resend an invite. Live keys only                                              |

### Devices and fleets

| Call                                                                                                 | Scope                                 | Purpose                                                                                                                               |
| ---------------------------------------------------------------------------------------------------- | ------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------- |
| `GET /licenses`                                                                                      | `licenses:read`                       | List; filters `status`, `kind`, `credentialType`, `archived`, `productId`, `contingentId`, `tagId`, `updatedSince`, `expiresBefore`   |
| `POST /licenses`                                                                                     | `licenses:provision`                  | Create a device: `kind: "paid"`, `productId` or one of `months`, `days`, `expiresAt`, optional `credentials`, `autoRenew`, `metadata` |
| `GET /licenses/next-username`                                                                        | `licenses:provision`                  | The next free generated login name, to send as `credentials.username`                                                                 |
| `GET /licenses/{id}`, `PATCH /licenses/{id}`                                                         | `licenses:read`, `licenses:write`     | Read; change `metadata` or `autoRenew`                                                                                                |
| `GET /licenses/{id}/credentials`                                                                     | `credentials:read`                    | `host`, `port`, `mountpoint`, `username`, `password` and a ready-made setup string                                                    |
| `POST /licenses/{id}/extend`                                                                         | `licenses:provision`                  | Buy more time                                                                                                                         |
| `POST /licenses/{id}/convert`                                                                        | `licenses:provision`                  | Turn a trial device into a paid one                                                                                                   |
| `GET`, `POST /licenses/{id}/renewal-undo`                                                            | `licenses:read`, `licenses:provision` | Preview or undo the last renewal while it is on no issued bill                                                                        |
| `POST /licenses/{id}/end`, `/suspend`, `/reactivate`                                                 | `licenses:write`                      | End now; place or clear your hold                                                                                                     |
| `POST /licenses/{id}/archive`, `/unarchive`                                                          | `licenses:write`                      | Block the login without ending it, and let it in again (a fleet needs streams first)                                                  |
| `POST /quotes`                                                                                       | `licenses:provision`                  | Price a purchase without making it                                                                                                    |
| `GET /licenses/expiring-service`                                                                     | `licenses:read`                       | Paid logins that lose service unless renewed, soonest first                                                                           |
| `GET /licenses/diagnostics`, `GET /licenses/{id}/diagnostics`, `POST /licenses/{id}/diagnostics/run` | `licenses:read`                       | Connection diagnostics of the last 30 days, cached or asked afresh                                                                    |
| `GET /licenses/usage`                                                                                | `licenses:read`                       | Every login with its diagnostics, as the portal's Usage table                                                                         |
| `GET /licenses/usage/daily`, `/usage/utilization`, `GET /licenses/{id}/utilization`                  | `sessions:read`                       | Connected time per day, peak parallel connections against streams held                                                                |

A create that could not reach the caster answers `503 caster_unavailable` and leaves nothing behind; a create that conclusively failed answers `502 provisioning_failed` and the license reads `failed`.

### Contingents

| Call                                                                    | Scope                | Purpose                                                                                              |
| ----------------------------------------------------------------------- | -------------------- | ---------------------------------------------------------------------------------------------------- |
| `GET /contingents`, `GET /contingents/{id}`                             | `licenses:read`      | Your contingents with their fleets and free streams                                                  |
| `POST /contingents`                                                     | `licenses:provision` | Buy `streams` at a fleet `productId`, or at the standard terms with `termMonths`                     |
| `PATCH /contingents/{id}`                                               | `licenses:write`     | Switch auto renew (a trial contingent never renews)                                                  |
| `POST /contingents/{id}/renew`                                          | `licenses:provision` | Renew for its own streams and term                                                                   |
| `GET /contingents/{id}/top-up-preview`, `POST /contingents/{id}/top-up` | `licenses:provision` | Preview or raise the contingent to a new total of `streams`, the extra billed pro rata until its end |
| `POST /contingents/{id}/fleets`                                         | `licenses:provision` | Cut a fleet with `streams` from the free streams, optional `credentials`                             |
| `POST /contingents/{id}/devices`                                        | `licenses:provision` | A trial device (one stream) from a trial contingent                                                  |
| `POST /contingents/{id}/transfers`                                      | `licenses:write`     | Move `streams` from one fleet (`fromLicenseId`) to another (`toLicenseId`)                           |
| `POST /contingents/{id}/fleets/{licenseId}/release`                     | `licenses:write`     | Free streams of a fleet back to the contingent                                                       |
| `DELETE /contingents/{id}/fleets/{licenseId}`                           | `licenses:write`     | End a fleet for good, its streams are free again                                                     |
| `POST /contingents/{id}/fleets/{licenseId}/convert`                     | `licenses:provision` | Buy a contingent for a trial fleet; the fleet keeps its login                                        |
| `GET /contingents/usage/daily`                                          | `sessions:read`      | The most connections open at once per day, per contingent                                            |

A fleet left with no streams after a transfer or release is archived; one that gets streams again is unarchived.

### Bulk orders and exports

| Call                                                | Scope                | Purpose                                                                                                                                                                                                             |
| --------------------------------------------------- | -------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `POST /bulk-operations`                             | `licenses:provision` | Order up to 500 devices or fleets at once: `credentialType`, `count`, `productId` or `termMonths`, for fleets `contingentId` and `streams`, optional `tagIds`, `usernamePrefix`, `firstNumber`. Answers 202 at once |
| `GET /bulk-operations`, `GET /bulk-operations/{id}` | `licenses:read`      | Follow an order and every login in it                                                                                                                                                                               |
| `POST /bulk-operations/{id}/retry`                  | `licenses:provision` | Run the failed logins of a finished order again                                                                                                                                                                     |
| `POST /credential-exports`                          | `credentials:read`   | Read the logins of up to 500 devices and fleets at once, passwords included, never stored                                                                                                                           |

### Tags

`GET /tags`, `GET /tags/{id}` under `licenses:read`; `POST /tags`, `PATCH /tags/{id}`, `DELETE /tags/{id}` and `POST /tags/licenses` (tags on and off up to 5000 logins at once) under `licenses:write`. A name is unique regardless of case and spacing, at most 200 tags per environment. Filter lists with `tagId`.

### Hardware that signs itself in

For receivers that fetch their own login without your backend in the loop:

| Call                                                              | Scope                             | Purpose                                                                                                                   |
| ----------------------------------------------------------------- | --------------------------------- | ------------------------------------------------------------------------------------------------------------------------- |
| `POST /licenses/{id}/claim-code`                                  | `licenses:write`                  | A single-use claim code, valid 7 days                                                                                     |
| `POST /devices/claim`                                             | no key                            | The receiver spends the code with its `serial`, takes a free slot and receives a client id, a client secret and the login |
| `POST /oauth/token`                                               | no key                            | OAuth 2.0 client credentials: a device token valid one hour                                                               |
| `GET /devices/self`                                               | device token                      | The hardware behind the token; it may also read its own license, credentials and diagnostics                              |
| `GET /licenses/{id}/slots`, `PATCH /licenses/{id}/slots/{slotId}` | `licenses:read`, `licenses:write` | The slots, one per stream; name one or release the hardware in it                                                         |
| `GET /devices`, `GET /devices/{id}`                               | `licenses:read`                   | Claimed hardware, released included                                                                                       |

### Bills, quotes, tickets and documents

| Call                                                                                                                | Scope            | Purpose                                                                                                   |
| ------------------------------------------------------------------------------------------------------------------- | ---------------- | --------------------------------------------------------------------------------------------------------- |
| `GET /grants`                                                                                                       | `bills:read`     | The purchase ledger; filters `invoiceId`, `billedPeriod`, `unbilled`, `licenseId`                         |
| `GET /bills`, `GET /bills/{id}`, `GET /bills/{id}/lines`, `GET /bills/{id}/pdf`                                     | `bills:read`     | Your monthly bills, their lines and the PDF (`409 pdf_not_ready` while it renders)                        |
| `GET /bills/upcoming`                                                                                               | `bills:read`     | The running month so far                                                                                  |
| `GET /stats/bills`                                                                                                  | `stats:read`     | Counts, what is outstanding, the most recent and the next due                                             |
| `GET /sales-quotes`, `GET /sales-quotes/{id}`, `/pdf`, `/stats`, `/products`                                        | `quotes:read`    | Quotes from RTKdata                                                                                       |
| `POST /sales-quotes`, `/{id}/order`, `/{id}/decline`, `/{id}/withdraw`, `PUT /{id}/renewal-items`                   | `quotes:write`   | Ask for a quote, order it with your PO number, decline or withdraw it, choose what a renewal quote renews |
| `GET /tickets`, `GET /tickets/{id}`, `GET /tickets/stats`                                                           | `tickets:read`   | Your support tickets                                                                                      |
| `POST /tickets`, `/tickets/escalations`, `/tickets/bill-inquiries`, `/tickets/{id}/messages`, `/tickets/{id}/close` | `tickets:write`  | Open a ticket, escalate a login's problem, ask about a bill, answer, close                                |
| `GET /documents`, `GET /documents/{id}`, `/download`                                                                | `documents:read` | Files RTKdata shared with you, with a download link valid 5 minutes                                       |

Quotes, tickets and documents are live only: a test key reads empty lists and changes nothing.

### Sessions, stats and notifications

* **Sessions** (`sessions:read`): `GET /sessions` (the last 30 days unless you give a window), `GET /sessions/summary`, `GET /sessions/live` (open connections with a position), `GET /sessions/{id}/track` as JSON, GeoJSON or GPX.
* **Stats** (`stats:read`): `GET /stats/licenses`, `/stats/trials`, `/stats/usage`, `/stats/usage/trend`, `/stats/sessions`, `/stats/sessions/trend`, `/stats/api`, `/stats/api/trend`, `/stats/api/health`, `/stats/api/keys/daily`.
* **Notifications**: `GET /notifications` and `GET /stats/notifications` under `notifications:read`; `PATCH` and `DELETE /notifications/{id}`, `POST /notifications/read-all`, `GET` and `PATCH /notification-settings` under `notifications:write`.

### Events, webhooks and keys

| Call                                                                                   | Scope             | Purpose                                                             |
| -------------------------------------------------------------------------------------- | ----------------- | ------------------------------------------------------------------- |
| `GET /events?afterPosition=`, `GET /events/{id}`                                       | `events:read`     | The feed, oldest first from your position; kept 90 days             |
| `GET`, `POST /webhooks`, `GET`, `PATCH`, `DELETE /webhooks/{id}`                       | `webhooks:manage` | Your endpoints. The signing secret is answered once                 |
| `GET /webhooks/{id}/deliveries`, `POST .../deliveries/{deliveryId}/retry`              | `webhooks:manage` | The delivery log, send one again                                    |
| `POST /webhooks/{id}/test`, `POST /webhooks/{id}/roll-secret`                          | `webhooks:manage` | A signed ping; a new secret, the old one signs as well for 24 hours |
| `GET /api-keys/self`                                                                   | any key           | The calling key                                                     |
| `GET`, `POST /api-keys`, `GET`, `PATCH /api-keys/{id}`, `/revoke`, `/rotate`, `/usage` | `keys:manage`     | Keys of the calling key's environment                               |
| `GET /api-requests`                                                                    | `stats:read`      | The request log; find a call by its `RTK-Request-Id`                |
| `GET /api-requests/{id}`                                                               | `requests:read`   | One call with what it sent and received, credentials masked         |

***

## Events and webhooks

Everything that happens on your account is an **event**. Read them in order from `GET /v2/events`, or register a webhook endpoint with the event types it wants and receive each as a signed `POST`. Webhooks on an Enterprise account always use the v2 payload.

### Event types

| Area                       | Types                                                                                                                                                                                                                                                                                                                                                                  |
| -------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Devices and fleets         | `license.created`, `license.activated`, `license.failed`, `license.converted`, `license.extended`, `license.updated`, `license.suspended`, `license.reactivated`, `license.expiring`, `license.trial_expiring`, `license.expired`, `license.ended`, `license.removed`, `license.archived`, `license.unarchived`, `license.first_connection`, `license.never_connected` |
| Contingents                | `contingent.created`, `contingent.renewed`, `contingent.updated`, `contingent.expired`                                                                                                                                                                                                                                                                                 |
| Sessions                   | `session.started`, `session.ended`                                                                                                                                                                                                                                                                                                                                     |
| Billing                    | `invoice.issued`, `invoice.paid`, `invoice.overdue`, `account.past_due`                                                                                                                                                                                                                                                                                                |
| Account                    | `account.updated`, `account.suspended`, `account.reactivated`, `profile_change_request.submitted`, `profile_change_request.decided`, `product.created`, `product.updated`, `product.archived`                                                                                                                                                                          |
| Quotes, tickets, documents | `sales_quote.requested`, `sales_quote.released`, `sales_quote.revised`, `sales_quote.ordered`, `sales_quote.declined`, `sales_quote.canceled`, `sales_quote.fulfilled`, `ticket.opened`, `ticket.replied`, `ticket.status_changed`, `document.shared`, `document.withdrawn`                                                                                            |
| Your integration and team  | `api_key.created`, `api_key.updated`, `api_key.revoked`, `api_key.rotated`, `webhook.created`, `webhook.updated`, `webhook.deleted`, `webhook.failing`, `webhook.recovered`, `member.invited`, `member.updated`, `member.removed`, `tag.created`, `tag.updated`, `tag.deleted`, `bulk_operation.finished`, `device.claimed`, `device.released`                         |

### The envelope

```json
{
  "id": "evt_3f2b8c1e5d4a4e7b9c1f2a6d8e0b7c45",
  "position": 48214,
  "type": "license.archived",
  "occurredAt": "2026-10-08T12:00:00Z",
  "sequence": 12,
  "data": {
    "license": {
      "id": "lic_3f2b8c1e5d4a4e7b9c1f2a6d8e0b7c45",
      "credentialType": "fleet",
      "...": "the license as GET /v2/licenses/{id} returns it, without credentials"
    }
  }
}
```

`position` is the event's place in your account's feed, `sequence` the resource's version after it, so a receiver can drop an event that arrives after a newer one of the same resource. Events never carry credentials. The same event can arrive more than once; deduplicate on `id`. A position older than 90 days answers `410 event_history_expired` with the position to resume from.

### Checking the signature

Every delivery is signed with the endpoint's signing secret:

```
RTK-Signature: t=1759233600,v1=5257a869e7ecebeda32affa62cdca3fa51cad7e77a0e56ff536d0ce8e108d8bd
RTK-Event-Id: evt_3f2b8c1e5d4a4e7b9c1f2a6d8e0b7c45
RTK-Event-Type: license.archived
RTK-Delivery-Id: 0e3c8f52-7d1b-4b9e-a6f4-2c5d8e1a9b70
RTK-Delivery-Attempt: 1
Content-Type: application/json
```

`t` is the time of this attempt in unix seconds, `v1` the hex HMAC-SHA256 of `t`, a dot and the raw request body. For 24 hours after a secret roll the header carries one `v1` per secret: accept the delivery when any matches. Refuse a `t` more than five minutes from your clock.

```javascript
import crypto from "node:crypto"

// rawBody: the request body exactly as received, before any JSON parsing.
// secret: the endpoint's signing secret (whsec_...).
function isFromRtkdata(rawBody, signatureHeader, secret) {
  const parts = signatureHeader.split(",").map((part) => part.split("="))
  const timestamp = Number(parts.find(([key]) => key === "t")?.[1])
  if (!timestamp || Math.abs(Date.now() / 1000 - timestamp) > 300) return false

  const expected = crypto.createHmac("sha256", secret).update(`${timestamp}.${rawBody}`).digest()
  return parts
    .filter(([key]) => key === "v1")
    .map(([, value]) => Buffer.from(value, "hex"))
    .some((given) => given.length === expected.length && crypto.timingSafeEqual(given, expected))
}
```

### Answering and retries

Answer with any 2xx within 10 seconds and do the actual work afterwards. A transport failure or a 5xx is retried with growing pauses for about three days, then the endpoint is marked **failing**, you are notified, and `webhook.failing` is emitted (`webhook.recovered` once a delivery goes through again). A 4xx other than 408, 425 or 429 counts as a rejection and is not retried. Resend what you missed from the delivery log, or read the feed from your last position: the read endpoints are the source of truth.

***

## Test sandbox

With a test key you can rehearse the whole life of a device or fleet, the events it causes and the bill it would produce. These calls exist for test keys only (a live key answers `403 test_only`) and need `licenses:provision`:

| Call                                                                                 | Purpose                                                                                                                                                     |
| ------------------------------------------------------------------------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `POST /test/trial-contingents` with `streams` and `days`                             | A trial contingent like the one RTKdata grants your account, to rehearse trial fleets and devices                                                           |
| `POST /test/clock` with `licenseId` and `advanceTo`                                  | Moves that license's clock forward and runs everything that became due on the way, in order: reminders, expiry, end of access, removal, each with its event |
| `POST /test/sessions` with `licenseId`, `sessionKey`, `startedAt`, `durationSeconds` | Records a connection, so first connection, diagnostics and the sessions area can be rehearsed                                                               |
| `GET /test/bill-preview?period=2026-11`                                              | What the bill for that period would contain, from your test grants                                                                                          |

***

## Next

* [Error catalogue](https://docs.rtkdata.com/enterprise-portal/api/api-guide/api-errors.md): every `code`, its status and whether it uses up your idempotency key
* [API](https://docs.rtkdata.com/enterprise-portal/api.md): the API area in the portal, keys, webhooks and the request history
* [Billing](https://docs.rtkdata.com/enterprise-portal/billing.md): your monthly bill and what happens when a bill is overdue


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.rtkdata.com/enterprise-portal/api/api-guide.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
