# Post the opening balance

Source: https://amanucci.com/nl/docs/developers/api/ledger/postOpeningBalance

## POST /v1/entities/{entityId}/opening-balance

Post the opening balance

Enter the books' starting truth — a SIGNED act (`post_entry`). The body is a trial balance by account code; it posts as ONE `migration` entry dated the day before `opensPeriodId`, through the one door, with your step-up's verification id on the row. A reconcilable account's line names the open item it mints (customer and supplier items with their party), so later bank lines can match it. One live opening per entity, before any other entry up to the end of the period it opens (409 `opening_exists`, `opening_after_entries`); a correction is `replacesEntryId` — a reversal plus a new opening in one act, never an edit. A retry of the same body is 200 `deduped: true`.

Operation ID: `postOpeningBalance`

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

### Responses

#### 200 Duplicate-ok: this exact opening had already posted.

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

#### 201 The opening is posted.

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

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