Agent-readable docs index: /llms.txt. Full docs in one file: /llms-full.txt. Download /docs.zip to grep all markdown files locally.

Use eReport

eReport supports citizen complaint submission, administrative location datasets, OTP verification, and authenticated report retrieval.
Complaint records can contain sensitive citizen information. Protect integration tokens, view tokens, OTP data, and report payloads.

Authentication flow

Use eReport.generateToken to obtain an integration bearer token. OTP confirmation returns the X-EReport-View-Token required for listing or retrieving reports.

Initialize the client

Create a dedicated client for the documented eReport staging host:
import { createClient } from "egov.js"; const client = createClient({ baseUrl: "https://stg-ereport-ws.oueg.info", });

Methods

The examples below use this eReport client. See the quickstart for the general client pattern.
The API Reference tab remains the source of truth for complete parameters, schemas, responses, and cURL examples.

eReport.generateToken

POST /api/integration/token exchanges the integration access code in the request body for a bearer token.
import { eReport } from "egov.js"; const integration = await eReport.generateToken({ client, body: { access_code: reportAccessCode }, throwOnError: true, });

eReport.listReportTypes

GET /api/integration/datasets/report_types returns the report types available to an authenticated integration.
import { eReport } from "egov.js"; const reportTypes = await eReport.listReportTypes({ client, auth: integration.access_token, throwOnError: true, });

eReport.listRegions

GET /api/integration/datasets/regions returns the top-level administrative regions used by report forms.
import { eReport } from "egov.js"; const regions = await eReport.listRegions({ client, auth: integration.access_token, throwOnError: true, });

eReport.listProvinces

GET /api/integration/datasets/provinces returns provinces for the required region code.
import { eReport } from "egov.js"; const provinces = await eReport.listProvinces({ client, auth: integration.access_token, query: { region_code: "040000000" }, throwOnError: true, });

eReport.listMunicipalities

GET /api/integration/datasets/municipalities returns municipalities for the required province code.
import { eReport } from "egov.js"; const municipalities = await eReport.listMunicipalities({ client, auth: integration.access_token, query: { province_code: "042100000" }, throwOnError: true, });

eReport.listBarangays

GET /api/integration/datasets/barangays returns barangays for the required municipality code.
import { eReport } from "egov.js"; const barangays = await eReport.listBarangays({ client, auth: integration.access_token, query: { municipality_code: "042111000" }, throwOnError: true, });

eReport.submitComplaint

POST /api/integration/submit_complaint submits an authenticated citizen complaint and returns its case information.
import { eReport } from "egov.js"; const complaint = await eReport.submitComplaint({ client, auth: integration.access_token, body: { barangay_code: "042111001", complainant_email: "juan@example.gov.ph", first_name: "Juan", gender: "male", last_name: "Dela Cruz", message: "The streetlight has been out for three nights.", mobile: "+639171234567", municipality_code: "042111000", province_code: "042100000", region_code: "040000000", report_type: "infrastructure", subject: "Broken streetlight", }, throwOnError: true, });

eReport.requestOtp

POST /api/integration/verify/request dispatches the OTP used to authorize access to citizen report records.
import { eReport } from "egov.js"; const otpRequest = await eReport.requestOtp({ client, auth: integration.access_token, body: { email: "juan@example.gov.ph" }, throwOnError: true, });

eReport.confirmOtp

POST /api/integration/verify/confirm confirms an OTP and returns the report view token.
import { eReport } from "egov.js"; const confirmation = await eReport.confirmOtp({ client, auth: integration.access_token, body: { email: "juan@example.gov.ph", otp: submittedOtp, }, throwOnError: true, });

eReport.listReports

GET /api/integration/reports lists reports using X-EReport-View-Token, with optional search and pagination parameters.
import { eReport } from "egov.js"; const reports = await eReport.listReports({ client, headers: { "X-EReport-View-Token": confirmation.report_view_token }, query: { page: 1, limit: 10 }, throwOnError: true, });

eReport.getReport

GET /api/integration/reports/{case_number} retrieves one report by case number using the report view token.
import { eReport } from "egov.js"; const report = await eReport.getReport({ client, headers: { "X-EReport-View-Token": confirmation.report_view_token }, path: { case_number: complaint.case_number }, throwOnError: true, });