Bills

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


List Bills (Pilot Wallet)

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) see only their own. Linked flight info is included if the flight is not deleted.

Query Parameters

Parameter
Type
Description

limit

number

Records per page (default: 10)

Response

{
  "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
}

View Bill

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).

Path Parameters

Parameter
Type
Description

id

UUID

Bill ID

Response


Create Manual Bill

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.

Request Body

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

Mark as a receipt

id

UUID

No

Existing bill ID to update

Response


Bill a Flight

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 and not deleted.

Query Parameters

Parameter
Type
Description

id

UUID

Flight ID

Request Body (POST)

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

Send notification email to pilot

use_packages

boolean

No

Deduct from pilot's package balance

created

string

No

Bill date (defaults to onblocks_time)

Response


Delete Bill

POST /bills/delete.json

Delete a bill and recalculate the pilot's balance.

Request Body

Field
Type
Required
Description

bill

UUID

Yes

Bill ID to delete

Response


Auto-Bill a Flight

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.

Request Body (POST)

Field
Type
Required
Description

flight

UUID

Yes

Flight ID

user

UUID

No

Override pilot to bill

Response


Get Pilot Balance

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.

Response


Create Stripe Payment Intent

GET /bills/pay.json

POST /bills/pay.json

Initiate a Stripe Checkout session to allow a pilot to pay their balance. Requires Stripe to be enabled and configured for the company.

Request Body (POST)

Field
Type
Required
Description

amount

number

No

Amount to pay (defaults to current balance)

Response


Complete Stripe Checkout

GET /bills/checkout/{token}.json

Process a completed Stripe Checkout session. Called automatically via the Stripe success_url redirect. Verifies payment status, records the credit, and notifies company managers.

Path Parameters

Parameter
Type
Description

token

string

Stripe Checkout session ID

Response


Download Bills (XLS)

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.


List Rates

GET /bills/rates.json

GET /bills/rates/true.json

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

Response


View Rate

GET /bills/rate/{id}.json

Retrieve a single rate with linked aircraft.


Get Rates for Aircraft

GET /bills/aircraft/{aircraftId}.json

List all rates configured for a specific aircraft.


List Packages (Pilot)

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).

Response


View Package

GET /bills/package/{id}.json

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


Create / Update Package

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.

Request Body

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

Response


Delete Package

POST /bills/manager_delete_package.json

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

Request Body

Field
Type
Required
Description

id

UUID

Yes

Package ID


Manager: List All Bills

GET /bills/manager_index.json

GET /bills/manager_index/{type}.json

Paginated list of all company bills. type is transactions (default, non-flight bills) or flights (flight-linked bills).

Named Parameters / POST Filters

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)


Manager: Bill Stats

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_indexfrom, 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 = '') 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.

Filters (POST body or query string)

Parameter
Description

from

Start date (anything strtotime accepts)

to

End date (anything strtotime accepts)

pilot

Filter by pilot user ID

Response

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


Manager: List Billable Pilots

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.

Response


Manager: List All Packages

GET /bills/manager_packages.json

Paginated list of all packages across all company pilots.


Manager: Billable Flights

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


Manager: Create / Update Rate

POST /bills/manager_rate_edit.json

Create or update a billing rate and assign aircraft.

Request Body

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


Manager: Delete Rate

POST /bills/manager_rate_delete.json

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

Request Body

Field
Type
Required
Description

rateId

UUID

Yes

Rate ID to delete

Last updated