#Conventions
Rules that hold across the whole API, in one place.
#Requests and responses
- Bodies are JSON (
Content-Type: application/json), UTF-8. SendAccept: application/json. - A request body is limited to 1 MB. Bigger is
413 payload_too_large. - Unknown fields in a request are refused (
400 invalid_request). That catches a misspelt field instead of ignoring it. Unknown fields in a response must be ignored by your code: new fields appear within a version. - Every response carries an
X-Request-Idheader, and every error body carries the samerequest_id. Quote it when you ask for help. - Field names are
snake_case. A field that has no value isnull; it is not left out (except where the reference says a field is only present in some cases).
#Dates, times and money
| Kind | Form | Example |
|---|---|---|
| A day (a night, a check-in) | YYYY-MM-DD, in the property's time zone | 2027-03-11 |
| A range of days | date_from and date_to, both included | 2027-03-10 to 2027-03-16 is seven nights |
An instant (created_at) | RFC 3339 in UTC | 2027-03-01T09:30:00Z |
| Money | an integer in the smallest unit of the currency, with an ISO 4217 currency | 12000 and USD is US$120.00 |
A currency's smallest unit follows ISO 4217: two decimals for USD or EUR, none for JPY, IDR as most systems use it, or KRW, three for KWD or BHD. Never send 120.0. A property without a currency uses USD; the currency of a property cannot change afterwards.
A stay is a range of nights: arrival included, departure day not (arrival 2027-03-11, departure 2027-03-13 is the nights of the 11th and 12th).
#Idempotency
Retrying a request that timed out must not do the work twice. Send an Idempotency-Key header (1 to 200 characters, chosen by you) on every POST, PUT and PATCH:
| You send | Antero Connect does |
|---|---|
| the key for the first time | does the work, remembers the answer |
| the same key, the same method, path and body again | returns the original answer (same status, same body) and does nothing |
| the same key with a different body or path | 409 idempotency_key_reused: nothing is done |
Make the key from what the work is, not from the time: reservation-KN-G6MSB7-cancel, or a UUID you save before you send. A key made fresh on every retry protects nothing.
Two exceptions are on purpose: the call that creates a webhook receiver does not accept the header, because its answer carries a secret that must not be stored for replay.
PUT availability, rates and restrictions are also protected by pms_version (see below), so a retry is safe even without a key, but send the key anyway.
#Try first, with dry_run
PUT availability, rates and restrictions take ?dry_run=true. Antero Connect works out what would change and answers, and writes nothing: no days, no audit row, no job, and the version does not move.
{"dry_run": true, "changed_days": 7, "unchanged_days": 0, "derived_changed_days": 0, "affected_connections": 0, "held_days": 0, "released_holds": 0}affected_connections is how many channels would be told; held_days how many of the days have rooms held back.
#Versions that prevent old news
A hotel system that pushes availability sends a pms_version, a number that only goes up. Two pushes can arrive in the wrong order (a retry, a slow network); the version lets Antero Connect tell which is newer.
| You send | Antero Connect does |
|---|---|
| a version higher than the last | applies it |
| the same version and the same body | returns the same answer, does nothing (a replay) |
| the same version with a different body | 409 version_conflict |
| a lower version | 409 stale_version, with current_version in the error: the push is ignored |
Availability, rates and restrictions each have their own counter (the last version is kept per property and per kind), so pushing prices with version 7 does not touch the version of availability. It is required for a property run by your system (pms_authoritative). Count it however you like (a counter, a timestamp in milliseconds), as long as it only grows.
#Pagination
Lists take limit (default 50, at most 200) and after. The answer has data and next_cursor; pass next_cursor as after for the next page. next_cursor is null on the last page. A cursor is opaque: do not build or read one. A bad one is 400 invalid_cursor.
export CHANNEL_MANAGER=https://api.anteromas.com # the address of your Channel Manager service
export KEY=cm_prod_ab12cd34_0123456789abcdef0123456789abcdef # your API key
curl -s -X GET "$CHANNEL_MANAGER/v1/properties/$PROPERTY_ID/reservations?limit=100&after=$CURSOR" \
-H "Authorization: Bearer $KEY"import os
import requests
CHANNEL_MANAGER = os.environ["CHANNEL_MANAGER"] # the address of your Channel Manager service
KEY = os.environ["KEY"] # your API key
r = requests.get(
f"{CHANNEL_MANAGER}/v1/properties/{PROPERTY_ID}/reservations?limit=100&after={CURSOR}",
headers={"Authorization": f"Bearer {KEY}"},
)
r.raise_for_status()
print(r.status_code, r.text)// Node.js 18 or newer (fetch is built in); save as a .mjs file
const CHANNEL_MANAGER = process.env.CHANNEL_MANAGER; // the address of your Channel Manager service
const KEY = process.env.KEY; // your API key
let r; // the last answer
r = await fetch(`${CHANNEL_MANAGER}/v1/properties/${PROPERTY_ID}/reservations?limit=100&after=${CURSOR}`, {
method: "GET",
headers: { Authorization: `Bearer ${KEY}` },
});
if (!r.ok) throw new Error(await r.text());
console.log(r.status, await r.text());<?php
$CHANNEL_MANAGER = getenv("CHANNEL_MANAGER"); // the address of your Channel Manager service
$KEY = getenv("KEY"); // your API key
$ch = curl_init("{$CHANNEL_MANAGER}/v1/properties/{$PROPERTY_ID}/reservations?limit=100&after={$CURSOR}");
curl_setopt_array($ch, [
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => ["Authorization: Bearer {$KEY}"],
]);
$out = curl_exec($ch);
$status = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);
if ($status >= 400) { throw new RuntimeException($out); }
echo $status, " ", $out, "\n";The reservation feed is paged differently, by number (after=<seq>), because it is a log you follow. See Reservations.
#Filters
A list says which filters it takes. Where a reference lists status, connection_id, arrival_from and arrival_to, an unknown value is 400 invalid_request, never an empty list, so a typo is not mistaken for "no results".
#Archiving, not deleting
Room types, rate plans and properties are archived, not deleted: bookings and history that refer to them stay readable. An archived thing no longer takes new work (409 property_archived).
#Browsers and CORS
The management API is for servers. The booking page API (/book-api/…) and the spec (/openapi.json, /openapi.yaml) allow any origin (Access-Control-Allow-Origin: *), because a guest's browser and your tools call them. Never call the management API from a web page: it would put a key where anyone can read it.