Get Organization Details
Learn how to retrieve information about your active merchant organization, including your current deposit account balance and organization name.
Overview
The Get Organization endpoint allows you to retrieve the profile details of the merchant organization associated with your API credentials. This is particularly useful for checking your operating balance before initiating payouts or verifying that your integration is correctly targeting the right merchant entity.
Endpoint Information
| Feature | Details |
|---|---|
| Method | GET |
| URL | /merchant/organization |
| Auth | API Key & Secret (Headers) |
Response Structure
The API returns a JSON object containing the organization's identity and financial standing.
Attributes
name(String): The legal or trade name of your registered organization.depositAccount(Object): An object containing the current balance information.prefixedAmount(String): A human-readable string showing the balance formatted with the currency (e.g.,6 F CFA).amount(Number): The precise numerical value of the balance (e.g.,6.259916). Use this for programmatic logic or threshold checks.
Integration Use Cases
1. Balance Monitoring
Before performing a Credit (transfer to customer), your system should verify if the amount in your depositAccount is sufficient to cover the transaction.
2. Connection Heartbeat
This endpoint can be used as a "Health Check" for your integration. If you can successfully retrieve your organization details, it confirms that your X-Auth-ApiKey and X-Auth-ApiSecret are valid and active.
HTTP Status Codes
| Status Code | Meaning | Action |
|---|---|---|
| 200 OK | Success. | Organization data retrieved successfully. |
| 401 Unauthorized | Invalid credentials. | Verify your API Key and Secret. |
| 403 Forbidden | Insufficient permissions. | Ensure your account has "Merchant" access levels. |
Example Request
import axios from 'axios';
const apiKey = 'your-api-key';
const apiSecret = 'your-api-secret';
axios.get('[https://svc.test.bestcash.me/merchant/organization](https://svc.test.bestcash.me/merchant/organization)', {
headers: {
'X-Auth-ApiKey': apiKey,
'X-Auth-ApiSecret': apiSecret
},
})
.then(response => {
const { name, depositAccount } = response.data;
console.log(`Connected to: ${name}`);
console.log(`Current Balance: ${depositAccount.prefixedAmount}`);
if (depositAccount.amount < 100) {
console.warn('Alert: Low balance for operations.');
}
})
.catch(error => {
console.error('Failed to retrieve organization data:', error.message);
});