Skip to main content

Python SDK for the CardAPI credit card data API

Project description

cardapi

Official Python SDK for the CardAPI — the most comprehensive credit card data API for the US and Canada.

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
cards = client.get_cards(country="CA")

# Get a specific card
card = client.get_card("chase-sapphire-preferred")

# Search
results = client.search_cards("sapphire")

# 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", "amex-gold"])

# Card change history (Pro+ tier)
history = client.get_card_history("chase-sapphire-preferred")

# Transfer partners for a card
transfers = client.get_card_transfers("chase-sapphire-preferred")

# Issuers
issuers = client.get_issuers()
issuer = client.get_issuer("chase")

# Spending categories
categories = client.get_categories()

# Transfer partner directory
partners = client.get_transfer_partners()

# Issuer application rules (e.g. Chase 5/24)
rules = client.get_application_rules(issuer="chase")

# Database stats
stats = client.get_stats()

# Your API usage and limits
usage = client.get_usage()

Custom Base URL

client = CardAPI(
    api_key="ck_live_xxxxx",
    base_url="http://localhost:3100",
)

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"

API Reference

All methods return the raw API response as a Python dict.

Method Description
get_cards(country, issuer, limit, offset) List cards with optional filters
get_card(slug) Get a single card by slug
search_cards(query, country) Full-text search
compare_cards(slugs) Side-by-side comparison
get_best_cards(category, country, limit) Best cards for a spending category
get_card_history(slug) Offer change history (Pro+)
get_card_transfers(slug) Transfer partners for a card
get_issuers() List all issuers
get_issuer(slug) Get a single issuer
get_categories() List spending categories
get_transfer_partners(currency) Transfer partner directory
get_application_rules(issuer) Issuer application restrictions
get_stats() Database stats
get_usage() Your API key usage and limits

Get an API Key

Sign up at cardapi.dev/portal — free tier includes 100 requests/day.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

cardapi-0.2.0.tar.gz (3.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

cardapi-0.2.0-py3-none-any.whl (3.9 kB view details)

Uploaded Python 3

File details

Details for the file cardapi-0.2.0.tar.gz.

File metadata

  • Download URL: cardapi-0.2.0.tar.gz
  • Upload date:
  • Size: 3.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.12

File hashes

Hashes for cardapi-0.2.0.tar.gz
Algorithm Hash digest
SHA256 6280dc64e132fb0e29c92875b8b44bd8edd9dcb8a2df16d6f47a83152c0d5880
MD5 916c113bf0ca9f333fde24925a7a9626
BLAKE2b-256 184e73a7608129cfafd1d57b641234bc733d719b5ec69dcce691a6345496e968

See more details on using hashes here.

File details

Details for the file cardapi-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: cardapi-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 3.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.12

File hashes

Hashes for cardapi-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 3ab7b3ce61e38d113133406b246188724364a5b8ca2a6d03a74bb5aae9f37fac
MD5 0ab8ca8f0ce344b0304581bdc2114180
BLAKE2b-256 4946806bee0066d230ade7f5eaec81836cb304635f0c6d56403226885daee030

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page