From 605badab812b087a087be38c8c74a6a38b7fbf2d Mon Sep 17 00:00:00 2001 From: Joseph Giambo Date: Wed, 4 Nov 2026 20:00:50 -0800 Subject: [PATCH 1/2] Add endpoint to terminate (end) a group for everyone POST /v1/groups/{number}/{groupid}/terminate wraps signal-cli's terminateGroup command (added in signal-cli 0.14.8). It permanently ends a groups v2 group for all members: nobody can send messages or start calls afterwards, but members keep the history. The account must be a group admin. Works in normal/native mode (exec) and json-rpc mode, like quit. Swagger docs regenerated; example added to doc/EXAMPLES.md. Co-Authored-By: Claude Opus 5.5 --- doc/EXAMPLES.md | 10 ++++++++++ src/api/api.go | 36 ++++++++++++++++++++++++++++++++++ src/client/client.go | 19 ++++++++++++++++++ src/docs/docs.go | 45 +++++++++++++++++++++++++++++++++++++++++++ src/docs/swagger.json | 45 +++++++++++++++++++++++++++++++++++++++++++ src/main.go | 1 + 6 files changed, 156 insertions(+) diff --git a/doc/EXAMPLES.md b/doc/EXAMPLES.md index 597175d..fa518f3 100644 --- a/doc/EXAMPLES.md +++ b/doc/EXAMPLES.md @@ -125,6 +125,16 @@ e.g: `curl -X DELETE -H "Content-Type: application/json" 'http://127.0.0.1:8080/v1/groups/+431212131491291/ckRzaEd4VmRzNnJaASAEsasa'` +- Terminate (end) a group for everyone + + Permanently end the group with the given group id for all members. Afterwards nobody, not even an admin, can send messages or start calls in the group, but members keep the message history. This can't be undone. The account must be an admin of the group, and only groups v2 are supported. + + `curl -X POST -H "Content-Type: application/json" 'http://127.0.0.1:8080/v1/groups///terminate'` + + e.g: + + `curl -X POST -H "Content-Type: application/json" 'http://127.0.0.1:8080/v1/groups/+431212131491291/group.ckRzaEd4VmRzNnJaASAEsasa/terminate'` + - Link a device `curl -X GET -H "Content-Type: application/json" 'http://127.0.0.1:8080/v1/qrcodelink?device_name='` diff --git a/src/api/api.go b/src/api/api.go index 465fa03..af3d284 100644 --- a/src/api/api.go +++ b/src/api/api.go @@ -1790,6 +1790,42 @@ func (a *Api) QuitGroup(c *gin.Context) { c.Status(http.StatusNoContent) } +// @Summary Terminate a Signal Group for all members. +// @Tags Groups +// @Description Permanently end the specified Signal Group for everyone ("End group" in the Signal apps). Afterwards no member, not even an admin, can send messages or start calls in the group; members keep the existing message history. This can't be undone. Requires admin rights in the group and is only supported for groups v2. +// @Accept json +// @Produce json +// @Success 204 {string} OK +// @Failure 400 {object} Error +// @Param number path string true "Account identifier (E.164 phone number or ACI UUID)" +// @Param groupid path string true "Group ID" +// @Router /v1/groups/{number}/{groupid}/terminate [post] +func (a *Api) TerminateGroup(c *gin.Context) { + _, number, err := accountIdentifierFromParam(c) + if err != nil { + c.JSON(400, Error{Msg: err.Error()}) + return + } + if number == "" { + c.JSON(400, Error{Msg: "Couldn't process request - number missing"}) + return + } + + groupId := c.Param("groupid") + internalGroupId, err := client.ConvertGroupIdToInternalGroupId(groupId) + if err != nil { + c.JSON(400, Error{Msg: err.Error()}) + return + } + + err = a.signalClient.TerminateGroup(number, internalGroupId) + if err != nil { + c.JSON(400, Error{Msg: err.Error()}) + return + } + c.Status(http.StatusNoContent) +} + // @Summary Update the state of a Signal Group. // @Tags Groups // @Description Update the state of a Signal Group. diff --git a/src/client/client.go b/src/client/client.go index 6dc0d1f..03f69f8 100644 --- a/src/client/client.go +++ b/src/client/client.go @@ -2133,6 +2133,25 @@ func (s *SignalClient) QuitGroup(number string, groupId string) error { return err } +func (s *SignalClient) TerminateGroup(number string, groupId string) error { + var err error + var jsonRpc2Client *JsonRpc2Client + if s.signalCliMode == JsonRpc { + type Request struct { + GroupId string `json:"groupId"` + } + request := Request{GroupId: groupId} + jsonRpc2Client, err = s.getJsonRpc2Client() + if err != nil { + return err + } + _, err = jsonRpc2Client.getRaw("terminateGroup", &number, request) + } else { + _, err = s.cliClient.Execute(true, []string{"--config", s.signalCliConfig, "-a", number, "terminateGroup", "-g", groupId}, "") + } + return err +} + func (s *SignalClient) UpdateGroup(number string, groupId string, base64Avatar *string, groupDescription *string, groupName *string, expirationTime *int, groupLinkState *GroupLinkState, editGroupPermission GroupPermission, addMembersPermission GroupPermission, sendMessagesPermission GroupPermission) error { var err error diff --git a/src/docs/docs.go b/src/docs/docs.go index db26180..432f7b9 100644 --- a/src/docs/docs.go +++ b/src/docs/docs.go @@ -4082,6 +4082,51 @@ const docTemplate = `{ ] } }, + "/v1/groups/{number}/{groupid}/terminate": { + "post": { + "consumes": [ + "application/json" + ], + "description": "Permanently end the specified Signal Group for everyone (\"End group\" in the Signal apps). Afterwards no member, not even an admin, can send messages or start calls in the group; members keep the existing message history. This can't be undone. Requires admin rights in the group and is only supported for groups v2.", + "parameters": [ + { + "description": "Account identifier (E.164 phone number or ACI UUID)", + "in": "path", + "name": "number", + "required": true, + "type": "string" + }, + { + "description": "Group ID", + "in": "path", + "name": "groupid", + "required": true, + "type": "string" + } + ], + "produces": [ + "application/json" + ], + "responses": { + "204": { + "description": "No Content", + "schema": { + "type": "string" + } + }, + "400": { + "description": "Bad Request", + "schema": { + "$ref": "#/definitions/api.Error" + } + } + }, + "summary": "Terminate a Signal Group for all members.", + "tags": [ + "Groups" + ] + } + }, "/v1/health": { "get": { "description": "Internally used by the docker container to perform the health check.", diff --git a/src/docs/swagger.json b/src/docs/swagger.json index c8e910b..3f35234 100644 --- a/src/docs/swagger.json +++ b/src/docs/swagger.json @@ -4077,6 +4077,51 @@ ] } }, + "/v1/groups/{number}/{groupid}/terminate": { + "post": { + "consumes": [ + "application/json" + ], + "description": "Permanently end the specified Signal Group for everyone (\"End group\" in the Signal apps). Afterwards no member, not even an admin, can send messages or start calls in the group; members keep the existing message history. This can't be undone. Requires admin rights in the group and is only supported for groups v2.", + "parameters": [ + { + "description": "Account identifier (E.164 phone number or ACI UUID)", + "in": "path", + "name": "number", + "required": true, + "type": "string" + }, + { + "description": "Group ID", + "in": "path", + "name": "groupid", + "required": true, + "type": "string" + } + ], + "produces": [ + "application/json" + ], + "responses": { + "204": { + "description": "No Content", + "schema": { + "type": "string" + } + }, + "400": { + "description": "Bad Request", + "schema": { + "$ref": "#/definitions/api.Error" + } + } + }, + "summary": "Terminate a Signal Group for all members.", + "tags": [ + "Groups" + ] + } + }, "/v1/health": { "get": { "description": "Internally used by the docker container to perform the health check.", diff --git a/src/main.go b/src/main.go index 30ac26f..be9f6b7 100644 --- a/src/main.go +++ b/src/main.go @@ -234,6 +234,7 @@ func main() { groups.POST(":number/:groupid/block", api.BlockGroup) groups.POST(":number/:groupid/join", api.JoinGroup) groups.POST(":number/:groupid/quit", api.QuitGroup) + groups.POST(":number/:groupid/terminate", api.TerminateGroup) groups.PUT(":number/:groupid", api.UpdateGroup) groups.POST(":number/:groupid/members", api.AddMembersToGroup) groups.DELETE(":number/:groupid/members", api.RemoveMembersFromGroup) From 39319d2ae027964f612c01ccb17fc482fc52fca4 Mon Sep 17 00:00:00 2001 From: Joseph Giambo Date: Sun, 8 Nov 2026 10:36:36 -0800 Subject: [PATCH 2/2] Terminate group docs: drop the groups v2 detail As suggested in review: it's confusing for most people, and signal-cli returns an error if it doesn't apply. Co-Authored-By: Claude Opus 5.5 --- doc/EXAMPLES.md | 2 +- src/api/api.go | 2 +- src/docs/docs.go | 2 +- src/docs/swagger.json | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/doc/EXAMPLES.md b/doc/EXAMPLES.md index fa518f3..cdc93da 100644 --- a/doc/EXAMPLES.md +++ b/doc/EXAMPLES.md @@ -127,7 +127,7 @@ e.g: - Terminate (end) a group for everyone - Permanently end the group with the given group id for all members. Afterwards nobody, not even an admin, can send messages or start calls in the group, but members keep the message history. This can't be undone. The account must be an admin of the group, and only groups v2 are supported. + Permanently end the group with the given group id for all members. Afterwards nobody, not even an admin, can send messages or start calls in the group, but members keep the message history. This can't be undone. The account must be an admin of the group. `curl -X POST -H "Content-Type: application/json" 'http://127.0.0.1:8080/v1/groups///terminate'` diff --git a/src/api/api.go b/src/api/api.go index af3d284..8bb0671 100644 --- a/src/api/api.go +++ b/src/api/api.go @@ -1792,7 +1792,7 @@ func (a *Api) QuitGroup(c *gin.Context) { // @Summary Terminate a Signal Group for all members. // @Tags Groups -// @Description Permanently end the specified Signal Group for everyone ("End group" in the Signal apps). Afterwards no member, not even an admin, can send messages or start calls in the group; members keep the existing message history. This can't be undone. Requires admin rights in the group and is only supported for groups v2. +// @Description Permanently end the specified Signal Group for everyone ("End group" in the Signal apps). Afterwards no member, not even an admin, can send messages or start calls in the group; members keep the existing message history. This can't be undone. Requires admin rights in the group. // @Accept json // @Produce json // @Success 204 {string} OK diff --git a/src/docs/docs.go b/src/docs/docs.go index 432f7b9..96a8e1c 100644 --- a/src/docs/docs.go +++ b/src/docs/docs.go @@ -4087,7 +4087,7 @@ const docTemplate = `{ "consumes": [ "application/json" ], - "description": "Permanently end the specified Signal Group for everyone (\"End group\" in the Signal apps). Afterwards no member, not even an admin, can send messages or start calls in the group; members keep the existing message history. This can't be undone. Requires admin rights in the group and is only supported for groups v2.", + "description": "Permanently end the specified Signal Group for everyone (\"End group\" in the Signal apps). Afterwards no member, not even an admin, can send messages or start calls in the group; members keep the existing message history. This can't be undone. Requires admin rights in the group.", "parameters": [ { "description": "Account identifier (E.164 phone number or ACI UUID)", diff --git a/src/docs/swagger.json b/src/docs/swagger.json index 3f35234..0fb0953 100644 --- a/src/docs/swagger.json +++ b/src/docs/swagger.json @@ -4082,7 +4082,7 @@ "consumes": [ "application/json" ], - "description": "Permanently end the specified Signal Group for everyone (\"End group\" in the Signal apps). Afterwards no member, not even an admin, can send messages or start calls in the group; members keep the existing message history. This can't be undone. Requires admin rights in the group and is only supported for groups v2.", + "description": "Permanently end the specified Signal Group for everyone (\"End group\" in the Signal apps). Afterwards no member, not even an admin, can send messages or start calls in the group; members keep the existing message history. This can't be undone. Requires admin rights in the group.", "parameters": [ { "description": "Account identifier (E.164 phone number or ACI UUID)",