get_job_status

GET /v1/jobs/{job_id} says whether creating or calibrating a score has finished, and why it failed if it did.

Creating and calibrating a score run as jobs.

GET
/v1/jobs/{job_id}

Whether creating or calibrating a score has finished. It doesn't report progress: check every 30 seconds or so until complete is true. Not counted toward the request rate.

Path parameters

FieldTypeDescription
job_idrequiredstring

The job_id from creating or calibrating a score.

Responses

complete is true once the job has finished, whether it succeeded or failed. Complete without an error means the score is ready, or its calibration is in use. A failed creation leaves the score unusable (create a new one); a failed calibration leaves the score as it was.

FieldTypeDescription
job_idstring

The job's id

completeboolean

Whether the job has finished.

errorobject

Only when the job failed.

Only when the job failed.

FieldTypeDescription
typestring
  • job_interrupted: maintenance interrupted creating the score. Send the same data to POST /v1/scores again.
  • internal_error: something failed on Finic's side. Create the score, or send the outcomes, again.
  • unavailable: creating scores isn't available right now. Try again later.
  • conflict: the score changed during the calibration. Send the outcomes again.
messagestring

What to do.

Examples

Example Request
curl -X GET 'https://api.finic.ai/v1/jobs/string' \  -H "Authorization: Bearer $FINIC_API_KEY"
Example Response
{  "job_id": "job_01M4XZXNCRZBPXV30MSF7RN5H3",  "complete": true}

Waiting for a job

import os
import time

import requests


def wait_for_job(job_id: str) -> None:
    while True:
        r = requests.get(f"https://api.finic.ai/v1/jobs/{job_id}",
                         headers={"Authorization": f"Bearer {os.environ['FINIC_API_KEY']}"}, timeout=30)
        r.raise_for_status()
        job = r.json()
        if job["complete"]:
            if "error" in job:
                raise RuntimeError(f"{job['error']['type']}: {job['error']['message']}")
            return
        time.sleep(30)

On this page