Go go get Zero deps

Go SDK

Idiomatic Go client using stdlib net/http only. Zero third-party dependencies, full context support, typed error hierarchy.

install go
$ go get github.com/TCG-Price-Lookup/tcglookup-go

Key Features

Zero Dependencies

Only stdlib net/http — nothing to audit or update.

Idiomatic Go

Follows standard Go conventions and error patterns.

Context Support

Every method accepts ctx for cancellation and deadlines.

Typed Errors

Use errors.As() with *AuthenticationError, *RateLimitError, etc.

Auto-chunk Batches

Search with any number of IDs — SDK handles chunking.

Rate Limit Access

client.RateLimit.Remaining after each request.

Quickstart

main.go Go
package main

import (
    "context"
    "fmt"
    "os"
    tcglookup "github.com/TCG-Price-Lookup/tcglookup-go"
)

func main() {
    client := tcglookup.NewClient(os.Getenv("TCG_API_KEY"))
    ctx := context.Background()

    // Search for cards
    results, err := client.Cards.Search(ctx, &tcglookup.SearchParams{
        Q:     "charizard",
        Game:  "pokemon",
        Limit: 5,
    })
    if err != nil {
        panic(err)
    }
    fmt.Println(results.Data[0].Name)

    // Check rate limit
    fmt.Println(client.RateLimit.Remaining, "/", client.RateLimit.Limit)
}

API Surface

client.Cards.Search(ctx, params) Search & batch
results, err := client.Cards.Search(ctx, &tcglookup.SearchParams{
    Q: "black lotus", Game: "mtg",
})

// Batch by IDs — auto-chunks beyond 20
results, err = client.Cards.Search(ctx, &tcglookup.SearchParams{
    IDs: []string{
        "uuid1", "uuid2", /* ... */
    },
})
client.Cards.Get(ctx, id) Single card lookup
card, err := client.Cards.Get(ctx, "019535a1-d5d0-7c12-a3e8-b7f4c6d8e9a2")
fmt.Println(card.Prices.Raw.NearMint.TCGPlayer.Market)
client.Cards.History(ctx, id, params) Trader+ required
history, err := client.Cards.History(ctx, card.ID, &tcglookup.HistoryParams{
    Period: "30d",
})
client.Sets.List / client.Games.List Browse sets and games
sets, err := client.Sets.List(ctx, &tcglookup.SetParams{Game: "pokemon"})
games, err := client.Games.List(ctx, nil)

Error Handling

error-handling.go
import (
    "errors"
    tcglookup "github.com/TCG-Price-Lookup/tcglookup-go"
)

card, err := client.Cards.Get(ctx, "some-id")
if err != nil {
    var authErr *tcglookup.AuthenticationError
    var planErr *tcglookup.PlanAccessError
    var notFound *tcglookup.NotFoundError
    var rateErr *tcglookup.RateLimitError

    switch {
    case errors.As(err, &authErr):
        fmt.Println("invalid API key")
    case errors.As(err, &planErr):
        fmt.Println("plan upgrade required")
    case errors.As(err, ¬Found):
        fmt.Println("card not found")
    case errors.As(err, &rateErr):
        fmt.Printf("rate limited, retry after %d\n", rateErr.RetryAfter)
    }
}

Rate Limit Headers

rate-limits.go
client.Cards.Search(ctx, &tcglookup.SearchParams{Q: "pikachu"})

fmt.Println(client.RateLimit.Limit)      // 100000
fmt.Println(client.RateLimit.Remaining)  // 99987
fmt.Println(client.RateLimit.Reset)      // Unix timestamp

Start building with Go

Get your free API key and query card prices in minutes.