> ## Documentation Index
> Fetch the complete documentation index at: https://docs.range.org/llms.txt
> Use this file to discover all available pages before exploring further.

# Company Intelligence Quickstart

> Resolve a company, read facts, register a webhook, start a watch, and verify a signed test event.

> [!NOTE]
>
> Company Intelligence and Watchers is in closed beta. To use it, [get in touch](https://www.range.org/get-in-touch).

Follow the [shared quickstart](https://docs.range.org/introduction/quickstart.md) to create a key with the Risk API scope. You need beta access, `curl`, `jq`, Node.js 20 or later for the receiver, and a public HTTPS URL that forwards requests to it. Python examples use `requests`.

The Kestrel Payments company and `.example` domains below are fictional. Use a company covered by your beta account and your own reachable HTTPS destination. Copy identifiers from your responses; the examples are not sandbox fixtures.

Set your API key:

```bash theme={null}
export RANGE_API_KEY="YOUR_API_KEY"
```

**1. Resolve the company**

Use a domain, name, LEI, registry number, or wallet. Replace the example domain with the company you need:

```bash cURL theme={null}
curl --fail-with-body https://api.range.org/v1/risk/companies/resolve \
  -H "Authorization: Bearer $RANGE_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"domain":"kestrelpay.example","country":"NL"}'
```

```javascript JavaScript theme={null}
const response = await fetch("https://api.range.org/v1/risk/companies/resolve", {
  method: "POST",
  headers: {
    Authorization: `Bearer ${process.env.RANGE_API_KEY}`,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({ domain: "kestrelpay.example", country: "NL" }),
});
if (!response.ok) throw new Error(await response.text());
const { items } = await response.json();
console.log(items); // Review candidates before selecting a company ID.
```

```python Python theme={null}
import os
import requests

response = requests.post(
    "https://api.range.org/v1/risk/companies/resolve",
    headers={"Authorization": f"Bearer {os.environ['RANGE_API_KEY']}"},
    json={"domain": "kestrelpay.example", "country": "NL"},
    timeout=30,
)
response.raise_for_status()
print(response.json()["items"])  # Review candidates before choosing an ID.
```

Example response:

```json theme={null}
{
  "items": [
    {
      "company": {
        "id": "6aa0498a-dac8-54d6-8f70-757fb7a78c92",
        "name": "Kestrel Payments",
        "legal_name": "Kestrel Payments B.V.",
        "status": "active",
        "jurisdiction": {
          "country": "NL",
          "registered_address": "Herengracht 182, 1016 BR Amsterdam, Netherlands"
        },
        "categories": [
          "payment_processor",
          "acquirer"
        ],
        "primary_domain": "kestrelpay.example",
        "lei": "724500KESTRELPAY0042"
      },
      "confidence": 0.99,
      "matched_on": [
        "domain"
      ]
    }
  ]
}
```

Check the legal entity, `confidence`, and `matched_on`. If there are no candidates or the match is ambiguous, review the identifier before continuing. Set the selected `company.id` in your shell:

```bash theme={null}
export RANGE_COMPANY_ID="6aa0498a-dac8-54d6-8f70-757fb7a78c92"
```

**2. Read its facts**

Select modules with [List Company Facts](https://docs.range.org/risk-api/companies/list-company-facts.md):

```bash theme={null}
curl --fail-with-body -G "https://api.range.org/v1/risk/companies/$RANGE_COMPANY_ID/facts" \
  --data-urlencode "modules=licenses,certifications,sanctions" \
  -H "Authorization: Bearer $RANGE_API_KEY"
```

Example response excerpt:

```json theme={null}
{
  "company_id": "6aa0498a-dac8-54d6-8f70-757fb7a78c92",
  "as_of": null,
  "items": [
    {
      "id": "a8cd7bef-ff4c-5898-963e-bc77a5c3559f",
      "module": "licenses",
      "type": "license",
      "attributes": {
        "regime": "PSD2",
        "license_type": "payment_institution",
        "authority": "De Nederlandsche Bank",
        "authority_reference": "R123456",
        "status": "authorized",
        "passported_to": [
          "BE",
          "DE",
          "FR",
          "IE"
        ]
      },
      "confirmation": "primary",
      "sources": [
        {
          "url": "https://www.dnb.nl/en/public-register/",
          "publisher": "DNB public register",
          "source_type": "register",
          "retrieved_at": "2026-12-01T08:02:11Z"
        }
      ],
      "first_seen_at": "2025-02-01T00:00:00Z",
      "verified_at": "2026-12-01T08:02:11Z",
      "valid_from": "2021-06-14",
      "valid_to": null
    }
  ],
  "meta": {
    "next_cursor": null
  }
}
```

Use the sources, confirmation level, and `verified_at` in your own review. Follow `meta.next_cursor` when it is non-null.

**3. Register a webhook endpoint**

Replace the example URL with your public HTTPS destination. The receiver below listens locally on port 8080; your HTTPS service must forward its requests there.

```bash theme={null}
webhook_response=$(curl --fail-with-body https://api.range.org/v1/risk/webhook-endpoints \
  -H "Authorization: Bearer $RANGE_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"url":"https://hooks.your-company.example/range/events","description":"Company watch receiver"}') || exit 1
export RANGE_WEBHOOK_ENDPOINT_ID=$(printf '%s' "$webhook_response" | jq -er '.id')
export WEBHOOK_SIGNING_SECRET=$(printf '%s' "$webhook_response" | jq -er '.secret')
unset webhook_response
```

The creation response includes the endpoint UUID and its one-time secret. Store the secret securely; listing endpoints does not recover it. Do not log it or commit it to source control.

**4. Start a watch**

Watch your selected company and route changes to the registered endpoint:

```bash theme={null}
watch_body=$(jq -n \
  --arg company "$RANGE_COMPANY_ID" \
  --arg endpoint "$RANGE_WEBHOOK_ENDPOINT_ID" \
  '{company_id:$company,depth:"enhanced",event_filter:{types:["*"]},destinations:{webhook_endpoint_ids:[$endpoint]},labels:{owner:"payments-ops"}}')
curl --fail-with-body https://api.range.org/v1/risk/watches \
  -H "Authorization: Bearer $RANGE_API_KEY" \
  -H "Content-Type: application/json" \
  -d "$watch_body"
```

Example response excerpt:

```json theme={null}
{
  "id": "77900c12-055e-5255-9c85-480e00059964",
  "target": {
    "type": "company",
    "company_id": "6aa0498a-dac8-54d6-8f70-757fb7a78c92",
    "name": "Kestrel Payments"
  },
  "depth": "enhanced",
  "status": "active"
}
```

Keep the returned watch `id`. A `pending_coverage` watch becomes active after onboarding. An HTTP 409 requires checking for an existing watch or available capacity before trying again.

**5. Receive and verify an event**

Save the [Node.js signature verifier](https://docs.range.org/risk-api/companies/webhooks.md#verify-signatures) as `verify-range-signature.mjs`. Save this receiver beside it as `receive-range.mjs`:

```javascript Node.js receiver theme={null}
import http from "node:http";
import { verifyRangeSignature } from "./verify-range-signature.mjs";

const secret = process.env.WEBHOOK_SIGNING_SECRET;
if (!secret) throw new Error("Set WEBHOOK_SIGNING_SECRET before starting");
const highestVersion = new Map(); // Demo only; use durable storage in production.

http.createServer(async (request, response) => {
  if (request.method !== "POST" || request.url !== "/range/events") {
    response.writeHead(404).end();
    return;
  }
  const chunks = [];
  try {
    for await (const chunk of request) chunks.push(chunk);
    const rawBody = Buffer.concat(chunks);
    if (!verifyRangeSignature(rawBody, request.headers["range-signature"], secret)) {
      response.writeHead(401).end("Invalid signature");
      return;
    }
    const delivery = JSON.parse(rawBody.toString("utf8"));
    if (delivery.type === "event.created" || delivery.type === "event.updated") {
      const event = delivery.data;
      if (event.version > (highestVersion.get(event.id) ?? 0)) {
        console.log(event.id, event.version, event.status, event.summary);
        highestVersion.set(event.id, event.version);
      }
    } else if (delivery.type === "watch.status_changed") {
      console.log("Watch status:", delivery.data.id, delivery.data.status);
    }
    response.writeHead(204).end();
  } catch {
    response.writeHead(400).end("Invalid delivery");
  }
}).listen(8080, "127.0.0.1", () => console.log("Receiver listening on port 8080"));
```

Start it in the shell where you exported the signing secret:

```bash theme={null}
node receive-range.mjs
```

From a second shell, set `RANGE_API_KEY` and `RANGE_WEBHOOK_ENDPOINT_ID` from the earlier steps, then request a signed test delivery:

```bash theme={null}
curl --fail-with-body -X POST \
  "https://api.range.org/v1/risk/webhook-endpoints/$RANGE_WEBHOOK_ENDPOINT_ID/test" \
  -H "Authorization: Bearer $RANGE_API_KEY"
```

Look for `delivered: true` and your receiver's 2xx status in the response. The receiver logs the sample event ID, version, status, and summary only after verifying the signature. If the test fails, check HTTPS forwarding, the stored secret, raw body handling, and your clock.

For a production receiver, replace the in-memory map and console handling with durable idempotency and a queue before acknowledging. See [Webhooks](https://docs.range.org/risk-api/companies/webhooks.md) for retries and recovery.

Use [List Watch Events](https://docs.range.org/risk-api/companies/list-watch-events.md) to reconcile missed deliveries. The [Event Catalog](https://docs.range.org/risk-api/companies/event-catalog.md) lists available filters; [Errors and Rate Limits](https://docs.range.org/resources/errors-and-rate-limits.md) covers request failures.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.