Reward Used Callback
The signed call your server makes to mark a Digia Engage gamification reward as used: the request, how to sign it, and the responses.
Call this API from your server when a user redeems a reward, for example when the coupon is applied at checkout. The reward then moves to Used on the user's rewards page. Tapping the reward button doesn't mark it used.
Get the grantId from the reward.won webhook or from the
{{grantId}} placeholder in a reward link.
Request
POST https://app.digia.tech/api/v1/engage/inbound/rewards/used
Call it from your server, never from the app.
| Header | Value |
|---|---|
Content-Type | application/json |
x-digia-project-id | Your project's API key, from Project settings → API Key. |
x-digia-timestamp | The current Unix time in seconds. |
x-digia-signature | The signature, in lowercase hex. |
Body:
{ "grantId": "665f1c2e9a1b2c3d4e5f6a7b", "usedAt": "2026-11-20T10:15:00.000Z" }
| Field | |
|---|---|
grantId | Required. The ID of the win. |
usedAt | Optional. ISO 8601 time. Defaults to now. |
Signature
Sign the call with your webhook signing secret, the same way as the webhook signature. You get the secret when you save a webhook in Project settings → Webhook.
| Algorithm | HMAC-SHA256 |
| Key | The signing secret, as a text string. |
| Signed text | ${timestamp}.${rawBody}: the x-digia-timestamp value, a dot, and the exact body you send. |
Build the body string once, sign it, and send that same string.
- Node.js
- Python
import crypto from 'node:crypto';
export async function markRewardUsed(grantId, usedAt = new Date()) {
const body = JSON.stringify({ grantId, usedAt: usedAt.toISOString() });
const timestamp = Math.floor(Date.now() / 1000);
const signature = crypto
.createHmac('sha256', process.env.DIGIA_WEBHOOK_SECRET)
.update(`${timestamp}.${body}`)
.digest('hex');
const response = await fetch('https://app.digia.tech/api/v1/engage/inbound/rewards/used', {
method: 'POST',
headers: {
'content-type': 'application/json',
'x-digia-project-id': process.env.DIGIA_PROJECT_API_KEY,
'x-digia-timestamp': String(timestamp),
'x-digia-signature': signature,
},
body,
});
if (!response.ok) throw new Error(`Digia answered ${response.status}`);
}
import hashlib
import hmac
import json
import os
import time
from datetime import datetime, timezone
import requests
def mark_reward_used(grant_id: str) -> None:
body = json.dumps(
{"grantId": grant_id, "usedAt": datetime.now(timezone.utc).isoformat(timespec="milliseconds")},
separators=(",", ":"),
)
timestamp = str(int(time.time()))
signature = hmac.new(
os.environ["DIGIA_WEBHOOK_SECRET"].encode(),
f"{timestamp}.{body}".encode(),
hashlib.sha256,
).hexdigest()
response = requests.post(
"https://app.digia.tech/api/v1/engage/inbound/rewards/used",
data=body.encode(), # send the same bytes you signed
headers={
"Content-Type": "application/json",
"x-digia-project-id": os.environ["DIGIA_PROJECT_API_KEY"],
"x-digia-timestamp": timestamp,
"x-digia-signature": signature,
},
timeout=10,
)
response.raise_for_status()
Responses
| Status | Meaning |
|---|---|
200 | The reward is marked used. Repeat calls are safe. |
400 | The body is invalid. |
401 | Authentication failed. Check the API key, timestamp, secret and signature. |
404 | No win with that grantId in your project. |
500 | A Digia error. Try again. |