# Keep one of an invoice's files

Source: https://amanucci.com/docs/developers/api/documents/keepDocumentFile

## POST /v1/entities/{entityId}/documents/{documentId}/keep-file

Keep one of an invoice's files

Keep one of a received invoice's files from the document itself ( (q),): `artifactId` names the contested file you decide on, `keep` whether that file is used (`file`: its reading becomes the document's, and a booked document's entry is reversed and re-posted) or what the document shows is kept (`standing`: the file is set aside). The door finds the file's live `duplicate_document` case and keeps through it, answering and refusing as `keepDocument` does (`keep_needs_check`, `case_not_correctable`). 409: a file the document does not hold, or one never in doubt, is `document_not_in_case`; one another person already decided is `case_terminal`, one a booking settled `case_booked_from_file`. The firm's alone: a firm seat holding `ledger.manage`, a client seat 403 `authority-required`; `getDocument`'s `acts` carry `keep` exactly where this door admits the caller. Not a signed act. A case the Assembler closed because its document was booked from another of its files (a scan's gate case its e-invoice booked) is 409 `case_booked_from_file`, in words naming the kind of file it was booked from.

Operation ID: `keepDocumentFile`

### Parameters

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

### Request body

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

### Responses

#### 200 One file is kept; its case, resolved.

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

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