# Look up a contractor's debts

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

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

Look up a contractor's debts

Ask the RSZ's BillRetainment service about a contractor on a day and record its answer under `system:billretainment`. The live connector needs credentials the RSZ grants on request and is not built: until then this answers 503 `debt_check_unavailable`, and a person records the check by hand. 422 `debt_check_number_missing` when the contractor has no enterprise number.

Operation ID: `lookupContractorDebtCheck`

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

### Responses

#### 200 Duplicate-ok: the same answer was already recorded.

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

#### 201 The service's answer, 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"
    }
  }
}
```
