{"meta":{"title":"REST-API-Endpunkte für Codespaces-Repository-Geheimnisse","intro":"Verwende die REST-API, um Geheimnisse für Repositorys zu verwalten, auf die der Benutzer Zugriff in einem Codespace hat.","product":"REST-API","breadcrumbs":[{"href":"/de/rest","title":"REST-API"},{"href":"/de/rest/codespaces","title":"Codespaces"},{"href":"/de/rest/codespaces/repository-secrets","title":"Repositorygeheimnisse"}],"documentType":"article"},"body":"# REST-API-Endpunkte für Codespaces-Repository-Geheimnisse\n\nVerwende die REST-API, um Geheimnisse für Repositorys zu verwalten, auf die der Benutzer Zugriff in einem Codespace hat.\n\n## Informationen zu Codespaces-Repositorygeheimnissen\n\nDu kannst Geheimnisse (z. B. Zugriffstoken für Clouddienste) für die Repositorys erstellen, auflisten und löschen, auf die der Benutzer Zugriff hat. Diese Geheimnisse werden dem Codespace zur Laufzeit zur Verfügung gestellt. Weitere Informationen finden Sie unter [Verwalten Ihrer kontospezifischen geheimen Schlüssel für GitHub Codespaces](/de/codespaces/managing-your-codespaces/managing-your-account-specific-secrets-for-github-codespaces).\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## List repository secrets\n\n```\nGET /repos/{owner}/{repo}/codespaces/secrets\n```\n\nLists all development environment secrets available in a repository without revealing their encrypted\nvalues.\nOAuth app 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### 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/codespaces/secrets\n```\n\n**Response schema (Status: 200):**\n\n* `total_count`: required, integer\n* `secrets`: required, array of `Codespaces Secret`:\n  * `name`: required, string\n  * `created_at`: required, string, format: date-time\n  * `updated_at`: required, string, format: date-time\n\n## Get a repository public key\n\n```\nGET /repos/{owner}/{repo}/codespaces/secrets/public-key\n```\n\nGets your public key, which you need to encrypt secrets. You need to\nencrypt a secret before you can create or update secrets.\nIf the repository is private, OAuth app 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/codespaces/secrets/public-key\n```\n\n**Response schema (Status: 200):**\n\n* `key_id`: required, string\n* `key`: required, string\n* `id`: integer\n* `url`: string\n* `title`: string\n* `created_at`: string\n\n## Get a repository secret\n\n```\nGET /repos/{owner}/{repo}/codespaces/secrets/{secret_name}\n```\n\nGets a single repository development environment secret without revealing its encrypted value.\nOAuth app 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* **`secret_name`** (string) (required)\n  The name of the secret.\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/codespaces/secrets/SECRET_NAME\n```\n\n**Response schema (Status: 200):**\n\n* `name`: required, string\n* `created_at`: required, string, format: date-time\n* `updated_at`: required, string, format: date-time\n\n## Create or update a repository secret\n\n```\nPUT /repos/{owner}/{repo}/codespaces/secrets/{secret_name}\n```\n\nCreates or updates a repository development environment secret with an encrypted value. Encrypt your secret using\nLibSodium. For more information, see \"Encrypting secrets for the REST API.\"\nOAuth app tokens and personal access tokens (classic) need the repo scope to use this endpoint. The associated user must be a repository admin.\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* **`secret_name`** (string) (required)\n  The name of the secret.\n\n#### Body parameters\n\n* **`encrypted_value`** (string)\n  Value for your secret, encrypted with LibSodium using the public key retrieved from the Get a repository public key endpoint.\n\n* **`key_id`** (string)\n  ID of the key you used to encrypt the secret.\n\n### HTTP response status codes\n\n* **201** - Response when creating a secret\n\n* **204** - Response when updating a secret\n\n### Code examples\n\n#### Example 1: Status Code 201\n\n**Request:**\n\n```curl\ncurl -L \\\n  -X PUT \\\n  https://api.github.com/repos/OWNER/REPO/codespaces/secrets/SECRET_NAME \\\n  -d '{\n  \"encrypted_value\": \"c2VjcmV0\",\n  \"key_id\": \"012345678912345678\"\n}'\n```\n\n**Response schema (Status: 201):**\n\n#### Example 2: Status Code 204\n\n**Request:**\n\n```curl\ncurl -L \\\n  -X PUT \\\n  https://api.github.com/repos/OWNER/REPO/codespaces/secrets/SECRET_NAME \\\n  -d '{\n  \"encrypted_value\": \"c2VjcmV0\",\n  \"key_id\": \"012345678912345678\"\n}'\n```\n\n**Response schema (Status: 204):**\n\n## Delete a repository secret\n\n```\nDELETE /repos/{owner}/{repo}/codespaces/secrets/{secret_name}\n```\n\nDeletes a development environment secret in a repository using the secret name.\nOAuth app tokens and personal access tokens (classic) need the repo scope to use this endpoint. The associated user must be a repository admin.\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* **`secret_name`** (string) (required)\n  The name of the secret.\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/codespaces/secrets/SECRET_NAME\n```\n\n**Response schema (Status: 204):**"}