Decrement
Subtract from a goal counter
Last updated:
Decrement a goal counter. Useful for refunds, cancellations, inventory adjustments, or any scenario where progress needs to be reversed.
Decrement a Goal
POST
/v1/goals/decrement Secret keySubtract from a goal counter, optionally attaching metadata for context.
| Parameter | Type | Required | Description |
|---|---|---|---|
| goalId (body) | string | ✓ | The goal slug ID (created in the dashboard) |
| propertyId (body) | string | ✓ | Property the goal belongs to |
| sessionId (body) | string | ✓ | Session this decrement is attributed to. Alphanumeric with hyphens, max 128 chars. The Goals SDK fills this from the request via forRequest(req). |
| amount (body) | number | For revenue goals, dollars to subtract from progress. For count goals, ignored for progress (each call subtracts one conversion). | |
| metadata (body) | object | Key-value string pairs for context. Max 5 keys, 256 chars per key and value. |
Response
{ "success": true }Example
bash
curl -X POST "https://api.sessionsight.com/v1/goals/decrement" \
-H "x-api-key: YOUR_SECRET_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"goalId": "",
"propertyId": "",
"sessionId": "",
"amount": "1",
"metadata": ""
}'Notes
- The decrement is stored as a negative increment internally, so it affects all aggregation (current period totals, previous period comparisons, etc.)
- The
amountmust be positive. It represents how much to subtract (e.g.,amount: 3subtracts 3)