> ## Documentation Index
> Fetch the complete documentation index at: https://docs.usehydra.co.za/llms.txt
> Use this file to discover all available pages before exploring further.

# Report activities

> Submit confirmed member activity and handle retries and action changes.

Use your [action mapping](https://docs.usehydra.co.za/integrations/app-rewards/setup.md#read-and-map-actions) and the [member ID](https://docs.usehydra.co.za/integrations/app-rewards/members.md) saved for the account.

Report the agreed backend event after verifying it really happened. A client
button press alone should not prove that an order was paid or completed. Define
one reporting point so a payment callback and an order callback do not credit the
same purchase as two separate occurrences.

For each occurrence, create and persist an `external_activity_id` before the first
request. It is case-sensitive, 16–80 ASCII letters, digits, hyphens or underscores.
It must be unique across this integration's members and actions, and stay stable
across retries, app restarts and credential rotation. Do not include personal data.

Keep the complete submitted payload with that app event. For example, save
`activity.json`:

```json theme={null}
{
  "member_id": "7b9b1e00-1100-4000-8000-000000000001",
  "action_id": "7b9b1e00-2200-4000-8000-000000000001",
  "action_version": 1,
  "external_activity_id": "purchase_20261019_000003"
}
```

```sh theme={null}
curl --silent --show-error \
  --request POST "$HYDRA_BASE_URL/integration/activities" \
  --header "Authorization: Bearer $HYDRA_TOKEN" \
  --header "Content-Type: application/json" \
  --data @activity.json
```

A new accepted activity returns `201`. On the illustrative third purchase:

```json theme={null}
{
  "activity_id": "7b9b1e00-4400-4000-8000-000000000003",
  "duplicate": false,
  "points_awarded": 10,
  "balance_after_activity": 30,
  "reward_ids": ["7b9b1e00-5500-4000-8000-000000000001"]
}
```

When Hydra accepts the activity, it records points and evaluates campaigns
together. Gift issuance follows, so an issuing failure does not undo accepted points.

Save the receipt and mark the app event as accepted. The activity ID is Hydra's
reference for this receipt. The balance is the historical balance at acceptance,
not a continually updated value. Reward IDs refer to saved gift records and are
not evidence that a voucher is issued or usable.

`reward_ids` can be empty at a reached goal if funding or offering availability
delays gift creation. Read current progress and gifts to check the outcome;
do not submit another activity to get a gift ID.

Hydra uses acceptance time for campaign progress. Report confirmed events promptly;
backdated imports and caller timestamps are unsupported. If an outage leaves old
submissions pending, check their campaign timing with us before sending them.

## Handle retries and action edits

**Retry an uncertain request with its original payload and occurrence ID.** A new
ID represents another occurrence and may award points again.

An exact replay returns `200`:

```json theme={null}
{
  "activity_id": "7b9b1e00-4400-4000-8000-000000000003",
  "duplicate": true,
  "points_awarded": 0,
  "balance_after_activity": 30,
  "reward_ids": ["7b9b1e00-5500-4000-8000-000000000001"]
}
```

The activity ID, historical balance and reward IDs match the original receipt,
even after later activity, action edits or credential rotation. Replay does not
run campaign evaluation, issuance or delivery. To learn what happened to a gift,
read its current state rather than repeatedly submitting the activity.

| Situation | Next action |
| - | - |
| Network timeout, connection loss or `500 internal_error` | Acceptance may be unknown to your app. Retry the identical saved payload and ID with bounded backoff. Never create a replacement ID. |
| `503 authentication_unavailable` | Pause/back off until access checks recover, then retry the same request. Do not treat this as a reason to replace credentials or IDs. |
| `429 rate_limited` | Honor `Retry-After` (currently 60 seconds). Then retry the same payload and ID. |
| `409 action_changed` | This occurrence was not accepted. Refresh actions and confirm the merchant's intended mapping. Then update the action/version as appropriate while preserving this unaccepted occurrence's ID. |
| `409 idempotency_conflict` | The ID already represents another member/action/version. Stop automated retries, inspect the saved original payload and resolve the app bookkeeping problem. |
| `401 unauthorized` | Check credential expiry/revocation with Hydra. After credential replacement, retry the original payload and ID. |
| `404 unknown_member` or `unknown_action` | Verify your saved member link and action mapping for this environment/business. Do not manufacture replacement IDs or assume the resource belongs to another business. |
| `403 forbidden` | Stop integration activity and private reads for this withdrawn app link; follow the account-support process. |
| `400 invalid_body` | Correct the actual request. Points, metadata, caller timestamps and business selectors are unsupported. |

If a response was lost before an action edit, first resolve the original request
using its original payload. Replacing its version before checking acceptance can
produce an idempotency conflict against a credit that already succeeded.

A simple backend sequence is:

```text theme={null}
Confirm one real app event.
Find or create its saved occurrence ID and original request payload.
Submit that saved payload.
On 201 or exact-replay 200, retain the receipt and mark the event accepted.
On an uncertain transport/server result, schedule a bounded retry of the same payload.
On a configuration, identity or payload conflict, stop and resolve that condition.
Read current progress/gifts separately from the activity receipt.
```

Keep this saved event and retry logic in your backend.

Next: [Display progress and gifts](https://docs.usehydra.co.za/integrations/app-rewards/rewards.md).


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.