--- title: "Rename an agent" canonical: "https://admiral.io/docs/api/agents/AgentAPI_RenameAgent" --- # Rename an agent `POST https://api.admiral.io/v1/agents/{agent}/rename` - ALREADY_EXISTS when another agent has the new name. - ABORTED when `etag` is set and the agent changed since it was read. Scope: `agent:write` ### Path parameters - `agent` (string, required): The agent id. ### Request body - `new_name` (string, required): The new name, under the same rules as the agent's `name`. new_name.not_uid // an agent name may not have the shape of an id 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 agent's current etag. ### Response 200 Success - `agent` (Agent): The agent under its new name. - `id` (string): `agt-` and twelve base36 characters. Never changes and is never reused, so it is what a reference to the agent holds. Pattern `^agt-[0-9a-z]+$`. Read-only. - `name` (string, required): (IMMUTABLE) The name, such as `k8s-prod`. Unique among the organization's agents, set on create and changed only by RenameAgent. Its service account takes the same name. 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 an id (`agt-` and twelve characters). name.not_uid // an agent name may not have the shape of an id Pattern `^[a-z]([a-z0-9-]{0,61}[a-z0-9])?$`. Length 1 to 63. - `display_name` (string): A label for people, such as "Production cluster". Optional; clients show the name when it is unset. Length at most 128. - `resource_name` (string): (IDENTIFIER) The resource name, `agents/{agent}`, such as `agents/k8s-prod`. Built from the agent's name, so it changes when the agent is renamed; refer to an agent by `id` to keep a reference stable. Identifies the agent on update. Pattern `^agents/[a-z]([a-z0-9-]{0,61}[a-z0-9])?$`. - `kind` (AgentKind): (IMMUTABLE) What the agent deploys. Set on create. enum.defined_only = true One of `KUBERNETES`, `INFRA`. - `settings` (AgentSettings): AgentSettings is what the agent's owner allows it, one block per kind. Environments that use the agent choose within these; they cannot exceed them. - At most one of `infra`, `kubernetes` is set. - `infra` (InfraAgentSettings): InfraAgentSettings is what an infra agent will run. - `engines` (array of EngineSupport): The engines this agent may run. Setting an assignment's engine version outside them, or placing a component pinned outside them, is refused, naming an agent that runs it, so no job waits on it. Items at most 8. - `engine` (Engine): enum.defined_only = true One of `TERRAFORM`, `OPENTOFU`. - `versions` (string): A version constraint in Terraform's syntax, e.g. `>= 1.8, < 2.0`. Empty allows every version. Length at most 128. - `kubernetes` (KubernetesAgentSettings): KubernetesAgentSettings limits where a Kubernetes agent may deploy, whatever its RBAC allows. The plan refuses what falls outside them. - `allowed_namespaces` (array of string): Glob patterns; empty allows every namespace. Items at most 64. - `denied_namespaces` (array of string): Glob patterns. A namespace that matches is refused even when `allowed_namespaces` matches it too. Items at most 64. - `allow_namespace_creation` (boolean) - `approval` (ApprovalRule): What every apply on this agent needs from people, in every environment that uses it, on top of the environment's own rule. Only the agent's owner sets it, so a team using the agent cannot loosen it. - `required_approvals` (integer (int32)): Distinct people who must approve the planned revision, from anyone allowed to. 0 needs none. Value at least 0. - `groups` (array of GroupApproval): Groups that must each approve, all of them. One person's approval counts for every group they belong to; to need two people, also set required_approvals to 2. approval_rule.unique_groups // a group appears at most once Items at most 16. - `group_id` (string, required): Pattern `^grp-[0-9a-z]+$`. - `approvals` (integer (int32)): Value at least 1. - `allowed_component_ids` (array of string): The components that may run on this agent, as `cmp-` ids. Empty allows any. Only the agent's owner sets it; Admiral refuses to place a component outside it and checks again before each job. Items at most 256. - `service_account_id` (string): `sa-`: the service account the agent runs as, made with it. Read-only. - `health` (Health): One of `HEALTH_UNSPECIFIED`, `NEW`, `ONLINE`, `OFFLINE`. Read-only. - `report` (AgentReport): What the agent last reported. Absent until it does. Read-only. - At most one of `infra`, `kubernetes` is set. - `agent_version` (string) - `protocol_version` (integer (int32)) - `runtime` (Runtime): Where the agent runs. - Exactly one of `kubernetes`, `machine` is set. - `kubernetes` (KubernetesRuntime): KubernetesRuntime is the cluster the agent's pod runs in. - `cluster_uid` (string): The kube-system namespace UID: an accident detector, not a proof. Length at most 64. - `machine` (MachineRuntime): MachineRuntime is the VM or host the agent runs on. - `machine_id` (string): The machine's own stable id (`/etc/machine-id`, the cloud instance id). Length at most 128. - `ambient_credentials` (array of AmbientCredential): Credentials every job it runs can reach, found when it started. Items at most 64. - `source` (Source): enum.defined_only = true One of `METADATA_SERVER`, `WORKLOAD_IDENTITY`, `ENVIRONMENT_VARIABLE`, `FILE`. - `location` (string): What was found: the variable's name, the file's path, the metadata server's address. Length at most 1024. - `principal` (string): Who it acts as, when the agent could tell: a service account email, a role ARN, a client id. Length at most 1024. - `reported_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. - `infra` (InfraReport): InfraReport is what an infra agent can deploy: every engine version it found installed or has fetched. - `engines` (array of InfraEngineVersion): Items at most 256. - `engine` (Engine): enum.defined_only = true One of `TERRAFORM`, `OPENTOFU`. - `version` (string): Exact, e.g. `1.10.6`. Pattern `^[0-9]+\.[0-9]+\.[0-9]+(-[0-9A-Za-z.-]+)?$`. Length at most 64. - `kubernetes` (KubernetesReport): KubernetesReport is what a Kubernetes agent can deploy against. - `kube_version` (string): Length at most 64. - `api_versions` (array of string): Items at most 2048. - `capabilities` (KubernetesCapabilities): KubernetesCapabilities is what the agent's own RBAC lets it do, as it measured. - `can_create_namespaces` (boolean) - `writable_namespaces` (array of string): Namespaces it may write. Empty when `all_namespaces` is set. - `all_namespaces` (boolean) - `can_write_cluster_scoped` (boolean) - `etag` (string): Changes whenever the agent does. Send it back on update, rename or delete to refuse the change if someone else changed the agent 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.