# Schedule a stream with the Wowza Video REST API Learn how to use the Wowza Video REST API to schedule a stream in the Wowza Video™ service to start and stop once, or on a repeating schedule. ## Before you start You should complete the following tasks: - Create a **live stream** or a **transcoder**. You'll need the resulting `live_stream_id` or `transcoder_id` to schedule a broadcast. View our [Connect a source](/docs/wowza-video/guides/video-source/encoder-camera/connect-an-ip-camera) topics to learn how to create a live stream or transcoder for RTMP, RTSP, IP camera, SRT encoder, UDP encoder, WebRTC, and Wowza Streaming Engine. See Decide between a live stream or transcoder workflow for more information about these workflows. ## Create a schedule Create a schedule to start and stop the live stream or transcoder. When specifying the start time, allow a few minutes for Wowza Video to launch the stream or transcoder. If your event begins at 9:00, for example, set the start time for 8:55. The minimum run time for a scheduled live stream or transcoder is 5 minutes, but we recommend scheduling at least 10 minutes between start and stop. You can use the following sample request, making sure to: - Set `action_type` to `start_stop`. You can also use the action types `start` or `stop` if you only want to set either a start or stop time. - Set `recurrence_type` to `once`. - Set `start_transcoder` to the time and date you would like your transcoder to start. The example below starts the transcoder at 1PM UTC (13:00) on February 10, 2022. - Set `stop_transcoder` to the time and date you would like your transcoder to stop. The example below stops the transcoder at 3PM UTC (16:00) on February 10, 2022. - Set `transcoder_id` to the id that identifies the transcoder or live stream being scheduled. - Change any values unique to your broadcast, using the API reference documentation as a resource. See the **Endpoint Reference** button below. #### Sample request Endpoint Reference ``` curl -X POST \ -H "Content-Type: application/json" \ -H "Authorization: Bearer ${WV_JWT}" \ -d '{ "schedule": { "action_type": "start_stop", "name": "ThreeHourTour", "recurrence_type": "once", "start_transcoder": "2022-02-10 13:00:00", "stop_transcoder": "2022-02-10 16:00:00", "transcoder_id": "1234abcd" } }' "${WV_HOST}/api/${WV_VERSION}/schedules" ``` #### Sample response The response includes: - An `id` for the schedule that you can use to make changes. ``` { "schedule": { "id": "5678efgh", "state": "enabled", "name": "StartOneTimeSchedule", "transcoder_id": "1234abcd", "transcoder_name": "MyTranscoder", "recurrence_type": "once", "action_type": "start_stop", "start_transcoder": "2022-02-10T13:00:00.000Z", "stop_transcoder": "2022-02-10T16:00:00.000Z", "created_at": "2021-11-25T11:53:28.508", "updated_at": "2021-11-25T11:53:28.508" } } ``` ## Reoccurring schedules ### Schedule to start a transcoder on Tuesdays and Thursdays for two weeks The following request generates schedule that starts transcoder **1234abcd** at 1pm UTC (13:00) every Tuesday and Thursday for the first two weeks of January 2016. You can use the following sample request, making sure to: - Set `action_type` to `start`. - Set `end_repeat` to the date the recurring schedule should stop running. - Set `recurrence_data` to the day(s) of the week the recurring schedule should run. Separate each day with a comma**.** - Set `recurrence_type` to `recur`. - Set `start_repeat` to the date the recurring schedule should start running. - Set `start_transcoder` to the time and date you would like your transcoder to start. The example below starts the transcoder at 1PM UTC (13:00) on February 10, 2016. - Set `transcoder_id` to the id that identifies the transcoder or live stream being scheduled. - Change any values unique to your broadcast, using the API reference documentation as a resource. See the **Endpoint Reference** button below. #### Sample request Endpoint Reference ``` curl -X POST \ -H "Content-Type: application/json" \ -H "Authorization: Bearer ${WV_JWT}" \ -d '{ "schedule": { "action_type": "start", "end_repeat": "2016-01-14", "name": "tuesday-thursday", "recurrence_data": "tuesday,thursday", "recurrence_type": "recur", "start_repeat": "2016-01-01", "start_transcoder": "2016-01-05 13:00:00", "transcoder_id": "1234abcd" } }' "${WV_HOST}/api/${WV_VERSION}/schedules" ``` ### Schedule to stop a transcoder every day for a week The following request generates schedule that stops transcoder **1234abcd** at 2pm UTC (14:00) every day for seven days starting on February 10, 2016. You can use the following sample request, making sure to: - Set `action_type` to `stop`. - Set `end_repeat` to the date the recurring schedule should stop running. - Set `recurrence_data` to the day(s) of the week the recurring schedule should run. Separate each day with a comma. - Set `recurrence_type` to `recur`. - Set `start_repeat` to the date the recurring schedule should start running. - Set `stop_transcoder` to the time and date you would like your transcoder to stop. - Set `transcoder_id` to the id that identifies the transcoder or live stream being scheduled. - Change any values unique to your broadcast, using the API reference documentation as a resource. See the **Endpoint Reference** button below. #### Sample request Endpoint Reference ``` curl -X POST \ -H "Content-Type: application/json" \ -H "Authorization: Bearer ${WV_JWT}" \ -d '{ "schedule": { "action_type": "stop", "end_repeat": "2016-02-17", "name": "OneWeekInFeb", "recurrence_data": "wednesday,thursday,friday,saturday,sunday,monday,tuesday", "recurrence_type": "recur", "start_repeat": "2016-02-10", "stop_transcoder": "2016-02-10 14:00:00", "transcoder_id": "1234abcd" } }' "${WV_HOST}/api/${WV_VERSION}/schedules" ``` ## Enable or disable a schedule By default, the state of every new schedule is `enabled`, which means the schedule will run automatically at the date and time specified. You can, however, disable and enable any schedule at any time. Disable a schedule: Endpoint Reference ``` curl -X PUT \ -H "Authorization: Bearer ${WV_JWT}" \ "${WV_HOST}/api/${WV_VERSION}/schedules/[schedule_id]/disable" ``` Enable a schedule: Endpoint Reference ``` curl -X PUT \ -H "Authorization: Bearer ${WV_JWT}" \ "${WV_HOST}/api/${WV_VERSION}/schedules/[schedule_id]/enable" ``` ## Related API requests - GET/schedules/ID/state — View a schedule's state. - GET/schedules/ID — View the details of a schedule. - PATCH/schedules/ID — Update a schedule's configuration. - DELETE/schedules/ID — Delete a schedule.