# Append a firm seat version

Source: https://amanucci.com/fr/docs/developers/api/people/appendFirmMembershipVersion

## POST /v1/firms/{firmId}/memberships/{userId}/versions

Append a firm seat version

Append the next version of somebody's FIRM seat — role, portfolio, or both. `expectedSeq` is the pinned-row idempotency key: the server writes `expectedSeq + 1`, a byte-identical retry is duplicate-ok with a 200, and a stale expectation is a 409 the caller resolves by re-reading. Only an `accountant` head appends; a staffer meets 403 `authority-required`. Re-roling the firm's last accountant to `staff` is 409 `membership_last_accountant`. Never an UPDATE: 'who could reach which clients, when' is an audit question.

Operation ID: `appendFirmMembershipVersion`

### Parameters

```json
[
  {
    "schema": {
      "type": "string",
      "format": "uuid"
    },
    "required": true,
    "name": "firmId",
    "in": "path"
  },
  {
    "schema": {
      "type": "string",
      "format": "uuid"
    },
    "required": true,
    "name": "userId",
    "in": "path"
  }
]
```

### Request body

```json
{
  "required": true,
  "content": {
    "application/json": {
      "schema": {
        "$ref": "#/components/schemas/AppendFirmMembership"
      }
    }
  }
}
```

### Responses

#### 200 The new head version, or the byte-identical one a retry found already there.

```json
{
  "application/json": {
    "schema": {
      "$ref": "#/components/schemas/AppendFirmMembershipResult"
    }
  }
}
```

#### 401 Dead or absent credential (`unauthenticated`).

```json
{
  "application/problem+json": {
    "schema": {
      "$ref": "#/components/schemas/Problem"
    }
  }
}
```

#### 403 Authenticated, present, and refused: a missing grant, a missing seat, or a missing step-up.

```json
{
  "application/problem+json": {
    "schema": {
      "$ref": "#/components/schemas/Problem"
    }
  }
}
```

#### 404 Absent, or hidden from this asker — the two are indistinguishable (`not-found`).

```json
{
  "application/problem+json": {
    "schema": {
      "$ref": "#/components/schemas/Problem"
    }
  }
}
```

#### 409 The world is not in the state the request assumed: a stale `expectedSeq`, or a transition already made.

```json
{
  "application/problem+json": {
    "schema": {
      "$ref": "#/components/schemas/Problem"
    }
  }
}
```

#### 422 The request did not satisfy the schema (`invalid-input`).

```json
{
  "application/problem+json": {
    "schema": {
      "$ref": "#/components/schemas/Problem"
    }
  }
}
```

#### 429 Too many requests on this door's bucket (`rate-limited`); refused before any handler ran, `Retry-After` says when to come back.

```json
{
  "application/problem+json": {
    "schema": {
      "$ref": "#/components/schemas/Problem"
    }
  }
}
```

#### 503 Temporarily unavailable; `Retry-After` says when to come back.

```json
{
  "application/problem+json": {
    "schema": {
      "$ref": "#/components/schemas/Problem"
    }
  }
}
```
