# Record a contractor's debt check

Source: https://amanucci.com/fr/docs/developers/api/settings/recordContractorDebtCheck

## POST /v1/entities/{entityId}/contractor-debt-checks

Record a contractor's debt check

Record what the public databases showed about a contractor's debts on a day: the RSZ part, the RSVZ part and the FPS part, each `debt`, `no_debt` or `not_in_domain`, an attest's debt beside `debt`, and the evidence the person saw. The person is the row's actor. Append-only: the same content again is 200, other content on the same day is 409 `debt_check_conflict`. 422 `debt_check_invalid` names the refusal; 404 `debt_check_party_not_found` / `debt_check_evidence_not_found` for another entity's.

Operation ID: `recordContractorDebtCheck`

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

### Responses

#### 200 Duplicate-ok: this exact check was already recorded.

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

#### 201 The check, recorded.

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

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