[role="xpack"]
[testenv="platinum"]
[[ml-put-calendar-job]]
=== Add {anomaly-jobs} to calendar API
++++
<titleabbrev>Add jobs to calendar</titleabbrev>
++++

Adds an {anomaly-job} to a calendar.

[[ml-put-calendar-job-request]]
==== {api-request-title}

`PUT _ml/calendars/<calendar_id>/jobs/<job_id>`

[[ml-put-calendar-job-prereqs]]
==== {api-prereq-title}

* If the {es} {security-features} are enabled, you must have `manage_ml` or
`manage` cluster privileges to use this API. See
{stack-ov}/security-privileges.html[Security privileges].

[[ml-put-calendar-job-path-parms]]
==== {api-path-parms-title}

`<calendar_id>`::
  (Required, string) Identifier for the calendar.

`<job_id>`::
  (Required, string) An identifier for the {anomaly-jobs}. It can be a job
  identifier, a group name, or a comma-separated list of jobs or groups.

[[ml-put-calendar-job-example]]
==== {api-examples-title}

[source,console]
--------------------------------------------------
PUT _ml/calendars/planned-outages/jobs/total-requests
--------------------------------------------------
// TEST[skip:setup:calendar_outages_openjob]

The API returns the following results:

[source,console-result]
----
{
  "calendar_id": "planned-outages",
  "job_ids": [
    "total-requests"
  ]
}
----
