# Query Player Data

> Query player data using an existing index.

Query player data. If no index is available to fulfil the query then the query will fail.

Authentication Required: `Yes`

```bash
ugs cloud-save data player query [options]
```

## Arguments

`<visibility>` A string representing the visibility of the index. Must be one of `default`, `public` or `protected`.
`<body>` The index query in JSON. If this is a file path, the content of the file is used; otherwise, the raw string is used.

Sample Query String
`--body "{"fields":\[{"key":"EXAMPLE_KEY","value":"example_value","op":"EQ","asc":true}],"returnKeys":\["EXAMPLE_KEY"],"offset":0,"limit":100,"sampleSize":100}"`

Sample Query Body

```json
{
  "fields": [
    {
      "key": "EXAMPLE_KEY",
      "value": "example_value",
      "op": "EQ",
      "asc": true
    }
  ],
  "returnKeys": [
    "EXAMPLE_KEY"
  ],
  "offset": 0,
  "limit": 100,
  "sampleSize": 100
}
```

## Documentation

For more documentation on querying indexes, see the [Unity Service API Docs](https://services.docs.unity.com/cloud-save-admin/v1/index.html#tag/Data/operation/queryDefaultPlayerData).

## Options

| Option           | Alias                  | Description                         |
| ---------------- | ---------------------- | ----------------------------------- |
| project-id       | -p, --project-id       | The Unity cloud project ID.         |
| environment-name | -e, --environment-name | The services environment name.      |
| help             | -?, -h, --help         | Display help and usage information. |
| quiet            | -q, --quiet            | Reduce logging to a minimum.        |
| json             | -j, --json             | Use JSON as the output format.      |
