Buy a credit pack on the saved card

POST/v1/billing/purchase

Buys a credit pack on the account's saved card, from $50 for 500 credits, only if the account owner has turned agent purchases on.

View as MarkdownOpenAPI specAll docs for LLMs

  • Auth: API key (Authentication)
  • Scope: none
  • Cost: Charges the account's saved card the pack price ($50 to $1,000).

Use it when a job runs out of credits (402 insufficient_credits) and the owner has allowed it. Otherwise hand error.offers.pack.buyUrl to a person.

Buys starter ($50, 500 credits), growth ($150, 2,500), pro ($400, 10,000) or scale ($1,000, 40,000) on the card saved at the account's first checkout. Off until the account owner turns on agent purchases and sets per-purchase and 30-day limits (403 purchase_not_allowed).

Request

curl -X POST "https://api.installgraph.com/v1/billing/purchase" \
  -H "Authorization: Bearer $INSTALLGRAPH_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"pack":"starter"}'

Body

JSON.

Field Type Description
pack string One of starter, growth, pro, scale.

Response

200. The example's stores are fictional.

{
  "data": {
    "pack": "starter",
    "credits": 500,
    "priceUsd": 50,
    "balance": 546
  }
}

Every keyed response also carries meta (requestId, creditsUsed, creditsRemaining, freeRepulls) and the X-Credits-* and X-RateLimit-* headers. See Credits and Rate limits.

Errors

Status Code Meaning What to do
402 spend_cap_reached Purchases would pass $1,000 in 30 days. Talk to us for more: error.offers.talkToUs.url.
402 payment_failed The saved card was declined. Ask the account owner to update the card at installgraph.com/account.
403 purchase_not_allowed Agent purchases are off for this account, the pack is over the owner's limits, or the key has no account. Hand error.offers.pack.buyUrl to a person; the owner sets limits at error.settings.
409 no_payment_method No card is saved, so nothing can be bought off-session. Buy a pack once at installgraph.com/account to save a card.

All codes: Errors.