---
title: "Create a JobRun"
method: POST
path: "/api/v2/jobRuns"
tags: ["JobRuns"]
---

# Create a JobRun

`POST /api/v2/jobRuns`

## Request

- Base URL: `https://secure.agco-ats.com`
- URL: `https://secure.agco-ats.com/api/v2/jobRuns`
- Auth: none declared

Creates a JobRun.  The body of the POST is the JobRun to create.  The JobRunID will be assigned on
            creation of the JobRun.  When successful, the response is the JobRunID.  If unsuccessful, an 
            appropriate ApiError is returned.

## Request body

- BuildSystemSharedDTOJobRun: A DTO for an IJobRun
  - `JobRunID` integer: The ID of this JobRun
  - `JobID` integer: The ID of the job that defines the run
  - `Parameters` BuildSystemSharedDTOParameterValue[]: The parameters used for this run of the job
    - `Name` string: The name of the parameter this value is for
    - `Value` string: The parameter value in string representation
    - `Direction` 'Input' | 'Output': The parameter direction (Input or Output)
  - `Status` 'Ready' | 'InProgress' | 'Succeeded' | 'Cancelled' | 'Failed': The status of this JobRun
  - `ActivityRuns` BuildSystemSharedDTOActivityRun[]: The activity runs belonging to this JobRun
    - `ActivityRunID` integer: The identifier for the ActivityRun
    - `JobActivityID` integer: Read Only. The ID of the Job Activity that defines this activity run
    - `JobRunID` integer: Read Only. The ID of the JobRun under which this ActivityRun is executing
    - `Parameters` BuildSystemSharedDTOParameterValue[]: The parameters used for this run of the activity. Parameters cannot be added or removed, but output parameter values may be updated.
      - `Name` string: The name of the parameter this value is for
      - `Value` string: The parameter value in string representation
      - `Direction` 'Input' | 'Output': The parameter direction (Input or Output)
    - `Status` BuildSystemSharedDTOActivityRunStatus, required: A DTO for an IActivityRunStatus
      - `Status` 'Ready' | 'InProgress' | 'Succeeded' | 'Cancelled' | 'Failed': The status of the ActivityRun
      - `CurrentStep` integer: The activity step currently executing, indicated by numeric order
      - `StepStatus` string: The status text from the currently executing step
      - `StepProgress` integer: The percent progress from the currently executing step. This value shall be null if progress is not available
    - `Steps` BuildSystemSharedDTOActivityStep[]: Read Only. The steps to be executed for the activity. These steps come from the relationship through JobActivity down to ActivityStep
      - `ActivityStepID` integer: The id of this activity step
      - `ActivityID` integer: The id of the activity this activity step belongs to
      - `StepID` integer: The id of the step
      - `RunOrder` integer: The order of this activity step relative to other activity steps
      - `UseConfig` string: Indicates the configuration for the ActivityStep to use at runtime. The build agent must provide this configuration
      - `StepName` string: The name of the step
      - `ImplementationID` string: The implementation id which is used to look up the step implementation
      - `ParameterMappings` BuildSystemSharedDTOParameterMapping[]: The mapping of values from a source to be used for the step parameters
        - `Name` string: The name of the parameter this mapping applies to
        - `SourceType` 'Constant' | 'Variable': The source type used for supplying the parameter
        - `Source` string: The source of the value. The meaning of this value is determined by the source type. When the source type is “Constant” then source is the value formatted as a string. When the source type is “Variable” then the source is the name of the variable
    - `StartDate` string, date-time: Read Only. The UTC date and time when the activity started
    - `EndDate` string, date-time: Read Only. The UTC date and time when the activity completed
  - `StartDate` string, date-time: The UTC date and time when the job started
  - `EndDate` string, date-time: The UTC date and time when the job completed

## Response `200`

OK

- integer

## Other responses

- `default`: API Error Response

---

[API](https://skmtc.dev/agco-ats/apis/agco-ats-api.md) - [All operations](https://skmtc.dev/agco-ats/apis/agco-ats-api/llms.txt) - [OpenAPI document](https://skmtc.dev/agco-ats/apis/agco-ats-api/revisions/8b416443df5c?raw)
