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
Anonymous identity
Fully auditable
Fail closed
Quick start
Request a validated bonus suggestion from a trusted server-side integration. Never expose API keys in a browser bundle.
Provision a scoped API client
Create separate credentials per environment and workload.
Configure server-side secrets
Set BONIFY_API_BASE_URL and BONIFY_API_KEY in your secret manager.
Upsert player safety state
Send the anonymous player and current RG/self-exclusion state.
Ingest versioned activity
Send events in chronological batches with stable external IDs.
Evaluate and validate
Call decisioning and validate the response against @bonify/contracts.
Confirm approval and result
Use one callback to report platform approval, player activity and the realized financial result.
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
Secret handling
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
PostgreSQL
Versioned facts, decisions, outcomes, safety state, immutable audit
Intelligence service
Internal dashboard
Future delivery layer
External boundary
Internal boundary
Authority boundary
Environments and base URLs
This installation serves Production. Use its base URL below; Sandbox requires a separately configured deployment.
| Environment | Base URL | Mode | Authentication | Purpose |
|---|---|---|---|---|
| Local | http://localhost:3001 | Suggestions | DEV_MOCK_AUTH or local key | Developer integration and contract testing |
| Sandbox | https://bonify.pro/api/sandbox | Suggestions | Scoped API key (bonify_sandbox_…) | New tenants start empty; Power.Win alone owns the reference demo seed |
| Production | https://bonify.pro/api/production | Suggestions | Scoped API key (bonify_production_…) | Real operator traffic — delivery disabled |
# 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
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
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
ADMIN, OPERATOR, ANALYST, REVIEWER, AUDITOR, or VIEWER roles.| Header | Format | Required | Purpose |
|---|---|---|---|
| X-API-Key | opaque secret | Yes | Authenticates the scoped operator-platform API client. |
| Idempotency-Key | 8-200 chars | Writes | Deduplicates semantically identical write requests. |
| X-Request-Timestamp | ISO-8601 | Future prod | Supports freshness and replay-window enforcement. |
| X-Request-Nonce | unique string | Future prod | Prevents replay inside the allowed timestamp window. |
| X-Signature | HMAC digest | Future prod | Authenticates canonical request method, path, headers, and body. |
| X-Request-ID | UUID | Recommended | Propagates caller correlation across logs and traces. |
X-API-Key: <secret>
Idempotency-Key: event-batch-20260716-00042
X-Request-ID: 48f8eab2-5215-4a44-a18c-274c925b67d0
Content-Type: application/json
Accept: application/jsonSecret handling
Your key is your account
GET /v1/meta and read data.account to confirm which account a key resolves to.Activation required
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
API conventions
All integrations use versioned JSON, standard envelopes, explicit UTC timestamps, stable identifiers, and deterministic retry behavior.
{
"data": {},
"meta": {
"request_id": "48f8eab2-5215-4a44-a18c-274c925b67d0",
"timestamp": "2026-07-16T12:00:00.000Z",
"version": "v1"
}
}{
"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
Ordering
Schema evolution
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.
Receive
Authenticate, rate limit, enforce body size
Validate
Parse schema version, currency, amount, timestamp
Deduplicate
Stable event ID and content fingerprint
Persist
Transactional facts, errors, dead letters
Project
Features, metrics, timelines, safety state
| Field | Type | Required | Description |
|---|---|---|---|
| event_id | string | Yes | Stable source identifier. Never recycle it for a different event. |
| player_id | string | Yes | Stable anonymous player identifier, maximum 255 characters. |
| event_type | string | Yes | Versioned domain event type such as LOGIN or GAME_ROUND. |
| occurred_at | ISO-8601 | Yes | Source occurrence time with UTC offset. |
| schema_version | string | Yes | Producer contract version, currently 1.0. |
| source | POWER_WIN | Yes | Literal source-system identifier. |
| payload | object | Yes | Event-specific structured fields; no direct PII. |
{
"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
Impossible values
Decisioning
The decision API evaluates eligibility, safety, candidate economics, confidence, and approval state. A response is a recommendation record, never an execution command.
No positive validated action
Responsible-gaming policy block
Fraud or abuse policy block
Human review is required
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
Data sufficiency
INSUFFICIENT or LIMITED. Do not present uplift, ROI, or causality as proven.{
"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 group | Type | Required | Integration responsibility |
|---|---|---|---|
| identity | decision_id, player_id, created_at | Yes | Persist and use decision_id for workflow and outcomes. |
| mode/action | Suggestion behavior + action enum | Yes | Treat holds and no-action as successful business outcomes. |
| bonus | family-specific object | Conditional | Present only for RECOMMEND_BONUS; never execute automatically. |
| expected_outcomes | probabilities and money | Yes | Use as versioned estimates, not realized facts. |
| confidence | score + sufficiency | Yes | Display uncertainty and suppress unsupported claims. |
| evidence | reason codes + features | Yes | Show auditable explanations, never hidden chain-of-thought. |
| safety | eligibility + checks | Yes | Fail closed on ineligible, failed, or unknown checks. |
| model/calculation | version references | Yes | Persist for reproducibility and audit. |
| approval | required + status | Yes | Route PENDING records to authorized reviewers. |
| outcome_status | lifecycle enum | Yes | Report 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
Required parameter keys
box_id, expected_reward_cost, expected_player_value, quantity
Expected cost and player value must be deterministic catalog values.
CS_BOX
Required parameter keys
box_id, expected_reward_cost, quantity, battle_eligible, conversion_restrictions
Conversion and battle restrictions remain operator-enforced.
CASHBOOST
Required parameter keys
minimum_deposit, maximum_deposit?, boost_percent, maximum_bonus
Deposit thresholds do not imply GGR and are independently validated.
CASHBACK
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
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.
{
"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
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
Strategies & templates
Players & decisions
Safety
Agent & insights
Audit & notifications
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
Do not redefine contracts
@bonify/contracts and the live OpenAPI document. Local view models may map fields for display, but the backend schema remains authoritative.No hidden reasoning
Endpoint reference
66 implemented REST operations across external ingestion, decisioning, internal operations, simulation, safety, and audit.
/health/liveProcess liveness probe.
/health/readyDependency readiness and Suggestions-mode status.
/v1/metaProduct, agent, API version, and data-sufficiency metadata.
/v1/configNon-secret runtime configuration and supported bonus families.
/v1/players/upsertCreate or update an anonymous player profile.
/v1/player-snapshotsIngest point-in-time player state snapshots.
/v1/eventsIngest one normalized, versioned player event.
/v1/events/batchIngest up to 1,000 normalized events.
/v1/sessionsIngest anonymous login and session activity.
/v1/game-rounds/batchIngest game rounds with stake, payout, and currency.
/v1/deposits/batchIngest deposit lifecycle events. Deposits are never treated as GGR.
/v1/withdrawals/batchIngest withdrawal lifecycle events.
/v1/balances/batchIngest wallet balance snapshots with explicit currencies.
/v1/bonus-history/batchIngest historical bonus grants, costs, states, and results.
/v1/rg-signals/batchIngest responsible-gaming signals and state changes.
/v1/abuse-signals/batchIngest fraud and abuse signals.
/v1/outcomesReport actual post-decision cost, activity, and engagement outcomes.
/v1/approved-bonusesList platform-approved bonuses with individual activity and realized results.
/v1/approved-bonuses/reportReport approval, usage and financial result in one idempotent callback.
/v1/operator/bonus-configurationRead this platform account's fixed rules and suggestion logic Markdown.
/v1/operator/bonus-configurationValidate and atomically save both account-specific Markdown documents.
/v1/decisions/evaluateEvaluate one player and return a validated bonus suggestion.
/v1/decisions/evaluate/batchEvaluate up to 100 players in Suggestions mode.
/v1/decisionsList persisted decisions.
/v1/decisions/{decisionId}Retrieve one complete auditable decision.
/v1/decisions/{decisionId}/approveApprove a recommendation workflow record without crediting funds.
/v1/decisions/{decisionId}/rejectReject a recommendation workflow record.
/v1/decisions/{decisionId}/cancelCancel a recommendation workflow record.
/v1/decisions/{decisionId}/mark-executedRecord that the platform acted on an approved suggestion. Never credits funds.
/v1/decisions/{decisionId}/mark-failedRecord an operator-side execution failure.
/v1/decisions/{id}/exportExport one decision as an auditable JSON artifact.
/v1/simulations/evaluateEvaluate a non-crediting simulation.
/v1/replays/xlsxReplay normalized XLSX-derived activity without delivery.
/v1/replays/eventsReplay versioned events without external execution.
/v1/dashboard/overviewReturn suggestion metrics, realized outcomes and information quality.
/v1/dashboard/decision-orchestrationReturn evaluation, trigger, cache, validation, latency, and LLM cost metrics.
/v1/players/{playerId}/evaluateRun one manual fail-closed player evaluation.
/v1/players/{playerId}/evaluation-stateReturn cooldown, feature, valid-decision, and daily LLM state.
/v1/triggersList deterministic opportunity and safety triggers.
/v1/triggers/{triggerId}Update an enabled, priority, cooldown, or LLM trigger setting.
/v1/evaluation-jobsList scheduled and historical evaluation jobs.
/v1/evaluation-jobs/{id}/retryRetry a failed evaluation job.
/v1/evaluation-runs/dailyCreate a timezone-aware daily evaluation run.
/v1/llm-usageReturn daily LLM requests, tokens, cost, budget, and degraded state.
/v1/decisions/{id}/validationReturn provider, model, trigger, cache, candidate, and validation metadata.
/v1/strategiesList strategy definitions.
/v1/strategiesCreate a suggestion plan draft.
/v1/strategies/{id}Retrieve one strategy.
/v1/strategies/{id}Update a suggestion plan draft.
/v1/templatesList bonus templates.
/v1/templatesCreate a versioned bonus template draft.
/v1/templates/{id}Update a bonus template draft.
/v1/agentGet Bonify Core Agent runtime metadata.
/v1/agent/runsList traceable agent runs.
/v1/playersList anonymous players.
/v1/players/{id}Retrieve an anonymous player profile.
/v1/players/{id}/timelineRetrieve a player event timeline.
/v1/safety/summaryReturn safety blocks and RG summary.
/v1/safety/eventsList auditable safety events.
/v1/insightsList exploratory operational insights.
/v1/experimentsList experiment definitions and evidence state.
/v1/notificationsList internal notifications.
/v1/notifications/{id}/readMark one internal notification as read.
/v1/profileReturn the current internal actor and roles.
/v1/auditList append-only audit entries.
/v1/audit/exportExport 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.
| Code | HTTP | Meaning | Client action |
|---|---|---|---|
| VALIDATION_ERROR | 400 | Body, params, or query failed schema validation. | Correct the request; preserve the idempotency key for the same semantic write. |
| IDEMPOTENCY_KEY_REQUIRED | 400 | A write request omitted a valid Idempotency-Key header. | Correct the request; preserve the idempotency key for the same semantic write. |
| ACTIVATION_PAYLOAD_INVALID | 400 | The activation JSON does not match the required fixed handshake. | Correct the request; preserve the idempotency key for the same semantic write. |
| PWR_EXCLUDED | 400 | The payload contains the excluded PWR currency or wallet. | Correct the request; preserve the idempotency key for the same semantic write. |
| API_KEY_MISSING_OR_MALFORMED | 401 | X-API-Key is missing or incomplete. | Stop and rotate or correct credentials. |
| API_KEY_INVALID | 401 | The supplied credential does not match a registered key. | Stop and rotate or correct credentials. |
| API_KEY_REVOKED | 401 | The supplied key was revoked. | Stop and rotate or correct credentials. |
| API_KEY_EXPIRED | 401 | The supplied key expired. | Stop and rotate or correct credentials. |
| API_KEY_PENDING_ACTIVATION | 403 | The generated key has not completed POST /v1/auth/activate. | Correct the request; preserve the idempotency key for the same semantic write. |
| API_KEY_SCOPE_MISSING | 403 | The key lacks the required read or write scope. | Correct the request; preserve the idempotency key for the same semantic write. |
| ACTIVATION_ACCOUNT_MISMATCH | 409 | operator_code does not match the tenant bound to the key. | Correct the request; preserve the idempotency key for the same semantic write. |
| ACTIVATION_ENVIRONMENT_MISMATCH | 409 | The activation environment does not match the key environment. | Correct the request; preserve the idempotency key for the same semantic write. |
| NOT_FOUND | 404 | The requested resource does not exist for the current operator. | Do not retry without correcting the resource ID. |
| REQUEST_ERROR | 4xx | A safe client-facing request error. | Correct the request; preserve the idempotency key for the same semantic write. |
| INTERNAL_ERROR | 500 | The request failed closed; no recommendation is executable. | Retry with backoff only when safe; route to manual review. |
Retryable
Not retryable
Support evidence
Reliability and reconciliation
Integration clients must assume duplicate delivery, out-of-order events, dependency failures, retries, and late outcomes.
Idempotent writes
Timeout budgets
Exponential backoff
Dead-letter handling
Transactional state
Reconciliation
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
Least privilege
Safe logging
Transport security
Observability
Use request IDs, structured logs, metrics, traces, and dependency readiness to operate the integration without exposing sensitive data.
Required metrics
{
"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
Traces
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
Breaking changes
Integration go-live checklist
Complete every item before routing production operator traffic into Bonify, even though Bonify remains suggestion-only.
Stable anonymous player IDs are defined and direct PII is excluded.
Separate scoped credentials exist for every environment and workload.
Secrets are stored server-side and rotation/revocation is documented.
Every write sends a deterministic Idempotency-Key.
Every event carries a stable event ID, occurred_at, and schema_version.
All currencies are explicit and PWR is excluded before transmission.
Batch size, payload size, timeout, retry, and backoff limits are enforced.
NO_ACTION, RG_HOLD, ABUSE_HOLD, and MANUAL_REVIEW are handled as valid outcomes.
RECOMMEND_BONUS is never interpreted as an automatic execution command.
Your platform's final eligibility, wallet, rollover, expiry, restriction, and crediting remain authoritative.
Realized cost and attributed outcomes are reported against decision IDs.
Duplicate, late, invalid, and dead-letter events have reconciliation procedures.
Request IDs propagate through caller logs, Bonify logs, metrics, and traces.
Safety blocks, invalid event rate, latency, drift, and pending outcomes are monitored.
Contract tests validate @bonify/contracts and the current OpenAPI document.
Production startup and deployment checks confirm suggestion-only behavior and disabled delivery.
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.