---
# @generated by sylphx-gen. Do not edit.
title: "Set relationship on a chat profile"
description: "`events.chat_profiles.set_relationship` (POST /v1/{name}:setRelationship): Changes friendship or a bilateral interaction block."
type: reference
product: queues
summary: "Changes friendship or a bilateral interaction block."
updated: 2026-09-28
nav: false
---

Changes friendship or a bilateral interaction block.

- **Path** `POST https://api.sylphx.com/v1/orgs/acme/projects/shop/envs/production/chat_profiles/chat-profile:setRelationship`
- **Scope** `events:write`
- **Effect** `write` — a successful call changes state.
- **Collection** [chat_profiles](/docs/api/chat_profiles)

## Request

| Field | Type | What it is |
| --- | --- | --- |
| `name` | `string` | Acting user's profile. Required. |
| `peer_id` | `string` | Other user's stable client id. Required. |
| `action` | `string` | request, accept, remove, block or unblock. Required. |

## Response

| Field | Type | What it is |
| --- | --- | --- |
| `client_id` | `string` | Acting member. |
| `peer_id` | `string` | Other member. |
| `requested` | `bool` | This user requested friendship. |
| `mutual` | `bool` | Both users accepted friendship. |
| `blocked` | `bool` | Either user blocked the other; interaction is denied both ways. |
| `peer` | `ChatProfile` | Other member's profile and fresh presence. |

### ChatProfile

| Field | Type | What it is |
| --- | --- | --- |
| `name` | `string` | Resource name; the last segment is the stable authenticated client id. |
| `uid` | `string` | Stable service-derived identifier. Output only. |
| `meta` | `ResourceMeta` | Resource metadata. |
| `terms_version` | `string` | Accepted code of conduct version, before first send; includes disclosure that images go to a third-party AI model provider through Sylphx AI Gateway. Output only. |
| `display_name` | `string` | User-visible name. Output only. |
| `official` | `bool` | Trusted backend verification, never a message-supplied flag. Output only. |
| `allow_stranger_images` | `bool` | Explicit opt-in to images from non-mutual contacts; default false. Output only. |
| `online` | `bool` | Fresh presence on any joined conversation. Output only. |
| `activity` | `string` | Latest presence activity, including title and game, if the member supplied it. Output only. |
| `quiet_hours_start_utc_minute` | `int32` | UTC quiet-hours start in minutes, 0..1439. Omit both fields to disable. Output only. |
| `quiet_hours_end_utc_minute` | `int32` | UTC exclusive end, 0..1440; may wrap midnight. Output only. |
| `cosmetics` | `ChatCosmetics` | Appearance assigned only by a trusted tenant backend. Output only. |

### ResourceMeta

| Field | Type | What it is |
| --- | --- | --- |
| `generation` | `int64` | Increases by one on every change to `spec`. Output only. |
| `etag` | `string` | Strong ETag (AIP-154): changes on any change to spec, status, or metadata. Send it back as `If-Match` or `etag` to make Update and Delete conditional; a mismatch fails with ABORTED / 409 `ETAG_MISMATCH`. Output only. |
| `create_time` | `timestamp` | When the Resource was created. Output only. |
| `update_time` | `timestamp` | When the Resource last changed. Output only. |
| `delete_time` | `timestamp` | Set while the Resource is being deleted. Output only. |
| `labels` | `map<string, string>` | Caller-writable, indexed labels (AIP-122 label rules). |
| `annotations` | `map<string, string>` | Caller-writable, unindexed annotations. |
| `display_name` | `string` | Caller-writable human-readable name. |
| `creator` | `string` | The principal that created the Resource. Output only. |

### ChatCosmetics

| Field | Type | What it is |
| --- | --- | --- |
| `avatar_frame_id` | `string` | Owned avatar-frame identifier, assigned by the trusted backend. |
| `name_color_id` | `string` | Owned name-color identifier, assigned by the trusted backend. |
| `title_badge_id` | `string` | Owned title-badge identifier, assigned by the trusted backend. |

## Errors

- [`UNAUTHENTICATED`](/docs/api/errors/UNAUTHENTICATED) — No valid key or token was presented.
- [`PERMISSION_DENIED`](/docs/api/errors/PERMISSION_DENIED) — The key lacks the method's permission.
- [`RESOURCE_NOT_FOUND`](/docs/api/errors/RESOURCE_NOT_FOUND) — The named Resource does not exist or is not visible.
- [`INVALID_FIELD`](/docs/api/errors/INVALID_FIELD) — A field failed validation.
- [`INVALID_STATE`](/docs/api/errors/INVALID_STATE) — The Resource is in a state that forbids the call.

Every error arrives in the body [Errors](/docs/platform/errors) describes.

## Examples

**cURL**

```curl
curl -X POST "https://api.sylphx.com/v1/orgs/acme/projects/shop/envs/production/chat_profiles/chat-profile:setRelationship" \
  -H "Authorization: Bearer $SYLPHX_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"action":"…","peer_id":"…"}'
```

**TypeScript**

```ts
const response = await sylphx.events.chatProfiles.setRelationship({ action: '…', name: 'orgs/acme/projects/shop/envs/production/chat_profiles/chat-profile', peerId: '…' })
```

**Rust**

```rust
let mut req = sylphx::events::SetChatRelationshipRequest::default();
req.action = "…".to_string();
req.name = "orgs/acme/projects/shop/envs/production/chat_profiles/chat-profile".to_string();
req.peer_id = "…".to_string();
let response = sx.events().chat_profiles().set_relationship(req).await?;
```

**CLI**

```bash
sylphx events chat-profiles set-relationship orgs/acme/projects/shop/envs/production/chat_profiles/chat-profile
```

**MCP**

```json
{ "method_id": "events.chat_profiles.set_relationship", "args": {"action":"…","name":"orgs/acme/projects/shop/envs/production/chat_profiles/chat-profile","peer_id":"…"} }
```
