Talk with Archie
API reference › Utility
Skills › Utility

Enrich a Trial Balance With Auto-Renumber + Classification

POST/api/v1/skills/enrich.tb.rows/invoke
Prepares trial balance rows for use. Pass the tb_rows, and the coa_rows if you have them so each account's type can be looked up. Each row comes back with a classification, its original_code, any auto_assigned_code and a drop_reason; accounts without a code are numbered by account type and zero-balance rows are dropped.
Body parameters
tb_rowsarray of objects
Trial balance rows to enrich, each with code, name, section, debit and credit (amounts as numbers).
coa_rowsarray of objects
Chart of accounts rows used to look up each account's type, each with account_id, code, name, type and balance.
Returns

Skill executed successfully

skillstringRequired
Example enrich_tb_rows
outputobjectRequired
Envelope for enrich_tb_rows output — same dict shape as input rows with added classification / original_code / auto_assigned_code / drop_reason keys.
output.stub_fieldsarray of strings
output.warningsarray of strings
output.rowsarray of objects
correlation_idstringRequired
Errors
StatusTypeWhen
401AUTH.TOKEN_INVALIDAuthentication required
403PERMISSION.CAPABILITY_DENIEDInsufficient permissions
404SKILL.NOT_FOUNDSkill not found
422VALIDATION.INVALID_FORMATValidation error
429RATE_LIMIT.USERRate limit exceeded
5XXINTERNAL.UNKNOWNInternal server error
curl https://uk.heyarchie.com/api/v1/skills/enrich.tb.rows/invoke \
  -X POST \
  -H "Authorization: Bearer sk_..." \
  -H "Content-Type: application/json" \
  -d '{
       "tb_rows": [
         {}
       ],
       "coa_rows": [
         {}
       ]
     }'
from heyarchie import Archie
archie = Archie(api_key="sk_...")
result = archie.skills.invoke(
    "enrich.tb.rows",
    tb_rows=[{}],
    coa_rows=[{}],
)
print(result)
import { Archie } from "heyarchie";

const archie = new Archie({ apiKey: "sk_..." });
const result = await archie.skills.invoke("enrich.tb.rows", {
  "tb_rows": [
    {}
  ],
  "coa_rows": [
    {}
  ]
});
console.log(result);
Response
{
  "skill": "enrich_tb_rows",
  "output": {
    "rows": [
      {
        "classification": "ok",
        "code": "1200",
        "credit": 0,
        "debit": 96250,
        "drop_reason": null,
        "name": "Bank current account",
        "original_code": "1200",
        "section": "Assets"
      },
      {
        "auto_assigned_code": "1500",
        "classification": "auto_renumbered",
        "code": "1500",
        "credit": 0,
        "debit": 4800,
        "drop_reason": null,
        "name": "Office equipment",
        "original_code": "",
        "section": "Assets"
      },
      {
        "classification": "dropped",
        "code": "2900",
        "credit": 0,
        "debit": 0,
        "drop_reason": "zero_balance",
        "name": "Old suspense",
        "original_code": "2900",
        "section": "Liabilities"
      }
    ]
  },
  "correlation_id": "<string>"
}
{
  "error": {
    "type": "<string>",
    "code": "<string>",
    "message": "<string>",
    "param": "<string>",
    "retry_after_seconds": "<integer>"
  }
}
{
  "error": {
    "type": "<string>",
    "code": "<string>",
    "message": "<string>",
    "param": "<string>",
    "retry_after_seconds": "<integer>"
  }
}
{
  "error": {
    "type": "<string>",
    "code": "<string>",
    "message": "<string>",
    "param": "<string>",
    "retry_after_seconds": "<integer>"
  }
}

Every response also carries X-Request-ID. Quote it if you write to us about a call.