Search index appears after first production build.

Developers and integration teams

API Reference

Integration guide for current Firebase callable functions used by DecoDocs clients.

About this documentation

  • Official product documentation for DecoDocs (operated by Snap Sign Pty Ltd).
  • Written for end users, evaluators, and integration teams.
  • For support or to request corrections, use the footer support links or email support@decodocs.com.
  • DecoDocs provides informational analysis and is not legal advice.

Integration model

The production app uses Firebase callable functions, not a public API key-based REST platform.

  • Authentication: Firebase Auth ID token
  • Transport: Firebase callable functions (httpsCallable)
  • Server enforces entitlements, budgets, and OCR gating

Primary callables

These functions cover the normal analyze flow and type-aware analysis path.

  • analyzeText: main document analysis
  • explainSelection: clause-level explanation
  • highlightRisks: focused risk extraction
  • translateToPlainEnglish: legal-to-plain rewrite
  • analyzeByType: type-aware checks using validation criteria

Document type pipeline endpoints

Use these calls when your UI supports detected type display and user override.

  • detectDocumentType: detect intake category and suggested type
  • getDocumentTypeState: fetch detected + overridden type
  • saveDocTypeOverride: persist user-confirmed type

Client-side callable example

This pattern mirrors production usage and keeps auth + quota enforcement on the server.

import { getFunctions, httpsCallable } from "firebase/functions";

const functions = getFunctions();
const analyzeText = httpsCallable(functions, "analyzeText");

const result = await analyzeText({
  docHash: "sha256:...",
  stats: { pageCount: 8, totalChars: 14500 },
  text: { value: extractedText },
});

if (!result.data?.ok) {
  // Handle structured denial or error response
}

Error handling and limits

Design client UX for entitlement gates so users always get a clear next action.

  • invalid-argument: missing or malformed payload
  • unauthenticated: sign-in required
  • permission-denied: tier or role does not allow this action
  • resource-exhausted: token budget reached for current tier