API version 1.0

Malawi Verified Services API

The API provides structured information about government agencies and public services in Malawi. Responses are returned as JSON.

REST API JSON X-API-Key Prototype

Base URL

All prototype API requests begin with:

https://malawi-verified-services-backend.onrender.com/api/v1
POST /api-access/register

Register an application

Register a project and receive a prototype API key. The full key is included only in the registration response.

Request body

{
  "company_name": "Malawi Explore Travel",
  "contact_name": "Developer Name",
  "email": "developer@example.com",
  "website": "https://example.com",
  "purpose": "Display verified immigration services."
}

Example response

{
  "id": 1,
  "company_name": "Malawi Explore Travel",
  "api_key": "mvs_live_generated_key",
  "api_key_prefix": "mvs_live_generat",
  "is_active": true,
  "message": "API application registered successfully."
}

Authentication

Protected endpoints require your API key in the X-API-Key HTTP request header.

X-API-Key: mvs_live_your_api_key
Prototype security notice

Do not expose production API keys inside public browser JavaScript. This prototype will temporarily use a frontend key only for demonstration.

GET /public/access-check

Verify API access

Confirms that the supplied key is valid and active.

curl https://malawi-verified-services-backend.onrender.com/api/v1/public/access-check \
  -H "X-API-Key: mvs_live_your_api_key"
GET /public/agencies

List active agencies

Returns active government agencies ordered by name.

Parameter Type Description
skip integer Number of records to skip.
limit integer Maximum 100 records.
GET /public/agencies/{agency_id}

Returns one active agency by its numeric ID.

GET /public/services

List and search services

Returns active public services belonging to active agencies.

GET /public/services/{service_id}

Get complete service details

Returns the service and its related agency, requirements, fees, FAQs, documents, contacts and locations.

GET /api/v1/public/services/2

Service search filters

Parameter Type Description
search string Searches service name, description and agency name.
category string Filters by service category.
agency_id integer Filters services by agency.
district string Filters by agency location district.
online_available boolean Filters by online service availability.
skip integer Pagination offset.
limit integer Maximum 100 records.

Filtered request example

GET /api/v1/public/services?search=passport&online_available=true

Common errors

401 Unauthorized

The API key is missing or invalid.

403 Forbidden

The API application is inactive.

404 Not Found

The requested active agency or service does not exist.

422 Validation Error

A request field or query parameter is invalid.

JavaScript integration example

const API_BASE_URL =
  "https://malawi-verified-services-backend.onrender.com/api/v1";

const API_KEY =
  "mvs_live_your_api_key";

async function loadServices() {
  const response = await fetch(
    `${API_BASE_URL}/public/services?search=passport`,
    {
      headers: {
        "X-API-Key": API_KEY
      }
    }
  );

  if (!response.ok) {
    throw new Error(
      `Request failed: ${response.status}`
    );
  }

  const services = await response.json();

  console.log(services);
}

loadServices();

Interactive API documentation

FastAPI automatically generates interactive Swagger and ReDoc documentation.