Reason tables

Reason tables

The approved wording for why a model decided against someone, drafted, approved and kept by version, and the draft reasons each decision record draws with it.

A reason table says, for each input of a model, what a person is told when that input pushed the decision against them, and which inputs must never be given as a reason. With one in force, the record of a decision that went against the person carries its draft reasons: the approved wording for the strongest pushes toward the adverse outcome, and the inputs held for a person to review. Adverse action reasons describes it for compliance teams.

A model has at most one draft, which changes nothing. Approving it gives it the next version number and puts it in force; an approved version is never edited, and approving its successor retires it. Retired versions are kept: each decision's reasons are drawn with the version that was in force when the decision was made.

The wording is yours. Kaimei stores it and applies it; it does not write it, and a table does not make a notice compliant.

#The Reason table object

coverage says whether every input has been decided on: given wording, or put on the never-state list. An undecided input that pushes toward the adverse outcome is held for review on a decision's record.

Attributes

idstring
rt_ identifier.
model_idstring

The model it is for. model repeats its name, slug and version.

versioninteger | null

1, 2, … once approved. null for a draft.

statusstring
draft, approved (in force) or retired.
adverseobject

Which way is against the person: {outcome}, one of the model's labels, for a model that decides; {direction: "higher" | "lower"} for one that predicts a number.

max_reasonsinteger

Reasons a decision is given, at most. 1 to 10; 4 unless you say otherwise.

entriesobject

Input name → {reason, code}: the approved wording, and your own code for it when your notices use one.

never_stateobject

Input name → why it is never given as a reason (may be empty).

notestring | null

What changed in this version.

coverageobject
{inputs, with_reason, never_state, unmapped, not_inputs, complete}. unmapped names the inputs with neither wording nor a place on the never-state list; not_inputs names entries that are no longer inputs of the model.
content_hashstring

SHA-256 of what the table says. A decision's reasons cite it.

drafted_by / approved_byobject | null
{user_id, name, role} as they were at the time. Kept after the person has left.
created_at / updated_at / approved_at / retired_attimestamp | null

The reasons block of a decision record

tableobjectoptional
{id, version, status, content_hash, approved_at, approved_by}: the version the reasons were drawn with.
appliesbooleanoptional

Whether reasons were drawn: the decision's outcome is the adverse one, and its explanation is of named inputs. When false, sentence says why.

sentencestringoptional

The block in a sentence: how many reasons, and how many inputs are held.

reasonsarrayoptional
{feature, label, display, attribution, position, reason, code, features}, strongest first, at most max_reasons. Two inputs with the same wording are one reason, and features names both.
morearrayoptional

Approved reasons beyond the limit, in the same shape.

heldarrayoptional
{feature, label, attribution, why, sentence}: an input that pushed toward the adverse outcome and is unmapped (no approved wording) or never_state.
clearbooleanoptional

True when nothing is held.

notesarray of stringsoptional

That the reasons use a draft, that no table was approved when the decision was made, or that the explanation cannot be reproduced exactly.

The Reason table object
{
  "object": "reason_table",
  "id": "rt_4f1d2c9a8b7e6d5c4b3a",
  "model_id": "mdl_390bd6d9568f626851ef",
  "model": {
    "id": "mdl_390bd6d9568f626851ef",
    "name": "Credit risk scorer",
    "slug": "credit-risk-v3",
    "version": "3"
  },
  "version": 1,
  "status": "approved",
  "adverse": {"outcome": "decline"},
  "max_reasons": 4,
  "entries": {
    "debt_to_income": {
      "reason": "Excessive obligations in relation to income"
    },
    "num_delinquencies": {
      "reason": "Delinquent past or present credit obligations with others"
    },
    "credit_score": {"reason": "Credit score"},
    "employment_years": {"reason": "Length of employment"}
  },
  "never_state": {
    "age": "a prohibited basis under the Equal Credit Opportunity Act"
  },
  "note": "First wording, from compliance.",
  "coverage": {
    "inputs": 9,
    "with_reason": 4,
    "never_state": 1,
    "unmapped": [
      "income", "utilization", "loan_amount", "home_ownership"
    ],
    "not_inputs": [],
    "complete": false
  },
  "content_hash": "cc8b52cfa73b91874fe37c9db825c350ec9c30dc360945ee0972eace8b70045c",
  "drafted_by": {"name": "Mona Member", "role": "member"},
  "approved_by": {"name": "Riley Counsel", "role": "reviewer"},
  "created_at": "2026-10-01T09:30:00.000000Z",
  "updated_at": "2026-10-01T09:30:00.000000Z",
  "approved_at": "2026-10-01T09:30:00.000000Z",
  "retired_at": null
}

#Save a model's draft

PUT/v1/reason-tables/draftAPI key or session

Create the model's draft, or replace what it says. The version in force is not touched. Members, reviewers, admins and owners may draft.

Every name must be an input of the model that holds one value (a number, a category, a flag): 400 unknown_feature otherwise. An input has wording or is never stated, not both (400 invalid_reason). adverse.outcome must be one of the model's labels, and a model that predicts a number takes adverse.direction (400 invalid_adverse_outcome). A model that reads only a picture, a text, a series or a tensor has no inputs to give wording for (422 reason_table_not_applicable).

Body parameters

modelstringrequired

Model id or slug.

adverseobjectrequired
{outcome} or {direction}.
entriesobjectoptional

Input name → {reason, code}. reason up to 240 characters.

never_stateobjectoptional

Input name → why (may be empty).

max_reasonsintegeroptionaldefault 4

1 to 10.

notestringoptional

What changed, up to 500 characters.

Returns

The draft Reason table.
draft = client.reason_tables.save_draft(
    "credit-risk-v3",
    adverse_outcome="decline",
    entries={
        "debt_to_income": "Excessive obligations in relation to income",
        "num_delinquencies": "Delinquent past or present credit obligations with others",
        "credit_score": "Credit score",
        "employment_years": "Length of employment",
    },
    never_state={"age": "a prohibited basis"},
    note="First wording, from compliance.",
)
print(draft.coverage.unmapped)   # inputs still to decide on
curl -X PUT https://api.kaimei.ai/v1/reason-tables/draft \
  -H "Authorization: Bearer $KAIMEI_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{'model': 'credit-risk-v3', 'adverse': {'outcome': 'decline'}, 'entries': {'debt_to_income': {'reason': 'Excessive obligations in relation to income'}, 'credit_score': {'reason': 'Credit score'}}, 'never_state': {'age': 'a prohibited basis'}}'
200 OKResponse
{
  "object": "reason_table",
  "id": "rt_9c8b7a6d5e4f3a2b1c0d",
  "model_id": "mdl_390bd6d9568f626851ef",
  "model": {
    "id": "mdl_390bd6d9568f626851ef",
    "name": "Credit risk scorer",
    "slug": "credit-risk-v3",
    "version": "3"
  },
  "version": null,
  "status": "draft",
  "adverse": {"outcome": "decline"},
  "max_reasons": 4,
  "entries": {
    "debt_to_income": {
      "reason": "Excessive obligations in relation to income"
    },
    "num_delinquencies": {
      "reason": "Delinquent past or present credit obligations with others"
    },
    "credit_score": {"reason": "Credit score"},
    "employment_years": {"reason": "Length of employment"}
  },
  "never_state": {
    "age": "a prohibited basis under the Equal Credit Opportunity Act"
  },
  "note": "First wording, from compliance.",
  "coverage": {
    "inputs": 9,
    "with_reason": 4,
    "never_state": 1,
    "unmapped": [
      "income", "utilization", "loan_amount", "home_ownership"
    ],
    "not_inputs": [],
    "complete": false
  },
  "content_hash": "cc8b52cfa73b91874fe37c9db825c350ec9c30dc360945ee0972eace8b70045c",
  "drafted_by": {"name": "Mona Member", "role": "member"},
  "approved_by": null,
  "created_at": "2026-10-01T09:30:00.000000Z",
  "updated_at": "2026-10-01T09:30:00.000000Z",
  "approved_at": null,
  "retired_at": null
}

#Approve a draft

POST/v1/reason-tables/{table_id}/approveSession token only

Put a draft in force. It takes the next version number; the version before it is retired and kept. Decisions made from now on draw their reasons with it.

Takes a signed-in reviewer, admin or owner: the table records who approved it. A member is refused (403 approver_required) and so is an API key (403 user_session_required). A table that is not a draft is 409 reason_table_not_draft, and a draft with no wording at all is 422 reason_table_empty.

Path parameters

table_idstringrequired

The draft's id.

Returns

The Reason table, now approved.
curl -X POST https://api.kaimei.ai/v1/reason-tables/rt_9c8b7a6d5e4f3a2b1c0d/approve \
  -H "Authorization: Bearer $SESSION_TOKEN"
200 OKResponse
{
  "object": "reason_table",
  "id": "rt_4f1d2c9a8b7e6d5c4b3a",
  "model_id": "mdl_390bd6d9568f626851ef",
  "model": {
    "id": "mdl_390bd6d9568f626851ef",
    "name": "Credit risk scorer",
    "slug": "credit-risk-v3",
    "version": "3"
  },
  "version": 1,
  "status": "approved",
  "adverse": {"outcome": "decline"},
  "max_reasons": 4,
  "entries": {
    "debt_to_income": {
      "reason": "Excessive obligations in relation to income"
    },
    "num_delinquencies": {
      "reason": "Delinquent past or present credit obligations with others"
    },
    "credit_score": {"reason": "Credit score"},
    "employment_years": {"reason": "Length of employment"}
  },
  "never_state": {
    "age": "a prohibited basis under the Equal Credit Opportunity Act"
  },
  "note": "First wording, from compliance.",
  "coverage": {
    "inputs": 9,
    "with_reason": 4,
    "never_state": 1,
    "unmapped": [
      "income", "utilization", "loan_amount", "home_ownership"
    ],
    "not_inputs": [],
    "complete": false
  },
  "content_hash": "cc8b52cfa73b91874fe37c9db825c350ec9c30dc360945ee0972eace8b70045c",
  "drafted_by": {"name": "Mona Member", "role": "member"},
  "approved_by": {"name": "Riley Counsel", "role": "reviewer"},
  "created_at": "2026-10-01T09:30:00.000000Z",
  "updated_at": "2026-10-01T09:30:00.000000Z",
  "approved_at": "2026-10-01T09:30:00.000000Z",
  "retired_at": null
}
200 OKa declined decision's reasons, drawn with it
{
  "table": {
    "id": "rt_4f1d2c9a8b7e6d5c4b3a",
    "version": 1,
    "status": "retired",
    "content_hash": "cc8b52cfa73b91874fe37c9db825c350ec9c30dc360945ee0972eace8b70045c",
    "approved_at": "2026-10-01T09:30:00.000000Z",
    "approved_by": {"name": "Riley Counsel", "role": "reviewer"}
  },
  "adverse": {"outcome": "decline"},
  "applies": true,
  "sentence": "4 draft reasons for decline, strongest first. 2 inputs are held for review before these can be used.",
  "reasons": [
    {
      "feature": "debt_to_income",
      "label": "Total monthly debt / monthly income",
      "display": "0.38",
      "attribution": 0.07970604262568466,
      "position": 1,
      "reason": "Excessive obligations in relation to income",
      "code": null,
      "features": ["debt_to_income"]
    },
    {
      "feature": "num_delinquencies",
      "label": "Delinquencies in the last 24 months",
      "display": "1",
      "attribution": 0.07483986997713922,
      "position": 2,
      "reason": "Delinquent past or present credit obligations with others",
      "code": null,
      "features": ["num_delinquencies"]
    },
    …
  ],
  "more": [],
  "held": [
    {
      "feature": "home_ownership",
      "label": "Housing status",
      "display": "rent",
      "attribution": 0.0457483647176272,
      "position": 3,
      "why": "unmapped",
      "sentence": "Housing status pushed toward decline and has no approved reason. Hold for review."
    },
    …
  ],
  "clear": false,
  "notes": [],
  "notice": "Draft reasons, drawn from the model's explanation with wording your organization approved. They cover the model's part of the decision only. Whether they meet a notice requirement is for counsel."
}

#List reason tables

GET/v1/reason-tablesAPI key or session

Versions of reason tables, most recently changed first: every model's, or one model's.

Query parameters

modelstringoptional

Model id or slug.

statusstringoptional
draft, approved or retired. approved gives the versions in force, one for each model that has one.
limitintegeroptionaldefault 50

1 to 200.

offsetintegeroptionaldefault 0

Returns

A page of Reason tables.
in_force = client.reason_tables.in_force("credit-risk-v3")     # or None
draft = client.reason_tables.draft("credit-risk-v3")           # or None
for table in client.reason_tables.iterate(model="credit-risk-v3"):
    print(table.version, table.status, table.note)
curl "https://api.kaimei.ai/v1/reason-tables?model=credit-risk-v3&status=approved" \
  -H "Authorization: Bearer $KAIMEI_API_KEY"
200 OKResponse
{
  "object": "list",
  "data": [
    {
      "object": "reason_table",
      "id": "rt_4f1d2c9a8b7e6d5c4b3a",
      "model_id": "mdl_390bd6d9568f626851ef",
      "model": {
        "id": "mdl_390bd6d9568f626851ef",
        "name": "Credit risk scorer",
        "slug": "credit-risk-v3",
        "version": "3"
      },
      "version": 1,
      "status": "approved",
      "adverse": {"outcome": "decline"},
      "max_reasons": 4,
      "entries": {
        "debt_to_income": {
          "reason": "Excessive obligations in relation to income"
        },
        "num_delinquencies": {
          "reason": "Delinquent past or present credit obligations with others"
        },
        "credit_score": {"reason": "Credit score"},
        "employment_years": {"reason": "Length of employment"}
      },
      "never_state": {
        "age": "a prohibited basis under the Equal Credit Opportunity Act"
      },
      "note": "First wording, from compliance.",
      "coverage": {
        "inputs": 9,
        "with_reason": 4,
        "never_state": 1,
        "unmapped": [
          "income", "utilization", "loan_amount",
          "home_ownership"
        ],
        "not_inputs": [],
        "complete": false
      },
      "content_hash": "cc8b52cfa73b91874fe37c9db825c350ec9c30dc360945ee0972eace8b70045c",
      "drafted_by": {"name": "Mona Member", "role": "member"},
      "approved_by": {
        "name": "Riley Counsel",
        "role": "reviewer"
      },
      "created_at": "2026-10-01T09:30:00.000000Z",
      "updated_at": "2026-10-01T09:30:00.000000Z",
      "approved_at": "2026-10-01T09:30:00.000000Z",
      "retired_at": null
    }
  ],
  "total": 1,
  "limit": 50,
  "offset": 0,
  "has_more": false
}

#Retrieve a reason table

GET/v1/reason-tables/{table_id}API key or session

One version by id.

Path parameters

table_idstringrequired

Returns

A Reason table.
table = client.reason_tables.retrieve("rt_4f1d2c9a8b7e6d5c4b3a")
curl https://api.kaimei.ai/v1/reason-tables/rt_4f1d2c9a8b7e6d5c4b3a \
  -H "Authorization: Bearer $KAIMEI_API_KEY"
200 OKResponse
{
  "object": "reason_table",
  "id": "rt_4f1d2c9a8b7e6d5c4b3a",
  "model_id": "mdl_390bd6d9568f626851ef",
  "model": {
    "id": "mdl_390bd6d9568f626851ef",
    "name": "Credit risk scorer",
    "slug": "credit-risk-v3",
    "version": "3"
  },
  "version": 1,
  "status": "approved",
  "adverse": {"outcome": "decline"},
  "max_reasons": 4,
  "entries": {
    "debt_to_income": {
      "reason": "Excessive obligations in relation to income"
    },
    "num_delinquencies": {
      "reason": "Delinquent past or present credit obligations with others"
    },
    "credit_score": {"reason": "Credit score"},
    "employment_years": {"reason": "Length of employment"}
  },
  "never_state": {
    "age": "a prohibited basis under the Equal Credit Opportunity Act"
  },
  "note": "First wording, from compliance.",
  "coverage": {
    "inputs": 9,
    "with_reason": 4,
    "never_state": 1,
    "unmapped": [
      "income", "utilization", "loan_amount", "home_ownership"
    ],
    "not_inputs": [],
    "complete": false
  },
  "content_hash": "cc8b52cfa73b91874fe37c9db825c350ec9c30dc360945ee0972eace8b70045c",
  "drafted_by": {"name": "Mona Member", "role": "member"},
  "approved_by": {"name": "Riley Counsel", "role": "reviewer"},
  "created_at": "2026-10-01T09:30:00.000000Z",
  "updated_at": "2026-10-01T09:30:00.000000Z",
  "approved_at": "2026-10-01T09:30:00.000000Z",
  "retired_at": null
}

#Discard a draft

DELETE/v1/reason-tables/{table_id}API key or session

Delete a draft. An approved or retired version is part of the record and cannot be deleted (409 reason_table_not_draft).

Path parameters

table_idstringrequired

The draft's id.

Returns

A deletion marker.
client.reason_tables.discard("rt_9c8b7a6d5e4f3a2b1c0d")
curl -X DELETE https://api.kaimei.ai/v1/reason-tables/rt_9c8b7a6d5e4f3a2b1c0d \
  -H "Authorization: Bearer $KAIMEI_API_KEY"
200 OKResponse
{
  "id": "rt_9c8b7a6d5e4f3a2b1c0d",
  "object": "reason_table",
  "deleted": true
}