Entylink
Tutorial

Search UK companies in Node.js with Entylink

Build a production-ready UK company search step in Node.js using Entylink's `/v1/search` endpoint, including query validation, bearer auth, and response shaping for product UIs.

uk company search api node jscompany search api tutorialcompanies house alternative search apinode js company lookup api
Guide details
Read time
8 min
Estimated for an engineer implementing the flow
Level
Intermediate
Assumes comfort with APIs and backend basics
Intent
Implementation
Real product or compliance workflows
Who this is for

Start from the real implementation problem

Target readers
Backend engineers implementing business lookupProduct engineers building signup and onboarding flowsDevelopers replacing manual registry search steps
01Send a search query to `/v1/search` with bearer auth
02Cap result volume using `items_per_page`
03Return the company number, name, and status in a UI-friendly shape
Prerequisites

Keep the setup explicit

01

An Entylink API key

02

Node.js 18 or newer

03

A server endpoint or action that needs company search

Step by step
Step 01

Create a small API client wrapper

Keep the Entylink key in an environment variable and send it as a bearer token. The search endpoint expects a non-empty `q` and accepts up to 100 results through `items_per_page`.

Node.jsExample
const ENTYLINK_KEY = process.env.ENTYLINK_KEY!;

async function entylinkFetch(path: string) {
  const response = await fetch(`https://api.entylink.com${path}`, {
    headers: {
      Authorization: `Bearer ${ENTYLINK_KEY}`,
    },
  });

  if (!response.ok) {
    throw new Error(`Entylink request failed: ${response.status}`);
  }

  return response.json();
}
Step 02

Validate the query before you call the API

You should reject empty or overlong queries before making the network call. That keeps the UX cleaner and avoids avoidable 400 responses.

ValidationExample
function validateSearchQuery(q: string) {
  const trimmed = q.trim();
  if (!trimmed) throw new Error("Search query is required");
  if (trimmed.length > 160) throw new Error("Search query is too long");
  return trimmed;
}
Step 03

Call `/v1/search` and shape the response for your UI

Return only the fields your search UI needs. In most onboarding flows that means the company number, legal name, and current status.

Search handlerExample
export async function searchCompanies(q: string) {
  const query = validateSearchQuery(q);
  const payload = await entylinkFetch(
    `/v1/search?q=${encodeURIComponent(query)}&items_per_page=10`,
  );

  return payload.data.items.map((item: {
    company_number: string;
    company_name: string;
    company_status: string;
  }) => ({
    number: item.company_number,
    name: item.company_name,
    status: item.company_status,
  }));
}
Step 04

Use search as the first step, not the final answer

Once the user selects a company, move immediately into the company record and related endpoints. Search is the entry point into the workflow, not the whole workflow.