Skip to main content
Docs

Documentation

Everything you need to integrate CompanyLens into your application or AI agent.

AI-assisted development

Integrate CompanyLens in seconds

Copy one of the prompts below and paste it into Claude Code, Cursor, Copilot, or any AI coding assistant. You'll get a working company autocomplete component for your framework in one shot — no docs spelunking required.

Each prompt includes

  • Endpoint URL, authentication, and full request/response shape
  • Debounced search input with 300 ms delay
  • Loading state, dropdown results, and status badges
  • Error handling for 400 and 429 responses
  • Framework-specific patterns — React, Vue, or vanilla JS

Autocomplete API prompt

You are helping me integrate the CompanyLens company autocomplete API into my React application.

## API Details

Endpoint: GET https://api.companylens.io/api/v1/companies/autocomplete

Authentication: Include this header on every request:
  Authorization: Bearer YOUR_API_KEY

Query parameters:
  q            (required)  Search string — minimum 2 characters
  jurisdiction (optional)  ISO code to filter by country, e.g. "GB", "IE", "AU", "NZ"
  limit        (optional)  Number of results to return (default 10, max 20)

## Response shape

{
  "data": [
    {
      "name": "Apple Retail UK Limited",
      "number": "04551022",
      "jurisdiction": "GB",
      "jurisdictionName": "United Kingdom",
      "flag": "🇬🇧",
      "status": "active",
      "type": "Private limited company",
      "incorporatedDate": "2002-10-02",
      "dissolutionDate": null,
      "address": "Amen Corner, Cain Road, Bracknell, England, RG12 1HN"
    }
  ],
  "meta": {
    "limit": 10,
    "hasMore": false,
    "total": 3
  }
}

## Error responses

400 Bad Request   {"error":{"code":"INVALID_QUERY","message":"Query parameter 'q' must be at least 2 characters."}}
429 Too Many Requests  Rate limit exceeded — back off and retry

## Task

Build a CompanyAutocomplete React component (TypeScript, hooks) that:

1. Renders a text input for the company search query
2. Debounces API calls by 300 ms after the user stops typing
3. Does not call the API when the query is fewer than 2 characters
4. Shows a loading spinner while fetching
5. Renders results as a dropdown list — each item shows the flag emoji, company name,
   jurisdiction name, and a coloured status badge ("active" → green, "dissolved" → red, others → grey)
6. On result click: calls an onSelect(company) callback prop and closes the dropdown
7. Closes the dropdown when the user clicks outside the component
8. Handles errors: displays a user-friendly inline error message (never exposes raw API errors to the user)
9. Respects a 429 response — shows "Too many requests, please slow down" and does not retry automatically

Style with Tailwind CSS. Keep the component self-contained in a single file.

How to use

  1. 1Copy the prompt for your framework using the button above.
  2. 2Paste it into Claude Code, Cursor, Copilot Chat, or any AI coding assistant.
  3. 3Replace YOUR_API_KEY with your key from the API Keys dashboard.
  4. 4The AI will generate a complete, working component — review, drop it into your app, and ship.