{"openapi":"3.1.0","info":{"title":"The Card Caddie API","version":"1.0.0","description":"Rank your cards for a store, read category rates, and manage your wallet. Dollar estimates assume one cent per reward unit. Unknown stores use Other unless category is supplied. MCP is available separately at /mcp."},"servers":[{"url":"https://www.thecardcaddie.com"}],"paths":{"/api/v1/rank":{"post":{"operationId":"rank_cards","summary":"Rank your cards for a store","security":[{"ApiKey":[]},{"OAuth":["wallet:read"]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"store":{"type":"string","minLength":1,"maxLength":253,"description":"Merchant name, domain, or website URL."},"amount":{"type":"number","exclusiveMinimum":0,"maximum":1000000000,"description":"Optional purchase amount in USD. Estimates assume one cent per reward unit."},"category":{"type":"string","description":"Optional merchant category override.","enum":["travel","groceries","gas","dining","shopping","entertainment","drugstores","home_improvement","transit","streaming_services","fitness_clubs","utilities","other"]}},"required":["store"],"additionalProperties":false}}}},"responses":{"200":{"description":"Cards ranked best first","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/RankedCard"}}}}},"400":{"description":"Invalid request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Connect your account or provide a valid API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Required permission was not granted","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"No active cards in your wallet","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Request limit reached","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"headers":{"Retry-After":{"schema":{"type":"integer"},"description":"Seconds to wait before retrying"}}},"500":{"description":"Server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/v1/cards":{"get":{"operationId":"list_cards","summary":"List your active wallet cards","security":[{"ApiKey":[]},{"OAuth":["wallet:read"]}],"responses":{"200":{"description":"Active cards; an empty wallet returns []","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/WalletCard"}}}}},"400":{"description":"Invalid request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Connect your account or provide a valid API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Required permission was not granted","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Request limit reached","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"headers":{"Retry-After":{"schema":{"type":"integer"},"description":"Seconds to wait before retrying"}}},"500":{"description":"Server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"post":{"operationId":"add_card","summary":"Add a supported card to your wallet","description":"Send templateId OR full name and optional issuer. Sequential repeat requests reuse an existing active template. Serialize adds to avoid concurrent duplicates.","security":[{"ApiKey":[]},{"OAuth":["wallet:write"]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"templateId":{"type":"string","format":"uuid"},"name":{"type":"string","minLength":1,"maxLength":200},"issuer":{"type":"string","minLength":1,"maxLength":200}},"additionalProperties":false,"oneOf":[{"required":["templateId"],"not":{"anyOf":[{"required":["name"]},{"required":["issuer"]}]}},{"required":["name"],"not":{"required":["templateId"]}}]}}}},"responses":{"200":{"description":"Already in your wallet","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WalletCard"}}}},"201":{"description":"Card added","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WalletCard"}}}},"400":{"description":"Invalid request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Connect your account or provide a valid API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Required permission was not granted","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Supported template not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Multiple cards match; select a candidate","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Request limit reached","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"headers":{"Retry-After":{"schema":{"type":"integer"},"description":"Seconds to wait before retrying"}}},"500":{"description":"Server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/v1/cards/{cardId}":{"get":{"operationId":"get_card_rates","summary":"Read one card’s category rates","parameters":[{"name":"cardId","in":"path","required":true,"description":"Wallet ID from list_cards or add_card, not a template ID.","schema":{"type":"string","format":"uuid"}}],"security":[{"ApiKey":[]},{"OAuth":["wallet:read"]}],"responses":{"200":{"description":"Numeric category multipliers, including saved overrides. No domain rules or notes.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CardRates"}}}},"400":{"description":"Invalid request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Connect your account or provide a valid API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Required permission was not granted","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Card not found in your wallet","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Request limit reached","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"headers":{"Retry-After":{"schema":{"type":"integer"},"description":"Seconds to wait before retrying"}}},"500":{"description":"Server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"delete":{"operationId":"remove_card","summary":"Remove a card from your wallet","parameters":[{"name":"cardId","in":"path","required":true,"description":"Wallet ID from list_cards or add_card, not a template ID.","schema":{"type":"string","format":"uuid"}}],"security":[{"ApiKey":[]},{"OAuth":["wallet:write"]}],"responses":{"204":{"description":"Removed. No response body; do not parse as JSON."},"400":{"description":"Invalid request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Connect your account or provide a valid API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Required permission was not granted","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Card not found in your active wallet","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Request limit reached","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"headers":{"Retry-After":{"schema":{"type":"integer"},"description":"Seconds to wait before retrying"}}},"500":{"description":"Server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/v1/card-templates":{"get":{"operationId":"find_supported_cards","summary":"List supported card products","security":[{"ApiKey":[]},{"OAuth":["wallet:read"]}],"responses":{"200":{"description":"Product catalog, not your wallet","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/Template"}}}}},"400":{"description":"Invalid request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Connect your account or provide a valid API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Required permission was not granted","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Request limit reached","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"headers":{"Retry-After":{"schema":{"type":"integer"},"description":"Seconds to wait before retrying"}}},"500":{"description":"Server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/v1/calculate-reward":{"post":{"operationId":"calculate_reward","summary":"Legacy single-card reward calculation","security":[{"ApiKey":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["card","merchant","amount"],"properties":{"card":{"type":"string"},"merchant":{"type":"string"},"amount":{"type":"number","exclusiveMinimum":0},"category":{"type":"string"}}}}}},"responses":{"200":{"description":"Legacy reward estimate. Rate label uses percent; value assumes one cent per reward unit.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"reward":{"type":"object","properties":{"value":{"type":"number"},"rate":{"type":"string"},"category":{"type":"string"},"cardName":{"type":"string"},"merchant":{"type":"string"},"amount":{"type":"number"},"categorySource":{"type":"string"}}}}}}}},"400":{"description":"Invalid request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"API key required","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Card not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Request limit reached","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"headers":{"Retry-After":{"schema":{"type":"integer"},"description":"Seconds to wait before retrying"}}},"500":{"description":"Server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}}},"components":{"securitySchemes":{"ApiKey":{"type":"http","scheme":"bearer","bearerFormat":"cc_ API key","description":"API key from your Card Caddie profile. Existing keys have wallet read and write access."},"OAuth":{"type":"oauth2","description":"Public clients use S256 PKCE. Register at https://www.thecardcaddie.com/api/assistant-oauth/register. Request resource https://www.thecardcaddie.com/api/v1 for REST access; /mcp tokens are audience-bound separately. Request offline_access for refresh tokens.","flows":{"authorizationCode":{"authorizationUrl":"https://www.thecardcaddie.com/api/assistant-oauth/authorize","tokenUrl":"https://www.thecardcaddie.com/api/assistant-oauth/token","refreshUrl":"https://www.thecardcaddie.com/api/assistant-oauth/token","scopes":{"wallet:read":"View cards, rates, and recommendations","wallet:write":"Add and remove cards","offline_access":"Stay connected with rotating refresh tokens"}}}}},"schemas":{"WalletCard":{"type":"object","additionalProperties":false,"required":["id","name","issuer"],"properties":{"id":{"type":"string","format":"uuid"},"name":{"type":"string"},"issuer":{"type":"string"}}},"Template":{"type":"object","additionalProperties":false,"required":["templateId","name","issuer"],"properties":{"templateId":{"type":"string","format":"uuid"},"name":{"type":"string"},"issuer":{"type":"string"}}},"Categories":{"type":"object","additionalProperties":false,"required":["travel","groceries","gas","dining","shopping","entertainment","drugstores","home_improvement","transit","streaming_services","fitness_clubs","utilities","other"],"properties":{"travel":{"type":"number","description":"Earn multiplier; 4 means 4x."},"groceries":{"type":"number","description":"Earn multiplier; 4 means 4x."},"gas":{"type":"number","description":"Earn multiplier; 4 means 4x."},"dining":{"type":"number","description":"Earn multiplier; 4 means 4x."},"shopping":{"type":"number","description":"Earn multiplier; 4 means 4x."},"entertainment":{"type":"number","description":"Earn multiplier; 4 means 4x."},"drugstores":{"type":"number","description":"Earn multiplier; 4 means 4x."},"home_improvement":{"type":"number","description":"Earn multiplier; 4 means 4x."},"transit":{"type":"number","description":"Earn multiplier; 4 means 4x."},"streaming_services":{"type":"number","description":"Earn multiplier; 4 means 4x."},"fitness_clubs":{"type":"number","description":"Earn multiplier; 4 means 4x."},"utilities":{"type":"number","description":"Earn multiplier; 4 means 4x."},"other":{"type":"number","description":"Earn multiplier; 4 means 4x."}}},"CardRates":{"type":"object","additionalProperties":false,"required":["name","issuer","categories"],"properties":{"name":{"type":"string"},"issuer":{"type":"string"},"categories":{"$ref":"#/components/schemas/Categories"}}},"RankedCard":{"type":"object","additionalProperties":false,"required":["rank","card","value"],"properties":{"rank":{"type":"integer","minimum":1},"card":{"type":"string"},"value":{"type":"number","description":"Earn multiplier; 4 means 4x."},"estimatedReturnUsd":{"type":"number","description":"Only present when amount is supplied. amount × value ÷ 100, rounded to four decimals; not guaranteed redemption value."}}},"Error":{"type":"object","required":["error","message"],"properties":{"error":{"type":"string"},"message":{"type":"string"},"success":{"type":"boolean"},"candidates":{"type":"array","items":{"$ref":"#/components/schemas/Template"}}}}}}}