# Rewards

## Get rewards summery

> \
> This API retrieves the total rewards earned by users for tasks completed during a specified reporting period. The reporting period can either be provided in the request (\`date\_from\` and \`date\_to\`) or defaults to the last closed reporting period if not specified. Rewards are only included for tasks marked with \`is\_reporting\_period\_closed = true\`.\
> \
> \*\*Notes:\*\*\
> \
> \- If \`date\_from\` and \`date\_to\` are provided, the system calculates rewards for all full calendar months within the range and returns the total for those months\
> \- If no period is specified, the API defaults to the last closed reporting period\
> \- Pagination is required when external\_user\_ids is not specified, as the response includes data for all users\
> \- Rewards are only included for tasks with \`is\_reporting\_period\_closed = true\`<br>

```json
{"openapi":"3.0.0","info":{"title":"Public API","version":"1.0"},"security":[{"PublicApiKey":[]}],"components":{"securitySchemes":{"PublicApiKey":{"type":"apiKey","in":"header","name":"x-api-key"}},"schemas":{"GetRewardsSummaryRequestDto":{"type":"object","properties":{"external_user_ids":{"description":"An array of unique identifiers assigned to users by an external system or third-party service. If not provided, the response includes data for all users in the system.","type":"array","items":{"type":"string"}}}},"GetSummaryResponseDto":{"type":"object","properties":{"period":{"description":"The date range for the reporting period.","allOf":[{"$ref":"#/components/schemas/DateRangeDto"}]},"currency":{"type":"object","nullable":true,"description":"The type of currency or unit used for rewards (e.g., USD, coins)."},"users_rewards":{"description":"A list of users and their associated rewards, including user details, total rewards, and time spent.","type":"array","items":{"$ref":"#/components/schemas/SummaryPerUserDto"}}},"required":["period","currency","users_rewards"]},"DateRangeDto":{"type":"object","properties":{"date_from":{"format":"date-time","type":"string","description":"The start date of the reporting period in ISO 8601 format."},"date_to":{"format":"date-time","type":"string","description":"The start date of the reporting period in ISO 8601 format."}}},"SummaryPerUserDto":{"type":"object","properties":{"user":{"description":"User details including identification and contact information","allOf":[{"$ref":"#/components/schemas/UserForSummaryDto"}]},"reward":{"type":"number","description":"Total reward amount earned by the user during the specified period"},"time_spent":{"type":"number","description":"Total time spent by the user in seconds during the specified period"}},"required":["user","reward","time_spent"]},"UserForSummaryDto":{"type":"object","properties":{"id":{"type":"object","nullable":true,"description":"Unique internal identifier of the user"},"name":{"type":"object","nullable":true,"description":"Full name of the user"},"external_user_id":{"type":"object","nullable":true,"description":"External user identifier assigned by third-party system"},"email":{"type":"object","nullable":true,"format":"email","description":"Email address of the user"},"status":{"type":"string","nullable":true,"description":"Current status of the user account","enum":["Active","Inactive","Pending"]}},"required":["id","name","external_user_id","email","status"]}}},"paths":{"/api/v1/public/rewards/summary":{"post":{"description":"\nThis API retrieves the total rewards earned by users for tasks completed during a specified reporting period. The reporting period can either be provided in the request (`date_from` and `date_to`) or defaults to the last closed reporting period if not specified. Rewards are only included for tasks marked with `is_reporting_period_closed = true`.\n\n**Notes:**\n\n- If `date_from` and `date_to` are provided, the system calculates rewards for all full calendar months within the range and returns the total for those months\n- If no period is specified, the API defaults to the last closed reporting period\n- Pagination is required when external_user_ids is not specified, as the response includes data for all users\n- Rewards are only included for tasks with `is_reporting_period_closed = true`\n","operationId":"PublicRewardsController_getRewardsSummary_v1","parameters":[{"name":"date_from","required":false,"in":"query","description":"The start date of the reporting period in ISO 8601 format.","schema":{"format":"date-time","type":"string"}},{"name":"date_to","required":false,"in":"query","description":"The end date of the reporting period in ISO 8601 format.","schema":{"format":"date-time","type":"string"}},{"name":"x-tenant-id","in":"header","description":"Tenant id (uuid v4)","required":false,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/GetRewardsSummaryRequestDto"}}}},"responses":{"201":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GetSummaryResponseDto"}}}},"429":{"description":"Returned when the rate limit is exceeded","headers":{"X-RateLimit-Limit":{"description":"Maximum number of allowed requests during the current window","schema":{"type":"integer"}},"X-RateLimit-Remaining":{"description":"Remaining number of requests before throttling occurs","schema":{"type":"integer"}},"X-RateLimit-Reset":{"description":"Number of seconds until the rate limit window resets","schema":{"type":"integer"}}}}},"summary":"Get rewards summery","tags":["Rewards"]}}}}
```
