--- title: "Rename a credential" canonical: "https://admiral.io/docs/api/credentials/CredentialAPI_RenameCredential" --- # Rename a credential `POST https://api.admiral.io/v1/credentials/{credential}/rename` - PERMISSION_DENIED without permission to manage credentials, which organization admins hold by default. - ALREADY_EXISTS when another credential has the new name. - ABORTED when `etag` is set and the credential changed since it was read. Scope: `credential:write` ### Path parameters - `credential` (string, required): The credential id. ### Request body - `new_name` (string, required): The new name, under the same rules as the credential's `name`. new_name.not_uid // a credential name may not have the shape of a uid Pattern `^[a-z]([a-z0-9-]{0,61}[a-z0-9])?$`. Length 1 to 63. - `etag` (string): When set, the rename is refused unless it matches the credential's current etag. ### Response 200 Success - `credential` (Credential): The credential under its new name. - `uid` (string): `cred-` and twelve base36 characters. Never changes and is never reused, so it is what a reference to the credential holds. Pattern `^cred-[0-9a-z]+$`. Read-only. - `name` (string, required): (IMMUTABLE) The name, such as `ghcr-read`. Unique among the organization's credentials, set on create and changed only by RenameCredential. Lowercase letters, digits and hyphens, starting with a letter and ending with a letter or digit, 1 to 63 characters. It may not have the shape of a uid (`cred-` and twelve characters). name.not_uid // a credential name may not have the shape of a uid Pattern `^[a-z]([a-z0-9-]{0,61}[a-z0-9])?$`. Length 1 to 63. - `display_name` (string): A label for people, such as "GHCR read". Optional; clients show the name when it is unset. Length at most 128. - `resource_name` (string): (IDENTIFIER) The resource name, `credentials/{credential}`, such as `credentials/ghcr-read`. Built from the credential's name, so it changes when the credential is renamed; refer to a credential by `uid` to keep a reference stable. Identifies the credential on update. Pattern `^credentials/[a-z]([a-z0-9-]{0,61}[a-z0-9])?$`. - `description` (string): Length at most 1024. - `labels` (map of string to string) - `type` (Type): (IMMUTABLE) Immutable after creation. One of `TYPE_UNSPECIFIED`, `SSH_KEY`, `BASIC_AUTH`, `BEARER_TOKEN`, `GITHUB_APP`. - `auth_config` (AuthConfig): Write-only. Empty in every response. - At most one of `basic_auth`, `bearer_token`, `github_app`, `ssh_key` is set. - `basic_auth` (BasicAuth): BasicAuth is a username and password, or a username and a token that the host takes as a password (a registry-scoped token, an app password). - `username` (string): Length 1 to 256. - `password` (string): Write-only. Length at most 4096. - `bearer_token` (BearerTokenAuth): BearerTokenAuth is one token. - `token` (string): Write-only. Length at most 4096. - `github_app` (GitHubAppAuth): GitHubAppAuth identifies a GitHub App installation and holds the app's private key, from which Admiral mints installation tokens. - `app_id` (string (int64)): The app's numeric id, from the app's settings page. - `installation_id` (string (int64)): The installation's numeric id, from the installation's URL. - `private_key` (string): The app's PEM-encoded RSA private key. Write-only. Length at most 16384. - `api_url` (string (uri)): The REST API base, for GitHub Enterprise Server: `https://github.acme.example/api/v3`. Empty is `https://api.github.com`. Length at most 512. - `ssh_key` (SSHKeyAuth): SSHKeyAuth is a PEM-encoded private key and its passphrase, if any. - `private_key` (string): Write-only. Length at most 16384. - `passphrase` (string): Write-only. Length at most 1024. - `allowed_hosts` (array of string): Hosts this credential may be presented to, as a guard: set means Admiral refuses to present it anywhere else. Empty, on a credential a source holds, means that source's host and nothing more. It is checked on every fetch, redirects and transitive fetches included. Hostnames, optionally with a port: `github.acme.example`, `harbor.acme.example:8443`. No scheme, no path. Items at most 32. - `last_used_at` (Timestamp): When Admiral last presented this credential to a host, whether or not the host accepted it. Updated at most every few minutes. Absent if it has never been used. Read-only. - `etag` (string): Changes whenever the credential does. Send it back on update, rename or delete to refuse the change if someone else changed the credential first. Read-only. - `created_by` (ActorRef): ActorRef is a lightweight reference to the user or agent that performed an action. Server-populated on all resource responses. Clients should never send this. Read-only. - `id` (string): The actor's typed id: a `usr-` user id or an `sa-` service account id. - `display_name` (string): Human-readable name (e.g., "John Smith", "deploy-bot"). - `email` (string): Email address (empty for non-human actors). - `created_at` (Timestamp): A point in time in RFC 3339 format, with up to nanosecond precision. Output uses UTC (`Z`); input may use an offset from UTC. Read-only. - `updated_at` (Timestamp): A point in time in RFC 3339 format, with up to nanosecond precision. Output uses UTC (`Z`); input may use an offset from UTC. Read-only.