Skip to content
alltcgapi.com

SDKs

TypeScript, Python and Go clients.

Three client libraries for the same REST API, one per language, with the same resources, errors and pagination. They are in preparation. Until they are published, the calls below work with nothing but the standard library of each language.

Not published · checked 2026-11-19

The install commands fail today.

None of the three packages is on npm, PyPI or the Go module proxy yet. The table shows the names they are planned to have, so you know what to look for; it is not an instruction to run them now.

Two things work today, against the API as documented: the plain HTTP code further down, and a client generated from openapi.json with the generator you already use. Keys are self-service and the trial is free: get one.

Packages · planned

Three names to look for.

Planned SDK packages
LanguagePackageInstallRuntimeStatus
TypeScript@alltcgapi/sdknpm install @alltcgapi/sdkNode 20 or later, no runtime dependenciesNot on npm
Pythonalltcgapipip install alltcgapiPython 3.10 or later, with httpx; a sync and an async clientNot on PyPI
Gogithub.com/alltcgapi/sdk-gogo get github.com/alltcgapi/sdk-goStandard library onlyNot on Go module proxy

What the three share

The same behaviour in each language.

These are the rules the clients are being written to. They follow from how the API works, which is why the plain HTTP code below follows them too.

One key, every game
The key is passed to the client or read from ALLTCG_API_KEY. game is a parameter, not a separate client.
Pagination
A list is iterable: the client requests links.next exactly as the API returned it, until it is null.
Errors
One error class per error.code family (authentication, quota, rate limit, not found, invalid request), with request_id kept for support.
Retries
RATE_LIMITED and CONCURRENCY_LIMIT are retried after Retry-After, 5xx with backoff. QUOTA_EXCEEDED and TRIAL_EXPIRED are not: waiting does not bring credits back.
Credits
X-Credits-Cost and X-Quota-Remaining of the last response are readable from the client.

Routes and methods · planned

One method per route.

How each route of the API reference is planned to be called in each client. Names can still change before the first release.

Planned SDK methods per route
RouteTypeScriptPythonGo
GET /v1/gamesclient.games.list()client.games.list()c.Games.List(ctx)
GET /v1/setsclient.sets.list(params)client.sets.list(**params)c.Sets.List(ctx, params)
GET /v1/sets/{id}client.sets.get(idOrCode)client.sets.get(id_or_code)c.Sets.Get(ctx, idOrCode)
GET /v1/sets/{id}/cardsclient.sets.cards(idOrCode, params)client.sets.cards(id_or_code, **params)c.Sets.Cards(ctx, idOrCode, params)
GET /v1/cardsclient.cards.list(params)client.cards.list(**params)c.Cards.List(ctx, params)
GET /v1/cards/{id}client.cards.get(id)client.cards.get(id)c.Cards.Get(ctx, id)
GET /v1/sealedclient.sealed.list(params)client.sealed.list(**params)c.Sealed.List(ctx, params)
GET /v1/sealed/{id}client.sealed.get(id)client.sealed.get(id)c.Sealed.Get(ctx, id)
GET /v1/cards/{id}/pricesclient.prices.card(id, params)client.prices.card(id, **params)c.Prices.Card(ctx, id, params)
GET /v1/sealed/{id}/pricesclient.prices.sealed(id, params)client.prices.sealed(id, **params)c.Prices.Sealed(ctx, id, params)
GET /v1/prices/sourcesclient.prices.sources()client.prices.sources()c.Prices.Sources(ctx)
GET /v1/prices/coverageclient.prices.coverage()client.prices.coverage()c.Prices.Coverage(ctx)
GET /v1/referenceclient.reference.all()client.reference.all()c.Reference.All(ctx)
GET /v1/billing/plansclient.plans()client.plans()c.Plans(ctx)
GET /v1/statusclient.status()client.status()c.Status(ctx)
GET /v1/healthclient.health()client.health()c.Health(ctx)

Works today

The same job without an SDK.

Every card of one set, page by page: send the key, wait the seconds in Retry-After when the API says to slow down, stop on any other error with its code and request_id, and follow links.next until it is null. Swap OP01 for any set code of any game.

TypeScript · fetch, Node 20+
const KEY = process.env.ALLTCG_API_KEY!;

async function get(url: string): Promise<any> {
  for (;;) {
    const res = await fetch(url, { headers: { 'X-Api-Key': KEY } });
    const body = await res.json();
    if (res.ok) return body;
    // 429 is also QUOTA_EXCEEDED: no amount of waiting brings credits back.
    if (res.status === 429 && body.error.code !== 'QUOTA_EXCEEDED') {
      const wait = Number(res.headers.get('Retry-After') ?? '1');
      await new Promise((r) => setTimeout(r, wait * 1000));
      continue;
    }
    throw new Error(`${body.error.code}: ${body.error.message} (${body.error.request_id})`);
  }
}

// Every card of One Piece OP01, in collector-number order.
let url: string | null = 'https://api.alltcgapi.com/v1/sets/OP01/cards?limit=250';
while (url) {
  const page = await get(url);
  for (const card of page.data) console.log(card.number, card.name, card.id);
  url = page.links.next; // a complete URL: request it as it is
}
Python · standard library
import json, os, time, urllib.error, urllib.request

KEY = os.environ["ALLTCG_API_KEY"]

def get(url):
    while True:
        req = urllib.request.Request(url, headers={"X-Api-Key": KEY})
        try:
            with urllib.request.urlopen(req) as res:
                return json.load(res)
        except urllib.error.HTTPError as err:
            body = json.load(err)["error"]
            # 429 is also QUOTA_EXCEEDED: no amount of waiting brings credits back.
            if err.code == 429 and body["code"] != "QUOTA_EXCEEDED":
                time.sleep(int(err.headers.get("Retry-After", "1")))
                continue
            raise RuntimeError(f"{body['code']}: {body['message']} ({body['request_id']})")

# Every card of One Piece OP01, in collector-number order.
url = "https://api.alltcgapi.com/v1/sets/OP01/cards?limit=250"
while url:
    page = get(url)
    for card in page["data"]:
        print(card["number"], card["name"], card["id"])
    url = page["links"]["next"]  # a complete URL: request it as it is
Go · net/http
type page struct {
	Data []struct {
		ID, Number, Name string
	} `json:"data"`
	Links struct {
		Next *string `json:"next"`
	} `json:"links"`
}

func get(ctx context.Context, url string, out any) error {
	for {
		req, _ := http.NewRequestWithContext(ctx, "GET", url, nil)
		req.Header.Set("X-Api-Key", os.Getenv("ALLTCG_API_KEY"))
		res, err := http.DefaultClient.Do(req)
		if err != nil {
			return err
		}
		if res.StatusCode < 400 {
			defer res.Body.Close()
			return json.NewDecoder(res.Body).Decode(out)
		}
		var e struct {
			Error struct {
				Code      string `json:"code"`
				Message   string `json:"message"`
				RequestID string `json:"request_id"`
			} `json:"error"`
		}
		json.NewDecoder(res.Body).Decode(&e)
		res.Body.Close()
		// 429 is also QUOTA_EXCEEDED: no amount of waiting brings credits back.
		if res.StatusCode == http.StatusTooManyRequests && e.Error.Code != "QUOTA_EXCEEDED" {
			wait, _ := strconv.Atoi(res.Header.Get("Retry-After"))
			time.Sleep(time.Duration(max(wait, 1)) * time.Second)
			continue
		}
		return fmt.Errorf("%s: %s (%s)", e.Error.Code, e.Error.Message, e.Error.RequestID)
	}
}

// Every card of One Piece OP01, in collector-number order.
next := "https://api.alltcgapi.com/v1/sets/OP01/cards?limit=250"
for next != "" {
	var p page
	if err := get(ctx, next, &p); err != nil {
		return err
	}
	for _, card := range p.Data {
		fmt.Println(card.Number, card.Name, card.ID)
	}
	next = ""
	if p.Links.Next != nil {
		next = *p.Links.Next // a complete URL: request it as it is
	}
}

A list with limit=250 costs 5 credits a page, and an error costs nothing. The samples retry a 429 unless its code is QUOTA_EXCEEDED; a 503 METER_UNAVAILABLE can also be retried after a few seconds. No other code improves by waiting. Every code is on the errors page.