Skip to content

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.

Developer Agreement

By using Musaffa’s API, you agree to our Terms of Use.

Rate Limits

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.

Authentication and API

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.

Example Token Generation

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));
Download OpenAPI description
Overview
Languages
Servers
Mock server

https://docs.musaffa.us/_mock/apis/

https://b2b.musaffa.us/b2b/api/

https://b2b.musaffa.us/b2b/api/v1/

Operations
Operations

Customer Account

Customer account management APIs

Operations