Integrations › Go

Zapi for Go

Call any source from Go with net/http: one key, one URL shape, JSON back. No module to add.

Languagenet/httpREST
  1. 01
    Set your API key

    Create a free key in the dashboard and keep it out of your code.

    export ZAPI_KEY="zpi_..."
  2. 02
    Call any source

    Every source is a GET on /v1/<category>:<source>/<endpoint>. Decode only the fields you need from data.

    package main
    
    import (
    	"encoding/json"
    	"fmt"
    	"net/http"
    	"net/url"
    	"os"
    	"time"
    )
    
    func main() {
    	q := url.Values{"username": {"tiktok"}}
    	req, _ := http.NewRequest("GET", "https://api.zapi.ink/v1/social-media:tiktok-scraper/profile?"+q.Encode(), nil)
    	req.Header.Set("x-api-key", os.Getenv("ZAPI_KEY"))
    
    	client := &http.Client{Timeout: 60 * time.Second}
    	res, err := client.Do(req)
    	if err != nil {
    		panic(err)
    	}
    	defer res.Body.Close()
    
    	var out struct {
    		Data struct {
    			FollowerCount int64 `json:"followerCount"`
    		} `json:"data"`
    	}
    	json.NewDecoder(res.Body).Decode(&out)
    	fmt.Println(out.Data.FollowerCount)
    }
  3. 03
    Handle limits

    A 429 means you hit your plan’s per-minute limit. Wait a moment and try again.

    if res.StatusCode == http.StatusTooManyRequests {
    	// per-minute limit reached: wait, then retry
    	time.Sleep(5 * time.Second)
    }

The response

200 OK
{
  "project": "social-media:tiktok-scraper:profile",
  "data": {
    "username": "tiktok",
    "nickname": "TikTok",
    "verified": true,
    "followerCount": 92400000,
    "videoCount": 1310
  },
  "timestamp": "2026-12-01T07:00:00.000Z"
}

Questions

Is there a Go SDK?

No. net/http and encoding/json from the standard library are all you need. JavaScript and TypeScript have zpi-sdk.

Do I have to map every field?

No. Declare only the fields you need under Data; encoding/json skips the rest.

Can I call sources from goroutines?

Yes. Keep within your plan’s per-minute limit: calls above it get a 429.

Your first call in a minute.

Free key, every source, and the same JSON shape from anywhere.