Skip to content

Deduct credits

POST /api/v2/entitlements/deduct

Deducts credits from a contact’s entitlement — call it when a booking is confirmed or a visit happens. Requires the deduct scope and is idempotent via request_id.

FieldTypeRequiredNotes
location_idstringyesMust match the token’s location
request_idstringyesIdempotency key
external_contact_idstringyes†Provider-neutral contact id. Send this or ghl_contact_id — interchangeable; must match the id used on the grant
ghl_contact_idstringyes†The GoHighLevel contact id. Interchangeable with external_contact_id
product_config_idstringyes*The product config to deduct from
calendar_idstringyes*Alternative to product_config_id
amountintegernoCredits to deduct; defaults to 1
external_refstringnoBooking or event reference
appointment_timestringnoISO 8601 timestamp of the appointment

* Either product_config_id or calendar_id is required.
† Exactly one of external_contact_id or ghl_contact_id is required.

Terminal window
curl -X POST https://app.<your-domain>/api/v2/entitlements/deduct \
-H "Authorization: Bearer ktly_<your-token>" \
-H "Content-Type: application/json" \
-d '{
"location_id": "loc_1",
"request_id": "booking-123-deduct",
"ghl_contact_id": "ghl_contact_123",
"product_config_id": "pc_package_1",
"amount": 1,
"external_ref": "booking_123"
}'
{
"ok": true,
"reason_code": "deducted",
"correlation_id": "a1b2c3d4-...",
"balance_after": 9,
"entitlement_id": "kotally-entitlement-uuid"
}
  • balance_after — the contact’s remaining available credits after the deduction.
reason_codeMeaning
NO_ENTITLEMENTContact has no matching entitlement
INSUFFICIENT_CREDITSNot enough credits to complete the deduction
BILLING_SUSPENDEDWorkspace billing is suspended
REQUEST_IN_PROGRESSSame request_id is still being processed — retry after a short delay

See the Overview for HTTP status codes and the full reason-code list.