A/B Test Experiment Transactions

July 28, 2026 · View on GitHub

Use case

Returns a paginated per-transaction log for a routing A/B test experiment — which arm each payment landed in, the gateway chosen, and the outcome. Useful for spot-checking arm assignment or debugging a specific payment.

Authentication

Protected. Send either Authorization: Bearer <jwt_token> or x-api-key: <api_key>. In sandbox, also send x-feature: decision-engine.

For local development, start with:

export BASE_URL=http://localhost:8080
export AUTH_HEADER="Authorization: Bearer <jwt_token>"
export TENANT_HEADER="x-tenant-id: public"
# Sandbox only:
# export BASE_URL=https://sandbox.hyperswitch.io
# export FEATURE_HEADER="x-feature: decision-engine"

Request

  • Method and path: GET /analytics/experiment/{experiment_id}/transactions
  • Parameters:
    • x-tenant-id (header, required, string) — see Environment setup.
    • experiment_id (path, required, string) — the rule_id returned by /routing/create for the ab_test algorithm.
    • start_ms (query, optional, integer)
    • page (query, optional, integer) — defaults to 1.
    • page_size (query, optional, integer) — defaults to 50, capped at 100.
  • Body: No request body.

Example

curl "$BASE_URL/analytics/experiment/routing_a1b2c3d4-1111-2222-3333-444455556666/transactions?page=1&page_size=20" \
  --header "$AUTH_HEADER" \
  --header "$TENANT_HEADER"

Response

{
  "experiment_id": "routing_a1b2c3d4-1111-2222-3333-444455556666",
  "total": 6024,
  "transactions": [
    {
      "payment_id": "pay_9f21",
      "variant_arm": "variant",
      "gateway": "adyen",
      "status": "success",
      "created_at_ms": 1784271600000
    }
  ]
}

Notes

  • variant_arm is "control" or "variant", matching the deterministic per-payment_id arm assignment.
  • Arm assignment is stable across retries of the same payment.