> For the complete documentation index, see [llms.txt](https://docs.decisionrules.io/doc/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.decisionrules.io/doc/api/jobs-api.md).

# Jobs API

The Jobs API starts and manages jobs — background runs of Integration Flows.

## Authentication

Every request needs a [**Solver API key**](/doc/api/api-keys/solver-api-keys.md) in the `Authorization` header:

```javascript
Authorization: Bearer <YOUR_SOLVER_API_KEY>
```

## Start a new job.

> Starts a new asynchronous job for a specific Integration Flow.\
> The \`identifier\` is the unique ID of the Integration Flow, and \`ruleVersion\` is its specific version.\
> This endpoint only accepts rules of type \`IntegrationFlow\`.<br>

```json
{"openapi":"3.0.0","info":{"title":"Job API","version":"1.0.0"},"servers":[{"url":"https://api.decisionrules.io/job"}],"security":[{"ApiKeyAuth":[]}],"components":{"securitySchemes":{"ApiKeyAuth":{"type":"http","scheme":"bearer","bearerFormat":"ApiKey"}},"schemas":{"JobStatus":{"type":"object","properties":{"state":{"$ref":"#/components/schemas/JobState"},"code":{"$ref":"#/components/schemas/JobStatusCode"},"message":{"type":"string","description":"A human-readable message for the status."}}},"JobState":{"type":"string","enum":["WAITING","RUNNING","COMPLETED","CANCELING","CANCELED","ERROR"]},"JobStatusCode":{"type":"string","enum":["JOB_SUCCESS","JOB_ERROR","JOB_TIMEOUT","JOB_QUOTA_EXCEEDED","JOB_EXECUTION_ERROR","JOB_VALIDATION_ERROR","JOB_USER_CANCELED","JOB_SYSTEM_CANCELED","ZOMBIE_PROCESS","JOB_INITIALIZED","JOB_RUNNING","JOB_WAITING"]}}},"paths":{"/start/{identifier}/{ruleVersion}":{"post":{"summary":"Start a new job.","description":"Starts a new asynchronous job for a specific Integration Flow.\nThe `identifier` is the unique ID of the Integration Flow, and `ruleVersion` is its specific version.\nThis endpoint only accepts rules of type `IntegrationFlow`.\n","operationId":"startJob","parameters":[{"name":"identifier","in":"path","required":true,"description":"The unique identifier of the Integration Flow.","schema":{"type":"string"}},{"name":"ruleVersion","in":"path","required":false,"description":"The specific version of the Integration Flow. If not provided, the latest published version is used.","schema":{"type":"string"}}],"requestBody":{"description":"Input data for the Integration Flow.","required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"inputData":{"type":"object","additionalProperties":true,"description":"A JSON object containing the input data for the job."},"solverVersion":{"type":"string","enum":["v1","v2"],"description":"Solver version for this job. Defaults to v1 when omitted."}}}}}},"responses":{"200":{"description":"Job started successfully.","content":{"application/json":{"schema":{"type":"object","properties":{"jobId":{"type":"string","description":"The ID of the newly created job."},"status":{"$ref":"#/components/schemas/JobStatus"}}}}},"headers":{"X-Solver-Version":{"description":"Solver version the job uses.","schema":{"type":"string","enum":["v1","v2"]}},"X-Solver-Engine":{"description":"Name of the solver engine the job uses: `aero` (v2) or `gaia` (v1).","schema":{"type":"string"}}}},"400":{"description":"Business error."},"401":{"description":"Unauthorized. Invalid or missing API key."}}}}}}
```

## Cancel a job.

> Attempts to cancel a specific job by its ID. The job must belong to the requesting space.

```json
{"openapi":"3.0.0","info":{"title":"Job API","version":"1.0.0"},"servers":[{"url":"https://api.decisionrules.io/job"}],"security":[{"ApiKeyAuth":[]}],"components":{"securitySchemes":{"ApiKeyAuth":{"type":"http","scheme":"bearer","bearerFormat":"ApiKey"}},"schemas":{"Job":{"type":"object","properties":{"jobId":{"type":"string"},"correlationId":{"type":"string"},"inputData":{"type":"object","additionalProperties":true},"output":{"type":"object","additionalProperties":true,"nullable":true},"ruleReference":{"$ref":"#/components/schemas/JobRuleReference"},"context":{"$ref":"#/components/schemas/JobContext"},"status":{"$ref":"#/components/schemas/JobStatus"},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"},"claimedAt":{"type":"string","format":"date-time"},"endedAt":{"type":"string","format":"date-time","nullable":true},"apiKey":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"}},"nullable":true},"solverVersion":{"type":"string","enum":["v1","v2"],"description":"Solver version the job runs on."}}},"JobRuleReference":{"type":"object","properties":{"baseId":{"type":"string","description":"The ID of the rule."},"version":{"type":"number","description":"The version of the rule."},"type":{"type":"string","description":"The type of the rule (e.g., IntegrationFlow)."}}},"JobContext":{"type":"object","properties":{"spaceId":{"type":"string"},"billingUserId":{"type":"string"},"executorUser":{"type":"object","nullable":true},"usedApiKeyId":{"type":"string","nullable":true}}},"JobStatus":{"type":"object","properties":{"state":{"$ref":"#/components/schemas/JobState"},"code":{"$ref":"#/components/schemas/JobStatusCode"},"message":{"type":"string","description":"A human-readable message for the status."}}},"JobState":{"type":"string","enum":["WAITING","RUNNING","COMPLETED","CANCELING","CANCELED","ERROR"]},"JobStatusCode":{"type":"string","enum":["JOB_SUCCESS","JOB_ERROR","JOB_TIMEOUT","JOB_QUOTA_EXCEEDED","JOB_EXECUTION_ERROR","JOB_VALIDATION_ERROR","JOB_USER_CANCELED","JOB_SYSTEM_CANCELED","ZOMBIE_PROCESS","JOB_INITIALIZED","JOB_RUNNING","JOB_WAITING"]}}},"paths":{"/cancel/{jobId}":{"post":{"summary":"Cancel a job.","description":"Attempts to cancel a specific job by its ID. The job must belong to the requesting space.","operationId":"cancelJob","parameters":[{"name":"jobId","in":"path","required":true,"description":"The ID of the job to cancel.","schema":{"type":"string"}}],"responses":{"200":{"description":"Job canceled successfully.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Job"}}}},"400":{"description":"Business error."},"401":{"description":"Unauthorized. Invalid or missing API key."}}}}}}
```

## Cancel all waiting jobs for a space.

> Cancels all jobs that are in a \`WAITING\` state for a specific space.

```json
{"openapi":"3.0.0","info":{"title":"Job API","version":"1.0.0"},"servers":[{"url":"https://api.decisionrules.io/job"}],"security":[{"ApiKeyAuth":[]}],"components":{"securitySchemes":{"ApiKeyAuth":{"type":"http","scheme":"bearer","bearerFormat":"ApiKey"}}},"paths":{"/cancelAll/space/{spaceId}":{"post":{"summary":"Cancel all waiting jobs for a space.","description":"Cancels all jobs that are in a `WAITING` state for a specific space.","operationId":"cancelAllWaitingJobsForSpace","parameters":[{"name":"spaceId","in":"path","required":true,"description":"The ID of the space.","schema":{"type":"string"}}],"responses":{"200":{"description":"The number of waiting jobs that were canceled.","content":{"application/json":{"schema":{"type":"object","properties":{"canceledCount":{"type":"number","description":"The total count of jobs that were canceled."}}}}}},"400":{"description":"Business error."},"401":{"description":"Unauthorized. Invalid or missing API key."}}}}}}
```

## Cancel all waiting jobs for a rule.

> Cancels all jobs that are in a \`WAITING\` state for a specific rule identifier and an optional version.

```json
{"openapi":"3.0.0","info":{"title":"Job API","version":"1.0.0"},"servers":[{"url":"https://api.decisionrules.io/job"}],"security":[{"ApiKeyAuth":[]}],"components":{"securitySchemes":{"ApiKeyAuth":{"type":"http","scheme":"bearer","bearerFormat":"ApiKey"}}},"paths":{"/cancelAll/rule/{identifier}/{ruleVersion}":{"post":{"summary":"Cancel all waiting jobs for a rule.","description":"Cancels all jobs that are in a `WAITING` state for a specific rule identifier and an optional version.","operationId":"cancelAllWaitingJobsForRule","parameters":[{"name":"identifier","in":"path","required":true,"description":"The identifier of the rule.","schema":{"type":"string"}},{"name":"ruleVersion","in":"path","required":false,"description":"The version of the rule. If not provided, jobs for all versions of the rule will be considered.","schema":{"type":"string"}}],"responses":{"200":{"description":"The number of waiting jobs that were canceled for the rule.","content":{"application/json":{"schema":{"type":"object","properties":{"canceledCount":{"type":"number","description":"The total count of jobs that were canceled."}}}}}},"400":{"description":"Bad request. Rule identifier or version is invalid."},"401":{"description":"Unauthorized. Invalid or missing API key."},"403":{"description":"Forbidden. Insufficient permissions to cancel jobs for this rule."}}}}}}
```

## Get job details.

> Retrieves detailed information about a specific job, including its status and output. The job must belong to the requesting space.

```json
{"openapi":"3.0.0","info":{"title":"Job API","version":"1.0.0"},"servers":[{"url":"https://api.decisionrules.io/job"}],"security":[{"ApiKeyAuth":[]}],"components":{"securitySchemes":{"ApiKeyAuth":{"type":"http","scheme":"bearer","bearerFormat":"ApiKey"}},"schemas":{"Job":{"type":"object","properties":{"jobId":{"type":"string"},"correlationId":{"type":"string"},"inputData":{"type":"object","additionalProperties":true},"output":{"type":"object","additionalProperties":true,"nullable":true},"ruleReference":{"$ref":"#/components/schemas/JobRuleReference"},"context":{"$ref":"#/components/schemas/JobContext"},"status":{"$ref":"#/components/schemas/JobStatus"},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"},"claimedAt":{"type":"string","format":"date-time"},"endedAt":{"type":"string","format":"date-time","nullable":true},"apiKey":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"}},"nullable":true},"solverVersion":{"type":"string","enum":["v1","v2"],"description":"Solver version the job runs on."}}},"JobRuleReference":{"type":"object","properties":{"baseId":{"type":"string","description":"The ID of the rule."},"version":{"type":"number","description":"The version of the rule."},"type":{"type":"string","description":"The type of the rule (e.g., IntegrationFlow)."}}},"JobContext":{"type":"object","properties":{"spaceId":{"type":"string"},"billingUserId":{"type":"string"},"executorUser":{"type":"object","nullable":true},"usedApiKeyId":{"type":"string","nullable":true}}},"JobStatus":{"type":"object","properties":{"state":{"$ref":"#/components/schemas/JobState"},"code":{"$ref":"#/components/schemas/JobStatusCode"},"message":{"type":"string","description":"A human-readable message for the status."}}},"JobState":{"type":"string","enum":["WAITING","RUNNING","COMPLETED","CANCELING","CANCELED","ERROR"]},"JobStatusCode":{"type":"string","enum":["JOB_SUCCESS","JOB_ERROR","JOB_TIMEOUT","JOB_QUOTA_EXCEEDED","JOB_EXECUTION_ERROR","JOB_VALIDATION_ERROR","JOB_USER_CANCELED","JOB_SYSTEM_CANCELED","ZOMBIE_PROCESS","JOB_INITIALIZED","JOB_RUNNING","JOB_WAITING"]}}},"paths":{"/{jobId}":{"get":{"summary":"Get job details.","description":"Retrieves detailed information about a specific job, including its status and output. The job must belong to the requesting space.","operationId":"getJobsDetail","parameters":[{"name":"jobId","in":"path","required":true,"description":"The ID of the job to retrieve details for.","schema":{"type":"string"}}],"responses":{"200":{"description":"Job details retrieved successfully.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Job"}}}},"400":{"description":"Business error."},"401":{"description":"Unauthorized. Invalid or missing API key."}}}}}}
```

## The JobState object

```json
{"openapi":"3.0.0","info":{"title":"Job API","version":"1.0.0"},"components":{"schemas":{"JobState":{"type":"string","enum":["WAITING","RUNNING","COMPLETED","CANCELING","CANCELED","ERROR"]}}}}
```

## The JobStatusCode object

```json
{"openapi":"3.0.0","info":{"title":"Job API","version":"1.0.0"},"components":{"schemas":{"JobStatusCode":{"type":"string","enum":["JOB_SUCCESS","JOB_ERROR","JOB_TIMEOUT","JOB_QUOTA_EXCEEDED","JOB_EXECUTION_ERROR","JOB_VALIDATION_ERROR","JOB_USER_CANCELED","JOB_SYSTEM_CANCELED","ZOMBIE_PROCESS","JOB_INITIALIZED","JOB_RUNNING","JOB_WAITING"]}}}}
```

## The JobStatus object

```json
{"openapi":"3.0.0","info":{"title":"Job API","version":"1.0.0"},"components":{"schemas":{"JobStatus":{"type":"object","properties":{"state":{"$ref":"#/components/schemas/JobState"},"code":{"$ref":"#/components/schemas/JobStatusCode"},"message":{"type":"string","description":"A human-readable message for the status."}}},"JobState":{"type":"string","enum":["WAITING","RUNNING","COMPLETED","CANCELING","CANCELED","ERROR"]},"JobStatusCode":{"type":"string","enum":["JOB_SUCCESS","JOB_ERROR","JOB_TIMEOUT","JOB_QUOTA_EXCEEDED","JOB_EXECUTION_ERROR","JOB_VALIDATION_ERROR","JOB_USER_CANCELED","JOB_SYSTEM_CANCELED","ZOMBIE_PROCESS","JOB_INITIALIZED","JOB_RUNNING","JOB_WAITING"]}}}}
```

## The JobRuleReference object

```json
{"openapi":"3.0.0","info":{"title":"Job API","version":"1.0.0"},"components":{"schemas":{"JobRuleReference":{"type":"object","properties":{"baseId":{"type":"string","description":"The ID of the rule."},"version":{"type":"number","description":"The version of the rule."},"type":{"type":"string","description":"The type of the rule (e.g., IntegrationFlow)."}}}}}}
```

## The Job object

```json
{"openapi":"3.0.0","info":{"title":"Job API","version":"1.0.0"},"components":{"schemas":{"Job":{"type":"object","properties":{"jobId":{"type":"string"},"correlationId":{"type":"string"},"inputData":{"type":"object","additionalProperties":true},"output":{"type":"object","additionalProperties":true,"nullable":true},"ruleReference":{"$ref":"#/components/schemas/JobRuleReference"},"context":{"$ref":"#/components/schemas/JobContext"},"status":{"$ref":"#/components/schemas/JobStatus"},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"},"claimedAt":{"type":"string","format":"date-time"},"endedAt":{"type":"string","format":"date-time","nullable":true},"apiKey":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"}},"nullable":true},"solverVersion":{"type":"string","enum":["v1","v2"],"description":"Solver version the job runs on."}}},"JobRuleReference":{"type":"object","properties":{"baseId":{"type":"string","description":"The ID of the rule."},"version":{"type":"number","description":"The version of the rule."},"type":{"type":"string","description":"The type of the rule (e.g., IntegrationFlow)."}}},"JobContext":{"type":"object","properties":{"spaceId":{"type":"string"},"billingUserId":{"type":"string"},"executorUser":{"type":"object","nullable":true},"usedApiKeyId":{"type":"string","nullable":true}}},"JobStatus":{"type":"object","properties":{"state":{"$ref":"#/components/schemas/JobState"},"code":{"$ref":"#/components/schemas/JobStatusCode"},"message":{"type":"string","description":"A human-readable message for the status."}}},"JobState":{"type":"string","enum":["WAITING","RUNNING","COMPLETED","CANCELING","CANCELED","ERROR"]},"JobStatusCode":{"type":"string","enum":["JOB_SUCCESS","JOB_ERROR","JOB_TIMEOUT","JOB_QUOTA_EXCEEDED","JOB_EXECUTION_ERROR","JOB_VALIDATION_ERROR","JOB_USER_CANCELED","JOB_SYSTEM_CANCELED","ZOMBIE_PROCESS","JOB_INITIALIZED","JOB_RUNNING","JOB_WAITING"]}}}}
```

## The JobContext object

```json
{"openapi":"3.0.0","info":{"title":"Job API","version":"1.0.0"},"components":{"schemas":{"JobContext":{"type":"object","properties":{"spaceId":{"type":"string"},"billingUserId":{"type":"string"},"executorUser":{"type":"object","nullable":true},"usedApiKeyId":{"type":"string","nullable":true}}}}}}
```

## **Solver version**

Each job runs on one solver version. Set it with `solverVersion` in the request body when you start the job:

```json
{
  "inputData": {
    "client": { "age": 18 }
  },
  "solverVersion": "v2"
}
```

It takes `v1` or `v2`. If you leave it out, the job runs on `v1`. For what AERO(v2) offers, see Rule[ Solver API AERO (v2](/doc/api/rule-solver-api/rule-solver-api.md)).


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.decisionrules.io/doc/api/jobs-api.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
