Developer guides

Go Integration Guide

Use Crawlora from high-performance Go services, workers, API backends, and data pipelines with the standard net/http package.

net/httpContext timeoutTyped structsWorkersBackoff

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

This repository does not contain an official Crawlora Go module, so the guide uses Go's standard library.

Developer workflow

Environment variable

.env · bash

export CRAWLORA_API_KEY="your_api_key_here"

Developer workflow

Basic request with context timeout

Go net/http · go

package main

import (
	"bytes"
	"context"
	"encoding/json"
	"fmt"
	"io"
	"net/http"
	"os"
	"time"
)

const baseURL = "https://api.crawlora.net/api/v1"

type SearchRequest struct {
	Country  string `json:"country,omitempty"`
	Keyword  string `json:"keyword"`
	Language string `json:"language,omitempty"`
	Limit    int    `json:"limit,omitempty"`
	Page     int    `json:"page,omitempty"`
}

type SearchResponse struct {
	Code int    `json:"code"`
	Msg  string `json:"msg"`
	Data struct {
		Result []struct {
			Position int    `json:"position,omitempty"`
			Title    string `json:"title,omitempty"`
			Link     string `json:"link,omitempty"`
			Snippet  string `json:"Snippet,omitempty"`
		} `json:"result,omitempty"`
	} `json:"data,omitempty"`
}

func crawloraRequest(ctx context.Context, client *http.Client, path string, payload any, out any) error {
	apiKey := os.Getenv("CRAWLORA_API_KEY")
	if apiKey == "" {
		return fmt.Errorf("missing CRAWLORA_API_KEY")
	}

	body, err := json.Marshal(payload)
	if err != nil {
		return err
	}

	req, err := http.NewRequestWithContext(ctx, http.MethodPost, baseURL+path, bytes.NewReader(body))
	if err != nil {
		return err
	}

	req.Header.Set("x-api-key", apiKey)
	req.Header.Set("Content-Type", "application/json")

	resp, err := client.Do(req)
	if err != nil {
		return err
	}
	defer resp.Body.Close()

	respBody, err := io.ReadAll(resp.Body)
	if err != nil {
		return err
	}

	if resp.StatusCode < 200 || resp.StatusCode >= 300 {
		return fmt.Errorf("crawlora request failed: status=%d body=%s", resp.StatusCode, string(respBody))
	}

	return json.Unmarshal(respBody, out)
}

func main() {
	ctx, cancel := context.WithTimeout(context.Background(), 60*time.Second)
	defer cancel()

	client := &http.Client{Timeout: 65 * time.Second}

	var result SearchResponse
	err := crawloraRequest(ctx, client, "/google/search", SearchRequest{
		Country:  "us",
		Keyword:  "best CRM software",
		Language: "en",
		Limit:    10,
		Page:     1,
	}, &result)
	if err != nil {
		panic(err)
	}

	fmt.Printf("%+v\n", result.Data.Result)
}

Developer workflow

Typed structs

Define request and response structs around the fields your service uses. Endpoint-specific request examples and schemas are available from the docs catalog.

Developer workflow

Worker pattern

Use bounded workers and context cancellation instead of unbounded goroutines.

Bounded worker · go

type Job struct {
	Keyword string
}

func worker(ctx context.Context, client *http.Client, jobs <-chan Job, results chan<- SearchResponse) {
	for {
		select {
		case <-ctx.Done():
			return
		case job, ok := <-jobs:
			if !ok {
				return
			}

			var out SearchResponse
			err := crawloraRequest(ctx, client, "/google/search", SearchRequest{
				Keyword:  job.Keyword,
				Country:  "us",
				Language: "en",
				Limit:    10,
				Page:     1,
			}, &out)
			if err == nil {
				results <- out
			}
		}
	}
}

Developer workflow

Error handling

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

Production checklist

  • Use context timeouts.
  • Reuse http.Client.
  • Handle 429 with backoff.
  • Avoid unbounded goroutines.
  • Log request IDs or response context where available.
  • Validate inputs.
  • Keep API keys out of logs.

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 Go SDK?

This frontend repository does not contain an official Crawlora Go SDK or module. Use net/http with the documented API.

Can I use only the standard library?

Yes. The example uses only net/http, context, encoding/json, and related standard packages.

How do I handle context timeouts?

Use context.WithTimeout for each request and reuse an http.Client with an appropriate Timeout.

How do I control concurrency?

Use a bounded worker pool and back off on 429 or temporary 5xx responses.

Can I use Crawlora in Go workers?

Yes. Crawlora fits queue workers and backend services when jobs are bounded and retry behavior is controlled.

Where can I find endpoint schemas?

Use the docs catalog and endpoint detail pages for request examples, parameters, and response schema references.

How do I monitor credits and rate limits?

Use the console, pricing page, endpoint docs, and response context where available.

Next step

Add Crawlora to a Go worker

Start with a typed request, add context timeouts, then place the call behind your queue or API boundary.