> 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-reputation/reputation-score-batch.md).

# Reputation Score: Batch

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

`POST` /users/v1/reputation-score

## **Description**

The Reputation Score API allows you to fetch the latest reputation scores for all users in CSV format. The files will be available to download via URL, which will be returned either by email or via a webhook subscription or both. Apart from the user ID, user name and current reputation score, the CSV also includes positive, negative, and engagement metrics for each user. The reputation score is derived from the user's behavior in the game and ranges from 150 to 850, where lower values indicate more toxic or negative behavior.

Notes:&#x20;

1. The CSV URLs are valid for 30 minutes from the time of generation.
2. In cases where the number of users exceeds 1,000,000, the data will be split across multiple CSV files.

## **Parameters**

`body`: Dictionary containing the following fields:

* **mode**: Mode of CSV delivery. Supported values: `all`, `email`, `webhook`
  * When selecting `webhook`, please make sure to configure the [Webhook](/webhooks.md) system and subscribe to the [Player Reputation Score Batch event](https://docs.ggwp.com/api-docs-reputation/pages/CaTjknmX3wgPXycWIUvf#id-6.-player-reputation-score-batch)
* (OPTIONAL) **email**: Email id for CSV delivery, only applicable when mode is `all`/`email`
* (OPTIONAL) **score\_range:** Returns all players who have a reputation score within the input ranges. Valid input ranges are between 150 and 850.
  * Examples:&#x20;
    * `"score_range": "bw:150-850"`&#x20;
    * `"score_range": "bw:150-250"`&#x20;
    * `"score_range": "bw:550-850"`
* (OPTIONAL) **sanction\_status** : Filter for sanction status of the players. This parameter can accept multiple values. Incase multiple values are passed, the API considers OR operator in between.
  * Supported values:
    * `chat_active`
    * `chat_muted`
    * `chat_session_muted`
    * `discord_active`
    * `discord_muted`
    * `game_active`
    * `game_muted`
  * Example:&#x20;
    * `"sanction_status": "in:'chat_active','game_active'"`&#x20;

Sample call:

```bash
curl --request POST 'https://api.ggwp.com/users/v1/reputation-score' \
--header 'x-api-key: api_key' \
--header 'Content-Type: application/json' \
--data-raw '{
    "mode": "email",
    "email": "abc@xyz.com",
    "score_range": "bw:150-850",
    "sanction_status": "in:'\''chat_muted'\'','\''game_muted'\''"
}'
```

## **Output**

* 200 - a successful operation

```json
{"success": true}
```

* 403
  * Invalid or missing API key
* 404
  * UserInvalid or missing 'mode' - when mode is not foundprovided
  * Missing email id - when email id not provided
  * Webhook Event not Subscribed - when webhook for reputation-score not subscribed.
* 500
  * Error response. Unable to fetch the reputation score

#### Note:

* When webhook is chosen as a delivery mode, the webhook response will have this format:

```
{
  "type": "player-reputation-batch-export",
  "event_id": "<event_id>",
  "created_at": "2024-10-06 16:30:09",
  "data": {
    "csv_urls": [
      "csv_url_1",
      "csv_url_2"
    ]
  }
}
```
