# Edit an attribute definition

`PUT /v1/attributes/{id}`

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

Edits an attribute's name, type, enum values, and description. The registry
is authoritative: the edit **always applies** — it is never blocked. Each
edit is classified by its impact on dependent Segments and the class is
returned as `mutation_class`:

- `free` — no effect on any predicate (description change, enum widen, or
  moving between `string` and `enum`, which compile to the same cast).
- `safe_but_stale` — an `enum` value was removed; predicates stay valid but
  may compare against a value that can no longer be written.
- `disruptive` — a rename or a cast-class change (e.g. `string`→`number`).
  Segments that reference the attribute keep evaluating best-effort but
  carry a standing `eval_warning` until their predicate is re-saved. For a
  disruptive edit the response includes an `impact` block (affected segments
  + projected org-wide drop-out). Preview the impact first via
  `/v1/attributes/{id}/preview`.

Git-backed definitions are read-only here (`409 conflict`) — edit them in the
connected repo.

## Path parameters

- `id` (string<uuid>, required) — Resource UUID. An unparseable id reads as a clean `404 not_found`.

## Request body

Content type: `application/json`

```json
{
  "name": "string",
  "type": "string",
  "enum_values": [
    "string"
  ],
  "description": "string",
  "formula": "string"
}
```

## Example request

```bash
curl -X PUT 'https://api.sendops.dev/v1/attributes/00000000-0000-0000-0000-000000000000' \
  -H "Authorization: Bearer $SENDOPS_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"name":"string","type":"string","enum_values":["string"],"description":"string","formula":"string"}'
```

## Responses

### 200 — The updated definition with the mutation class and (for a disruptive edit) the impact

Content type: `application/json`

```json
{
  "attribute": {
    "id": "00000000-0000-0000-0000-000000000000",
    "name": "string",
    "type": "string",
    "enum_values": [
      "string"
    ],
    "description": "string",
    "formula": "string",
    "origin": "managed",
    "source_path": "string",
    "last_synced_at": "2026-05-17T20:00:00Z",
    "created_at": "2026-05-17T20:00:00Z",
    "updated_at": "2026-05-17T20:00:00Z"
  },
  "mutation_class": "free",
  "impact": {
    "affected_segments": [
      {
        "id": "00000000-0000-0000-0000-000000000000",
        "name": "string",
        "typecheck_ok": true,
        "warning": "string"
      }
    ],
    "affected_workflows": [
      {
        "id": "00000000-0000-0000-0000-000000000000",
        "name": "string",
        "key": "string",
        "status": "string"
      }
    ],
    "projected_dropout": 0
  }
}
```

### 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"
    }
  ]
}
```

### 409 — The mutation is rejected by a state rule rather than a bad request — e.g.
editing a git-backed (read-only) definition. The `code` is `conflict`.

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"
    }
  ]
}
```
