> For the complete documentation index, see [llms.txt](https://help.openloyalty.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://help.openloyalty.io/api-reference/campaign/list-distinct-group-values-for-a-grouped-leaderboard.md).

# List distinct group values for a grouped leaderboard

Integration\
\
Returns the distinct group values present on the leaderboard's currently running iteration. Use these values to populate the `group` query parameter of the leaderboard ranking endpoint.\
\
Returns an empty list when: - the campaign's leaderboard is not grouped, - no iteration is currently running (the leaderboard hasn't started or just completed),

* the running iteration has no ranking rows yet.\
  \
  Returns 404 when the campaign does not exist for the given store, is not a leaderboard campaign, or belongs to a different tenant.

````json
{"openapi":"3.0.0","info":{"title":"Open Loyalty","version":"0.0.1"},"tags":[{"name":"Campaign","description":"These endpoints will allow you to easily manage campaigns."}],"servers":[{"url":"http://openloyalty.localhost"}],"security":[{"Bearer":[]},{"token":[]}],"components":{"securitySchemes":{"Bearer":{"type":"http","description":"Open Loyalty has the JWT authorization.\nTo learn what a JSON Web Token is and how it works, check out Introduction to JSON Web Tokens <https://jwt.io/introduction/>\n\n### Obtain an access token\n\nSend a request with the parameters username and password\n\n#### Definition\n\n`POST /api/admin/login_check` [Go to definition](#operation/adminLoginCheck)\\\n`POST /api/{storeCode}/member/login_check` [Go to definition](#operation/memberLoginCheck)\n\n#### Example\n\n```bash\ncurl {HOST}/api/admin/login_check\n    -H 'Content-Type: application/json;charset=UTF-8'\n    -H 'Accept: application/json, text/plain, */*'\n    --data-binary '{\"username\":\"admin\",\"password\":\"password\"}'\n```\n\n#### Example Response\n\n```json\n{\n    \"token\":\"eyJhbGciOiJSUzI1NiIsInR5cCI6...\",\n    \"refresh_token\":\"0558f8bb29948c4e54c443f...\"\n}\n```\n\n### Using JSON Web Token\n\nAdd authorization header to each request\\\n`Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCI6...`\\\nYou can now access any API method you want under the /api prefix.\n\n#### Example\n```bash\ncurl {HOST}/api/{storeCode}/analytics/members\n    -H 'Accept: application/json'\n    -H 'Content-type: application/x-www-form-urlencoded'\n    -H 'Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCI6...'\n```\n\n### Refresh JSON Web Token\nYou can refresh token using refresh_token that was given during login.\\\nThere are two endpoints\\\nTo refresh admin token `POST /api/token/refresh` [Go to definition](#operation/tokenRefresh)\\\nTo refresh member token `POST /api/{storeCode}/token/refresh` [Go to definition](#operation/tokenRefreshMember)\n","bearerFormat":"JWT","scheme":"bearer"},"token":{"type":"apiKey","name":"X-AUTH-TOKEN","in":"header"}},"parameters":{"storeCode":{"name":"storeCode","in":"path","description":"Store code","required":true,"schema":{"type":"string"}},"campaign":{"name":"campaign","in":"path","description":"Campaign ID","required":true,"schema":{"type":"string","format":"uuid"}}},"responses":{"Unauthorized":{"description":"Unauthorized","content":{"application/json":{"schema":{"required":["code","message"],"properties":{"code":{"type":"integer"},"message":{"type":"string"}},"type":"object"}}}},"AccessDenied":{"description":"Forbidden.","content":{"application/json":{"schema":{"required":["code","message"],"properties":{"code":{"type":"integer"},"message":{"type":"string"}},"type":"object"}}}},"NotFound":{"description":"Not found.","content":{"application/json":{"schema":{"required":["code","message"],"properties":{"code":{"type":"integer"},"message":{"type":"string"}},"type":"object"}}}}}},"paths":{"/api/{storeCode}/campaign/{campaign}/leaderboard/group":{"get":{"tags":["Campaign"],"summary":"List distinct group values for a grouped leaderboard","description":"<label style=\"background-color: #BFE1F6;padding:5px;\">Integration</label><br><br>\nReturns the distinct group values present on the leaderboard's currently running iteration. Use these values to populate the `group` query parameter of the leaderboard ranking endpoint.<br><br>\nReturns an empty list when: - the campaign's leaderboard is not grouped, - no iteration is currently running (the leaderboard hasn't started or just\n  completed),\n- the running iteration has no ranking rows yet.<br><br>\nReturns 404 when the campaign does not exist for the given store, is not a leaderboard campaign, or belongs to a different tenant.\n","operationId":"campaignLeaderboardGroupGet","parameters":[{"$ref":"#/components/parameters/storeCode"},{"$ref":"#/components/parameters/campaign"},{"name":"name[startsWith]","in":"query","description":"Case-insensitive, left-anchored prefix filter on the group value (matches `value%`). Only the `startsWith` operator is supported — a disallowed operator such as `name[like]` returns HTTP 400. The short form `name=<prefix>` is treated identically to `name[startsWith]=<prefix>`.\n","required":false,"schema":{"type":"string"}},{"name":"_page","in":"query","description":"1-based page index.","required":false,"schema":{"type":"integer","minimum":1,"default":1}},{"name":"_itemsOnPage","in":"query","description":"Page size.","required":false,"schema":{"type":"integer","minimum":1,"default":10}},{"name":"_orderBy[groupValue]","in":"query","description":"Sort direction for the `groupValue` column. Only `asc` and `desc` are accepted.","required":false,"schema":{"type":"string","enum":["asc","desc"],"default":"asc"}}],"responses":{"200":{"description":"Distinct group values for the running iteration.","content":{"application/json":{"schema":{"properties":{"items":{"type":"array","items":{"type":"string"}},"total":{"properties":{"all":{"description":"Total number of distinct group values, ignoring the name filter.","type":"integer"},"filtered":{"description":"Number of distinct group values after applying the name filter.","type":"integer"},"estimated":{"description":"Whether the total count is estimated.","type":"boolean"}},"type":"object"}},"type":"object"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/AccessDenied"},"404":{"$ref":"#/components/responses/NotFound"}}}}}}
````


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://help.openloyalty.io/api-reference/campaign/list-distinct-group-values-for-a-grouped-leaderboard.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
