Quick start
-
Get an API key.
Sign in to the AI4M dashboard and open Settings → API access. Choose Create API key, name it, and pick the data it may read. Copy the key when it is shown: it is displayed only once.
In an organisation, only administrators can create keys. See Authentication.
-
Check which months are available.
curl https://api.ai4mproject.com/v1/periods \-H "Authorization: Bearer $AI4M_API_KEY"from ai4m_sdk import AI4MClientclient = AI4MClient(api_key="ai4m_live_...")periods = client.get_periods()print(periods.last_estimated, periods.last_forecast)import { AI4MClient } from "ai4m-sdk";const client = new AI4MClient({ apiKey: "ai4m_live_..." });const periods = await client.getPeriods();console.log(periods.last_estimated, periods.last_forecast);client := ai4m.NewClient("ai4m_live_...")ctx := context.Background()periods, err := client.Periods(ctx)if err != nil {log.Fatal(err)}fmt.Println(periods.LastEstimated, periods.LastForecast)The response tells you the latest estimated month and the last forecast month:
{"last_estimated": "2026-07","last_forecast": "2026-11","updated_at": "2026-10-04T00:54:14.000Z","model_version": "ai4m-malaria-1.0"} -
Get risk scores for every state.
curl https://api.ai4mproject.com/v1/risk/states \-H "Authorization: Bearer $AI4M_API_KEY"report = client.get_state_risk()for state in report.states:print(state.state, state.score, state.level)const report = await client.getStateRisk();for (const state of report.states) {console.log(state.state, state.score, state.level);}report, err := client.StateRisk(ctx, "")if err != nil {log.Fatal(err)}for _, state := range report.States {fmt.Println(state.State, state.Score, state.Level)} -
Drill into one state’s LGAs.
States are identified by a two-letter code, such as
KNfor Kano. The full list is in States and LGA codes.curl "https://api.ai4mproject.com/v1/risk/lgas?state=KN" \-H "Authorization: Bearer $AI4M_API_KEY"kano = client.get_lga_risk("KN")print(len(kano.lgas), "LGAs in", kano.state)const kano = await client.getLgaRisk("KN");console.log(kano.lgas.length, "LGAs in", kano.state);kano, err := client.LGARisk(ctx, "KN", "")if err != nil {log.Fatal(err)}fmt.Println(len(kano.LGAs), "LGAs in", kano.State)
Next steps
Section titled “Next steps”- Read Scores and levels so you interpret the numbers correctly.
- Get forecasts for the months ahead.
- Handle errors and limits before you automate anything.