Developer guides

TypeScript / JavaScript Integration Guide

Use Crawlora from Node.js, Next.js, serverless functions, backend services, and AI workflows with standard fetch-based HTTP requests.

No package requiredServer-side fetchTyped JSONTimeoutsNext.js routes

Verified HTTP pattern

POST /google/search

Normalized JSON

Request

POST https://api.crawlora.net/api/v1/google/search
x-api-key: $CRAWLORA_API_KEY
Content-Type: application/json

{
  "country": "us",
  "keyword": "best CRM software",
  "language": "en",
  "limit": 10,
  "page": 1
}

Base URL

https://api.crawlora.net/api/v1

Auth header

x-api-key

Example endpoint

POST /google/search

Use standard fetch today. A lightweight SDK can be added later if the product publishes one.

Developer workflow

Install / setup

No Crawlora npm package is required for modern Node.js runtimes with fetch support. Keep the API key on the server and call Crawlora from backend code, route handlers, or serverless functions.

Developer workflow

Environment variable

.env · bash

CRAWLORA_API_KEY=your_api_key_here

Developer workflow

Basic request

This example uses the verified Google Search endpoint from the generated docs catalog.

Fetch client · typescript

const CRAWLORA_API_KEY = process.env.CRAWLORA_API_KEY;
const CRAWLORA_BASE_URL = "https://api.crawlora.net/api/v1";

if (!CRAWLORA_API_KEY) {
  throw new Error("Missing CRAWLORA_API_KEY");
}

async function crawloraRequest<TResponse>(
  path: string,
  body: Record<string, unknown>,
): Promise<TResponse> {
  const controller = new AbortController();
  const timeout = setTimeout(() => controller.abort(), 60_000);

  try {
    const response = await fetch(`${CRAWLORA_BASE_URL}${path}`, {
      method: "POST",
      headers: {
        "x-api-key": CRAWLORA_API_KEY,
        "Content-Type": "application/json",
      },
      body: JSON.stringify(body),
      signal: controller.signal,
    });

    if (!response.ok) {
      const errorText = await response.text();
      throw new Error(`Crawlora request failed: ${response.status} ${errorText}`);
    }

    return response.json() as Promise<TResponse>;
  } finally {
    clearTimeout(timeout);
  }
}

type GoogleSearchItem = {
  position?: number;
  title?: string;
  website_name?: string;
  link?: string;
  Snippet?: string;
};

type GoogleSearchResponse = {
  code: number;
  msg: string;
  data?: {
    result?: GoogleSearchItem[];
  };
};

async function main() {
  const data = await crawloraRequest<GoogleSearchResponse>("/google/search", {
    country: "us",
    keyword: "best CRM software",
    language: "en",
    limit: 10,
    page: 1,
  });

  console.log(data.data?.result);
}

main().catch(console.error);

Developer workflow

Next.js API route example

Proxy browser requests through a server-side route so the API key never reaches client-side code.

Server route · typescript

// app/api/search/route.ts
import { NextResponse } from "next/server";

const CRAWLORA_API_KEY = process.env.CRAWLORA_API_KEY;
const CRAWLORA_BASE_URL = "https://api.crawlora.net/api/v1";

export async function POST(request: Request) {
  if (!CRAWLORA_API_KEY) {
    return NextResponse.json({ error: "Server API key is not configured" }, { status: 500 });
  }

  const { keyword, country = "us", language = "en" } = await request.json();

  if (typeof keyword !== "string" || keyword.trim().length < 2) {
    return NextResponse.json({ error: "Keyword is required" }, { status: 400 });
  }

  const response = await fetch(`${CRAWLORA_BASE_URL}/google/search`, {
    method: "POST",
    headers: {
      "x-api-key": CRAWLORA_API_KEY,
      "Content-Type": "application/json",
    },
    body: JSON.stringify({ keyword, country, language, limit: 10, page: 1 }),
  });

  const payload = await response.json().catch(() => null);

  if (!response.ok) {
    return NextResponse.json({ error: "Crawlora request failed", details: payload }, { status: response.status });
  }

  return NextResponse.json(payload);
}

Developer workflow

Error handling

The status codes below are common integration patterns. Endpoint detail pages list documented failure responses where available.

Status / codeMeaningHow to handle
400Invalid request or missing required input.Validate request bodies before calling Crawlora and surface useful messages to users.
401Missing or invalid API key.Check the `x-api-key` header and rotate the key from the console if needed.
402/403Plan, permission, or billing issue where applicable.Check plan access, credit state, and endpoint availability.
429Rate limit exceeded.Back off with jitter and reduce concurrency.
5xxTemporary execution or upstream failure.Retry safe jobs with exponential backoff and keep the failure visible.

Developer workflow

Timeouts and retries

Set reasonable timeouts, retry only safe jobs, back off on 429 or temporary 5xx responses, and avoid aggressive loops.

AbortController timeout · typescript

async function fetchWithTimeout(input: RequestInfo, init: RequestInit, timeoutMs = 60_000) {
  const controller = new AbortController();
  const timeout = setTimeout(() => controller.abort(), timeoutMs);

  try {
    return await fetch(input, { ...init, signal: controller.signal });
  } finally {
    clearTimeout(timeout);
  }
}

Developer workflow

Production checklist

  • Store API keys in environment variables.
  • Keep API keys server-side and out of browser code.
  • Set request timeouts.
  • Handle non-2xx responses and empty result sets.
  • Log request IDs or response context when available.
  • Track credit usage and link operators to pricing.
  • Respect rate limits and back off on repeated failures.

Responsible public web data workflows

Use Crawlora for structured public web data workflows. Customers are responsible for compliance with applicable laws, third-party rights, platform rules, and Crawlora terms. Keep API keys server-side, validate inputs, and avoid collecting or storing unnecessary sensitive data.

Read Crawlora terms

Developer workflow

Related developer links

Use these pages to move between endpoint discovery, examples, pricing, and responsible-use guidance.

Developer workflow

FAQ

Common questions for this Crawlora developer integration path.

Is there an official Crawlora TypeScript SDK?

This frontend repository does not contain an official Crawlora TypeScript SDK. Use standard fetch with the documented HTTP API.

Can I call Crawlora from the browser?

Prefer server-side calls so API keys are not exposed. Browser code should call your own backend or Next.js route handler.

How do I handle rate limits?

Check for 429 responses, reduce concurrency, and retry with exponential backoff and jitter.

Can I use Crawlora in Next.js?

Yes. Use route handlers, server actions, or backend services to call Crawlora with a server-side API key.

Can I use Crawlora in serverless functions?

Yes. Add timeouts and keep function limits in mind for longer browser-backed endpoints.

How do I type the response?

Start with endpoint response examples in docs, define narrow TypeScript types for fields your app uses, and handle optional fields defensively.

Where do I find endpoint schemas?

Open the endpoint detail page from the docs catalog to inspect request parameters, examples, and schema references.

Next step

Build a server-side TypeScript integration

Start with a single endpoint in a route handler, add timeouts and error handling, then promote it into your product workflow.