AviMiles / Docs
Documentation / Developer API
Developer API

Mileage API

Award, deduct, set or reverse miles safely.

Award miles

POST /miles/award with a positive amount (up to 10,000), reason and unique idempotency key.

{"roblox_id":"123456789","miles":200,"reason":"Test award","idempotency_key":"test-award-001"}

Deduct or set balance

POST /miles/deduct with the same fields and a positive amount up to 1,000,000. POST /miles/set-balance with balance instead of miles. Negative balances are rejected.

Reverse a transaction

POST /miles/reverse with transaction_id and reason. Reversal creates a compensating transaction, not a deletion.

{"transaction_id":42,"reason":"Correct test award"}

Safe retries

Reuse the same idempotency key only when retrying the same operation. Use a new key for a new award. Manual and API awards do not apply tier multipliers automatically.

Example correction workflow

Read the passenger balance and transactions first. If an award was incorrect, use its transaction ID with the reverse endpoint. If you need to set an exact balance, use set-balance with a new idempotency key. Read the balance again to confirm the result.