AI credit client wallets

Add or take away credits

Moves one balance: RECURRENCE moves recurrence_balance (the allowance the next cycle refills to is unchanged), TOPUP moves topup_balance. A positive amount adds, a negative one takes away, and a balance never goes below zero. For corrections only - AI usage is deducted automatically. Errors: wallet_not_found, invalid_value.

post/api/ai-credits/wallets/{wallet_id}/credits

Request

  • Base URL
    https://api.duda.co
  • URL
    https://api.duda.co/api/ai-credits/wallets/{wallet_id}/credits
  • Auth
    HTTP basic

Path parameters

wallet_idstring required

Request body

amountstring required

A signed decimal string: positive adds, negative takes away. Zero is rejected; at most 2 decimals and 99999999.99 either way. A balance never goes below zero - taking more than is there lands it on zero.

type'RECURRENCE' | 'TOPUP' required

Which balance moves.

Example request

{
  "amount": "-12.5"
}

Response

OK

created_atstring date-time
idstring

Minted by Duda and immutable. Store it against your own customer record.

namestring

The id when no name was set.

recurrence_amountstring

The recurring allowance, as a decimal string.

recurrence_balancestring

What is left of the recurring allowance this cycle, as a decimal string. Moved by POST /credits.

recurrence_dayinteger

Day of the month (1-31) the cycle turns over. Clamps to the month's length.

topup_balancestring

A single flat top-up figure, as a decimal string. It never expires.

updated_atstring date-time

Example response

{
  "assigned_accounts": [
    {
      "account_name": "acme-corp"
    }
  ],
  "id": "3f9c1a7e-4b21-4d9a-9f0e-8c2d1a5b7e33",
  "name": "Acme Corp",
  "recurrence_amount": "500.0",
  "recurrence_balance": "320.0",
  "recurrence_day": 15,
  "topup_balance": "100.0"
}

Changes

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