Use API to leave a call

Support intro

Sorry to hear you’re facing problems :slightly_frowning_face: is for home/non-enterprise users. If you’re running a business, paid support can be accessed via where we can ensure your business keeps running smoothly.

In order to help you as quickly as possible, before clicking Create Topic please provide as much of the below as you can. Feel free to use a pastebin service for logs, otherwise either indent short log examples with four spaces:


Or for longer, use three backticks above and below the code snippet:


Some or all of the below information will be requested if it isn’t supplied; for fastest response please provide as much as you can :heart:

Nextcloud version (eg, 20.0.5): 27.1.5
PHP version (eg, 7.4): 8.2

We would like to use the API to leave the call for some of the users remotely.
It happens very often that in 1-1 calls, when one of the call-attendees hangs-up the call another one just may forget to leave the call (cause normally in WhatsApp or similar apps the call hangs-up automatically when one of the participants presses the “red button” and leaves the call.

In Nextcloud talk the call-attendee stays in the call for hours. We noticed that in some cases an active 1-1 call with just a 1 participant stays active for 24h.

Steps to replicate it:

  1. Try to use the API Call management - Nextcloud Talk API documentation with the command:
    GET {talk_host}/ocs/v2.php/apps/spreed/api/v4/call/{token} it returns the correct response status 200

  2. Start the call, check call/{token} again and see the response array in “data” field of the json response. So the GET command works perfectly.

  3. Try to send the API command to leave the call. Using the
    DELETE /call/{token}
    the response has the status code 404:

Is it possible to somehow send an API command to leave the call?

We use the simple python snippet to send commands:

import requests

# Replace these values with your own
username = "*******"
password = "*******"
base_url = "https://***TALK_HOST****.comf"
token = "9mj4r3h7"

# Create a session object to store authentication credentials
session = requests.Session()
session.auth = (username, password)

# Set the headers for the API request
headers = {
    "Accept": "application/json",
    "Content-Type": "application/json",
    "OCS-APIRequest": "true"

# Set the payload for the API request
payload = {
    "force": True,
    "all": True

# Construct the URL for the API endpoint
url = f"{base_url}/ocs/v2.php/apps/spreed/api/v4/call/{token}"

# Send a GET request to "Get list of connected participants"
response1= session.get(url, headers=headers, json=payload)
# Print output

# or

# # Send a DELETE request to " Leave a call"
# response1= session.delete(url, headers=headers, json=payload)
# # Print output
# print(response1.text)