{"openapi":"3.0.3","info":{"title":"API Ghana","version":"1.0.0","description":"Ghana's data as a JSON API: datasets, live market prices, news and more. Send your API key as the `X-API-Key` header. Full reference, Postman collection and quickstart: https://apighana.com/docs/reference","contact":{"name":"API Ghana","email":"info@apighana.com","url":"https://apighana.com/docs/reference"}},"servers":[{"url":"https://connect.apighana.com"}],"tags":[{"name":"Catalogue","description":"What datasets exist, what their columns are and where each comes from. All public: no key needed. The dataset `name` is what every other endpoint takes."},{"name":"Data rows","description":"A dataset's rows, paged. Free datasets work on every key; any other dataset needs a licence, a free pick, a pack, or the Developer plan or higher."},{"name":"Query builder","description":"Choose columns, filter with operators and sort, in one JSON body. Column names come from the dataset's schema; an unknown column is an error, not an empty answer."},{"name":"Ask in plain English","description":"Ask a question in words and get an answer worked out from the rows, with the queries that produced it. Each question counts against a daily allowance: Free 10, Developer 50, Business 200, Enterprise 500 (reset at midnight, Accra time). Bought questions are used after that."},{"name":"Live and markets","description":"Exchange rates, bank rates, fuel, food and commodity prices and economic indicators, updated through the day. No key needed for the latest values; a key's plan sets how much history comes back. The two families name their groups differently: `/api/live` uses `fx banks fuel food commodities macro`, `/api/market` uses `rates banks fuel food commodities indicators`."},{"name":"News","description":"Ghanaian news, sorted into sections, with outlet and link. With an API key this is the News API, which comes with the Developer plan and up: a Free key gets 403 `PLAN_REQUIRED`. The same endpoints answer without a key, as they do for the website."},{"name":"Exports","description":"Whole datasets and long market histories as files. Exports come with the Business plan and up; other plans get 403 `PLAN_REQUIRED`."},{"name":"Webhooks","description":"We POST to your URL when a market group changes or news is published, instead of you polling. Webhooks come with the Business plan and up. Up to 10 endpoints per account."},{"name":"Status and plans","description":"Whether the API is up, and what each plan includes. All public."},{"name":"MCP","description":"API Ghana is also an MCP server, so AI assistants (Claude, ChatGPT, Cursor and others) can search the catalogue, read rows and query datasets themselves. It speaks JSON-RPC over Streamable HTTP; most people point an MCP client at it rather than calling it by hand."}],"paths":{"/api/datasets":{"get":{"operationId":"listDatasets","tags":["Catalogue"],"summary":"List datasets","description":"Every dataset with its description, sector, price, source, licence and freshness.\n\n`price` is the yearly licence in cedis; `0` means free on every key.","security":[],"parameters":[{"name":"page","in":"query","required":false,"description":"Page number, from 1.","schema":{"type":"integer","default":8},"example":"1"},{"name":"limit","in":"query","required":false,"description":"Datasets per page, up to 100.","schema":{"type":"integer","default":8},"example":"2"},{"name":"search","in":"query","required":false,"description":"Matches the name or description.","schema":{"type":"string"},"example":"hospital"},{"name":"category","in":"query","required":false,"description":"A category id from GET /api/categories.","schema":{"type":"integer","default":8},"example":"21"}],"responses":{"200":{"description":"Every dataset with its description, sector, price, source, licence and freshness.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Envelope"},"example":{"status":"success","message":"Datasets fetched successfully.","data":[{"id":1,"name":"health_facilities","description":"Hospitals, clinics, health centres and doctors across Ghana, with region, district and coordinates. Derived from OpenStreetMap. 1186 records.","endpoint":"/api/data/health_facilities","version":"1.0","price":49,"price_usd":null,"requiresAuth":true,"category":1,"category_name":"Health","data_as_of":"2026-09-18","last_checked_at":"2026-09-25T02:07:11.341+00:00","check_status":"warning","update_frequency":"monthly","source_name":"OpenStreetMap contributors","source_url":"https://www.openstreetmap.org/copyright","licence":"ODbL","coverage_start":null,"coverage_end":null,"coverage_column":null,"enrichment":null,"created_at":"2026-09-16T14:48:47.221879+00:00","updated_at":"2026-09-18T22:46:18.987+00:00"}],"meta":{"total":284,"page":1,"limit":2,"total_pages":142}}}}}},"externalDocs":{"url":"https://apighana.com/docs/reference#list-datasets"}}},"/api/datasets/{table}":{"get":{"operationId":"getDataset","tags":["Catalogue"],"summary":"Describe a dataset","description":"One dataset's documentation: its columns and types, source, licence and freshness. Takes a name or an id.","security":[],"parameters":[{"name":"table","in":"path","required":true,"description":"A dataset name from the catalogue, e.g. `districts`, `health_facilities`, `schools`.","schema":{"type":"string"},"example":"districts"}],"responses":{"200":{"description":"One dataset's documentation: its columns and types, source, licence and freshness. Takes a name or an id.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Envelope"},"example":{"status":"success","message":"Dataset fetched successfully","data":{"id":77,"name":"districts","description":"Ghana's metropolitan, municipal and district assemblies with their region, land area and centroid. 260 records.","endpoint":"/api/data/districts","version":"1.0","price":0,"price_usd":null,"requiresAuth":true,"created_at":"2026-09-16T14:55:46.241304+00:00","updated_at":"2026-09-18T22:46:50.243+00:00","data_as_of":"2026-09-18","coverage_start":null,"coverage_end":null,"coverage_column":null,"last_checked_at":"2026-09-25T02:04:23.445+00:00","check_status":"ok","update_frequency":"monthly","source_name":"geoBoundaries ADM2","source_url":"https://www.geoboundaries.org/","licence":"CC BY 4.0","category":21,"category_name":"Geography","schema":{"columns":[{"name":"id","type":"BIGSERIAL PRIMARY KEY"},{"name":"name","type":"TEXT NOT NULL"},{"name":"region","type":"TEXT"},{"name":"boundary_id","type":"TEXT"},{"name":"area_sqkm","type":"DECIMAL(12,2)"},{"name":"centroid_latitude","type":"DECIMAL(9,6)"},{"name":"centroid_longitude","type":"DECIMAL(9,6)"},{"name":"source","type":"TEXT"}]},"api_parameters":null,"api_headers":null,"api_status_codes":null,"api_examples":null,"total_calls":0,"usage_per_month":0}}}}},"404":{"description":"No dataset by that name.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"externalDocs":{"url":"https://apighana.com/docs/reference#get-dataset"}}},"/api/datasets/{table}/versions":{"get":{"operationId":"datasetVersions","tags":["Catalogue"],"summary":"Dataset versions","description":"The dataset's recorded versions, newest first, with rows added, removed and changed. Up to 100.\n\nA version with `exportable: true` can be passed as `version` to the export endpoint.","security":[],"parameters":[{"name":"table","in":"path","required":true,"description":"A dataset name from the catalogue, e.g. `districts`, `health_facilities`, `schools`.","schema":{"type":"string"},"example":"districts"}],"responses":{"200":{"description":"The dataset's recorded versions, newest first, with rows added, removed and changed. Up to 100.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Envelope"},"example":{"status":"success","message":"Versions retrieved","data":[{"id":21,"dataset_name":"districts","version":"2026-09-18","version_date":"2026-09-18","row_count":260,"rows_added":260,"rows_removed":0,"rows_changed":0,"note":"First check","created_at":"2026-09-18T02:49:25.695525+00:00","exportable":true}]}}}}},"externalDocs":{"url":"https://apighana.com/docs/reference#dataset-versions"}}},"/api/categories":{"get":{"operationId":"listCategories","tags":["Catalogue"],"summary":"List categories","description":"The sectors datasets are grouped into, with how many datasets each has.","security":[],"responses":{"200":{"description":"The sectors datasets are grouped into, with how many datasets each has.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Envelope"},"example":{"status":"success","message":"Categories retrieved successfully","data":[{"id":20,"name":"Agriculture","description":"Agriculture datasets for Ghana.","created_at":"2026-09-16T14:48:42.96785+00:00","updated_at":"2026-09-16T14:48:42.96785+00:00","dataset_count":26}]}}}}},"externalDocs":{"url":"https://apighana.com/docs/reference#list-categories"}}},"/api/data/{table}/preview":{"get":{"operationId":"previewRows","tags":["Catalogue"],"summary":"Preview rows","description":"The first five rows of any dataset, paid ones included, and its column names. Use it to see a dataset before you licence it.","security":[],"parameters":[{"name":"table","in":"path","required":true,"description":"A dataset name from the catalogue, e.g. `districts`, `health_facilities`, `schools`.","schema":{"type":"string"},"example":"districts"}],"responses":{"200":{"description":"The first five rows of any dataset, paid ones included, and its column names. Use it to see a dataset before you licence it.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Envelope"},"example":{"status":"success","message":"Preview of 'districts': the first 5 records.","data":[{"id":1,"name":"Adenta Municipal","region":"Greater Accra Region","boundary_id":"2480657B26321648161032","area_sqkm":78.47,"centroid_latitude":5.703203,"centroid_longitude":-0.119929,"source":"geoBoundaries ADM2 (CC BY 4.0)","reference_date":null},{"id":2,"name":"Ledzokuku Municipal","region":"Greater Accra Region","boundary_id":"2480657B94892111901595","area_sqkm":29.44,"centroid_latitude":5.594821,"centroid_longitude":-0.124979,"source":"geoBoundaries ADM2 (CC BY 4.0)","reference_date":null}],"meta":{"preview":true,"preview_rows":5,"total":260,"columns":["id","name","region","boundary_id","area_sqkm","centroid_latitude","centroid_longitude","source","reference_date"]}}}}},"404":{"description":"No dataset by that name.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"externalDocs":{"url":"https://apighana.com/docs/reference#preview-rows"}}},"/api/data/{table}":{"get":{"operationId":"listRows","tags":["Data rows"],"summary":"List rows","description":"A page of rows, in id order, with the total and where the data comes from.\n\nWhen `limit` is above your plan's cap, the page is cut to the cap and `message` says so.\n\n`meta.source` names the source, its licence and when the data was last updated. Show it wherever you show the figures.","security":[{"apiKey":[]}],"parameters":[{"name":"table","in":"path","required":true,"description":"A dataset name from the catalogue, e.g. `districts`, `health_facilities`, `schools`.","schema":{"type":"string"},"example":"districts"},{"name":"page","in":"query","required":false,"description":"Page number, from 1.","schema":{"type":"integer","default":8},"example":"1"},{"name":"limit","in":"query","required":false,"description":"Rows per page. Capped at your plan's rows per page (Free 50, Developer 500, Business 5,000, Enterprise 10,000).","schema":{"type":"integer","default":8},"example":"2"},{"name":"filter","in":"query","required":false,"description":"Exact matches, `column:value` pairs joined by commas. Case-sensitive; values cannot contain commas.","schema":{"type":"string"},"example":"region:Greater Accra Region"},{"name":"search","in":"query","required":false,"description":"Case-insensitive match across the text columns, up to 200 characters.","schema":{"type":"string"},"example":"Accra"}],"responses":{"200":{"description":"A page of rows, in id order, with the total and where the data comes from.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Envelope"},"example":{"status":"success","message":"Records fetched from 'districts'.","data":[{"id":1,"name":"Adenta Municipal","region":"Greater Accra Region","boundary_id":"2480657B26321648161032","area_sqkm":78.47,"centroid_latitude":5.703203,"centroid_longitude":-0.119929,"source":"geoBoundaries ADM2 (CC BY 4.0)","reference_date":null},{"id":2,"name":"Ledzokuku Municipal","region":"Greater Accra Region","boundary_id":"2480657B94892111901595","area_sqkm":29.44,"centroid_latitude":5.594821,"centroid_longitude":-0.124979,"source":"geoBoundaries ADM2 (CC BY 4.0)","reference_date":null}],"meta":{"page":1,"limit":2,"total":260,"total_items":260,"total_pages":130,"is_limited":true,"source":{"dataset":"districts","source":"geoBoundaries ADM2","source_url":"https://www.geoboundaries.org/","licence":"CC BY 4.0","last_updated":"2026-09-18","last_checked":"2026-09-25T02:04:23.445+00:00","covers":null,"notice":"Source: geoBoundaries ADM2 (CC BY 4.0). Last updated from the source on 2026-09-18. The records are a snapshot of the source as of the date it was last updated. Provided as published by the source, without warranty. Check the dates before relying on a figure."}}}}}},"400":{"description":"A bad `filter` or `search`, or a filter on a column the dataset does not have.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"No `X-API-Key` header, or the key is wrong or revoked.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"The key is inactive or the account is deactivated.\n\nACCESS_REQUIRED: The dataset is not on your key. `data.options` says how to get it: a yearly licence, a free pick, a pack or a plan.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"No dataset by that name.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Over your plan's requests per minute. Wait for `Retry-After` seconds.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"externalDocs":{"url":"https://apighana.com/docs/reference#list-rows"}}},"/api/data/{table}/{id}":{"get":{"operationId":"getRow","tags":["Data rows"],"summary":"Get one row","description":"One row by its id.","security":[{"apiKey":[]}],"parameters":[{"name":"table","in":"path","required":true,"description":"A dataset name from the catalogue, e.g. `districts`, `health_facilities`, `schools`.","schema":{"type":"string"},"example":"districts"},{"name":"id","in":"path","required":true,"description":"The row's `id`.","schema":{"type":"integer","default":8},"example":"1"}],"responses":{"200":{"description":"One row by its id.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Envelope"},"example":{"status":"success","message":"Record fetched from 'districts'.","data":{"id":1,"name":"Adenta Municipal","region":"Greater Accra Region","boundary_id":"2480657B26321648161032","area_sqkm":78.47,"centroid_latitude":5.703203,"centroid_longitude":-0.119929,"source":"geoBoundaries ADM2 (CC BY 4.0)","reference_date":null}}}}},"400":{"description":"`id` is not a positive integer.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"No `X-API-Key` header, or the key is wrong or revoked.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"The key is inactive or the account is deactivated.\n\nACCESS_REQUIRED: The dataset is not on your key. `data.options` says how to get it: a yearly licence, a free pick, a pack or a plan.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"No dataset, or no row with that id.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Over your plan's requests per minute. Wait for `Retry-After` seconds.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"externalDocs":{"url":"https://apighana.com/docs/reference#get-row"}}},"/api/datasets/extended/schema/{table}":{"get":{"operationId":"datasetSchema","tags":["Data rows"],"summary":"Columns","description":"The dataset's column names and types. The same columns are listed publicly by GET /api/datasets/{table}.","security":[{"apiKey":[]}],"parameters":[{"name":"table","in":"path","required":true,"description":"A dataset name from the catalogue, e.g. `districts`, `health_facilities`, `schools`.","schema":{"type":"string"},"example":"districts"}],"responses":{"200":{"description":"The dataset's column names and types. The same columns are listed publicly by GET /api/datasets/{table}.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Envelope"},"example":{"status":"success","message":"Dataset schema retrieved successfully.","data":{"columns":[{"name":"id","type":"BIGSERIAL PRIMARY KEY"},{"name":"name","type":"TEXT NOT NULL"},{"name":"region","type":"TEXT"},{"name":"boundary_id","type":"TEXT"},{"name":"area_sqkm","type":"DECIMAL(12,2)"},{"name":"centroid_latitude","type":"DECIMAL(9,6)"},{"name":"centroid_longitude","type":"DECIMAL(9,6)"},{"name":"source","type":"TEXT"}]}}}}},"401":{"description":"No `X-API-Key` header, or the key is wrong or revoked.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"The key is inactive or the account is deactivated.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"No dataset by that name.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Over your plan's requests per minute. Wait for `Retry-After` seconds.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"externalDocs":{"url":"https://apighana.com/docs/reference#dataset-schema"}}},"/api/datasets/extended/stats/{table}":{"get":{"operationId":"datasetStats","tags":["Data rows"],"summary":"Row count","description":"How many rows the dataset has, and when it was created and last changed.","security":[{"apiKey":[]}],"parameters":[{"name":"table","in":"path","required":true,"description":"A dataset name from the catalogue, e.g. `districts`, `health_facilities`, `schools`.","schema":{"type":"string"},"example":"districts"}],"responses":{"200":{"description":"How many rows the dataset has, and when it was created and last changed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Envelope"},"example":{"status":"success","message":"Statistics for dataset 'districts'.","data":{"total_records":260,"created_at":"2026-09-16T14:55:46.241304+00:00","updated_at":"2026-09-18T22:46:50.243+00:00"}}}}},"401":{"description":"No `X-API-Key` header, or the key is wrong or revoked.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"The key is inactive or the account is deactivated.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"No dataset by that name.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Over your plan's requests per minute. Wait for `Retry-After` seconds.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"externalDocs":{"url":"https://apighana.com/docs/reference#dataset-stats"}}},"/api/query/{table}":{"post":{"operationId":"runQuery","tags":["Query builder"],"summary":"Run a query","description":"Rows matching every `where` condition, with the columns you choose, in the order you choose.\n\nA `limit` above your plan's cap is lowered to the cap without an error.","security":[{"apiKey":[]}],"parameters":[{"name":"table","in":"path","required":true,"description":"A dataset name from the catalogue, e.g. `districts`, `health_facilities`, `schools`.","schema":{"type":"string"},"example":"districts"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"select":{"type":"array","items":{"type":"string"},"description":"Columns to return."},"where":{"type":"array","items":{"type":"object"},"description":"Conditions, all of which must hold: `{ column, operator, value }`. Operators: `=`, `!=`, `>`, `<`, `>=`, `<=`, `IN` (value is a non-empty array), `CONTAINS` (case-insensitive text match)."},"order":{"type":"object","description":"`{ column, direction }`, direction `asc` or `desc`."},"limit":{"type":"integer","default":10,"description":"1 to 1,000. Capped at your plan's rows per page (Free 50, Developer 500, Business 5,000, Enterprise 10,000)."},"page":{"type":"integer","default":10,"description":"Page number, from 1."}}},"example":{"select":["name","region","area_sqkm"],"where":[{"column":"name","operator":"IN","value":["Wa East","Wa Municipal"]}],"order":{"column":"area_sqkm","direction":"desc"},"limit":10}}}},"responses":{"200":{"description":"Rows matching every `where` condition, with the columns you choose, in the order you choose.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Envelope"},"example":{"status":"success","message":"Custom query executed successfully.","data":[{"name":"Wa East","region":"Upper West Region","area_sqkm":4325},{"name":"Wa Municipal","region":"Upper West Region","area_sqkm":583.44}],"meta":{"total":2,"total_items":2,"total_pages":1,"page":1,"limit":10,"source":{"dataset":"districts","source":"geoBoundaries ADM2","source_url":"https://www.geoboundaries.org/","licence":"CC BY 4.0","last_updated":"2026-09-18","last_checked":"2026-09-25T02:04:23.445+00:00","covers":null,"notice":"Source: geoBoundaries ADM2 (CC BY 4.0). Last updated from the source on 2026-09-18. The records are a snapshot of the source as of the date it was last updated. Provided as published by the source, without warranty. Check the dates before relying on a figure."}}}}}},"400":{"description":"A bad body, or a column in `select`, `where` or `order` that the dataset does not have. `errors` names the field.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"No `X-API-Key` header, or the key is wrong or revoked.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"The key is inactive or the account is deactivated.\n\nACCESS_REQUIRED: The dataset is not on your key. `data.options` says how to get it: a yearly licence, a free pick, a pack or a plan.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"No dataset by that name.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"The dataset has no column definitions to query against.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Over your plan's requests per minute. Wait for `Retry-After` seconds.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"externalDocs":{"url":"https://apighana.com/docs/reference#run-query"}}},"/api/datasets/{table}/ask":{"post":{"operationId":"askDataset","tags":["Ask in plain English"],"summary":"Ask a dataset","description":"Answers a question from one dataset's rows.","security":[{"apiKey":[]}],"parameters":[{"name":"table","in":"path","required":true,"description":"A dataset name from the catalogue, e.g. `districts`, `health_facilities`, `schools`.","schema":{"type":"string"},"example":"districts"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"question":{"type":"string","description":"1 to 2,000 characters."},"history":{"type":"array","items":{"type":"object"},"description":"Earlier turns for follow-up questions, up to 8: `{ role: \"user\" | \"assistant\", content }`."}},"required":["question"]},"example":{"question":"How many districts are there?"}}}},"responses":{"200":{"description":"Answers a question from one dataset's rows.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Envelope"},"example":{"status":"success","message":"Chat with data answered.","data":{"answer":"The districts dataset lists 260 districts.","tools":[{"name":"run_query","args":{"table":"districts"},"summary":"Queried districts: 1 rows (260 match)"}],"dataset":{"id":77,"name":"districts"},"sources":[{"dataset":"districts","source":"geoBoundaries ADM2","source_url":"https://www.geoboundaries.org/","licence":"CC BY 4.0","last_updated":"2026-09-18","last_checked":"2026-09-25T02:04:23.445+00:00","covers":null,"notice":"Source: geoBoundaries ADM2 (CC BY 4.0). Last updated from the source on 2026-09-18. The records are a snapshot of the source as of the date it was last updated. Provided as published by the source, without warranty. Check the dates before relying on a figure."}],"mode":"dataset","quota":{"used":1,"limit":10,"remaining":9,"day":"2026-09-25","credits":0}}}}}},"400":{"description":"No `question`, or one over 2,000 characters.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"No `X-API-Key` header, or the key is wrong or revoked.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"The key is inactive or the account is deactivated.\n\nACCESS_REQUIRED: The dataset is not on your key. `data.options` says how to get it: a yearly licence, a free pick, a pack or a plan.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"ASK_LIMIT: Today's questions are used up and there are no bought ones left.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"503":{"description":"ASK_NOT_CONFIGURED: Asking is switched off on our side.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"externalDocs":{"url":"https://apighana.com/docs/reference#ask-dataset"}}},"/api/datasets/ask":{"post":{"operationId":"askCatalogue","tags":["Ask in plain English"],"summary":"Ask the catalogue","description":"Answers a question from any dataset your key can read; it chooses the datasets itself.","security":[{"apiKey":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"question":{"type":"string","description":"1 to 2,000 characters."},"history":{"type":"array","items":{"type":"object"},"description":"Earlier turns, up to 8."}},"required":["question"]},"example":{"question":"How many regions does Ghana have?"}}}},"responses":{"200":{"description":"Answers a question from any dataset your key can read; it chooses the datasets itself.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Envelope"},"example":{"status":"success","message":"Chat with data answered.","data":{"answer":"Ghana has 16 regions, according to the regions dataset.","tools":[{"name":"list_datasets","args":{"query":"regions"},"summary":"Listed 3 datasets"},{"name":"run_query","args":{"table":"regions"},"summary":"Queried regions: 16 rows (16 match)"}],"dataset":null,"sources":[],"mode":"catalogue","quota":{"used":2,"limit":10,"remaining":8,"day":"2026-09-25","credits":0}}}}}},"400":{"description":"No `question`, or one over 2,000 characters.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"No `X-API-Key` header, or the key is wrong or revoked.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"The key is inactive or the account is deactivated.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"ASK_LIMIT: Today's questions are used up and there are no bought ones left.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"503":{"description":"ASK_NOT_CONFIGURED: Asking is switched off on our side.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"externalDocs":{"url":"https://apighana.com/docs/reference#ask-catalogue"}}},"/api/live":{"get":{"operationId":"liveOverview","tags":["Live and markets"],"summary":"Every live series","description":"Every live series with its latest and previous value, grouped. Add `points` for recent history to draw a line.","security":[],"parameters":[{"name":"group","in":"query","required":false,"description":"`fx`, `banks`, `fuel`, `food`, `commodities` or `macro`.","schema":{"type":"string"},"example":"fx"},{"name":"points","in":"query","required":false,"description":"Recent observations per series, 0 to 120.","schema":{"type":"integer","default":8},"example":"7"}],"responses":{"200":{"description":"Every live series with its latest and previous value, grouped. Add `points` for recent history to draw a line.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Envelope"},"example":{"status":"success","message":"Live data","data":{"groups":{"fx":[{"id":12,"slug":"fx-usd-ghs","name":"US dollar to cedi","group":"fx","unit":"GHS per USD","frequency":"daily","source_name":"exchangerate-api.com","source_url":"https://www.exchangerate-api.com","licence":"Free for use with attribution","description":"How many Ghana cedis one US dollar buys, mid-market, updated daily.","dataset_name":"fx_rates","dimensions":{"base":"USD","quote":"GHS"},"latest_value":11.5673,"latest_at":"2026-09-25T00:00:01+00:00","previous_value":11.574,"previous_at":"2026-09-24T00:00:02+00:00","change_pct":-0.0579,"first_at":"2026-09-18T00:00:01+00:00","observation_count":9,"stale":false,"points":[]}]},"series":[{"id":12,"slug":"fx-usd-ghs","name":"US dollar to cedi","group":"fx","unit":"GHS per USD","frequency":"daily","source_name":"exchangerate-api.com","source_url":"https://www.exchangerate-api.com","licence":"Free for use with attribution","description":"How many Ghana cedis one US dollar buys, mid-market, updated daily.","dataset_name":"fx_rates","dimensions":{"base":"USD","quote":"GHS"},"latest_value":11.5673,"latest_at":"2026-09-25T00:00:01+00:00","previous_value":11.574,"previous_at":"2026-09-24T00:00:02+00:00","change_pct":-0.0579,"first_at":"2026-09-18T00:00:01+00:00","observation_count":9,"stale":false,"points":[]}],"updated_at":null}}}}}},"externalDocs":{"url":"https://apighana.com/docs/reference#live-overview"}}},"/api/live/{slug}":{"get":{"operationId":"liveSeries","tags":["Live and markets"],"summary":"One series with history","description":"One series and its observations, oldest first.\n\nWithout a key, and on Free and Developer, a daily series goes back 92 days, a monthly one 2 years and an annual one all the way. Business, Enterprise and owners of the series' dataset get all of it.\n\nOnly Business and Enterprise get figures from within the day; other plans get the last figure of each day.","security":[{},{"apiKey":[]}],"parameters":[{"name":"slug","in":"path","required":true,"description":"A series slug from GET /api/live, e.g. `fx-usd-ghs`, `fuel-petrol`, `commodity-gold`.","schema":{"type":"string"},"example":"fx-usd-ghs"},{"name":"range","in":"query","required":false,"description":"`30d`, `90d`, `1y`, `5y` or `all`.","schema":{"type":"string","default":"1y"},"example":"30d"},{"name":"limit","in":"query","required":false,"description":"Most points returned, 1 to 5,000.","schema":{"type":"integer","default":8},"example":"5"}],"responses":{"200":{"description":"One series and its observations, oldest first.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Envelope"},"example":{"status":"success","message":"Series retrieved","data":{"id":12,"slug":"fx-usd-ghs","name":"US dollar to cedi","group":"fx","unit":"GHS per USD","frequency":"daily","source_name":"exchangerate-api.com","source_url":"https://www.exchangerate-api.com","licence":"Free for use with attribution","description":"How many Ghana cedis one US dollar buys, mid-market, updated daily.","dataset_name":"fx_rates","dimensions":{"base":"USD","quote":"GHS"},"latest_value":11.5673,"latest_at":"2026-09-25T00:00:01+00:00","previous_value":11.574,"previous_at":"2026-09-24T00:00:02+00:00","change_pct":-0.0579,"first_at":"2026-09-18T00:00:01+00:00","observation_count":9,"stale":false,"points":[{"t":"2026-09-23T00:00:01+00:00","v":11.5805},{"t":"2026-09-24T00:00:02+00:00","v":11.574},{"t":"2026-09-25T00:00:01+00:00","v":11.5673}]},"meta":{"range":"30d","truncated":false,"free_window_days":92,"history_days":92,"plan":null,"intraday":false,"dataset":{"name":"fx_rates","price":9,"endpoint":"/api/data/fx_rates"}}}}}},"401":{"description":"A key was sent but is wrong or revoked. Leave the header out to call without one.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"No series with that slug.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"externalDocs":{"url":"https://apighana.com/docs/reference#live-series"}}},"/api/market/{group}":{"get":{"operationId":"marketBoard","tags":["Live and markets"],"summary":"Market board","description":"The latest value of every series in one group.\n\nOn `banks`, Free keys and callers without a key see five banks; `meta.bank_by_bank` says when the list is cut.","security":[{},{"apiKey":[]}],"parameters":[{"name":"group","in":"path","required":true,"description":"`rates`, `banks`, `fuel`, `commodities`, `food` or `indicators`.","schema":{"type":"string"},"example":"rates"}],"responses":{"200":{"description":"The latest value of every series in one group.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Envelope"},"example":{"status":"success","message":"Latest rates","data":[{"id":13,"slug":"fx-gbp-ghs","name":"British pound to cedi","group":"fx","unit":"GHS per GBP","frequency":"daily","source_name":"exchangerate-api.com","source_url":"https://www.exchangerate-api.com","licence":"Free for use with attribution","dimensions":{"base":"GBP","quote":"GHS"},"latest_value":15.29257007,"latest_at":"2026-09-25T00:00:01+00:00","previous_value":15.33996024,"previous_at":"2026-09-24T00:00:02+00:00","change_pct":-0.3089,"first_at":"2026-09-18T00:00:01+00:00","observation_count":9,"stale":false}],"meta":{"group":"fx","plan":"free","history_days":7,"as_of":"2026-09-25T00:00:01+00:00"}}}}},"401":{"description":"A key was sent but is wrong or revoked.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Unknown market group.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"externalDocs":{"url":"https://apighana.com/docs/reference#market-board"}}},"/api/market/{group}/history":{"get":{"operationId":"marketHistory","tags":["Live and markets"],"summary":"Market history","description":"Observations for a group, or one series in it, between two dates. Paged with a cursor.\n\nHistory here follows the plan: 7 days without a key and on Free, 90 on Developer, everything on Business and Enterprise. `meta.clipped` is true when `from` was moved forward.\n\nKeep asking with `after = meta.next_cursor` until it is null.","security":[{},{"apiKey":[]}],"parameters":[{"name":"group","in":"path","required":true,"description":"`rates`, `banks`, `fuel`, `commodities`, `food` or `indicators`.","schema":{"type":"string"},"example":"rates"},{"name":"series","in":"query","required":false,"description":"One series slug. Leave out for the whole group.","schema":{"type":"string"},"example":"fx-usd-ghs"},{"name":"currency","in":"query","required":false,"description":"Only series whose base currency is this, e.g. `USD`.","schema":{"type":"string"},"example":"USD"},{"name":"from","in":"query","required":false,"description":"Start date, `YYYY-MM-DD`. Clipped to your plan's history.","schema":{"type":"string"},"example":"2026-09-01"},{"name":"to","in":"query","required":false,"description":"End date, `YYYY-MM-DD`.","schema":{"type":"string"},"example":"2026-09-25"},{"name":"limit","in":"query","required":false,"description":"Observations per page, 1 to 5,000.","schema":{"type":"integer","default":8},"example":"3"},{"name":"order","in":"query","required":false,"description":"`asc` or `desc`.","schema":{"type":"string","default":"asc"},"example":"desc"},{"name":"after","in":"query","required":false,"description":"`meta.next_cursor` from the previous page.","schema":{"type":"string"}}],"responses":{"200":{"description":"Observations for a group, or one series in it, between two dates. Paged with a cursor.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Envelope"},"example":{"status":"success","message":"rates history","data":[{"series":"fx-usd-ghs","observed_at":"2026-09-19T00:00:01+00:00","value":11.426},{"series":"fx-usd-ghs","observed_at":"2026-09-20T00:00:01+00:00","value":11.4837},{"series":"fx-usd-ghs","observed_at":"2026-09-21T00:00:01+00:00","value":11.5608}],"meta":{"series":[{"slug":"fx-usd-ghs","name":"US dollar to cedi","unit":"GHS per USD","frequency":"daily","dimensions":{"base":"USD","quote":"GHS"}}],"plan":"free","history_days":7,"from":"2026-09-18T08:50:41.415Z","to":null,"clipped":true,"upgrade":"Your plan reads 7 days of history. Developer reads 90 days, Business everything.","next_cursor":"MjAyNi0wOS0yMVQwMDowMDowMSswMDowMHwxMg","count":3,"intraday":false}}}}},"400":{"description":"A bad date, cursor or limit.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"A key was sent but is wrong or revoked.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Unknown market group.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"externalDocs":{"url":"https://apighana.com/docs/reference#market-history"}}},"/api/market/snapshot":{"get":{"operationId":"marketSnapshot","tags":["Live and markets"],"summary":"Daily snapshot","description":"Every series' value as recorded in today's snapshot, taken once a day. `data` is null before the first snapshot.","security":[],"responses":{"200":{"description":"Every series' value as recorded in today's snapshot, taken once a day. `data` is null before the first snapshot.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Envelope"},"example":{"status":"success","message":"Daily snapshot","data":{"snapshot_date":"2026-09-25","rows":[{"slug":"fx-usd-ghs","group":"fx","value":11.5673,"observed_at":"2026-09-25T00:00:01+00:00","is_carried_forward":false,"source":"exchangerate-api.com","raw":{"unit":"GHS per USD","frequency":"daily","change_pct":-0.0579,"previous_at":"2026-09-24T00:00:02+00:00","previous_value":11.574}}]}}}}}},"externalDocs":{"url":"https://apighana.com/docs/reference#market-snapshot"}}},"/api/news":{"get":{"operationId":"listNews","tags":["News"],"summary":"List stories","description":"Stories, newest first.\n\nNeeds the Developer plan or higher when called with a key.","security":[{},{"apiKey":[]}],"parameters":[{"name":"page","in":"query","required":false,"description":"Page number, from 1.","schema":{"type":"integer","default":8},"example":"1"},{"name":"limit","in":"query","required":false,"description":"Stories per page, up to 100.","schema":{"type":"integer","default":8},"example":"1"},{"name":"category","in":"query","required":false,"description":"`politics`, `business`, `technology`, `health`, `education`, `energy`, `agriculture`, `environment`, `sports`, `entertainment`, `society`, `world` or `general`.","schema":{"type":"string"},"example":"business"},{"name":"q","in":"query","required":false,"description":"Words in the headline or summary, up to 100 characters.","schema":{"type":"string"},"example":"cedi"},{"name":"source","in":"query","required":false,"description":"A source slug from GET /api/news/sources.","schema":{"type":"string"},"example":"myjoyonline"},{"name":"tag","in":"query","required":false,"description":"A tag.","schema":{"type":"string"},"example":"gold"},{"name":"outlet","in":"query","required":false,"description":"The outlet's domain.","schema":{"type":"string"},"example":"asaaseradio.com"},{"name":"from","in":"query","required":false,"description":"Published on or after, `YYYY-MM-DD`.","schema":{"type":"string"},"example":"2026-09-01"},{"name":"to","in":"query","required":false,"description":"Published on or before, `YYYY-MM-DD`.","schema":{"type":"string"},"example":"2026-09-25"},{"name":"sentiment","in":"query","required":false,"description":"`positive`, `neutral` or `negative`.","schema":{"type":"string"},"example":"positive"},{"name":"entity","in":"query","required":false,"description":"A person, company or place named in the story.","schema":{"type":"string"},"example":"Bank of Ghana"}],"responses":{"200":{"description":"Stories, newest first.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Envelope"},"example":{"status":"success","message":"News retrieved","data":[{"id":3879,"slug":"gold-shipments-resume-boosting-ghanas-forex-reserves-bog-governor-31239d","url":"https://asaaseradio.com/gold-shipments-resume-boosting-ghanas-forex-reserves-bog-governor","headline":"Gold shipments resume, boosting Ghana's forex reserves, says BoG governor","summary":"Fresh gold shipments from Ghana are accelerating foreign exchange reserve accumulation, with the Bank of Ghana confirming a significant export spike, though volatile international gold prices remain a challenge.","image_url":null,"source_name":"Asaase Radio","source_domain":"asaaseradio.com","author":"Winifred Lartey","category":"business","tags":["gold","bank of ghana","forex reserves","exports"],"region":"national","published_at":"2026-09-25T08:03:47+00:00","clicks":0,"sentiment":null,"entities":[]}],"meta":{"total":923,"page":1,"limit":1,"total_pages":923}}}}},"401":{"description":"A key was sent but is wrong or revoked.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"PLAN_REQUIRED: Needs the Developer plan or higher.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"externalDocs":{"url":"https://apighana.com/docs/reference#list-news"}}},"/api/news/categories":{"get":{"operationId":"newsCategories","tags":["News"],"summary":"Sections","description":"Each section with how many stories it has.\n\nNeeds the Developer plan or higher when called with a key.","security":[{},{"apiKey":[]}],"responses":{"200":{"description":"Each section with how many stories it has.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Envelope"},"example":{"status":"success","message":"Categories retrieved","data":[{"category":"politics","count":296},{"category":"business","count":251}]}}}},"403":{"description":"PLAN_REQUIRED: Needs the Developer plan or higher.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"externalDocs":{"url":"https://apighana.com/docs/reference#news-categories"}}},"/api/news/sources":{"get":{"operationId":"newsSources","tags":["News"],"summary":"Sources","description":"The outlets and feeds stories come from.\n\nNeeds the Developer plan or higher when called with a key.","security":[{},{"apiKey":[]}],"responses":{"200":{"description":"The outlets and feeds stories come from.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Envelope"},"example":{"status":"success","message":"Sources retrieved","data":[{"id":1,"name":"MyJoyOnline","slug":"myjoyonline","homepage":"https://www.myjoyonline.com","kind":"rss","item_count":1172}]}}}},"403":{"description":"PLAN_REQUIRED: Needs the Developer plan or higher.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"externalDocs":{"url":"https://apighana.com/docs/reference#news-sources"}}},"/api/news/trending":{"get":{"operationId":"newsTrending","tags":["News"],"summary":"Trending","description":"The most-read recent stories.\n\nNeeds the Developer plan or higher when called with a key.","security":[{},{"apiKey":[]}],"parameters":[{"name":"limit","in":"query","required":false,"description":"Up to 20.","schema":{"type":"integer","default":8},"example":"1"}],"responses":{"200":{"description":"The most-read recent stories.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Envelope"},"example":{"status":"success","message":"Trending retrieved","data":[{"id":3879,"slug":"gold-shipments-resume-boosting-ghanas-forex-reserves-bog-governor-31239d","url":"https://asaaseradio.com/gold-shipments-resume-boosting-ghanas-forex-reserves-bog-governor","headline":"Gold shipments resume, boosting Ghana's forex reserves, says BoG governor","summary":"Fresh gold shipments from Ghana are accelerating foreign exchange reserve accumulation, with the Bank of Ghana confirming a significant export spike, though volatile international gold prices remain a challenge.","image_url":null,"source_name":"Asaase Radio","source_domain":"asaaseradio.com","author":"Winifred Lartey","category":"business","tags":["gold","bank of ghana","forex reserves","exports"],"region":"national","published_at":"2026-09-25T08:03:47+00:00","clicks":0,"sentiment":null,"entities":[]}]}}}},"403":{"description":"PLAN_REQUIRED: Needs the Developer plan or higher.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"externalDocs":{"url":"https://apighana.com/docs/reference#news-trending"}}},"/api/news/story/{slug}":{"get":{"operationId":"newsStory","tags":["News"],"summary":"One story","description":"One story and related ones.\n\nNeeds the Developer plan or higher when called with a key.","security":[{},{"apiKey":[]}],"parameters":[{"name":"slug","in":"path","required":true,"description":"The story's `slug`.","schema":{"type":"string"},"example":"gold-shipments-resume-boosting-ghanas-forex-reserves-bog-governor-31239d"}],"responses":{"200":{"description":"One story and related ones.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Envelope"},"example":{"status":"success","message":"Story retrieved","data":{"id":3879,"slug":"gold-shipments-resume-boosting-ghanas-forex-reserves-bog-governor-31239d","url":"https://asaaseradio.com/gold-shipments-resume-boosting-ghanas-forex-reserves-bog-governor","headline":"Gold shipments resume, boosting Ghana's forex reserves, says BoG governor","summary":"Fresh gold shipments from Ghana are accelerating foreign exchange reserve accumulation, with the Bank of Ghana confirming a significant export spike, though volatile international gold prices remain a challenge.","image_url":null,"source_name":"Asaase Radio","source_domain":"asaaseradio.com","author":"Winifred Lartey","category":"business","tags":["gold","bank of ghana","forex reserves","exports"],"region":"national","published_at":"2026-09-25T08:03:47+00:00","clicks":0,"sentiment":null,"entities":[],"related":[]}}}}},"403":{"description":"PLAN_REQUIRED: Needs the Developer plan or higher.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"No story with that slug.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"externalDocs":{"url":"https://apighana.com/docs/reference#news-story"}}},"/api/data/{table}/export":{"get":{"operationId":"exportDataset","tags":["Exports"],"summary":"Download a dataset","description":"The dataset as a CSV or Excel file, streamed. Up to 250,000 rows.\n\nNeeds the Business plan or higher when called with a key.","security":[{"apiKey":[]}],"parameters":[{"name":"table","in":"path","required":true,"description":"A dataset name from the catalogue, e.g. `districts`, `health_facilities`, `schools`.","schema":{"type":"string"},"example":"districts"},{"name":"format","in":"query","required":false,"description":"`csv` or `xlsx`.","schema":{"type":"string","default":"csv"},"example":"csv"},{"name":"version","in":"query","required":false,"description":"A version from GET /api/datasets/{table}/versions, `YYYY-MM-DD`. Leave out for the current rows.","schema":{"type":"string"},"example":"2026-09-18"}],"responses":{"200":{"description":"The dataset as a CSV or Excel file, streamed. Up to 250,000 rows.","content":{"text/csv":{"schema":{"type":"string"},"example":"id,name,region,boundary_id,area_sqkm,...\n1,Adenta Municipal,Greater Accra Region,2480657B26321648161032,78.47,..."},"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet":{"schema":{"type":"string","format":"binary"}}}},"401":{"description":"No `X-API-Key` header, or the key is wrong or revoked.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"The key is inactive or the account is deactivated.\n\nPLAN_REQUIRED: Needs the Business plan or higher.\n\nACCESS_REQUIRED: The dataset is not on your key. `data.options` says how to get it: a yearly licence, a free pick, a pack or a plan.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"No dataset, or no such version.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Over your plan's requests per minute. Wait for `Retry-After` seconds.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"externalDocs":{"url":"https://apighana.com/docs/reference#export-dataset"}}},"/api/query/{table}/export":{"post":{"operationId":"exportQuery","tags":["Exports"],"summary":"Download a query","description":"The rows matching a query, as a CSV or Excel file. Excel files carry an \"About this data\" sheet.\n\nNeeds the Business plan or higher when called with a key.\n\nThe answer carries `X-Data-Source`, `X-Data-Last-Updated` and `X-Data-Covers` headers.","security":[{"apiKey":[]}],"parameters":[{"name":"table","in":"path","required":true,"description":"A dataset name from the catalogue, e.g. `districts`, `health_facilities`, `schools`.","schema":{"type":"string"},"example":"districts"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"format":{"type":"string","description":"`csv` or `xlsx`."},"where":{"type":"array","items":{"type":"object"},"description":"As in POST /api/query/{table}. `IN` also takes a comma-separated string here."},"order":{"type":"object","description":"`{ column, direction }`."}}},"example":{"format":"csv","where":[{"column":"region","operator":"=","value":"Upper West Region"}],"order":{"column":"name","direction":"asc"}}}}},"responses":{"200":{"description":"The rows matching a query, as a CSV or Excel file. Excel files carry an \"About this data\" sheet.","content":{"text/csv":{"schema":{"type":"string"},"example":"name,region,area_sqkm,...\nWa East,Upper West Region,4325,..."},"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet":{"schema":{"type":"string","format":"binary"}}}},"400":{"description":"A bad body or an unknown column.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"No `X-API-Key` header, or the key is wrong or revoked.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"The key is inactive or the account is deactivated.\n\nPLAN_REQUIRED: Needs the Business plan or higher.\n\nACCESS_REQUIRED: The dataset is not on your key. `data.options` says how to get it: a yearly licence, a free pick, a pack or a plan.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"No dataset by that name.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Over your plan's requests per minute. Wait for `Retry-After` seconds.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"externalDocs":{"url":"https://apighana.com/docs/reference#export-query"}}},"/api/market/exports":{"post":{"operationId":"queueExport","tags":["Exports"],"summary":"Queue a bulk export","description":"Starts a CSV or Parquet export of market history or a whole dataset. We email a download link when it is ready; you can also poll the job.\n\nNeeds the Business plan or higher when called with a key.","security":[{"apiKey":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"kind":{"type":"string","description":"`market` or `dataset`."},"format":{"type":"string","description":"`csv` or `parquet`."},"groups":{"type":"array","items":{"type":"string"},"description":"For `market`: any of `fx`, `fuel`, `banks`, `commodities`, `food`, `macro`. Leave out for all."},"from":{"type":"string","description":"For `market`: start date, `YYYY-MM-DD`."},"to":{"type":"string","description":"For `market`: end date, `YYYY-MM-DD`."},"table":{"type":"string","description":"For `dataset`: the dataset name."}}},"example":{"kind":"market","format":"csv","groups":["fx","fuel"],"from":"2026-01-01","to":"2026-09-24"}}}},"responses":{"201":{"description":"Starts a CSV or Parquet export of market history or a whole dataset. We email a download link when it is ready; you can also poll the job.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Envelope"},"example":{"status":"success","message":"Export queued. You will get an email with the link.","data":{"id":41,"kind":"market","params":{"groups":["fx","fuel"],"from":"2026-01-01","to":"2026-09-24"},"format":"csv","status":"queued","rows":null,"bytes":null,"download_url":null,"expires_at":null,"error":null,"created_at":"2026-09-25T09:00:00.000Z","finished_at":null}}}}},"400":{"description":"A bad body (`BAD_PARAMS`).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"No `X-API-Key` header, or the key is wrong or revoked.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"The key is inactive or the account is deactivated.\n\nPLAN_REQUIRED: Needs the Business plan or higher.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"TOO_MANY: Three exports are already running.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"externalDocs":{"url":"https://apighana.com/docs/reference#queue-export"}},"get":{"operationId":"listExports","tags":["Exports"],"summary":"List exports","description":"Your export jobs, with their status and, once finished, a download link and when it expires.\n\nNeeds the Business plan or higher when called with a key.","security":[{"apiKey":[]}],"responses":{"200":{"description":"Your export jobs, with their status and, once finished, a download link and when it expires.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Envelope"},"example":{"status":"success","message":"Your exports","data":[{"id":41,"kind":"market","params":{"groups":["fx","fuel"],"from":"2026-01-01","to":"2026-09-24"},"format":"csv","status":"done","rows":5420,"bytes":318204,"download_url":"https://…/exports/41.csv?token=…","expires_at":"2026-10-02T09:01:12.000Z","error":null,"created_at":"2026-09-25T09:00:00.000Z","finished_at":"2026-09-25T09:01:12.000Z"}]}}}},"401":{"description":"No `X-API-Key` header, or the key is wrong or revoked.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"The key is inactive or the account is deactivated.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"externalDocs":{"url":"https://apighana.com/docs/reference#list-exports"}}},"/api/market/exports/{id}":{"get":{"operationId":"getExport","tags":["Exports"],"summary":"Get an export","description":"One export job. Poll until `status` is `done`, then fetch `download_url`.\n\nNeeds the Business plan or higher when called with a key.","security":[{"apiKey":[]}],"parameters":[{"name":"id","in":"path","required":true,"description":"The job's `id`.","schema":{"type":"integer","default":8},"example":"41"}],"responses":{"200":{"description":"One export job. Poll until `status` is `done`, then fetch `download_url`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Envelope"},"example":{"status":"success","message":"Export","data":{"id":41,"kind":"market","params":{"groups":["fx","fuel"],"from":"2026-01-01","to":"2026-09-24"},"format":"csv","status":"queued","rows":null,"bytes":null,"download_url":null,"expires_at":null,"error":null,"created_at":"2026-09-25T09:00:00.000Z","finished_at":null}}}}},"401":{"description":"No `X-API-Key` header, or the key is wrong or revoked.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"The key is inactive or the account is deactivated.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"No export with that id on your account.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"externalDocs":{"url":"https://apighana.com/docs/reference#get-export"}}},"/api/market/webhooks":{"get":{"operationId":"listWebhooks","tags":["Webhooks"],"summary":"List endpoints","description":"Your webhook endpoints, the events you can subscribe to, and the last 30 deliveries.\n\nNeeds the Business plan or higher when called with a key.","security":[{"apiKey":[]}],"responses":{"200":{"description":"Your webhook endpoints, the events you can subscribe to, and the last 30 deliveries.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Envelope"},"example":{"status":"success","message":"Webhook endpoints","data":{"endpoints":[{"id":7,"url":"https://example.com/hooks/apighana","events":["rates.changed","fuel.changed"],"description":"Pricing service","active":true,"created_at":"2026-09-25T09:00:00.000Z","failures":0,"last_delivery_at":"2026-09-25T08:00:03.000Z","last_status":200,"disabled_at":null}],"events":["rates.changed","fuel.changed","commodities.changed","food.changed","macro.changed","news.published"],"deliveries":[]}}}}},"401":{"description":"No `X-API-Key` header, or the key is wrong or revoked.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"The key is inactive or the account is deactivated.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"externalDocs":{"url":"https://apighana.com/docs/reference#list-webhooks"}},"post":{"operationId":"createWebhook","tags":["Webhooks"],"summary":"Add an endpoint","description":"Registers a URL for the events you choose. The answer includes the signing `secret`, shown only this once.\n\nNeeds the Business plan or higher when called with a key.","security":[{"apiKey":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"url":{"type":"string","description":"A public `https` URL."},"events":{"type":"array","items":{"type":"string"},"description":"Any of `rates.changed`, `fuel.changed`, `commodities.changed`, `food.changed`, `macro.changed`, `news.published`."},"description":{"type":"string","description":"Up to 120 characters."}},"required":["url"]},"example":{"url":"https://example.com/hooks/apighana","events":["rates.changed","fuel.changed"],"description":"Pricing service"}}}},"responses":{"201":{"description":"Registers a URL for the events you choose. The answer includes the signing `secret`, shown only this once.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Envelope"},"example":{"status":"success","message":"Endpoint added. Keep the secret; it is shown once.","data":{"id":7,"url":"https://example.com/hooks/apighana","events":["rates.changed","fuel.changed"],"description":"Pricing service","active":true,"created_at":"2026-09-25T09:00:00.000Z","secret":"whsec_3f9c…"}}}}},"400":{"description":"BAD_URL: The URL is not a public https address.\n\nBAD_EVENTS: No known event was chosen.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"No `X-API-Key` header, or the key is wrong or revoked.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"The key is inactive or the account is deactivated.\n\nPLAN_REQUIRED: Needs the Business plan or higher.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"TOO_MANY: You already have 10 endpoints.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"externalDocs":{"url":"https://apighana.com/docs/reference#create-webhook"}}},"/api/market/webhooks/{id}":{"patch":{"operationId":"updateWebhook","tags":["Webhooks"],"summary":"Change an endpoint","description":"Changes the URL, events or description, or switches the endpoint off and on.\n\nNeeds the Business plan or higher when called with a key.","security":[{"apiKey":[]}],"parameters":[{"name":"id","in":"path","required":true,"description":"The endpoint's `id`.","schema":{"type":"integer","default":8},"example":"7"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"url":{"type":"string","description":"A public `https` URL."},"events":{"type":"array","items":{"type":"string"},"description":"Replaces the list."},"description":{"type":"string","description":"Up to 120 characters."},"active":{"type":"boolean","description":"`false` stops deliveries; `true` resumes them."}}},"example":{"events":["rates.changed","fuel.changed","news.published"],"active":true}}}},"responses":{"200":{"description":"Changes the URL, events or description, or switches the endpoint off and on.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Envelope"},"example":{"status":"success","message":"Endpoint updated","data":{"id":7,"url":"https://example.com/hooks/apighana","events":["rates.changed","fuel.changed","news.published"],"description":"Pricing service","active":true,"created_at":"2026-09-25T09:00:00.000Z","failures":0}}}}},"400":{"description":"BAD_URL: The URL is not a public https address.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"No `X-API-Key` header, or the key is wrong or revoked.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"The key is inactive or the account is deactivated.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"No endpoint with that id on your account.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"externalDocs":{"url":"https://apighana.com/docs/reference#update-webhook"}},"delete":{"operationId":"deleteWebhook","tags":["Webhooks"],"summary":"Remove an endpoint","description":"Removes the endpoint; nothing more is sent to it.\n\nNeeds the Business plan or higher when called with a key.","security":[{"apiKey":[]}],"parameters":[{"name":"id","in":"path","required":true,"description":"The endpoint's `id`.","schema":{"type":"integer","default":8},"example":"7"}],"responses":{"200":{"description":"Removes the endpoint; nothing more is sent to it.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Envelope"},"example":{"status":"success","message":"Endpoint removed","data":null}}}},"401":{"description":"No `X-API-Key` header, or the key is wrong or revoked.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"The key is inactive or the account is deactivated.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"externalDocs":{"url":"https://apighana.com/docs/reference#delete-webhook"}}},"/api/market/webhooks/{id}/test":{"post":{"operationId":"testWebhook","tags":["Webhooks"],"summary":"Send a test","description":"Sends a `test` event to this endpoint now, so you can check your receiver and its signature check.\n\nNeeds the Business plan or higher when called with a key.","security":[{"apiKey":[]}],"parameters":[{"name":"id","in":"path","required":true,"description":"The endpoint's `id`.","schema":{"type":"integer","default":8},"example":"7"}],"responses":{"200":{"description":"Sends a `test` event to this endpoint now, so you can check your receiver and its signature check.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Envelope"},"example":{"status":"success","message":"Test delivery attempted","data":{"delivered":1,"failed":0,"dead":0}}}}},"401":{"description":"No `X-API-Key` header, or the key is wrong or revoked.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"The key is inactive or the account is deactivated.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"No endpoint with that id on your account.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"externalDocs":{"url":"https://apighana.com/docs/reference#test-webhook"}}},"/api/status":{"get":{"operationId":"status","tags":["Status and plans"],"summary":"Status","description":"Whether the API, the database, the live feeds and the daily dataset checks are working. The same data as the status page.","security":[],"responses":{"200":{"description":"Whether the API, the database, the live feeds and the daily dataset checks are working. The same data as the status page.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Envelope"},"example":{"status":"success","message":"Status","data":{"state":"operational","components":[{"name":"API","state":"operational"},{"name":"Database","state":"operational","latency_ms":181},{"name":"Live data feeds","state":"operational"},{"name":"Dataset checks","state":"operational"}],"feeds":[{"feed":"fx","label":"Exchange rates","state":"operational","last_success_at":"2026-09-25T07:38:14.599+00:00"}],"datasets":{"checked":284,"ok":162,"warning":120,"error":2,"last_checked_at":"2026-09-25T02:17:54.612+00:00","state":"operational"},"checked_at":"2026-09-25T08:50:46.703Z"}}}}}},"externalDocs":{"url":"https://apighana.com/docs/reference#status"}}},"/api/health":{"get":{"operationId":"health","tags":["Status and plans"],"summary":"Health","description":"Answers 200 while the API process is running. For uptime monitors.","security":[],"responses":{"200":{"description":"Answers 200 while the API process is running. For uptime monitors.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Envelope"},"example":{"status":"success","message":"API Ghana is running","data":{"uptime":1182.66}}}}}},"externalDocs":{"url":"https://apighana.com/docs/reference#health"}}},"/api/health/ready":{"get":{"operationId":"ready","tags":["Status and plans"],"summary":"Ready","description":"Like health, but also checks the database: 503 when it cannot be reached.","security":[],"responses":{"200":{"description":"Like health, but also checks the database: 503 when it cannot be reached.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Envelope"},"example":{"status":"success","message":"API Ghana is ready","data":{"database":"ok","database_ms":172}}}}},"503":{"description":"The database cannot be reached.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"externalDocs":{"url":"https://apighana.com/docs/reference#ready"}}},"/api/plans":{"get":{"operationId":"plans","tags":["Status and plans"],"summary":"Plans","description":"Every plan with its price and limits: requests per minute, rows per page, history, exports, webhooks, News API.","security":[],"parameters":[{"name":"currency","in":"query","required":false,"description":"`GHS` or `USD`. Chosen from your country when left out.","schema":{"type":"string"},"example":"USD"}],"responses":{"200":{"description":"Every plan with its price and limits: requests per minute, rows per page, history, exports, webhooks, News API.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Envelope"},"example":{"status":"success","message":"Plans","data":{"currency":"USD","tiers_enabled":true,"vat_rate":0.15,"plans":[{"code":"developer","name":"Developer","currency":"USD","monthly":19,"annual":190,"rate_per_minute":600,"rows_per_page":500,"history_days":90,"catalogue":"all","free_dataset_limit":0,"exports":"none","webhooks":false,"news_api":true,"intraday":false,"bank_rows":null,"support":"Email, 3 business days","uptime_target":null,"self_serve":true}]}}}}}},"externalDocs":{"url":"https://apighana.com/docs/reference#plans"}}},"/mcp":{"post":{"operationId":"mcpTools","tags":["MCP"],"summary":"List tools","description":"The tools the server offers. Stateless: no session to open first.\n\nSend the key as `X-API-Key`, or as `Authorization: Bearer <key>` for clients that only send that. Without a key, tools that read rows say how to get one.","security":[{},{"apiKey":[]}],"parameters":[{"name":"Accept","in":"header","required":true,"schema":{"type":"string","default":"application/json, text/event-stream"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object"},"example":{"jsonrpc":"2.0","id":1,"method":"tools/list"}}}},"responses":{"200":{"description":"The tools the server offers. Stateless: no session to open first.","content":{"text/event-stream":{"schema":{"type":"string"},"example":"event: message\ndata: {\"result\":{\"tools\":[{\"name\":\"search_datasets\",\"title\":\"Search Ghana datasets\",…},{\"name\":\"describe_dataset\",…},{\"name\":\"get_rows\",…},{\"name\":\"query_dataset\",…},{\"name\":\"get_market\",…},{\"name\":\"get_series\",…},{\"name\":\"search_news\",…}]},\"jsonrpc\":\"2.0\",\"id\":1}"}}}},"externalDocs":{"url":"https://apighana.com/docs/reference#mcp-tools"}}}},"components":{"securitySchemes":{"apiKey":{"type":"apiKey","in":"header","name":"X-API-Key"}},"schemas":{"Envelope":{"type":"object","required":["status","message"],"properties":{"status":{"type":"string","enum":["success"]},"message":{"type":"string"},"data":{},"meta":{"type":"object","additionalProperties":true}}},"Error":{"type":"object","required":["status","message"],"properties":{"status":{"type":"string","enum":["error"]},"message":{"type":"string"},"code":{"type":"string"},"errors":{"type":"array","items":{"type":"object","properties":{"field":{"type":"string"},"issue":{"type":"string"}}}},"data":{"type":"object","additionalProperties":true},"request_id":{"type":"string"}}}}}}