# Evaluate a deal against an underwriting rule set

Runs the machine over a deal's scorecard and answers the NEW version's rows. It mints version n+1, COPIES every answer from version n into it (nothing in n is ever touched), adds a pending row for any active criterion the template has gained since, then answers the criteria this service can decide by itself — leaving alone any a person has already decided. Reach for it after new documents land; a person's own answers are saved with `put_definitions_key_underwriting_id_criteria` instead. Deals page only.

Access class: `def:read`.

## Endpoint

`POST /v1/definitions/{key}/underwriting/{id}/evaluate`

## Parameters

| Name | In | Type | Required |
| --- | --- | --- | --- |
| key | path | string | Yes |
| id | path | string | Yes |

## Request body

Content type: `application/json`.

```json
{
  "body": {},
  "params": {
    ":id": "string",
    ":key": "string"
  },
  "query": {}
}
```

## Responses

### 201

the action's answer

Content type: `application/json`.

```json
{
  "data": [
    {
      "criterion": {
        "active": "string",
        "autoSource": "string",
        "category": "string",
        "comparison": "string",
        "createdAt": "string",
        "id": "",
        "key": "string",
        "label": "string",
        "sortOrder": "string",
        "threshold": "string",
        "updatedAt": "string",
        "valueKind": "string"
      },
      "criterionId": 1,
      "evaluatedAt": "string",
      "evaluatedBy": 1,
      "evidence": "string",
      "id": 1,
      "note": "string",
      "numericValue": 1.5,
      "source": "string",
      "status": "string",
      "version": 1
    }
  ]
}
```

### default

a refusal: `{"error": "<what a person needs to read>"}`. 401 no credential, 402 the plan does not include this, 403 the seat does not, 404 the thing does not exist or is not yours to see.

Content type: `application/json`.

```json
{
  "error": "string"
}
```
