End and Delete a Live Video
Learn how to end and delete a live video.
We'll cover the following...
End a live video
To end a live video on Facebook using the Facebook Graph API, we need to make a POST request to the live video's terminate endpoint. The base URL of the endpoint is:
https://graph.facebook.com/v16.0/{{live_video_id}}/live_videos?end_live_video=true
Request parameters
The request parameters for the endpoint are given below.
Parameter | Type | Category | Description |
| String | Mandatory | This is the token that we received after app authentication and authorization. |
| String | Mandatory | This is the ID of the live video. Note that this is a path parameter. |
| Boolean | Mandatory | This is the boolean value that must be set to |
The code below uses the endpoint above to end a live video. Click the “Run” button to see the response.
Note: This endpoint will only work if there is a live video running on the created live video broadcast.
In the code widget above:
Line 5: We define the endpoint URL in the
endpointUrlvariable.Lines 18–21: We add the
access_tokenand setend_live_videototruein thequeryParametersvariable.Line 27: We use the
fetchfunction to make the API call.
Response fields
The following are the response fields for the above endpoint.
Name | Type | Description |
| String | This is the ID of the live video. |
| String | This is the current status of the live video; it can be either |
| String | This is the title of the live video. |
| String | This is the URL of the live video's stream. |
| String | This is the secure URL of the live video's stream. |
| String | This is the URL of the live video on Facebook. |
| Boolean | This indicates whether the live video has been published or not. |
| DateTime | This is the time the live video was created. The time is in ISO 8601 format. |
| DateTime | This is the time the live video was updated. The time is in ISO 8601 format. |
| String | This is the HTML code to embed the live video on another website. |
| DateTime | This is the time when the live video was started. The time is in ISO 8601 format. |
| DateTime | This is the time when the live video was ended. The time is in ISO 8601 format. |
Note: Please note that the above fields aren't guaranteed to be returned in every request, and some fields may be added or removed in future versions of the API.
Delete a live video
To delete a live video on Facebook using the Graph API, we must make a DELETE request to the video's endpoint. The base URL for the endpoint is:
https://graph.facebook.com/v16.0/{{live_video_id}}
Request parameters
The request parameters for the endpoint are given below.
Parameter | Type | Category | Description |
| String | Mandatory | This is the token that we received after app authentication and authorization. |
| String | Mandatory | This is the ID of the live video. Note that this is a path parameter. |
The code below uses the endpoint above to delete a live video. Click the “Run” button to see the response.
In the code widget above:
Line 5: We define the endpoint URL in the
endpointUrlvariable.Line 13: We set the method to
DELETE.Lines 18–20: We add the
access_tokenin thequeryParametersvariable.Line 26: We use the
fetchfunction to make the API call.
Response fields
The following are the response fields for the above endpoint.
Name | Type | Description |
| Boolean | This is the boolean value indicating whether the deletion was successful or not. |
| String | This is the ID of the deleted live video, if the deletion was successful. |
Note: Once a live video is deleted, it can't be recovered again.