Skip to main content
Version: 1.5.0

Document extract (Huginn)

Overview​

Huginn reads companies with extract enabled, downloads eligible Tower deposits, runs OCR, and writes business fields (displayLabel, auto-attributes) without changing the Box active upload target.

How it works​

  1. Extract agent token → companies with flags.extract.enabled (or one company for a company token).
  2. Eligible listing uses enrich folder filters (targetAutoAttributes, displayedCodes) and extract.prompt.
  3. POST /documents/:id/download-session returns a presigned GetObject from flags.extract.storageConfig (named upload config).
  4. PATCH /documents/:id/extract writes fields; batches are recorded for reporting.

Key files​

  • src/domains/company/extract*.ts — config, eligible, batches
  • src/domains/document/extract-storage.ts — S3 GetObject presign
  • src/domains/document/document.service.ts — download-session, extract write
  • Huginn worker (separate repo)

Technical decisions​

flags.extract is opt-in plus storage read. Prompt and field set live on the enrich folder. Extract ignores drafts.