---
title: "Set GitHub Actions cache retention limit for a repository"
method: PUT
path: "/repos/{owner}/{repo}/actions/cache/retention-limit"
tags: ["actions"]
---

# Set GitHub Actions cache retention limit for a repository

`PUT /repos/{owner}/{repo}/actions/cache/retention-limit`

Sets GitHub Actions cache retention limit for a repository. This determines how long caches will be retained for, if
not manually removed or evicted due to size constraints.

OAuth tokens and personal access tokens (classic) need the `admin:repository` scope to use this endpoint.

## Path parameters

- `owner` string, required
- `repo` string, required

## Request body

- ActionsCacheRetentionLimitForRepository — GitHub Actions cache retention policy for a repository.
  - `max_cache_retention_days` integer — The maximum number of days to keep caches in this repository.

## Response `204`

Response

## Other responses

- `400` — Bad Request
- `403` — Forbidden
- `404` — Resource not found

---

[API](https://skmtc.net/github/apis/rest-api.md) · [All operations](https://skmtc.net/github/apis/rest-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/github/rest-api/versions/80850db290cd/schema)
