API

EDI Agent AI exposes a REST API secured by your session cookie and scoped to your organization. Every request is authenticated, authorized, and validated with Zod. Responses follow a consistent envelope:

{
  "success": true,
  "data": { }
}
{
  "success": false,
  "error": {
    "code": "ANALYSIS_FAILED",
    "message": "..."
  }
}

Endpoints

POST
/api/analysesUpload EDI content and run the full parse → detect → validate → AI pipeline.
GET
/api/analyses/:idGet an analysis's status, detection result and counts.
POST
/api/analyses/:id/runRe-run the pipeline for an existing analysis.
GET
/api/analyses/:id/segmentsPaginated list of parsed segments.
GET
/api/analyses/:id/errorsDeterministic validation findings.
GET
/api/analyses/:id/error-analysisAI Error Agent output, grounded in the deterministic findings.
POST
/api/analyses/:id/validateRe-run deterministic validation from stored segments.
POST
/api/analyses/:id/chatAsk the AI Explanation Agent a question about this file.
POST
/api/analyses/:id/reportGenerate a PDF, JSON or CSV report.
POST
/api/mappingsCreate a mapping project for an analysis.
POST
/api/mappings/:id/generateGenerate/regenerate AI mapping suggestions.
GET
/api/mappings/:idGet a mapping and its rules.
PATCH
/api/mapping-rules/:idApprove, reject or edit a mapping rule.
GET
/api/usageCurrent plan and usage for your organization.

Coming in v1: a public, API-key authenticated surface

A versioned, API-key authenticated surface (/v1/detect, /v1/analyze, /v1/validate, /v1/map) is planned for Business/Enterprise plans. The current session-authenticated API above is available today.