Create a Team (Account)
const url = 'https://api.payhero.africa/api/v2/accounts';const options = { method: 'POST', headers: {Authorization: 'Basic <credentials>', 'Content-Type': 'application/json'}, body: '{"organization_id":9,"name":"Vendor A","description":"WiFi vendor onboarded via our platform","email":"vendor-a@acme.co","dial_code":"+254","number":"711000111"}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request POST \ --url https://api.payhero.africa/api/v2/accounts \ --header 'Authorization: Basic <credentials>' \ --header 'Content-Type: application/json' \ --data '{ "organization_id": 9, "name": "Vendor A", "description": "WiFi vendor onboarded via our platform", "email": "vendor-a@acme.co", "dial_code": "+254", "number": "711000111" }'Provisions a new Team under your organization. A dedicated service
wallet is created automatically. The Team’s currency is derived from
the dial_code + number country. The creator defaults to the user
behind the API key when user_id is omitted.
Authorizations
Section titled “Authorizations”Request Bodyrequired
Section titled “Request Bodyrequired”object
The organization the Team belongs to.
E.164 country dial code. Combined with number.
Local phone number. The Team’s currency is derived from this number’s country.
Creator. Defaults to the user behind the API key when omitted.
Custom account UUID/slug. Auto-generated when omitted.
Examples
{ "organization_id": 9, "name": "Vendor A", "description": "WiFi vendor onboarded via our platform", "email": "vendor-a@acme.co", "dial_code": "+254", "number": "711000111"}Responses
Section titled “Responses”The created Team.
object
A Team — an isolated Account with its own scoped wallet, payment channels, KYC and members.
object
Derived from the account phone number’s country at creation.
Example
{ "account": { "id": 63, "organization_id": 9, "name": "Vendor A", "description": "WiFi vendor onboarded via our platform", "currency": "KES", "number": "254711000111", "email": "vendor-a@acme.co", "status": "active", "account_type": "prepaid", "kyc_tier": 1, "kyc_verified": false, "service_wallet_balance": 0, "theme_color": "#0A7C4A", "notify_amount": 500 }}The request was rejected (validation or business-rule failure).
object
Examples
{ "error_code": "invalid_argument", "error_message": "the transaction amount is insufficient as it wont cater for cost: (4.62)", "status_code": 400}{ "error_code": "invalid_argument", "error_message": "The passed channel is not active", "status_code": 400}Missing or invalid Basic auth credentials.
object
Example
{ "error_code": "invalid_argument", "error_message": "the transaction amount is insufficient as it wont cater for cost: (4.62)", "status_code": 400}
