Bonify

Bonify documentation

Connect your platform, manage reward rules and track recommendations through the API.

Integration contract

Base path

/v1

Versioned REST surface

Authentication

X-API-Key

Scoped machine identity

Write safety

Idempotency-Key

Required on all writes

Product behavior

SUGGESTIONS

Your platform decides and delivers

Content type

application/json

UTF-8 JSON payloads

Time standard

UTC / ISO-8601

Offset required

Safe by design

Bonify recommends only. Your platform remains authoritative for final eligibility, wallet crediting, rollover, expiry, restrictions, and communications.

Anonymous identity

Integrations send stable anonymous player IDs. Names, emails, addresses, documents, and direct PII are prohibited.

Fully auditable

Every decision references request, feature, model, prompt, policy, formula, approval, and safety-check versions.

Fail closed

Validation, policy, or intelligence failures produce a hold, no action, or manual review—never an executable bonus.

Quick start

Request a validated bonus suggestion from a trusted server-side integration. Never expose API keys in a browser bundle.

1

Provision a scoped API client

Create separate credentials per environment and workload.

2

Configure server-side secrets

Set BONIFY_API_BASE_URL and BONIFY_API_KEY in your secret manager.

3

Upsert player safety state

Send the anonymous player and current RG/self-exclusion state.

4

Ingest versioned activity

Send events in chronological batches with stable external IDs.

5

Evaluate and validate

Call decisioning and validate the response against @bonify/contracts.

6

Confirm approval and result

Use one callback to report platform approval, player activity and the realized financial result.

evaluate-decision.sh
curl --request POST \
  --url "$BONIFY_API_BASE_URL/v1/decisions/evaluate" \
  --header "X-API-Key: $BONIFY_API_KEY" \
  --header "Idempotency-Key: decision-anon-001-20260716T120000Z" \
  --header "Content-Type: application/json" \
  --data '{
    "player_id": "anon-player-001",
    "requested_bonus_type": "CASHBOOST",
    "context": {
      "trigger": "SCHEDULED_RETENTION_EVALUATION"
    }
  }'

Server-to-server only

API keys must remain in a backend, worker, or trusted integration service. The internal Next.js dashboard may read public-safe runtime configuration, but it must not embed operator-platform machine credentials.

Secret handling

Never log API keys, authorization headers, session tokens, HMAC secrets, raw sensitive payloads, or unhashed source IPs. Browser clients must call an authenticated internal backend-for-frontend, not Bonify with a machine key.

Integration architecture

Bonify separates external operator integration, deterministic decision policy, advisory intelligence, persistence, audit, and internal read models.

Your platform

Anonymous profiles, activity, RG/abuse signals, outcome reports

Bonify API /v1

Auth & rate limits
Schema validation
Ingestion & dedupe
Safety policy
Decision orchestration
Audit & outbox

PostgreSQL

Versioned facts, decisions, outcomes, safety state, immutable audit

Intelligence service

Advisory predictions behind timeout, retry, validation, and circuit breaker.

Internal dashboard

Read models, reviews, strategies, templates, safety, and audit exports.

Future delivery layer

Outbox and webhook schemas exist, but Bonify remains suggestion-only and never delivers a bonus.

External boundary

Your platform calls only the REST API. Bonify never reaches directly into operator wallets, customer systems, or communication channels.

Internal boundary

The dashboard, intelligence service, jobs, and repositories communicate through typed interfaces and versioned records.

Authority boundary

Deterministic API policy is authoritative. Model output cannot bypass eligibility, caps, cooldowns, schema checks, or approval.

Environments and base URLs

This installation serves Production. Use its base URL below; Sandbox requires a separately configured deployment.

EnvironmentBase URLModeAuthenticationPurpose
Localhttp://localhost:3001SuggestionsDEV_MOCK_AUTH or local keyDeveloper integration and contract testing
Sandboxhttps://bonify.pro/api/sandboxSuggestionsScoped API key (bonify_sandbox_…)New tenants start empty; Power.Win alone owns the reference demo seed
Productionhttps://bonify.pro/api/productionSuggestionsScoped API key (bonify_production_…)Real operator traffic — delivery disabled
.env.server
# Production
BONIFY_API_BASE_URL=https://bonify.pro/api/production
BONIFY_API_KEY=bonify_production_<your-key>
BONIFY_TIMEOUT_MS=90000

# Sandbox is not configured on this installation.

Production startup guard

The API refuses production startup when DEV_MOCK_AUTH=true or delivery is enabled. Production is still suggestion-only and contains no balance-credit endpoint.

Authentication and authorization

Operator-platform integrations use scoped API clients. Internal operators use session-backed RBAC identities.

Machine authentication

Send X-API-Key from a trusted server. Store only hashed secrets, rotate keys, assign least-privilege scopes, and use separate credentials per workload and environment.

Internal sessions

Dashboard users map to ADMIN, OPERATOR, ANALYST, REVIEWER, AUDITOR, or VIEWER roles.
HeaderFormatRequiredPurpose
X-API-Keyopaque secretYesAuthenticates the scoped operator-platform API client.
Idempotency-Key8-200 charsWritesDeduplicates semantically identical write requests.
X-Request-TimestampISO-8601Future prodSupports freshness and replay-window enforcement.
X-Request-Nonceunique stringFuture prodPrevents replay inside the allowed timestamp window.
X-SignatureHMAC digestFuture prodAuthenticates canonical request method, path, headers, and body.
X-Request-IDUUIDRecommendedPropagates caller correlation across logs and traces.
request headers
X-API-Key: <secret>
Idempotency-Key: event-batch-20260716-00042
X-Request-ID: 48f8eab2-5215-4a44-a18c-274c925b67d0
Content-Type: application/json
Accept: application/json

Secret handling

Never log API keys, authorization headers, session tokens, HMAC secrets, raw sensitive payloads, or unhashed source IPs. Browser clients must call an authenticated internal backend-for-frontend, not Bonify with a machine key.

Your key is your account

Every API key is issued under exactly one Bonify account (operator) — there is no separate account field to send, since a client-supplied ID would be spoofable. Call GET /v1/meta and read data.account to confirm which account a key resolves to.

Activation required

New keys start PENDING. Send one authenticated POST /v1/auth/activate with an Idempotency-Key, the bound operator code, environment, and BONIFY_API_KEY_ACTIVATION_V1. Only HTTP 200 with activation_status: ACTIVE unlocks data routes.

Rejected requests are retained

Invalid activation, GET, POST, scope, revoked-key, and contract attempts are recorded with a redacted payload and explicit reason. Identifiable attempts remain isolated by tenant and API key.

API conventions

All integrations use versioned JSON, standard envelopes, explicit UTC timestamps, stable identifiers, and deterministic retry behavior.

success envelope
{
  "data": {},
  "meta": {
    "request_id": "48f8eab2-5215-4a44-a18c-274c925b67d0",
    "timestamp": "2026-07-16T12:00:00.000Z",
    "version": "v1"
  }
}
error envelope
{
  "error": {
    "code": "VALIDATION_ERROR",
    "message": "Request payload is invalid",
    "details": [],
    "request_id": "48f8eab2-5215-4a44-a18c-274c925b67d0"
  }
}

Rate limit

300 requests/min

Per configured rate-limit key

Body limit

1 MiB

Reject oversized JSON before processing

Event batch

1,000 items

Duplicate fingerprints are idempotent

Decision batch

100 items

Each result remains independently auditable

List limit

200 records

Cursor-based keyset pagination reserved

Money

numeric / JSON number

Nonnegative, max 6 decimal places

Currency

3-8 uppercase chars

PWR is explicitly forbidden

Timestamp

ISO-8601 offset

Normalized and persisted as UTC

Idempotency

Reuse the same key only for the same semantic write. Mock mode replays a successful response for 24 hours; durable storage scopes keys by operator and request.

Ordering

Send events with source occurrence time. Bonify deduplicates by stable fingerprint and derives chronological views independently of arrival order.

Schema evolution

Every event carries schema_version. Additive fields are allowed; breaking changes require a new API or event schema version.

Data ingestion

Your platform sends anonymous, structured activity. Bonify validates, deduplicates, versions, persists, audits, and exposes deterministic read models.

01

Receive

Authenticate, rate limit, enforce body size

02

Validate

Parse schema version, currency, amount, timestamp

03

Deduplicate

Stable event ID and content fingerprint

04

Persist

Transactional facts, errors, dead letters

05

Project

Features, metrics, timelines, safety state

FieldTypeRequiredDescription
event_idstringYesStable source identifier. Never recycle it for a different event.
player_idstringYesStable anonymous player identifier, maximum 255 characters.
event_typestringYesVersioned domain event type such as LOGIN or GAME_ROUND.
occurred_atISO-8601YesSource occurrence time with UTC offset.
schema_versionstringYesProducer contract version, currently 1.0.
sourcePOWER_WINYesLiteral source-system identifier.
payloadobjectYesEvent-specific structured fields; no direct PII.
event batch
{
  "schema_version": "1.0",
  "items": [
    {
      "event_id": "evt-20260716-000001",
      "player_id": "anon-player-001",
      "event_type": "LOGIN",
      "occurred_at": "2026-07-16T12:00:00.000Z",
      "schema_version": "1.0",
      "source": "YOUR_PLATFORM",
      "payload": {
        "channel": "WEB",
        "device_class": "DESKTOP"
      }
    }
  ]
}

PWR exclusion rule

Do not send PWR currencies, wallets, tokens, or rows. Bonify rejects or excludes them entirely; PWR is never converted to zero or retained in aggregates.

Impossible values

Negative/non-finite stakes, payouts, balances, deposits, withdrawals, bonus values, or costs are rejected and recorded as safe ingestion errors.

Decisioning

The decision API evaluates eligibility, safety, candidate economics, confidence, and approval state. A response is a recommendation record, never an execution command.

NO_ACTION

No positive validated action

RG_HOLD

Responsible-gaming policy block

ABUSE_HOLD

Fraud or abuse policy block

MANUAL_REVIEW

Human review is required

RECOMMEND_BONUS

Validated bonus suggestion

Evaluation request

player_id
Required anonymous player identifier
strategy_id
Optional UUID to constrain strategy
requested_bonus_type
Optional supported family
context
Optional structured trigger context

Fail-closed semantics

Unknown player state, failed safety checks, invalid model output, timeout, circuit-open state, or deterministic validation errors cannot produce an actionable bonus.

Data sufficiency

One-player or immature datasets are explicitly marked INSUFFICIENT or LIMITED. Do not present uplift, ROI, or causality as proven.
standard decision
{
  "decision_id": "451923af-a850-48c3-bdc6-5eedb62cc947",
  "player_id": "anon-player-001",
  "created_at": "2026-07-16T12:00:01.184Z",
  "mode": "SHADOW",
  "action": "RECOMMEND_BONUS",
  "strategy_id": "11111111-1111-4111-8111-111111111111",
  "bonus": {
    "type": "CASHBOOST",
    "template_id": "22222222-2222-4222-8222-222222222222",
    "face_value": 12.5,
    "expected_realized_cost": 8.1,
    "currency": "USD",
    "parameters": {
      "minimum_deposit": 100,
      "boost_percent": 10,
      "maximum_bonus": 12.5
    }
  },
  "timing": {
    "recommended_at": "2026-07-16T12:00:01.184Z",
    "valid_until": "2026-07-17T12:00:01.184Z",
    "window_reason": "EXPECTED_NEXT_LOGIN_WINDOW"
  },
  "expected_outcomes": {
    "baseline_return_probability_7d": 0.21,
    "treatment_return_probability_7d": 0.33,
    "incremental_return_probability_7d": 0.12,
    "expected_ggr_30d": 51.4,
    "expected_incremental_ggr_30d": 18.7,
    "expected_incremental_ngr_30d": 10.6,
    "expected_bonus_roi_30d": 4.11,
    "lower_confidence_bound_net_value": 1.2
  },
  "confidence": {
    "score": 0.41,
    "data_sufficiency": "LIMITED",
    "calibration_bucket": "0.40-0.50"
  },
  "evidence": {
    "reason_codes": [
      "DEPOSIT_CADENCE_DECLINE",
      "RETURN_WINDOW_OPEN",
      "POSITIVE_EXPECTED_INCREMENTAL_VALUE"
    ],
    "feature_snapshot_id": "646730c4-f0b2-4647-9561-7c5d65f434d8",
    "top_feature_contributions": [
      {
        "feature": "days_since_last_login",
        "direction": "positive",
        "contribution": 0.18
      }
    ],
    "similar_case_ids": []
  },
  "safety": {
    "eligible": true,
    "rg_status": "GREEN",
    "abuse_risk": "LOW",
    "checks": [
      { "code": "SELF_EXCLUSION", "result": "PASS" },
      { "code": "RG_STATUS", "result": "PASS" },
      { "code": "ABUSE_RISK", "result": "PASS" }
    ]
  },
  "approval": {
    "required": true,
    "status": "PENDING"
  },
  "model": {
    "agent": "Bonify Core Agent",
    "model_version": "mock-model-1",
    "prompt_version": "backend-v1",
    "policy_version": "shadow-policy-1",
    "feature_version": "features-v1"
  },
  "calculation": {
    "objective": "MAXIMIZE_EXPECTED_INCREMENTAL_NGR_SUBJECT_TO_SAFETY",
    "candidate_count": 16,
    "selected_candidate_rank": 1,
    "formula_version": "incremental-value-v1"
  },
  "outcome_status": "PENDING",
  "exploratory": true
}
Decision groupTypeRequiredIntegration responsibility
identitydecision_id, player_id, created_atYesPersist and use decision_id for workflow and outcomes.
mode/actionSuggestion behavior + action enumYesTreat holds and no-action as successful business outcomes.
bonusfamily-specific objectConditionalPresent only for RECOMMEND_BONUS; never execute automatically.
expected_outcomesprobabilities and moneyYesUse as versioned estimates, not realized facts.
confidencescore + sufficiencyYesDisplay uncertainty and suppress unsupported claims.
evidencereason codes + featuresYesShow auditable explanations, never hidden chain-of-thought.
safetyeligibility + checksYesFail closed on ineligible, failed, or unknown checks.
model/calculationversion referencesYesPersist for reproducibility and audit.
approvalrequired + statusYesRoute PENDING records to authorized reviewers.
outcome_statuslifecycle enumYesReport outcomes until REPORTED or EXPIRED.

Bonus mapping: Power.win reference catalog

Every RECOMMEND_BONUS decision carries a platform-agnostic `recommendation` object. The `bonus` field below is an optional, operator-defined reward mapping — these four families are Power.win's current catalog, not a fixed platform taxonomy; a new operator can define its own.

MYSTERY_BOX

Reference

Required parameter keys

box_id, expected_reward_cost, expected_player_value, quantity

Expected cost and player value must be deterministic catalog values.

CS_BOX

Reference

Required parameter keys

box_id, expected_reward_cost, quantity, battle_eligible, conversion_restrictions

Conversion and battle restrictions remain operator-enforced.

CASHBOOST

Reference

Required parameter keys

minimum_deposit, maximum_deposit?, boost_percent, maximum_bonus

Deposit thresholds do not imply GGR and are independently validated.

CASHBACK

Reference

Required parameter keys

eligible_loss_window_hours, cashback_percent, maximum_cashback, excluded_game_categories, settlement_delay_hours

Loss windows, exclusions, and settlement remain operator-owned.

Operator authority

Your platform owns wallet types, final eligibility, balance crediting, rollover, expiry enforcement, game restrictions, communication delivery, and execution. Bonify stores recommendations and expected results only.

Outcome reporting

Your platform reports actual results against the original decision so Bonify can compare expected and realized cost, value, and engagement.

Face value

Nominal player-facing bonus value at recommendation time.

Expected realized cost

Estimated operator cost used during candidate ranking.

Realized cost

Actual operator-reported cost when known.

Attributed GGR

Turnover minus payout inside the versioned attribution window.

Attributed NGR

GGR minus supplied operator costs only when all required components exist.

Engagement outcomes

Return, session, deposit, and activity results at defined horizons.

outcome report
{
  "decision_id": "451923af-a850-48c3-bdc6-5eedb62cc947",
  "reported_at": "2026-07-23T12:00:00.000Z",
  "realized_cost": 8.1,
  "attributed_turnover": 90,
  "attributed_payout": 60,
  "attributed_ggr": 30,
  "attributed_ngr": 21.9,
  "return_7d": true,
  "currency": "USD"
}

Metric definitions

GGR = turnover - payout. Bonus ROI = attributed GGR / realized bonus cost. Deposit amount is never equivalent to GGR.

Append-only reporting

Late corrections create new outcome facts or lifecycle updates. Do not rewrite the original decision, policy evidence, or audit entry.

Internal API integration

Internal clients consume read models and controlled workflow updates. They must preserve access control, audit, information-quality and suggestion-only behavior.

Dashboard

Overview metrics, approved bonus results, pending outcomes and information quality.

Strategies & templates

Versioned drafts, allowed bonus families, objectives, guardrails, and approval state.

Players & decisions

Anonymous profiles, timelines, decisions, evidence, versions, and outcome state.

Safety

RG state, abuse risk, safety blocks, reviews, caps, and cooldown evidence.

Agent & insights

Runtime metadata, traceable runs, exploratory insights, and model quality state.

Audit & notifications

Immutable audit exports, workflow alerts, and read-state mutations.
internal read client
const response = await fetch(
  `${BONIFY_API_BASE_URL}/v1/decisions/${decisionId}`,
  {
    headers: {
      "X-API-Key": internalServiceKey,
      "X-Request-ID": requestId,
      "Accept": "application/json",
    },
    cache: "no-store",
  },
);

const decision =
  standardDecisionSchema.parse((await response.json()).data);

Backend-for-frontend

Browser UI should call an authenticated internal route or server component. Machine credentials stay server-side and RBAC is checked before data reaches the browser.

Do not redefine contracts

Internal clients should consume @bonify/contracts and the live OpenAPI document. Local view models may map fields for display, but the backend schema remains authoritative.

No hidden reasoning

Display reason codes, feature contributions, calculation inputs, safety checks, and version references. Never request or expose hidden chain-of-thought.

Endpoint reference

66 implemented REST operations across external ingestion, decisioning, internal operations, simulation, safety, and audit.

66 operations
GET
/health/live
SystemBoth

Process liveness probe.

GET
/health/ready
SystemBoth

Dependency readiness and Suggestions-mode status.

GET
/v1/meta
SystemBoth

Product, agent, API version, and data-sufficiency metadata.

GET
/v1/config
SystemBoth

Non-secret runtime configuration and supported bonus families.

POST
/v1/players/upsert
IngestionPlatform

Create or update an anonymous player profile.

POST
/v1/player-snapshots
IngestionPlatform

Ingest point-in-time player state snapshots.

POST
/v1/events
IngestionPlatform

Ingest one normalized, versioned player event.

POST
/v1/events/batch
IngestionPlatform

Ingest up to 1,000 normalized events.

POST
/v1/sessions
IngestionPlatform

Ingest anonymous login and session activity.

POST
/v1/game-rounds/batch
IngestionPlatform

Ingest game rounds with stake, payout, and currency.

POST
/v1/deposits/batch
IngestionPlatform

Ingest deposit lifecycle events. Deposits are never treated as GGR.

POST
/v1/withdrawals/batch
IngestionPlatform

Ingest withdrawal lifecycle events.

POST
/v1/balances/batch
IngestionPlatform

Ingest wallet balance snapshots with explicit currencies.

POST
/v1/bonus-history/batch
IngestionPlatform

Ingest historical bonus grants, costs, states, and results.

POST
/v1/rg-signals/batch
IngestionPlatform

Ingest responsible-gaming signals and state changes.

POST
/v1/abuse-signals/batch
IngestionPlatform

Ingest fraud and abuse signals.

POST
/v1/outcomes
OutcomesPlatform

Report actual post-decision cost, activity, and engagement outcomes.

GET
/v1/approved-bonuses
Approved bonusesBoth

List platform-approved bonuses with individual activity and realized results.

POST
/v1/approved-bonuses/report
Approved bonusesPlatform

Report approval, usage and financial result in one idempotent callback.

GET
/v1/operator/bonus-configuration
ConfigurationPlatform

Read this platform account's fixed rules and suggestion logic Markdown.

PUT
/v1/operator/bonus-configuration
ConfigurationPlatform

Validate and atomically save both account-specific Markdown documents.

POST
/v1/decisions/evaluate
DecisioningPlatform

Evaluate one player and return a validated bonus suggestion.

POST
/v1/decisions/evaluate/batch
DecisioningPlatform

Evaluate up to 100 players in Suggestions mode.

GET
/v1/decisions
DecisioningBoth

List persisted decisions.

GET
/v1/decisions/{decisionId}
DecisioningBoth

Retrieve one complete auditable decision.

POST
/v1/decisions/{decisionId}/approve
WorkflowInternal

Approve a recommendation workflow record without crediting funds.

POST
/v1/decisions/{decisionId}/reject
WorkflowInternal

Reject a recommendation workflow record.

POST
/v1/decisions/{decisionId}/cancel
WorkflowInternal

Cancel a recommendation workflow record.

POST
/v1/decisions/{decisionId}/mark-executed
WorkflowPlatform

Record that the platform acted on an approved suggestion. Never credits funds.

POST
/v1/decisions/{decisionId}/mark-failed
WorkflowPlatform

Record an operator-side execution failure.

GET
/v1/decisions/{id}/export
AuditInternal

Export one decision as an auditable JSON artifact.

POST
/v1/simulations/evaluate
SimulationInternal

Evaluate a non-crediting simulation.

POST
/v1/replays/xlsx
SimulationInternal

Replay normalized XLSX-derived activity without delivery.

POST
/v1/replays/events
SimulationInternal

Replay versioned events without external execution.

GET
/v1/dashboard/overview
DashboardInternal

Return suggestion metrics, realized outcomes and information quality.

GET
/v1/dashboard/decision-orchestration
OrchestrationInternal

Return evaluation, trigger, cache, validation, latency, and LLM cost metrics.

POST
/v1/players/{playerId}/evaluate
OrchestrationInternal

Run one manual fail-closed player evaluation.

GET
/v1/players/{playerId}/evaluation-state
OrchestrationInternal

Return cooldown, feature, valid-decision, and daily LLM state.

GET
/v1/triggers
OrchestrationInternal

List deterministic opportunity and safety triggers.

PATCH
/v1/triggers/{triggerId}
OrchestrationInternal

Update an enabled, priority, cooldown, or LLM trigger setting.

GET
/v1/evaluation-jobs
OrchestrationInternal

List scheduled and historical evaluation jobs.

POST
/v1/evaluation-jobs/{id}/retry
OrchestrationInternal

Retry a failed evaluation job.

POST
/v1/evaluation-runs/daily
OrchestrationInternal

Create a timezone-aware daily evaluation run.

GET
/v1/llm-usage
OrchestrationInternal

Return daily LLM requests, tokens, cost, budget, and degraded state.

GET
/v1/decisions/{id}/validation
OrchestrationInternal

Return provider, model, trigger, cache, candidate, and validation metadata.

GET
/v1/strategies
StrategiesInternal

List strategy definitions.

POST
/v1/strategies
StrategiesInternal

Create a suggestion plan draft.

GET
/v1/strategies/{id}
StrategiesInternal

Retrieve one strategy.

PATCH
/v1/strategies/{id}
StrategiesInternal

Update a suggestion plan draft.

GET
/v1/templates
TemplatesInternal

List bonus templates.

POST
/v1/templates
TemplatesInternal

Create a versioned bonus template draft.

PATCH
/v1/templates/{id}
TemplatesInternal

Update a bonus template draft.

GET
/v1/agent
AgentInternal

Get Bonify Core Agent runtime metadata.

GET
/v1/agent/runs
AgentInternal

List traceable agent runs.

GET
/v1/players
PlayersInternal

List anonymous players.

GET
/v1/players/{id}
PlayersInternal

Retrieve an anonymous player profile.

GET
/v1/players/{id}/timeline
PlayersInternal

Retrieve a player event timeline.

GET
/v1/safety/summary
SafetyInternal

Return safety blocks and RG summary.

GET
/v1/safety/events
SafetyInternal

List auditable safety events.

GET
/v1/insights
InsightsInternal

List exploratory operational insights.

GET
/v1/experiments
ExperimentsInternal

List experiment definitions and evidence state.

GET
/v1/notifications
NotificationsInternal

List internal notifications.

POST
/v1/notifications/{id}/read
NotificationsInternal

Mark one internal notification as read.

GET
/v1/profile
IdentityInternal

Return the current internal actor and roles.

GET
/v1/audit
AuditInternal

List append-only audit entries.

GET
/v1/audit/export
AuditInternal

Export the immutable audit trail.

Errors and client behavior

HTTP status communicates transport outcome; the stable error code controls application behavior. All unsafe failures remain non-executable.

CodeHTTPMeaningClient action
VALIDATION_ERROR400Body, params, or query failed schema validation.Correct the request; preserve the idempotency key for the same semantic write.
IDEMPOTENCY_KEY_REQUIRED400A write request omitted a valid Idempotency-Key header.Correct the request; preserve the idempotency key for the same semantic write.
ACTIVATION_PAYLOAD_INVALID400The activation JSON does not match the required fixed handshake.Correct the request; preserve the idempotency key for the same semantic write.
PWR_EXCLUDED400The payload contains the excluded PWR currency or wallet.Correct the request; preserve the idempotency key for the same semantic write.
API_KEY_MISSING_OR_MALFORMED401X-API-Key is missing or incomplete.Stop and rotate or correct credentials.
API_KEY_INVALID401The supplied credential does not match a registered key.Stop and rotate or correct credentials.
API_KEY_REVOKED401The supplied key was revoked.Stop and rotate or correct credentials.
API_KEY_EXPIRED401The supplied key expired.Stop and rotate or correct credentials.
API_KEY_PENDING_ACTIVATION403The generated key has not completed POST /v1/auth/activate.Correct the request; preserve the idempotency key for the same semantic write.
API_KEY_SCOPE_MISSING403The key lacks the required read or write scope.Correct the request; preserve the idempotency key for the same semantic write.
ACTIVATION_ACCOUNT_MISMATCH409operator_code does not match the tenant bound to the key.Correct the request; preserve the idempotency key for the same semantic write.
ACTIVATION_ENVIRONMENT_MISMATCH409The activation environment does not match the key environment.Correct the request; preserve the idempotency key for the same semantic write.
NOT_FOUND404The requested resource does not exist for the current operator.Do not retry without correcting the resource ID.
REQUEST_ERROR4xxA safe client-facing request error.Correct the request; preserve the idempotency key for the same semantic write.
INTERNAL_ERROR500The request failed closed; no recommendation is executable.Retry with backoff only when safe; route to manual review.

Retryable

Network timeouts, selected 5xx responses, and temporary dependency failures may be retried with exponential backoff, jitter, timeout, and the original idempotency key.

Not retryable

Validation, PWR exclusion, unauthorized access, and not-found responses require request or configuration changes.

Support evidence

Capture HTTP status, error code, request ID, environment, route, and timestamp. Never attach secrets or raw player payloads.

Reliability and reconciliation

Integration clients must assume duplicate delivery, out-of-order events, dependency failures, retries, and late outcomes.

Idempotent writes

Generate deterministic keys from the source operation, not random keys per retry.

Timeout budgets

Bound connect and total request time; never allow an upstream decision call to block operator workflows indefinitely.

Exponential backoff

Retry temporary failures with jitter and a strict attempt budget.

Dead-letter handling

Persist rejected events safely, classify the failure, and replay only after correction.

Transactional state

Persist decision, candidates, safety checks, status history, audit, and outbox atomically.

Reconciliation

Compare source counts, fingerprints, pending outcomes, delivery state, and operator reports.

Recommended retry policy

Attempt 1

Immediate

Original request

Attempt 2

250-500 ms

Jittered retry

Attempt 3

1-2 s

Jittered retry

Attempt 4

4-8 s

Final synchronous retry

After budget

Dead letter

Alert and reconcile

Security and data handling

Bonify is an internal decision system. Integrations must minimize data, isolate credentials, enforce authorization, and retain auditable security controls.

Allowed data

  • Stable anonymous player identifiers
  • Age bracket and adult-eligibility state
  • VIP tier, acquisition channel, and device/channel metadata
  • Sessions, game rounds, deposits, withdrawals, and balances
  • Bonus history, RG state, self-exclusion, and abuse signals
  • Versioned outcome and attribution data

Prohibited data

  • Names, emails, phone numbers, or account login identifiers
  • Government documents, tax IDs, or verification images
  • Street addresses or precise location data
  • Raw payment credentials or authentication secrets
  • Unredacted source IP addresses where a hash is sufficient
  • PWR currencies, wallets, tokens, rows, or aggregate values

Credential rotation

Issue per-environment keys, record prefixes, rotate on schedule, and revoke immediately on suspected disclosure.

Least privilege

Scope clients to ingestion, decisioning, outcomes, or internal reads; avoid broad shared credentials.

Safe logging

Redact secrets and minimize payload logging. Use request IDs, hashes, counts, error codes, and safe summaries.

Transport security

Require TLS. Add request signing and mTLS before enabling a future production command channel.

Observability

Use request IDs, structured logs, metrics, traces, and dependency readiness to operate the integration without exposing sensitive data.

Required metrics

request count / latency / errors
ingestion lag
invalid event rate
decision latency
no-action rate
structured-output failures
safety blocks
drift alerts
pending outcomes
dead-letter backlog
structured log
{
  "level": "info",
  "service": "bonify-api",
  "request_id": "48f8eab2-5215-4a44-a18c-274c925b67d0",
  "actor_id": "api-client:power-win-ingestion",
  "route": "/v1/events/batch",
  "status_code": 202,
  "accepted_count": 998,
  "duplicate_count": 2,
  "pwr_excluded_count": 0,
  "duration_ms": 84,
  "message": "event batch accepted"
}

Logs

Pino JSON logs with secret redaction, request correlation, actor identity, safe counts, and stable error codes.

Traces

OpenTelemetry spans across HTTP, policy, intelligence, repository, outbox, and reconciliation boundaries.

Readiness

/health/ready reports dependency status, suggestion-only behavior, optional intelligence availability, and disabled delivery.

Versioning and compatibility

Version every boundary needed to reproduce a recommendation: API, event schema, model, prompt, policy, feature pipeline, formula, strategy, and template.

API version

/v1

Breaking HTTP contract changes require a new base path.

Event version

schema_version

Producers identify the payload shape for each event.

Decision versions

model / prompt / policy

Every decision records the exact advisory and deterministic policy versions.

Calculation versions

feature / formula

Features and monetary calculations remain reproducible and auditable.

Additive changes

New optional fields and endpoints are non-breaking. Clients should ignore unknown response fields and validate required fields through the shared contract package.

Breaking changes

Renames, removals, semantic changes, stricter required fields, or enum removals require a new version and a documented migration window.

Integration go-live checklist

Complete every item before routing production operator traffic into Bonify, even though Bonify remains suggestion-only.

01

Stable anonymous player IDs are defined and direct PII is excluded.

02

Separate scoped credentials exist for every environment and workload.

03

Secrets are stored server-side and rotation/revocation is documented.

04

Every write sends a deterministic Idempotency-Key.

05

Every event carries a stable event ID, occurred_at, and schema_version.

06

All currencies are explicit and PWR is excluded before transmission.

07

Batch size, payload size, timeout, retry, and backoff limits are enforced.

08

NO_ACTION, RG_HOLD, ABUSE_HOLD, and MANUAL_REVIEW are handled as valid outcomes.

09

RECOMMEND_BONUS is never interpreted as an automatic execution command.

10

Your platform's final eligibility, wallet, rollover, expiry, restriction, and crediting remain authoritative.

11

Realized cost and attributed outcomes are reported against decision IDs.

12

Duplicate, late, invalid, and dead-letter events have reconciliation procedures.

13

Request IDs propagate through caller logs, Bonify logs, metrics, and traces.

14

Safety blocks, invalid event rate, latency, drift, and pending outcomes are monitored.

15

Contract tests validate @bonify/contracts and the current OpenAPI document.

16

Production startup and deployment checks confirm suggestion-only behavior and disabled delivery.

Authoritative resources

Build against the live contract

This portal explains integration architecture and behavior. The live OpenAPI 3.1 document and @bonify/contracts package are authoritative for request and response schemas.