Docs

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 key
Subtract from a goal counter, optionally attaching metadata for context.
ParameterTypeRequiredDescription
goalId (body)stringThe goal slug ID (created in the dashboard)
propertyId (body)stringProperty the goal belongs to
sessionId (body)stringSession this decrement is attributed to. Alphanumeric with hyphens, max 128 chars. The Goals SDK fills this from the request via forRequest(req).
amount (body)numberFor revenue goals, dollars to subtract from progress. For count goals, ignored for progress (each call subtracts one conversion).
metadata (body)objectKey-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 amount must be positive. It represents how much to subtract (e.g., amount: 3 subtracts 3)