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.1.0.tar.gz (3.3 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.1.0-py3-none-any.whl (3.8 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for cardapi-0.1.0.tar.gz
Algorithm Hash digest
SHA256 7465e952026fb8f6f9fd9f397b7b786761c7809b17f5b4a22742d6280391479f
MD5 a22fbe3de5c984c42dcf5998d5664c02
BLAKE2b-256 8ae33725b40a5fc41e396ef38ad7cdaa3b62cc414449878bdf975da8041c5515

See more details on using hashes here.

File details

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

File metadata

  • Download URL: cardapi-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 3.8 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.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 7325c9bf0169c2dd159ef80aedfed40d4a15a4073dfec0f7ebb09ee8925b9e7c
MD5 59adf93d4330b47643bc64c168a05bd1
BLAKE2b-256 9439b328898b2d02fb572a744b8848f110d7e3e076d9b161d8e14706bebcf80f

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