# calibrate (/reference/score/calibrate)



Up to 10 calibrations per scoring model per day. See [Calibration](/score-model/calibration#calibrate-a-scoring-model) and [Changing questions](/score-model#changing-questions).

## POST https://api.finic.ai/v1/calibrate

Fits a scoring model to labeled records: past records with the fields of the records it scores, each with `is_bad`. Grayson answers all the scoring model's questions, and yours, for every record, and Finic chooses again which to use and how much each counts. It can add and remove questions too.

A scoring model's first calibration, for one created from its criteria alone, also has Finic write its questions from the records and gives it its [schema](/score-model#schema). Creating one from labeled records is its first calibration.

Returns `202` with a `job_id`; score calls after the [job](/reference/score/get-job-status) completes, in about two minutes, use the updated scoring model. One calibration at a time per scoring model. The records are kept encrypted only while the job runs, and deleted when it ends.

Authorization: `Bearer <API key>` (see [Authentication](/authentication)).

### Request body (application/json or multipart/form-data)

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `model_id` | string | yes | The scoring model to calibrate. |
| `data` | array of object or string | yes | Labeled records: a JSON array of objects, or CSV text with a header row, with the fields of the records the scoring model scores and `is_bad` (`true` when the outcome was bad, `false` when good; also `1`/`0`). At least 100 rows with 20 or more of each outcome; up to 2,000 are used, by the [rules](/score-model#labeled-records) for creating. They must match the scoring model's schema, if it has one. |
| `add_questions` | array of string |  | Optional. Your own yes/no questions to try; the scoring model uses the ones that help, and the others are listed as not used on its page in the Finic app. Up to 20 at a time, and 50 per scoring model. [add_questions](/reference/score/add-questions) adds them without calibrating. |
| `remove_questions` | array of string |  | Optional. The ids of questions to stop using, from [get_model](/reference/score/get-scoring-model). A removed question isn't asked or tried again. |

Example:

```json
{
  "model_id": "scm_01M4XRC000RT2GZSKYPD8J86G9",
  "data": [
    {
      "amount_usd": 2400,
      "merchant_category": "electronics",
      "account_age_days": 19,
      "new_device": true,
      "billing_country": "US",
      "ip_country": "NG",
      "is_bad": true
    },
    {
      "amount_usd": 58.12,
      "merchant_category": "grocery",
      "account_age_days": 1260,
      "new_device": false,
      "billing_country": "US",
      "ip_country": "US",
      "is_bad": false
    }
  ],
  "add_questions": [
    "Was the account opened less than a week before the payment?"
  ],
  "remove_questions": [
    "q022"
  ]
}
```

### Responses

- **202**: The calibration is running.

| Field | Type | Always | Description |
| --- | --- | --- | --- |
| `job_id` | string | yes | The calibration's job, `job_…`. |
| `rows` | integer | yes | The labeled records used. |
| `request_id` | string | yes | `req_…`, the same as the `X-Request-Id` header. |

```json
{
  "job_id": "job_01M4YY4AZRJ8NR5QFRW628CJ5G",
  "rows": 1800,
  "request_id": "req_01M4YPJNK0SZGEQS0A76EEND4N"
}
```

- **400**: - `invalid_request`: `model_id` or `data` is missing; a row breaks a rule (fewer than 100 rows or 20 of an outcome, a row without `is_bad`, …); a question in `add_questions` is blank, too long or already one of its questions; `remove_questions` names a question it doesn't have, or would leave none.
  - `schema_mismatch`: a row's fields differ from the scoring model's schema. The message lists them.

- **401**: `authentication_error`: the API key is missing, unknown, revoked or expired.

- **404**: `scoring_model_not_found`: no scoring model with this `model_id` in your organization.

- **409**: - `scoring_model_not_ready`: the scoring model is still being created, or creating it failed.
  - `scoring_model_archived`: the scoring model is archived. Unarchive it to calibrate it.
  - `calibration_in_progress`: a calibration is already running. Calibrate again when its job completes.

- **413**: `request_too_large`: over 2 MB, or the record is too large.

- **429**: `rate_limited`: 10 calibrations of this scoring model in the last 24 hours, or over the [request rate](/reference#rate-limits).
