# Record a firm rule

Source: https://amanucci.com/nl/docs/developers/api/cases/appendFirmPrecedent

## POST /v1/firms/{firmId}/precedents

Record a firm rule

Record one of the firm's own rules — a SIGNED act (`approve_firm_precedent`): an accountant of the firm with a step-up under fifteen minutes old; the signer and the step-up's id are recorded on the row. It applies to every client the firm engages, while the engagement covers the event's date; a client's own rule on the same fact outranks it. It names nothing of one client's: no example case, no evidence, no client's own account or party (422 `precedent_invalid`). `expectedSeq` is the firm log's pinned-row recipe: a byte-identical retry is 200, a stale head is 409. A fact rule re-checks the live, unposted cases of every client it reaches.

Operation ID: `appendFirmPrecedent`

### Parameters

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

### Request body

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

### Responses

#### 200 Duplicate-ok: this exact append had landed.

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

#### 201 The firm's rule, recorded.

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

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