Overview
The Partner API lets a travel company that has a contract with AYAFLY sell our cruise inventory under its own brand. Your account is an AYAFLY agency account: API bookings are paid from the same wallet, at your contract prices, and you can also see them in the agency panel.
| Value | |
|---|---|
| Base URL | https://ayafly.com/api/partner/v1 |
| Format | JSON over HTTPS (TLS 1.2+). UTF-8. Dates YYYY-MM-DD, times ISO 8601 UTC. |
| Environments | The key decides: ayk_test_… = sandbox (test data, nothing is booked), ayk_live_… = live. |
| Cruise lines | MSC MSC Cruises · AROYA AROYA Cruises · CELEBRITY Celebrity Cruises · ROYAL Royal Caribbean |
Onboarding & go-live
- We sign the partner contract (commission, payment terms, cruise lines, domains) and create your account.
- You receive a sandbox key and build the integration on your domain against the sandbox.
- You accept the API terms and send us your server's public IP address(es) and your webhook URL.
- We review a few sandbox bookings with you (search → quote → book → webhook → cancel), then issue a live key and activate live access.
Until live access is activated, a live key answers 403 live_not_activated. You keep your sandbox key after going live.
Authentication
Send your key in the Authorization header on every request:
curl https://ayafly.com/api/partner/v1/ping \
-H "Authorization: Bearer ayk_test_XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"- Keys are secrets: call the API from your server only, never from a browser or mobile app.
- Live keys can be limited to your servers' IP addresses (we set the allowlist). Other addresses get
403 ip_not_allowed. - Lost or leaked key: tell us, we revoke it at once and issue a new one. Keys can be given an expiry date.
Conventions
- Every response has an
X-Request-Idheader; errors also carry it in the body. Quote it when you contact support. X-Environmenttells you which environment answered (sandboxorlive).- Money is always
{ gross, taxes, commission, net, currency }in your account currency, rounded to cents. - Lists take
limit(max 100) andoffset. - Idempotency:
POST /bookingsneeds anIdempotency-Keyheader (8–80 chars, e.g. a UUID) in live. Sending the same key again returns the first booking ("replayed": true) and never books twice, so it is safe to retry after a timeout.
Booking flow
GET /sailings— find sailings (prices from the cache: fast, indicative).GET /sailings/{id}— itinerary for the sailing page.POST /quotes— live cabin prices for the exact party (ages). Valid 30 minutes.POST /bookings— book one quote option with the guests' details; paid from your wallet.- Follow the status by webhook (or
GET /bookings/{reference}) untilCONFIRMED. POST /bookings/{reference}/cancel— request a cancellation if needed.
Search sailings
| Parameter | Description |
|---|---|
dateFrom | First departure date (default today). |
dateTo | Last departure date (default dateFrom + 60 days; at most 120 days after dateFrom). |
lines | Comma list of MSC, AROYA, CELEBRITY, ROYAL (default: every line in your contract). |
nightsMin / nightsMax | Cruise length. |
region / port / ship | Text filters, e.g. region=Mediterranean, port=Istanbul, ship=Euribia. |
product | CRUISE (cruise only) or PACKAGE (cruise with flights/transfers, some Royal Caribbean / Celebrity sailings). |
limit / offset | Paging (default 50 / 0). |
curl "https://ayafly.com/api/partner/v1/sailings?dateFrom=2027-01-01&dateTo=2027-02-28&lines=MSC,AROYA&nightsMin=7" \
-H "Authorization: Bearer $AYA_KEY"{
"sailings": [
{
"id": "CCE_7f3c…",
"line": "AROYA", "lineName": "AROYA Cruises", "product": "CRUISE", "title": null,
"ship": { "code": "AC01", "name": "AROYA" },
"departureDate": "2027-01-08", "returnDate": "2027-01-15", "nights": 7,
"embarkPort": "Istanbul", "disembarkPort": "Istanbul",
"ports": ["Istanbul", "Mykonos", "Piraeus", "Istanbul"],
"region": "Aegean",
"fromPrice": { "amount": 515.00, "currency": "EUR" },
"imageUrl": "https://…"
}
],
"total": 42, "limit": 50, "offset": 0
}fromPrice is per guest in a double cabin, before your commission. Always quote before you show a final price.
Sailing details
The search fields plus itinerary: [{ day, port, arrival, departure }].
Quotes
Give every guest's age on the sailing date, adults first. 1–8 guests, at least one 18 or older. Children and infants are priced by age.
curl -X POST https://ayafly.com/api/partner/v1/quotes \
-H "Authorization: Bearer $AYA_KEY" -H "Content-Type: application/json" \
-d '{ "sailingId": "MSC_EU20270110DXBDXB", "guests": [{ "age": 40 }, { "age": 38 }, { "age": 9 }] }'{
"quoteId": "qt_4b1e0c9a2f7d48a1b3c5",
"sailingId": "MSC_EU20270110DXBDXB",
"expiresAt": "2026-12-01T10:30:00.000Z",
"guests": [{ "age": 40 }, { "age": 38 }, { "age": 9 }],
"currency": "EUR",
"options": [
{
"optionId": "B-BP",
"category": { "code": "BP", "name": "BALCONY CABIN", "type": "BALCONY" },
"fare": { "code": "EXP1", "name": "BELLA" },
"price": { "gross": 2360.00, "taxes": 630.00, "commission": 173.00, "net": 2187.00, "currency": "EUR" },
"perGuest": [{ "age": 40, "gross": 786.67, "taxes": 210.00 }, …],
"exact": false,
"availability": "AVAILABLE"
}
]
}exact: false (MSC) means the price comes from the line's search and is confirmed when you book: if it moved by more than 3 % the booking answers 409 price_changed with the new price. Core Cruise Engine lines (AROYA, Celebrity, Royal Caribbean) quote the exact price for your party.
Create a booking
curl -X POST https://ayafly.com/api/partner/v1/bookings \
-H "Authorization: Bearer $AYA_KEY" -H "Content-Type: application/json" \
-H "Idempotency-Key: 6f1d2c8e-4a0b-4e2a-9d51-8b7f0a3c1e22" \
-d '{
"quoteId": "qt_4b1e0c9a2f7d48a1b3c5",
"optionId": "B-BP",
"partnerReference": "PT-100245",
"guests": [
{ "firstName": "Sara", "lastName": "Ahmadi", "gender": "F", "dateOfBirth": "1986-04-02", "nationality": "IR", "passportNumber": "K12345678", "passportExpiry": "2031-05-01" },
{ "firstName": "Reza", "lastName": "Ahmadi", "gender": "M", "dateOfBirth": "1988-09-14", "nationality": "IR", "passportNumber": "K87654321", "passportExpiry": "2030-11-20" },
{ "firstName": "Nika", "lastName": "Ahmadi", "gender": "F", "dateOfBirth": "2017-06-30", "nationality": "IR", "passportNumber": "K11223344", "passportExpiry": "2029-02-10" }
],
"customer": { "name": "Sara Ahmadi", "email": "sara@example.com", "phone": "+98 912 000 0000" },
"emergencyContact": { "name": "Ali Ahmadi", "phone": "+98 912 111 1111" }
}'- Guests in the quote's order; each birth date must give the quoted age on the sailing date (else
422 age_mismatch). - Passport number and expiry are required for MSC and AROYA.
- The booking is paid from your wallet; without enough balance + credit limit you get
402 insufficient_creditand nothing is held. - We never contact your customer. Cruise line documents and booking e-mails go to your operations contact.
- On
409 price_changed, show the new price and send the same request again with"acceptPriceChange": true(a new Idempotency-Key), or quote again.
Answer 201: the booking (see below), usually PENDING or already CONFIRMED.
Read bookings
reference is our reference or your partnerReference.
{
"reference": "CCE-482913", "partnerReference": "PT-100245", "lineReference": "AR1234567",
"status": "CONFIRMED", "paymentStatus": "PAID", "environment": "live",
"sailing": { "id": "CCE_7f3c…", "line": "Aroya Cruises", "ship": "AROYA", "departureDate": "2027-01-08", "nights": 7 },
"cabin": { "category": "BA", "name": "Balcony" },
"guests": [{ "firstName": "Sara", "lastName": "Ahmadi", "dateOfBirth": "1986-04-02" }],
"price": { "gross": 2360.00, "taxes": 630.00, "commission": 173.00, "net": 2187.00, "currency": "EUR" },
"holdUntil": null, "cancellation": null,
"createdAt": "2026-12-01T10:02:11.000Z", "updatedAt": "2026-12-01T10:05:40.000Z"
}Cancellation
{ "reason": "Customer cannot travel" }The booking becomes CANCELLATION_REQUESTED; our team cancels with the cruise line under its cancellation conditions, and you receive booking.updated with CANCELLED and the refund. A refunded booking's commission is reversed.
Account
Your wallet (balance, credit limit, available), commission rates, contract summary, lines, scopes and limits.
Prices & commission
- gross — your contract price for the cabin (all guests), in your account currency. Your selling price to your customer is your decision.
- taxes — port taxes and fees included in gross. They carry no commission.
- commission — your commission under the contract: a percentage of the cruise fare (gross − taxes), or a fixed amount per guest, possibly different per cruise line.
- net — what you pay us: gross − commission. For MSC the commission is deducted when you book; for the other lines it is paid back into your wallet right after the booking. Either way the wallet's net effect is net.
Booking statuses
| Status | Meaning |
|---|---|
PENDING | Received and paid; the cruise line is confirming it. |
HELD | Option held without payment until holdUntil. |
CONFIRMED | Confirmed by the cruise line (lineReference is its booking number). Final. |
CANCELLATION_REQUESTED | You asked to cancel; we are handling it. |
CANCELLED | Cancelled. paymentStatus REFUNDED when money went back to your wallet. |
FAILED | The cruise line refused it; nothing is owed. |
Webhooks
Give us an https URL and we send booking.created, booking.updated and booking.cancellation_requested (and webhook.test), for sandbox and live alike (environment in the body):
{
"id": "evt_0c2f…",
"type": "booking.updated",
"environment": "live",
"createdAt": "2026-12-01T10:05:41.000Z",
"data": { "booking": { "reference": "CCE-482913", "status": "CONFIRMED", … } }
}Every delivery is signed with your webhook secret (whsec_…): X-AYA-Signature: t=<unix seconds>,v1=<hex HMAC-SHA256 of "t.rawBody">. Also sent: X-AYA-Event, X-AYA-Delivery (the event id; deduplicate on it).
import crypto from "crypto";
function verify(rawBody, header, secret) {
const parts = Object.fromEntries(header.split(",").map(p => p.split("=")));
const expected = crypto.createHmac("sha256", secret).update(`${parts.t}.${rawBody}`).digest("hex");
const fresh = Math.abs(Date.now() / 1000 - Number(parts.t)) < 300;
return fresh && crypto.timingSafeEqual(Buffer.from(expected), Buffer.from(parts.v1));
}$parts = [];
foreach (explode(',', $_SERVER['HTTP_X_AYA_SIGNATURE']) as $p) { [$k, $v] = explode('=', $p, 2); $parts[$k] = $v; }
$expected = hash_hmac('sha256', $parts['t'] . '.' . file_get_contents('php://input'), $secret);
$ok = hash_equals($expected, $parts['v1']) && abs(time() - (int)$parts['t']) < 300;Answer any 2xx within 10 seconds. Otherwise we retry after 1, 5, 15, 60 minutes, 3, 6, 12 and 24 hours. Events can arrive more than once or out of order: use updatedAt, or read the booking.
Sandbox & test cases
With a ayk_test_ key every endpoint works on a fixed test catalogue (sailing ids contain _SBX_) priced with your real commission. Nothing is booked or charged, and the sandbox wallet always shows 100,000.
- A new sandbox booking is
PENDINGand becomesCONFIRMEDabout 2 minutes later (webhookbooking.updated). - A cancellation request becomes
CANCELLEDabout 2 minutes later. - Our team can also set any status on a sandbox booking for you, to test your handling.
| Lead guest's last name | Result |
|---|---|
HOLD | Booking stays HELD for 48 hours. |
PRICECHANGE | 409 price_changed; with acceptPriceChange: true it books 4 % higher. |
DECLINE | 502 booking_failed (cruise line refused). |
NOCREDIT | 402 insufficient_credit. |
SOLDOUT | 409 sold_out. |
The sailing MSC_SBX_SOLDOUT always answers 409 sold_out to a quote.
Errors
{ "error": { "code": "insufficient_credit", "message": "Your credit balance does not cover this booking. …", "requestId": "req_9a0c…" } }| HTTP | code | What to do |
|---|---|---|
| 400 | invalid_parameter, invalid_json, idempotency_key_required | Fix the request. |
| 401 | missing_api_key, invalid_api_key | Check the key; it may be revoked or expired. |
| 402 | insufficient_credit | Top up your wallet. |
| 403 | insufficient_scope, line_not_enabled, live_not_activated, ip_not_allowed, partner_suspended, contract_expired | Contact your account manager. |
| 404 | sailing_not_found, quote_not_found, booking_not_found | Search / quote again. |
| 409 | price_changed, sold_out, request_in_progress, already_cancelled, cancellation_pending | See message; request_in_progress: retry in seconds. |
| 410 | quote_expired | Create a new quote. |
| 422 | invalid_guest, guests_mismatch, age_mismatch, adult_required, invalid_option | Fix guest data. |
| 429 | rate_limited, daily_limit_reached | Wait for Retry-After / next day. |
| 502 / 503 | booking_failed, supplier_error, supplier_unavailable, prices_paused | Nothing was charged. Retry later. |
| 500 | internal_error | Retry; contact us with the requestId. |
Limits
Your contract sets requests per minute (default 60), quotes per day (default 300) and bookings per day (default 30). Live quotes read the cruise lines' availability, so quote when a customer is choosing a cabin, not to build a price list: use /sailings for lists. The sandbox allows at least 1,000 quotes and bookings a day.
Versioning
This is v1. We only add to it (new fields, endpoints, enum values); ignore fields you don't know. Breaking changes come as /v2 with at least 90 days' notice.