# Participants

## Add a participant to a chat

`client.chats.participants.add(stringchatID, ParticipantAddParamsbody, RequestOptionsoptions?): ParticipantAddResponse`

**post** `/v3/chats/{chatId}/participants`

Add a new participant to an existing group chat.

**Requirements:**

- Group chats only (3+ existing participants)
- New participant must support the same messaging service as the group
- Cross-service additions not allowed (e.g., can't add RCS-only user to iMessage group)
- For cross-service scenarios, create a new chat instead

### Parameters

- `chatID: string`

- `body: ParticipantAddParams`

  - `handle: string`

    Phone number (E.164 format) or email address of the participant to add

### Returns

- `ParticipantAddResponse`

  - `message?: string`

  - `status?: string`

  - `trace_id?: string`

### Example

```typescript
import LinqAPIV3 from '@linqapp/sdk';

const client = new LinqAPIV3({
  apiKey: process.env['LINQ_API_V3_API_KEY'], // This is the default and can be omitted
});

const response = await client.chats.participants.add('550e8400-e29b-41d4-a716-446655440000', {
  handle: '+12052499136',
});

console.log(response.trace_id);
```

#### Response

```json
{
  "message": "Participant addition queued",
  "status": "accepted",
  "trace_id": "trace_id"
}
```

## Remove a participant from a chat

`client.chats.participants.remove(stringchatID, ParticipantRemoveParamsbody, RequestOptionsoptions?): ParticipantRemoveResponse`

**delete** `/v3/chats/{chatId}/participants`

Remove a participant from an existing group chat.

**Requirements:**

- Group chats only
- Must have 3+ participants after removal

### Parameters

- `chatID: string`

- `body: ParticipantRemoveParams`

  - `handle: string`

    Phone number (E.164 format) or email address of the participant to remove

### Returns

- `ParticipantRemoveResponse`

  - `message?: string`

  - `status?: string`

  - `trace_id?: string`

### Example

```typescript
import LinqAPIV3 from '@linqapp/sdk';

const client = new LinqAPIV3({
  apiKey: process.env['LINQ_API_V3_API_KEY'], // This is the default and can be omitted
});

const participant = await client.chats.participants.remove('550e8400-e29b-41d4-a716-446655440000', {
  handle: '+12052499136',
});

console.log(participant.trace_id);
```

#### Response

```json
{
  "message": "Participant removal queued",
  "status": "accepted",
  "trace_id": "trace_id"
}
```

## Domain Types

### Participant Add Response

- `ParticipantAddResponse`

  - `message?: string`

  - `status?: string`

  - `trace_id?: string`

### Participant Remove Response

- `ParticipantRemoveResponse`

  - `message?: string`

  - `status?: string`

  - `trace_id?: string`
