@extends('layouts.app') @section('title', 'API reference') @section('content')
Base URL: {{ $base }}. JSON only. Every response includes a request_id (also in the X-Request-Id header). Quote it when you contact support.
Create a key under API Keys. Send it on every request:
Authorization: Bearer trv_xxxxxxxx_<40 characters>
Keys in query strings are rejected. Keep keys on your server, never in browser or mobile code. A key can be disabled or rotated at any time. Optional IP allowlists restrict where a key can be used.
{"data": { ... }, "request_id": "01J..."}
{"error": {"code": "insufficient_funds", "message": "...", "request_id": "01J...", "details": {...}}}
| HTTP | Codes |
|---|---|
| 400 | idempotency_key_required, idempotency_key_invalid |
| 401 | missing_api_key, invalid_api_key, too_many_failed_attempts (429) |
| 402 | insufficient_funds (nothing was reserved) |
| 403 | api_key_disabled, account_suspended, email_not_verified, ip_not_allowed, package_required |
| 404 | not_found, service_not_available, order_not_found |
| 405 | method_not_allowed (see the Allow header) |
| 409 | idempotency_key_reused, out_of_stock |
| 422 | validation_failed, invalid_product, product_unavailable, too_many_units, shell_single_product |
| 429 | rate_limited (see Retry-After) |
| 503 | provider_unavailable, maintenance |
| 500 | internal_error: quote the request_id |
Your best active package sets the limit per minute, shared by all your keys (default 30). Responses carry X-RateLimit-Limit and X-RateLimit-Remaining. Wait the number of seconds in Retry-After after a 429.
GET /balance — your wallet: available and reserved (decimal strings).
GET /packages — catalog (packages you can buy) and owned (your purchases with remaining quota).
GET /services — active services, the products you may order and the price you would pay. Unpriced products are never listed.
POST /orders/free-fire/unipin and POST /orders/free-fire/shell — place an order. Required header Idempotency-Key (8–100 characters: letters, digits, _ - : .); reuse the same key only for the same request. Body:
{
"player_uid": "123456789",
"items": [{"product": "unipin-80uc", "quantity": 2}], // at most {{ $maxUnits }} units in total
"reference": "your-own-reference", // optional
"region": "sgshell" // Shell only: shell | sgshell | myshell | indoshell
}
202 = accepted (status: pending or processing). 200 with Idempotent-Replayed: true = the same order returned again, nothing new charged. Prices are always set by TREVO; any price you send is ignored. Successful items are charged, failed items are released.
GET /orders/{order_id} — current state of your order. Statuses: pending, processing, success, partial, failed, manual_review, refunded. Funds stay reserved while an order is processing or in manual_review.
Register up to {{ $maxEndpoints }} HTTPS endpoints under Webhooks. We POST a JSON envelope when an order changes:
{
"id": "01J...", // unique per event: de-duplicate on this
"type": "order.updated",
"created_at": "2026-12-06T10:00:00Z",
"data": { "order": { "order_id": "01J...", "status": "success", "amount": {...}, "items": [...] } }
}
Headers: X-Trevo-Event, X-Trevo-Delivery (= the event id), X-Trevo-Signature: t=<unix>,v1=<hex>.
Verify: compute HMAC-SHA256(secret, t + "." + raw_body) and compare it with v1 using a constant-time comparison. Reject timestamps more than 5 minutes old. The example is shown when you create an endpoint.
Delivery: respond with any 2xx within 10 seconds. Anything else is retried with increasing delays (about 1 min, 5 min, 15 min, 1 h, 2 h, 6 h, 12 h), up to 8 attempts. The payload never contains provider references, voucher codes or credentials.
Test deliveries use type: webhook.test.
Changes to these endpoints are announced under Announcements.
@endsection