ProtectMum OpenAPI spec

ProtectMum API

Free maternal and child health calculators for Ghana and Nigeria: pregnancy dates and antenatal visits, each country's vaccine schedule, and a danger-sign check for messages.

Overview

Free calculators for maternal and child health in Ghana and Nigeria, built on WHO, Ghana Health Service and NPHCDA guidance. Use them in clinic software, apps, SMS services and research tools.

  • Pregnancy calculator: EDD, gestational age and the dates of the 8 WHO antenatal contacts.
  • Vaccines: Ghana's EPI and Nigeria's NPHCDA schedules, and one child's doses, statuses and next clinic visit.
  • Danger-sign screen: checks a message for pregnancy and newborn danger signs and returns the advice ProtectMum sends mothers.
  • Antenatal risk score: a draft score in test (shadow) mode, for research partners with sandbox keys.
Information only. No endpoint gives a diagnosis or replaces a health worker. ProtectMum is a non-profit: the API is free.

Base URL: https://protectmum.org/v1  ·  Machine-readable spec: openapi.json (OpenAPI 3.1, import it into Postman or Insomnia)

Quick start

  1. Ask for a sandbox key (see Keys).
  2. Keep it in an environment variable on your server, e.g. PM_KEY.
  3. Make your first call:
curl https://protectmum.org/v1/pregnancy/calculate \
  -H "Authorization: Bearer $PM_KEY" \
  -H "Content-Type: application/json" \
  -d '{"lmp": "2026-06-01"}'

Keys and sandbox

Send your key in the Authorization header: Authorization: Bearer pm_test_…. The header X-Api-Key also works. GET /v1/health needs no key.

KeyStarts withUse it for
Sandboxpm_test_Building and testing. Same answers as live, lower limits. The only key that can use the risk score.
Livepm_live_Your product in use, once we have seen how it shows our answers to people.

Getting a key: email developers@protectmum.org with your organisation, a contact person and what you are building. Sandbox keys are usually issued within a week. We show the key once; store it then.

Keep keys on your server. Never put a key in a website's JavaScript, a mobile app or a public repository. If a key leaks, tell us and we will revoke it and issue a new one. There is no browser (CORS) access on purpose.

Scopes: pregnancy, vaccines and triage come with every key. risk is granted on request to research partners.

Rate limits

KeyPer minutePer day (UTC)
Sandbox301,000
Live12050,000

Every answer carries X-RateLimit-Limit and X-RateLimit-Remaining for the current minute. Over the limit you get 429 with Retry-After (seconds). Need more? Ask; we raise limits for health services.

The calculators give the same answer for the same input on the same day, so cache results where you can.

Errors

Errors are JSON with a stable code to program against, a readable message, and a request_id to quote if you contact us.

{
  "error": {
    "code": "date_out_of_range",
    "message": "The dates do not give a current pregnancy (0 to 44 weeks). Check them.",
    "request_id": "9f2c4e1a7b3d5c60"
  }
}
HTTPcodeMeaning
400invalid_jsonThe body is not a JSON object.
401missing_keyNo key was sent.
401invalid_keyThe key is wrong or has been revoked.
403scope_missingThe key is not allowed to use this endpoint.
403not_availableThe risk score with a live key (it is sandbox-only for now).
404not_foundNo such endpoint.
405method_not_allowedWrong HTTP method; see the Allow header.
413too_largeBody over 16 KB.
415unsupported_media_typeContent-Type is not application/json.
422invalid_inputA field is missing, unknown or the wrong type. The message names it.
422date_out_of_rangeThe dates do not make sense (for example an LMP in the future).
429rate_limitedToo many requests. Wait for Retry-After seconds.
500server_errorOur fault. Retry once, then send us the request_id.

Dates are always YYYY-MM-DD. Unknown fields are rejected rather than ignored, so a typo cannot silently change an answer.

Endpoints

POST /v1/pregnancy/calculate

EDD, gestational age and ANC contact dates. Scope: pregnancy.

Send exactly one of lmp, edd or scan. The EDD from an LMP uses Naegele's rule (LMP + 280 days); a scan in the first half of pregnancy is more accurate. The next ANC contact is marked next.

FieldTypeNotes
lmpdateFirst day of the last menstrual period. 0 to 44 weeks ago.
edddateAn EDD from the clinic. From 14 days ago to 40 weeks ahead.
scan.date / scan.ga_weeks / scan.ga_daysdate, int 4-42, int 0-6A dating scan and the gestational age it showed.
todaydate, optionalDefaults to today in Ghana (UTC).

Request

curl https://protectmum.org/v1/pregnancy/calculate \
  -H "Authorization: Bearer $PM_KEY" \
  -H "Content-Type: application/json" \
  -d '{"lmp": "2026-06-01"}'

Response

{
  "edd": "2027-03-08",
  "dating_method": "lmp",
  "today": "2026-11-26",
  "gestational_age": {
    "weeks": 25,
    "days": 3,
    "label": "25+3"
  },
  "trimester": 2,
  "days_to_edd": 102,
  "post_dates": false,
  "anc_contacts": [
    {
      "contact": 1,
      "week": 12,
      "date": "2026-08-24",
      "status": "past"
    },
    {
      "contact": 2,
      "week": 20,
      "date": "2026-10-19",
      "status": "past"
    },
    {
      "contact": 3,
      "week": 26,
      "date": "2026-11-30",
      "status": "next"
    },
    {
      "contact": 4,
      "week": 30,
      "date": "2026-12-28",
      "status": "upcoming"
    },
    {
      "contact": 5,
      "week": 34,
      "date": "2027-01-25",
      "status": "upcoming"
    },
    {
      "contact": 6,
      "week": 36,
      "date": "2027-02-08",
      "status": "upcoming"
    },
    {
      "contact": 7,
      "week": 38,
      "date": "2027-02-22",
      "status": "upcoming"
    },
    {
      "contact": 8,
      "week": 40,
      "date": "2027-03-08",
      "status": "upcoming"
    }
  ],
  "notes": [
    "EDD from LMP uses Naegele's rule (LMP + 280 days). An early scan is more accurate.",
    "ANC contacts follow the WHO 2016 eight-contact model.",
    "Information only. Not a diagnosis and not a substitute for a health worker."
  ]
}

GET /v1/vaccines/schedule

The national vaccine schedule for a country. Scope: vaccines.

Add ?country=NG for Nigeria's NPHCDA schedule; without it you get Ghana's EPI schedule (country is GH or NG). Each dose has a code, a dose number and an age (days, weeks, months or years after birth). Doses with requires_clinic_check (malaria vaccine, HPV) are not offered at every clinic yet. The version changes whenever the schedule does. Response shortened here.

Request

curl https://protectmum.org/v1/vaccines/schedule \
  -H "Authorization: Bearer $PM_KEY"

Response

{
  "schedule_id": "ghs-epi",
  "version": "2026-11-25",
  "source": "https://ghs.gov.gh/immunisation",
  "notes": [
    "Ages are offsets from the child's date of birth. Weeks = 7 days; months and years are calendar offsets (31 Jan + 1 month = 28/29 Feb).",
    "Entries with requires_clinic_check = true are only reminded after the mother confirms her clinic offers them (malaria vaccine is a phased introduction since 2019).",
    "Vitamin A after 24 months: GHS says every 6 months until age 5. Doses at 30-54 months are listed here; confirm the final dose with Prof Bonsaffoh.",
    "HPV at 9 years: confirm eligibility rules (sex, age band) before reminding."
  ],
  "doses": [
    {
      "code": "BCG",
      "name": "BCG",
      "dose": 1,
      "age": {
        "days": 0
      },
      "requires_clinic_check": false
    },
    {
      "code": "OPV",
      "name": "Oral polio vaccine",
      "dose": 0,
      "age": {
        "days": 0
      },
      "requires_clinic_check": false
    },
    {
      "code": "HEPB_BIRTH",
      "name": "Hepatitis B birth dose",
      "dose": 1,
      "age": {
        "days": 0
      },
      "requires_clinic_check": false
    },
    {
      "code": "PENTA",
      "name": "DPT-HepB-Hib",
      "dose": 1,
      "age": {
        "weeks": 6
      },
      "requires_clinic_check": false
    }
  ]
}

POST /v1/vaccines/child

One child's doses, statuses and next visit. Scope: vaccines.

Status is one of given, overdue, due_today, due_soon (within 7 days), upcoming or needs_clinic_check. next_visit is the earliest date that still has doses to give. Response shortened here.

FieldTypeNotes
dobdate, requiredChild's date of birth; under 5 years old.
givenobject, optionalDoses already given: {"BCG:1": "2026-10-01"}. Keys are CODE:dose from the schedule.
clinic_offerslist, optionalCodes of phased-in vaccines the child's clinic gives, e.g. ["MALARIA"].
countrystring, optionalGH (default) or NG: which national schedule to use.
todaydate, optionalDefaults to today in Ghana.

Request

curl https://protectmum.org/v1/vaccines/child \
  -H "Authorization: Bearer $PM_KEY" \
  -H "Content-Type: application/json" \
  -d '{"dob": "2026-10-01", "given": {"BCG:1": "2026-10-01", "OPV:0": "2026-10-01", "HEPB_BIRTH:1": "2026-10-02"}}'

Response

{
  "dob": "2026-10-01",
  "today": "2026-11-26",
  "schedule_version": "2026-11-25",
  "next_visit": {
    "date": "2026-11-12",
    "doses": [
      {
        "code": "OPV",
        "name": "Oral polio vaccine",
        "dose": 1,
        "status": "overdue"
      },
      {
        "code": "PCV",
        "name": "Pneumococcal vaccine",
        "dose": 1,
        "status": "overdue"
      },
      {
        "code": "PENTA",
        "name": "DPT-HepB-Hib",
        "dose": 1,
        "status": "overdue"
      },
      {
        "code": "ROTA",
        "name": "Rotavirus vaccine",
        "dose": 1,
        "status": "overdue"
      }
    ]
  },
  "doses": [
    {
      "code": "BCG",
      "name": "BCG",
      "dose": 1,
      "due_date": "2026-10-01",
      "status": "given",
      "given_date": "2026-10-01",
      "reminder_dates": []
    },
    {
      "code": "HEPB_BIRTH",
      "name": "Hepatitis B birth dose",
      "dose": 1,
      "due_date": "2026-10-01",
      "status": "given",
      "given_date": "2026-10-02",
      "reminder_dates": []
    },
    {
      "code": "OPV",
      "name": "Oral polio vaccine",
      "dose": 0,
      "due_date": "2026-10-01",
      "status": "given",
      "given_date": "2026-10-01",
      "reminder_dates": []
    },
    {
      "code": "OPV",
      "name": "Oral polio vaccine",
      "dose": 1,
      "due_date": "2026-11-12",
      "status": "overdue",
      "given_date": null,
      "reminder_dates": [
        "2026-11-09",
        "2026-11-12"
      ]
    }
  ],
  "notes": [
    "Statuses: given, overdue, due_today, due_soon, upcoming, needs_clinic_check.",
    "Information only. Not a diagnosis and not a substitute for a health worker."
  ]
}

POST /v1/triage/message

Screen a message for danger signs. Scope: triage.

Checks free text for the danger signs of pregnancy and the newborn (bleeding, severe headache, fits, reduced baby movements, a newborn not feeding, and others), including common Ghanaian and Nigerian English and Pidgin. When one is found, advice is the message ProtectMum sends: go to a health facility now or call 112. The text is not stored.

FieldTypeNotes
textstring, required1 to 1,000 characters.
languageen | tw | gaa | eeLanguage of the advice. English rules are always checked; Twi, Ga and Ewe rules are being written.
danger_sign: false does not mean safe. It only means no keyword matched. Your product must always let people reach a health worker.

Request

curl https://protectmum.org/v1/triage/message \
  -H "Authorization: Bearer $PM_KEY" \
  -H "Content-Type: application/json" \
  -d '{"text": "I am bleeding and my head is paining me seriously"}'

Response

{
  "danger_sign": true,
  "codes": [
    "bleeding",
    "severe_headache"
  ],
  "advice": "This could be a danger sign. Please go to the nearest health facility now. If you cannot get there, call 112. Do not wait.",
  "rules_version": "draft-2026-11-26",
  "notes": [
    "This is a keyword screen. danger_sign = false does NOT mean the person is safe: always let them reach a health worker.",
    "Information only. Not a diagnosis and not a substitute for a health worker."
  ]
}

POST /v1/risk/antenatal

Draft antenatal risk score (shadow mode). Scope: risk.

A rule-based score modelled on the WHO antenatal classifying-form approach: one high-risk factor moves a woman out of routine care. Bands: urgent (same-day review), high (doctor-led care), moderate, low, and incomplete when key items are missing and nothing was found. Missing data never lowers a band.

FieldTypeNotes
age_years, gravida, parity, ga_weeksintegersgravida counts this pregnancy; parity is previous births.
systolic_bp, diastolic_bp, proteinuriaint, int, boolBooking or latest reading.
hb_g_dl, height_cm, bminumber, int, number
previous_caesareans, consecutive_miscarriages, last_baby_weight_gintegers
previous_stillbirth_or_neonatal_death, previous_preeclampsia, previous_uterine_surgery, previous_pph, multiple_pregnancy, rh_sensitised, vaginal_bleeding, pelvic_mass, malpresentationbooleans
conditionslistAny of: diabetes, chronic_hypertension, renal_disease, cardiac_disease, sickle_cell_disease, epilepsy, substance_use, hiv, other_severe.
Not validated. Not for care decisions. The score is being checked against past records with known outcomes. Until it is validated and signed off by our clinical lead it only works with sandbox keys, and ProtectMum never shows it to mothers.

Request

curl https://protectmum.org/v1/risk/antenatal \
  -H "Authorization: Bearer $PM_KEY" \
  -H "Content-Type: application/json" \
  -d '{"age_years": 37, "gravida": 4, "parity": 3, "systolic_bp": 142, "diastolic_bp": 92, "proteinuria": false, "hb_g_dl": 9.8, "previous_caesareans": 1}'

Response

{
  "band": "high",
  "score": 6,
  "factors": [
    {
      "code": "hypertension",
      "level": "high",
      "label": "Blood pressure 140/90 or higher"
    },
    {
      "code": "age_16_17_or_35_40",
      "level": "moderate",
      "label": "Age 16-17 or 35-40"
    },
    {
      "code": "one_previous_caesarean",
      "level": "moderate",
      "label": "One previous caesarean section"
    },
    {
      "code": "moderate_anaemia",
      "level": "moderate",
      "label": "Haemoglobin 7 to 9.9 g/dL"
    }
  ],
  "missing": [],
  "advice": "Doctor-led antenatal care. Plan birth where caesarean section and blood transfusion are available.",
  "model_version": "antenatal-risk-v0-draft",
  "mode": "shadow",
  "for_clinical_use": false,
  "notes": [
    "Draft rule-based score, not validated. Do not use it to make care decisions.",
    "Missing data never lowers the band; with key items missing and no factor found the band is \"incomplete\"."
  ]
}

Safety rules for apps using the API

  1. Show the answers as information, not a diagnosis, and say so near them.
  2. Wherever you show triage results, show a way to reach care: the nearest facility and 112.
  3. Never present danger_sign: false as "you are fine".
  4. Do not use the risk score to decide anyone's care while it is in shadow mode.
  5. Show the dates we return as estimates to confirm with the clinic.
  6. Tell us if you see an answer that looks wrong: developers@protectmum.org, with the request_id.

Privacy

No endpoint needs a name, phone number, hospital number, NHIS number or address. Do not send them. Unknown fields are rejected, which also stops most accidental leaks.

We do not store request bodies. For each request we keep only the key used, the endpoint, the status code, an error code and the time taken, to run limits and fix problems. For the risk score we also keep the band and the factor codes (not the values you sent), to evaluate the score.

Terms of use

  • Free for health services, NGOs, researchers, students and companies building health products.
  • Follow the safety rules above. We may suspend keys that present answers unsafely.
  • Say "Calculations by ProtectMum" where you show our results.
  • The API is provided as is. It does not replace clinical judgement, and ProtectMum is not responsible for decisions made from its answers.
  • We will give at least 90 days' notice before a breaking change to /v1.

Draft terms, to be reviewed before live keys are issued.

Changelog

v1 (preview), November 2026. First release: pregnancy calculator, vaccine schedule and child vaccines, danger-sign screen, and the antenatal risk score in shadow mode.