Appearance
Subtract
http
POST https://api.creduse.com/subtract
Subtracts credits from a user's balance. This is typically used when a user performs an action that consumes credits.
- If the user does not have enough credits, the request will return an
InsufficientFunds
error. - The subtraction follows the FIFO principle: the oldest credits are subtracted first. For more information, see the Credit Subtraction Logic page.
Request body
Parameter | Type | Description |
---|---|---|
end_user_id | UUID | Required. The unique identifier of the user. |
amount | integer | Required. The amount of credits to subtract from the user's balance. Positive integers only. |
Example request
curl
curl https://api.creduse.com/subtract \
-H "Authorization : Bearer $YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"end_user_id": "UUID",
"amount": 100
}' \
Response
Returns a subtraction object. The response will include the end_user_id
and the amount
of credits subtracted.
json
{
"end_user_id": "UUID",
"amount": 100
}