--- title: "Rename a service account" canonical: "https://admiral.io/docs/api/serviceaccounts/ServiceAccountAPI_RenameServiceAccount" --- # Rename a service account `POST https://api.admiral.io/v1/serviceAccounts/{serviceAccount}/rename` - ALREADY_EXISTS when another service account has the new id. - ABORTED when `etag` is set and the service account changed since it was read. Scope: `serviceaccount:write` ### Path parameters - `serviceAccount` (string, required): The serviceAccount id. ### Request body - `service_account_id` (string, required): The new id, under the same rules as CreateServiceAccount's `service_account_id`. service_account_id.not_uid // a service account id 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 service account's current etag. ### Response 200 Success - `service_account` (ServiceAccount): The service account under its new name. - `name` (string): (IDENTIFIER) The service account's name, `serviceAccounts/{service_account}`, such as `serviceAccounts/ci-deployer`. An agent's takes the agent's id when it is made. Pattern `^serviceAccounts/[a-z]([a-z0-9-]{0,61}[a-z0-9])?$`. - `uid` (string): `sa-` and twelve base36 characters. Never changes and is never reused, so it is what a reference to the service account holds, and the `sub` of every token it signs in with. Pattern `^sa-[0-9a-z]+$`. Read-only. - `display_name` (string): A label for people, such as "CI deployer". Optional; clients show the id when it is unset. Length at most 128. - `subject` (string): (IMMUTABLE) The `sub` a token must carry. For a Kubernetes service account, `system:serviceaccount::`; for GitHub Actions, `repo:/:ref:refs/heads/` or `repo:/:environment:`. For an agent's, recorded from its verified token when it enrolls; empty before. Fixed once set. Length at most 512. - `issuer_id` (string): (IMMUTABLE) `iss-`: the issuer whose tokens it accepts. For an agent's, set when the agent enrolls; empty before. For one that runs no agent, set on create. Pattern `^iss-[0-9a-z]+$`. - `agent_id` (string): `agt-`: the agent that runs as this service account. Empty for one that runs no agent. Read-only. - `enrolled_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. - `etag` (string): Changes whenever the service account does. Send it back on rename or delete to refuse the change if someone else changed it 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.