Introduction
APIs
- Authentication
- Customers
- Accounts
- Aliases
- Event Schemas
- Usage Meters
- AddOns
- Licenses
- Feature
- (Deprecated) Price Plans
- Price Plan V2
- Settings
- Price Experimentation
- Jobs
- Event Ingestion
- Entitlements
- Event Management
- Metrics
- Credits
- Invoices
- Payments
- Wallet
- InvoiceGroups
- Alerts
- Reports
Grant credit
Grant credit
curl --request POST \
--url https://api.togai.com/credits \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{
"creditRequests": [
{
"accountId": "ACC001",
"purpose": "Prepaid Credit",
"effectiveFrom": "2023-02-04",
"effectiveUntil": "2024-02-04",
"creditAmount": 1000,
"priority": 1
}
]
}'
[
{
"id": "creds.1znQx9jiIXw.r44fc",
"customerId": "7VcRw9xZDIqsC5E",
"accountId": "ACC001",
"purpose": "Prepaid Credit",
"effectiveFrom": "2020-07-04",
"effectiveUntil": "2021-07-04",
"status": "ACTIVE",
"creditAmount": 1000,
"creditUnit": "USD",
"holdAmount": 500,
"consumedAmount": 400,
"priority": 1,
"createdAt": "2020-07-04T12:00:00.000Z"
},
{
"id": "creds.1znQ46jiIXw.r24fc",
"customerId": "7VcRw9xZDIqsC5E",
"accountId": "ACC001",
"purpose": "Prepaid Credit",
"effectiveFrom": "2020-08-04",
"effectiveUntil": "2021-08-04",
"status": "ACTIVE",
"creditAmount": 1000,
"creditUnit": "USD",
"holdAmount": 500,
"consumedAmount": 400,
"priority": 1,
"createdAt": "2020-08-04T12:00:00.000Z"
}
]
Authorizations
Bearer authentication header of the form Bearer <token>
, where <token>
is your auth token.
Body
payload to create credits
Payload to grant Credits
"ACC001"
"PREPAID_CREDIT"
"2020-07-04"
1
List of entity ids for which the credit is applicable. If null or empty, the credit is applicable to all ids. This list can accept special values like: - ALL_USAGE_METER_RATE_CARDS: To apply the credit to all usage meter rate cards - ALL_FIXED_FEE_RATE_CARDS: To apply the credit to all fixed fee rate cards
"2021-07-04"
1000
The entity through which the credit has been granted
The idempotency key for uniqueness of the credit record
Response
Payload to grant Credits
"ACC001"
"PREPAID_CREDIT"
"2020-07-04"
1
Identifier of credits
50
"cred.1znqBOVcai0.0tBFz"
"7VcRw9xZDIqsC5E"
ACTIVE
, CONSUMED
, EXPIRED
, VOIDED
"ACTIVE"
List of entity ids for which the credit is applicable. If null or empty, the credit is applicable to all ids. This list can accept special values like: - ALL_USAGE_METER_RATE_CARDS: To apply the credit to all usage meter rate cards - ALL_FIXED_FEE_RATE_CARDS: To apply the credit to all fixed fee rate cards
"2021-07-04"
1000
The entity through which the credit has been granted
The idempotency key for uniqueness of the credit record
"USD"
500
400
curl --request POST \
--url https://api.togai.com/credits \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{
"creditRequests": [
{
"accountId": "ACC001",
"purpose": "Prepaid Credit",
"effectiveFrom": "2023-02-04",
"effectiveUntil": "2024-02-04",
"creditAmount": 1000,
"priority": 1
}
]
}'
[
{
"id": "creds.1znQx9jiIXw.r44fc",
"customerId": "7VcRw9xZDIqsC5E",
"accountId": "ACC001",
"purpose": "Prepaid Credit",
"effectiveFrom": "2020-07-04",
"effectiveUntil": "2021-07-04",
"status": "ACTIVE",
"creditAmount": 1000,
"creditUnit": "USD",
"holdAmount": 500,
"consumedAmount": 400,
"priority": 1,
"createdAt": "2020-07-04T12:00:00.000Z"
},
{
"id": "creds.1znQ46jiIXw.r24fc",
"customerId": "7VcRw9xZDIqsC5E",
"accountId": "ACC001",
"purpose": "Prepaid Credit",
"effectiveFrom": "2020-08-04",
"effectiveUntil": "2021-08-04",
"status": "ACTIVE",
"creditAmount": 1000,
"creditUnit": "USD",
"holdAmount": 500,
"consumedAmount": 400,
"priority": 1,
"createdAt": "2020-08-04T12:00:00.000Z"
}
]