{"meta":{"title":"Использование выставления счетов","intro":"Используйте REST API для получения информации об использовании биллинга.","product":"REST API","breadcrumbs":[{"href":"/ru/rest","title":"REST API"},{"href":"/ru/rest/billing","title":"Выставление счетов"},{"href":"/ru/rest/billing/usage","title":"Использование выставления счетов"}],"documentType":"article"},"body":"# Использование выставления счетов\n\nИспользуйте REST API для получения информации об использовании биллинга.\n\nКонечные точки на этой странице возвращают использование, которое оплачивается, на счёт, связанный с конечной точкой. Для помощи в выборе уровня использования для отчёта см. [Автоматизация отчетов об использовании с помощью REST API](/ru/billing/tutorials/automate-usage-reporting#step-1-decide-what-level-to-report-on).\n\n* Пользовательские конечные точки возвращают Copilot использование, которое оплачивается напрямую на личный аккаунт конкретного пользователя. Эти конечные точки применимы только если пользователь приобрёл свой собственный план Copilot.\n* Если лицензия пользователя Copilot управляется и выставляет счета через организацию или предприятие, её использование не учитывается в пользовательских конечных точках. В таком случае вам придётся использовать конечные устройства на уровне организации или предприятия.\n\nЧтобы просмотреть корпоративные конечные точки, выберите выпадающее меню вверху страницы и переключитесь с Free, Pro и Team на GitHub Enterprise Cloud.\n\n> \\[!NOTE]\n> Most endpoints use `Authorization: Bearer <YOUR-TOKEN>` and `Accept: application/vnd.github+json` headers, plus `X-GitHub-Api-Version: 2026-03-10`. Curl examples below omit these standard headers for brevity.\n\n## Get billing AI credit usage report for an organization\n\n```\nGET /organizations/{org}/settings/billing/ai_credit/usage\n```\n\nGets a report of AI credit usage for an organization. To use this endpoint, you must be an administrator of an organization within an enterprise or an organization account.\nNote: Only data from the past 24 months is accessible via this endpoint.\n\n### Parameters\n\n#### Headers\n\n* **`accept`** (string)\n  Setting to `application/vnd.github+json` is recommended.\n\n#### Path and query parameters\n\n* **`org`** (string) (required)\n  The organization name. The name is not case sensitive.\n\n* **`year`** (integer)\n  If specified, only return results for a single year. The value of year is an integer with four digits representing a year. For example, 2025. Default value is the current year.\n\n* **`month`** (integer)\n  If specified, only return results for a single month. The value of month is an integer between 1 and 12. Default value is the current month. If no year is specified the default year is used.\n\n* **`day`** (integer)\n  If specified, only return results for a single day. The value of day is an integer between 1 and 31. If no year or month is specified, the default year and month are used.\n\n* **`user`** (string)\n  The user name to query usage for. The name is not case sensitive.\n\n* **`model`** (string)\n  The model name to query usage for. The name is not case sensitive.\n\n* **`product`** (string)\n  The product name to query usage for. The name is not case sensitive.\n\n### HTTP response status codes\n\n* **200** - Response when getting a billing AI credit usage report\n\n* **400** - Bad Request\n\n* **403** - Forbidden\n\n* **404** - Resource not found\n\n* **500** - Internal Error\n\n* **503** - Service unavailable\n\n### Code examples\n\n#### Example\n\n**Request:**\n\n```curl\ncurl -L \\\n  -X GET \\\n  https://api.github.com/organizations/ORG/settings/billing/ai_credit/usage\n```\n\n**Response schema (Status: 200):**\n\n* `timePeriod`: required, object:\n  * `year`: required, integer\n  * `month`: integer\n  * `day`: integer\n* `organization`: required, string\n* `user`: string\n* `product`: string\n* `model`: string\n* `usageItems`: required, array of objects:\n  * `product`: required, string\n  * `sku`: required, string\n  * `model`: required, string\n  * `unitType`: required, string\n  * `pricePerUnit`: required, number\n  * `grossQuantity`: required, number\n  * `grossAmount`: required, number\n  * `discountQuantity`: required, number\n  * `discountAmount`: required, number\n  * `netQuantity`: required, number\n  * `netAmount`: required, number\n\n## Get billing premium request usage report for an organization\n\n```\nGET /organizations/{org}/settings/billing/premium_request/usage\n```\n\nGets a report of premium request usage for an organization. To use this endpoint, you must be an administrator of an organization within an enterprise or an organization account.\nNote: Only data from the past 24 months is accessible via this endpoint.\n\n### Parameters\n\n#### Headers\n\n* **`accept`** (string)\n  Setting to `application/vnd.github+json` is recommended.\n\n#### Path and query parameters\n\n* **`org`** (string) (required)\n  The organization name. The name is not case sensitive.\n\n* **`year`** (integer)\n  If specified, only return results for a single year. The value of year is an integer with four digits representing a year. For example, 2025. Default value is the current year.\n\n* **`month`** (integer)\n  If specified, only return results for a single month. The value of month is an integer between 1 and 12. Default value is the current month. If no year is specified the default year is used.\n\n* **`day`** (integer)\n  If specified, only return results for a single day. The value of day is an integer between 1 and 31. If no year or month is specified, the default year and month are used.\n\n* **`user`** (string)\n  The user name to query usage for. The name is not case sensitive.\n\n* **`model`** (string)\n  The model name to query usage for. The name is not case sensitive.\n\n* **`product`** (string)\n  The product name to query usage for. The name is not case sensitive.\n\n### HTTP response status codes\n\n* **200** - Response when getting a billing premium request usage report\n\n* **400** - Bad Request\n\n* **403** - Forbidden\n\n* **404** - Resource not found\n\n* **500** - Internal Error\n\n* **503** - Service unavailable\n\n### Code examples\n\n#### Example\n\n**Request:**\n\n```curl\ncurl -L \\\n  -X GET \\\n  https://api.github.com/organizations/ORG/settings/billing/premium_request/usage\n```\n\n**Response schema (Status: 200):**\n\nSame response schema as [Get billing AI credit usage report for an organization](#get-billing-ai-credit-usage-report-for-an-organization).\n\n## Get billing usage report for an organization\n\n```\nGET /organizations/{org}/settings/billing/usage\n```\n\nGets a report of the total usage for an organization. To use this endpoint, you must be an administrator of an organization within an enterprise or an organization account.\nNote: This endpoint is only available to organizations with access to the enhanced billing platform. For more information, see \"About the enhanced billing platform.\"\n\n### Parameters\n\n#### Headers\n\n* **`accept`** (string)\n  Setting to `application/vnd.github+json` is recommended.\n\n#### Path and query parameters\n\n* **`org`** (string) (required)\n  The organization name. The name is not case sensitive.\n\n* **`year`** (integer)\n  If specified, only return results for a single year. The value of year is an integer with four digits representing a year. For example, 2025. Default value is the current year.\n\n* **`month`** (integer)\n  If specified, only return results for a single month. The value of month is an integer between 1 and 12. If no year is specified the default year is used.\n\n* **`day`** (integer)\n  If specified, only return results for a single day. The value of day is an integer between 1 and 31. If no year or month is specified, the default year and month are used.\n\n### HTTP response status codes\n\n* **200** - Billing usage report response for an organization\n\n* **400** - Bad Request\n\n* **403** - Forbidden\n\n* **500** - Internal Error\n\n* **503** - Service unavailable\n\n### Code examples\n\n#### Example\n\n**Request:**\n\n```curl\ncurl -L \\\n  -X GET \\\n  https://api.github.com/organizations/ORG/settings/billing/usage\n```\n\n**Response schema (Status: 200):**\n\n* `usageItems`: array of objects:\n  * `date`: required, string\n  * `product`: required, string\n  * `sku`: required, string\n  * `quantity`: required, integer\n  * `unitType`: required, string\n  * `pricePerUnit`: required, number\n  * `grossAmount`: required, number\n  * `discountAmount`: required, number\n  * `netAmount`: required, number\n  * `organizationName`: required, string\n  * `repositoryName`: string\n\n## Get billing usage summary for an organization\n\n```\nGET /organizations/{org}/settings/billing/usage/summary\n```\n\nNote\n\nThis endpoint is in public preview and is subject to change.\n\nGets a summary report of usage for an organization. To use this endpoint, you must be an administrator of an organization within an enterprise or an organization account.\nNote: Only data from the past 24 months is accessible via this endpoint.\n\n### Parameters\n\n#### Headers\n\n* **`accept`** (string)\n  Setting to `application/vnd.github+json` is recommended.\n\n#### Path and query parameters\n\n* **`org`** (string) (required)\n  The organization name. The name is not case sensitive.\n\n* **`year`** (integer)\n  If specified, only return results for a single year. The value of year is an integer with four digits representing a year. For example, 2025. Default value is the current year.\n\n* **`month`** (integer)\n  If specified, only return results for a single month. The value of month is an integer between 1 and 12. Default value is the current month. If no year is specified the default year is used.\n\n* **`day`** (integer)\n  If specified, only return results for a single day. The value of day is an integer between 1 and 31. If no year or month is specified, the default year and month are used.\n\n* **`repository`** (string)\n  The repository name to query for usage in the format owner/repository.\n\n* **`product`** (string)\n  The product name to query usage for. The name is not case sensitive.\n\n* **`sku`** (string)\n  The SKU to query for usage.\n\n### HTTP response status codes\n\n* **200** - Response when getting a billing usage summary\n\n* **400** - Bad Request\n\n* **403** - Forbidden\n\n* **500** - Internal Error\n\n* **503** - Service unavailable\n\n### Code examples\n\n#### Example\n\n**Request:**\n\n```curl\ncurl -L \\\n  -X GET \\\n  https://api.github.com/organizations/ORG/settings/billing/usage/summary\n```\n\n**Response schema (Status: 200):**\n\n* `timePeriod`: required, object:\n  * `year`: required, integer\n  * `month`: integer\n  * `day`: integer\n* `organization`: required, string\n* `repository`: string\n* `product`: string\n* `sku`: string\n* `usageItems`: required, array of objects:\n  * `product`: required, string\n  * `sku`: required, string\n  * `unitType`: required, string\n  * `pricePerUnit`: required, number\n  * `grossQuantity`: required, number\n  * `grossAmount`: required, number\n  * `discountQuantity`: required, number\n  * `discountAmount`: required, number\n  * `netQuantity`: required, number\n  * `netAmount`: required, number\n\n## Get billing AI credit usage report for a user\n\n```\nGET /users/{username}/settings/billing/ai_credit/usage\n```\n\nGets a report of AI credit usage for a user.\nNote: Only data from the past 24 months is accessible via this endpoint.\n\n### Parameters\n\n#### Headers\n\n* **`accept`** (string)\n  Setting to `application/vnd.github+json` is recommended.\n\n#### Path and query parameters\n\n* **`username`** (string) (required)\n  The handle for the GitHub user account.\n\n* **`year`** (integer)\n  If specified, only return results for a single year. The value of year is an integer with four digits representing a year. For example, 2025. Default value is the current year.\n\n* **`month`** (integer)\n  If specified, only return results for a single month. The value of month is an integer between 1 and 12. Default value is the current month. If no year is specified the default year is used.\n\n* **`day`** (integer)\n  If specified, only return results for a single day. The value of day is an integer between 1 and 31. If no year or month is specified, the default year and month are used.\n\n* **`model`** (string)\n  The model name to query usage for. The name is not case sensitive.\n\n* **`product`** (string)\n  The product name to query usage for. The name is not case sensitive.\n\n### HTTP response status codes\n\n* **200** - Response when getting a billing AI credit usage report\n\n* **400** - Bad Request\n\n* **403** - Forbidden\n\n* **404** - Resource not found\n\n* **500** - Internal Error\n\n* **503** - Service unavailable\n\n### Code examples\n\n#### Example\n\n**Request:**\n\n```curl\ncurl -L \\\n  -X GET \\\n  https://api.github.com/users/USERNAME/settings/billing/ai_credit/usage\n```\n\n**Response schema (Status: 200):**\n\n* `timePeriod`: required, object:\n  * `year`: required, integer\n  * `month`: integer\n  * `day`: integer\n* `user`: required, string\n* `product`: string\n* `model`: string\n* `usageItems`: required, array of objects:\n  * `product`: required, string\n  * `sku`: required, string\n  * `model`: required, string\n  * `unitType`: required, string\n  * `pricePerUnit`: required, number\n  * `grossQuantity`: required, number\n  * `grossAmount`: required, number\n  * `discountQuantity`: required, number\n  * `discountAmount`: required, number\n  * `netQuantity`: required, number\n  * `netAmount`: required, number\n\n## Get billing premium request usage report for a user\n\n```\nGET /users/{username}/settings/billing/premium_request/usage\n```\n\nGets a report of premium request usage for a user.\nNote: Only data from the past 24 months is accessible via this endpoint.\n\n### Parameters\n\n#### Headers\n\n* **`accept`** (string)\n  Setting to `application/vnd.github+json` is recommended.\n\n#### Path and query parameters\n\n* **`username`** (string) (required)\n  The handle for the GitHub user account.\n\n* **`year`** (integer)\n  If specified, only return results for a single year. The value of year is an integer with four digits representing a year. For example, 2025. Default value is the current year.\n\n* **`month`** (integer)\n  If specified, only return results for a single month. The value of month is an integer between 1 and 12. Default value is the current month. If no year is specified the default year is used.\n\n* **`day`** (integer)\n  If specified, only return results for a single day. The value of day is an integer between 1 and 31. If no year or month is specified, the default year and month are used.\n\n* **`model`** (string)\n  The model name to query usage for. The name is not case sensitive.\n\n* **`product`** (string)\n  The product name to query usage for. The name is not case sensitive.\n\n### HTTP response status codes\n\n* **200** - Response when getting a billing premium request usage report\n\n* **400** - Bad Request\n\n* **403** - Forbidden\n\n* **404** - Resource not found\n\n* **500** - Internal Error\n\n* **503** - Service unavailable\n\n### Code examples\n\n#### Example\n\n**Request:**\n\n```curl\ncurl -L \\\n  -X GET \\\n  https://api.github.com/users/USERNAME/settings/billing/premium_request/usage\n```\n\n**Response schema (Status: 200):**\n\nSame response schema as [Get billing AI credit usage report for a user](#get-billing-ai-credit-usage-report-for-a-user).\n\n## Get billing usage report for a user\n\n```\nGET /users/{username}/settings/billing/usage\n```\n\nGets a report of the total usage for a user.\nNote: This endpoint is only available to users with access to the enhanced billing platform.\n\n### Parameters\n\n#### Headers\n\n* **`accept`** (string)\n  Setting to `application/vnd.github+json` is recommended.\n\n#### Path and query parameters\n\n* **`username`** (string) (required)\n  The handle for the GitHub user account.\n\n* **`year`** (integer)\n  If specified, only return results for a single year. The value of year is an integer with four digits representing a year. For example, 2025. Default value is the current year.\n\n* **`month`** (integer)\n  If specified, only return results for a single month. The value of month is an integer between 1 and 12. If no year is specified the default year is used.\n\n* **`day`** (integer)\n  If specified, only return results for a single day. The value of day is an integer between 1 and 31. If no year or month is specified, the default year and month are used.\n\n### HTTP response status codes\n\n* **200** - Response when getting a billing usage report\n\n* **400** - Bad Request\n\n* **403** - Forbidden\n\n* **500** - Internal Error\n\n* **503** - Service unavailable\n\n### Code examples\n\n#### Example\n\n**Request:**\n\n```curl\ncurl -L \\\n  -X GET \\\n  https://api.github.com/users/USERNAME/settings/billing/usage\n```\n\n**Response schema (Status: 200):**\n\n* `usageItems`: array of objects:\n  * `date`: required, string\n  * `product`: required, string\n  * `sku`: required, string\n  * `quantity`: required, integer\n  * `unitType`: required, string\n  * `pricePerUnit`: required, number\n  * `grossAmount`: required, number\n  * `discountAmount`: required, number\n  * `netAmount`: required, number\n  * `repositoryName`: string\n\n## Get billing usage summary for a user\n\n```\nGET /users/{username}/settings/billing/usage/summary\n```\n\nNote\n\nThis endpoint is in public preview and is subject to change.\n\nGets a summary report of usage for a user.\nNote: Only data from the past 24 months is accessible via this endpoint.\n\n### Parameters\n\n#### Headers\n\n* **`accept`** (string)\n  Setting to `application/vnd.github+json` is recommended.\n\n#### Path and query parameters\n\n* **`username`** (string) (required)\n  The handle for the GitHub user account.\n\n* **`year`** (integer)\n  If specified, only return results for a single year. The value of year is an integer with four digits representing a year. For example, 2025. Default value is the current year.\n\n* **`month`** (integer)\n  If specified, only return results for a single month. The value of month is an integer between 1 and 12. Default value is the current month. If no year is specified the default year is used.\n\n* **`day`** (integer)\n  If specified, only return results for a single day. The value of day is an integer between 1 and 31. If no year or month is specified, the default year and month are used.\n\n* **`repository`** (string)\n  The repository name to query for usage in the format owner/repository.\n\n* **`product`** (string)\n  The product name to query usage for. The name is not case sensitive.\n\n* **`sku`** (string)\n  The SKU to query for usage.\n\n### HTTP response status codes\n\n* **200** - Response when getting a billing usage summary\n\n* **400** - Bad Request\n\n* **403** - Forbidden\n\n* **404** - Resource not found\n\n* **500** - Internal Error\n\n* **503** - Service unavailable\n\n### Code examples\n\n#### Example\n\n**Request:**\n\n```curl\ncurl -L \\\n  -X GET \\\n  https://api.github.com/users/USERNAME/settings/billing/usage/summary\n```\n\n**Response schema (Status: 200):**\n\n* `timePeriod`: required, object:\n  * `year`: required, integer\n  * `month`: integer\n  * `day`: integer\n* `user`: required, string\n* `repository`: string\n* `product`: string\n* `sku`: string\n* `usageItems`: required, array of objects:\n  * `product`: required, string\n  * `sku`: required, string\n  * `unitType`: required, string\n  * `pricePerUnit`: required, number\n  * `grossQuantity`: required, number\n  * `grossAmount`: required, number\n  * `discountQuantity`: required, number\n  * `discountAmount`: required, number\n  * `netQuantity`: required, number\n  * `netAmount`: required, number"}