{
  "openapi": "3.1.0",
  "info": {
    "title": "CardAPI — 카드 이용내역 조회 API",
    "version": "2026-12-01",
    "summary": "농협·우리·국민카드 이용내역(승인내역)을 카드사 홈페이지 아이디·비밀번호로 조회하는 무료 REST API",
    "description": "농협·우리·국민카드 이용내역(승인내역)을 카드사 홈페이지 아이디·비밀번호로 조회하는 무료 REST API. BankAPI 와 같은 API 키를 쓴다(콘솔 https://console.bankapi.co.kr/). 한국(국내) IP 에서만 호출할 수 있다(Google Apps Script 예외). 조회 제한: API 키마다 30분에 60회, 같은 조회는 30초에 한 번. 카드사 아이디·비밀번호와 이용내역은 저장하지 않는다. 카드사 쪽 실패(HTTP 200 + success:false) code: INTERNAL_ERROR, INVALID_INPUT, CRAWLER_ERROR, UNSUPPORTED_OP.",
    "contact": {
      "email": "help@bankapi.co.kr",
      "url": "https://cardapi.co.kr"
    }
  },
  "servers": [
    {
      "url": "https://api.cardapi.co.kr",
      "description": "국내 IP 에서만 열린다"
    }
  ],
  "externalDocs": {
    "url": "https://cardapi.co.kr/docs",
    "description": "CardAPI 문서"
  },
  "paths": {
    "/v1/transactions": {
      "post": {
        "operationId": "transactions",
        "summary": "카드 이용내역 조회",
        "description": "조회 기간의 카드 이용내역(승인내역)을 거래 목록으로 돌려준다. source 로 승인/매입을 고른다. 지원 카드사: NONGHYUP, WOORI, KOOKMIN. 문서: https://cardapi.co.kr/docs/transactions",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "cardCode": {
                    "type": "string",
                    "description": "카드사 코드",
                    "enum": [
                      "NONGHYUP",
                      "WOORI",
                      "KOOKMIN"
                    ],
                    "examples": [
                      "WOORI"
                    ]
                  },
                  "userId": {
                    "type": "string",
                    "description": "카드사 홈페이지 아이디",
                    "examples": [
                      "hong123"
                    ]
                  },
                  "password": {
                    "type": "string",
                    "description": "카드사 홈페이지 비밀번호(입력하는 그대로)",
                    "examples": [
                      "********"
                    ]
                  },
                  "from": {
                    "type": "string",
                    "description": "조회 시작일 YYYY-MM-DD. from·to 를 주면 days 는 무시한다 (to 와 함께)",
                    "examples": [
                      "2026-11-01"
                    ]
                  },
                  "to": {
                    "type": "string",
                    "description": "조회 종료일 YYYY-MM-DD (from 과 함께)",
                    "examples": [
                      "2026-11-30"
                    ]
                  },
                  "days": {
                    "type": "integer",
                    "description": "최근 N일(오늘 포함). from·to 가 없을 때 쓴다. 기본 30",
                    "examples": [
                      30
                    ]
                  },
                  "source": {
                    "type": "string",
                    "description": "approval(기본) = 승인내역 전체, billing = 매입(이용) 거래만. 카드사마다 동작이 다르다",
                    "enum": [
                      "approval",
                      "billing"
                    ],
                    "examples": [
                      "approval"
                    ]
                  }
                },
                "required": [
                  "cardCode",
                  "userId",
                  "password"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "성공. 카드사 거절(로그인 실패 등)도 HTTP 200 + success:false(Failure)로 온다",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "required": [
                        "success",
                        "transactions"
                      ],
                      "properties": {
                        "success": {
                          "const": true
                        },
                        "transactions": {
                          "type": "array",
                          "items": {
                            "$ref": "#/components/schemas/CardTransaction"
                          }
                        }
                      }
                    },
                    {
                      "$ref": "#/components/schemas/Failure"
                    }
                  ]
                }
              }
            }
          },
          "400": {
            "description": "MISSING_FIELDS: cardCode 가 없다 / INVALID_CARD_CODE: 지원하지 않는 카드사 코드 / INVALID_INPUT: 아이디·비밀번호 누락, 기간 형식·범위 오류, source 값 오류 / UNSUPPORTED_OP: 그 카드사가 지원하지 않는 엔드포인트(예: 농협카드 /v1/cards)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Failure"
                }
              }
            }
          },
          "401": {
            "description": "UNAUTHORIZED: Authorization 헤더가 없거나 형식이 틀렸거나, 키가 틀렸거나 비활성",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Failure"
                }
              }
            }
          },
          "403": {
            "description": "SERVICE_NOT_ALLOWED: 카드 조회에 쓸 수 없게 설정된 키 / (본문 없음): 한국 밖 IP 에서 호출(Cloudflare 가 막는다 — 본문이 JSON 이 아니다)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Failure"
                }
              }
            }
          },
          "404": {
            "description": "(error: Not Found): 없는 경로",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Failure"
                }
              }
            }
          },
          "429": {
            "description": "TOO_MANY_REQUESTS: API 키마다 30분에 60회를 넘었다(성공·실패 합산) / TOO_FREQUENT: 같은 조회(같은 API 키·카드사·아이디·엔드포인트·source)를 30초 안에 다시 했다. 조회 기간이나 거래가 달라도 같은 조회로 본다",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Failure"
                }
              }
            }
          },
          "500": {
            "description": "INTERNAL_ERROR: 키 확인 중 일시 오류 / CONFIG_ERROR: 서비스 설정 오류 / CRAWLER_ERROR: 조회 서버 처리 중 오류",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Failure"
                }
              }
            }
          },
          "502": {
            "description": "CRAWLER_ERROR: 조회 서버 처리 중 오류",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Failure"
                }
              }
            }
          },
          "503": {
            "description": "CRAWLER_UNAVAILABLE: 조회 서버가 응답하지 않는다",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Failure"
                }
              }
            }
          }
        }
      }
    },
    "/v1/statements": {
      "post": {
        "operationId": "statements",
        "summary": "결제·이용 요약",
        "description": "조회 기간에 받은 거래를 합산한 요약(국내·해외 이용, 취소, 순이용, 건수)을 돌려준다. 지원 카드사: NONGHYUP, WOORI, KOOKMIN. 문서: https://cardapi.co.kr/docs/statements",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "cardCode": {
                    "type": "string",
                    "description": "카드사 코드",
                    "enum": [
                      "NONGHYUP",
                      "WOORI",
                      "KOOKMIN"
                    ],
                    "examples": [
                      "WOORI"
                    ]
                  },
                  "userId": {
                    "type": "string",
                    "description": "카드사 홈페이지 아이디",
                    "examples": [
                      "hong123"
                    ]
                  },
                  "password": {
                    "type": "string",
                    "description": "카드사 홈페이지 비밀번호(입력하는 그대로)",
                    "examples": [
                      "********"
                    ]
                  },
                  "from": {
                    "type": "string",
                    "description": "조회 시작일 YYYY-MM-DD. from·to 를 주면 days 는 무시한다 (to 와 함께)",
                    "examples": [
                      "2026-11-01"
                    ]
                  },
                  "to": {
                    "type": "string",
                    "description": "조회 종료일 YYYY-MM-DD (from 과 함께)",
                    "examples": [
                      "2026-11-30"
                    ]
                  },
                  "days": {
                    "type": "integer",
                    "description": "최근 N일(오늘 포함). from·to 가 없을 때 쓴다. 기본 30",
                    "examples": [
                      30
                    ]
                  }
                },
                "required": [
                  "cardCode",
                  "userId",
                  "password"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "성공. 카드사 거절(로그인 실패 등)도 HTTP 200 + success:false(Failure)로 온다",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "required": [
                        "success",
                        "statement"
                      ],
                      "properties": {
                        "success": {
                          "const": true
                        },
                        "statement": {
                          "$ref": "#/components/schemas/Statement"
                        }
                      }
                    },
                    {
                      "$ref": "#/components/schemas/Failure"
                    }
                  ]
                }
              }
            }
          },
          "400": {
            "description": "MISSING_FIELDS: cardCode 가 없다 / INVALID_CARD_CODE: 지원하지 않는 카드사 코드 / INVALID_INPUT: 아이디·비밀번호 누락, 기간 형식·범위 오류, source 값 오류 / UNSUPPORTED_OP: 그 카드사가 지원하지 않는 엔드포인트(예: 농협카드 /v1/cards)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Failure"
                }
              }
            }
          },
          "401": {
            "description": "UNAUTHORIZED: Authorization 헤더가 없거나 형식이 틀렸거나, 키가 틀렸거나 비활성",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Failure"
                }
              }
            }
          },
          "403": {
            "description": "SERVICE_NOT_ALLOWED: 카드 조회에 쓸 수 없게 설정된 키 / (본문 없음): 한국 밖 IP 에서 호출(Cloudflare 가 막는다 — 본문이 JSON 이 아니다)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Failure"
                }
              }
            }
          },
          "404": {
            "description": "(error: Not Found): 없는 경로",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Failure"
                }
              }
            }
          },
          "429": {
            "description": "TOO_MANY_REQUESTS: API 키마다 30분에 60회를 넘었다(성공·실패 합산) / TOO_FREQUENT: 같은 조회(같은 API 키·카드사·아이디·엔드포인트·source)를 30초 안에 다시 했다. 조회 기간이나 거래가 달라도 같은 조회로 본다",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Failure"
                }
              }
            }
          },
          "500": {
            "description": "INTERNAL_ERROR: 키 확인 중 일시 오류 / CONFIG_ERROR: 서비스 설정 오류 / CRAWLER_ERROR: 조회 서버 처리 중 오류",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Failure"
                }
              }
            }
          },
          "502": {
            "description": "CRAWLER_ERROR: 조회 서버 처리 중 오류",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Failure"
                }
              }
            }
          },
          "503": {
            "description": "CRAWLER_UNAVAILABLE: 조회 서버가 응답하지 않는다",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Failure"
                }
              }
            }
          }
        }
      }
    },
    "/v1/cards": {
      "post": {
        "operationId": "cards",
        "summary": "보유카드 목록",
        "description": "카드사 계정에 연결된 카드 목록(카드 이름·마스킹 번호 등)을 돌려준다. 지원 카드사: NONGHYUP, WOORI, KOOKMIN. 문서: https://cardapi.co.kr/docs/cards",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "cardCode": {
                    "type": "string",
                    "description": "카드사 코드",
                    "enum": [
                      "NONGHYUP",
                      "WOORI",
                      "KOOKMIN"
                    ],
                    "examples": [
                      "WOORI"
                    ]
                  },
                  "userId": {
                    "type": "string",
                    "description": "카드사 홈페이지 아이디",
                    "examples": [
                      "hong123"
                    ]
                  },
                  "password": {
                    "type": "string",
                    "description": "카드사 홈페이지 비밀번호(입력하는 그대로)",
                    "examples": [
                      "********"
                    ]
                  }
                },
                "required": [
                  "cardCode",
                  "userId",
                  "password"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "성공. 카드사 거절(로그인 실패 등)도 HTTP 200 + success:false(Failure)로 온다",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "required": [
                        "success",
                        "cards"
                      ],
                      "properties": {
                        "success": {
                          "const": true
                        },
                        "cards": {
                          "type": "array",
                          "items": {
                            "$ref": "#/components/schemas/CardInfo"
                          }
                        }
                      }
                    },
                    {
                      "$ref": "#/components/schemas/Failure"
                    }
                  ]
                }
              }
            }
          },
          "400": {
            "description": "MISSING_FIELDS: cardCode 가 없다 / INVALID_CARD_CODE: 지원하지 않는 카드사 코드 / INVALID_INPUT: 아이디·비밀번호 누락, 기간 형식·범위 오류, source 값 오류 / UNSUPPORTED_OP: 그 카드사가 지원하지 않는 엔드포인트(예: 농협카드 /v1/cards)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Failure"
                }
              }
            }
          },
          "401": {
            "description": "UNAUTHORIZED: Authorization 헤더가 없거나 형식이 틀렸거나, 키가 틀렸거나 비활성",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Failure"
                }
              }
            }
          },
          "403": {
            "description": "SERVICE_NOT_ALLOWED: 카드 조회에 쓸 수 없게 설정된 키 / (본문 없음): 한국 밖 IP 에서 호출(Cloudflare 가 막는다 — 본문이 JSON 이 아니다)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Failure"
                }
              }
            }
          },
          "404": {
            "description": "(error: Not Found): 없는 경로",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Failure"
                }
              }
            }
          },
          "429": {
            "description": "TOO_MANY_REQUESTS: API 키마다 30분에 60회를 넘었다(성공·실패 합산) / TOO_FREQUENT: 같은 조회(같은 API 키·카드사·아이디·엔드포인트·source)를 30초 안에 다시 했다. 조회 기간이나 거래가 달라도 같은 조회로 본다",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Failure"
                }
              }
            }
          },
          "500": {
            "description": "INTERNAL_ERROR: 키 확인 중 일시 오류 / CONFIG_ERROR: 서비스 설정 오류 / CRAWLER_ERROR: 조회 서버 처리 중 오류",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Failure"
                }
              }
            }
          },
          "502": {
            "description": "CRAWLER_ERROR: 조회 서버 처리 중 오류",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Failure"
                }
              }
            }
          },
          "503": {
            "description": "CRAWLER_UNAVAILABLE: 조회 서버가 응답하지 않는다",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Failure"
                }
              }
            }
          }
        }
      }
    },
    "/v1/transactions/detail": {
      "post": {
        "operationId": "detail",
        "summary": "거래 상세 조회",
        "description": "이용내역 한 건을 매출전표 정보(가맹점 주소·전화 등)로 보강해 돌려준다. 지원 카드사: WOORI, KOOKMIN. 문서: https://cardapi.co.kr/docs/transaction-detail",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "cardCode": {
                    "type": "string",
                    "description": "카드사 코드",
                    "enum": [
                      "NONGHYUP",
                      "WOORI",
                      "KOOKMIN"
                    ],
                    "examples": [
                      "WOORI"
                    ]
                  },
                  "userId": {
                    "type": "string",
                    "description": "카드사 홈페이지 아이디",
                    "examples": [
                      "hong123"
                    ]
                  },
                  "password": {
                    "type": "string",
                    "description": "카드사 홈페이지 비밀번호(입력하는 그대로)",
                    "examples": [
                      "********"
                    ]
                  },
                  "apvNo": {
                    "type": "string",
                    "description": "우리카드: 승인번호(ref.apvNo) (우리카드)",
                    "examples": [
                      "30012345"
                    ]
                  },
                  "mchNo": {
                    "type": "string",
                    "description": "우리카드: 가맹점 번호(ref.mchNo). 있으면 같이 보낸다 (우리카드)",
                    "examples": [
                      "123456789"
                    ]
                  },
                  "date": {
                    "type": "string",
                    "description": "거래일 YYYYMMDD 또는 YYYY-MM-DD(ref.date) — 우리카드·국민카드 공통",
                    "examples": [
                      "20261128"
                    ]
                  },
                  "cardSeq": {
                    "type": "string",
                    "description": "국민카드: 카드 구분값(ref.cardSeq) (국민카드)",
                    "examples": [
                      "1"
                    ]
                  },
                  "from": {
                    "type": "string",
                    "description": "거래를 찾을 기간 시작일 YYYY-MM-DD(없으면 거래일 하루)"
                  },
                  "to": {
                    "type": "string",
                    "description": "거래를 찾을 기간 종료일 YYYY-MM-DD"
                  }
                },
                "required": [
                  "cardCode",
                  "userId",
                  "password",
                  "date"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "성공. 카드사 거절(로그인 실패 등)도 HTTP 200 + success:false(Failure)로 온다",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "required": [
                        "success",
                        "detail"
                      ],
                      "properties": {
                        "success": {
                          "const": true
                        },
                        "detail": {
                          "$ref": "#/components/schemas/TransactionDetail"
                        }
                      }
                    },
                    {
                      "$ref": "#/components/schemas/Failure"
                    }
                  ]
                }
              }
            }
          },
          "400": {
            "description": "MISSING_FIELDS: cardCode 가 없다 / INVALID_CARD_CODE: 지원하지 않는 카드사 코드 / INVALID_INPUT: 아이디·비밀번호 누락, 기간 형식·범위 오류, source 값 오류 / UNSUPPORTED_OP: 그 카드사가 지원하지 않는 엔드포인트(예: 농협카드 /v1/cards)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Failure"
                }
              }
            }
          },
          "401": {
            "description": "UNAUTHORIZED: Authorization 헤더가 없거나 형식이 틀렸거나, 키가 틀렸거나 비활성",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Failure"
                }
              }
            }
          },
          "403": {
            "description": "SERVICE_NOT_ALLOWED: 카드 조회에 쓸 수 없게 설정된 키 / (본문 없음): 한국 밖 IP 에서 호출(Cloudflare 가 막는다 — 본문이 JSON 이 아니다)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Failure"
                }
              }
            }
          },
          "404": {
            "description": "(error: Not Found): 없는 경로",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Failure"
                }
              }
            }
          },
          "429": {
            "description": "TOO_MANY_REQUESTS: API 키마다 30분에 60회를 넘었다(성공·실패 합산) / TOO_FREQUENT: 같은 조회(같은 API 키·카드사·아이디·엔드포인트·source)를 30초 안에 다시 했다. 조회 기간이나 거래가 달라도 같은 조회로 본다",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Failure"
                }
              }
            }
          },
          "500": {
            "description": "INTERNAL_ERROR: 키 확인 중 일시 오류 / CONFIG_ERROR: 서비스 설정 오류 / CRAWLER_ERROR: 조회 서버 처리 중 오류",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Failure"
                }
              }
            }
          },
          "502": {
            "description": "CRAWLER_ERROR: 조회 서버 처리 중 오류",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Failure"
                }
              }
            }
          },
          "503": {
            "description": "CRAWLER_UNAVAILABLE: 조회 서버가 응답하지 않는다",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Failure"
                }
              }
            }
          }
        }
      }
    },
    "/v1/health": {
      "get": {
        "operationId": "health",
        "summary": "서버 상태",
        "responses": {
          "200": {
            "description": "정상",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "const": true
                    },
                    "service": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "securitySchemes": {
      "bearerAuth": {
        "type": "http",
        "scheme": "bearer",
        "description": "`{apiKey}:{secretKey}` 를 Bearer 토큰으로 보낸다"
      }
    },
    "schemas": {
      "CardTransaction": {
        "type": "object",
        "properties": {
          "approvedAt": {
            "type": "string",
            "description": "이용(승인) 일시 YYYY-MM-DD HH:mm, 한국 시간 — 제공: NONGHYUP, WOORI, KOOKMIN"
          },
          "merchantName": {
            "type": "string",
            "description": "가맹점 이름 — 제공: NONGHYUP, WOORI, KOOKMIN"
          },
          "amount": {
            "type": "number",
            "description": "이용 금액(원). 항상 양수 — 취소는 canceled 로 구분한다 — 제공: NONGHYUP, WOORI, KOOKMIN"
          },
          "currency": {
            "type": "string",
            "description": "통화 코드(대부분 KRW) — 제공: NONGHYUP, WOORI, KOOKMIN"
          },
          "domestic": {
            "type": "boolean",
            "description": "true = 국내, false = 해외 — 제공: NONGHYUP, WOORI, KOOKMIN"
          },
          "canceled": {
            "type": "boolean",
            "description": "취소된 거래인지 — 제공: NONGHYUP, WOORI, KOOKMIN"
          },
          "approvalNo": {
            "type": "string",
            "description": "승인번호 — 제공: NONGHYUP, WOORI, KOOKMIN"
          },
          "installmentMonths": {
            "type": "number",
            "description": "할부 개월 수. 2개월 이상일 때만 온다(없으면 일시불) — 제공: NONGHYUP, WOORI, KOOKMIN"
          },
          "paymentType": {
            "type": "string",
            "description": "결제 방식 — 카드사 원문(예: 일시불, 할부, 체크계좌, 예금인출) — 제공: NONGHYUP, WOORI, KOOKMIN"
          },
          "billingDate": {
            "type": "string",
            "description": "결제(예정)일 YYYY-MM-DD — 제공: NONGHYUP, WOORI"
          },
          "cardName": {
            "type": "string",
            "description": "카드 이름(상품명) — 제공: WOORI, KOOKMIN"
          },
          "cardNumberMasked": {
            "type": "string",
            "description": "마스킹된 카드번호 — 제공: NONGHYUP, WOORI, KOOKMIN"
          },
          "vat": {
            "type": "number",
            "description": "부가세(원). 0보다 클 때만 온다 — 제공: NONGHYUP, WOORI, KOOKMIN(상세)"
          },
          "canceledAmount": {
            "type": "number",
            "description": "취소 금액(원) — 제공: WOORI, KOOKMIN"
          },
          "status": {
            "type": "string",
            "description": "거래 상태 — 카드사 원문. 승인/매입 구분에 쓴다 — 제공: NONGHYUP, WOORI, KOOKMIN"
          },
          "discountAmount": {
            "type": "number",
            "description": "할인 금액(원) — 제공: KOOKMIN"
          },
          "pointsEarned": {
            "type": "number",
            "description": "적립(예정) 포인트 — 제공: KOOKMIN"
          },
          "merchant": {
            "type": "object",
            "description": "가맹점 정보(제공하는 칸만 들어 있다) — 제공: WOORI, KOOKMIN",
            "properties": {
              "businessNo": {
                "type": "string",
                "description": "가맹점 사업자등록번호(숫자만) — 제공: WOORI, KOOKMIN"
              },
              "category": {
                "type": "string",
                "description": "업종 — 카드사 원문(코드로 올 수 있다) — 제공: WOORI, KOOKMIN"
              },
              "address": {
                "type": "string",
                "description": "가맹점 주소 — 제공: WOORI(상세), KOOKMIN(상세)"
              },
              "tel": {
                "type": "string",
                "description": "가맹점 전화번호 — 제공: WOORI(상세), KOOKMIN(상세)"
              }
            }
          },
          "ref": {
            "type": "object",
            "additionalProperties": {
              "type": "string"
            },
            "description": "거래 상세 조회에 그대로 넘기는 참조값. 키는 카드사마다 다르다 — 제공: NONGHYUP, WOORI, KOOKMIN"
          }
        },
        "required": [
          "approvedAt",
          "merchantName",
          "amount",
          "currency",
          "domestic",
          "canceled"
        ]
      },
      "TransactionDetail": {
        "allOf": [
          {
            "$ref": "#/components/schemas/CardTransaction"
          },
          {
            "type": "object",
            "properties": {
              "extra": {
                "type": "object",
                "additionalProperties": {
                  "type": "string"
                },
                "description": "정규화하지 않은 보조 상세(카드사 원문 값, 예: 가맹점 번호) — 제공: WOORI(상세), KOOKMIN(상세)"
              }
            }
          }
        ]
      },
      "CardInfo": {
        "type": "object",
        "properties": {
          "cardName": {
            "type": "string",
            "description": "카드 이름(상품명) — 제공: NONGHYUP, WOORI, KOOKMIN"
          },
          "cardNumberMasked": {
            "type": "string",
            "description": "마스킹된 카드번호 — 제공: NONGHYUP, WOORI, KOOKMIN"
          },
          "brand": {
            "type": "string",
            "description": "브랜드(예: VISA, MASTER) — 제공: KOOKMIN"
          },
          "owner": {
            "type": "string",
            "description": "소유자 이름 — 제공: KOOKMIN"
          },
          "cardType": {
            "type": "string",
            "description": "신용·체크 등 구분 — 카드사 원문(코드로 올 수 있다. 농협카드는 카드 이름에서 판단) — 제공: NONGHYUP, WOORI, KOOKMIN"
          },
          "main": {
            "type": "boolean",
            "description": "대표 카드면 true — 제공: WOORI, KOOKMIN"
          },
          "expireDate": {
            "type": "string",
            "description": "유효기간 — 카드사 원문 — 제공: WOORI, KOOKMIN"
          }
        },
        "required": [
          "cardName",
          "cardNumberMasked"
        ]
      },
      "StatementSummary": {
        "type": "object",
        "properties": {
          "domesticAmount": {
            "type": "number",
            "description": "국내 이용 금액 합(원) — 제공: NONGHYUP, WOORI, KOOKMIN"
          },
          "overseaAmount": {
            "type": "number",
            "description": "해외 이용 금액 합(원) — 제공: NONGHYUP, WOORI, KOOKMIN"
          },
          "totalAmount": {
            "type": "number",
            "description": "이용 금액 합계(국내 + 해외) — 제공: NONGHYUP, WOORI, KOOKMIN"
          },
          "domesticCancelAmount": {
            "type": "number",
            "description": "국내 취소 금액 합(원) — 제공: NONGHYUP, WOORI, KOOKMIN"
          },
          "overseaCancelAmount": {
            "type": "number",
            "description": "해외 취소 금액 합(원) — 제공: NONGHYUP, WOORI, KOOKMIN"
          },
          "totalCancelAmount": {
            "type": "number",
            "description": "취소 금액 합계 — 제공: NONGHYUP, WOORI, KOOKMIN"
          },
          "netAmount": {
            "type": "number",
            "description": "순이용 금액(이용 합계 − 취소 합계) — 제공: NONGHYUP, WOORI, KOOKMIN"
          },
          "count": {
            "type": "number",
            "description": "거래 건수(취소 포함) — 제공: NONGHYUP, WOORI, KOOKMIN"
          },
          "cancelCount": {
            "type": "number",
            "description": "취소 건수 — 제공: NONGHYUP, WOORI, KOOKMIN"
          }
        },
        "required": [
          "domesticAmount",
          "overseaAmount",
          "totalAmount",
          "domesticCancelAmount",
          "overseaCancelAmount",
          "totalCancelAmount",
          "netAmount",
          "count",
          "cancelCount"
        ]
      },
      "Statement": {
        "type": "object",
        "required": [
          "period",
          "summary"
        ],
        "properties": {
          "period": {
            "type": "object",
            "properties": {
              "from": {
                "type": "string"
              },
              "to": {
                "type": "string"
              }
            },
            "description": "조회한 기간 YYYY-MM-DD"
          },
          "summary": {
            "$ref": "#/components/schemas/StatementSummary"
          },
          "upcoming": {
            "type": "array",
            "description": "월별 결제예정(아직 어느 카드사도 채우지 않는다)",
            "items": {
              "type": "object"
            }
          }
        }
      },
      "Failure": {
        "type": "object",
        "required": [
          "success",
          "error",
          "code",
          "message"
        ],
        "properties": {
          "success": {
            "const": false
          },
          "error": {
            "type": "string",
            "description": "코드 또는 카드사 쪽 세부 코드"
          },
          "code": {
            "type": "string",
            "description": "분기할 종류",
            "enum": [
              "MISSING_FIELDS",
              "INVALID_CARD_CODE",
              "INVALID_INPUT",
              "UNSUPPORTED_OP",
              "UNAUTHORIZED",
              "SERVICE_NOT_ALLOWED",
              "TOO_MANY_REQUESTS",
              "TOO_FREQUENT",
              "INTERNAL_ERROR",
              "CONFIG_ERROR",
              "CRAWLER_ERROR",
              "CRAWLER_UNAVAILABLE"
            ]
          },
          "message": {
            "type": "string",
            "description": "사람이 읽는 안내"
          }
        }
      }
    }
  }
}