# How to start live streaming in Wowza Video using the REST API **Applies to: Wowza Video REST API v2.0 and later** This quick-start tutorial shows developers how to use the Wowza Video 2.0 REST API to create a Web Real-Time Communication (WebRTC) live stream, connect a video source, and deliver it to a Wowza-hosted player page in a few API calls. You'll also learn how to programmatically start and stop the stream so you can integrate the full workflow into a code-based solution. Info This tutorial applies to Wowza Video REST API v2.0 and later only. ## Prerequisites: Wowza Video account and REST API client This tutorial requires: - A JSON Web Token (JWT) for a Wowza Video account. If you don't have an account, see Wowza Video free trial for sign-up instructions and trial limitations. - cURL, Postman, or another REST API client. For installation and usage instructions, refer to the documentation for whichever client you choose. Tips for working through this tutorial: - **Sample code**: This tutorial uses environment variables for your JWT in the cURL examples so you can copy, paste, and run commands in your terminal without manually replacing values. After you get your JWT in step 1, set the environment variable on your computer. See [How to set environment variables for Wowza Video API testing](/docs/wowza-video/about-the-rest-api/api-overview#tools-for-testing-the-api) for instructions. If you skip this, you'll need to manually enter the correct value in each code sample. - **API reference**: Each step links to the relevant endpoint reference so you can explore all available parameters for that request. ## 1. Get a JSON Web Token (JWT) for the Wowza Video REST API You'll use an access token, also called a JSON Web Token (JWT), to authenticate each API request. The token identifies both the Wowza Video account and the specific user making the call. There are two types of access tokens: - **Personal access tokens**: Available to all users with a Wowza Video license. These tokens are tied to a specific user and work well for quick tests or manual actions that don't need to persist if the user leaves the organization. - **System access tokens**: Available to organization owners only. These tokens belong to the organization rather than to any individual user, which makes them the right choice for production integrations that need to remain active after specific users leave. Generate the token in the Wowza Video user interface. 1. In the left navigation, click your user name and choose **Token Management**. ![Video Account Settings Updated](/assets/video-account-settings-updated.d94df2a8ad69f2583959e88898d25d2ab2bacb8dd445c51d00f08515212d1b68.71a4f21c.png) 2. In the Token Management portal, add a new token. Choose a personal access token or, if you're an organization owner, a system token. If you're an organization member who needs a system-level token, contact your organization owner. Copy the token and store it in a safe location. You won't be able to view it again after leaving this page. ![Token Management Personal System](/assets/token-management-personal-system.942cc46e82ed7e3bd0c407ce013ca684a67024866163b12e108531bd7e47ba05.71a4f21c.png) For a full explanation of token types and scopes, see [Wowza Video REST API authentication (JWT, personal tokens, and system tokens)](/docs/wowza-video/about-the-rest-api/authentication). ## 2. Create a live stream with POST /live_streams The quickest path to your first broadcast is a *live stream*. In Wowza Video, a live stream automatically handles the configuration and processing required to deliver your content to a global audience. A single API call to `POST /live_streams`: - Specifies how the video source connects to Wowza Video - Generates a Wowza-hosted webpage to send your viewers to - Assigns a player configuration for styling and branding To create a live stream that receives a WebRTC source, send the following request. For this tutorial, use the sample code as shown with these changes: - Replace `${WV_JWT}` with your JWT from step 1. If you set the environment variable as described in the prerequisites, no changes are needed. - (Optional) By default, the live stream uses your account's default player configuration. To use a branded player, create a player configuration in the Wowza Video UI under **Players > Configurations**, then pass its ID (for example, `affaa6b7-aeb0-4961-92a0-5319423867fd`) in the `player_id` field. This tutorial uses the default player, so `player_id` is omitted. **cURL request: POST /live_streams (API v2.0)** Endpoint Reference ```json curl -X POST \ -H "Content-Type: application/json" \ -H "Authorization: Bearer ${WV_JWT}" \ -d '{ "live_stream": { "broadcast_location": "us_west_california", "delivery_method": "push", "encoder": "other_webrtc", "name": "My Live Stream" } }' "${WV_HOST}/api/${WV_VERSION}/live_streams" ``` **JSON response: POST /live_streams** The response includes: - An `id` that identifies the live stream. You'll use this value in later steps. - A `source_connection_information` object to configure the WebRTC publish page as the video source. You'll complete this in step 3. - Additional details about the live stream configuration. ```json { "live_stream": { "id": "1234abcd", "name": "MyWebRTCStream", ... "encoder": "other_webrtc", ... "source_connection_information": { "sdp_url": "wss://[subdomain].entrypoint.video.wowza.com/webrtc-session.json", "application_name": "app-30zl5349", "stream_name": "32a5814b" } ... } } ``` ## 3. Configure a WebRTC video source using source_connection_information Use the `source_connection_information` values from the `POST /live_streams` response to configure the WebRTC publish page as your video source. WebRTC lets you capture video directly from your browser without installing plugins or third-party software. 1. In a new browser tab, go to wowza.com/webrtc/publish. Grant access to your camera and microphone when prompted. The WebRTC hosted publish page is supported on the latest versions of Chrome and Safari, and on Edge version 79 and later. 2. Click **Settings** in the upper-right corner of the page. 3. Using the `source_connection_information` from the step 2 response, enter the following values: **JSON: source_connection_information from the POST /live_streams response (API v2.0)** ```json "source_connection_information": { "sdp_url": "wss://[subdomain].entrypoint.video.wowza.com/webrtc-session.json", "application_name": "app-30zl5349", "stream_name": "32a5814b" } ``` - Enter the `sdp_url` value in the **SDP URL** field. - Enter the `application_name` value in the **Application Name** field. - Enter the `stream_name` value in the **Stream Name** field. - Leave **Audio Bitrate** and **Video Bitrate** at their default values. 4. Close the **Settings** dialog to apply your changes. ## 4. Start the live stream with PUT /live_streams/{live_stream_id}/start Start the stream in Wowza Video first so it's ready to process the incoming video, then start the stream on the WebRTC publish page. Info For active subscriptions, charges start accruing when you start the stream in Wowza Video. See Wowza Video free trial for trial subscription features and limitations. ### 4a. Start the live stream in Wowza Video Send the following request to start the live stream. Replace `[live_stream_id]` with the `id` value returned in step 2. **cURL request: PUT /live_streams/{live_stream_id}/start (API v2.0)** Endpoint Reference ```json curl -X PUT \ -H "Content-Type: application/json" \ -H "Authorization: Bearer ${WV_JWT}" \ "https://api.video.wowza.com/api/${WV_VERSION}/live_streams/[live_stream_id]/start" # Replace [live_stream_id] with the id from step 2 ``` The response shows the live stream state as `start` (starting). ### 4b. Start the stream on the WebRTC publish page Wait 20 seconds for the live stream to finish starting up, then click **Publish** on the WebRTC publish page. Wowza Video is now receiving, processing, and delivering the stream to the player on your hosted page. ## 5. View the live stream on the WebRTC playback page (wowza.com/webrtc/play) Use the `source_connection_information` from the `POST /live_streams` response to configure the WebRTC playback page, which is optimized for low-latency WebRTC playback. 1. In a new browser tab, go to wowza.com/webrtc/play. The WebRTC hosted playback page is supported on the latest versions of Chrome and Safari, and on Edge version 79 and later. ![WebRTC playback page](/assets/webrtc_playback_page.825c42fcecb5548cc34c3a6b53f799784258bf92cddeb78763ab8cd2c9173fd1.71a4f21c.png) 2. Click **Settings** in the upper-right corner of the page. 3. Using the `source_connection_information` from the step 2 response, enter the following values: **JSON: source_connection_information from the POST /live_streams response (API v2.0)** ```json "source_connection_information": { "sdp_url": "wss://[subdomain].entrypoint.video.wowza.com/webrtc-session.json", "application_name": "app-30zl5349", "stream_name": "32a5814b" } ``` - Enter the `sdp_url` value in the **SDP URL** field. - Enter the `application_name` value in the **Application Name** field. - Enter the `stream_name` value in the **Stream Name** field. 4. Close the **Settings** dialog to apply your changes, then click play to view the stream. ## 6. Stop the live stream with PUT /live_streams/{live_stream_id}/stop Stop both the video source and the live stream in Wowza Video. If you forget to stop the stream in Wowza Video, charges continue to accrue. Info Transcoding charges accrue for started live streams even when they aren't actively streaming content. Wowza Video automatically stops idle live streams after 20 minutes, but stop your stream as soon as your event ends to avoid unnecessary charges. See [Wowza Video free trial](https://www.wowza.com/docs/wowza-video-free-trial-2) for trial subscription features and limitations. ### 6a. Stop the stream on the WebRTC publish page On the WebRTC publish page, click **Stop**. ### 6b. Stop the live stream in Wowza Video Send the following request to stop the live stream. Replace `[live_stream_id]` with the `id` value returned in step 2. **cURL request: PUT /live_streams/{live_stream_id}/stop (API v2.0)** Endpoint Reference ```json curl -X PUT \ -H "Authorization: Bearer ${WV_JWT}" \ "https://api.video.wowza.com/api/${WV_VERSION}/live_streams/[live_stream_id]/stop" # Replace [live_stream_id] with the id from step 2 ``` The response shows the live stream state as `stop` (stopped). ## What to build next with the Wowza Video REST API You've completed your first live stream using the Wowza Video 2.0 REST API. You used a WebRTC encoder to push video to Wowza Video, which processed and delivered it to your viewers. To continue building your streaming solution: - [Query a live stream with GET /live_streams/{live_stream_id}](/docs/wowza-video/about-the-rest-api/api-overview) to retrieve live stream details and status programmatically. - Browse the **Guides** section of the navigation for advanced REST API workflows, including transcoder configuration, multi-bitrate output, and playback customization. ## Related Wowza Video REST API reference and guides - [About the Wowza Video REST API](/docs/wowza-video/about-the-rest-api/api-overview) - [Connect an IP camera as a video source using the Wowza Video REST API](/docs/wowza-video/guides/video-source/encoder-camera/connect-an-ip-camera) - Wowza Video REST API v2.0 reference documentation