> Call the Check Share Code API from Node.js: authentication, requesting a check, and reading the response.

Web version: https://checksharecode.co.uk/tutorials/quickstart-node · Sign up: https://checksharecode.co.uk/signup?ref=md · Last updated: 2026-11-23

[← Back to docs](https://checksharecode.co.uk/docs)

# Quickstart: Node.js

Sign up, mint a test key, send your first check in under 5 minutes.

## 1\. Mint a test key

Sign in, open `/app/keys`, click _New key_, choose **test** mode. Copy the `rtw_test_…` plaintext: it's only shown once.

## 2\. Send a request

Using Node's built-in `fetch` (Node ≥ 18). No SDK needed.

```
const RTW_KEY = process.env.RTW_KEY!; // rtw_test_… or rtw_live_…

const res = await fetch('https://api.checksharecode.co.uk/v1/check/right-to-work', {
  method: 'POST',
  headers: {
    'content-type': 'application/json',
    authorization: `Bearer ${RTW_KEY}`,
  },
  body: JSON.stringify({
    share_code: 'AA1AA1AA1',          // sandbox: ACCEPTED fixture
    date_of_birth: '1990-01-01',
    company_name: 'Acme Ltd',
  }),
});

if (!res.ok) {
  const { error } = await res.json();
  throw new Error(`${error.code}: ${error.message}`);
}

const data = await res.json();
console.log(data.outcome, data.name, data.expiry_date);
```

## 3\. Sandbox dispatch by share code

With a test key the response is deterministic; pick the share code that matches the path you want to exercise (see `/docs` for the full table).

```
// Force a NOT_FOUND error path:
{ share_code: 'CC3CC3CC3', date_of_birth: '1990-01-01', company_name: 'Acme Ltd' }
// Expected response: 404 { error: { code: 'NOT_FOUND', ... } }
```

## 4\. Swap to a live key

The wire shape is identical. Mint a `rtw_live_…` key, set `RTW_KEY`, rerun. Each successful live check counts toward your monthly quota.

## 5\. Next steps

-   Read [Handling errors](https://checksharecode.co.uk/tutorials/handling-errors) for retry strategy.
-   Read [Quota & billing](https://checksharecode.co.uk/tutorials/quota-and-billing) for what the rate-limit headers mean.
-   Hit [/openapi.json](https://checksharecode.co.uk/openapi.json) with your generator of choice for a typed client.
