APIs related to Stocks
MUSAFFA B2B API (1.0.0)
Musaffa’s API is one of the most comprehensive Shariah-Compliant Stock Screener organized around REST. Our API has predictable resource-oriented URLs, accepts form-encoded request bodies, returns JSON-encoded responses, and uses standard HTTP response codes, authentication, and verbs.
All requests are made to endpoints beginning: https://b2b.musaffa.us/b2b/api.
By using Musaffa’s API, you agree to our Terms of Use.
There are limitations for the API calls.
Depending on the B2B subscription plan it can be up to 100 000 API calls per month and 1 API call per second.
If your limit is exceeded, you will receive a response with status code 429.
Musaffa will provide a secret key and a client ID to every B2B client.
secretKey=< should be shared separately for each client >
clientId=< should be shared separately for each client >
UTC is used for time zone “UTC+5”
TimeZone = "UTC"
DateTimeFormatter = "yyyyMMddHHmmss"
Using current time, the secret key, the client ID and a body of the message a token is generated using the following code:
token = Base64.getEncoder().encodeToString(DigestUtils.sha512 (secretKey + time + json String body))
The token is placed in the header of the message for both sides of the communication and used for validating messages.
String secretKey = "gRUsdfsdfkv8yBEyQWGbPeShVmYq3tREWRC&F)JMcQfTjWnZ"
String jsonInStringBody = "{"stock":"AAPL"}"
String time = ZonedDateTime.ofInstant(nowUtc,zoneId).format(DateTimeFormatter.ofPattern("yyyyMMddHHmmss"));
String token = Base64.getEncoder().encodeToString(DigestUtils.sha512(secretKey + time + jsonInStringBody));
https://docs.musaffa.us/_mock/apis/
https://b2b.musaffa.us/b2b/api/
https://b2b.musaffa.us/b2b/api/v1/
Request
Get the Request Statistics of your account.
| Parameter | Type | Description |
|---|---|---|
| clientId | string | Client ID |
| companyName | string | Company Name |
| subscriptionPlan | string | Subscription Plan |
| monthlyRequestLimit | number | Monthly request limit |
| activeMonthRequestAmount | number | Number of requests made for the active month |
| lastRequestDate | dateTime | Last request date |
| subscriptionEndDate | dateTime | Subscription end date |
| activeMonthStartDate | dateTime | Start date of the active month |
- Mock server
https://docs.musaffa.us/_mock/apis/v1/b2b-users/statistics
https://b2b.musaffa.us/b2b/api/v1/b2b-users/statistics
https://b2b.musaffa.us/b2b/api/v1/v1/b2b-users/statistics
- curl
- JavaScript
- Node.js
- Python
- Java
- C#
- PHP
- Go
- Ruby
- R
- Payload
curl -i -X GET \
https://docs.musaffa.us/_mock/apis/v1/b2b-users/statistics \
-H 'clientid: AX6kFk5ywERyZacb' \
-H 'time: {{time}}' \
-H 'token: YOUR_API_KEY_HERE'{ "activeMonthRequestAmount": 146, "activeMonthStartDate": "2023-06-14T12:00:00.7105", "clientId": "test-4WkMxTnpRcEdhRW1Sbk", "companyName": "TEST", "lastRequestDate": "2023-06-16T06:48:16.547655", "monthlyRequestLimit": 100000, "subscriptionEndDate": "2023-07-14T12:00:00.7105", "subscriptionPlan": "Annual Premium" }