{
  "openapi": "3.1.0",
  "info": {
    "title": "Solarize PKI API",
    "version": "0.1.0",
    "description": "업체가 기기를 등록하고 인증서를 발급·갱신·폐기하는 API입니다. 모든 호출에 API 키(`Authorization: Bearer slzp_…`)와 그 키에 묶인 클라이언트 인증서(mTLS)가 함께 필요합니다. 키마다 분당 600회까지 부를 수 있습니다."
  },
  "servers": [
    {
      "url": "https://api.pki.solar-on.org",
      "description": "운영"
    },
    {
      "url": "https://api.pki-dev.solar-on.org",
      "description": "테스트 환경"
    }
  ],
  "tags": [
    {
      "name": "계정"
    },
    {
      "name": "기기"
    },
    {
      "name": "인증서"
    },
    {
      "name": "발급 요청"
    }
  ],
  "security": [
    {
      "apiKey": [],
      "clientCert": []
    }
  ],
  "paths": {
    "/v1/me": {
      "get": {
        "operationId": "getMe",
        "tags": [
          "계정"
        ],
        "summary": "API 키와 업체 확인",
        "description": "호출한 API 키의 이름, 권한, 만료일과 업체 상태, 연결된 클라이언트 인증서를 조회합니다. 연동 설정을 확인할 때 사용합니다.",
        "x-scope": null,
        "x-blocked-when-suspended": false,
        "parameters": [],
        "responses": {
          "200": {
            "description": "성공",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Me"
                }
              }
            }
          },
          "401": {
            "description": "`CLIENT_CERT_REQUIRED` 클라이언트 인증서(mTLS)가 필요합니다.\n\n`API_KEY_REQUIRED` Authorization: Bearer 헤더에 API 키를 넣어 주세요.\n\n`INVALID_API_KEY` API 키가 올바르지 않습니다.\n\n`API_KEY_REVOKED` 폐기된 API 키입니다.\n\n`API_KEY_EXPIRED` 만료된 API 키입니다.\n\n`CLIENT_CERT_MISMATCH` 이 API 키에 연결된 클라이언트 인증서가 아닙니다.\n\n`CLIENT_CERT_REVOKED` 폐기되었거나 만료된 클라이언트 인증서입니다.",
            "x-error-codes": [
              "CLIENT_CERT_REQUIRED",
              "API_KEY_REQUIRED",
              "INVALID_API_KEY",
              "API_KEY_REVOKED",
              "API_KEY_EXPIRED",
              "CLIENT_CERT_MISMATCH",
              "CLIENT_CERT_REVOKED"
            ],
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "`VENDOR_INACTIVE` 승인된 업체가 아닙니다.",
            "x-error-codes": [
              "VENDOR_INACTIVE"
            ],
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "`RATE_LIMITED` 호출 한도를 초과했습니다. Retry-After 시간이 지난 뒤 다시 요청하세요.",
            "x-error-codes": [
              "RATE_LIMITED"
            ],
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "integer"
                },
                "description": "다시 보낼 때까지 초"
              }
            }
          }
        }
      }
    },
    "/v1/profiles": {
      "get": {
        "operationId": "listProfiles",
        "tags": [
          "계정"
        ],
        "summary": "인증서 프로필 목록",
        "description": "발급에 사용할 수 있는 프로필을 조회합니다. 업체가 승인받은 기기 종류의 프로필만 표시됩니다.",
        "x-scope": "vendor.read",
        "x-blocked-when-suspended": false,
        "parameters": [],
        "responses": {
          "200": {
            "description": "성공",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProfileList"
                }
              }
            }
          },
          "401": {
            "description": "`CLIENT_CERT_REQUIRED` 클라이언트 인증서(mTLS)가 필요합니다.\n\n`API_KEY_REQUIRED` Authorization: Bearer 헤더에 API 키를 넣어 주세요.\n\n`INVALID_API_KEY` API 키가 올바르지 않습니다.\n\n`API_KEY_REVOKED` 폐기된 API 키입니다.\n\n`API_KEY_EXPIRED` 만료된 API 키입니다.\n\n`CLIENT_CERT_MISMATCH` 이 API 키에 연결된 클라이언트 인증서가 아닙니다.\n\n`CLIENT_CERT_REVOKED` 폐기되었거나 만료된 클라이언트 인증서입니다.",
            "x-error-codes": [
              "CLIENT_CERT_REQUIRED",
              "API_KEY_REQUIRED",
              "INVALID_API_KEY",
              "API_KEY_REVOKED",
              "API_KEY_EXPIRED",
              "CLIENT_CERT_MISMATCH",
              "CLIENT_CERT_REVOKED"
            ],
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "`VENDOR_INACTIVE` 승인된 업체가 아닙니다.\n\n`INSUFFICIENT_SCOPE` API 키에 이 작업을 할 권한이 없습니다.",
            "x-error-codes": [
              "VENDOR_INACTIVE",
              "INSUFFICIENT_SCOPE"
            ],
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "`RATE_LIMITED` 호출 한도를 초과했습니다. Retry-After 시간이 지난 뒤 다시 요청하세요.",
            "x-error-codes": [
              "RATE_LIMITED"
            ],
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "integer"
                },
                "description": "다시 보낼 때까지 초"
              }
            }
          }
        }
      }
    },
    "/v1/devices": {
      "post": {
        "operationId": "registerDevices",
        "tags": [
          "기기"
        ],
        "summary": "기기 등록",
        "description": "출하할 기기를 등록합니다. 한 번에 최대 1000대까지 등록할 수 있습니다. 한 건이라도 잘못되면 전체가 저장되지 않으며, 오류 메시지에 잘못된 위치가 표시됩니다. 같은 값으로 다시 요청해도 오류가 나지 않습니다.",
        "x-scope": "devices.write",
        "x-blocked-when-suspended": true,
        "parameters": [
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": false,
            "schema": {
              "type": "string",
              "maxLength": 255
            },
            "description": "같은 키로 다시 보내면 처음 응답을 그대로 돌려줍니다(24시간). 재시도에 쓰세요."
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/RegisterDevicesRequest"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "성공",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RegisterDevicesResult"
                }
              }
            }
          },
          "400": {
            "description": "`VALIDATION` 입력값이 올바르지 않습니다.",
            "x-error-codes": [
              "VALIDATION"
            ],
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "`CLIENT_CERT_REQUIRED` 클라이언트 인증서(mTLS)가 필요합니다.\n\n`API_KEY_REQUIRED` Authorization: Bearer 헤더에 API 키를 넣어 주세요.\n\n`INVALID_API_KEY` API 키가 올바르지 않습니다.\n\n`API_KEY_REVOKED` 폐기된 API 키입니다.\n\n`API_KEY_EXPIRED` 만료된 API 키입니다.\n\n`CLIENT_CERT_MISMATCH` 이 API 키에 연결된 클라이언트 인증서가 아닙니다.\n\n`CLIENT_CERT_REVOKED` 폐기되었거나 만료된 클라이언트 인증서입니다.",
            "x-error-codes": [
              "CLIENT_CERT_REQUIRED",
              "API_KEY_REQUIRED",
              "INVALID_API_KEY",
              "API_KEY_REVOKED",
              "API_KEY_EXPIRED",
              "CLIENT_CERT_MISMATCH",
              "CLIENT_CERT_REVOKED"
            ],
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "`DEVICE_TYPE_NOT_APPROVED` 승인받지 않은 기기 종류입니다.\n\n`VENDOR_SUSPENDED` 정지된 업체입니다. 조회와 폐기만 가능합니다.\n\n`VENDOR_INACTIVE` 승인된 업체가 아닙니다.\n\n`INSUFFICIENT_SCOPE` API 키에 이 작업을 할 권한이 없습니다.",
            "x-error-codes": [
              "DEVICE_TYPE_NOT_APPROVED",
              "VENDOR_SUSPENDED",
              "VENDOR_INACTIVE",
              "INSUFFICIENT_SCOPE"
            ],
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "`DEVICE_EXISTS` 같은 일련번호로 다른 정보의 기기가 이미 등록되어 있습니다.\n\n`DUPLICATE_CHIP` 다른 기기나 유효한 인증서에서 이미 사용 중인 칩 ID입니다.\n\n`RTU_ID_IN_USE` 다른 기기나 유효한 인증서에서 이미 사용 중인 RTU ID입니다.",
            "x-error-codes": [
              "DEVICE_EXISTS",
              "DUPLICATE_CHIP",
              "RTU_ID_IN_USE"
            ],
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "`RATE_LIMITED` 호출 한도를 초과했습니다. Retry-After 시간이 지난 뒤 다시 요청하세요.",
            "x-error-codes": [
              "RATE_LIMITED"
            ],
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "integer"
                },
                "description": "다시 보낼 때까지 초"
              }
            }
          }
        }
      },
      "get": {
        "operationId": "listDevices",
        "tags": [
          "기기"
        ],
        "summary": "기기 목록",
        "description": "등록된 기기 목록을 일련번호 순으로 조회합니다.",
        "x-scope": "devices.read",
        "x-blocked-when-suspended": false,
        "parameters": [
          {
            "name": "status",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "registered",
                "shipped",
                "active",
                "returned",
                "retired"
              ]
            }
          },
          {
            "name": "deviceType",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "rtu",
                "ppc",
                "module"
              ]
            }
          },
          {
            "name": "q",
            "in": "query",
            "required": false,
            "description": "일련번호 앞부분, 칩 ID 또는 RTU ID로 검색.",
            "schema": {
              "type": "string",
              "maxLength": 64
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "description": "페이지당 항목 수.",
            "schema": {
              "default": 100,
              "type": "integer",
              "minimum": 1,
              "maximum": 1000
            }
          },
          {
            "name": "cursor",
            "in": "query",
            "required": false,
            "description": "이전 페이지 응답의 nextCursor 값.",
            "schema": {
              "type": "string",
              "maxLength": 200
            }
          }
        ],
        "responses": {
          "200": {
            "description": "성공",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DeviceList"
                }
              }
            }
          },
          "400": {
            "description": "`VALIDATION` 입력값이 올바르지 않습니다.",
            "x-error-codes": [
              "VALIDATION"
            ],
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "`CLIENT_CERT_REQUIRED` 클라이언트 인증서(mTLS)가 필요합니다.\n\n`API_KEY_REQUIRED` Authorization: Bearer 헤더에 API 키를 넣어 주세요.\n\n`INVALID_API_KEY` API 키가 올바르지 않습니다.\n\n`API_KEY_REVOKED` 폐기된 API 키입니다.\n\n`API_KEY_EXPIRED` 만료된 API 키입니다.\n\n`CLIENT_CERT_MISMATCH` 이 API 키에 연결된 클라이언트 인증서가 아닙니다.\n\n`CLIENT_CERT_REVOKED` 폐기되었거나 만료된 클라이언트 인증서입니다.",
            "x-error-codes": [
              "CLIENT_CERT_REQUIRED",
              "API_KEY_REQUIRED",
              "INVALID_API_KEY",
              "API_KEY_REVOKED",
              "API_KEY_EXPIRED",
              "CLIENT_CERT_MISMATCH",
              "CLIENT_CERT_REVOKED"
            ],
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "`VENDOR_INACTIVE` 승인된 업체가 아닙니다.\n\n`INSUFFICIENT_SCOPE` API 키에 이 작업을 할 권한이 없습니다.",
            "x-error-codes": [
              "VENDOR_INACTIVE",
              "INSUFFICIENT_SCOPE"
            ],
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "`RATE_LIMITED` 호출 한도를 초과했습니다. Retry-After 시간이 지난 뒤 다시 요청하세요.",
            "x-error-codes": [
              "RATE_LIMITED"
            ],
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "integer"
                },
                "description": "다시 보낼 때까지 초"
              }
            }
          }
        }
      }
    },
    "/v1/devices/{serial}": {
      "get": {
        "operationId": "getDevice",
        "tags": [
          "기기"
        ],
        "summary": "기기 조회",
        "description": "기기 정보와 최근 발급된 인증서를 조회합니다.",
        "x-scope": "devices.read",
        "x-blocked-when-suspended": false,
        "parameters": [
          {
            "name": "serial",
            "in": "path",
            "required": true,
            "description": "일련번호.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "성공",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Device"
                }
              }
            }
          },
          "401": {
            "description": "`CLIENT_CERT_REQUIRED` 클라이언트 인증서(mTLS)가 필요합니다.\n\n`API_KEY_REQUIRED` Authorization: Bearer 헤더에 API 키를 넣어 주세요.\n\n`INVALID_API_KEY` API 키가 올바르지 않습니다.\n\n`API_KEY_REVOKED` 폐기된 API 키입니다.\n\n`API_KEY_EXPIRED` 만료된 API 키입니다.\n\n`CLIENT_CERT_MISMATCH` 이 API 키에 연결된 클라이언트 인증서가 아닙니다.\n\n`CLIENT_CERT_REVOKED` 폐기되었거나 만료된 클라이언트 인증서입니다.",
            "x-error-codes": [
              "CLIENT_CERT_REQUIRED",
              "API_KEY_REQUIRED",
              "INVALID_API_KEY",
              "API_KEY_REVOKED",
              "API_KEY_EXPIRED",
              "CLIENT_CERT_MISMATCH",
              "CLIENT_CERT_REVOKED"
            ],
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "`VENDOR_INACTIVE` 승인된 업체가 아닙니다.\n\n`INSUFFICIENT_SCOPE` API 키에 이 작업을 할 권한이 없습니다.",
            "x-error-codes": [
              "VENDOR_INACTIVE",
              "INSUFFICIENT_SCOPE"
            ],
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "`DEVICE_NOT_FOUND` 등록되지 않은 기기입니다.",
            "x-error-codes": [
              "DEVICE_NOT_FOUND"
            ],
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "`RATE_LIMITED` 호출 한도를 초과했습니다. Retry-After 시간이 지난 뒤 다시 요청하세요.",
            "x-error-codes": [
              "RATE_LIMITED"
            ],
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "integer"
                },
                "description": "다시 보낼 때까지 초"
              }
            }
          }
        }
      },
      "patch": {
        "operationId": "updateDevice",
        "tags": [
          "기기"
        ],
        "summary": "기기 정보 변경",
        "description": "기기 상태(registered → shipped → active, returned, retired), 모델명, 메모를 변경합니다. retired로 바꾸면 되돌릴 수 없으며, 유효한 인증서는 운영 종료(cessationOfOperation) 사유로 폐기됩니다. 칩 ID와 RTU ID는 유효한 인증서가 없을 때만 변경할 수 있습니다.",
        "x-scope": "devices.write",
        "x-blocked-when-suspended": true,
        "parameters": [
          {
            "name": "serial",
            "in": "path",
            "required": true,
            "description": "일련번호.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/DeviceUpdate"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "성공",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Device"
                }
              }
            }
          },
          "400": {
            "description": "`VALIDATION` 입력값이 올바르지 않습니다.",
            "x-error-codes": [
              "VALIDATION"
            ],
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "`CLIENT_CERT_REQUIRED` 클라이언트 인증서(mTLS)가 필요합니다.\n\n`API_KEY_REQUIRED` Authorization: Bearer 헤더에 API 키를 넣어 주세요.\n\n`INVALID_API_KEY` API 키가 올바르지 않습니다.\n\n`API_KEY_REVOKED` 폐기된 API 키입니다.\n\n`API_KEY_EXPIRED` 만료된 API 키입니다.\n\n`CLIENT_CERT_MISMATCH` 이 API 키에 연결된 클라이언트 인증서가 아닙니다.\n\n`CLIENT_CERT_REVOKED` 폐기되었거나 만료된 클라이언트 인증서입니다.",
            "x-error-codes": [
              "CLIENT_CERT_REQUIRED",
              "API_KEY_REQUIRED",
              "INVALID_API_KEY",
              "API_KEY_REVOKED",
              "API_KEY_EXPIRED",
              "CLIENT_CERT_MISMATCH",
              "CLIENT_CERT_REVOKED"
            ],
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "`VENDOR_SUSPENDED` 정지된 업체입니다. 조회와 폐기만 가능합니다.\n\n`VENDOR_INACTIVE` 승인된 업체가 아닙니다.\n\n`INSUFFICIENT_SCOPE` API 키에 이 작업을 할 권한이 없습니다.",
            "x-error-codes": [
              "VENDOR_SUSPENDED",
              "VENDOR_INACTIVE",
              "INSUFFICIENT_SCOPE"
            ],
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "`DEVICE_NOT_FOUND` 등록되지 않은 기기입니다.",
            "x-error-codes": [
              "DEVICE_NOT_FOUND"
            ],
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "`DEVICE_INACTIVE` 반품되었거나 폐기된 기기입니다.\n\n`DEVICE_LOCKED` 유효한 인증서가 있는 기기는 칩 ID와 RTU ID를 변경할 수 없습니다.\n\n`DUPLICATE_CHIP` 다른 기기나 유효한 인증서에서 이미 사용 중인 칩 ID입니다.\n\n`RTU_ID_IN_USE` 다른 기기나 유효한 인증서에서 이미 사용 중인 RTU ID입니다.",
            "x-error-codes": [
              "DEVICE_INACTIVE",
              "DEVICE_LOCKED",
              "DUPLICATE_CHIP",
              "RTU_ID_IN_USE"
            ],
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "`RATE_LIMITED` 호출 한도를 초과했습니다. Retry-After 시간이 지난 뒤 다시 요청하세요.",
            "x-error-codes": [
              "RATE_LIMITED"
            ],
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "integer"
                },
                "description": "다시 보낼 때까지 초"
              }
            }
          }
        }
      }
    },
    "/v1/certificates": {
      "post": {
        "operationId": "issueCertificate",
        "tags": [
          "인증서"
        ],
        "summary": "인증서 발급",
        "description": "등록된 기기의 CSR로 인증서를 발급합니다. 자동 발급 업체는 201과 함께 인증서와 체인을 받습니다. 수동 발급 업체는 202와 승인 대기 중인 요청을 받으며, GET /v1/requests/{id}로 결과를 확인합니다. 기기당 유효한 인증서는 하나이므로, 교체할 때는 갱신 API를 사용하세요.",
        "x-scope": "certs.issue",
        "x-blocked-when-suspended": true,
        "parameters": [
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": false,
            "schema": {
              "type": "string",
              "maxLength": 255
            },
            "description": "같은 키로 다시 보내면 처음 응답을 그대로 돌려줍니다(24시간). 재시도에 쓰세요."
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/IssueRequest"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "성공",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/IssueResult"
                }
              }
            }
          },
          "202": {
            "description": "성공",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/IssueResult"
                }
              }
            }
          },
          "400": {
            "description": "`VALIDATION` 입력값이 올바르지 않습니다.\n\n`INVALID_CSR` CSR을 읽을 수 없거나 프로필 조건(P-256 키, 유효한 서명)을 만족하지 않습니다.\n\n`PROFILE_NOT_ALLOWED` 이 기기에는 사용할 수 없는 프로필입니다.\n\n`RTU_ID_REQUIRED` RTU 프로필로 발급하려면 기기에 rtuId를 등록해야 합니다(CN: rtu-{RTU ID}).",
            "x-error-codes": [
              "VALIDATION",
              "INVALID_CSR",
              "PROFILE_NOT_ALLOWED",
              "RTU_ID_REQUIRED"
            ],
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "`CLIENT_CERT_REQUIRED` 클라이언트 인증서(mTLS)가 필요합니다.\n\n`API_KEY_REQUIRED` Authorization: Bearer 헤더에 API 키를 넣어 주세요.\n\n`INVALID_API_KEY` API 키가 올바르지 않습니다.\n\n`API_KEY_REVOKED` 폐기된 API 키입니다.\n\n`API_KEY_EXPIRED` 만료된 API 키입니다.\n\n`CLIENT_CERT_MISMATCH` 이 API 키에 연결된 클라이언트 인증서가 아닙니다.\n\n`CLIENT_CERT_REVOKED` 폐기되었거나 만료된 클라이언트 인증서입니다.",
            "x-error-codes": [
              "CLIENT_CERT_REQUIRED",
              "API_KEY_REQUIRED",
              "INVALID_API_KEY",
              "API_KEY_REVOKED",
              "API_KEY_EXPIRED",
              "CLIENT_CERT_MISMATCH",
              "CLIENT_CERT_REVOKED"
            ],
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "`DEVICE_TYPE_NOT_APPROVED` 승인받지 않은 기기 종류입니다.\n\n`VENDOR_SUSPENDED` 정지된 업체입니다. 조회와 폐기만 가능합니다.\n\n`VENDOR_INACTIVE` 승인된 업체가 아닙니다.\n\n`INSUFFICIENT_SCOPE` API 키에 이 작업을 할 권한이 없습니다.",
            "x-error-codes": [
              "DEVICE_TYPE_NOT_APPROVED",
              "VENDOR_SUSPENDED",
              "VENDOR_INACTIVE",
              "INSUFFICIENT_SCOPE"
            ],
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "`DEVICE_NOT_FOUND` 등록되지 않은 기기입니다.",
            "x-error-codes": [
              "DEVICE_NOT_FOUND"
            ],
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "`DEVICE_INACTIVE` 반품되었거나 폐기된 기기입니다.\n\n`CERTIFICATE_EXISTS` 이미 유효한 인증서가 있는 기기입니다. 인증서를 바꾸려면 갱신 API를 사용하세요.\n\n`REQUEST_PENDING` 승인 대기 중인 요청이 이미 있는 기기입니다.\n\n`DUPLICATE_CHIP` 다른 기기나 유효한 인증서에서 이미 사용 중인 칩 ID입니다.\n\n`RTU_ID_IN_USE` 다른 기기나 유효한 인증서에서 이미 사용 중인 RTU ID입니다.",
            "x-error-codes": [
              "DEVICE_INACTIVE",
              "CERTIFICATE_EXISTS",
              "REQUEST_PENDING",
              "DUPLICATE_CHIP",
              "RTU_ID_IN_USE"
            ],
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "`RATE_LIMITED` 호출 한도를 초과했습니다. Retry-After 시간이 지난 뒤 다시 요청하세요.",
            "x-error-codes": [
              "RATE_LIMITED"
            ],
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "integer"
                },
                "description": "다시 보낼 때까지 초"
              }
            }
          },
          "503": {
            "description": "`NOT_CONFIGURED` 현재 이 환경에서는 인증서를 발급할 수 없습니다.",
            "x-error-codes": [
              "NOT_CONFIGURED"
            ],
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      },
      "get": {
        "operationId": "listCertificates",
        "tags": [
          "인증서"
        ],
        "summary": "인증서 목록",
        "description": "업체 기기에 발급된 인증서를 최신순으로 조회합니다.",
        "x-scope": "certs.read",
        "x-blocked-when-suspended": false,
        "parameters": [
          {
            "name": "status",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "valid",
                "revoked"
              ]
            }
          },
          {
            "name": "deviceSerial",
            "in": "query",
            "required": false,
            "description": "기기 일련번호. 영문, 숫자, . - _로 64자 이내. 프로필의 CN 규칙이 rtuId가 아니면 인증서 CN으로 사용됩니다.",
            "schema": {
              "type": "string",
              "pattern": "^[A-Za-z0-9._-]{1,64}$"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "description": "페이지당 항목 수.",
            "schema": {
              "default": 100,
              "type": "integer",
              "minimum": 1,
              "maximum": 1000
            }
          },
          {
            "name": "cursor",
            "in": "query",
            "required": false,
            "description": "이전 페이지 응답의 nextCursor 값.",
            "schema": {
              "type": "string",
              "maxLength": 200
            }
          }
        ],
        "responses": {
          "200": {
            "description": "성공",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CertificateList"
                }
              }
            }
          },
          "400": {
            "description": "`VALIDATION` 입력값이 올바르지 않습니다.",
            "x-error-codes": [
              "VALIDATION"
            ],
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "`CLIENT_CERT_REQUIRED` 클라이언트 인증서(mTLS)가 필요합니다.\n\n`API_KEY_REQUIRED` Authorization: Bearer 헤더에 API 키를 넣어 주세요.\n\n`INVALID_API_KEY` API 키가 올바르지 않습니다.\n\n`API_KEY_REVOKED` 폐기된 API 키입니다.\n\n`API_KEY_EXPIRED` 만료된 API 키입니다.\n\n`CLIENT_CERT_MISMATCH` 이 API 키에 연결된 클라이언트 인증서가 아닙니다.\n\n`CLIENT_CERT_REVOKED` 폐기되었거나 만료된 클라이언트 인증서입니다.",
            "x-error-codes": [
              "CLIENT_CERT_REQUIRED",
              "API_KEY_REQUIRED",
              "INVALID_API_KEY",
              "API_KEY_REVOKED",
              "API_KEY_EXPIRED",
              "CLIENT_CERT_MISMATCH",
              "CLIENT_CERT_REVOKED"
            ],
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "`VENDOR_INACTIVE` 승인된 업체가 아닙니다.\n\n`INSUFFICIENT_SCOPE` API 키에 이 작업을 할 권한이 없습니다.",
            "x-error-codes": [
              "VENDOR_INACTIVE",
              "INSUFFICIENT_SCOPE"
            ],
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "`RATE_LIMITED` 호출 한도를 초과했습니다. Retry-After 시간이 지난 뒤 다시 요청하세요.",
            "x-error-codes": [
              "RATE_LIMITED"
            ],
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "integer"
                },
                "description": "다시 보낼 때까지 초"
              }
            }
          }
        }
      }
    },
    "/v1/certificates/batch": {
      "post": {
        "operationId": "issueBatch",
        "tags": [
          "인증서"
        ],
        "summary": "일괄 발급",
        "description": "최대 1000건의 발급 요청을 한 번에 접수합니다. 즉시 202와 배치 ID를 응답하고 비동기로 처리합니다. 항목마다 단건 발급과 같은 검증을 거치며, 일부가 실패해도 나머지는 계속 처리합니다. 진행 상태는 GET /v1/batches/{id}로, 인증서 체인은 GET /v1/certificates/{serial}/chain으로 조회합니다.",
        "x-scope": "certs.issue",
        "x-blocked-when-suspended": true,
        "parameters": [
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": false,
            "schema": {
              "type": "string",
              "maxLength": 255
            },
            "description": "같은 키로 다시 보내면 처음 응답을 그대로 돌려줍니다(24시간). 재시도에 쓰세요."
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/BatchRequest"
              }
            }
          }
        },
        "responses": {
          "202": {
            "description": "성공",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Batch"
                }
              }
            }
          },
          "400": {
            "description": "`VALIDATION` 입력값이 올바르지 않습니다.",
            "x-error-codes": [
              "VALIDATION"
            ],
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "`CLIENT_CERT_REQUIRED` 클라이언트 인증서(mTLS)가 필요합니다.\n\n`API_KEY_REQUIRED` Authorization: Bearer 헤더에 API 키를 넣어 주세요.\n\n`INVALID_API_KEY` API 키가 올바르지 않습니다.\n\n`API_KEY_REVOKED` 폐기된 API 키입니다.\n\n`API_KEY_EXPIRED` 만료된 API 키입니다.\n\n`CLIENT_CERT_MISMATCH` 이 API 키에 연결된 클라이언트 인증서가 아닙니다.\n\n`CLIENT_CERT_REVOKED` 폐기되었거나 만료된 클라이언트 인증서입니다.",
            "x-error-codes": [
              "CLIENT_CERT_REQUIRED",
              "API_KEY_REQUIRED",
              "INVALID_API_KEY",
              "API_KEY_REVOKED",
              "API_KEY_EXPIRED",
              "CLIENT_CERT_MISMATCH",
              "CLIENT_CERT_REVOKED"
            ],
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "`VENDOR_SUSPENDED` 정지된 업체입니다. 조회와 폐기만 가능합니다.\n\n`VENDOR_INACTIVE` 승인된 업체가 아닙니다.\n\n`INSUFFICIENT_SCOPE` API 키에 이 작업을 할 권한이 없습니다.",
            "x-error-codes": [
              "VENDOR_SUSPENDED",
              "VENDOR_INACTIVE",
              "INSUFFICIENT_SCOPE"
            ],
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "`RATE_LIMITED` 호출 한도를 초과했습니다. Retry-After 시간이 지난 뒤 다시 요청하세요.",
            "x-error-codes": [
              "RATE_LIMITED"
            ],
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "integer"
                },
                "description": "다시 보낼 때까지 초"
              }
            }
          }
        }
      }
    },
    "/v1/batches/{id}": {
      "get": {
        "operationId": "getBatch",
        "tags": [
          "인증서"
        ],
        "summary": "일괄 발급 조회",
        "description": "일괄 발급의 진행 상태와 항목별 결과를 조회합니다.",
        "x-scope": "certs.read",
        "x-blocked-when-suspended": false,
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid",
              "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "성공",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Batch"
                }
              }
            }
          },
          "401": {
            "description": "`CLIENT_CERT_REQUIRED` 클라이언트 인증서(mTLS)가 필요합니다.\n\n`API_KEY_REQUIRED` Authorization: Bearer 헤더에 API 키를 넣어 주세요.\n\n`INVALID_API_KEY` API 키가 올바르지 않습니다.\n\n`API_KEY_REVOKED` 폐기된 API 키입니다.\n\n`API_KEY_EXPIRED` 만료된 API 키입니다.\n\n`CLIENT_CERT_MISMATCH` 이 API 키에 연결된 클라이언트 인증서가 아닙니다.\n\n`CLIENT_CERT_REVOKED` 폐기되었거나 만료된 클라이언트 인증서입니다.",
            "x-error-codes": [
              "CLIENT_CERT_REQUIRED",
              "API_KEY_REQUIRED",
              "INVALID_API_KEY",
              "API_KEY_REVOKED",
              "API_KEY_EXPIRED",
              "CLIENT_CERT_MISMATCH",
              "CLIENT_CERT_REVOKED"
            ],
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "`VENDOR_INACTIVE` 승인된 업체가 아닙니다.\n\n`INSUFFICIENT_SCOPE` API 키에 이 작업을 할 권한이 없습니다.",
            "x-error-codes": [
              "VENDOR_INACTIVE",
              "INSUFFICIENT_SCOPE"
            ],
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "`BATCH_NOT_FOUND` 일괄 발급 요청을 찾을 수 없습니다.",
            "x-error-codes": [
              "BATCH_NOT_FOUND"
            ],
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "`RATE_LIMITED` 호출 한도를 초과했습니다. Retry-After 시간이 지난 뒤 다시 요청하세요.",
            "x-error-codes": [
              "RATE_LIMITED"
            ],
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "integer"
                },
                "description": "다시 보낼 때까지 초"
              }
            }
          }
        }
      }
    },
    "/v1/certificates/{serial}": {
      "get": {
        "operationId": "getCertificate",
        "tags": [
          "인증서"
        ],
        "summary": "인증서 조회",
        "description": "인증서 정보와 PEM을 조회합니다.",
        "x-scope": "certs.read",
        "x-blocked-when-suspended": false,
        "parameters": [
          {
            "name": "serial",
            "in": "path",
            "required": true,
            "description": "일련번호.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "성공",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Certificate"
                }
              }
            }
          },
          "401": {
            "description": "`CLIENT_CERT_REQUIRED` 클라이언트 인증서(mTLS)가 필요합니다.\n\n`API_KEY_REQUIRED` Authorization: Bearer 헤더에 API 키를 넣어 주세요.\n\n`INVALID_API_KEY` API 키가 올바르지 않습니다.\n\n`API_KEY_REVOKED` 폐기된 API 키입니다.\n\n`API_KEY_EXPIRED` 만료된 API 키입니다.\n\n`CLIENT_CERT_MISMATCH` 이 API 키에 연결된 클라이언트 인증서가 아닙니다.\n\n`CLIENT_CERT_REVOKED` 폐기되었거나 만료된 클라이언트 인증서입니다.",
            "x-error-codes": [
              "CLIENT_CERT_REQUIRED",
              "API_KEY_REQUIRED",
              "INVALID_API_KEY",
              "API_KEY_REVOKED",
              "API_KEY_EXPIRED",
              "CLIENT_CERT_MISMATCH",
              "CLIENT_CERT_REVOKED"
            ],
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "`VENDOR_INACTIVE` 승인된 업체가 아닙니다.\n\n`INSUFFICIENT_SCOPE` API 키에 이 작업을 할 권한이 없습니다.",
            "x-error-codes": [
              "VENDOR_INACTIVE",
              "INSUFFICIENT_SCOPE"
            ],
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "`CERTIFICATE_NOT_FOUND` 해당 일련번호의 인증서를 찾을 수 없습니다.",
            "x-error-codes": [
              "CERTIFICATE_NOT_FOUND"
            ],
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "`RATE_LIMITED` 호출 한도를 초과했습니다. Retry-After 시간이 지난 뒤 다시 요청하세요.",
            "x-error-codes": [
              "RATE_LIMITED"
            ],
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "integer"
                },
                "description": "다시 보낼 때까지 초"
              }
            }
          }
        }
      }
    },
    "/v1/certificates/{serial}/chain": {
      "get": {
        "operationId": "getChain",
        "tags": [
          "인증서"
        ],
        "summary": "인증서 체인 내려받기",
        "description": "기기 인증서와 발급 CA 인증서를 순서대로 이어 붙인 PEM을 내려받습니다(application/pem-certificate-chain, RFC 8555). 루트 인증서는 기기가 이미 신뢰 앵커로 갖고 있으므로 포함하지 않습니다.",
        "x-scope": "certs.read",
        "x-blocked-when-suspended": false,
        "parameters": [
          {
            "name": "serial",
            "in": "path",
            "required": true,
            "description": "일련번호.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "성공",
            "content": {
              "application/pem-certificate-chain": {
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "description": "`CLIENT_CERT_REQUIRED` 클라이언트 인증서(mTLS)가 필요합니다.\n\n`API_KEY_REQUIRED` Authorization: Bearer 헤더에 API 키를 넣어 주세요.\n\n`INVALID_API_KEY` API 키가 올바르지 않습니다.\n\n`API_KEY_REVOKED` 폐기된 API 키입니다.\n\n`API_KEY_EXPIRED` 만료된 API 키입니다.\n\n`CLIENT_CERT_MISMATCH` 이 API 키에 연결된 클라이언트 인증서가 아닙니다.\n\n`CLIENT_CERT_REVOKED` 폐기되었거나 만료된 클라이언트 인증서입니다.",
            "x-error-codes": [
              "CLIENT_CERT_REQUIRED",
              "API_KEY_REQUIRED",
              "INVALID_API_KEY",
              "API_KEY_REVOKED",
              "API_KEY_EXPIRED",
              "CLIENT_CERT_MISMATCH",
              "CLIENT_CERT_REVOKED"
            ],
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "`VENDOR_INACTIVE` 승인된 업체가 아닙니다.\n\n`INSUFFICIENT_SCOPE` API 키에 이 작업을 할 권한이 없습니다.",
            "x-error-codes": [
              "VENDOR_INACTIVE",
              "INSUFFICIENT_SCOPE"
            ],
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "`CERTIFICATE_NOT_FOUND` 해당 일련번호의 인증서를 찾을 수 없습니다.",
            "x-error-codes": [
              "CERTIFICATE_NOT_FOUND"
            ],
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "`RATE_LIMITED` 호출 한도를 초과했습니다. Retry-After 시간이 지난 뒤 다시 요청하세요.",
            "x-error-codes": [
              "RATE_LIMITED"
            ],
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "integer"
                },
                "description": "다시 보낼 때까지 초"
              }
            }
          }
        }
      }
    },
    "/v1/certificates/{serial}/renew": {
      "post": {
        "operationId": "renewCertificate",
        "tags": [
          "인증서"
        ],
        "summary": "인증서 갱신",
        "description": "같은 기기에 새 CSR로 인증서를 다시 발급합니다. 새 인증서가 발급되면(수동 발급은 승인 후) 기존 인증서는 superseded 사유로 폐기됩니다.",
        "x-scope": "certs.issue",
        "x-blocked-when-suspended": true,
        "parameters": [
          {
            "name": "serial",
            "in": "path",
            "required": true,
            "description": "일련번호.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": false,
            "schema": {
              "type": "string",
              "maxLength": 255
            },
            "description": "같은 키로 다시 보내면 처음 응답을 그대로 돌려줍니다(24시간). 재시도에 쓰세요."
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/RenewRequest"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "성공",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/IssueResult"
                }
              }
            }
          },
          "202": {
            "description": "성공",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/IssueResult"
                }
              }
            }
          },
          "400": {
            "description": "`VALIDATION` 입력값이 올바르지 않습니다.\n\n`INVALID_CSR` CSR을 읽을 수 없거나 프로필 조건(P-256 키, 유효한 서명)을 만족하지 않습니다.",
            "x-error-codes": [
              "VALIDATION",
              "INVALID_CSR"
            ],
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "`CLIENT_CERT_REQUIRED` 클라이언트 인증서(mTLS)가 필요합니다.\n\n`API_KEY_REQUIRED` Authorization: Bearer 헤더에 API 키를 넣어 주세요.\n\n`INVALID_API_KEY` API 키가 올바르지 않습니다.\n\n`API_KEY_REVOKED` 폐기된 API 키입니다.\n\n`API_KEY_EXPIRED` 만료된 API 키입니다.\n\n`CLIENT_CERT_MISMATCH` 이 API 키에 연결된 클라이언트 인증서가 아닙니다.\n\n`CLIENT_CERT_REVOKED` 폐기되었거나 만료된 클라이언트 인증서입니다.",
            "x-error-codes": [
              "CLIENT_CERT_REQUIRED",
              "API_KEY_REQUIRED",
              "INVALID_API_KEY",
              "API_KEY_REVOKED",
              "API_KEY_EXPIRED",
              "CLIENT_CERT_MISMATCH",
              "CLIENT_CERT_REVOKED"
            ],
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "`VENDOR_SUSPENDED` 정지된 업체입니다. 조회와 폐기만 가능합니다.\n\n`VENDOR_INACTIVE` 승인된 업체가 아닙니다.\n\n`INSUFFICIENT_SCOPE` API 키에 이 작업을 할 권한이 없습니다.",
            "x-error-codes": [
              "VENDOR_SUSPENDED",
              "VENDOR_INACTIVE",
              "INSUFFICIENT_SCOPE"
            ],
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "`CERTIFICATE_NOT_FOUND` 해당 일련번호의 인증서를 찾을 수 없습니다.",
            "x-error-codes": [
              "CERTIFICATE_NOT_FOUND"
            ],
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "`CERTIFICATE_REVOKED` 이미 폐기된 인증서입니다.\n\n`DEVICE_INACTIVE` 반품되었거나 폐기된 기기입니다.\n\n`REQUEST_PENDING` 승인 대기 중인 요청이 이미 있는 기기입니다.",
            "x-error-codes": [
              "CERTIFICATE_REVOKED",
              "DEVICE_INACTIVE",
              "REQUEST_PENDING"
            ],
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "`RATE_LIMITED` 호출 한도를 초과했습니다. Retry-After 시간이 지난 뒤 다시 요청하세요.",
            "x-error-codes": [
              "RATE_LIMITED"
            ],
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "integer"
                },
                "description": "다시 보낼 때까지 초"
              }
            }
          }
        }
      }
    },
    "/v1/certificates/{serial}/revoke": {
      "post": {
        "operationId": "revokeCertificate",
        "tags": [
          "인증서"
        ],
        "summary": "인증서 폐기",
        "description": "인증서를 즉시 폐기하고 새 CRL과 신뢰 번들을 게시합니다. 수신 서버에는 1분 안에 반영됩니다. 업체가 정지된 상태에서도 호출할 수 있습니다.",
        "x-scope": "certs.revoke",
        "x-blocked-when-suspended": false,
        "parameters": [
          {
            "name": "serial",
            "in": "path",
            "required": true,
            "description": "일련번호.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": false,
            "schema": {
              "type": "string",
              "maxLength": 255
            },
            "description": "같은 키로 다시 보내면 처음 응답을 그대로 돌려줍니다(24시간). 재시도에 쓰세요."
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/RevokeRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "성공",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Certificate"
                }
              }
            }
          },
          "400": {
            "description": "`VALIDATION` 입력값이 올바르지 않습니다.",
            "x-error-codes": [
              "VALIDATION"
            ],
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "`CLIENT_CERT_REQUIRED` 클라이언트 인증서(mTLS)가 필요합니다.\n\n`API_KEY_REQUIRED` Authorization: Bearer 헤더에 API 키를 넣어 주세요.\n\n`INVALID_API_KEY` API 키가 올바르지 않습니다.\n\n`API_KEY_REVOKED` 폐기된 API 키입니다.\n\n`API_KEY_EXPIRED` 만료된 API 키입니다.\n\n`CLIENT_CERT_MISMATCH` 이 API 키에 연결된 클라이언트 인증서가 아닙니다.\n\n`CLIENT_CERT_REVOKED` 폐기되었거나 만료된 클라이언트 인증서입니다.",
            "x-error-codes": [
              "CLIENT_CERT_REQUIRED",
              "API_KEY_REQUIRED",
              "INVALID_API_KEY",
              "API_KEY_REVOKED",
              "API_KEY_EXPIRED",
              "CLIENT_CERT_MISMATCH",
              "CLIENT_CERT_REVOKED"
            ],
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "`VENDOR_INACTIVE` 승인된 업체가 아닙니다.\n\n`INSUFFICIENT_SCOPE` API 키에 이 작업을 할 권한이 없습니다.",
            "x-error-codes": [
              "VENDOR_INACTIVE",
              "INSUFFICIENT_SCOPE"
            ],
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "`CERTIFICATE_NOT_FOUND` 해당 일련번호의 인증서를 찾을 수 없습니다.",
            "x-error-codes": [
              "CERTIFICATE_NOT_FOUND"
            ],
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "`CERTIFICATE_REVOKED` 이미 폐기된 인증서입니다.",
            "x-error-codes": [
              "CERTIFICATE_REVOKED"
            ],
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "`RATE_LIMITED` 호출 한도를 초과했습니다. Retry-After 시간이 지난 뒤 다시 요청하세요.",
            "x-error-codes": [
              "RATE_LIMITED"
            ],
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "integer"
                },
                "description": "다시 보낼 때까지 초"
              }
            }
          }
        }
      }
    },
    "/v1/requests": {
      "get": {
        "operationId": "listRequests",
        "tags": [
          "발급 요청"
        ],
        "summary": "발급 요청 목록",
        "description": "발급·갱신 요청을 최신순으로 조회합니다.",
        "x-scope": "certs.read",
        "x-blocked-when-suspended": false,
        "parameters": [
          {
            "name": "status",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "pending",
                "approved",
                "rejected"
              ]
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "description": "페이지당 항목 수.",
            "schema": {
              "default": 100,
              "type": "integer",
              "minimum": 1,
              "maximum": 1000
            }
          },
          {
            "name": "cursor",
            "in": "query",
            "required": false,
            "description": "이전 페이지 응답의 nextCursor 값.",
            "schema": {
              "type": "string",
              "maxLength": 200
            }
          }
        ],
        "responses": {
          "200": {
            "description": "성공",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/IssuanceRequestList"
                }
              }
            }
          },
          "400": {
            "description": "`VALIDATION` 입력값이 올바르지 않습니다.",
            "x-error-codes": [
              "VALIDATION"
            ],
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "`CLIENT_CERT_REQUIRED` 클라이언트 인증서(mTLS)가 필요합니다.\n\n`API_KEY_REQUIRED` Authorization: Bearer 헤더에 API 키를 넣어 주세요.\n\n`INVALID_API_KEY` API 키가 올바르지 않습니다.\n\n`API_KEY_REVOKED` 폐기된 API 키입니다.\n\n`API_KEY_EXPIRED` 만료된 API 키입니다.\n\n`CLIENT_CERT_MISMATCH` 이 API 키에 연결된 클라이언트 인증서가 아닙니다.\n\n`CLIENT_CERT_REVOKED` 폐기되었거나 만료된 클라이언트 인증서입니다.",
            "x-error-codes": [
              "CLIENT_CERT_REQUIRED",
              "API_KEY_REQUIRED",
              "INVALID_API_KEY",
              "API_KEY_REVOKED",
              "API_KEY_EXPIRED",
              "CLIENT_CERT_MISMATCH",
              "CLIENT_CERT_REVOKED"
            ],
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "`VENDOR_INACTIVE` 승인된 업체가 아닙니다.\n\n`INSUFFICIENT_SCOPE` API 키에 이 작업을 할 권한이 없습니다.",
            "x-error-codes": [
              "VENDOR_INACTIVE",
              "INSUFFICIENT_SCOPE"
            ],
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "`RATE_LIMITED` 호출 한도를 초과했습니다. Retry-After 시간이 지난 뒤 다시 요청하세요.",
            "x-error-codes": [
              "RATE_LIMITED"
            ],
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "integer"
                },
                "description": "다시 보낼 때까지 초"
              }
            }
          }
        }
      }
    },
    "/v1/requests/{id}": {
      "get": {
        "operationId": "getRequest",
        "tags": [
          "발급 요청"
        ],
        "summary": "발급 요청 조회",
        "description": "발급 요청의 상태를 조회합니다. 승인되면 certificateSerial로 인증서를 조회할 수 있습니다.",
        "x-scope": "certs.read",
        "x-blocked-when-suspended": false,
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid",
              "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "성공",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/IssuanceRequest"
                }
              }
            }
          },
          "401": {
            "description": "`CLIENT_CERT_REQUIRED` 클라이언트 인증서(mTLS)가 필요합니다.\n\n`API_KEY_REQUIRED` Authorization: Bearer 헤더에 API 키를 넣어 주세요.\n\n`INVALID_API_KEY` API 키가 올바르지 않습니다.\n\n`API_KEY_REVOKED` 폐기된 API 키입니다.\n\n`API_KEY_EXPIRED` 만료된 API 키입니다.\n\n`CLIENT_CERT_MISMATCH` 이 API 키에 연결된 클라이언트 인증서가 아닙니다.\n\n`CLIENT_CERT_REVOKED` 폐기되었거나 만료된 클라이언트 인증서입니다.",
            "x-error-codes": [
              "CLIENT_CERT_REQUIRED",
              "API_KEY_REQUIRED",
              "INVALID_API_KEY",
              "API_KEY_REVOKED",
              "API_KEY_EXPIRED",
              "CLIENT_CERT_MISMATCH",
              "CLIENT_CERT_REVOKED"
            ],
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "`VENDOR_INACTIVE` 승인된 업체가 아닙니다.\n\n`INSUFFICIENT_SCOPE` API 키에 이 작업을 할 권한이 없습니다.",
            "x-error-codes": [
              "VENDOR_INACTIVE",
              "INSUFFICIENT_SCOPE"
            ],
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "`REQUEST_NOT_FOUND` 발급 요청을 찾을 수 없습니다.",
            "x-error-codes": [
              "REQUEST_NOT_FOUND"
            ],
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "`RATE_LIMITED` 호출 한도를 초과했습니다. Retry-After 시간이 지난 뒤 다시 요청하세요.",
            "x-error-codes": [
              "RATE_LIMITED"
            ],
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "integer"
                },
                "description": "다시 보낼 때까지 초"
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "securitySchemes": {
      "apiKey": {
        "type": "http",
        "scheme": "bearer",
        "description": "API 키. 키 권한: vendor.read, devices.read, devices.write, certs.read, certs.issue, certs.revoke"
      },
      "clientCert": {
        "type": "mutualTLS",
        "description": "포털에서 키와 함께 받은 클라이언트 인증서"
      }
    },
    "schemas": {
      "Batch": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid",
            "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
          },
          "status": {
            "type": "string",
            "enum": [
              "queued",
              "running",
              "completed"
            ]
          },
          "total": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          },
          "issued": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          },
          "pending": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          },
          "failed": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          },
          "createdAt": {
            "type": "string",
            "description": "ISO 8601 시각(UTC)."
          },
          "completedAt": {
            "anyOf": [
              {
                "type": "string",
                "description": "ISO 8601 시각(UTC)."
              },
              {
                "type": "null"
              }
            ]
          },
          "items": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "index": {
                  "type": "integer",
                  "minimum": -9007199254740991,
                  "maximum": 9007199254740991
                },
                "deviceSerial": {
                  "type": "string"
                },
                "status": {
                  "type": "string",
                  "enum": [
                    "queued",
                    "issued",
                    "pending",
                    "failed"
                  ]
                },
                "requestId": {
                  "anyOf": [
                    {
                      "type": "string",
                      "format": "uuid",
                      "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "certificateSerial": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "error": {
                  "anyOf": [
                    {
                      "type": "object",
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "code",
                        "message"
                      ]
                    },
                    {
                      "type": "null"
                    }
                  ]
                }
              },
              "required": [
                "index",
                "deviceSerial",
                "status",
                "requestId",
                "certificateSerial",
                "error"
              ]
            }
          }
        },
        "required": [
          "id",
          "status",
          "total",
          "issued",
          "pending",
          "failed",
          "createdAt",
          "completedAt",
          "items"
        ]
      },
      "BatchRequest": {
        "type": "object",
        "properties": {
          "items": {
            "minItems": 1,
            "maxItems": 1000,
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/IssueRequest"
            },
            "description": "발급 요청 목록. 최대 1000건."
          }
        },
        "required": [
          "items"
        ]
      },
      "Certificate": {
        "type": "object",
        "properties": {
          "serial": {
            "type": "string",
            "description": "인증서 일련번호(16진수 소문자)."
          },
          "deviceSerial": {
            "type": [
              "string",
              "null"
            ]
          },
          "deviceType": {
            "type": "string",
            "enum": [
              "rtu",
              "ppc",
              "module"
            ]
          },
          "profileId": {
            "type": "string",
            "format": "uuid",
            "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
          },
          "commonName": {
            "type": "string"
          },
          "chipId": {
            "type": [
              "string",
              "null"
            ]
          },
          "issuer": {
            "type": "object",
            "properties": {
              "caId": {
                "type": "string",
                "format": "uuid",
                "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
              },
              "name": {
                "type": "string"
              }
            },
            "required": [
              "caId",
              "name"
            ]
          },
          "status": {
            "type": "string",
            "enum": [
              "valid",
              "revoked"
            ]
          },
          "revokeReason": {
            "type": [
              "string",
              "null"
            ]
          },
          "revokedAt": {
            "anyOf": [
              {
                "type": "string",
                "description": "ISO 8601 시각(UTC)."
              },
              {
                "type": "null"
              }
            ]
          },
          "notBefore": {
            "type": "string",
            "description": "ISO 8601 시각(UTC)."
          },
          "notAfter": {
            "type": "string",
            "description": "ISO 8601 시각(UTC)."
          },
          "issuedAt": {
            "type": "string",
            "description": "ISO 8601 시각(UTC)."
          },
          "certificatePem": {
            "description": "인증서 단건 조회 응답에만 포함됩니다.",
            "type": "string"
          }
        },
        "required": [
          "serial",
          "deviceSerial",
          "deviceType",
          "profileId",
          "commonName",
          "chipId",
          "issuer",
          "status",
          "revokeReason",
          "revokedAt",
          "notBefore",
          "notAfter",
          "issuedAt"
        ]
      },
      "CertificateList": {
        "type": "object",
        "properties": {
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Certificate"
            }
          },
          "nextCursor": {
            "description": "다음 페이지를 조회할 때 cursor로 보냅니다. 마지막 페이지에서는 null입니다.",
            "type": [
              "string",
              "null"
            ]
          }
        },
        "required": [
          "data",
          "nextCursor"
        ]
      },
      "Device": {
        "type": "object",
        "properties": {
          "serial": {
            "type": "string"
          },
          "deviceType": {
            "type": "string",
            "enum": [
              "rtu",
              "ppc",
              "module"
            ]
          },
          "chipId": {
            "type": [
              "string",
              "null"
            ]
          },
          "rtuId": {
            "type": [
              "string",
              "null"
            ]
          },
          "model": {
            "type": [
              "string",
              "null"
            ]
          },
          "note": {
            "type": [
              "string",
              "null"
            ]
          },
          "status": {
            "type": "string",
            "enum": [
              "registered",
              "shipped",
              "active",
              "returned",
              "retired"
            ]
          },
          "certificate": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "serial": {
                    "type": "string"
                  },
                  "status": {
                    "type": "string",
                    "enum": [
                      "valid",
                      "revoked"
                    ]
                  },
                  "notAfter": {
                    "type": "string",
                    "description": "ISO 8601 시각(UTC)."
                  }
                },
                "required": [
                  "serial",
                  "status",
                  "notAfter"
                ]
              },
              {
                "type": "null"
              }
            ],
            "description": "기기에 최근 발급된 인증서."
          },
          "createdAt": {
            "type": "string",
            "description": "ISO 8601 시각(UTC)."
          },
          "updatedAt": {
            "type": "string",
            "description": "ISO 8601 시각(UTC)."
          }
        },
        "required": [
          "serial",
          "deviceType",
          "chipId",
          "rtuId",
          "model",
          "note",
          "status",
          "certificate",
          "createdAt",
          "updatedAt"
        ]
      },
      "DeviceInput": {
        "type": "object",
        "properties": {
          "serial": {
            "type": "string",
            "pattern": "^[A-Za-z0-9._-]{1,64}$",
            "description": "기기 일련번호. 영문, 숫자, . - _로 64자 이내. 프로필의 CN 규칙이 rtuId가 아니면 인증서 CN으로 사용됩니다."
          },
          "deviceType": {
            "type": "string",
            "enum": [
              "rtu",
              "ppc",
              "module"
            ],
            "description": "기기 종류. 업체가 승인받은 종류만 사용할 수 있습니다."
          },
          "chipId": {
            "type": "string",
            "pattern": "^[0-9A-Fa-f]{2,64}$",
            "description": "보안칩 ID(16진수, 예: ATECC608 일련번호). 인증서 SAN에 urn:solarize:chip:{칩 ID} 형식으로 들어갑니다. 기기 간에 중복될 수 없습니다."
          },
          "rtuId": {
            "type": "string",
            "pattern": "^\\d{1,10}$",
            "description": "RTU ID(숫자). RTU 프로필로 발급할 때 필요하며, 인증서 CN은 rtu-{RTU ID}가 됩니다. 모든 업체를 통틀어 중복될 수 없습니다."
          },
          "model": {
            "description": "제품 모델명.",
            "type": "string",
            "minLength": 1,
            "maxLength": 60
          },
          "note": {
            "description": "메모(로트, 생산 라인 등).",
            "type": "string",
            "maxLength": 200
          }
        },
        "required": [
          "serial",
          "deviceType"
        ],
        "description": "등록할 기기."
      },
      "DeviceList": {
        "type": "object",
        "properties": {
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Device"
            }
          },
          "nextCursor": {
            "description": "다음 페이지를 조회할 때 cursor로 보냅니다. 마지막 페이지에서는 null입니다.",
            "type": [
              "string",
              "null"
            ]
          }
        },
        "required": [
          "data",
          "nextCursor"
        ]
      },
      "DeviceUpdate": {
        "type": "object",
        "properties": {
          "status": {
            "description": "변경할 상태. retired는 되돌릴 수 없으며, 유효한 인증서는 운영 종료 사유로 폐기됩니다.",
            "type": "string",
            "enum": [
              "registered",
              "shipped",
              "active",
              "returned",
              "retired"
            ]
          },
          "chipId": {
            "anyOf": [
              {
                "type": "string",
                "pattern": "^[0-9A-Fa-f]{2,64}$",
                "description": "보안칩 ID(16진수, 예: ATECC608 일련번호). 인증서 SAN에 urn:solarize:chip:{칩 ID} 형식으로 들어갑니다. 기기 간에 중복될 수 없습니다."
              },
              {
                "type": "null"
              }
            ]
          },
          "rtuId": {
            "anyOf": [
              {
                "type": "string",
                "pattern": "^\\d{1,10}$",
                "description": "RTU ID(숫자). RTU 프로필로 발급할 때 필요하며, 인증서 CN은 rtu-{RTU ID}가 됩니다. 모든 업체를 통틀어 중복될 수 없습니다."
              },
              {
                "type": "null"
              }
            ]
          },
          "model": {
            "anyOf": [
              {
                "type": "string",
                "minLength": 1,
                "maxLength": 60
              },
              {
                "type": "null"
              }
            ]
          },
          "note": {
            "anyOf": [
              {
                "type": "string",
                "maxLength": 200
              },
              {
                "type": "null"
              }
            ]
          }
        }
      },
      "Error": {
        "type": "object",
        "properties": {
          "statusCode": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          },
          "code": {
            "type": "string",
            "description": "변하지 않는 오류 코드. 「오류 코드」 페이지 참고."
          },
          "message": {
            "type": "string"
          }
        },
        "required": [
          "statusCode",
          "code",
          "message"
        ]
      },
      "IssuanceRequest": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid",
            "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
          },
          "kind": {
            "type": "string",
            "enum": [
              "issue",
              "renew"
            ]
          },
          "status": {
            "type": "string",
            "enum": [
              "pending",
              "approved",
              "rejected"
            ],
            "description": "pending: 솔라라이즈 승인 대기 중(수동 발급 업체)."
          },
          "deviceSerial": {
            "type": "string"
          },
          "profileId": {
            "type": "string",
            "format": "uuid",
            "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
          },
          "commonName": {
            "type": "string"
          },
          "rejectReason": {
            "type": [
              "string",
              "null"
            ]
          },
          "certificateSerial": {
            "type": [
              "string",
              "null"
            ]
          },
          "replaces": {
            "description": "갱신 요청인 경우, 새 인증서가 발급되면 폐기(superseded)될 기존 인증서.",
            "type": [
              "string",
              "null"
            ]
          },
          "batchId": {
            "anyOf": [
              {
                "type": "string",
                "format": "uuid",
                "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
              },
              {
                "type": "null"
              }
            ]
          },
          "createdAt": {
            "type": "string",
            "description": "ISO 8601 시각(UTC)."
          },
          "decidedAt": {
            "anyOf": [
              {
                "type": "string",
                "description": "ISO 8601 시각(UTC)."
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "id",
          "kind",
          "status",
          "deviceSerial",
          "profileId",
          "commonName",
          "rejectReason",
          "certificateSerial",
          "replaces",
          "batchId",
          "createdAt",
          "decidedAt"
        ]
      },
      "IssuanceRequestList": {
        "type": "object",
        "properties": {
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/IssuanceRequest"
            }
          },
          "nextCursor": {
            "description": "다음 페이지를 조회할 때 cursor로 보냅니다. 마지막 페이지에서는 null입니다.",
            "type": [
              "string",
              "null"
            ]
          }
        },
        "required": [
          "data",
          "nextCursor"
        ]
      },
      "IssueRequest": {
        "type": "object",
        "properties": {
          "deviceSerial": {
            "type": "string",
            "pattern": "^[A-Za-z0-9._-]{1,64}$",
            "description": "등록된 기기의 일련번호."
          },
          "csrPem": {
            "type": "string",
            "minLength": 100,
            "maxLength": 20000,
            "description": "PKCS#10 CSR(PEM, ECDSA P-256). 개인키는 기기 밖으로 나오지 않습니다. CSR의 CN과 SAN은 사용하지 않고 등록된 기기 정보로 정합니다."
          },
          "profileId": {
            "description": "GET /v1/profiles로 조회한 프로필 ID. 생략하면 기기 종류의 기본 프로필을 사용합니다.",
            "type": "string",
            "format": "uuid",
            "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
          }
        },
        "required": [
          "deviceSerial",
          "csrPem"
        ]
      },
      "IssueResult": {
        "type": "object",
        "properties": {
          "request": {
            "$ref": "#/components/schemas/IssuanceRequest"
          },
          "certificate": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/Certificate"
              },
              {
                "type": "null"
              }
            ],
            "description": "발급된 경우(201)에 포함되며, 승인 대기 중(202)이면 null입니다."
          },
          "chainPem": {
            "description": "기기 인증서와 발급 CA 인증서(PEM). 기기에 저장된 루트 인증서와 함께 사용합니다.",
            "type": [
              "string",
              "null"
            ]
          }
        },
        "required": [
          "request",
          "certificate",
          "chainPem"
        ]
      },
      "Me": {
        "type": "object",
        "properties": {
          "keyId": {
            "type": "string",
            "format": "uuid",
            "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
          },
          "keyName": {
            "type": "string"
          },
          "scopes": {
            "type": "array",
            "items": {
              "type": "string",
              "enum": [
                "vendor.read",
                "devices.read",
                "devices.write",
                "certs.read",
                "certs.issue",
                "certs.revoke"
              ]
            }
          },
          "expiresAt": {
            "type": "string",
            "description": "ISO 8601 시각(UTC)."
          },
          "vendor": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string",
                "format": "uuid",
                "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
              },
              "name": {
                "type": "string"
              },
              "status": {
                "type": "string"
              },
              "approvedTypes": {
                "type": "array",
                "items": {
                  "type": "string"
                }
              },
              "issueMode": {
                "type": [
                  "string",
                  "null"
                ]
              }
            },
            "required": [
              "id",
              "name",
              "status",
              "approvedTypes",
              "issueMode"
            ]
          },
          "clientCert": {
            "type": "object",
            "properties": {
              "serial": {
                "type": "string"
              },
              "notAfter": {
                "type": "string",
                "description": "ISO 8601 시각(UTC)."
              }
            },
            "required": [
              "serial",
              "notAfter"
            ]
          }
        },
        "required": [
          "keyId",
          "keyName",
          "scopes",
          "expiresAt",
          "vendor",
          "clientCert"
        ]
      },
      "Profile": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid",
            "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
          },
          "name": {
            "type": "string"
          },
          "deviceType": {
            "type": "string",
            "enum": [
              "rtu",
              "ppc",
              "module"
            ]
          },
          "cnRule": {
            "type": "string",
            "enum": [
              "rtuId",
              "serial"
            ],
            "description": "rtuId: CN을 rtu-{RTU ID}로, serial: CN을 기기 일련번호로 정합니다."
          },
          "validDays": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991,
            "description": "인증서 유효기간(일)."
          },
          "chipCompat": {
            "type": "boolean",
            "description": "보안칩이 검증할 수 있는 형식(P-256, SHA-256, 크기 제한)으로 발급하는지 여부."
          },
          "default": {
            "type": "boolean",
            "description": "profileId를 생략했을 때 사용하는 프로필인지 여부."
          }
        },
        "required": [
          "id",
          "name",
          "deviceType",
          "cnRule",
          "validDays",
          "chipCompat",
          "default"
        ]
      },
      "ProfileList": {
        "type": "object",
        "properties": {
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Profile"
            }
          }
        },
        "required": [
          "data"
        ]
      },
      "RegisterDevicesRequest": {
        "type": "object",
        "properties": {
          "devices": {
            "minItems": 1,
            "maxItems": 1000,
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/DeviceInput"
            },
            "description": "출하 목록. 한 번에 최대 1000대."
          }
        },
        "required": [
          "devices"
        ]
      },
      "RegisterDevicesResult": {
        "type": "object",
        "properties": {
          "created": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991,
            "description": "새로 등록된 기기 수."
          },
          "unchanged": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991,
            "description": "같은 정보로 이미 등록되어 있던 기기 수. 목록을 다시 보내도 안전합니다."
          },
          "devices": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Device"
            }
          }
        },
        "required": [
          "created",
          "unchanged",
          "devices"
        ]
      },
      "RenewRequest": {
        "type": "object",
        "properties": {
          "csrPem": {
            "type": "string",
            "minLength": 100,
            "maxLength": 20000,
            "description": "PKCS#10 CSR(PEM, ECDSA P-256). 개인키는 기기 밖으로 나오지 않습니다. CSR의 CN과 SAN은 사용하지 않고 등록된 기기 정보로 정합니다."
          }
        },
        "required": [
          "csrPem"
        ]
      },
      "RevokeRequest": {
        "type": "object",
        "properties": {
          "reason": {
            "type": "string",
            "enum": [
              "unspecified",
              "keyCompromise",
              "affiliationChanged",
              "superseded",
              "cessationOfOperation"
            ],
            "description": "RFC 5280 폐기 사유. 개인키 유출이 의심되면 keyCompromise를 사용하세요."
          }
        },
        "required": [
          "reason"
        ]
      }
    }
  }
}