Skip to content

Bills

Role names and user_group_id values are listed in User groups.

Billing and wallet management. Requires a non-free company plan. Pilots need billing: true on their user record to appear in billing operations.

CompanyBillingSetting.send_notification is still returned in some responses but is no longer used: whether a receipt is emailed depends on the kind of bill (see notify and receipt below).


GET /bills/index.json

GET /bills/index/{userId}.json

GET /bills/index/{userId}/{offset}.json

List wallet movement records for a pilot. Managers can view any pilot’s bills; regular users (user_group_id ≥ 150 — Chief Pilot and below) see only their own. Linked flight info is included unless the flight’s status is CANCELED or DELETED.

Parameter Type Description
limit number Records per page (default: 10)
{
"bills": [
{
"UserBill": {
"id": "xyz789",
"user_id": "100",
"company_id": "42",
"flight_id": "5678",
"name": "2025-01-10 LEBL-LEMD",
"price": "-120.00",
"total": "-120.00",
"receipt": false,
"created": "2025-01-10 15:00:00"
},
"Flight": {
"callsign": "EC-ABC",
"rules": "IFR",
"offblocks_time": "1736505000",
"block_time": "6900",
"deleted": false
}
}
],
"total": 42
}

GET /bills/view/{id}.json

Full detail for a single bill including client info, company billing settings, and linked flight. Access does not require authentication (allowed in beforeFilter).

Parameter Type Description
id UUID Bill ID
{
"bill": {
"UserBill": {
"id": "xyz789",
"n_id": 12,
"name": "2025-01-10 LEBL-LEMD",
"price": -120.00,
"price_hour": -60.00,
"airport": 0.0,
"fuel": 0.0,
"handling": 0.0,
"others": 0.0,
"collected_tax": 0.0,
"subtotal": -120.00,
"total": -120.00,
"packaged": 0.0,
"packaged_time": 0.0,
"billed_time": 2.0,
"balance": -120.00,
"receipt": false
},
"Flight": {
"date": "2025-01-10",
"callsign": "EC-ABC",
"departure_airport": "LEBL",
"landing_airport": "LEMD",
"flight_time": "6900",
"block_time": "6900",
"rules": "IFR",
"landings": 1
},
"Client": {
"id": "100",
"UserDetail": { "name": "John", "surname": "Doe", "passport": "AB123456", "phone": "+34600000000", "address": "...", "city": "Barcelona", "pc": "08001", "Country": { "name": "Spain" } },
"Company": {
"name": "My FTO",
"CompanyDetail": { "Country": { "name": "Spain" } },
"CompanyBillingSetting": { "tax": "21", "billed_person": "pilot", "send_notification": true, "bill_notes": "IBAN: NL00 BANK 0123 4567 89" }
}
},
"Creator": {
"id": "50",
"UserDetail": { "name": "Admin", "surname": "User" }
},
"UserBillPackageFlight": []
}
}

UserBill.n_id is the bill number. Flight bills and manual bills (flight_id empty) each have their own sequence per company. By default a sequence is consecutive and continues after the most recently created bill of its kind. Companies that enable yearly reset restart it every 1 January and store the year in UserBill.n_year (shown as 2026/1). n_id is null for transactions saved without a number. Bills created before October 2026 keep their old number, which may repeat across years; older bills without a number can be numbered by editing them with assign_number.


GET /bills/next_number.json?created={unix}

The bill number the next bill would receive, so a form can show it before saving. created (Unix timestamp, optional) is the bill date; it decides the year when the company restarts numbering yearly. Restricted to user_group_id ≤ 145. The value is informational: the number is assigned when the bill is saved, so another bill saved in between takes it.

{ "next": { "n_id": 505, "n_year": null } }

n_year is null unless the company restarts numbering every year.


POST /bills/create.json

Create a manual wallet transaction for one or more pilots. If id is provided, updates an existing record. user_id can be a single UUID, an array of UUIDs, or a pilot group UUID (group members are expanded automatically). Restricted to user_group_id ≤ 145 (Flight Dispatcher and above).

Field Type Required Description
user_id string | array Yes (new) Pilot UUID(s) or pilot group UUID
price number Yes (new) Amount (negative = charge, positive = credit)
name string Yes Transaction description
created string No Transaction date (defaults to now)
receipt boolean No Send the receipt notification to the user. It does not control numbering
assign_number boolean No Give the bill a bill number (n_id). false/0 stores it without number and removes an existing one. When omitted, the bill is numbered
id UUID No Existing bill ID to update

To post a charge on a schedule instead, see Recurring charges.

{
"result": true,
"new": true,
"UserBills": [
{
"id": "xyz789",
"user_id": "100",
"name": "Manual adjustment",
"price": "-50.00",
"creator": "Admin User",
"client": "John Doe"
}
],
"errors": []
}

GET /bills/flight.json?id={flightId}

POST /bills/flight.json?id={flightId}

Retrieve flight billing data (GET) or create/update a flight bill (POST). Flight must be confirmed (status = LANDED).

Parameter Type Description
id UUID Flight ID
Field Type Required Description
user_id UUID Yes Pilot to bill
price_hour number Yes Hourly rate
price number Yes Total flight price
airport number No Airport fees
fuel number No Fuel charges
handling number No Handling charges
others number No Other charges
rate_id UUID No Rate record to use
notify boolean No Email the receipt to the billed person. false saves the bill without emailing. Defaults to true when omitted
use_packages boolean No Deduct from pilot’s package balance
created string No Bill date (defaults to onblocks_time)
{
"defaults": { "tax": "21", "default_airport": "0", ... },
"payment": { "UserBill": { ... } },
"flight": { "Flight": { ... }, "Aircraft": { ... }, "UserBill": { ... } },
"errors": null
}

POST /bills/delete.json

Delete a bill and recalculate the pilot’s balance.

Field Type Required Description
bill UUID Yes Bill ID to delete
{
"result": true,
"balance": -240.00,
"bill": { "UserBill": { "id": "xyz789", "name": "...", "total": "-120.00" } }
}

GET /bills/autobill/{flightId}.json

GET /bills/autobill/{flightId}/{userId}.json

POST /bills/autobill.json

Automatically generate a bill for a flight using the aircraft’s default rate. Any existing bill for the flight is replaced. Optionally override which pilot to bill. The receipt is always emailed to the billed person.

Field Type Required Description
flight UUID Yes Flight ID
user UUID No Override pilot to bill
{
"bill": { "UserBill": { ... } }
}

GET /bills/balance.json

GET /bills/balance/{userId}.json

Returns the current wallet balance for a pilot. Managers can query any billable pilot. Regular users see only their own balance.

{
"balance": -240.50
}

POST /bills/pay.json

Opens a Stripe Checkout session so the logged-in pilot can pay their balance by card into the company’s own Stripe account. Requires company billing enabled, the pilot’s own billing enabled, and a valid pair of Stripe keys in the company billing settings (CompanyBillingSetting.stripe is true in /companies/settings.json). Only card payments are offered. External auditors (group 250) are denied.

Field Type Required Description
amount number No Amount to pay in the company currency, up to two decimals. Defaults to what the pilot owes; required when the balance is not negative
ui string No embedded returns the data to mount Stripe’s embedded Checkout form; otherwise a hosted Checkout URL is returned
{
"result": {
"client_secret": "cs_test_..._secret_...",
"publishable_key": "pk_live_...",
"payment_id": "cs_test_..."
},
"message": "",
"amount": 795
}
{
"result": {
"checkout_url": "https://checkout.stripe.com/c/pay/cs_...",
"payment_id": "cs_..."
},
"message": "",
"amount": 795
}

result is null with a message when the amount is missing or invalid, or when Stripe refused to open the session. Returns 400 when online payments are not set up for the company and 403 when billing is off for the pilot. After a hosted payment Stripe returns the pilot to /bills?stripe_session={id}.


POST /bills/checkout/{sessionId}.json

Records a finished Checkout session on the pilot’s account as a Stripe payment receipt and notifies the Company Administrators and Financial Managers. Only the pilot who opened the session can confirm it. Safe to call more than once: a session is recorded once. Paid sessions nobody confirms are recorded by an hourly job.

Parameter Type Description
sessionId string Stripe Checkout session id (payment_id from /bills/pay.json)
{
"result": true,
"pending": false,
"message": "Payment received, thank you!"
}

result is false and pending is true while the session is not paid yet.


GET /bills/download.json

GET /bills/download/{userId}.json

Download all bills as an Excel file. Regular users see only their own. Requires token query param.


GET /bills/rates.json

GET /bills/rates/true.json

List all billing rates for the company. Pass true to return only package rates.

{
"rates": [
{
"Rate": {
"id": "r1",
"company_id": "42",
"name": "C172 Standard",
"hourly_price": "120.00",
"pack": false,
"deleted": false
},
"Aircraft": [
{ "id": "45", "registration": "EC-ABC" }
]
}
]
}

GET /bills/rate/{id}.json

Retrieve a single rate with linked aircraft.


GET /bills/aircraft/{aircraftId}.json

List all rates configured for a specific aircraft.


GET /bills/packages/{userId}.json

GET /bills/packages/{userId}/true.json

List flight-hour packages for a pilot. Pass true to return only valid packages (non-expired with remaining balance).

{
"packages": [
{
"UserBillPackage": {
"id": "pkg1",
"user_id": "100",
"total": "50.00",
"balance": "32.50",
"expiration": "2026-12-31",
"created": "2025-01-01 10:00:00"
},
"Rate": [{ "id": "r1", "name": "C172 Standard", "hourly_price": "120.00" }]
}
]
}

GET /bills/package/{id}.json

Full details for a package including the pilot, creator, linked rate, bills, and associated flights.


POST /bills/manager_purchase_package.json

Create or update a flight-hour package for a pilot. Optionally creates a debit bill for the package cost.

Field Type Required Description
user_id UUID Yes (new) Pilot to assign the package to
rate_id array Yes Array of rate UUIDs to include
total number Yes Total hours in the package
id UUID No Existing package ID to update
expiration string | timestamp No Package expiry date
bill string No 1 to also create a debit bill for the package cost
{
"new": true,
"package": { "UserBillPackage": { "id": "pkg1", "balance": "50.00", ... } },
"bill": "xyz789",
"errors": null
}

POST /bills/manager_delete_package.json

Delete a package and its associated bill (if any). Recalculates the pilot’s balance.

Field Type Required Description
id UUID Yes Package ID

GET /bills/manager_index.json

GET /bills/manager_index/{type}.json

Paginated list of all company bills. type is transactions (default, every non-flight bill), unnumbered (non-flight bills without a bill number), numbered (non-flight bills with a bill number) or flights (flight-linked bills). The manager Bills page uses its tabs Transactions = unnumbered, Bills = numbered and Flights = flights.

Parameter Description
from Start date filter
to End date filter
pilot Filter by pilot user ID
excel Append excel:true for XLS download (requires token)

Each UserBill includes recurring_bill_id: the ID of the recurring charge that posted it, or null for any other transaction. Charges posted by a schedule are ordinary manual transactions otherwise.


GET /bills/manager_stats/{type}.json

POST /bills/manager_stats/{type}.json

Aggregated stats over the full filtered set (not paginated). Same type and filters as manager_index — from, to, pilot. Filters can be sent as POST body or query string. Designed to be fetched in parallel with the first page of manager_index and refetched on every filter change. Charts read from this response, not from the paginated bill list.

type: transactions (default, flight_id = ''), unnumbered (flight_id = '' and no n_id), numbered (flight_id = '' and n_id > 0) or flights (flight_id <> '').

totalSeconds is SUM(billed_time) * 3600 (billed_time stored as hours). topClients returns up to 10 entries ordered by ABS(SUM(total)) desc.

Parameter Description
from Start date (anything strtotime accepts)
to End date (anything strtotime accepts)
pilot Filter by pilot user ID
{
"stats": {
"type": "transactions",
"count": 1842,
"total": 125430.55,
"avg": 68.10,
"positive": 145200.00,
"negative": -19769.45,
"totalSeconds": 0,
"monthly": [
{
"month": "2026-01",
"count": 312,
"total": 21500.00,
"positive": 24000.00,
"negative": -2500.00,
"totalSeconds": 0
}
],
"topClients": [
{
"user_id": "100",
"name": "John Doe",
"count": 87,
"total": 9420.00,
"totalSeconds": 0
}
]
}
}

For type=flights, totalSeconds reflects flight billed time across the filtered set.


A recurring charge posts a manual transaction (a charge) on a schedule to a set of pilots and/or pilot groups. Restricted to user_group_id ≤ 145 and to companies with billing enabled; otherwise 403. The four endpoints below live under /manager/bills/.

GET /manager/bills/recurring.json

List the company’s recurring charges.

{
"RecurringBills": [
{
"id": "b15c0c4e-5b7e-4a58-9d2a-0d6f2f3e8a11",
"name": "Club membership",
"amount": 60,
"total": 72.6,
"assign_number": 1,
"interval_unit": "month",
"interval_count": 1,
"start_date": "2026-12-01",
"end_date": null,
"next_due": "2026-12-01",
"notify": 1,
"active": 1,
"status": "active",
"last_posted_due": null,
"posted_count": 0,
"recipients": [
{ "type": "pilot", "id": 100, "label": "John Doe" },
{ "type": "group", "id": "5f998959-90b4-4677-b5b3-097585fac858", "label": "Cadet students", "color": "#1954cf", "count": 24, "ended": false }
]
}
]
}
Field Description
amount Amount before taxes, always positive
total Amount including taxes, always positive
status active, paused or ended. Ended means the charge stopped after its end date, or it is paused and resuming it now would charge after its end date
next_due / last_posted_due Company-local dates (YYYY-MM-DD)
recipients[].ended For groups: true when the group’s end date has passed, so it charges nobody
recipients Deleted pilots, pilots who left the company and deleted groups are not listed. They are never charged, and the next save drops them

POST /manager/bills/recurring_save.json

Create a recurring charge, or update one when id is sent. Form-encoded.

Field Type Required Description
id UUID Edit only Recurring charge to update
client_id UUID No (new only) A UUID your client makes once per new charge. It becomes the charge’s id: if the same save is sent again (for example after a timeout), the charge it already created is returned with nothing posted, instead of a second charge. A value that is not a UUID is refused
name string Yes Concept shown on each transaction
amount number Yes Amount before taxes per charge, greater than zero. Posted as a negative transaction (a charge)
user_id[] array Yes Pilot IDs and/or pilot group UUIDs. At least one. On edit, pilots and groups that have left the company since they were added are dropped from the charge
interval_unit string Yes week, month or year
interval_count number Yes 1 to 24
start_date string New only First charge date (YYYY-MM-DD, company time)
next_due string Edit only Date of the next charge. Must be after the last posted charge
end_date string No Last date a charge can be posted. On create: on or after start_date. Also checked after saving (create or edit): it must not be before the next charge
notify boolean No Reminder 24 to 48 hours before each charge and the receipt when it posts. Default true
assign_number boolean No Give each posted transaction a bill number

When start_date is today, the first charge is posted before the response is sent. Its receipts are sent just after the response. Saving can take several seconds for a large group, so allow at least a minute before timing out, and send the same client_id if you retry.

{
"result": true,
"RecurringBill": { "id": "b15c0c4e-5b7e-4a58-9d2a-0d6f2f3e8a11", "status": "active", "...": "same shape as the list" },
"posted": { "posted": 1, "skipped": 0, "duplicates": 0, "failed": 0 }
}

POST /manager/bills/recurring_toggle.json

Pause or resume a recurring charge. Form fields: id, active (0 pauses, 1 resumes). Resuming never charges the paused period. If the next charge after resuming would fall after the end date, the charge ends instead and you get the “has ended” error. Returns { "result": true }.

POST /manager/bills/recurring_delete.json

Delete a recurring charge. Form field: id. Transactions it already posted are kept. Returns { "result": true }.

Errors use the usual 400 body, with the reason in message:

Status Message
400 Enter a concept.
400 The amount must be greater than zero.
400 Choose at least one pilot or group.
400 Enter how often to charge: a number from 1 to 24.
400 Choose the date of the first charge. / Choose the date of the next charge.
400 Choose a valid end date.
400 The end date must be on or after the first charge. (creating)
400 The end date is before the next charge. (the next charge, once calculated, falls after the end date; a past start date is not back-charged)
400 The next charge must be after the last charge on {date}.
400 This recurring charge has ended. Create a new one to charge again. (saving, pausing or resuming an ended charge)
400 One of the recipients is not in this company. (a pilot or group added in this save)
400 Invalid client id. (client_id is not a UUID)
404 Recurring charge not found.
403 Not a manager, or billing is not enabled

GET /bills/manager_pilots.json

GET /bills/manager_pilots/{aircraftId}.json

List all active, non-deleted pilots with billing: true. If an aircraft ID is provided, also returns each pilot’s configured hourly price for that aircraft.

{
"pilots": [
{ "id": "100", "name": "John Doe", "group": "170", "groupname": "Pilot", "price": "120.00" }
]
}

GET /bills/manager_packages.json

Paginated list of all packages across all company pilots.


GET /bills/manager_flights.json

Paginated list of flights on billing-enabled aircraft. Supports named parameter filters:

Named Param Description
pilot Filter by PIC or SIC user ID
status billed or notbilled
base Filter by base ID
flight_type Filter by flight type ID
flight_rules Filter by rules (IFR, VFR)
from Filter from date
to Filter to date
excel Append excel:true for XLS download

POST /bills/manager_rate_edit.json

Create or update a billing rate and assign aircraft.

Field Type Required Description
Rate.id UUID No Existing rate ID to update
Rate.name string Yes Rate name
Rate.hourly_price number Yes Price per hour
Rate.pack boolean No Is this a package rate
Rate.aircraft_id array No Aircraft UUIDs to link

POST /bills/manager_rate_delete.json

Soft-delete a rate and remove all aircraft-rate associations.

Field Type Required Description
rateId UUID Yes Rate ID to delete