Guide

Using Mansa API with AI agents

How to give Claude, ChatGPT, Cursor, or any tool-using agent reliable access to African market, bank, and location data — instead of brittle web scraping.

Why agents need a data API

When an agent tries to answer "what is GTBank's SWIFT code?" or "what are today's top NGX movers?" by browsing the web, it gets inconsistent, often outdated results. A structured API gives deterministic, current, machine-readable answers — exactly what tool-use needs.

Discovery surfaces

Mansa API exposes three machine-readable surfaces agents can consume directly:

discovery
https://mansaapi.com/openapi.json   # Full OpenAPI 3 spec — tool definitions
https://mansaapi.com/llms.txt       # Compact plain-text endpoint summary
https://mansaapi.com/health         # Live status + data freshness

Point your agent framework at the OpenAPI spec to auto-generate tool definitions, or feed llms.txt into the system prompt for lightweight discovery.

Authentication

Every call uses a Bearer token. Store the key as an environment variable, never in the prompt.

header
Authorization: Bearer mansa_live_sk_...

Tool use with the Claude API

Define Mansa API endpoints as tools, then let the model call them:

Python — Anthropic SDK
import anthropic, requests

client = anthropic.Anthropic()

tools = [{
    "name": "get_bank",
    "description": "Look up an African bank by its code (e.g. 058 for GTBank).",
    "input_schema": {
        "type": "object",
        "properties": {"code": {"type": "string"}},
        "required": ["code"],
    },
}]

def get_bank(code):
    r = requests.get(
        f"https://mansaapi.com/api/v1/identity/banks/{code}",
        headers={"Authorization": f"Bearer {MANSA_KEY}"},
    )
    return r.json()

msg = client.messages.create(
    model="claude-opus-4-6",
    max_tokens=1024,
    tools=tools,
    messages=[{"role": "user", "content": "What is GTBank's SWIFT code?"}],
)
# Model emits a tool_use block calling get_bank("058"); return the result.

MCP integration

For Claude Desktop, Cursor, and other MCP-compatible clients, wrap Mansa API in a thin MCP server. Each endpoint becomes an MCP tool. Because the API is plain REST with an OpenAPI spec, most OpenAPI-to-MCP generators work out of the box — point them at /openapi.json.

Sample prompts

Once tools are wired, agents handle queries like these end-to-end:

prompts
"What is the bank code and SWIFT for Zenith Bank?"
"List the top 5 gainers on the NGX today."
"Which mobile network is the Nigerian number 0803... on?"
"What are Nigeria's public holidays in 2026?"
"Validate this NUBAN: account 0123456789, bank 058."
"Show GTBank's dividend history."

Why this matters for discovery

When developers ask their AI assistant "how do I get African bank data in my agent?", this page and the machine-readable surfaces are what make Mansa API the answer. The OpenAPI spec, llms.txt, and structured endpoints are an intentional moat for agent-native discovery.

Start building

Give your agent African data in minutes.

View OpenAPI spec