--- title: "List jobs" canonical: "https://admiral.io/docs/api/agents/JobAPI_ListJobs2" --- # List jobs `GET https://api.admiral.io/v1/agents/{agent}/jobs` Scope: `agent:read` ### Path parameters - `agent` (string, required): The agent id. ### Query parameters - `page_size` (integer (int32)): The page_size query parameter. Value 0 to 100. - `page_token` (string): The page_token query parameter. - `filter` (string): An AIP-160 filter expression. Filterable fields are `status`, `kind`, `agent_id` and `environment_id`. Example: `status = QUEUED AND agent_id = "agt-01jb2f9h6t0c"` `id` is filterable too: `id = "a" OR id = "b"` reads up to 100 of them by id in one call. Length at most 4096. - `order_by` (string): Fields to order by, in AIP-132 syntax such as `created_at desc`. Accepted fields: `created_at`. Left empty, the list keeps the order stated above. An unknown field is INVALID_ARGUMENT. Length at most 256. ### Response 200 Success - `jobs` (array of Job) - `id` (string): `job-` and twelve base36 characters. Never changes and is never reused. Pattern `^job-[0-9a-z]+$`. Read-only. - `resource_name` (string): (IDENTIFIER) The job's resource name: under its run for a plan or apply, `projects/{project}/environments/{environment}/runs/{run}/jobs/{job}`, and under its agent for a probe, `agents/{agent}/jobs/{job}`. The job segment is its `id`. Pattern `^(projects/[a-z]([a-z0-9-]{0,61}[a-z0-9])?/environments/[a-z]([a-z0-9-]{0,61}[a-z0-9])?/runs/run-[0-9a-z]+|agents/[a-z]([a-z0-9-]{0,61}[a-z0-9])?)/jobs/job-[0-9a-z]+$`. - `environment_id` (string): The environment the job deploys to. Pattern `^env-[0-9a-z]+$`. Read-only. - `run_id` (string): The run this job plans or applies; empty for a PROBE. Pattern `^run-[0-9a-z]+$`. Read-only. - `agent_id` (string): The agent that runs it. Pattern `^agt-[0-9a-z]+$`. Read-only. - `kind` (JobKind): One of `JOB_KIND_UNSPECIFIED`, `PROBE`, `PLAN`, `APPLY`. - `artifact_digest` (string): `sha256:` of the artifact the job runs. - `components` (array of string): The components it covers. - `deferred_components` (array of string): On an APPLY, the components the reviewed plan deferred: each waits on an output another component in the job produces. The agent plans each one after what it waits on has applied, and applies that plan. Items at most 256. - `assignment_id` (string): The environment assignment it runs on. Pattern `^asg-[0-9a-z]+$`. Read-only. - `status` (JobStatus): One of `JOB_STATUS_UNSPECIFIED`, `QUEUED`, `OFFERED`, `RUNNING`, `SUCCEEDED`, `FAILED`, `CANCELLED`. - `wait_reason` (WaitReason): Set while QUEUED. One of `WAIT_REASON_UNSPECIFIED`, `NO_AGENT_ASSIGNED`, `AGENT_NOT_GRANTED`, `AGENT_OFFLINE`, `AGENT_AT_CAPACITY`, `AGENT_TOO_OLD`, `ENVIRONMENT_BUSY`, `BACKOFF`, `AGENT_NOT_ENROLLED`, `COMPONENT_NOT_ALLOWED`, `ENGINE_MISSING`. - `attempt` (integer (int32)) - `result` (JobResult) - `status` (JobStatus): SUCCEEDED, FAILED or CANCELLED. One of `SUCCEEDED`, `FAILED`, `CANCELLED`. - `status_reason` (string): Why the job failed or was cancelled. - `steps` (array of Step) - `component` (string) - `status` (JobStatus): enum.defined_only = true One of `JOB_STATUS_UNSPECIFIED`, `QUEUED`, `OFFERED`, `RUNNING`, `SUCCEEDED`, `FAILED`, `CANCELLED`. - `status_reason` (string): Why the step failed. - `failure` (Failure): Set only when status is FAILED. Only the Kubernetes agent sets UNHEALTHY. enum.defined_only = true One of `FAILURE_UNSPECIFIED`, `APPLY`, `UNHEALTHY`. - `plan` (PlanResult): Set by a PLAN. Set by an APPLY for the components it planned itself, the ones the reviewed plan deferred. - `components` (array of ComponentPlan): Items at most 256. - `component` (string): Length at most 63. - `changes` (array of ResourceChange): Items at most 5000. - `resource` (ResourceRef): ResourceRef names one thing a component manages. - `action` (Action): enum.defined_only = true One of `NO_OP`, `CREATE`, `UPDATE`, `REPLACE`, `DESTROY`, `ORPHAN`, `TAKE_OVER`. - `diff_digest` (string): `sha256:` of what the apply changes in this Kubernetes object: the action and each changed path with its before and after value, so a field the apply does not touch, such as replicas an autoscaler moved, leaves it unchanged. Empty for a Terraform resource, whose saved plan file pins what the apply changes, and for NO_OP. Length at most 71. - `plan_file_digest` (string): `sha256:` of a Terraform component's saved plan file. The apply refuses a file that does not match. Length at most 71. - `deferred` (DeferredPlan): Set when the component could not be planned yet: an input of its references an output another component in the same run only knows once it applies. `changes` and `plan_file_digest` are then empty. The apply plans it after what it waits on has applied, under the run's approval, and applies that plan. - `pending_inputs` (array of PendingInput): Items 1 to 1000. - `diff_digest` (string): `sha256:` of the PlanDiff uploaded for this attempt. Length at most 71. - `inventories` (array of ComponentInventory): Set by an APPLY: what each component it reached left behind, including one that failed partway. - `component` (string) - `resources` (array of ResourceRef) - Exactly one of `kubernetes`, `terraform` is set. - `kubernetes` (KubernetesResourceRef): KubernetesResourceRef names one Kubernetes object. - `api_version` (string): Length at most 253. - `kind` (string): Length at most 63. - `namespace` (string): Empty for a cluster-scoped object. Length at most 63. - `name` (string): Length at most 253. - `terraform` (TerraformResourceRef): TerraformResourceRef names one Terraform resource instance. - `address` (string): The full address, module path and index included: `module.net.aws_subnet.private["a"]`. Length at most 1024. - `type` (string): Length at most 128. - `provider` (string): The provider's source address: `registry.opentofu.org/hashicorp/aws`. Length at most 256. - `outputs` (array of ComponentOutputs): Set by a successful APPLY: each component's outputs. They replace the component's stored outputs; a failed apply keeps the old ones. Never returned on a job read: read them on the environment's component. Items at most 256. - `component` (string): Length at most 63. - `outputs` (array of ComponentOutput): Items at most 1000. - `name` (string): Length at most 256. - `value` (Value): Any JSON value: `null`, number, string, boolean, array, or object. - `sensitive` (boolean) - `hooks` (array of HookRun): Each hook the agent's operator configured that ran, in order. A failing hook fails the job. Items at most 256. - `name` (string): The hook's name in the agent's config. Length at most 63. - `phase` (Phase): enum.defined_only = true One of `PRE_INIT`, `POST_PLAN`, `POST_APPLY`. - `component` (string): The component it ran for. Length at most 63. - `passed` (boolean) - `exit_code` (integer (int32)) - `summary` (string): Length at most 4096. - `findings` (array of HookFinding): What the hook wrote to `$ADMIRAL_HOOK_REPORT`. Items at most 1000. - `message` (string): Length at most 4096. - `location` (string): Where it found it: a file and line, a resource address. Length at most 1024. - `log_offset` (string (int64)): Where its output starts in the job's log. Value at least 0. - `started_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. - `finished_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. - `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. - `next_page_token` (string)