# Replace a filing

Source: https://amanucci.com/fr/docs/developers/api/filings/replaceFiling

## POST /v1/entities/{entityId}/filings/{filingId}/replace

Replace a filing

The replacement return (vervangende aangifte): the live filing is superseded and a new one generated from the same locked period, in ONE transaction. When the replaced filing was acknowledged by the state, the new payload names its declaration. Use it before the deadline; an error found after the deadline is corrected in the next period's return through the ledger, never here.

Operation ID: `replaceFiling`

### Parameters

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

### Request body

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

### Responses

#### 200 Duplicate-ok: this id already named the replacement.

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

#### 201 The replacement filing.

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

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