API reference
Testing
Test-mode helpers.
Generate test orders#
Test mode only. Creates realistic orders that run through a chosen scenario (or a realistic mix) and plays the traveller and payment provider.
Request body application/json required
| Field | Type | Description |
|---|---|---|
scenario | string | const "mixed" | default: "mixed" |
count | integer | range: 1–50default: 10 |
{
"scenario": "mixed",
"count": 10
}Code samples
curl -X POST 'https://api.1fly.uz/v1/dev/simulate' \
-H "Authorization: Bearer $ONEFLY_API_KEY" \
-H 'Content-Type: application/json' \
-d '{
"scenario": "mixed",
"count": 10
}'const res = await fetch('https://api.1fly.uz/v1/dev/simulate', {
method: 'POST',
headers: {
Authorization: `Bearer ${process.env.ONEFLY_API_KEY}`,
'Content-Type': 'application/json',
},
body: JSON.stringify({
"scenario": "mixed",
"count": 10
}),
});
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.post(
"https://api.1fly.uz/v1/dev/simulate",
headers={"Authorization": f"Bearer {os.environ['ONEFLY_API_KEY']}"},
json={
"scenario": "mixed",
"count": 10,
},
timeout=30,
)
data = resp.json()
if not resp.ok:
raise RuntimeError(f"{data['error']['code']}: {data['error']['message']}")Responses
200Orders created.
{
"created": [
"ord_0d6c3f8a2b9e4c1d8f7a6b5c4d3e2f10"
]
}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"
}
]
}
}