> For the complete documentation index, see [llms.txt](https://docs.ggwp.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.ggwp.com/api-docs-contextual-information/match-stats.md).

# Match Stats

\[ Base URL: `api.ggwp.com`]

`POST` /data/v1/ingest

## **Description**

Reports any relevant stats associated with a match event. This information is used to apply severity modifiers to incidents, to track player parties across time and to provide additional context when reviewing incidents or players in GGWP’s moderation tool.

What consists of relevant stats can have a significant variation from game to game so we have provided a guideline around common summary metrics for the most popular game genres. These can be generally grouped into 3 categories:

* **Positive Stats** - positively correlated with player skill, fixing all other variables
* **Negative Stats** - negatively correlated with player skill, fixing all other variables
* **Neutral Stats** - neither positive or negative, more commonly used to normalize other stats

| Game Genre       | Positive Stats                                                                                                                                     | Negative Stats                                               | Neutral Stats                                                |
| ---------------- | -------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------ | ------------------------------------------------------------ |
| Shooter          | kills, assists, headshots, damage dealt, score, accuracy, XP, revives, wins                                                                        | deaths, damage taken, losses                                 | session length, games played, distance traveled, shots fired |
| MOBA             | kills, assists, damage dealt, currency earned (eg: gold), XP, level, rank, wins                                                                    | deaths, damage taken, losses                                 | session length, games played, actions per minute             |
| Sports           | goals, assists, saves, points, runs, wins, MVPs                                                                                                    | misses, fouls, offsides, losses                              | shots, swings, match length                                  |
| Action-Adventure | successful missions, currency earned, items obtained, damage dealt, enemies killed                                                                 | failed missions, health lost, damage taken, number of deaths | session length, missions in game                             |
| Card Game        | points, attacks, cards played, damage dealt, wins                                                                                                  | damage taken, losses                                         | turn durations, number of rounds, session length             |
| Casino           | winnings, currency earned                                                                                                                          | losses                                                       | session length, currency entered, games selected             |
| Fighting         | damage dealt, kicks landed, punches landed, number of combos, max combo, wins, attacks blocked, attack parried, ultimates used, specials used      | damage taken, losses                                         | kicks attempted, punches attempted                           |
| Puzzle           | points, level, trophies, stars, objectives cleared                                                                                                 |                                                              | session length, round duration                               |
| Racing           | average speed, top speed, wins                                                                                                                     | number of crashes, ending position                           | session length, number of laps                               |
| RPG              | XP earned, levels gained, strength increase, magic increase, defense increase, enemies defeated, damage dealt                                      | battles lost, HP decrease                                    | session length, character levels, number of battles          |
| Simulation       | resources acquired, resources used, objectives completed, damage dealt, distance traveled, enemies killed, items crafted, pets bred, food consumed |                                                              | session length (time, turns, days)                           |
| Strategy         | level, stars, trophies, wins, attack wins, defense wins, versus wins, units destroyed                                                              | losses, units lost                                           | session length (time, turns)                                 |

## **Parameters**

`body`: Dictionary containing the following fields:

* **type**: `match-stats`
* **session\_id**: unique identifier of the match.
* **start\_time**: match start time in *YYYY-MM-DD HH:MM:SS* format, in UTC.
* **end\_time**: match end time in *YYYY-MM-DD HH:MM:SS* format, in UTC.
* **session\_duration**: total duration of the match, in seconds.
* **session\_type**: string describing the match type or mode. Examples: `casual`, `competitive`, `custom`.
* **winning\_team**: identifier of the team that resulted the winner of the match.
* **players**: list of all player participants and metrics to summarize their individual performance in the match. Some examples of these metrics are listed below:
  * **user\_id**: unique identifier of the user.
  * **username**: friendly display name.
  * **team\_id**: team identifier.
  * **party\_id**: identifier to connect the party of players that are queueing together.
  * **character\_name**: name of the character picked by the player.
  * **user\_level**: current player level.
  * **match\_stats**: any relevant positive, negative or neutral stats (see guide table above).
* Sample Call

  ```bash
  curl --request POST 'https://api.ggwp.com/data/v1/ingest' \
  --header 'x-api-key: api_key' \
  --header 'Content-Type: application/json' \
  --data-raw '{
    "type": "match-stats",
    "session_id": "<sessionID1>",
    "start_time": "2022-01-25 09:44:00",
    "end_time": "2022-01-25 10:12:23",
    "session_duration": 1703,
    "session_type": "competitive",
    "winning_team": "2",
    "players": [
      {
        "user_id": "<id1>",
        "username": "nlxdz",
        "team_id": "1",
        "party_id": "1",
        "character_name": "Dracarys",
        "user_level": "50",
        "match_stats": {
          "positive_stats": {
            "kills": 3,
            "headshots": 1,
            "assists": 4
          },
          "negative_stats": {
            "deaths": 2
          },
          "neutral_stats": {
            "distance_traveled": 125,
            "actions_taken": 78,
            "active_session_duration": 1560
          }		
        }
      },
      {
        "user_id" "<id2>",
        ...
      }
    ]
  }'
  ```

## **Output**

* 200 - successful operation

  ```json
  {
    "status": "success"
  }
  ```
* 400
  * Error response. The event has not been inserted into the system. This error is thrown in the following cases:
    * `Invalid Body. Expected JSON input`
      * Data payload is not JSON format
    * `Data payload too large`
      * Data payload exceeds 1MB in size
* 403
  * Invalid or missing API key.
* 500
  * Error response. The event has not been inserted into the system. There was some error on the server while processing the request.
