Evaluate LOE to add an endpoint to download user-level usage data in GitLab Credits dashboard
<!--IssueSummary start-->
<details>
<summary>
Everyone can contribute. [Help move this issue forward](https://handbook.gitlab.com/handbook/marketing/developer-relations/contributor-success/community-contributors-workflows/#contributor-links) while earning points, leveling up and collecting rewards.
</summary>
- [Close this issue](https://contributors.gitlab.com/manage-issue?action=close&projectId=278964&issueIid=594072)
</details>
<!--IssueSummary end-->
<details>
<summary>
Everyone can contribute. [Help move this issue forward](https://handbook.gitlab.com/handbook/marketing/developer-relations/contributor-success/community-contributors-workflows/#contributor-links) while earning points, leveling up and collecting rewards.
</summary>
- [Label this issue](https://contributors.gitlab.com/manage-issue?action=label&projectId=278964&issueIid=594072)
</details>
## Summary
Provide the ability to retrieve **user-level usage data** from the GitLab Credits dashboard via a **GraphQL endpoint**. This would allow customers to programmatically access user-attributed credit consumption data directly from GitLab, without requiring manual data pulls or ad-hoc queries.
For the first iteration, this will be a **GraphQL-only endpoint** — UI integration (e.g., a "Download CSV" button on the Credits dashboard) will follow in a subsequent iteration.
## Problem
- The existing CSV export on the **CustomersDot (CDot) Credits Dashboard** ([customers-gitlab-com#14504 (closed)](https://gitlab.com/gitlab-org/customers-gitlab-com/-/work_items/14504)) provides only aggregate, action-level data — there is no user attribution.
- Customers need user-level visibility to understand which users are consuming credits and at what rate, enabling internal chargebacks, seat optimization, and usage governance.
- Without a self-serve option, fulfilling user-level data requests requires manual, ad-hoc data pulls, which is not scalable.
- A customer request has already surfaced this need: [customers-gitlab-com#16524](https://gitlab.com/gitlab-org/customers-gitlab-com/-/work_items/16524).
## Proposal
### Iteration 1 (this issue): GraphQL endpoint
Expose a **GraphQL query** that returns user-level credits usage data for a given namespace/subscription, including (but not limited to):
- **User ID / Username**
- **Date**
- **Flow type** (e.g., Code Suggestions, Agent Platform, Duo Code Review, Duo Chat)
- **Action code** (e.g., `CODE_SUGGESTION_SHOWN_IN_IDE`, `AGENT_PLATFORM_SESSION_STARTED`)
- **Usage events count**
- **Credits consumed** — broken down by: total, commitment, waiver, trial, on-demand, included
#### Default behavior
- **The endpoint would default to the current billing month**. This is consistent with the existing CDot CSV export behavior, which is also scoped to the current billing month for its MVC.
#### Considerations
- Access should be restricted to users with appropriate permissions (e.g., billing managers, group owners).
### Future iteration: UI integration
- Add a "Download usage by user" button to the GitLab Credits dashboard on GitLab.com.
- The UI would consume the GraphQL endpoint built in this iteration.
- Large exports should be handled gracefully (e.g., background job with notification/download link when ready).
## Related
- https://gitlab.com/gitlab-org/customers-gitlab-com/-/work_items/16524 — Customer request that surfaced the need for self-serve user-level export.
- https://gitlab.com/gitlab-org/customers-gitlab-com/-/work_items/14504 — Original aggregate CSV export feature on CDot (closed/complete, shipped in 18.10).
- https://gitlab.com/gitlab-org/customers-gitlab-com/-/work_items/16500 — Follow-up to include namespace name/ID in the CDot CSV.
- [GitLab Credits documentation](https://docs.gitlab.com/subscriptions/gitlab_credits/) — Current dashboard documentation.
## Acceptance Criteria
- [ ] A GraphQL endpoint exists that returns user-level credits usage data for a given namespace/subscription.
- [ ] The response includes user attribution (user ID/username), date, flow type, action code, usage event count, and credit consumption breakdown.
- [ ] The endpoint **defaults to the current billing month** when no date range is specified.
- [ ] Optional `start_date` / `end_date` parameters are supported for custom date range queries.
- [ ] Results are paginated to handle large datasets.
- [ ] User data visibility respects the "Display GitLab Credits user data" setting.
- [ ] Access is restricted to users with appropriate permissions (e.g., billing managers, group owners).
issue