# Partially update a contact

`PATCH /v1/contacts/{email}`

- Authentication: required (Bearer token)
- Required scope: `api.contacts.manage`

Partial diff-merge: only the fields present in the body are applied.

- `attributes` — keys in the map are set or cleared (a `null` value
  removes the key); keys absent from the map are left untouched.
- `topic_preferences` — only the listed topics are updated; others
  keep their existing preference.
- `unsubscribe_all` — when present, sets the master opt-out flag.
- `lists` — `add`/`remove` apply a delta; `set`, when present,
  replaces membership declaratively.

Returns `404 not_found` when the contact does not exist or has been
deleted.  Supports the `Idempotency-Key` header.

## Path parameters

- `email` (string<email>, required) — Recipient address. Percent-encode `@` as `%40`. Matched case-insensitively.

## Request body

Content type: `application/json`

```json
{
  "attributes": {},
  "unsubscribe_all": true,
  "topic_preferences": [
    {
      "topic_name": "string",
      "subscription_status": "OPT_IN"
    }
  ],
  "lists": {
    "add": [
      "00000000-0000-0000-0000-000000000000"
    ],
    "remove": [
      "00000000-0000-0000-0000-000000000000"
    ],
    "set": [
      "00000000-0000-0000-0000-000000000000"
    ]
  }
}
```

## Example request

```bash
curl -X PATCH 'https://api.sendops.dev/v1/contacts/user%40example.com' \
  -H "Authorization: Bearer $SENDOPS_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"attributes":{},"unsubscribe_all":true,"topic_preferences":[{"topic_name":"string","subscription_status":"OPT_IN"}],"lists":{"add":["00000000-0000-0000-0000-000000000000"],"remove":["00000000-0000-0000-0000-000000000000"],"set":["00000000-0000-0000-0000-000000000000"]}}'
```

## Responses

### 200 — Contact updated

Content type: `application/json`

```json
{
  "email": "user@example.com",
  "unsubscribe_all": true,
  "attributes": {},
  "topic_preferences": [
    {
      "topic_name": "string",
      "subscription_status": "OPT_IN"
    }
  ],
  "lists": [
    "00000000-0000-0000-0000-000000000000"
  ],
  "created_at": "2026-05-17T20:00:00Z",
  "updated_at": "2026-05-17T20:00:00Z"
}
```

### 401 — Missing, malformed, or unknown API key

Content type: `application/problem+json`

```json
{
  "type": "https://example.com",
  "title": "string",
  "status": 0,
  "detail": "string",
  "code": "invalid_key",
  "request_id": "string",
  "retry_after": 0,
  "retention_days": 0,
  "scope": "string",
  "resource": "string",
  "errors": [
    {
      "field": "string",
      "reason": "string"
    }
  ]
}
```

### 403 — Key lacks the required scope or plan limit violated

Content type: `application/problem+json`

```json
{
  "type": "https://example.com",
  "title": "string",
  "status": 0,
  "detail": "string",
  "code": "invalid_key",
  "request_id": "string",
  "retry_after": 0,
  "retention_days": 0,
  "scope": "string",
  "resource": "string",
  "errors": [
    {
      "field": "string",
      "reason": "string"
    }
  ]
}
```

### 404 — Resource not found

Content type: `application/problem+json`

```json
{
  "type": "https://example.com",
  "title": "string",
  "status": 0,
  "detail": "string",
  "code": "invalid_key",
  "request_id": "string",
  "retry_after": 0,
  "retention_days": 0,
  "scope": "string",
  "resource": "string",
  "errors": [
    {
      "field": "string",
      "reason": "string"
    }
  ]
}
```

### 422 — Query parameter or path value failed validation

Content type: `application/problem+json`

```json
{
  "type": "https://example.com",
  "title": "string",
  "status": 0,
  "detail": "string",
  "code": "invalid_key",
  "request_id": "string",
  "retry_after": 0,
  "retention_days": 0,
  "scope": "string",
  "resource": "string",
  "errors": [
    {
      "field": "string",
      "reason": "string"
    }
  ]
}
```

### 429 — Per-org rate limit exceeded

Content type: `application/problem+json`

```json
{
  "type": "https://example.com",
  "title": "string",
  "status": 0,
  "detail": "string",
  "code": "invalid_key",
  "request_id": "string",
  "retry_after": 0,
  "retention_days": 0,
  "scope": "string",
  "resource": "string",
  "errors": [
    {
      "field": "string",
      "reason": "string"
    }
  ]
}
```

### 500 — Unexpected server-side failure. The `code` is `internal_error`. The
`request_id` field can be quoted to SendOps support to investigate.

Content type: `application/problem+json`

```json
{
  "type": "https://example.com",
  "title": "string",
  "status": 0,
  "detail": "string",
  "code": "invalid_key",
  "request_id": "string",
  "retry_after": 0,
  "retention_days": 0,
  "scope": "string",
  "resource": "string",
  "errors": [
    {
      "field": "string",
      "reason": "string"
    }
  ]
}
```
