---
agentTools:
  projectIndex: https://scrimmage-rewards.readme.io/llms.txt
---

# Record a rewardable event

## Example of a rewardable event

Only `userId` and `dataType` are required. All other fields are optional.

```json
{
   "userId": "15",
   "dataType": "betExecuted",
   "eventId": "test",
   "body": {
      "betType": "single",
      "odds": 5.2,
      "description": "Just a cool bet",
      "wagerAmount": 1500,
      "netProfit": 1500,
      "outcome": "win",
      "betDate": 1678933476000,
      "bets": [
         {
            "type": "spread",
            "odds": 5.2,
            "teamBetOn": "Bulls",
            "teamBetAgainst": "Huricane",
            "league": "NBA",
            "sport": "Basketball"
         }
      ]
   }
}
```

# OpenAPI definition

````json
{
  "openapi": "3.0.0",
  "paths": {
    "/integrations/rewards": {
      "post": {
        "description": "\n## Example of a rewardable event\n\nOnly `userId` and `dataType` are required. All other fields are optional.\n\n```json\n{\n   \"userId\": \"15\",\n   \"dataType\": \"betExecuted\",\n   \"eventId\": \"test\",\n   \"body\": {\n      \"betType\": \"single\",\n      \"odds\": 5.2,\n      \"description\": \"Just a cool bet\",\n      \"wagerAmount\": 1500,\n      \"netProfit\": 1500,\n      \"outcome\": \"win\",\n      \"betDate\": 1678933476000,\n      \"bets\": [\n         {\n            \"type\": \"spread\",\n            \"odds\": 5.2,\n            \"teamBetOn\": \"Bulls\",\n            \"teamBetAgainst\": \"Huricane\",\n            \"league\": \"NBA\",\n            \"sport\": \"Basketball\"\n         }\n      ]\n   }\n}\n```\n    ",
        "operationId": "IntegrationsController_createReward",
        "parameters": [
          {
            "name": "scrimmage-namespace",
            "in": "header",
            "description": "Namespace",
            "required": true,
            "schema": {
              "type": "string",
              "default": "staging"
            }
          },
          {
            "name": "Scrimmage-Version",
            "in": "header",
            "description": "Version",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/DataTypeEventDTO"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Rewardable event recorded",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DataTypeEventResponseDTO"
                }
              }
            }
          },
          "default": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DataTypeEventResponseDTO"
                }
              }
            }
          }
        },
        "security": [
          {
            "rewarderSecretKey": []
          }
        ],
        "summary": "Record a rewardable event",
        "tags": [
          "Integrations"
        ]
      }
    }
  },
  "info": {
    "title": "Admin API",
    "description": "API for integration and system management",
    "version": "1.0",
    "contact": {}
  },
  "tags": [
    {
      "name": "Integrations",
      "description": "Integrations"
    }
  ],
  "servers": [
    {
      "url": "https://{domain}.apps.scrimmage.co/api",
      "description": "Remote Cluster / Ingress",
      "variables": {
        "domain": {
          "description": "Domain of the cluster. Get one after registration",
          "default": "coinflip"
        }
      }
    },
    {
      "url": "/api",
      "description": "Cluster / Ingress"
    },
    {
      "url": "/",
      "description": "Local"
    }
  ],
  "components": {
    "securitySchemes": {
      "rewarderSecretKey": {
        "type": "apiKey",
        "name": "Authorization",
        "in": "header",
        "description": "Please put as \"Token {token}\""
      }
    },
    "schemas": {
      "DataTypeEventDTO": {
        "type": "object",
        "properties": {
          "userId": {
            "type": "string",
            "description": "User id to send the event to"
          },
          "dataType": {
            "type": "string",
            "description": "The type of the event, has to be consistent with the body. If custom event type doesn't exist - it will be automatically created"
          },
          "eventId": {
            "type": "string",
            "description": "The id of the event, if not provided - it will be generated. Has to be unique for every event. Events with the same ID will be ignored"
          },
          "body": {
            "type": "object",
            "description": "The body of the event, can be anything. Body has to be consistent with the dataType"
          }
        },
        "required": [
          "userId",
          "dataType"
        ]
      },
      "DataTypeEventResponseDTO": {
        "type": "object",
        "properties": {
          "body": {
            "type": "object",
            "description": "The body of the event, can be anything. Body has to be consistent with the dataType"
          },
          "userId": {
            "type": "string",
            "description": "User id to send the event to"
          },
          "dataType": {
            "type": "string",
            "description": "The type of the event, has to be consistent with the body. If custom event type doesn't exist - it will be automatically created"
          },
          "eventId": {
            "type": "string",
            "description": "The id of the event, if not provided - it will be generated. Has to be unique for every event. Events with the same ID will be ignored"
          },
          "namespace": {
            "type": "string",
            "description": "The namespace of the event: production or staging"
          }
        },
        "required": [
          "userId",
          "dataType",
          "namespace"
        ]
      }
    }
  },
  "x-readme": {
    "explorer-enabled": true,
    "proxy-enabled": true
  },
  "_id": {
    "buffer": {
      "0": 104,
      "1": 45,
      "2": 139,
      "3": 169,
      "4": 112,
      "5": 184,
      "6": 145,
      "7": 0,
      "8": 86,
      "9": 190,
      "10": 6,
      "11": 104
    }
  }
}
````