Leave Group

From docs
Jump to: navigation, search

Mobile_API »Leave Group

Base URL

https://apimobile.callproof.com

Endpoint

/api/leave-group

Purpose

Removes a user from a video message group. By default, the authenticated user leaves the group. If another user_id is provided, the authenticated user must be a group admin and that member is removed instead. If the departing user is the only admin and other members remain, another member is promoted to admin. If the last member leaves, the group is deleted.

HTTP Method

DELETE

Headers

Header Required Description
Authorization Yes Bearer access token

Security

  • Yes – Requires Bearer Token authentication.

Parameters

Path Parameters

None.

Query Parameters

None.

Request Body

Parameter Type Required Description
group_id integer Yes Unique identifier of the group to leave
user_id integer No Member to remove from the group. When provided, the authenticated user must be a group admin. When omitted, the authenticated user leaves the group

cURL Example for Android

 curl --location --request DELETE 'https://apimobile.callproof.com/api/leave-group' \ --header 'Authorization: Bearer YOUR_ACCESS_TOKEN' \ --header 'Content-Type: application/json' \ --data '{ "group_id": YOUR_GROUP_ID, "user_id": "" }' 

cURL Example for iOS

 curl --location --request DELETE 'https://apimobile.callproof.com/api/leave-group' \ --header 'Authorization: Bearer YOUR_ACCESS_TOKEN' \ --header 'Content-Type: application/json' \ --data '{ "group_id": YOUR_GROUP_ID, "user_id": "" }' 

Successful Response (200)

Indicates that the member left (or was removed from) the group successfully.

Field Type Description
clientStatusCode integer Status indicator for the client (for example, 200)
message string Confirmation message (for example, "Left the group successfully")
uri string Requested resource URI

Error Responses

Status Code Meaning
200 Validation/authorization failed – response body uses clientStatusCode 401
400 Bad Request – the leave/remove action could not be completed
401 Unauthorized – missing, invalid, or expired Bearer token
  • Validation/authorization (HTTP 200, clientStatusCode 401) – Missing group_id, or the authenticated user is not a group admin when trying to remove another user (for example, "Login user as not an group admin of this group").
  • 400 – An error occurred while leaving the group (for example, "Error while processing").
  • 401 – Authentication failed or the access token is missing/expired.