[role="xpack"] [[ml-post-calendar-event]] === Add Events to Calendar API ++++ Add Events to Calendar ++++ This API enables you to post scheduled events in a calendar. ==== Request `POST _xpack/ml/calendars//events` ==== Description This API accepts a list of {xpack-ref}/ml-calendars.html[scheduled events], each of which must have a start time, end time, and description. ==== Path Parameters `calendar_id` (required):: (string) Identifier for the calendar. ==== Request Body `events`:: (array) A list of one of more scheduled events. See <>. ==== Authorization You must have `manage_ml`, or `manage` cluster privileges to use this API. For more information, see {xpack-ref}/security-privileges.html[Security Privileges]. ==== Examples You can add scheduled events to the `planned-outages` calendar as follows: [source,js] -------------------------------------------------- POST _xpack/ml/calendars/planned-outages/events { "events" : [ {"description": "event 1", "start_time": 1513641600000, "end_time": 1513728000000}, {"description": "event 2", "start_time": 1513814400000, "end_time": 1513900800000}, {"description": "event 3", "start_time": 1514160000000, "end_time": 1514246400000} ] } -------------------------------------------------- // CONSOLE // TEST[setup:calendar_outages_addjob] The API returns the following results: [source,js] ---- { "events": [ { "description": "event 1", "start_time": 1513641600000, "end_time": 1513728000000, "calendar_id": "planned-outages" }, { "description": "event 2", "start_time": 1513814400000, "end_time": 1513900800000, "calendar_id": "planned-outages" }, { "description": "event 3", "start_time": 1514160000000, "end_time": 1514246400000, "calendar_id": "planned-outages" } ] } ---- //TESTRESPONSE For more information about these properties, see <>.