Sync and async
The two ways to call Real-time data, sync and async, how to choose between them, and what an order is.
Real-time data comes from the official register at the time of your call, and
you get it in one of two ways. Async: you place an order, get its orderId
at once, and receive the result by webhook or by checking the order. Sync:
the call waits and returns the result itself. Both return the same data from the
same register. Only the way you wait differs. Registers can be slow, closed or
down for maintenance, so we retry timeouts and outages for you in the
background.
Definition
Real-time: Fresh data from the register at the time of your call. You call it sync (wait in the same call) or async (place an order, then receive a webhook or check the order).
Order: One piece of work you ask Kausate for, such as a company report, a document or a shareholder graph, identified by its orderId. Run appears only where an endpoint name uses it, and means the status of an order.
Retries: We retry passing failures ourselves. An error you receive is what remains after our retries.
Order lifecycle
Choose sync or async
| Approach | Use it for | Trade-off |
|---|---|---|
| Async with a webhook (recommended) | Production systems | Needs an endpoint that can receive our deliveries |
| Async, checking the order | Simple integrations, serverless environments | You write the loop that checks, and results come later |
| Sync | Testing, prototypes, one-off calls | Fails with HTTP 408 when the register is slow |
Use async with webhooks in production, check the order if you cannot receive webhooks, and use sync for development and testing.
Endpoints
| Capability | Async | Sync |
|---|---|---|
| Company search | POST /v2/companies/search | POST /v2/companies/search/sync |
| Company report | POST /v2/companies/report | POST /v2/companies/report/sync |
| Document list | POST /v2/companies/documents/list | POST /v2/companies/documents/list/sync |
| Documents | POST /v2/companies/documents | POST /v2/companies/documents/sync |
| Financials | POST /v2/companies/finance | POST /v2/companies/finance/sync |
| Beneficial owners | POST /v2/companies/ubo | POST /v2/companies/ubo/sync |
| Shareholder graph | POST /v2/companies/shareholder-graph | POST /v2/companies/shareholder-graph/sync |
Autocomplete (GET /v2/companies/search/autocomplete) and prefill
(POST /v2/companies/prefill) return DWH data and answer in the
call. They have no async form.
Async
An async endpoint returns an orderId at once. You then receive the result in
one of two ways:
- Webhook: once you register a webhook, we deliver every completed order to it, with the same body you get when checking the order. See Webhooks.
- Checking the order: call the order's status endpoint, which is the async
path followed by the order id, for example
GET /v2/companies/report/{orderId}.
Async requests also take metadata, a JSON object of your own that comes back
on the order and in its webhook deliveries. It cannot be searched. Use
customerReference to match orders to your records.
Metadata is stored and logged as you send it. Do not include credentials.
Order statuses
| Status | Meaning |
|---|---|
running | Still processing: check back later. |
completed | The result is in the result field. |
failed | The order failed: read error and code. |
canceled | The order was canceled. |
terminated | The order was terminated. |
timedOut | The order ran past its time budget. |
While an order is running, currentActivity names its current step. An order
can stay running for a long time without anything being wrong: the register
may be closed outside its opening hours, down for maintenance or still preparing
a document. While that is the case, waitingMessage says why in a plain
sentence you can show your users, with the time of the next attempt where it is
known. It is null when the order is not waiting.
Poll an order
Check the order using the resultUrl from the async response. While the status
is running, start with a 2-second delay, double it after each check, and cap
it at 30 seconds. On completed, read result. For any other terminal status,
stop and read error and code when present.
Set RESULT_URL to the returned path and use the same KAUSATE_VERSION and
KAUSATE_API_KEY as when you placed the order. These examples stop after
10 checks. If the order is still running, save the path and check it later.
On 2025-04-01, use the status endpoint in your version’s API reference
to build the path from the orderId.
Save the curl example as a Bash script and run it with curl and jq installed.
The Python example uses the requests package.
#!/usr/bin/env bash
set -euo pipefail
delay=2
for ((attempt = 1; attempt <= 10; attempt++)); do
order=$(curl --fail --silent --show-error --max-time 10 \
-H "X-API-Key: $KAUSATE_API_KEY" \
-H "Kausate-Version: $KAUSATE_VERSION" \
"https://api.kausate.com$RESULT_URL")
case "$(jq -er '.status' <<< "$order")" in
completed) jq '.result' <<< "$order"; exit 0 ;;
running) ;;
*) jq '{status, error, code}' <<< "$order" >&2; exit 1 ;;
esac
if ((attempt < 10)); then
sleep "$delay"
delay=$((delay < 15 ? delay * 2 : 30))
fi
done
echo "Order is still running. Check $RESULT_URL later." >&2
exit 1import os
import time
import requests
path = os.environ["RESULT_URL"]
headers = {
"X-API-Key": os.environ["KAUSATE_API_KEY"],
"Kausate-Version": os.environ["KAUSATE_VERSION"],
}
delay = 2
for attempt in range(10):
response = requests.get(f"https://api.kausate.com{path}", headers=headers, timeout=10)
response.raise_for_status()
order = response.json()
if order["status"] == "completed":
print(order["result"])
break
if order["status"] != "running":
raise RuntimeError(order["status"], order.get("error"), order.get("code"))
if attempt < 9:
time.sleep(delay)
delay = min(delay * 2, 30)
else:
raise TimeoutError(f"Order is still running. Check {path} later.")import { setTimeout } from "node:timers/promises";
async function pollOrder(path: string, apiKey: string, version: string) {
let delay = 2_000;
for (let attempt = 0; attempt < 10; attempt++) {
const response = await fetch(`https://api.kausate.com${path}`, {
headers: { "X-API-Key": apiKey, "Kausate-Version": version },
signal: AbortSignal.timeout(10_000),
});
if (!response.ok)
throw new Error(`Order status request failed (${response.status})`);
const order = await response.json();
if (order.status === "completed") return order.result;
if (order.status !== "running") {
throw new Error(
[order.status, order.error, order.code].filter(Boolean).join(" "),
);
}
if (attempt < 9) {
await setTimeout(delay);
delay = Math.min(delay * 2, 30_000);
}
}
throw new Error(`Order is still running. Check ${path} later.`);
}
const result = await pollOrder(
process.env.RESULT_URL!,
process.env.KAUSATE_API_KEY!,
process.env.KAUSATE_VERSION!,
);
console.log(result);Order time budgets
Set globalTimeout in the request body to give an order a time budget in whole
minutes, from 1 to 10,080. The budget starts when the order is queued. When it
runs out, the order stops and checking it returns request.timeout in code.
A shareholder graph order instead returns the graph collected so far, with
stopReason: "time_budget_exhausted", and you can extend it to continue.
Limits lists every time limit.
Shareholder graph credit limits
Set maxCredits on a shareholder graph order or extension to cap what it
charges. The default, 0, sets no limit. A graph is charged per company whose
shareholders it extracts, so a limit below the price of the first company
extracts nothing and charges nothing. With a limit, the largest shareholders are
extracted first, and when the next company no longer fits, the order returns the
graph so far with stopReason: "budget_exhausted".
When your subscription prices the graph's jurisdiction as a bundle, the bundle is charged with the first company and the other companies it covers cost nothing more. For those, the limit caps what the order spends acquiring data: the register fees and document extraction of each company, in credits. The limit is checked before each batch of companies starts, so a batch that costs more than the ones before it can take that spend over the limit. See Shareholders.
Sync
The /sync sibling of an endpoint takes the same body, waits for the result and
returns it in the response. A sync call that runs longer than 300 seconds, or 30
seconds for prefill, returns HTTP 408, even where an async order for the same
data would have completed. Sync is not recommended for production.
Same-day reuse
The same report, ownership, financials or document request (same endpoint,
company and parameters) on the same UTC day reuses the existing order: you get
the same orderId and result, and it is not charged again. A webhook delivery
re-sent for such a repeat carries cachedOrder: true. The result stays
Real-time: it came from the register that day. Search and
document-list orders are never reused, and a failed order is not reused:
repeating it runs again.
customerReference and metadata are not part of the comparison: two requests
that differ only in customerReference reuse the same order. Set
bypassCache: true in the request body to always fetch fresh from the register.
The day ends at midnight UTC: requests at 23:59 and at 00:01 UTC are separate
orders.
Fields that carry it
orderId
Example
Order the sandbox company's report asynchronously:
curl -X POST "https://api.kausate.com/v2/companies/report" \
-H "X-API-Key: $KAUSATE_API_KEY" \
-H "Kausate-Version: 2026-08-01" \
-H "Content-Type: application/json" \
-d '{
"kausateId": "co_zz_4O3wnpE5u1K5AXnkARuhp",
"bypassCache": true
}'The recorded call sets bypassCache so that it always fetches fresh from the
register. The response carries the orderId and the resultUrl to check. When
the order completes, GET on resultUrl returns the order with its result, and
a registered webhook receives the same body. To wait in the call instead, send
the same request body to POST /v2/companies/report/sync. The full walkthrough, with the completed
report, is Your first report.
Older API versions place and wait for orders differently: in 2025-04-01, the
kausateId is in the URL and sync is the ?sync=true query parameter. Pick the
version in the API reference to see its calls.
Related
- Webhooks: receive completed orders.
- Batch: place many orders at once.
- Data modes: Real-time and DWH data.
- Limits: every time and size limit.
- Company report in the API reference: the Async, Sync and Order status calls.
Last updated on