Repository navigation
Getting Started
This guide takes you from an empty Go project to a successful SocialKit request. The SDK is published as github.com/tigusigalpa/socialkit-go and requires Go 1.21+. 1
You need a Go module, a SocialKit access key, and a URL you are permitted to process. Create and manage access keys from the SocialKit project dashboard. Keep a key out of source control, browser code, application logs, and screenshots. SocialKit recommends sending it in the x-access-key header; this is also the SDK default. 2
| Requirement | Why it is needed |
|---|---|
| Go 1.21 or later | This is the SDK’s documented compatibility baseline. |
| A SocialKit access key | Required for protected operations, including Credits and scraping endpoints. |
A context.Context
|
Every SDK method accepts one, enabling timeouts and cancellation. |
| An authorised source URL | SocialKit operations act on the supplied social-media or direct-video URL. |
From the root of your Go module, run:
go get github.com/tigusigalpa/socialkit-goStore the access key outside your program. For local development, an environment variable is a simple choice:
export SOCIALKIT_ACCESS_KEY="YOUR_SOCIALKIT_ACCESS_KEY"On Windows PowerShell, set the variable for the current shell with:
$env:SOCIALKIT_ACCESS_KEY = "YOUR_SOCIALKIT_ACCESS_KEY"Do not commit a .env file containing a real secret. The SDK protects against accidental exposure in its own error and metadata values, but it cannot protect a key your application deliberately prints or stores. 3
Create main.go with a YouTube transcript call. NewClient returns a ready-to-use client; by default it calls https://api.socialkit.dev, uses a 30-second HTTP timeout, and authenticates each request with x-access-key. 3
package main
import (
"context"
"fmt"
"log"
"os"
socialkit "github.com/tigusigalpa/socialkit-go"
)
func main() {
key := os.Getenv("SOCIALKIT_ACCESS_KEY")
if key == "" {
log.Fatal("SOCIALKIT_ACCESS_KEY is not set")
}
client := socialkit.NewClient(key)
transcript, meta, err := client.YouTube.Transcript(context.Background(), &socialkit.FetchRequest{
URL: "https://www.youtube.com/watch?v=dQw4w9WgXcQ",
})
if err != nil {
log.Fatal(err)
}
fmt.Println(transcript.Transcript)
if meta.CreditsUsed != nil {
fmt.Printf("credits used: %.0f\n", *meta.CreditsUsed)
}
}Run it with:
go run .The transcript value is the typed response, meta contains HTTP, credit, and rate-limit information when available, and err is a typed SDK error when the request fails. Continue with Core Concepts for the shared request/response model. 3 4
client.Status.Get(ctx) calls the public GET /status endpoint. It is useful for a basic health check because SocialKit documents /status as the sole API operation that does not require an access key. 2 5
status, _, err := client.Status.Get(context.Background())
if err != nil {
log.Fatal(err)
}
fmt.Println(status.Overall)The repository includes small programs for basic usage, pagination, downloads, and error handling. They read SOCIALKIT_ACCESS_KEY rather than embedding a credential. 1
go run ./examples/basic
go run ./examples/pagination
go run ./examples/download
go run ./examples/errorsConfigure timeouts, retries, or a custom HTTP client in Client Configuration. For a complete list of operations, visit Service Reference. If you are extracting text or summaries, Transcripts and Summaries provides reusable patterns.