API reference
Account
Plan, usage and API keys.
Plan and usage#
Account, plan limits and usage for the current month. Any valid key or session of the account may read it; no scope needed.
Code samples
curl 'https://api.1fly.uz/v1/account' \
-H "Authorization: Bearer $ONEFLY_API_KEY"const res = await fetch('https://api.1fly.uz/v1/account', {
headers: {
Authorization: `Bearer ${process.env.ONEFLY_API_KEY}`,
},
});
const data = await res.json();
if (!res.ok) throw new Error(`${data.error.code}: ${data.error.message} (request ${data.error.requestId})`);import os
import requests
resp = requests.get(
"https://api.1fly.uz/v1/account",
headers={"Authorization": f"Bearer {os.environ['ONEFLY_API_KEY']}"},
timeout=30,
)
data = resp.json()
if not resp.ok:
raise RuntimeError(f"{data['error']['code']}: {data['error']['message']}")Responses
200Account overview.
{
"account": {
"id": "acc_…",
"name": "Sky Travel",
"type": "agency",
"plan": "basic",
"status": "active"
},
"plan": {
"id": "basic",
"name": "Basic",
"ordersPerMonth": 1000,
"requestsPerMinute": 300,
"liveKeys": true
},
"usage": {
"periodStart": "2026-11-01T00:00:00.000Z",
"ordersThisPeriod": 312,
"requestsThisPeriod": 18420,
"mcpCallsThisPeriod": 960,
"errorsLast24h": 14,
"requestsLast24h": 1210
}
}401Missing or invalid credentials.
| Field | Type | Description |
|---|---|---|
errorrequired | object | |
code (in error)required | string | Stable machine-readable code, e.g. VALIDATION_FAILED. |
message (in error)required | string | Human-readable explanation. |
requestId (in error)required | string | Quote this to support; also in the x-request-id header and the request log. |
issues (in error) | array<object> | Present for VALIDATION_FAILED: one entry per problem. |
path (in error.issues) | string | Example: passengers.0.lastName |
code (in error.issues) | string | |
message (in error.issues) | string |
{
"error": {
"code": "string",
"message": "string",
"requestId": "5b0c9a7e-2d1f-4e3a-9b8c-7d6e5f4a3b2c",
"issues": [
{
"path": "passengers.0.lastName",
"code": "string",
"message": "string"
}
]
}
}403The key lacks a required scope, or the account is suspended.
| Field | Type | Description |
|---|---|---|
errorrequired | object | |
code (in error)required | string | Stable machine-readable code, e.g. VALIDATION_FAILED. |
message (in error)required | string | Human-readable explanation. |
requestId (in error)required | string | Quote this to support; also in the x-request-id header and the request log. |
issues (in error) | array<object> | Present for VALIDATION_FAILED: one entry per problem. |
path (in error.issues) | string | Example: passengers.0.lastName |
code (in error.issues) | string | |
message (in error.issues) | string |
{
"error": {
"code": "string",
"message": "string",
"requestId": "5b0c9a7e-2d1f-4e3a-9b8c-7d6e5f4a3b2c",
"issues": [
{
"path": "passengers.0.lastName",
"code": "string",
"message": "string"
}
]
}
}500Unexpected error on our side; quote the requestId.
| Field | Type | Description |
|---|---|---|
errorrequired | object | |
code (in error)required | string | Stable machine-readable code, e.g. VALIDATION_FAILED. |
message (in error)required | string | Human-readable explanation. |
requestId (in error)required | string | Quote this to support; also in the x-request-id header and the request log. |
issues (in error) | array<object> | Present for VALIDATION_FAILED: one entry per problem. |
path (in error.issues) | string | Example: passengers.0.lastName |
code (in error.issues) | string | |
message (in error.issues) | string |
{
"error": {
"code": "string",
"message": "string",
"requestId": "5b0c9a7e-2d1f-4e3a-9b8c-7d6e5f4a3b2c",
"issues": [
{
"path": "passengers.0.lastName",
"code": "string",
"message": "string"
}
]
}
}List API keys#
Dashboard session only. Secrets are never returned after creation.
Code samples
curl 'https://api.1fly.uz/v1/api-keys' \
-b 'onefly_session=<session cookie>'const res = await fetch('https://api.1fly.uz/v1/api-keys', {
credentials: 'include', // session cookie
});
const data = await res.json();
if (!res.ok) throw new Error(`${data.error.code}: ${data.error.message} (request ${data.error.requestId})`);import requests
resp = requests.get(
"https://api.1fly.uz/v1/api-keys",
cookies={"onefly_session": "<session cookie>"},
timeout=30,
)
data = resp.json()
if not resp.ok:
raise RuntimeError(f"{data['error']['code']}: {data['error']['message']}")Responses
200Keys.
{
"keys": []
}401Missing or invalid credentials.
| Field | Type | Description |
|---|---|---|
errorrequired | object | |
code (in error)required | string | Stable machine-readable code, e.g. VALIDATION_FAILED. |
message (in error)required | string | Human-readable explanation. |
requestId (in error)required | string | Quote this to support; also in the x-request-id header and the request log. |
issues (in error) | array<object> | Present for VALIDATION_FAILED: one entry per problem. |
path (in error.issues) | string | Example: passengers.0.lastName |
code (in error.issues) | string | |
message (in error.issues) | string |
{
"error": {
"code": "string",
"message": "string",
"requestId": "5b0c9a7e-2d1f-4e3a-9b8c-7d6e5f4a3b2c",
"issues": [
{
"path": "passengers.0.lastName",
"code": "string",
"message": "string"
}
]
}
}500Unexpected error on our side; quote the requestId.
| Field | Type | Description |
|---|---|---|
errorrequired | object | |
code (in error)required | string | Stable machine-readable code, e.g. VALIDATION_FAILED. |
message (in error)required | string | Human-readable explanation. |
requestId (in error)required | string | Quote this to support; also in the x-request-id header and the request log. |
issues (in error) | array<object> | Present for VALIDATION_FAILED: one entry per problem. |
path (in error.issues) | string | Example: passengers.0.lastName |
code (in error.issues) | string | |
message (in error.issues) | string |
{
"error": {
"code": "string",
"message": "string",
"requestId": "5b0c9a7e-2d1f-4e3a-9b8c-7d6e5f4a3b2c",
"issues": [
{
"path": "passengers.0.lastName",
"code": "string",
"message": "string"
}
]
}
}Create an API key#
Dashboard session only (owner, admin or developer). The secret is returned once; store it safely. Live keys need a paid plan.
Request body application/json required
| Field | Type | Description |
|---|---|---|
namerequired | string | length: 1–60 |
moderequired | string | one of: "test", "live" |
scopesrequired | array<string> | items: 1–4 |
expiresInDaysrequired | const 30 | const 90 | const 365 | null |
{
"name": "Booking server",
"mode": "test",
"scopes": [
"orders:read",
"orders:write"
],
"expiresInDays": 90
}Code samples
curl -X POST 'https://api.1fly.uz/v1/api-keys' \
-b 'onefly_session=<session cookie>' \
-H 'Content-Type: application/json' \
-d '{
"name": "Booking server",
"mode": "test",
"scopes": [
"orders:read",
"orders:write"
],
"expiresInDays": 90
}'const res = await fetch('https://api.1fly.uz/v1/api-keys', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
},
credentials: 'include', // session cookie
body: JSON.stringify({
"name": "Booking server",
"mode": "test",
"scopes": [
"orders:read",
"orders:write"
],
"expiresInDays": 90
}),
});
const data = await res.json();
if (!res.ok) throw new Error(`${data.error.code}: ${data.error.message} (request ${data.error.requestId})`);import requests
resp = requests.post(
"https://api.1fly.uz/v1/api-keys",
cookies={"onefly_session": "<session cookie>"},
json={
"name": "Booking server",
"mode": "test",
"scopes": [
"orders:read",
"orders:write",
],
"expiresInDays": 90,
},
timeout=30,
)
data = resp.json()
if not resp.ok:
raise RuntimeError(f"{data['error']['code']}: {data['error']['message']}")Responses
201Key created.
{
"key": {
"id": "key_…",
"name": "Booking server",
"prefix": "1fly_test_a1b2",
"mode": "test",
"scopes": [
"orders:read",
"orders:write"
]
},
"secret": "1fly_test_a1b2…"
}401Missing or invalid credentials.
| Field | Type | Description |
|---|---|---|
errorrequired | object | |
code (in error)required | string | Stable machine-readable code, e.g. VALIDATION_FAILED. |
message (in error)required | string | Human-readable explanation. |
requestId (in error)required | string | Quote this to support; also in the x-request-id header and the request log. |
issues (in error) | array<object> | Present for VALIDATION_FAILED: one entry per problem. |
path (in error.issues) | string | Example: passengers.0.lastName |
code (in error.issues) | string | |
message (in error.issues) | string |
{
"error": {
"code": "string",
"message": "string",
"requestId": "5b0c9a7e-2d1f-4e3a-9b8c-7d6e5f4a3b2c",
"issues": [
{
"path": "passengers.0.lastName",
"code": "string",
"message": "string"
}
]
}
}500Unexpected error on our side; quote the requestId.
| Field | Type | Description |
|---|---|---|
errorrequired | object | |
code (in error)required | string | Stable machine-readable code, e.g. VALIDATION_FAILED. |
message (in error)required | string | Human-readable explanation. |
requestId (in error)required | string | Quote this to support; also in the x-request-id header and the request log. |
issues (in error) | array<object> | Present for VALIDATION_FAILED: one entry per problem. |
path (in error.issues) | string | Example: passengers.0.lastName |
code (in error.issues) | string | |
message (in error.issues) | string |
{
"error": {
"code": "string",
"message": "string",
"requestId": "5b0c9a7e-2d1f-4e3a-9b8c-7d6e5f4a3b2c",
"issues": [
{
"path": "passengers.0.lastName",
"code": "string",
"message": "string"
}
]
}
}Revoke an API key#
Takes effect immediately.
Parameters
Path parameters
| Name | Type | Description |
|---|---|---|
idrequired | string | Key id. pattern: ^key_[a-f0-9]{32}$ |
Code samples
curl -X POST 'https://api.1fly.uz/v1/api-keys/key_abcdef0123456789abcdef0123456789/revoke' \
-b 'onefly_session=<session cookie>'const res = await fetch('https://api.1fly.uz/v1/api-keys/key_abcdef0123456789abcdef0123456789/revoke', {
method: 'POST',
credentials: 'include', // session cookie
});
const data = await res.json();
if (!res.ok) throw new Error(`${data.error.code}: ${data.error.message} (request ${data.error.requestId})`);import requests
resp = requests.post(
"https://api.1fly.uz/v1/api-keys/key_abcdef0123456789abcdef0123456789/revoke",
cookies={"onefly_session": "<session cookie>"},
timeout=30,
)
data = resp.json()
if not resp.ok:
raise RuntimeError(f"{data['error']['code']}: {data['error']['message']}")Responses
200Revoked key.
{
"key": {
"id": "key_…",
"revokedAt": "2026-11-17T10:00:00.000Z"
}
}401Missing or invalid credentials.
| Field | Type | Description |
|---|---|---|
errorrequired | object | |
code (in error)required | string | Stable machine-readable code, e.g. VALIDATION_FAILED. |
message (in error)required | string | Human-readable explanation. |
requestId (in error)required | string | Quote this to support; also in the x-request-id header and the request log. |
issues (in error) | array<object> | Present for VALIDATION_FAILED: one entry per problem. |
path (in error.issues) | string | Example: passengers.0.lastName |
code (in error.issues) | string | |
message (in error.issues) | string |
{
"error": {
"code": "string",
"message": "string",
"requestId": "5b0c9a7e-2d1f-4e3a-9b8c-7d6e5f4a3b2c",
"issues": [
{
"path": "passengers.0.lastName",
"code": "string",
"message": "string"
}
]
}
}500Unexpected error on our side; quote the requestId.
| Field | Type | Description |
|---|---|---|
errorrequired | object | |
code (in error)required | string | Stable machine-readable code, e.g. VALIDATION_FAILED. |
message (in error)required | string | Human-readable explanation. |
requestId (in error)required | string | Quote this to support; also in the x-request-id header and the request log. |
issues (in error) | array<object> | Present for VALIDATION_FAILED: one entry per problem. |
path (in error.issues) | string | Example: passengers.0.lastName |
code (in error.issues) | string | |
message (in error.issues) | string |
{
"error": {
"code": "string",
"message": "string",
"requestId": "5b0c9a7e-2d1f-4e3a-9b8c-7d6e5f4a3b2c",
"issues": [
{
"path": "passengers.0.lastName",
"code": "string",
"message": "string"
}
]
}
}