Crawlora Docs
Use the official TypeScript and JavaScript SDK for application code, or copy raw fetch examples for low-level testing and server-side Next.js routes.
The current promoted SDK tag is v1.5.0-sdk.3. GitHub Packages npm installs require scoped registry configuration and package-read authentication.
npm config set @crawlora-org:registry https://npm.pkg.github.com npm install @crawlora-org/sdk@1.5.0-sdk.3
Uses the real Search Bing web results path at https://api.crawlora.net/api/v1/bing/search.
Use environment variables for secrets and keep Crawlora API keys server-side.
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");
}
const controller = new AbortController();
const timeout = setTimeout(() => controller.abort(), 60_000);
try {
const response = await fetch(`${CRAWLORA_BASE_URL}/bing/search?q=coffee&page=1&count=10&country=us&lang=en`, {
method: "GET",
headers: {
"x-api-key": CRAWLORA_API_KEY
},
signal: controller.signal,
});
const payload = await response.json().catch(() => null);
if (!response.ok) {
throw new Error(`Crawlora request failed: ${response.status} ${JSON.stringify(payload)}`);
}
console.log(payload);
} finally {
clearTimeout(timeout);
}Exact response fields vary by endpoint. Confirm field names on the endpoint reference page before depending on them.
type CrawloraEnvelope<T> = {
code?: number;
msg?: string;
data?: T;
};
type BingSearchResult = {
title?: string;
url?: string;
description?: string;
position?: number;
};
type BingSearchData = {
results?: BingSearchResult[];
};Keep Crawlora API keys on your server. Browser code should call your backend route.
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 GET(request: Request) {
if (!CRAWLORA_API_KEY) {
return NextResponse.json({ error: "Server API key is not configured" }, { status: 500 });
}
const { searchParams } = new URL(request.url);
const q = searchParams.get("q");
if (typeof q !== "string" || q.trim().length < 2) {
return NextResponse.json({ error: "q is required" }, { status: 400 });
}
const country = searchParams.get("country") || "us";
const lang = searchParams.get("lang") || "en-us";
const query = new URLSearchParams({ q, country, lang, count: "10", page: "1" });
const response = await fetch(`${CRAWLORA_BASE_URL}/bing/search?${query}`, {
headers: {
"x-api-key": CRAWLORA_API_KEY,
},
});
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);
}async function retryCrawlora(input: RequestInfo, init: RequestInit, attempts = 3) {
for (let attempt = 1; attempt <= attempts; attempt += 1) {
const response = await fetch(input, init);
if (response.ok) return response;
if (![429, 500, 502, 503, 504].includes(response.status) || attempt === attempts) {
throw new Error(`Crawlora request failed: ${response.status} ${await response.text()}`);
}
await new Promise((resolve) => setTimeout(resolve, Math.min(1000 * 2 ** (attempt - 1), 8000)));
}
throw new Error("Retry loop exited unexpectedly");
}Crawlora is designed for responsible structured public web data workflows. Customers are responsible for using Crawlora in compliance with applicable laws, third-party rights, target-platform rules, and Crawlora terms.
Read Crawlora termsInstall the official SDK for typed endpoint groups, then open endpoint docs to inspect current request and response schema summaries.