API referenceScore

calibrate

POST /v1/calibrate fits a scoring model to labeled records, and can add or remove its questions.

Up to 10 calibrations per scoring model per day. See Calibration and Changing questions.

POST
/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. Creating one from labeled records is its first calibration.

Returns 202 with a job_id; score calls after the job 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.

Request body

application/json or multipart/form-data

FieldTypeDescription
model_idrequiredstring

The scoring model to calibrate.

datarequiredarray of object or string

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 for creating. They must match the scoring model's schema, if it has one.

add_questionsarray 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 adds them without calibrating.

remove_questionsarray of string

Optional. The ids of questions to stop using, from get_model. A removed question isn't asked or tried again.

Responses

The calibration is running.

FieldTypeDescription
job_idstring

The calibration's job, job_….

rowsinteger

The labeled records used.

request_idstring

req_…, the same as the X-Request-Id header.

Examples

Example Request
curl -X POST 'https://api.finic.ai/v1/calibrate' \  -H "Authorization: Bearer $FINIC_API_KEY" \  -H 'Content-Type: application/json' \  -d '{  "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"  ]}'
Example Response
{  "job_id": "job_01M4YY4AZRJ8NR5QFRW628CJ5G",  "rows": 1800,  "request_id": "req_01M4YPJNK0SZGEQS0A76EEND4N"}