PSP Statistics API

Retrieve caregiver count statistics for households assigned to your payment service provider via /api/v1/psp_statistics. Authenticate with a LEAP session whose organisation code matches your PSP uniqueCode.

GET
Overview

The PSP Statistics API returns household and caregiver counts for the authenticated PSP, nested by region → district → community.

  • Base path: /api/v1/psp_statistics (alias /api/v1/psp-statistics)
  • Grouping: household region_code, district_code, community_code
Authentication

Sign in with POST /api/v1/session. Send the session token on every request:

token: YOUR_SESSION_TOKEN
Authorization: Bearer YOUR_SESSION_TOKEN
x-access-token: YOUR_SESSION_TOKEN
GET statistics
GET /api/v1/psp_statistics

Returns nested caregiver statistics for households assigned to the session PSP. Optional location filters restrict counts to matching household location columns.

Query parameters
Name Type Description
region_code string Optional. Match lpm_households_selected_all.region_code (e.g. 02).
district_code string Optional. Match lpm_households_selected_all.district_code (e.g. 02-03).
community_code string Optional. Match lpm_households_selected_all.community_code (e.g. 02-03-006).

Filters may be combined with AND. Applied filters are echoed in the response filter object; otherwise filter is null.

Example request
curl -X GET "https://YOUR_HOST/api/v1/psp_statistics" \
  -H "token: YOUR_SESSION_TOKEN"

curl -X GET "https://YOUR_HOST/api/v1/psp_statistics?region_code=02&district_code=02-03" \
  -H "token: YOUR_SESSION_TOKEN"
Example response
{
  "successful": true,
  "psp": {
    "id": 9,
    "uniqueCode": "GHIPSS",
    "name": "Ghana Interbank Payment and Settlement Systems"
  },
  "filter": {
    "region_code": "02",
    "district_code": "02-03"
  },
  "totals": {
    "householdCount": 120,
    "primaryCaregiverCount": 118,
    "secondaryCaregiverCount": 95,
    "caregiverRequestCount": 3400
  },
  "data": [
    {
      "regionCode": "02",
      "regionName": "Ashanti",
      "householdCount": 120,
      "primaryCaregiverCount": 118,
      "secondaryCaregiverCount": 95,
      "caregiverRequestCount": 3400,
      "districts": [
        {
          "districtCode": "02-03",
          "districtName": "Example District",
          "householdCount": 120,
          "primaryCaregiverCount": 118,
          "secondaryCaregiverCount": 95,
          "caregiverRequestCount": 3400,
          "communities": [
            {
              "communityCode": "02-03-006",
              "communityName": "Example Community",
              "householdCount": 40,
              "primaryCaregiverCount": 39,
              "secondaryCaregiverCount": 32,
              "caregiverRequestCount": 3400
            }
          ]
        }
      ]
    }
  ]
}
Response shape
Envelope
Field Notes
successfultrue on success.
pspResolved PSP id, uniqueCode, and name.
filterApplied location filters, or null.
totalsSum of counts across the returned tree.
dataArray of region nodes (see below).
Count fields (every level)
Field Notes
householdCountDistinct households with a non-empty gnhrHouseholdUUID.
primaryCaregiverCountNamed primary caregivers linked to those households.
secondaryCaregiverCountNamed secondary caregivers linked to those households.
caregiverRequestCountNumber of caregiver data requests made by the authenticated PSP through GET /api/v1/psp_enrollment.
Nesting
  • Region: regionCode, regionName, counts, districts[]
  • District: districtCode, districtName, counts, communities[]
  • Community: communityCode, communityName, counts

Region and district counts roll up from their child communities.

Errors
HTTP When
401 No valid session token.
403 Session is not a registered/active PSP.
405 Unsupported method (POST / PUT / DELETE).
500 Database or server error.