{
  "openapi": "3.1.0",
  "info": {
    "title": "OpenCard Card Data API",
    "version": "2026-11-02",
    "summary": "Read-only US credit card data from opencardai.com.",
    "description": "Public, read-only access to the card data shown on https://opencardai.com. No key required. Data: OpenCard (https://opencardai.com), licensed CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/). Commercial use allowed; attribution and a link back to https://opencardai.com are required. OpenCard may receive compensation from some card links; compensation does not determine ratings or order. Offers change often: verify terms with the issuer before applying. Not financial advice.",
    "license": {
      "name": "CC-BY-4.0",
      "url": "https://creativecommons.org/licenses/by/4.0/"
    },
    "contact": {
      "name": "OpenCard",
      "email": "data@opencardai.com",
      "url": "https://opencardai.com/en/developers"
    }
  },
  "servers": [
    {
      "url": "https://opencardai.com"
    }
  ],
  "paths": {
    "/api/public/cards": {
      "get": {
        "operationId": "searchCards",
        "summary": "Search cards",
        "parameters": [
          {
            "name": "q",
            "in": "query",
            "description": "Keywords (name, issuer, tags, earning categories).",
            "schema": {
              "type": "string",
              "maxLength": 100
            }
          },
          {
            "name": "issuer",
            "in": "query",
            "description": "Issuer substring, e.g. Chase.",
            "schema": {
              "type": "string",
              "maxLength": 100
            }
          },
          {
            "name": "network",
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "visa",
                "mastercard",
                "amex",
                "discover"
              ]
            }
          },
          {
            "name": "max_annual_fee",
            "in": "query",
            "schema": {
              "type": "number",
              "minimum": 0,
              "maximum": 10000
            }
          },
          {
            "name": "no_foreign_transaction_fee",
            "in": "query",
            "schema": {
              "type": "boolean"
            }
          },
          {
            "name": "tag",
            "in": "query",
            "description": "Exact tag, e.g. no-annual-fee.",
            "schema": {
              "type": "string",
              "maxLength": 60
            }
          },
          {
            "name": "include_discontinued",
            "in": "query",
            "schema": {
              "type": "boolean",
              "default": false
            }
          },
          {
            "name": "limit",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 50,
              "default": 20
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Matching cards",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SearchResult"
                }
              }
            }
          },
          "400": {
            "description": "Invalid input",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/public/cards/{card_id}": {
      "get": {
        "operationId": "getCard",
        "summary": "Get one card",
        "parameters": [
          {
            "name": "card_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^[a-z0-9][a-z0-9-]{0,80}$"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Full public card record",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "card": {
                      "$ref": "#/components/schemas/Card"
                    },
                    "disclosure": {
                      "type": "string"
                    },
                    "attribution": {
                      "type": "string"
                    },
                    "license": {
                      "$ref": "#/components/schemas/License"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid input",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/public/welcome-offers": {
      "get": {
        "operationId": "currentWelcomeOffers",
        "summary": "Current welcome offers",
        "parameters": [
          {
            "name": "issuer",
            "in": "query",
            "description": "Issuer substring.",
            "schema": {
              "type": "string",
              "maxLength": 100
            }
          },
          {
            "name": "min_estimated_value",
            "in": "query",
            "schema": {
              "type": "number",
              "minimum": 0,
              "maximum": 100000
            }
          },
          {
            "name": "elevated_only",
            "in": "query",
            "schema": {
              "type": "boolean"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 50,
              "default": 20
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Offers sorted by estimated value",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OffersResult"
                }
              }
            }
          },
          "400": {
            "description": "Invalid input",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/mcp": {
      "post": {
        "operationId": "mcp",
        "summary": "MCP server (Streamable HTTP, JSON-RPC 2.0)",
        "description": "Model Context Protocol endpoint. Tools: search_cards, get_card, current_welcome_offers. Stateless; JSON responses only.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "jsonrpc",
                  "method"
                ],
                "properties": {
                  "jsonrpc": {
                    "const": "2.0"
                  },
                  "id": {
                    "type": [
                      "string",
                      "integer"
                    ]
                  },
                  "method": {
                    "type": "string"
                  },
                  "params": {
                    "type": "object"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "JSON-RPC response"
          },
          "202": {
            "description": "Notification accepted"
          },
          "400": {
            "description": "Parse error"
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "License": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string"
          },
          "url": {
            "type": "string",
            "format": "uri"
          }
        }
      },
      "Card": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "card_id",
          "name",
          "issuer",
          "url"
        ],
        "properties": {
          "card_id": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "issuer": {
            "type": "string"
          },
          "network": {
            "type": "string"
          },
          "annual_fee": {
            "type": "number"
          },
          "annual_fee_description": {
            "type": "string"
          },
          "foreign_transaction_fee": {
            "type": "number",
            "description": "Foreign transaction fee, percent of the purchase (0 = none)."
          },
          "credit_required": {
            "type": "string"
          },
          "welcome_offer": {
            "$ref": "#/components/schemas/WelcomeOffer"
          },
          "earning_rates": {
            "type": "array",
            "items": {
              "type": "object"
            }
          },
          "travel_benefits": {
            "type": "object"
          },
          "insurance": {
            "type": "object"
          },
          "hotel_program": {
            "type": "object"
          },
          "application_rules": {
            "type": "object"
          },
          "last_updated": {
            "type": "string"
          },
          "sources": {
            "type": "array",
            "description": "Official and editorial sources (url and optional title only).",
            "items": {
              "type": "object",
              "additionalProperties": false,
              "required": [
                "url"
              ],
              "properties": {
                "url": {
                  "type": "string",
                  "format": "uri"
                },
                "title": {
                  "type": "string"
                }
              }
            }
          },
          "tags": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "status": {
            "type": "string"
          },
          "discontinued": {
            "type": "boolean"
          },
          "discontinued_notes": {
            "type": "string"
          },
          "discontinued_date": {
            "type": "string"
          },
          "recurring_credits": {
            "type": "array",
            "items": {
              "type": "object"
            }
          },
          "selectable_rewards": {
            "type": "object"
          },
          "relationship_bonus": {
            "type": "object"
          },
          "rotating_categories": {
            "type": "object"
          },
          "annual_credits": {
            "type": "array",
            "items": {
              "type": "object"
            },
            "description": "Legacy list of annual statement credits; most cards use recurring_credits."
          },
          "last_verified": {
            "type": "string",
            "description": "When the record was last checked against official sources (ISO date or datetime)."
          },
          "cash_advance_fee_flat": {
            "type": "number",
            "description": "Cash advance fee, flat USD amount."
          },
          "cash_advance_fee_pct": {
            "type": "number",
            "description": "Cash advance fee, percent of the advance."
          },
          "cash_advance_fee_min": {
            "type": "number",
            "description": "Cash advance fee minimum, USD."
          },
          "late_fee": {
            "type": "number",
            "description": "Late payment fee (up to), USD."
          },
          "late_fee_max": {
            "type": "number",
            "description": "Maximum late payment fee where tiered, USD."
          },
          "balance_transfer_fee_pct": {
            "type": "number",
            "description": "Balance transfer fee, percent of the transfer."
          },
          "balance_transfer_fee_min": {
            "type": "number",
            "description": "Balance transfer fee minimum, USD."
          },
          "authorized_user_fee": {
            "type": "number",
            "description": "Annual fee per additional authorized user, USD."
          },
          "url": {
            "type": "string",
            "format": "uri"
          }
        }
      },
      "WelcomeOffer": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "offer_status": {
            "type": "string"
          },
          "last_verified": {
            "type": "string"
          },
          "expires_at": {
            "type": "string"
          },
          "statement_credit": {
            "type": "number"
          },
          "spending_requirement": {
            "type": "number"
          },
          "time_period_months": {
            "type": "number"
          },
          "bonus_points": {
            "type": "number"
          },
          "bonus_type": {
            "type": "string",
            "enum": [
              "points",
              "cash",
              "percent_discount"
            ]
          },
          "discount_percent": {
            "type": "number"
          },
          "estimated_value": {
            "type": "number"
          },
          "point_program": {
            "type": "string"
          },
          "description": {
            "type": "string"
          },
          "bonus_value": {
            "type": "string"
          },
          "is_elevated": {
            "type": "boolean"
          },
          "normal_bonus_points": {
            "type": "number"
          },
          "elevated_until": {
            "type": "string"
          },
          "free_nights": {
            "type": "number"
          },
          "free_night_value_cap": {
            "type": "number"
          }
        }
      },
      "Error": {
        "type": "object",
        "required": [
          "error"
        ],
        "properties": {
          "error": {
            "type": "string"
          }
        }
      },
      "CardSummary": {
        "type": "object",
        "properties": {
          "card_id": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "issuer": {
            "type": "string"
          },
          "network": {
            "type": "string"
          },
          "annual_fee": {
            "type": "number"
          },
          "foreign_transaction_fee": {
            "type": "number"
          },
          "credit_required": {
            "type": "string"
          },
          "status": {
            "type": "string"
          },
          "welcome_offer": {
            "type": [
              "string",
              "null"
            ]
          },
          "top_earning_rates": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "category": {
                  "type": "string"
                },
                "rate": {
                  "type": "number"
                }
              }
            }
          },
          "tags": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "last_updated": {
            "type": "string"
          },
          "url": {
            "type": "string",
            "format": "uri"
          }
        }
      },
      "SearchResult": {
        "type": "object",
        "properties": {
          "total": {
            "type": "integer"
          },
          "count": {
            "type": "integer"
          },
          "cards": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CardSummary"
            }
          },
          "disclosure": {
            "type": "string"
          },
          "attribution": {
            "type": "string"
          }
        }
      },
      "Offer": {
        "type": "object",
        "properties": {
          "card_id": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "issuer": {
            "type": "string"
          },
          "annual_fee": {
            "type": "number"
          },
          "offer": {
            "type": [
              "string",
              "null"
            ]
          },
          "bonus_points": {
            "type": [
              "number",
              "null"
            ]
          },
          "point_program": {
            "type": [
              "string",
              "null"
            ]
          },
          "spending_requirement": {
            "type": [
              "number",
              "null"
            ]
          },
          "time_period_months": {
            "type": [
              "number",
              "null"
            ]
          },
          "estimated_value_usd": {
            "type": [
              "number",
              "null"
            ]
          },
          "is_elevated": {
            "type": "boolean"
          },
          "expires_at": {
            "type": [
              "string",
              "null"
            ]
          },
          "last_verified": {
            "type": [
              "string",
              "null"
            ]
          },
          "url": {
            "type": "string",
            "format": "uri"
          }
        }
      },
      "OffersResult": {
        "type": "object",
        "properties": {
          "as_of": {
            "type": "string",
            "format": "date"
          },
          "total": {
            "type": "integer"
          },
          "count": {
            "type": "integer"
          },
          "offers": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Offer"
            }
          },
          "disclosure": {
            "type": "string"
          },
          "attribution": {
            "type": "string"
          }
        }
      }
    }
  }
}