Search code examples
apigithub-apigithub-actionsbillingquota

GitHub API: get billing quota reset date


Is there a GitHub API I can use to retrieve the number of days X in

GitHub Actions

Included minutes quota resets in X days

which you can find on the https://github.com/settings/billing page?

billing quota

Performing the following API call

# GITHUB_TOKEN with "Update ALL user data" permission
curl \
  -H "Authorization: token $GITHUB_TOKEN" \
  -H "Accept: application/vnd.github.v3+json" \
  https://api.github.com/users/$GITHUB_USER/settings/billing/actions

I get all info except for the billing period expiration date:

{
  "total_minutes_used": 228,
  "total_paid_minutes_used": 0,
  "included_minutes": 2000,
  "minutes_used_breakdown": {
    "UBUNTU": 228
  }
}

Many thanks.


Solution

  • I've figured out the "number of days left in the billing cycle" can be retrieved from the /users/<user>/settings/billing/shared-storage endpoint.

    E.g.

    curl \
      -H "Authorization: token $GITHUB_TOKEN" \
      -H "Accept: application/vnd.github.v3+json" \
      https://api.github.com/users/$GITHUB_USER/settings/billing/shared-storage
    

    returns

    {
      "days_left_in_billing_cycle": 5,
      "estimated_paid_storage_for_month": 0,
      "estimated_storage_for_month": 0
    }