Developer Resources

This page describes NEPAWorks APIs for programmatic interaction with the platform. Examples intentionally omit any Supabase URL/keys. If you need credentials, request them from your NEPAWorks administrator.

Base URL And Auth

Replace CEWORKS_BASE_URL with your deployment host. For authenticated endpoints, provide an access token via Authorization: Bearer ...or use an existing browser session cookie.

# Set these in your environment
export CEWORKS_BASE_URL="https://<your-ceworks-host>"
export ACCESS_TOKEN="<request-from-admin>"

# Example: authenticated GET with bearer token
curl -sS \
  -H "Authorization: Bearer $ACCESS_TOKEN" \
  "$CEWORKS_BASE_URL/api/v1/projects/35" | jq

Public Reference Data

Use this endpoint when you need the current organization/process model/decision element/legal structure configuration without authentication or Supabase access.

# Summary (default): smaller payload, excludes large form configuration blobs
curl -sS "$CEWORKS_BASE_URL/api/public/reference-data" | jq

# Full: includes decision_element.form_data and other large config fields
curl -sS "$CEWORKS_BASE_URL/api/public/reference-data?scope=full" | jq

Notes: this is static, non-sensitive configuration. Any UID-like fields are removed from the response.

Initiate A Project (Decision Element 1)

This creates a project, an active process_instance, records completion of decision element 1, and stores a process_decision_payload for it. The response includes IDs and (when available) the next pending task.

curl -sS \
  -X POST \
  -H "Authorization: Bearer $ACCESS_TOKEN" \
  -H "Content-Type: application/json" \
  "$CEWORKS_BASE_URL/api/v1/projects/initiate" \
  -d '{
    "project": {
      "title": "API-initiated project",
      "description": "Created via /api/v1/projects/initiate",
      "lead_agency": "BLM Moab Field Office",
      "sector": "Land management",
      "type": "Habitat restoration",
      "location_text": "Moab, UT",
      "location": {
        "geojson": "{"type":"Point","coordinates":[-109.5498,38.5733]}",
        "latitude": 38.5733,
        "longitude": -109.5498
      }
    },
    "evaluationData": {
      "title": "API-initiated project",
      "description": "Created via /api/v1/projects/initiate",
      "lead_agency": "BLM Moab Field Office",
      "location_text": "Moab, UT",
      "sector": "Land management",
      "type": "Habitat restoration"
    }
  }' | jq

Tip: if you want the exact expected shape for decision element 1, call the public reference endpoint with scope=fulland inspect decisionElements[].form_data for the decision element with internal reference 1.

Retrieve Project And Workflow Data

These endpoints require authentication. Responses are redacted to avoid returning user UIDs.

# Project record
curl -sS -H "Authorization: Bearer $ACCESS_TOKEN" \
  "$CEWORKS_BASE_URL/api/v1/projects/35" | jq

# Process instances for a project
curl -sS -H "Authorization: Bearer $ACCESS_TOKEN" \
  "$CEWORKS_BASE_URL/api/v1/projects/35/process-instances" | jq

# Decision payloads for a project
curl -sS -H "Authorization: Bearer $ACCESS_TOKEN" \
  "$CEWORKS_BASE_URL/api/v1/projects/35/decision-payloads" | jq

# Case events (tasks, milestones, etc.) for a process instance
curl -sS -H "Authorization: Bearer $ACCESS_TOKEN" \
  "$CEWORKS_BASE_URL/api/v1/process-instances/12/case-events" | jq

Retrieve Documents

NEPAWorks can generate a project PDF. This endpoint is authenticated and returns application/pdf.

# Download a PDF for a project (example)
curl -L \
  -H "Authorization: Bearer $ACCESS_TOKEN" \
  -o project-35.pdf \
  "$CEWORKS_BASE_URL/api/project/35/pdf"

If your workflow uses external document portals (e.g., HedgeDoc), those URLs are stored in workflow configuration and can be discovered via reference data.

Workflow Routing APIs

These endpoints support NEPA child-process routing and rejected end-gate handling.

# Route NEPA workflow and optionally inherit prior-process documents
curl -sS \
  -X POST \
  -H "Authorization: Bearer $ACCESS_TOKEN" \
  -H "Content-Type: application/json" \
  "$CEWORKS_BASE_URL/api/workflow/nepa-route" \
  -d '{
    "projectId": 35,
    "parentProcessId": 12,
    "decisionElementId": 12,
    "nepaLevel": 4,
    "inheritDocuments": true,
    "inheritMode": "inherit"
  }' | jq

# Handle rejected end-gate follow-up action
curl -sS \
  -X POST \
  -H "Authorization: Bearer $ACCESS_TOKEN" \
  -H "Content-Type: application/json" \
  "$CEWORKS_BASE_URL/api/workflow/end-gate-action" \
  -d '{
    "processId": 44,
    "reopenParent": true
  }' | jq