netlify / netlify/open-api

Broken: `capabilities.credits.used` on /accounts always returns 0 on credit-based Pro plan

Open
#640 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Go
Stars
323
Forks
133
Avg merge
2d 8h
Merged PRs (30d)
2

Description

Summary

On the current credit-based Pro plan, GET /api/v1/accounts (and GET /api/v1/accounts/{account_id}) returns capabilities.credits.used: 0 regardless of actual usage. The included value is correct (3000 for our Pro plan), but used never increments, so the field is effectively dead for any dashboard or alerting built on top of the public API.

The Netlify billing UI (app.netlify.com/teams/<slug>/billing/general) clearly has this data: it shows a full "Credit usage breakdown" (production deploys, bandwidth, web requests, compute, etc.) and a "Total credits consumed" figure. So the data exists server-side, it just is not surfaced through the documented REST endpoint that looks like it should carry it.

Reproduction

  1. Authenticate as admin of a team on the credit-based Pro plan with non-zero usage in the current billing period.

  2. curl -H "Authorization: Bearer $TOKEN" https://api.netlify.com/api/v1/accounts

  3. Observe:

    "credits": {                                                                                                                                                                                                                               
      "included": 3000,                                                                                               
      "used": 0
    }
    
  4. Compare with the billing UI for the same account and billing period, which shows a non-zero "Total credits consumed" (in our case, 714.5 / 3000 for the Apr 3 to May 2 period).

Expected

Either capabilities.credits.used reflects actual consumption for the current billing period, or a dedicated endpoint exposes the same breakdown the billing UI shows. The first option is probably the smaller change and is enough for most API consumers.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Locate the account endpoint definitions for GET /api/v1/accounts and GET /api/v1/accounts/{account_id}, then inspect how the credits fields are specified. Determine whether this repository can expose the current billing-period usage or only document a server-side change; done means used reflects actual consumption or a documented endpoint provides the requested breakdown.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
api
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.