# Close a fiscal year

Source: https://amanucci.com/fr/docs/developers/api/ledger/closeYear

## POST /v1/entities/{entityId}/year-end/{yearEnd}

Close a fiscal year

Close a fiscal year: registers the year's capitalised purchases as assets on the entity's elected useful lives and time basis (`entity_policy.depreciationChoices`), and mints two period adjustments the ADE decides under the entity's pack — the close, dated the year's last day (the year's depreciation, plus the deferral of a cost whose service period runs past the year-end and the accrual of one invoiced after it), and its reversal on the next year's first day. Nothing here computes an amount. A missing election reaches the ADE, which refuses the close to a case by name. 409 `year_not_ended` before the year's last day by the business clock; 422 `year_end_unknown` on a date that is not the day before a fiscal year start. A retry of a closed year answers 200 with the stored close.

Operation ID: `closeYear`

### Parameters

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

### Responses

#### 200 The year was already closed: the stored close.

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

#### 201 The year is closed.

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

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