{"meta":{"title":"GitHub Actions キャッシュの REST API エンドポイント","intro":"この REST API を使って、GitHub Actions のリポジトリのキャッシュを操作します。","product":"REST API","breadcrumbs":[{"href":"/ja/rest","title":"REST API"},{"href":"/ja/rest/actions","title":"アクション"},{"href":"/ja/rest/actions/cache","title":"キャッシュ"}],"documentType":"article"},"body":"# GitHub Actions キャッシュの REST API エンドポイント\n\nこの REST API を使って、GitHub Actions のリポジトリのキャッシュを操作します。\n\n## GitHub Actions\n\nのキャッシュについて\n\nこの REST API を使うと、GitHub Actions\n内のリポジトリのキャッシュを照会および管理できます。 GitHub CLI 拡張機能をインストールして、コマンド ラインからキャッシュを管理することもできます。 詳しくは、「[依存関係キャッシュのリファレンス](/ja/actions/using-workflows/caching-dependencies-to-speed-up-workflows#managing-caches)」をご覧ください。\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 GitHub Actions cache retention limit for an enterprise\n\n```\nGET /enterprises/{enterprise}/actions/cache/retention-limit\n```\n\nGets GitHub Actions cache retention limit for an enterprise. All organizations and repositories under this\nenterprise may not set a higher cache retention limit.\nOAuth tokens and personal access tokens (classic) need the admin:enterprise scope to use 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* **`enterprise`** (string) (required)\n  The slug version of the enterprise name.\n\n### HTTP response status codes\n\n* **200** - OK\n\n* **403** - Forbidden\n\n* **404** - Resource not found\n\n### Code examples\n\n#### Example\n\n**Request:**\n\n```curl\ncurl -L \\\n  -X GET \\\n  https://api.github.com/enterprises/ENTERPRISE/actions/cache/retention-limit\n```\n\n**Response schema (Status: 200):**\n\n* `max_cache_retention_days`: integer\n\n## Set GitHub Actions cache retention limit for an enterprise\n\n```\nPUT /enterprises/{enterprise}/actions/cache/retention-limit\n```\n\nSets GitHub Actions cache retention limit for an enterprise. All organizations and repositories under this\nenterprise may not set a higher cache retention limit.\nOAuth tokens and personal access tokens (classic) need the admin:enterprise scope to use 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* **`enterprise`** (string) (required)\n  The slug version of the enterprise name.\n\n#### Body parameters\n\n* **`max_cache_retention_days`** (integer)\n  For repositories & organizations in an enterprise, the maximum duration, in days, for which caches in a repository may be retained.\n\n### HTTP response status codes\n\n* **204** - No Content\n\n* **400** - Bad Request\n\n* **403** - Forbidden\n\n* **404** - Resource not found\n\n### Code examples\n\n#### Example\n\n**Request:**\n\n```curl\ncurl -L \\\n  -X PUT \\\n  https://api.github.com/enterprises/ENTERPRISE/actions/cache/retention-limit \\\n  -d '{\n  \"max_cache_retention_days\": 80\n}'\n```\n\n**Response schema (Status: 204):**\n\n## Get GitHub Actions cache storage limit for an enterprise\n\n```\nGET /enterprises/{enterprise}/actions/cache/storage-limit\n```\n\nGets GitHub Actions cache storage limit for an enterprise. All organizations and repositories under this\nenterprise may not set a higher cache storage limit.\nOAuth tokens and personal access tokens (classic) need the admin:enterprise scope to use 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* **`enterprise`** (string) (required)\n  The slug version of the enterprise name.\n\n### HTTP response status codes\n\n* **200** - OK\n\n* **403** - Forbidden\n\n* **404** - Resource not found\n\n### Code examples\n\n#### Example\n\n**Request:**\n\n```curl\ncurl -L \\\n  -X GET \\\n  https://api.github.com/enterprises/ENTERPRISE/actions/cache/storage-limit\n```\n\n**Response schema (Status: 200):**\n\n* `max_cache_size_gb`: integer\n\n## Set GitHub Actions cache storage limit for an enterprise\n\n```\nPUT /enterprises/{enterprise}/actions/cache/storage-limit\n```\n\nSets GitHub Actions cache storage limit for an enterprise. All organizations and repositories under this\nenterprise may not set a higher cache storage limit.\nOAuth tokens and personal access tokens (classic) need the admin:enterprise scope to use 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* **`enterprise`** (string) (required)\n  The slug version of the enterprise name.\n\n#### Body parameters\n\n* **`max_cache_size_gb`** (integer)\n  For repositories & organizations in an enterprise, the maximum size limit for the sum of all caches in a repository, in gigabytes.\n\n### HTTP response status codes\n\n* **204** - No Content\n\n* **400** - Bad Request\n\n* **403** - Forbidden\n\n* **404** - Resource not found\n\n### Code examples\n\n#### Example\n\n**Request:**\n\n```curl\ncurl -L \\\n  -X PUT \\\n  https://api.github.com/enterprises/ENTERPRISE/actions/cache/storage-limit \\\n  -d '{\n  \"max_cache_size_gb\": 150\n}'\n```\n\n**Response schema (Status: 204):**\n\n## Get GitHub Actions cache retention limit for an organization\n\n```\nGET /organizations/{org}/actions/cache/retention-limit\n```\n\nGets GitHub Actions cache retention limit for an organization. All repositories under this\norganization may not set a higher cache retention limit.\nOAuth tokens and personal access tokens (classic) need the admin:organization scope to use 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### HTTP response status codes\n\n* **200** - OK\n\n* **403** - Forbidden\n\n* **404** - Resource not found\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/actions/cache/retention-limit\n```\n\n**Response schema (Status: 200):**\n\nSame response schema as [Get GitHub Actions cache retention limit for an enterprise](#get-github-actions-cache-retention-limit-for-an-enterprise).\n\n## Set GitHub Actions cache retention limit for an organization\n\n```\nPUT /organizations/{org}/actions/cache/retention-limit\n```\n\nSets GitHub Actions cache retention limit for an organization. All repositories under this\norganization may not set a higher cache retention limit.\nOAuth tokens and personal access tokens (classic) need the admin:organization scope to use 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#### Body parameters\n\n* **`max_cache_retention_days`** (integer)\n  For repositories in this organization, the maximum duration, in days, for which caches in a repository may be retained.\n\n### HTTP response status codes\n\n* **204** - No Content\n\n* **400** - Bad Request\n\n* **403** - Forbidden\n\n* **404** - Resource not found\n\n### Code examples\n\n#### Example\n\n**Request:**\n\n```curl\ncurl -L \\\n  -X PUT \\\n  https://api.github.com/organizations/ORG/actions/cache/retention-limit \\\n  -d '{\n  \"max_cache_retention_days\": 80\n}'\n```\n\n**Response schema (Status: 204):**\n\n## Get GitHub Actions cache storage limit for an organization\n\n```\nGET /organizations/{org}/actions/cache/storage-limit\n```\n\nGets GitHub Actions cache storage limit for an organization. All repositories under this\norganization may not set a higher cache storage limit.\nOAuth tokens and personal access tokens (classic) need the admin:organization scope to use 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### HTTP response status codes\n\n* **200** - OK\n\n* **403** - Forbidden\n\n* **404** - Resource not found\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/actions/cache/storage-limit\n```\n\n**Response schema (Status: 200):**\n\nSame response schema as [Get GitHub Actions cache storage limit for an enterprise](#get-github-actions-cache-storage-limit-for-an-enterprise).\n\n## Set GitHub Actions cache storage limit for an organization\n\n```\nPUT /organizations/{org}/actions/cache/storage-limit\n```\n\nSets GitHub Actions cache storage limit for an organization. All organizations and repositories under this\norganization may not set a higher cache storage limit.\nOAuth tokens and personal access tokens (classic) need the admin:organization scope to use 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#### Body parameters\n\n* **`max_cache_size_gb`** (integer)\n  For repositories in the organization, the maximum size limit for the sum of all caches in a repository, in gigabytes.\n\n### HTTP response status codes\n\n* **204** - No Content\n\n* **400** - Bad Request\n\n* **403** - Forbidden\n\n* **404** - Resource not found\n\n### Code examples\n\n#### Example\n\n**Request:**\n\n```curl\ncurl -L \\\n  -X PUT \\\n  https://api.github.com/organizations/ORG/actions/cache/storage-limit \\\n  -d '{\n  \"max_cache_size_gb\": 150\n}'\n```\n\n**Response schema (Status: 204):**\n\n## Get GitHub Actions cache usage for an organization\n\n```\nGET /orgs/{org}/actions/cache/usage\n```\n\nGets the total GitHub Actions cache usage for an organization.\nThe data fetched using this API is refreshed approximately every 5 minutes, so values returned from this endpoint may take at least 5 minutes to get updated.\nOAuth tokens and personal access tokens (classic) need the read:org scope to use 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### HTTP response status codes\n\n* **200** - OK\n\n### Code examples\n\n#### Example\n\n**Request:**\n\n```curl\ncurl -L \\\n  -X GET \\\n  https://api.github.com/orgs/ORG/actions/cache/usage\n```\n\n**Response schema (Status: 200):**\n\n* `total_active_caches_count`: required, integer\n* `total_active_caches_size_in_bytes`: required, integer\n\n## List repositories with GitHub Actions cache usage for an organization\n\n```\nGET /orgs/{org}/actions/cache/usage-by-repository\n```\n\nLists repositories and their GitHub Actions cache usage for an organization.\nThe data fetched using this API is refreshed approximately every 5 minutes, so values returned from this endpoint may take at least 5 minutes to get updated.\nOAuth tokens and personal access tokens (classic) need the read:org scope to use 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* **`per_page`** (integer)\n  The number of results per page (max 100). For more information, see \"Using pagination in the REST API.\"\n  Default: `30`\n\n* **`page`** (integer)\n  The page number of the results to fetch. For more information, see \"Using pagination in the REST API.\"\n  Default: `1`\n\n### HTTP response status codes\n\n* **200** - OK\n\n### Code examples\n\n#### Example\n\n**Request:**\n\n```curl\ncurl -L \\\n  -X GET \\\n  https://api.github.com/orgs/ORG/actions/cache/usage-by-repository\n```\n\n**Response schema (Status: 200):**\n\n* `total_count`: required, integer\n* `repository_cache_usages`: required, array of `Actions Cache Usage by repository`:\n  * `full_name`: required, string\n  * `active_caches_size_in_bytes`: required, integer\n  * `active_caches_count`: required, integer\n\n## Get GitHub Actions cache retention limit for a repository\n\n```\nGET /repos/{owner}/{repo}/actions/cache/retention-limit\n```\n\nGets GitHub Actions cache retention limit for a repository. This determines how long caches will be retained for, if\nnot manually removed or evicted due to size constraints.\nOAuth tokens and personal access tokens (classic) need the admin:repository scope to use 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* **`owner`** (string) (required)\n  The account owner of the repository. The name is not case sensitive.\n\n* **`repo`** (string) (required)\n  The name of the repository without the .git extension. The name is not case sensitive.\n\n### HTTP response status codes\n\n* **200** - OK\n\n* **403** - Forbidden\n\n* **404** - Resource not found\n\n### Code examples\n\n#### Example\n\n**Request:**\n\n```curl\ncurl -L \\\n  -X GET \\\n  https://api.github.com/repos/OWNER/REPO/actions/cache/retention-limit\n```\n\n**Response schema (Status: 200):**\n\nSame response schema as [Get GitHub Actions cache retention limit for an enterprise](#get-github-actions-cache-retention-limit-for-an-enterprise).\n\n## Set GitHub Actions cache retention limit for a repository\n\n```\nPUT /repos/{owner}/{repo}/actions/cache/retention-limit\n```\n\nSets GitHub Actions cache retention limit for a repository. This determines how long caches will be retained for, if\nnot manually removed or evicted due to size constraints.\nOAuth tokens and personal access tokens (classic) need the admin:repository scope to use 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* **`owner`** (string) (required)\n  The account owner of the repository. The name is not case sensitive.\n\n* **`repo`** (string) (required)\n  The name of the repository without the .git extension. The name is not case sensitive.\n\n#### Body parameters\n\n* **`max_cache_retention_days`** (integer)\n  The maximum number of days to keep caches in this repository.\n\n### HTTP response status codes\n\n* **204** - No Content\n\n* **400** - Bad Request\n\n* **403** - Forbidden\n\n* **404** - Resource not found\n\n### Code examples\n\n#### Example\n\n**Request:**\n\n```curl\ncurl -L \\\n  -X PUT \\\n  https://api.github.com/repos/OWNER/REPO/actions/cache/retention-limit \\\n  -d '{\n  \"max_cache_retention_days\": 80\n}'\n```\n\n**Response schema (Status: 204):**\n\n## Get GitHub Actions cache storage limit for a repository\n\n```\nGET /repos/{owner}/{repo}/actions/cache/storage-limit\n```\n\nGets GitHub Actions cache storage limit for a repository. This determines the maximum size of caches that can be\nstored before eviction occurs.\nOAuth tokens and personal access tokens (classic) need the admin:repository scope to use 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* **`owner`** (string) (required)\n  The account owner of the repository. The name is not case sensitive.\n\n* **`repo`** (string) (required)\n  The name of the repository without the .git extension. The name is not case sensitive.\n\n### HTTP response status codes\n\n* **200** - OK\n\n* **403** - Forbidden\n\n* **404** - Resource not found\n\n### Code examples\n\n#### Example\n\n**Request:**\n\n```curl\ncurl -L \\\n  -X GET \\\n  https://api.github.com/repos/OWNER/REPO/actions/cache/storage-limit\n```\n\n**Response schema (Status: 200):**\n\nSame response schema as [Get GitHub Actions cache storage limit for an enterprise](#get-github-actions-cache-storage-limit-for-an-enterprise).\n\n## Set GitHub Actions cache storage limit for a repository\n\n```\nPUT /repos/{owner}/{repo}/actions/cache/storage-limit\n```\n\nSets GitHub Actions cache storage limit for a repository. This determines the maximum size of caches that can be\nstored before eviction occurs.\nOAuth tokens and personal access tokens (classic) need the admin:repository scope to use 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* **`owner`** (string) (required)\n  The account owner of the repository. The name is not case sensitive.\n\n* **`repo`** (string) (required)\n  The name of the repository without the .git extension. The name is not case sensitive.\n\n#### Body parameters\n\n* **`max_cache_size_gb`** (integer)\n  The maximum total cache size for this repository, in gigabytes.\n\n### HTTP response status codes\n\n* **204** - No Content\n\n* **400** - Bad Request\n\n* **403** - Forbidden\n\n* **404** - Resource not found\n\n### Code examples\n\n#### Example\n\n**Request:**\n\n```curl\ncurl -L \\\n  -X PUT \\\n  https://api.github.com/repos/OWNER/REPO/actions/cache/storage-limit \\\n  -d '{\n  \"max_cache_size_gb\": 150\n}'\n```\n\n**Response schema (Status: 204):**\n\n## Get GitHub Actions cache usage for a repository\n\n```\nGET /repos/{owner}/{repo}/actions/cache/usage\n```\n\nGets GitHub Actions cache usage for a repository.\nThe data fetched using this API is refreshed approximately every 5 minutes, so values returned from this endpoint may take at least 5 minutes to get updated.\nAnyone with read access to the repository can use this endpoint.\nIf the repository is private, OAuth tokens and personal access tokens (classic) need the repo scope to use 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* **`owner`** (string) (required)\n  The account owner of the repository. The name is not case sensitive.\n\n* **`repo`** (string) (required)\n  The name of the repository without the .git extension. The name is not case sensitive.\n\n### HTTP response status codes\n\n* **200** - OK\n\n### Code examples\n\n#### Example\n\n**Request:**\n\n```curl\ncurl -L \\\n  -X GET \\\n  https://api.github.com/repos/OWNER/REPO/actions/cache/usage\n```\n\n**Response schema (Status: 200):**\n\n* `full_name`: required, string\n* `active_caches_size_in_bytes`: required, integer\n* `active_caches_count`: required, integer\n\n## List GitHub Actions caches for a repository\n\n```\nGET /repos/{owner}/{repo}/actions/caches\n```\n\nLists the GitHub Actions caches for a repository.\nOAuth tokens and personal access tokens (classic) need the repo scope to use 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* **`owner`** (string) (required)\n  The account owner of the repository. The name is not case sensitive.\n\n* **`repo`** (string) (required)\n  The name of the repository without the .git extension. The name is not case sensitive.\n\n* **`per_page`** (integer)\n  The number of results per page (max 100). For more information, see \"Using pagination in the REST API.\"\n  Default: `30`\n\n* **`page`** (integer)\n  The page number of the results to fetch. For more information, see \"Using pagination in the REST API.\"\n  Default: `1`\n\n* **`ref`** (string)\n  The full Git reference for narrowing down the cache. The ref for a branch should be formatted as refs/heads/<branch name>. To reference a pull request use refs/pull/<number>/merge.\n\n* **`key`** (string)\n  An explicit key or prefix for identifying the cache\n\n* **`sort`** (string)\n  The property to sort the results by. created\\_at means when the cache was created. last\\_accessed\\_at means when the cache was last accessed. size\\_in\\_bytes is the size of the cache in bytes.\n  Default: `last_accessed_at`\n  Can be one of: `created_at`, `last_accessed_at`, `size_in_bytes`\n\n* **`direction`** (string)\n  The direction to sort the results by.\n  Default: `desc`\n  Can be one of: `asc`, `desc`\n\n### HTTP response status codes\n\n* **200** - OK\n\n### Code examples\n\n#### Example\n\n**Request:**\n\n```curl\ncurl -L \\\n  -X GET \\\n  https://api.github.com/repos/OWNER/REPO/actions/caches\n```\n\n**Response schema (Status: 200):**\n\n* `total_count`: required, integer\n* `actions_caches`: required, array of objects:\n  * `id`: integer\n  * `ref`: string\n  * `key`: string\n  * `version`: string\n  * `last_accessed_at`: string, format: date-time\n  * `created_at`: string, format: date-time\n  * `size_in_bytes`: integer\n\n## Delete GitHub Actions caches for a repository (using a cache key)\n\n```\nDELETE /repos/{owner}/{repo}/actions/caches\n```\n\nDeletes one or more GitHub Actions caches for a repository, using a complete cache key. By default, all caches that match the provided key are deleted, but you can optionally provide a Git ref to restrict deletions to caches that match both the provided key and the Git ref.\nOAuth tokens and personal access tokens (classic) need the repo scope to use 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* **`owner`** (string) (required)\n  The account owner of the repository. The name is not case sensitive.\n\n* **`repo`** (string) (required)\n  The name of the repository without the .git extension. The name is not case sensitive.\n\n* **`key`** (string) (required)\n  A key for identifying the cache.\n\n* **`ref`** (string)\n  The full Git reference for narrowing down the cache. The ref for a branch should be formatted as refs/heads/<branch name>. To reference a pull request use refs/pull/<number>/merge.\n\n### HTTP response status codes\n\n* **200** - OK\n\n### Code examples\n\n#### Example\n\n**Request:**\n\n```curl\ncurl -L \\\n  -X DELETE \\\n  https://api.github.com/repos/OWNER/REPO/actions/caches\n```\n\n**Response schema (Status: 200):**\n\nSame response schema as [List GitHub Actions caches for a repository](#list-github-actions-caches-for-a-repository).\n\n## Delete a GitHub Actions cache for a repository (using a cache ID)\n\n```\nDELETE /repos/{owner}/{repo}/actions/caches/{cache_id}\n```\n\nDeletes a GitHub Actions cache for a repository, using a cache ID.\nOAuth tokens and personal access tokens (classic) need the repo scope to use 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* **`owner`** (string) (required)\n  The account owner of the repository. The name is not case sensitive.\n\n* **`repo`** (string) (required)\n  The name of the repository without the .git extension. The name is not case sensitive.\n\n* **`cache_id`** (integer) (required)\n  The unique identifier of the GitHub Actions cache.\n\n### HTTP response status codes\n\n* **204** - No Content\n\n### Code examples\n\n#### Example\n\n**Request:**\n\n```curl\ncurl -L \\\n  -X DELETE \\\n  https://api.github.com/repos/OWNER/REPO/actions/caches/CACHE_ID\n```\n\n**Response schema (Status: 204):**"}