|  | 
|  | 1 | +--- | 
|  | 2 | +layout: default | 
|  | 3 | +title: Jobs API | 
|  | 4 | +parent: Job Scheduler | 
|  | 5 | +nav_order: 10 | 
|  | 6 | +redirect_from: | 
|  | 7 | +    - /monitoring-plugins/job-scheduler/api/ | 
|  | 8 | +--- | 
|  | 9 | + | 
|  | 10 | +# Job Scheduler Jobs API  | 
|  | 11 | +Introduced 3.2 | 
|  | 12 | +{: .label .label-purple } | 
|  | 13 | + | 
|  | 14 | +The Jobs API allows you to view all Job Scheduler jobs. | 
|  | 15 | + | 
|  | 16 | +## Endpoints | 
|  | 17 | + | 
|  | 18 | +```json | 
|  | 19 | +GET /_plugins/_job_scheduler/api/jobs | 
|  | 20 | +``` | 
|  | 21 | + | 
|  | 22 | +## Query parameters | 
|  | 23 | + | 
|  | 24 | +The following table lists the available query parameters. All query parameters are optional. | 
|  | 25 | + | 
|  | 26 | +| Parameter |  Data type | Description | | 
|  | 27 | +| :--- | :--- | :--- | | 
|  | 28 | +| `by_node` | Boolean | Returns the jobs grouped by the node on which they are running. Default is `false`. | | 
|  | 29 | + | 
|  | 30 | +## Example request | 
|  | 31 | + | 
|  | 32 | +```json | 
|  | 33 | +GET /_plugins/_job_scheduler/api/jobs | 
|  | 34 | +``` | 
|  | 35 | +{% include copy-curl.html %} | 
|  | 36 | + | 
|  | 37 | +## Example response | 
|  | 38 | + | 
|  | 39 | +```json | 
|  | 40 | +{ | 
|  | 41 | +  "jobs": [ | 
|  | 42 | +    { | 
|  | 43 | +      "job_type": "reports-scheduler", | 
|  | 44 | +      "job_id": "Cuu8Z5gBTcOdmakPQ51t", | 
|  | 45 | +      "index_name": ".opendistro-reports-definitions", | 
|  | 46 | +      "name": "index_report", | 
|  | 47 | +      "descheduled": false, | 
|  | 48 | +      "enabled": true, | 
|  | 49 | +      "enabled_time": "2025-08-01T22:24:08.044Z", | 
|  | 50 | +      "last_update_time": "2025-08-01T22:24:08.044Z", | 
|  | 51 | +      "last_execution_time": "none", | 
|  | 52 | +      "last_expected_execution_time": "none", | 
|  | 53 | +      "next_expected_execution_time": "2025-08-04T02:15:00.000Z", | 
|  | 54 | +      "schedule": { | 
|  | 55 | +        "type": "cron", | 
|  | 56 | +        "expression": "15 2 1,15 * 1", | 
|  | 57 | +        "timezone": "Africa/Abidjan", | 
|  | 58 | +        "delay": "none" | 
|  | 59 | +      }, | 
|  | 60 | +      "lock_duration": "no_lock", | 
|  | 61 | +      "jitter": "none" | 
|  | 62 | +    }, | 
|  | 63 | +    { | 
|  | 64 | +      "job_type": "scheduler_sample_extension", | 
|  | 65 | +      "job_id": "jobid1", | 
|  | 66 | +      "index_name": ".scheduler_sample_extension", | 
|  | 67 | +      "name": "sample-job-it", | 
|  | 68 | +      "descheduled": false, | 
|  | 69 | +      "enabled": true, | 
|  | 70 | +      "enabled_time": "1970-07-23T00:27:45.353Z", | 
|  | 71 | +      "last_update_time": "1970-07-23T00:27:45.353Z", | 
|  | 72 | +      "last_execution_time": "2025-08-01T22:28:45.357484385Z", | 
|  | 73 | +      "last_expected_execution_time": "2025-08-01T22:28:45.353111804Z", | 
|  | 74 | +      "next_expected_execution_time": "2025-08-01T22:29:45.353111804Z", | 
|  | 75 | +      "schedule": { | 
|  | 76 | +        "type": "interval", | 
|  | 77 | +        "start_time": "1970-07-23T00:27:45.353Z", | 
|  | 78 | +        "interval": 1, | 
|  | 79 | +        "unit": "Minutes", | 
|  | 80 | +        "delay": "none" | 
|  | 81 | +      }, | 
|  | 82 | +      "lock_duration": 10, | 
|  | 83 | +      "jitter": "none" | 
|  | 84 | +    } | 
|  | 85 | +  ], | 
|  | 86 | +  "failures": [], | 
|  | 87 | +  "total_jobs": 2 | 
|  | 88 | +} | 
|  | 89 | +``` | 
|  | 90 | + | 
|  | 91 | +## Response body fields | 
|  | 92 | + | 
|  | 93 | +The following table lists all response body fields. | 
|  | 94 | + | 
|  | 95 | +| Field | Data type | Description | | 
|  | 96 | +| :--- | :--- | :--- | | 
|  | 97 | +| `jobs` | Array | Contains all jobs reported by the Job Scheduler. | | 
|  | 98 | +| `job_type` | String | The plugin that scheduled the job. | | 
|  | 99 | +| `job_id` | String | The unique identifier of the job. | | 
|  | 100 | +| `index_name` | String | The index in which the job information is stored. | | 
|  | 101 | +| `name` | String | The job name. The name is not necessarily unique. | | 
|  | 102 | +| `descheduled` | Boolean | Indicates whether the job is scheduled to be executed (`false`) or is not scheduled (`true`) by the Job Scheduler. | | 
|  | 103 | +| `enabled` | Boolean | Indicates whether the job is active (`true`) or inactive (`false`), as defined by the plugin using the Job Scheduler. | | 
|  | 104 | +| `enabled_time` | String | The time at which the job was originally scheduled. | | 
|  | 105 | +| `last_update_time` | String | The time at which the job was last updated. | | 
|  | 106 | +| `last_expected_exection_time` | String | The time at which the job was most recently executed. | | 
|  | 107 | +| `next_expected_execution_time` | String | The time at which the job is expected to be executed next. | | 
|  | 108 | +| `schedule` | Map | The job's execution schedule. Can define a [Cron](#cron-schedule) or [interval](#interval-schedule) schedule. | | 
|  | 109 | +| `schedule.type` | String | The schedule type. Valid values are `cron` and `interval`. | | 
|  | 110 | +| `lock_duration` | Integer | The maximum amount of time (in seconds) that a job can remain locked during execution.| | 
|  | 111 | +| `jitter` | Double | A random delay applied to job execution times to prevent simultaneous runs across the system.| | 
|  | 112 | +| `failures` | Array | A list of nodes that failed to report jobs. | | 
|  | 113 | +| `total_jobs` | Integer | The total number of jobs reported across all nodes. | | 
|  | 114 | + | 
|  | 115 | +### Interval schedule | 
|  | 116 | + | 
|  | 117 | +The `interval` schedule supports the following fields. | 
|  | 118 | + | 
|  | 119 | +| Field | Data type | Description | | 
|  | 120 | +| :--- | :--- | :--- | | 
|  | 121 | +| `start_time` | String | The schedule start time.  | | 
|  | 122 | +| `interval` | Integer | The numeric interval duration between job executions (for example, `10`). | | 
|  | 123 | +| `unit` | String | The interval units (for example, `Minutes`, `Hours`, or `Days`). | | 
|  | 124 | +| `delay` | String | A fixed amount of time applied to the job before execution. | | 
|  | 125 | + | 
|  | 126 | +### Cron schedule | 
|  | 127 | + | 
|  | 128 | +The `cron` schedule supports the following fields. | 
|  | 129 | + | 
|  | 130 | +| Field | Data type | Description | | 
|  | 131 | +| :--- | :--- | :--- | | 
|  | 132 | +| `expression` | String | A Cron expression defining the schedule. | | 
|  | 133 | +| `timezone` | String | The time zone associated with the Cron schedule. | | 
0 commit comments