tcglookup-go

module
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 9, 2026 License: MIT

README

tcglookup-go

Go Reference Go Report Card Powered by TCG Price Lookup

The official Go SDK for the TCG Price Lookup API — live trading card prices across Pokemon, Magic: The Gathering, Yu-Gi-Oh!, Disney Lorcana, One Piece TCG, Star Wars: Unlimited, and Flesh and Blood.

One API for every major trading card game. TCGPlayer market prices, eBay sold averages, and PSA / BGS / CGC graded comps — all in one place.

Install

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

Quickstart

package main

import (
    "context"
    "fmt"
    "log"

    "github.com/TCG-Price-Lookup/tcglookup-go/tcglookup"
)

func main() {
    client := tcglookup.NewClient("tlk_live_...")
    ctx := context.Background()

    results, err := client.Cards.Search(ctx, &tcglookup.CardSearchParams{
        Q:     "charizard",
        Game:  "pokemon",
        Limit: 5,
    })
    if err != nil {
        log.Fatal(err)
    }

    for _, card := range results.Data {
        fmt.Printf("%s — %s\n", card.Name, card.Set.Name)
    }
}

Get an API key

Sign up at tcgpricelookup.com/tcg-api. Free tier includes 10,000 requests per month with TCGPlayer market prices. Trader plan unlocks eBay sold averages, PSA / BGS / CGC graded prices, and full price history.

API surface

Cards
// Search
client.Cards.Search(ctx, &tcglookup.CardSearchParams{
    Q:     "blue-eyes white dragon",
    Game:  "yugioh",      // pokemon | mtg | yugioh | onepiece | lorcana | swu | fab
    Set:   "lob",
    Limit: 20,
    Offset: 0,
})

// Get one
card, err := client.Cards.Get(ctx, "<card-uuid>")

// Daily price history (Trader plan)
hist, err := client.Cards.History(ctx, "<card-uuid>", &tcglookup.HistoryParams{
    Period: "30d", // 7d | 30d | 90d | 1y
})
Sets
sets, _ := client.Sets.List(ctx, &tcglookup.SetListParams{Game: "mtg", Limit: 50})
Games
games, _ := client.Games.List(ctx, nil)
Batch lookups

Pass any slice of IDs and the SDK auto-chunks into 20-ID batches:

ids := []string{"uuid1", "uuid2", /* ... */}
results, _ := client.Cards.Search(ctx, &tcglookup.CardSearchParams{IDs: ids})

Error handling

import "errors"

results, err := client.Cards.History(ctx, "<uuid>", nil)
if err != nil {
    var planErr *tcglookup.PlanAccessError
    var rateErr *tcglookup.RateLimitError
    switch {
    case errors.As(err, &planErr):
        log.Println("History requires Trader plan — upgrade at tcgpricelookup.com/tcg-api")
    case errors.As(err, &rateErr):
        log.Printf("Rate limited. Quota: %d/%d", client.RateLimit.Remaining, client.RateLimit.Limit)
    default:
        log.Fatal(err)
    }
}

Available error types: *Error (base), *AuthenticationError, *PlanAccessError, *NotFoundError, *RateLimitError.

Configuration

client := tcglookup.NewClient("tlk_live_...",
    tcglookup.WithBaseURL("https://api.tcgpricelookup.com/v1"),
    tcglookup.WithHTTPClient(&http.Client{Timeout: 60 * time.Second}),
    tcglookup.WithUserAgent("my-app/1.0"),
)

Sister SDKs

The full developer ecosystem index lives at awesome-tcg.

License

MIT — see LICENSE.


Built by TCG Price Lookup. Get a free API key at tcgpricelookup.com/tcg-api.

Directories

Path Synopsis
Package tcglookup is the official Go SDK for the TCG Price Lookup API.
Package tcglookup is the official Go SDK for the TCG Price Lookup API.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL