Skip to content

Provider API

The Provider API base address is https://dispensaryapi.famasi.africa/api/v1/providers. Authenticate requests with a provider API key in x-api-key.

Operations

MethodPathDescription
GET/meFetch the authenticated provider’s details
POST/me/tokenRefresh the provider’s API token
GET/customersFetch customers for a provider
POST/customersCreate a new customer/patient for a provider
GET/plansFetch plans for a provider
GET/formularySearch products in the formulary
GET/analyticsFetch analytics data for a provider
GET/provider-orders/analyticsFetch analytics data for provider orders
GET/orders-statsFetch statistics for provider orders
POST/usersAdd a user to a provider
PUT/customers/{unique_customer_id}Edit a customer in the provider’s organization
POST/customers/{unique_customer_id}/plansAdd a customer to a plan
GET/profilesFetch user profiles
POST/update-payment-typeUpdate the preferred payment type for a provider
POST/set-low-balance-thresholdSet the low wallet balance threshold for a provider
POST/toggle-auto-debitToggle auto-debit functionality for a provider
GET/view-customer/{customer_id}View details of a specific customer/patient
POST/upload_logoUpload a logo for a provider
PUT/editEdit provider information
GET/wallet-balanceFetch the wallet balance of a provider
GET/transactionsFetch the transaction history of a provider
GET/ordersFetch all orders for a provider
POST/ordersCreate a new order for a provider
GET/virtual-accountsFetch all virtual accounts for a provider

Fields and examples for each operation are on these pages: Customers, Orders, Formulary, Analytics, Wallet, Users and Settings.

Responses

Every response is JSON with success and message. Most successful responses put the result in data.

{ "success": true, "message": "...", "data": {} }

Each operation’s page lists the fields it returns and the errors it can send back. Common errors are 400 for a bad request, 404 when something isn’t found, 429 when you’ve sent too many requests and 500 for an error on our side. Some operation pages list 401, but a missing or wrong key currently comes back as 500 with the message Invalid credentials.

Rate limits

You can send 200 requests every 3 minutes from one IP address. After that you get a 429 until the window resets. Every response carries RateLimit-Limit, RateLimit-Remaining and RateLimit-Reset headers, and the reset value is in seconds.

Paging

GET /customers, GET /formulary, GET /orders and GET /orders-stats take a page value, starting at 1. GET /customers and GET /orders also take limit, which defaults to 10.

Test environment

GET /me returns both your api_key and your test_api_key. Use the test key at the same address: a key starting FAMASI-TEST-KEY- works on test data, and test orders don’t reach pharmacies.

Quick example

Terminal window
curl "https://dispensaryapi.famasi.africa/api/v1/providers/formulary?search=amoxicillin" \
-H "x-api-key: YOUR_PROVIDER_API_KEY"

Provider API keys →