You have a ticker, an API key in your inbox, and a ticket that says "put the compliance verdict on the dashboard." You send the request, get a 200 OK, and the screen stays blank. Or worse, it fills with a verdict you can't defend when someone asks where the number came from.

That gap between a working request and a trustworthy feature is where most first integrations stall. This walkthrough builds a real one, a Shariah screening client, and treats each verdict as evidence with a date and a methodology attached rather than a permanent yes or no.

Table of Contents

Make Your First REST Request, Step by Step

A 200 only means the server answered. Roy Fielding began work on REST between October 1994 and August 1995, formalised it in his 2000 dissertation, and reported web applications scaling from roughly 100,000 requests per day in 1994 to 600,000,000 requests per day in 1999 on a deliberately thin contract (Fielding's dissertation). The client asks for a resource with a standard HTTP method and gets a representation such as JSON. It learns nothing about the server's internals. The status line works like a shipping label. The evidence you can show a compliance reviewer sits in the crate: verdict, ratios, coverage, and the data date.

A step-by-step infographic illustrating how to perform a REST API request for a software application.

Run that first stock call in this order. Each step blocks a failure that shows up as an empty dashboard.

  1. Create the key. Create a free account, then open Dashboard → API Keys and generate a key. That key is the identity on every request. The day-one slip is pasting it into a public repository or a support-ticket screenshot.
  2. Move it into the environment. Read the key from an environment variable on your server at runtime. Browser JavaScript and a mobile binary are both readable by anyone who looks, so the key never ships in either.
  3. Build the full URL. Use https://b2b-api.akinda.io as the host and append the endpoint path from the docs for one ticker, one of the five stock endpoints. Build it in code from a base URL constant, so a staging host does not need a find-and-replace later.
  4. Send a GET with three things set. Put the key in an X-API-Key header, send Accept: application/json, and set a timeout of about ten seconds. In Python the call is one line: requests.get(url, headers={"X-API-Key": key, "Accept": "application/json"}, timeout=10). Without the timeout, a stalled connection holds your worker until the process dies.
  5. Check the status before you read the body. A 401 body is not screening data. Parsing it as if it were produces a silent empty result. Branch on the status code first.
  6. Parse into a typed object. Keep verdict, ratios, coverage and data date as separate fields from the first commit. Ratios and coverage are the methodology. The data date says when that methodology was applied. Flattening all of it into one "compliant" string is the mistake you pay for when someone asks why last quarter's screen changed.
  7. Log the ticker, status, timestamp and request ID. When a verdict looks wrong in production, that line is the difference between a five-minute investigation and a lost afternoon.

Before you go further, it helps to know what failure looks like on purpose. how to test REST endpoints walks through the negative cases a first tutorial skips, including malformed identifiers and authorization boundaries.

What a healthy first call looks like: a 200 response whose verdict is one data point with a date and a methodology attached, not a permanent answer.

Choosing How to Send Your API Key

Akinda authenticates requests with a single API key, sent either as an apikey query parameter or as an X-API-Key header. Both work. They are not equally safe, and the difference shows up months later in someone else's log file.

Method How the key is sent Best for Main risk
X-API-Key header Sent as a request header Server code and most client libraries Key can leak if logs record full headers
Query parameter Added to the URL as apikey Quick checks in a browser or shell Key appears in logs, history and proxies
Secret store injection Read at runtime and placed in the header Production services Needs a rotation process and access control

The query parameter is fine for a curl call you paste once and forget. In production code it's a liability, because URLs get recorded by proxies, load balancers and browser history in places you never audited. Send the header.

The hardening checklist that travels with the key:

  • Server-side only. Call the API from your backend over TLS. A key in client code is a public key.
  • Least privilege inside your own service. One user must never read another user's portfolio data, even though the API key is shared across all of them.
  • Limits on your side. Set request-size and rate limits before traffic finds them for you.
  • Audit logs and an endpoint inventory. Keep a list of every endpoint your app calls. OWASP's 2023 API risk list names broken object-level authorization, unrestricted resource consumption, unsafe consumption of APIs and security misconfiguration among the top failures, and an inventory is what makes the last one visible (OWASP presentation).
  • Contract-first tests. Define the schema and scopes, generate or validate typed clients, then test malformed identifiers, null financial fields, insufficient-coverage responses and authorization boundaries in CI. A benchmark of 607 real-world REST defects across 50 projects found that 42% involved data validation or query processing, while another 27% involved configuration or environment problems (ACM study). Those are exactly the failures a schema plus negative tests catch early.

Rotation rule: an API key authenticates as its owner. If it may have been exposed, rotate it from the dashboard immediately, update the secret store, and confirm the old key now fails before you close the ticket. The storage patterns that make rotation a two minute job rather than an outage are covered in securing and rotating API keys.

If you're wiring this into a regulated product, the fintech API integration patterns that survive an audit are the ones where credentials never touch the client and every call is traceable to a user.

Reading Screening Responses Without Guessing

A screening response is not a pass or fail. It's a verdict plus the inputs that produced it, and your code should read it in that order: verdict first, then the numbers behind it. A basic tutorial stops at the binary result. A financial application can't, because the same company can come out compliant under one rulebook and non-compliant under another.

Peer-reviewed research shows that mainstream screening methodologies from Dow Jones, FTSE and S&P can produce materially different risk outcomes, and that the same firm can receive different classifications under different rulebooks (Wiley article). The cause is arithmetic, not opinion. One standard divides interest-bearing debt by a market-capitalisation average; another divides by total assets. Same company, same quarter, two defensible answers.

That's why a single "halal" field reduces transparency instead of simplifying it. It hides the threshold choice and makes your back-test irreproducible.

Response field What it tells you How your code should handle it
Compliance verdict Pass, fail or unrated under one named methodology Store the methodology name with it; treat unrated as review, not pass
Interest-bearing debt ratio Debt against a twelve-quarter average market cap, tested against 30% under AAOIFI Compare against the methodology's own threshold, never a hardcoded number
Non-compliant revenue share Share of revenue from prohibited activities, tested against 5% under AAOIFI Show the figure next to the verdict so users see the margin
Coverage percentage How much of the holdings or data the verdict is based on Below your threshold, display unrated rather than a verdict
Null value A figure the source did not allow to be computed Keep as null; converting to zero creates a false clean result

Three handling rules follow from that table, and they're worth writing into your data model rather than your UI layer.

Null is not zero. A missing debt figure means the filing didn't allow the calculation. Substituting zero turns an unknown into a clean pass, which is the most expensive bug in this entire integration.

Unrated is a state, not an error. When coverage falls short, show a review state with the reason attached. Users can act on "we don't have enough data on this fund" far better than on a wrong answer.

Surface the reason on screen. If the verdict is fail, the user should see which ratio breached and by how much. Our stock screener API documentation shows the field structure for verdicts, ratios and full reports, which is a useful reference for the shape your own normalized model should take.

Handling Errors, Rate Limits and Retries

The most common production failure isn't a crash. It's a 401 or a 429 that your code catches, logs at debug level, and converts into an empty result, so the dashboard shows "no data" for a stock that is perfectly well covered.

Symptom Likely cause Fix
400 Bad Request Malformed ticker or parameter Fix input validation before sending the call again
429 Too Many Requests Request allowance used up or bursts too fast Back off with exponential delay and jitter, and check usage against your plan
5xx or timeout Server-side or network failure Retry idempotent GETs with a bounded limit, then log the request ID and alert

Build the retry policy deliberately. Retry only GET requests and other idempotent calls. Use exponential backoff with jitter so a fleet of workers doesn't resynchronise into a thundering herd. Cap attempts at three or four, and honour any wait guidance the response gives you. For anything that creates or changes state, use an idempotency key instead of hoping a duplicate is harmless.

Don't retry these. A 400 or 404 needs a validation fix, and repeating the call just burns your allowance. A 403 means the key's access scope or plan doesn't cover the endpoint, so rerunning the job changes nothing. Both belong in a dead-letter path with an alert, not a retry loop.

Akinda records which endpoints each key calls, how often, and with what response status in order to enforce plan limits. That means a burst inside your own code can exhaust an allowance while every individual call looks healthy. Keep a local request counter and alert at, say, seventy percent of your expected volume, well before the ceiling.

Logging that pays for itself: status, endpoint, request ID and timestamp on every call. A support ticket with a request ID is a five minute lookup. Without one, it's a multi-day reconstruction.

Keeping Screening Verdicts Fresh After Launch

A 200 response proves the API answered. It does not prove the verdict is current. Filings get revised, ETF constituents change, and classifications are updated, so a cached verdict can go stale while every health check stays green.

The scale of modern API operations makes this easy to miss. UK open banking recorded 24 billion API calls in 2025, up 27% year over year, with weighted availability above 99.50% and an average response time of 324 milliseconds (Open Banking Limited). Excellent availability and current financial data are two different guarantees. Our API doesn't include real-time stock prices either, so the freshness that matters here is the verdict and its data date, not the quote.

A hand-drawn illustration showing how updated regulatory filings cause cached market data to become stale over time.

Polling harder is the instinct, and it's the wrong one. More frequent polls raise cost and rate-limit pressure while still missing what a change means for a portfolio. Design for events instead.

  1. Store each verdict with its data date and the time you fetched it.
  2. Cache report versions as immutable records keyed by ticker and methodology.
  3. Subscribe to verdict-change webhooks where your plan includes them, and verify the signature before processing.
  4. Process each event ID once, so a retry doesn't duplicate the change.
  5. Reconcile events against a scheduled snapshot to catch missed deliveries.
  6. Send events that keep failing to a dead-letter queue.
  7. Show the data date on every screen that displays a verdict.

Webhook delivery and verdict-change feeds are available on our Business Ultimate and Business Enterprise plans, so the event-driven path is a plan decision as much as an architecture one. Start with Akinda webhooks to see the payload shape before you commit to a polling design you'll have to unwind.

Testing the Integration Before You Ship

A green build proves very little if your tests only assert on HTTP 200. The interesting defects in a screening client live in the gap between "the call worked" and "the answer is right."

Write these checks before you write the dashboard:

  • A known ticker. One you understand well enough to eyeball the ratios and the verdict.
  • A malformed identifier. Confirm the client returns a clean validation error rather than an exception.
  • Null financial fields. Assert that nulls survive your mapping layer as nulls, not as zero.
  • An insufficient-coverage response. Confirm the UI shows unrated, not a verdict.
  • A second account. Prove one user cannot read another user's portfolio data.
  • A schema-change check. Validate live responses against your OpenAPI contract so a field rename fails the build instead of the customer.

The defect evidence backs the emphasis on data rather than plumbing. In the benchmark of REST defects, most failures sat in data validation and query processing, and automated tooling detected only a small share of sampled defects because semantic and stateful problems slipped through. Your test suite needs assertions about meaning, not just about transport.

Release gate: zero unresolved contract violations, a 100 percent authorization-test pass rate, and an error budget tied to how critical each endpoint is.

Before any verdict reaches a user, check five things in the payload: the denominator used, the source period, null versus zero handling, the methodology threshold applied, and ETF coverage. Persist those alongside the verdict, and a later dispute becomes a query rather than an investigation.

Run the Example With Your Own Key

Send one live request this week, with your own key, before you design anything larger. The interactive playground lets you pick an endpoint, send a live request with your own API key, and copy it as Shell, Python, Go or 10 more languages, and the docs carry snippets in 12 languages, so the working call moves straight into your service instead of being rewritten from a blog post.

Screenshot from https://b2b.akinda.io

Three steps, in order. Send one request for a ticker from your own order book, not a famous example. Compare the response fields against the field table, especially coverage and the data date. Then run the checks from the testing section before a verdict reaches a single user. A free tier is enough to try the integration; size your production plan against your expected request count rather than your first afternoon of testing.

The one decision to settle before launch is whether your application stores the verdict as a label or stores the evidence behind it. Labels are faster to build and impossible to defend. Evidence costs you a few columns and answers every question a compliance officer, an auditor or a confused customer will ask.


Akinda's REST API returns Shariah compliance verdicts with the ratios, coverage and methodology behind each one, covering more than 16,500 stocks and ETFs across the United States, United Kingdom, Canada and Uzbekistan. If you'd rather build on evidence than on labels, generate a key from the dashboard, send the first call from the playground, and store what comes back. Visit Akinda to start with a free account.