Skip to content

Add

http
POST https://api.creduse.com/add

Add credits to a user's balance. This is useful for adding credits to a user for marketing purposes, or for customer service reasons. For example, you could add credits to a user's balance as a reward for referring a friend or as a compensation for a service issue.

The /add endpoint facilitates free trials and pay-as-you-go billing approaches, allowing users to top up their credit balance on-demand. With a pay-as-you-go model, users can incrementally purchase credits and consume services or features as needed, paying only for what they use.

  • The credits will be valid for a certain number of days, after which they will expire.
  • The credits will not be automatically renewed.

Request body

ParameterTypeDescription
end_user_idUUIDRequired. The unique identifier of the user.
amountintegerRequired. The number of credits to add to the user's balance.
validity_daysinteger or nullThe number of days the credits will be valid. There is no limit to the number of days. Defaults to 31.

Example request

curl
curl https://api.creduse.com/add \
    -H "Authorization : Bearer $YOUR_API_KEY" \
    -H "Content-Type: application/json" \
    -d '{
        "end_user_id": "UUID",
        "amount": 100,
        "validity_days": 60
        }' \
Python
from creduse import CreduseClient
client = CreduseClient()

client.add(
    end_user_id=UUID("12345678-1234-5678-1234-567812345678"),
    amount=100,
    validity_days=60
)

Returns

Returns an addition object.

json
{
  "end_user_id": "UUID",
  "amount": 100
}