API reference

Account and billing

Three routes: the calls you have left, the history of your balance, and a payment page for more calls.

In short

  • Three routes: the account of your key, the ledger and a payment page.
  • All three need a key and cost nothing.

The samples continue from the quick start: they use its helper call.

The routes

GET /v1/account

Calls left, limits and usage of the key.

The calls you have left, the limits in force, and the usage of the key you send.

Key neededFree

Request

curl -sS "$GECKO_API/v1/account" -H "Authorization: Bearer $GECKO_KEY"

Answer

{
  "id": "acct_00VcT0dVK9hYwgNL7TOtz",
  "name": "Rivertown Poker Labs",
  "status": "active",
  "credits": 14547,
  "plan": null,
  "limits": {
    "account": {"max_concurrent": 1, "monthly_credits": null, "max_credits_per_request": 20000, "expand_all": true},
    "key": {"rpm": 120, "daily_credits": 5000, "monthly_credits": null}
  },
  "usage": {"account_month": 453, "key_day": 12, "key_month": 453},
  "key": {"id": "key_00VcT0dVWUNMMpSY2DTbJ", "name": "Production server", "env": "live", "hint": "gecko_live_qfP...evB1"}
}

credits is the calls you have left. usage counts calls: this month for the account, today and this month for the key. Days and months are in UTC.

ErrorsThe errors of the key and the account.

GET /v1/ledger

Every change of the balance.

Every change of the balance, newest first: solves, calls returned for failed solves, packs, plans and grants.

Key neededFree

Parameters

NameWhere and typeRequiredMeaning and limits
limitquery · whole numberNo1 to 500. Default 100.
afterquery · numberNoThe next value of the page before. Stop when next is null.

Request

curl -sS "$GECKO_API/v1/ledger?limit=2" -H "Authorization: Bearer $GECKO_KEY"

Answer

{
  "data": [
    {"id": "led_00VcT5fj2aQmW1xYb7Tn4", "type": "solve", "credits": -1, "balance": 14999, "ts": 1796049035.03,
     "solve_id": "slv_00VcT0iMuhDqPySfwtq2K", "root_id": "slv_00VcT0iMuhDqPySfwtq2K", "key_id": "key_00VcT0dVWUNMMpSY2DTbJ", "street": "flop"},
    {"id": "led_5c1f0e3a9b7d4c2e8f6a1b3d5e7f", "type": "topup", "credits": 2500, "balance": 15000, "ts": 1796040000.0,
     "ref": "cs_...", "note": "2,500 calls", "amount": 25000, "currency": "usd"}
  ],
  "next": null
}

type is solve, refund, topup, plan or grant. amount is in cents. A test key makes no ledger lines.

Errorsinvalid_request, and the errors of the key and the account.

POST /v1/billing/checkout

A payment page for a pack or a plan.

The address of a payment page for one pay-per-call pack or one monthly plan. Calls are added after the payment is confirmed to us.

Key neededFree

Parameters

NameWhere and typeRequiredMeaning and limits
packbody · stringOne of the twoThe id of a pack from GET /v1/pricing, such as calls-2500.
planbody · stringOne of the twoThe id of a plan, such as builder. An account has one plan at a time.
codebody · stringNoA discount code, with plan only. A code that does not apply to the plan is refused: 422 invalid_request.
success_url, cancel_urlbody · stringNoWhere the payment page sends the buyer after it.

Request

curl -sS -X POST "$GECKO_API/v1/billing/checkout" \
  -H "Authorization: Bearer $GECKO_KEY" -H "Content-Type: application/json" \
  -d '{"pack": "calls-2500"}' 

Answer

{"id": "cs_...", "url": "https://checkout.stripe.com/..."}

A payment started this way does not save the card for automatic top-up. More in Payments.

Errorsinvalid_request, billing_unavailable, and the errors of the key and the account.