Getting started
Quickstart
A key, one curl, and X-Credits-Charged on the response — about five minutes.
1. Sign in and create a key
Sign in with a magic link or Google: no password, no card. Then open Keys and create your first key. The plaintext is shown once — copy it then. The Free plan gives the account 250 credits a month, reset monthly.
2. Shop one hotel
Every rate endpoint is a POST with a JSON body and the key in x-api-key. Put the key in the
environment once — every sample below reads it from there:
export DIRECTRATE_API_KEY=<your key>
curl -s https://api.directrate.dev/v1/shop \
-H "x-api-key: $DIRECTRATE_API_KEY" \
-H "content-type: application/json" \
-d '{
"chain": "hyatt",
"hotel_code": "CHIZP",
"checkin": "2027-01-09",
"los": 1
}'import os
import requests
r = requests.post(
"https://api.directrate.dev/v1/shop",
headers={"x-api-key": os.environ["DIRECTRATE_API_KEY"]},
json={
"chain": "hyatt",
"hotel_code": "CHIZP",
"checkin": "2027-01-09",
"los": 1,
},
)
r.raise_for_status()
print(r.headers.get("x-credits-charged"), r.json())const res = await fetch("https://api.directrate.dev/v1/shop", {
method: "POST",
headers: {
"x-api-key": process.env.DIRECTRATE_API_KEY,
"content-type": "application/json",
},
body: JSON.stringify({
"chain": "hyatt",
"hotel_code": "CHIZP",
"checkin": "2027-01-09",
"los": 1
}),
});
if (!res.ok) throw new Error(`HTTP ${res.status}`);
console.log(res.headers.get("x-credits-charged"), await res.json());The response is the room × rate-plan matrix for that stay — every plan the chain sells, the member
rate as its own rows (member_only: true), lowest.bar / lowest.member and the after-tax twins,
status, and source / cache_age_sec so you know how fresh it is. Read the price on the response
itself:
X-Credits-Charged: 1
3. Points, parity, a calendar
Same body, different path. Award nights in points, cents-per-point against the cash rate and the free-night certificates that cover the stay:
curl -s https://api.directrate.dev/v1/award \
-H "x-api-key: $DIRECTRATE_API_KEY" \
-H "content-type: application/json" \
-d '{
"chain": "marriott",
"hotel_code": "CHIRL",
"checkin": "2027-01-09",
"los": 1
}'import os
import requests
r = requests.post(
"https://api.directrate.dev/v1/award",
headers={"x-api-key": os.environ["DIRECTRATE_API_KEY"]},
json={
"chain": "marriott",
"hotel_code": "CHIRL",
"checkin": "2027-01-09",
"los": 1,
},
)
r.raise_for_status()
print(r.headers.get("x-credits-charged"), r.json())const res = await fetch("https://api.directrate.dev/v1/award", {
method: "POST",
headers: {
"x-api-key": process.env.DIRECTRATE_API_KEY,
"content-type": "application/json",
},
body: JSON.stringify({
"chain": "marriott",
"hotel_code": "CHIRL",
"checkin": "2027-01-09",
"los": 1
}),
});
if (!res.ok) throw new Error(`HTTP ${res.status}`);
console.log(res.headers.get("x-credits-charged"), await res.json());The direct rate beside Booking.com, Expedia, Hotels.com, Trip.com and Agoda:
curl -s https://api.directrate.dev/v1/parity \
-H "x-api-key: $DIRECTRATE_API_KEY" \
-H "content-type: application/json" \
-d '{
"chain": "choice",
"hotel_code": "IL263",
"checkin": "2027-01-09",
"los": 1
}'import os
import requests
r = requests.post(
"https://api.directrate.dev/v1/parity",
headers={"x-api-key": os.environ["DIRECTRATE_API_KEY"]},
json={
"chain": "choice",
"hotel_code": "IL263",
"checkin": "2027-01-09",
"los": 1,
},
)
r.raise_for_status()
print(r.headers.get("x-credits-charged"), r.json())const res = await fetch("https://api.directrate.dev/v1/parity", {
method: "POST",
headers: {
"x-api-key": process.env.DIRECTRATE_API_KEY,
"content-type": "application/json",
},
body: JSON.stringify({
"chain": "choice",
"hotel_code": "IL263",
"checkin": "2027-01-09",
"los": 1
}),
});
if (!res.ok) throw new Error(`HTTP ${res.status}`);
console.log(res.headers.get("x-credits-charged"), await res.json());The lowest rate per night over a window:
curl -s https://api.directrate.dev/v1/calendar \
-H "x-api-key: $DIRECTRATE_API_KEY" \
-H "content-type: application/json" \
-d '{
"chain": "ihg",
"hotel_code": "CHIMM",
"start": "2027-01-09",
"days": 30
}'import os
import requests
r = requests.post(
"https://api.directrate.dev/v1/calendar",
headers={"x-api-key": os.environ["DIRECTRATE_API_KEY"]},
json={
"chain": "ihg",
"hotel_code": "CHIMM",
"start": "2027-01-09",
"days": 30,
},
)
r.raise_for_status()
print(r.headers.get("x-credits-charged"), r.json())const res = await fetch("https://api.directrate.dev/v1/calendar", {
method: "POST",
headers: {
"x-api-key": process.env.DIRECTRATE_API_KEY,
"content-type": "application/json",
},
body: JSON.stringify({
"chain": "ihg",
"hotel_code": "CHIMM",
"start": "2027-01-09",
"days": 30
}),
});
if (!res.ok) throw new Error(`HTTP ${res.status}`);
console.log(res.headers.get("x-credits-charged"), await res.json());4. Find hotel codes
Codes are each chain’s own property identifiers (Marriott CHIRL, Hyatt CHIZP, IHG CHIMM,
Hilton CHITDHX, Choice IL263) — not guessable, not shared between chains. Ask for them:
curl -s "https://api.directrate.dev/v1/hotels?chain=marriott&q=Chicago,%20IL&radius=5" \
-H "x-api-key: $DIRECTRATE_API_KEY"import os
import requests
r = requests.get(
"https://api.directrate.dev/v1/hotels",
headers={"x-api-key": os.environ["DIRECTRATE_API_KEY"]},
params={
"chain": "marriott",
"q": "Chicago, IL",
"radius": "5",
},
)
r.raise_for_status()
print(r.headers.get("x-credits-charged"), r.json())const url = new URL("https://api.directrate.dev/v1/hotels");
url.searchParams.set("chain", "marriott");
url.searchParams.set("q", "Chicago, IL");
url.searchParams.set("radius", "5");
const res = await fetch(url, {
headers: { "x-api-key": process.env.DIRECTRATE_API_KEY },
});
if (!res.ok) throw new Error(`HTTP ${res.status}`);
console.log(res.headers.get("x-credits-charged"), await res.json());One credit however many hotels come back (Best Western 5, Wyndham 6).
5. Watch the quota
curl -s https://api.directrate.dev/v1/usage \
-H "x-api-key: $DIRECTRATE_API_KEY"import os
import requests
r = requests.get(
"https://api.directrate.dev/v1/usage",
headers={"x-api-key": os.environ["DIRECTRATE_API_KEY"]},
)
r.raise_for_status()
print(r.headers.get("x-credits-charged"), r.json())const res = await fetch("https://api.directrate.dev/v1/usage", {
headers: { "x-api-key": process.env.DIRECTRATE_API_KEY },
});
if (!res.ok) throw new Error(`HTTP ${res.status}`);
console.log(res.headers.get("x-credits-charged"), await res.json());Free to call, answered even when the quota is spent. Errors, unknown codes and timeouts never bill.
Prefer tools to HTTP? The same key makes every mode a tool for Claude Code, Cursor, VS Code or a Claude.ai connector: the MCP server.
Next: Authentication · Credits & pricing · Watches & webhooks · Batch jobs & export · the API reference for every field.