> 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/get-campaign-leaderboard.md).

# Get campaign leaderboard

Integration\
\
This method returns the leaderboard for a specific campaign, showing members ranked by their scores.\ <br>

````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":{"get":{"tags":["Campaign"],"summary":"Get campaign leaderboard","description":"<label style=\"background-color: #BFE1F6;padding:5px;\">Integration</label><br><br>\nThis method returns the leaderboard for a specific campaign, showing members ranked by their scores.<br><br>\n","operationId":"campaignLeaderboardGet","parameters":[{"$ref":"#/components/parameters/storeCode"},{"$ref":"#/components/parameters/campaign"},{"name":"type","in":"query","description":"The type of cycle for which the ranking is to be returned.","required":false,"style":"deepObject","explode":true,"schema":{"type":"string"}},{"name":"group","in":"query","description":"Scope the ranking to a single group of a grouped leaderboard. Required for grouped leaderboards — calling the endpoint without `group` on a grouped leaderboard returns an empty list (`items: []`, `total.all: 0`). Ignored for non-grouped leaderboards. Only the EQUAL operator is accepted; operators like `[neq]` are rejected with HTTP 400. Maximum length: 255.\n","required":false,"schema":{"type":"string","maxLength":255}}],"responses":{"200":{"description":"Campaign leaderboard with member rankings.","content":{"application/json":{"schema":{"properties":{"items":{"type":"array","items":{"properties":{"member":{"properties":{"customerId":{"type":"string","format":"uuid"},"firstName":{"type":"string"},"lastName":{"type":"string"},"email":{"type":"string","format":"email"},"phone":{"type":"string"},"loyaltyCardNumber":{"type":"string"}},"type":"object"},"ranking":{"properties":{"score":{"description":"Member's score in the leaderboard","type":"number","format":"float"},"recalculatedAt":{"description":"When the position was last recalculated","type":"string","format":"date-time"},"position":{"description":"Current position in the leaderboard","type":"integer"},"changedPositionAt":{"description":"When the position changed or initial date","type":"string","format":"date-time"},"progress":{"properties":{"general":{"description":"Position change since the beginning of the leaderboard","type":"integer"},"recalculated":{"description":"Position change since the last recalculation","type":"integer"},"period":{"description":"Position change since the last reset","type":"integer"}},"type":"object"}},"type":"object"}},"type":"object"}},"total":{"properties":{"all":{"description":"Total number of members in the leaderboard","type":"integer"},"filtered":{"description":"Number of members after applying filters","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/get-campaign-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.
