Update a group

Works on
  • iMessage

Rename a group, or add or remove one member

POST/v1/commands/group.update

Renames an iMessage group chat, or adds or removes one member. One action per command. It is done only in a group chat.

Honors Idempotency-Key: a retry under the same key returns the first command rather than making the change twice.

Body

Target

Prop

Type

A group's conversationId reaches you on the message events from the group: every message someone writes there arrives under the group's own id, with isGroup: true.

Each of these is 422 validation_failed at target.conversationId before anything is sent:

  • a conversation with one person;
  • a conversation no message has arrived in yet;
  • in place of a conversation, the address of someone this project has already exchanged messages with.

The address of someone this project has never exchanged messages with is refused at the field you wrote it at, as on every command done in a conversation.

Payload

One action, at payload.action.

Prop

Type

Each of these is 422 validation_failed before anything is written:

  • no action, or one that is not rename, add_participant or remove_participant, at payload.action;
  • a name that is missing, blank, over 128 characters or holds an ASCII control character, at payload.name;
  • an address the channel cannot read, or one with an ASCII control character, over 512 characters or not in composed Unicode (NFC), at payload.participantExternalId;
  • any key the action does not take, at that key (payload.<key>).

rename

{ "action": "rename", "name": "Trip planning" }

add_participant and remove_participant

{ "action": "add_participant", "participantExternalId": "+14155550122" }

One person per command. Mapier reads the address the way the channel reads one — a phone number to E.164, an email lower-cased — and sends it in that canonical form.

Send a message into a new group first

A group the channel has seen no message in yet refuses an add_participant or a remove_participant at once: 409 conflict with details.reason: "group_has_no_messages_yet". Send a message into the group, then change its members. A rename is not held back.

Adding someone already in the group, or removing someone who is not in it, is accepted and then ends failed with command_claim_invalid. The line judges that against the members as it last saw them.

action: "set_photo" is 422 validation_failed at payload.action before anything is sent: a group's photo cannot be set through the API.

What comes back

At once, beside the refusals above:

  • 409 conflict with details.reason: "group_has_no_messages_yet" — an add or a remove into a group the channel has seen no message in yet.
  • 503 upstream_unavailable with details.reason: "connector_unavailable" — the line is offline.

Otherwise 202, then one command event on the response stream:

  • succeeded — the line made the change and confirmed it.
  • failed with command_claim_invalid — an add of someone already in the group, or a remove of someone who is not.
  • failed with stale_target — the group was addressed right after its membership changed, before its next message. Until that message arrives, a group.update, a group.leave or a message sent into the group ends this way. Wait for the next message event from the group, then send again under a new Idempotency-Key.
  • failed with gateway_rejected — the line refused the change before making it. A removal that would leave the group smaller than Apple allows is one.
  • failed with capability_constraint_violation, failureClass: capability — an add or a remove on a line that does not support member changes. Nothing changed.
  • expired with command_expired_before_execution — sending on the line was paused: the line held the command, and its time ran out before sending resumed. Nothing changed.
  • ambiguous with group_update_unverified — the line sent the change and could not confirm it. It may or may not have happened. Read the group with GET /v1/conversations/{conversationId}, or ask someone in it, before you send the change again.

Example request

curl https://api.mapier.ai/v1/commands/group.update \
  -H "Authorization: Bearer $MAPIER_API_KEY" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: rename-trip-planning-1" \
  -H "x-mapier-version: 2026-12-01" \
  -d '{
    "target": {
      "kind": "conversation",
      "conversationId": "a0000000-0000-4000-8000-000000000002"
    },
    "payload": { "action": "rename", "name": "Trip planning" }
  }'

Response

202 Accepted
{
  "commandId": "0192b3e2-a3d5-76b9-97ea-c50283b4f6a9",
  "status": "queued",
  "repeated": false,
  "lineId": "0192a7b0-3e4f-7051-8c6d-7e8f9a0b1c2d",
  "lineSelection": "reused_active_chat"
}

Then, on the response stream:

event: command — succeeded
{
  "commandId": "0192b3e2-a3d5-76b9-97ea-c50283b4f6a9",
  "logicalActionId": "rename-trip-planning-1",
  "status": "succeeded",
  "errorCode": null,
  "conversationId": "a0000000-0000-4000-8000-000000000002",
  "type": "group.update",
  "messageId": null,
  "externalId": null,
  "namePhoto": null,
  "projectId": "b0000000-0000-4000-8000-000000000002",
  "environment": "live",
  "failureClass": null
}

Errors

Every command can return the errors listed under How commands work › Errors. Specific to this command:

  • 422 validation_failed at target.conversationId for a conversation with one person, one no message has arrived in, or the address of someone this project has already exchanged messages with, in place of a conversation.
  • 422 validation_failed at payload.action, payload.name, payload.participantExternalId or payload.<key>, as above.
  • 409 conflict with details.reason: "group_has_no_messages_yet" for an add or a remove into a group the channel has seen no message in yet.
  • 503 upstream_unavailable with details.reason: "connector_unavailable" while the line is offline.
  • 404 unsupported_command with reason: not_on_channel on a line of any other channel.
  • On a test line on a shared number, 404 unsupported_command with reason: shared_line unless group chats are turned on for your organization, and 403 recipient_not_allowed with group_member_not_test_contact or recipient_must_write_first while someone in the group is not a connected Test contact. See Groups on a test line.

Result codes you will see for this command: command_claim_invalid, stale_target, gateway_rejected, capability_constraint_violation, command_expired_before_execution and group_update_unverified. See Error codes.

Guide