Skip to main content

Endpoints

MethodPathDescription
GET/api/keys/validateCheck if a key is active and retrieve its metadata
GET/api/keys/usageGet request usage stats for a key
GET/api/keys/createCreate a new API key (admin only)

Validate a key

Check whether an API key is valid and retrieve its metadata.

Request

api_key
string
required
The API key to validate.

Response

valid
boolean
true if the key is active, false otherwise.
name
string
Label assigned to the key when it was created.
monthly_limit
integer
Maximum number of API calls per calendar month.
requests_this_month
integer
Number of calls made in the current calendar month.

Example

curl "https://app.airrating.io/api/keys/validate?api_key=YOUR_API_KEY"
{
  "valid": true,
  "name": "My Integration",
  "monthly_limit": 1000,
  "requests_this_month": 42
}

Get usage stats

Returns per-endpoint usage breakdown for a key in a given month.

Request

api_key
string
required
Your API key.
year
integer
Year to query (defaults to current year).
month
integer
Month to query, 1–12 (defaults to current month).

Response

year
integer
Year of the usage period.
month
integer
Month of the usage period.
total_requests
integer
Total API calls in the period.
monthly_limit
integer
Monthly request limit for this key.
breakdown
object
Per-endpoint request counts.

Example

curl "https://app.airrating.io/api/keys/usage?api_key=YOUR_API_KEY&year=2026&month=4"
{
  "year": 2026,
  "month": 4,
  "total_requests": 87,
  "monthly_limit": 1000,
  "breakdown": {
    "/api/score": 52,
    "/api/airlines": 21,
    "/api/explain": 10,
    "/api/news": 4
  }
}

Create a key

This endpoint is restricted to admin use during private beta. It is not available to general API users.
Creates a new API key and stores it in the database.

Request

name
string
required
A label for the key (e.g. company name or integration name).
email
string
required
Contact email associated with the key.
monthly_limit
integer
default:"1000"
Maximum API calls per calendar month.

Response

api_key
string
The newly created API key. Store this immediately — it cannot be retrieved again.
name
string
Label for the key.
monthly_limit
integer
Monthly request limit.

Example

{
  "api_key": "ar_live_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
  "name": "Acme Travel",
  "monthly_limit": 1000
}