---
title: "run_job"
description: "Generated reference for the management action run_job: its description, access metadata, payload contract, and registration status."
slug: /reference/actions/run-job
order: 75
visibility: public
redirects_from: []
---

# run\_job

Generated automatically from the [published contract sources](/cloud/reference/about/#contract-sources).

A script calls this action over HTTPS at `POST https://tzcloud.dev.turnzero.ai/v1/run_job`, with a bearer credential and the action's payload as the JSON body. An MCP connection lists this action as the tool `tzcloud_run_job`.

OAuth access tokens and minted tokens, including the turnzero command's computer token, are bearer credentials. The action determines which kinds, scopes and grants it accepts ([Sign-in, sessions, and tokens](/cloud/concepts/sign-in-sessions-and-tokens/)).

**Build metadata:** Registered in this build. Registration describes the default dispatcher in this build. It does not guarantee that a caller has the required credential or grant, that a tool is listed for that connection, or that the required service is configured.

## Contract description

Start a declared job\. Use a job declared by the version serving the selected environment\. When jobs are off on this estate, Turn Zero refuses new manifest submissions that declare jobs\. Ask the account owner before starting a production run unless they already asked for it\. The response includes the run ID and current state\. Use its `next` call to read the run\. If you retry the start, use the same application, job, environment, and `request_id`\.

## More about this action

A job runs a script in its own container\. A schedule calls a handler at set times\. A new run may already be running, may be waiting to start, or may have failed to start\. If a deploy or promote is still setting up the job for the serving version, the run can stay `starting` while Cloud tries to assign it again\. Cloud marks a run still unassigned as `failed` with reason `not_claimed` when it checks at least 90 seconds after the request\. When a retry returns an existing run, the response includes `repeated: true`\.

If the environment has no serving version, deploy first\. On a two\-environment application, promote to serve a version on production\. If the environment is halted, use `halt_environment` with `resume: true` before trying again\. A paused or suspended account cannot start a run\. If you get `database_move_in_flight` or `cell_move_in_flight`, wait for the move to finish, then retry with the same `request_id`\.

For `no_such_job`, check the job name and the manifest of the version serving the selected environment\. To add the job, submit the manifest with its `job` entry and deploy\. On an app with two environments, promote that version before starting the job on production\. `jobs_not_available` comes from submitting a manifest that declares jobs on an estate where they are off\.

An account can have three unfinished runs at once\. If the account is at its limit, wait for a run to end or cancel one\. If the hosting cell is at capacity, wait a minute and retry with the same `request_id`\.

## Access and action metadata

```json
{
  "name": "run_job",
  "resource": "application",
  "tier": "reversible",
  "surface": "tzcloud",
  "addresses": [
    "tzcloud"
  ],
  "product": "cloud",
  "summary": "Start a job that the version serving the chosen environment declares. The response includes the run ID and its current state. Use the `read_job_runs` call in `next` to follow the run. To retry a start, send the same `request_id`. If the retry passes the start checks, it returns the original run.",
  "annotations": {
    "readOnlyHint": false,
    "destructiveHint": true,
    "openWorldHint": true
  }
}
```

## MCP catalog entry

```json
{
  "name": "run_job",
  "title": "Run a job",
  "tier": "reversible",
  "scenario": "CHI-L0-09",
  "summary": "Start a declared job. Use a job declared by the version serving the selected environment. When jobs are off on this estate, Turn Zero refuses new manifest submissions that declare jobs. Ask the account owner before starting a production run unless they already asked for it. The response includes the run ID and current state. Use its `next` call to read the run. If you retry the start, use the same application, job, environment, and `request_id`.",
  "owners": [
    "JOB-L0-04",
    "JOB-L0-08",
    "MAPI-04"
  ]
}
```

## request

| JSON pointer | Description and constraints |
|---|---|
| "" \(root\) | Type: object<br>Required fields: \["application","job"\] |
| /<wbr>properties/<wbr>application | The application ID from `list_applications`\.<br><br>Type: string |
| /<wbr>properties/<wbr>job | The name of a job declared by the version serving the chosen environment\.<br><br>Type: string |
| /<wbr>properties/<wbr>environment | Choose `development` or `production`\. The default is `production`\. If the application has no development environment, the request returns `environment_not_created`\.<br><br>Type: string |
| /<wbr>properties/<wbr>request\_id | An ID for this start, 1 to 255 UTF\-16 code units\. Many emoji count as two\. Reuse the same ID to retry this start in the same application and environment\.<br><br>Type: string |

## response

| JSON pointer | Description and constraints |
|---|---|
| "" \(root\) | Type: object<br>Required fields: \["contract\_version","run","detail","next"\] |
| /<wbr>properties/<wbr>contract\_version | Required value: 1 |
| /<wbr>properties/<wbr>reference | The ten\-character call reference\. Include it if you report a problem\.<br><br>Type: string<br>Pattern: ^\[0\-9a\-f\]\{10\}$ |
| /<wbr>properties/<wbr>run | $ref: \#/shapes/job\_run |
| /<wbr>properties/<wbr>repeated | Present when this `request_id` returns an existing run\.<br><br>Required value: true |
| /<wbr>properties/<wbr>detail | A short explanation of the result\.<br><br>Type: string |
| /<wbr>properties/<wbr>next | The `read_job_runs` call to check this run\.<br><br>Type: object<br>Required fields: \["action","arguments"\]<br>Additional properties: false |
| /<wbr>properties/<wbr>next/<wbr>properties/<wbr>action | Required value: read\_job\_runs |
| /<wbr>properties/<wbr>next/<wbr>properties/<wbr>arguments | Type: object<br>Required fields: \["application","run"\]<br>Additional properties: false |
| /<wbr>properties/<wbr>next/<wbr>properties/<wbr>arguments/<wbr>properties/<wbr>application | Type: string |
| /<wbr>properties/<wbr>next/<wbr>properties/<wbr>arguments/<wbr>properties/<wbr>run | Type: string |

## Complete payload contract

```json
{
  "request": {
    "type": "object",
    "required": [
      "application",
      "job"
    ],
    "properties": {
      "application": {
        "type": "string",
        "description": "The application ID from `list_applications`."
      },
      "job": {
        "type": "string",
        "description": "The name of a job declared by the version serving the chosen environment."
      },
      "environment": {
        "type": "string",
        "description": "Choose `development` or `production`. The default is `production`. If the application has no development environment, the request returns `environment_not_created`."
      },
      "request_id": {
        "type": "string",
        "description": "An ID for this start, 1 to 255 UTF-16 code units. Many emoji count as two. Reuse the same ID to retry this start in the same application and environment."
      }
    }
  },
  "response": {
    "type": "object",
    "required": [
      "contract_version",
      "run",
      "detail",
      "next"
    ],
    "properties": {
      "contract_version": {
        "const": 1
      },
      "reference": {
        "type": "string",
        "pattern": "^[0-9a-f]{10}$",
        "description": "The ten-character call reference. Include it if you report a problem."
      },
      "run": {
        "$ref": "#/shapes/job_run"
      },
      "repeated": {
        "const": true,
        "description": "Present when this `request_id` returns an existing run."
      },
      "detail": {
        "type": "string",
        "description": "A short explanation of the result."
      },
      "next": {
        "type": "object",
        "required": [
          "action",
          "arguments"
        ],
        "properties": {
          "action": {
            "const": "read_job_runs"
          },
          "arguments": {
            "type": "object",
            "required": [
              "application",
              "run"
            ],
            "properties": {
              "application": {
                "type": "string"
              },
              "run": {
                "type": "string"
              }
            },
            "additionalProperties": false
          }
        },
        "additionalProperties": false,
        "description": "The `read_job_runs` call to check this run."
      }
    }
  }
}
```

## Shared contracts

- [Refusals](/cloud/reference/refusals/): every refusal, by surface, with its cause and its remedy
- [schemas/wire\_error\.schema\.json](/cloud/reference/sources/schemas/wire-error-schema/)
- [schemas/wire\_errors\.json](/cloud/reference/sources/schemas/wire-errors/)
- [schemas/action\_payloads\.json](/cloud/reference/sources/schemas/action-payloads/) (includes shared shapes)
- [management\_api\_contract\.md](/cloud/reference/sources/management-api-contract/)
