# Set the entity's invoicing

Source: https://amanucci.com/nl/docs/developers/api/settings/appendEntityInvoicing

## POST /v1/entities/{entityId}/policy/invoicing

Set the entity's invoicing

Append the next version of the entity's policy with these invoicing settings, its other columns carried from the version it follows — the organisation's owner or a firm accountant holding `settings.policy` (a member or a staffer meets 403 `authority-required`). `expectedSeq` is the pinned-row idempotency key: the same settings again are duplicate-ok (200), a stale head is 409 `policy_conflict`. A new prefix for a kind that already has a finalized document this year is 409 `prefix_change_mid_series`: the same version from 1 January next year is accepted (the prefix rule). The database judges the block (422 `policy_invoicing_invalid`): a prefix of capital letters per kind, no two alike, terms in whole days, a reminder ladder in order, each email template's subject on one line and naming only its kind's placeholders (a credit note's no `{dueDate}`).

Operation ID: `appendEntityInvoicing`

### Parameters

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

### Request body

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

### Responses

#### 200 Duplicate-ok: this exact version was already appended.

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

#### 201 The new version.

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

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