cardapi
Official Python SDK for the CardAPI — the most comprehensive credit card data API for the US and Canada.
Get a free key (100 calls a day, no card): cardapi.dev/signup. Plans and the fields each returns: cardapi.dev/pricing.
Install
pip install cardapi
Or install from source:
pip install /path/to/sdk-python
Quick Start
from cardapi import CardAPI
client = CardAPI(api_key="ck_live_xxxxx")
# List Canadian cards: {"data": [...], "total": ..., "limit": ..., "offset": ...}
cards = client.get_cards(country="CA")
print(cards["total"])
# Get a specific card
card = client.get_card("chase-sapphire-preferred-credit-card")["data"]
# Search, optionally within one country
results = client.search_cards("sapphire")
canadian = client.search_cards("visa", country="CA")
# Best cards for a spending category
best = client.get_best_cards("dining", country="US", limit=5)
# Compare cards side by side
compared = client.compare_cards(["chase-sapphire-preferred-credit-card", "american-express-gold-card"])
# Issuers
issuers = client.get_issuers(country="US")
issuer = client.get_issuer("chase")
# Spending categories and point valuations
categories = client.get_categories()
valuations = client.get_reward_valuations()
# Issuer application rules (e.g. Chase 5/24) and product change paths
rules = client.get_application_rules(issuer="chase")
paths = client.get_product_changes(issuer="chase")
# Starter plan and above
perks = client.get_card_perks("american-express-gold-card")
credits = client.get_card_credits("american-express-gold-card")
# Pro plan and above
history = client.get_card_history("citi-custom-cash-card")
transfers = client.get_card_transfers("american-express-gold-card")
partners = client.get_transfer_partners(currency="MR")
notable = client.get_notable_offers(country="US")
# Database stats and your API usage
stats = client.get_stats()
usage = client.get_usage()
A runnable version is in examples/quickstart.py:
CARDAPI_API_KEY=ck_live_... python examples/quickstart.py
Reward rates
Each card's reward_rates say where a rate applies in categories (slugs from
/v1/categories), merchant, booking_channel and choice_group; match on
those. category_slug is a label built from them, unique on the card within a
rotating quarter, so the same rate reads the same on every card:
<categories>[:<merchant>][@portal|@direct][#choice][~<tag>], for example
dining, groceries+gas, airlines:united-airlines, travel@portal,
dining#choice and other (the base rate). A ~tag such as ~3x is added
only when two rates of one card would otherwise share a label, and can change
when the card's other rates change.
Options
client = CardAPI(
api_key="ck_live_xxxxx",
base_url="http://localhost:3100", # default: cardapi.client.DEFAULT_BASE_URL
timeout=(5, 30), # (connect, read) seconds; the default
)
Error Handling
from cardapi import CardAPI, CardAPIError
client = CardAPI(api_key="ck_live_xxxxx")
try:
card = client.get_card("nonexistent-card")
except CardAPIError as e:
print(e.status_code) # 404
print(e.code) # "not_found"
print(str(e)) # "Card not found"
print(e.retry_after) # seconds, when the server sent Retry-After (e.g. on 429)
Every HTTP error response raises CardAPIError, including ones whose body isn't JSON (their code is "unknown"). Connection failures and timeouts raise the usual requests exceptions, such as requests.exceptions.Timeout.
API Reference
All methods return the API's JSON response as a Python dict.
| Method | Description |
|---|---|
get_cards(country, issuer, limit, offset, network, card_type, max_annual_fee, no_annual_fee, credit_score, include_discontinued) |
List cards with optional filters, 25 per page unless you pass limit |
get_card(slug) |
Get a single card by slug |
search_cards(query, country, limit, offset) |
Search card and issuer names |
compare_cards(slugs) |
Side-by-side comparison of 2-5 cards |
get_best_cards(category, country, limit, max_annual_fee, no_annual_fee) |
Best cards for a spending category |
get_card_history(slug) |
Tracked field changes for a card (Pro+) |
get_card_perks(slug) |
Companion perks for a card (Starter+) |
get_card_credits(slug) |
Statement credits for a card (Starter+) |
get_card_transfers(slug) |
Transfer partners for a card (Pro+) |
get_issuers(country) |
List issuers |
get_issuer(slug) |
Get a single issuer |
get_categories() |
List spending categories |
get_transfer_partners(currency) |
Transfer partner directory (Pro+) |
get_application_rules(issuer) |
Issuer application restrictions |
get_reward_valuations() |
Cents-per-point valuations |
get_product_changes(issuer) |
Product change paths |
get_notable_offers(country) |
Recent notable offer changes (Pro+) |
get_offer_history(card_slug) |
Offer change history for a card (Pro+) |
create_webhook(url, events) / list_webhooks() / delete_webhook(id) |
Webhooks (Enterprise) |
get_stats() |
Database stats |
get_usage() |
Your account's usage (all keys) and limits |
Get an API Key
Sign up at cardapi.dev/portal — free tier includes 100 requests/day.
Metadata
Release files for cardapi 0.3.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| cardapi-0.3.1.tar.gz | 9.0 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| cardapi-0.3.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 15.8 kB
Release files / cardapi-0.3.1.tar.gz
| Download URL | cardapi-0.3.1.tar.gz |
|---|---|
| Size | 9.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
9ee8f0f540c52ae90de003082c375bbaa3e8c70dc2083b0cf501be1b83b9444d
|
|
BLAKE2b-256 checksum How to use checksums |
f9bb729f08adee6b85ddec4252c0a72f18c9c0c0d5cf1cd01c70c90895c981e9
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.14.7
|
Release files / cardapi-0.3.1-py3-none-any.whl
| Download URL | cardapi-0.3.1-py3-none-any.whl |
|---|---|
| Size | 6.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
80190ff6b05a994e9510eeb6c4481ab8529357ddfaa2ea9a50a0bcb8e195ccfd
|
|
BLAKE2b-256 checksum How to use checksums |
875b10a38256b5681d546b383125e71a954e09675eb4a7c30eca7f2328012dcf
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.14.7
|