レート制限用 REST API エンドポイント
REST API を使って、現在のレート制限の状態を確認します。
レート制限について
現在のレート制限の状態はいつでも確認できます。 レート制限規則の詳細については、「REST API のレート制限」を参照してください。
アイテムを検索するための REST API には、他の REST API エンドポイントを管理するレート制限とは別のカスタム レート制限があります。 詳しくは、「検索用 REST API エンドポイント」をご覧ください。 GraphQL API にも、REST API のレート制限とは別の、別の方法で計算されるカスタム レート制限があります。 詳しくは、「GraphQL API のレート制限とクエリ制限」をご覧ください。 そのため、API の応答は、レート制限を分類します。 resources の下には、次のようなさまざまなカテゴリに関連するオブジェクトが表示されます。
-
coreオブジェクトは、REST API の検索に関連しないすべてのリソースに関するレート制限の状態を示します。 -
searchオブジェクトは、REST API の検索に関するレート制限の状態を示します (コード検索を除く)。 詳しくは、「検索用 REST API エンドポイント」をご覧ください。 -
code_searchオブジェクトは、REST API のコード検索に関するレート制限の状態を示します。 詳しくは、「検索用 REST API エンドポイント」をご覧ください。 -
graphqlオブジェクトは、GraphQL API のレート制限の状態を示します。 -
integration_manifestオブジェクトは、POST /app-manifests/{code}/conversions操作のレート制限の状態を示します。 詳しくは、「マニフェストから GitHub App を登録する」をご覧ください。 -
dependency_snapshotsオブジェクトからは、スナップショットを依存関係グラフに送信するためのレート制限ステータスが与えられます。 詳しくは、「依存関係グラフ用の REST API エンドポイント」をご覧ください。 -
code_scanning_uploadオブジェクトは、SARIF の結果をコード スキャンにアップロードするためのレート制限の状態を示します。 詳しくは、「SARIF ファイルを GitHub にアップロードする」をご覧ください。 -
actions_runner_registrationオブジェクトには GitHub Actions でセルフホステッド ランナーを登録するためのレート制限状態が用意されています。 詳しくは、「セルフホステッド ランナーの REST API エンドポイント」をご覧ください。
レート制限の応答のヘッダーと値の詳細については、「REST API のレート制限」を参照してください。
Get rate limit status for the authenticated user
Note
Accessing this endpoint does not count against your REST API rate limit.
Some categories of endpoints have custom rate limits that are separate from the rate limit governing the other REST API endpoints. For this reason, the API response categorizes your rate limit. Under resources, you'll see objects relating to different categories:
- The
coreobject provides your rate limit status for all non-search-related resources in the REST API. - The
searchobject provides your rate limit status for the REST API for searching (excluding code searches). For more information, see "Search." - The
code_searchobject provides your rate limit status for the REST API for searching code. For more information, see "Search code." - The
graphqlobject provides your rate limit status for the GraphQL API. For more information, see "Resource limitations." - The
integration_manifestobject provides your rate limit status for thePOST /app-manifests/{code}/conversionsoperation. For more information, see "Creating a GitHub App from a manifest." - The
dependency_snapshotsobject provides your rate limit status for submitting snapshots to the dependency graph. For more information, see "Dependency graph." - The
dependency_sbomobject provides your rate limit status for requesting SBOMs from the dependency graph. For more information, see "Dependency graph." - The
code_scanning_uploadobject provides your rate limit status for uploading SARIF results to code scanning. For more information, see "Uploading a SARIF file to GitHub." - The
actions_runner_registrationobject provides your rate limit status for registering self-hosted runners in GitHub Actions. For more information, see "Self-hosted runners." - The
source_importobject is no longer in use for any API endpoints, and it will be removed in the next API version. For more information about API versions, see "API Versions."
Note
The rate object is closing down. If you're writing new API client code or updating existing code, you should use the core object instead of the rate object. The core object contains the same information that is present in the rate object.
"Get rate limit status for the authenticated user" のきめ細かいアクセス トークン
このエンドポイントは、次の粒度の細かいトークンの種類で動作します:
粒度の細かいトークンにはアクセス許可が必要ありません。
パブリック リソースのみが要求された場合、このエンドポイントは認証なしで使用できます。
"Get rate limit status for the authenticated user" の HTTP 応答状態コード
| 状態コード | 説明 |
|---|---|
200 | OK |
304 | Not modified |
404 | Resource not found |
"Get rate limit status for the authenticated user" のコード サンプル
要求の例
curl -L \
-H "Accept: application/vnd.github+json" \
-H "X-GitHub-Api-Version: 2022-11-28" \
https://api.github.com/rate_limitResponse
Status: 200{
"resources": {
"core": {
"limit": 5000,
"used": 1,
"remaining": 4999,
"reset": 1691591363
},
"search": {
"limit": 30,
"used": 12,
"remaining": 18,
"reset": 1691591091
},
"graphql": {
"limit": 5000,
"used": 7,
"remaining": 4993,
"reset": 1691593228
},
"integration_manifest": {
"limit": 5000,
"used": 1,
"remaining": 4999,
"reset": 1691594631
},
"source_import": {
"limit": 100,
"used": 1,
"remaining": 99,
"reset": 1691591091
},
"code_scanning_upload": {
"limit": 500,
"used": 1,
"remaining": 499,
"reset": 1691594631
},
"actions_runner_registration": {
"limit": 10000,
"used": 0,
"remaining": 10000,
"reset": 1691594631
},
"scim": {
"limit": 15000,
"used": 0,
"remaining": 15000,
"reset": 1691594631
},
"dependency_snapshots": {
"limit": 100,
"used": 0,
"remaining": 100,
"reset": 1691591091
},
"code_search": {
"limit": 10,
"used": 0,
"remaining": 10,
"reset": 1691591091
},
"code_scanning_autofix": {
"limit": 10,
"used": 0,
"remaining": 10,
"reset": 1691591091
}
},
"rate": {
"limit": 5000,
"used": 1,
"remaining": 4999,
"reset": 1372700873
}
}