Create Credit Batch
Creates a new credit batch for the specified client, setting an initial balance and optionally associating the batch with a credit account and expiration date
Creates a new credit batch for the specified client, setting an initial balance and optionally associating the batch with a credit account and expiration date.
POST
https://example.thoughtindustries.com/incoming/v2/clients/:id/creditBatchesExample request
curl -X POST "https://example.thoughtindustries.com/incoming/v2/clients/:id/creditBatches" \
-H 'Authorization: Bearer YOUR_API_KEY' \
-H 'Content-Type: application/json' \
-d '{
"clientId": "00000000-0000-0000-0000-000000000000",
"startingBalance": 0,
"creditAccountId": "00000000-0000-0000-0000-000000000000",
"name": "string"
}'Parameters
| Name | Type | Required | Location | Description |
|---|---|---|---|---|
id | string | Yes | path | The id identifier. |
clientId | uuid | No | body | UUID of the client to associate with this credit batch. |
startingBalance | number | Yes | body | Initial number of credits to assign to the batch. |
creditAccountId | uuid | No | body | UUID of the credit account to link to this batch. |
name | string | No | body | Display name for the credit batch. |
expiresOn | ISO 8601 timestamp | No | body | Date and time at which the credit batch expires, in ISO 8601 format. |
Example response
{
"data": {
"CreateCreditBatch": {
"id": "00000000-0000-0000-0000-000000000000",
"name": "string",
"expiresOn": "2024-01-01T00:00:00.000Z",
"startingBalance": 0,
"currentBalance": 0,
"clientId": "00000000-0000-0000-0000-000000000000",
"status": "active",
"createdAt": "2024-01-01T00:00:00.000Z",
"updatedAt": "2024-01-01T00:00:00.000Z",
"creditAccountId": "00000000-0000-0000-0000-000000000000",
"allocatedCredits": 0
}
}
}Response fields
| Field | Type | Description |
|---|---|---|
id | uuid | Unique identifier of the newly created credit batch. |
name | string | Display name of the credit batch. |
expiresOn | ISO 8601 timestamp | Date and time at which the credit batch expires, in ISO 8601 format. |
startingBalance | number | Number of credits assigned to the batch at creation. |
currentBalance | number | Number of credits currently remaining in the batch. |
clientId | uuid | UUID of the client associated with this credit batch. |
status | CreditBatchStatus | Current status of the credit batch (e.g., active). |
createdAt | ISO 8601 timestamp | Date and time the credit batch was created, in ISO 8601 format. |
updatedAt | ISO 8601 timestamp | Date and time the credit batch was last updated, in ISO 8601 format. |
creditAccountId | uuid | UUID of the credit account linked to this batch. |
allocatedCredits | number | Number of credits from this batch that have been allocated. |