Credits

Buy a credit pack

Buys exactly what a quote showed. confirmed: true states that the person who pays said yes to that quote; pass their own words in user_confirmation. Every purchase records who confirmed it, when, through which key or connection, the amount and the quote. Buy with the same key or connection that asked for the quote; a quote from another one is refused with 409 quote_other_session. With pay_with: auto the saved card the owner allowed in the app is charged right away when the amount fits the owner's monthly limit and the workspace's limits; the credits are added at once and a receipt is emailed. Otherwise you get checkout_url, a payment page the person pays themselves; the credits arrive with that payment. The quote id makes this safe to retry: the same quote is never charged twice, and a repeat returns the first answer with replayed: true.

CostWhat it doesKey scopes
The pack price, charged only after the person who pays confirmed the quoteCharges moneyargorant:manage_lists
post/api/v1/credits/purchases

Request

  • Base URL: https://app.argorant.com
  • URL: https://app.argorant.com/api/v1/credits/purchases
  • Auth: HTTP bearer

Headers

Idempotency-Keystring

Any unique text up to 128 characters. A retry with the same key and the same body within 24 hours returns the first answer (with the header Idempotent-Replayed: true) instead of doing the work twice. The same key with another body answers 409 idempotency_conflict.

X-Request-Idstring

Your own id for this request, 8 to 64 letters, digits, dot, dash or underscore. Returned as X-Request-Id; one is made for you when you send none.

Request body

quote_idstring uuid required

The quote the person said yes to.

confirmedboolean required

true: the person who pays saw the quote and said yes.

pay_with'auto' | 'link'

auto: the saved card when allowed, else a payment link. link: always a payment link.

user_confirmationstring

The person's own words that said yes to the quote, quoted exactly (up to 1,000 characters). Recorded with the purchase; without it the record says confirmed=true.

price_shown_centsinteger

The price you showed the person, in cents of the quote's currency. Recorded with the purchase. A price that differs from the quote is refused with 409 price_mismatch.

tool_call_idstring

The id of your tool call that carries this yes, if your app has one. Recorded with the purchase.

Example request

{
  "quote_id": "2f8a1b3c-4d5e-4f70-8192-a3b4c5d6e7f8",
  "confirmed": true,
  "user_confirmation": "Yes, buy the 5,000 credits for $69",
  "price_shown_cents": 6900,
  "tool_call_id": "toolu_01AbC"
}

Response

Payment link or Paid with the saved card

purchase_idstring uuid

Purchase id, the same as the quote id.

status'paid' | 'awaiting_payment' | 'processing' | 'not_charged' | 'expired'

paid: credits added. awaiting_payment: send checkout_url to the person who pays. processing: wait a minute. not_charged: the card was not charged. expired: the link ran out unpaid.

paid_withstring nullable

saved_card or payment_link.

cardstring nullable

The saved card that was charged, for example card ending 4242.

creditsinteger

Credits bought.

credits_addedinteger

Credits added to the account.

amount_centsinteger

Amount in cents.

currencystring

Currency.

checkout_urlstring uri nullable

Payment page for the person who pays.

messagestring

What happened, in one or two sentences.

saved_cardobject

Present when the saved card was not used, with used (false), code and reason.

replayedboolean

Present and true when this is the answer of an earlier call with the same quote.

Changes

No recorded changes to this operation across all 1 revision of this API.