{"openapi":"3.1.0","info":{"title":"cards.cards Developer & AI Agent API","version":"1.0.0","summary":"Programmable international USD virtual cards for builders and autonomous AI agents.","description":"Issue isolated international virtual cards per vendor (OpenAI, AWS, Vercel, Cursor), enforce strict integer-cent spend limits, freeze/unfreeze cards in real time, and retrieve live 3DS OTP codes programmatically.","contact":{"name":"cards.cards Engineering","email":"info@cards.cards"}},"servers":[{"url":"https://cards-cards-631297322917.europe-west1.run.app/api/v1","description":"cards.cards REST API v1"}],"security":[{"BearerAuth":[]}],"tags":[{"name":"Cards","description":"Issue, fund, freeze, and configure per-vendor international virtual cards."},{"name":"Transactions & 3DS","description":"Inspect settled/declined transactions and fetch live 3D Secure OTP codes."}],"components":{"securitySchemes":{"BearerAuth":{"type":"http","scheme":"bearer","bearerFormat":"cc_live_<token>","description":"Create an API key in Dashboard -> Developers. Pass as `Authorization: Bearer cc_live_...`."}},"parameters":{"CardIdParam":{"name":"id","in":"path","required":true,"description":"Unique card identifier (`crd-...`).","schema":{"type":"string","minLength":4,"maxLength":100}},"IdempotencyKeyHeader":{"name":"Idempotency-Key","in":"header","required":false,"description":"Optional unique key (6-128 chars) guaranteeing safe retries without duplicate card issuance or top-up charges.","schema":{"type":"string","minLength":6,"maxLength":128}}},"schemas":{"ErrorResponse":{"type":"object","required":["error","code"],"properties":{"error":{"type":"string"},"code":{"type":"string"}}},"CardLimits":{"type":"object","required":["perTxLimitCents","dailyLimitCents","monthlyLimitCents","totalSpendLimitCents"],"properties":{"perTxLimitCents":{"type":"integer","description":"Maximum spend per single authorization in USD cents ($50.00 = 5000)."},"dailyLimitCents":{"type":"integer","description":"Maximum rolling UTC daily spend in USD cents."},"monthlyLimitCents":{"type":"integer","description":"Maximum rolling UTC monthly spend in USD cents."},"totalSpendLimitCents":{"type":["integer","null"],"description":"Optional lifetime spend cap in USD cents before automatic card freeze."}}},"Card":{"type":"object","required":["id","label","tags","cardBin","binCountryCode","paymentSystem","maskedPan","status","availableBalanceCents","limits","createdAt"],"properties":{"id":{"type":"string","example":"crd-94f2b8a0-1234-4a9b-88c1-001122334455"},"label":{"type":"string","example":"OpenAI Production Agent"},"tags":{"type":"array","items":{"type":"string"},"example":["ai-agent","openai"]},"cardBin":{"type":"string","example":"493728"},"binCountryCode":{"type":"string","enum":["SG"]},"paymentSystem":{"type":"string","enum":["VISA"]},"maskedPan":{"type":"string","example":"************4829"},"status":{"type":"string","enum":["CREATING","ACTIVE","FROZEN","CLOSING","CLOSED","CREATION_FAILED"]},"freezeReason":{"type":["string","null"],"enum":["USER_MANUAL","API_AGENT","ANTI_DECLINE_GUARD","SPEND_LIMIT_REACHED","ADMIN_LOCK",null]},"availableBalanceCents":{"type":"integer","description":"Available card balance in integer USD cents.","example":5000},"limits":{"$ref":"#/components/schemas/CardLimits"},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"}}},"IssueCardRequest":{"type":"object","required":["label","initialDepositCents"],"properties":{"label":{"type":"string","minLength":1,"maxLength":50,"description":"Human or agent-readable vendor label (e.g., \"AWS Staging\", \"Cursor IDE\")."},"tags":{"type":"array","maxItems":10,"items":{"type":"string","maxLength":24}},"initialDepositCents":{"type":"integer","minimum":0,"maximum":10000000,"description":"Initial USD balance in integer cents transferred from your wallet (e.g., 2500 = $25.00)."},"perTxLimitCents":{"type":"integer","minimum":1,"maximum":10000000},"dailyLimitCents":{"type":"integer","minimum":1,"maximum":25000000},"monthlyLimitCents":{"type":"integer","minimum":1,"maximum":100000000},"totalSpendLimitCents":{"type":["integer","null"],"minimum":1,"maximum":100000000},"idempotencyKey":{"type":"string","minLength":6,"maxLength":128}}},"TopUpCardRequest":{"type":"object","required":["amountCents"],"properties":{"amountCents":{"type":"integer","minimum":100,"maximum":10000000,"description":"Amount in integer USD cents to load onto the card (minimum 100 = $1.00)."},"idempotencyKey":{"type":"string","minLength":6,"maxLength":128}}},"UpdateCardLimitRequest":{"type":"object","properties":{"perTxLimitCents":{"type":"integer","minimum":1,"maximum":10000000},"dailyLimitCents":{"type":"integer","minimum":1,"maximum":25000000},"monthlyLimitCents":{"type":"integer","minimum":1,"maximum":100000000},"totalSpendLimitCents":{"type":["integer","null"],"minimum":1,"maximum":100000000}}},"CardTransaction":{"type":"object","required":["id","cardId","type","direction","status","amountCents","currency","totalChargedCents","occurredAt"],"properties":{"id":{"type":"string"},"cardId":{"type":"string"},"type":{"type":"string","enum":["CARD_PAYMENT","CARD_TOP_UP","CARD_CLOSURE","AUTH_FEE_BANK","CARD_WITHDRAWAL"]},"direction":{"type":"string","enum":["OUTGOING","INCOMING"]},"status":{"type":"string","enum":["PENDING","SUCCESS","DECLINE"]},"amountCents":{"type":"integer"},"currency":{"type":"string","example":"USD"},"providerFeeCents":{"type":"integer"},"ourFeeCents":{"type":"integer"},"totalChargedCents":{"type":"integer"},"merchantName":{"type":["string","null"]},"failureReason":{"type":["string","null"]},"occurredAt":{"type":"string","format":"date-time"}}},"Card3dsCode":{"type":"object","required":["id","cardId","callbackType","code","expiresAt","createdAt"],"properties":{"id":{"type":"string"},"cardId":{"type":"string"},"callbackType":{"type":"string","enum":["THREE_DS_OTP","THREE_DS_CONFIRM"]},"maskedPan":{"type":"string"},"code":{"type":"string","example":"482910"},"merchantName":{"type":["string","null"]},"orderNumber":{"type":["string","null"]},"expiresAt":{"type":"string","format":"date-time"},"createdAt":{"type":"string","format":"date-time"}}}}},"paths":{"/cards":{"get":{"operationId":"listCards","tags":["Cards"],"summary":"List all virtual cards","description":"Requires `cards:read` scope. Optionally filter by `status` or `tag`.","parameters":[{"name":"status","in":"query","required":false,"schema":{"type":"string","enum":["CREATING","ACTIVE","FROZEN","CLOSING","CLOSED"]}},{"name":"tag","in":"query","required":false,"schema":{"type":"string"}}],"responses":{"200":{"description":"List of virtual cards owned by the authenticated account.","content":{"application/json":{"schema":{"type":"object","required":["ok","cards"],"properties":{"ok":{"type":"boolean"},"cards":{"type":"array","items":{"$ref":"#/components/schemas/Card"}}}}}}},"401":{"description":"Invalid or missing API key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}},"post":{"operationId":"issueCard","tags":["Cards"],"summary":"Issue a new virtual card","description":"Requires `cards:write` scope and approved KYC. Atomically reserves funds from your USD wallet and provisions an active international USD virtual card.","parameters":[{"$ref":"#/components/parameters/IdempotencyKeyHeader"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/IssueCardRequest"}}}},"responses":{"201":{"description":"Newly issued virtual card.","content":{"application/json":{"schema":{"type":"object","required":["ok","card"],"properties":{"ok":{"type":"boolean"},"card":{"$ref":"#/components/schemas/Card"}}}}}},"402":{"description":"Insufficient USD wallet balance.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/cards/{id}":{"get":{"operationId":"getCard","tags":["Cards"],"summary":"Retrieve a single virtual card by ID","description":"Requires `cards:read` scope.","parameters":[{"$ref":"#/components/parameters/CardIdParam"}],"responses":{"200":{"description":"Virtual card details.","content":{"application/json":{"schema":{"type":"object","required":["ok","card"],"properties":{"ok":{"type":"boolean"},"card":{"$ref":"#/components/schemas/Card"}}}}}}}}},"/cards/{id}/topup":{"post":{"operationId":"topUpCard","tags":["Cards"],"summary":"Top up a virtual card from USD wallet","description":"Requires `cards:write` scope. Debits wallet and settles onto the target card.","parameters":[{"$ref":"#/components/parameters/CardIdParam"},{"$ref":"#/components/parameters/IdempotencyKeyHeader"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/TopUpCardRequest"}}}},"responses":{"200":{"description":"Updated virtual card with increased balance.","content":{"application/json":{"schema":{"type":"object","required":["ok","card"],"properties":{"ok":{"type":"boolean"},"card":{"$ref":"#/components/schemas/Card"}}}}}}}}},"/cards/{id}/limit":{"patch":{"operationId":"updateCardLimits","tags":["Cards"],"summary":"Update per-transaction, daily, monthly, or lifetime spend caps","description":"Requires `cards:write` scope.","parameters":[{"$ref":"#/components/parameters/CardIdParam"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateCardLimitRequest"}}}},"responses":{"200":{"description":"Updated virtual card limits.","content":{"application/json":{"schema":{"type":"object","required":["ok","card"],"properties":{"ok":{"type":"boolean"},"card":{"$ref":"#/components/schemas/Card"}}}}}}}}},"/cards/{id}/freeze":{"post":{"operationId":"freezeCard","tags":["Cards"],"summary":"Immediately freeze a virtual card","description":"Requires `cards:write` scope. Blocks all new merchant authorizations.","parameters":[{"$ref":"#/components/parameters/CardIdParam"}],"responses":{"200":{"description":"Frozen card.","content":{"application/json":{"schema":{"type":"object","required":["ok","card"],"properties":{"ok":{"type":"boolean"},"card":{"$ref":"#/components/schemas/Card"}}}}}}}}},"/cards/{id}/unfreeze":{"post":{"operationId":"unfreezeCard","tags":["Cards"],"summary":"Unfreeze a previously frozen virtual card","description":"Requires `cards:write` scope. Resets consecutive decline counter.","parameters":[{"$ref":"#/components/parameters/CardIdParam"}],"responses":{"200":{"description":"Active card.","content":{"application/json":{"schema":{"type":"object","required":["ok","card"],"properties":{"ok":{"type":"boolean"},"card":{"$ref":"#/components/schemas/Card"}}}}}}}}},"/cards/{id}/transactions":{"get":{"operationId":"listCardTransactions","tags":["Transactions & 3DS"],"summary":"List recent merchant authorizations, settlements, and declines for a card","description":"Requires `transactions:read` scope.","parameters":[{"$ref":"#/components/parameters/CardIdParam"}],"responses":{"200":{"description":"List of card transactions.","content":{"application/json":{"schema":{"type":"object","required":["ok","transactions"],"properties":{"ok":{"type":"boolean"},"transactions":{"type":"array","items":{"$ref":"#/components/schemas/CardTransaction"}}}}}}}}}},"/cards/{id}/3ds":{"get":{"operationId":"getCard3dsCodes","tags":["Transactions & 3DS"],"summary":"Fetch active 3D Secure OTP / verification codes for autonomous checkout","description":"Requires `cards:read` scope. Returns non-expired 3DS codes (5-minute TTL) received from issuer callbacks.","parameters":[{"$ref":"#/components/parameters/CardIdParam"}],"responses":{"200":{"description":"Active 3DS codes for the card.","content":{"application/json":{"schema":{"type":"object","required":["ok","codes"],"properties":{"ok":{"type":"boolean"},"codes":{"type":"array","items":{"$ref":"#/components/schemas/Card3dsCode"}}}}}}}}}}}}