{
  "openapi": "3.1.0",
  "info": {
    "title": "Solarize PKI API",
    "version": "0.1.0",
    "description": "Register devices and issue, renew and revoke their certificates. Every call needs an API key (`Authorization: Bearer slzp_…`) and the client certificate bound to that key (mTLS). Each key can make 600 calls per minute."
  },
  "servers": [
    {
      "url": "https://api.pki.solar-on.org",
      "description": "Live"
    },
    {
      "url": "https://api.pki-dev.solar-on.org",
      "description": "Sandbox"
    }
  ],
  "tags": [
    {
      "name": "Account"
    },
    {
      "name": "Devices"
    },
    {
      "name": "Certificates"
    },
    {
      "name": "Requests"
    }
  ],
  "security": [
    {
      "apiKey": [],
      "clientCert": []
    }
  ],
  "paths": {
    "/v1/me": {
      "get": {
        "operationId": "getMe",
        "tags": [
          "Account"
        ],
        "summary": "Get the API key and vendor",
        "description": "Returns the calling key, its scopes and expiry, your vendor status and the bound client certificate. Use it to check your setup.",
        "x-scope": null,
        "x-blocked-when-suspended": false,
        "parameters": [],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Me"
                }
              }
            }
          },
          "401": {
            "description": "`CLIENT_CERT_REQUIRED` A client certificate (mTLS) is required.\n\n`API_KEY_REQUIRED` Send the API key in the Authorization: Bearer header.\n\n`INVALID_API_KEY` The API key is not valid.\n\n`API_KEY_REVOKED` The API key has been revoked.\n\n`API_KEY_EXPIRED` The API key has expired.\n\n`CLIENT_CERT_MISMATCH` The client certificate is not the one bound to this API key.\n\n`CLIENT_CERT_REVOKED` The client certificate is revoked or expired.",
            "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` The vendor is not approved.",
            "x-error-codes": [
              "VENDOR_INACTIVE"
            ],
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "`RATE_LIMITED` Too many requests. Retry after the Retry-After seconds.",
            "x-error-codes": [
              "RATE_LIMITED"
            ],
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "integer"
                },
                "description": "Seconds to wait"
              }
            }
          }
        }
      }
    },
    "/v1/profiles": {
      "get": {
        "operationId": "listProfiles",
        "tags": [
          "Account"
        ],
        "summary": "List certificate profiles",
        "description": "Profiles you can issue with: the device types your vendor is approved for.",
        "x-scope": "vendor.read",
        "x-blocked-when-suspended": false,
        "parameters": [],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProfileList"
                }
              }
            }
          },
          "401": {
            "description": "`CLIENT_CERT_REQUIRED` A client certificate (mTLS) is required.\n\n`API_KEY_REQUIRED` Send the API key in the Authorization: Bearer header.\n\n`INVALID_API_KEY` The API key is not valid.\n\n`API_KEY_REVOKED` The API key has been revoked.\n\n`API_KEY_EXPIRED` The API key has expired.\n\n`CLIENT_CERT_MISMATCH` The client certificate is not the one bound to this API key.\n\n`CLIENT_CERT_REVOKED` The client certificate is revoked or expired.",
            "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` The vendor is not approved.\n\n`INSUFFICIENT_SCOPE` The API key does not have the scope for this call.",
            "x-error-codes": [
              "VENDOR_INACTIVE",
              "INSUFFICIENT_SCOPE"
            ],
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "`RATE_LIMITED` Too many requests. Retry after the Retry-After seconds.",
            "x-error-codes": [
              "RATE_LIMITED"
            ],
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "integer"
                },
                "description": "Seconds to wait"
              }
            }
          }
        }
      }
    },
    "/v1/devices": {
      "post": {
        "operationId": "registerDevices",
        "tags": [
          "Devices"
        ],
        "summary": "Register devices",
        "description": "Adds devices to your registry, up to 1000 at a time (a shipping list). All or nothing: if one item fails, nothing is saved and the error names the item. Resending a device with the same values is not an error.",
        "x-scope": "devices.write",
        "x-blocked-when-suspended": true,
        "parameters": [
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": false,
            "schema": {
              "type": "string",
              "maxLength": 255
            },
            "description": "Resending with the same key returns the first response (24 h). Use it for retries."
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/RegisterDevicesRequest"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RegisterDevicesResult"
                }
              }
            }
          },
          "400": {
            "description": "`VALIDATION` The request is not valid.",
            "x-error-codes": [
              "VALIDATION"
            ],
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "`CLIENT_CERT_REQUIRED` A client certificate (mTLS) is required.\n\n`API_KEY_REQUIRED` Send the API key in the Authorization: Bearer header.\n\n`INVALID_API_KEY` The API key is not valid.\n\n`API_KEY_REVOKED` The API key has been revoked.\n\n`API_KEY_EXPIRED` The API key has expired.\n\n`CLIENT_CERT_MISMATCH` The client certificate is not the one bound to this API key.\n\n`CLIENT_CERT_REVOKED` The client certificate is revoked or expired.",
            "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` The vendor is not approved for this device type.\n\n`VENDOR_SUSPENDED` The vendor is suspended. Reads and revocations still work.\n\n`VENDOR_INACTIVE` The vendor is not approved.\n\n`INSUFFICIENT_SCOPE` The API key does not have the scope for this call.",
            "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` A device with this serial is already registered with different values.\n\n`DUPLICATE_CHIP` This chip ID is already used by another device or a valid certificate.\n\n`RTU_ID_IN_USE` This RTU ID is already used by another device or a valid certificate.",
            "x-error-codes": [
              "DEVICE_EXISTS",
              "DUPLICATE_CHIP",
              "RTU_ID_IN_USE"
            ],
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "`RATE_LIMITED` Too many requests. Retry after the Retry-After seconds.",
            "x-error-codes": [
              "RATE_LIMITED"
            ],
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "integer"
                },
                "description": "Seconds to wait"
              }
            }
          }
        }
      },
      "get": {
        "operationId": "listDevices",
        "tags": [
          "Devices"
        ],
        "summary": "List devices",
        "description": "Your device registry, ordered by serial.",
        "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": "Serial prefix, chip ID or RTU ID.",
            "schema": {
              "type": "string",
              "maxLength": 64
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "description": "Page size.",
            "schema": {
              "default": 100,
              "type": "integer",
              "minimum": 1,
              "maximum": 1000
            }
          },
          {
            "name": "cursor",
            "in": "query",
            "required": false,
            "description": "nextCursor from the previous page.",
            "schema": {
              "type": "string",
              "maxLength": 200
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DeviceList"
                }
              }
            }
          },
          "400": {
            "description": "`VALIDATION` The request is not valid.",
            "x-error-codes": [
              "VALIDATION"
            ],
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "`CLIENT_CERT_REQUIRED` A client certificate (mTLS) is required.\n\n`API_KEY_REQUIRED` Send the API key in the Authorization: Bearer header.\n\n`INVALID_API_KEY` The API key is not valid.\n\n`API_KEY_REVOKED` The API key has been revoked.\n\n`API_KEY_EXPIRED` The API key has expired.\n\n`CLIENT_CERT_MISMATCH` The client certificate is not the one bound to this API key.\n\n`CLIENT_CERT_REVOKED` The client certificate is revoked or expired.",
            "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` The vendor is not approved.\n\n`INSUFFICIENT_SCOPE` The API key does not have the scope for this call.",
            "x-error-codes": [
              "VENDOR_INACTIVE",
              "INSUFFICIENT_SCOPE"
            ],
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "`RATE_LIMITED` Too many requests. Retry after the Retry-After seconds.",
            "x-error-codes": [
              "RATE_LIMITED"
            ],
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "integer"
                },
                "description": "Seconds to wait"
              }
            }
          }
        }
      }
    },
    "/v1/devices/{serial}": {
      "get": {
        "operationId": "getDevice",
        "tags": [
          "Devices"
        ],
        "summary": "Get a device",
        "description": "One device and its latest certificate.",
        "x-scope": "devices.read",
        "x-blocked-when-suspended": false,
        "parameters": [
          {
            "name": "serial",
            "in": "path",
            "required": true,
            "description": "Serial.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Device"
                }
              }
            }
          },
          "401": {
            "description": "`CLIENT_CERT_REQUIRED` A client certificate (mTLS) is required.\n\n`API_KEY_REQUIRED` Send the API key in the Authorization: Bearer header.\n\n`INVALID_API_KEY` The API key is not valid.\n\n`API_KEY_REVOKED` The API key has been revoked.\n\n`API_KEY_EXPIRED` The API key has expired.\n\n`CLIENT_CERT_MISMATCH` The client certificate is not the one bound to this API key.\n\n`CLIENT_CERT_REVOKED` The client certificate is revoked or expired.",
            "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` The vendor is not approved.\n\n`INSUFFICIENT_SCOPE` The API key does not have the scope for this call.",
            "x-error-codes": [
              "VENDOR_INACTIVE",
              "INSUFFICIENT_SCOPE"
            ],
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "`DEVICE_NOT_FOUND` No device with this serial in your registry.",
            "x-error-codes": [
              "DEVICE_NOT_FOUND"
            ],
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "`RATE_LIMITED` Too many requests. Retry after the Retry-After seconds.",
            "x-error-codes": [
              "RATE_LIMITED"
            ],
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "integer"
                },
                "description": "Seconds to wait"
              }
            }
          }
        }
      },
      "patch": {
        "operationId": "updateDevice",
        "tags": [
          "Devices"
        ],
        "summary": "Update a device",
        "description": "Changes status (registered → shipped → active, returned, retired), model or note. retired is final and revokes the valid certificate with cessationOfOperation. chipId and rtuId can change only while the device has no valid certificate.",
        "x-scope": "devices.write",
        "x-blocked-when-suspended": true,
        "parameters": [
          {
            "name": "serial",
            "in": "path",
            "required": true,
            "description": "Serial.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/DeviceUpdate"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Device"
                }
              }
            }
          },
          "400": {
            "description": "`VALIDATION` The request is not valid.",
            "x-error-codes": [
              "VALIDATION"
            ],
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "`CLIENT_CERT_REQUIRED` A client certificate (mTLS) is required.\n\n`API_KEY_REQUIRED` Send the API key in the Authorization: Bearer header.\n\n`INVALID_API_KEY` The API key is not valid.\n\n`API_KEY_REVOKED` The API key has been revoked.\n\n`API_KEY_EXPIRED` The API key has expired.\n\n`CLIENT_CERT_MISMATCH` The client certificate is not the one bound to this API key.\n\n`CLIENT_CERT_REVOKED` The client certificate is revoked or expired.",
            "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` The vendor is suspended. Reads and revocations still work.\n\n`VENDOR_INACTIVE` The vendor is not approved.\n\n`INSUFFICIENT_SCOPE` The API key does not have the scope for this call.",
            "x-error-codes": [
              "VENDOR_SUSPENDED",
              "VENDOR_INACTIVE",
              "INSUFFICIENT_SCOPE"
            ],
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "`DEVICE_NOT_FOUND` No device with this serial in your registry.",
            "x-error-codes": [
              "DEVICE_NOT_FOUND"
            ],
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "`DEVICE_INACTIVE` The device is returned or retired.\n\n`DEVICE_LOCKED` chipId and rtuId cannot change while the device has a valid certificate.\n\n`DUPLICATE_CHIP` This chip ID is already used by another device or a valid certificate.\n\n`RTU_ID_IN_USE` This RTU ID is already used by another device or a valid certificate.",
            "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` Too many requests. Retry after the Retry-After seconds.",
            "x-error-codes": [
              "RATE_LIMITED"
            ],
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "integer"
                },
                "description": "Seconds to wait"
              }
            }
          }
        }
      }
    },
    "/v1/certificates": {
      "post": {
        "operationId": "issueCertificate",
        "tags": [
          "Certificates"
        ],
        "summary": "Issue a certificate",
        "description": "Issues a certificate for a registered device from its CSR. Vendors on automatic issuance get 201 with the certificate and chain. Vendors on manual issuance get 202 with a pending request; poll GET /v1/requests/{id}. One valid certificate per device: use renew to replace it.",
        "x-scope": "certs.issue",
        "x-blocked-when-suspended": true,
        "parameters": [
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": false,
            "schema": {
              "type": "string",
              "maxLength": 255
            },
            "description": "Resending with the same key returns the first response (24 h). Use it for retries."
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/IssueRequest"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/IssueResult"
                }
              }
            }
          },
          "202": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/IssueResult"
                }
              }
            }
          },
          "400": {
            "description": "`VALIDATION` The request is not valid.\n\n`INVALID_CSR` The CSR could not be read or does not meet the profile (P-256, signature).\n\n`PROFILE_NOT_ALLOWED` This profile cannot be used for the device.\n\n`RTU_ID_REQUIRED` The RTU profile needs rtuId on the device (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` A client certificate (mTLS) is required.\n\n`API_KEY_REQUIRED` Send the API key in the Authorization: Bearer header.\n\n`INVALID_API_KEY` The API key is not valid.\n\n`API_KEY_REVOKED` The API key has been revoked.\n\n`API_KEY_EXPIRED` The API key has expired.\n\n`CLIENT_CERT_MISMATCH` The client certificate is not the one bound to this API key.\n\n`CLIENT_CERT_REVOKED` The client certificate is revoked or expired.",
            "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` The vendor is not approved for this device type.\n\n`VENDOR_SUSPENDED` The vendor is suspended. Reads and revocations still work.\n\n`VENDOR_INACTIVE` The vendor is not approved.\n\n`INSUFFICIENT_SCOPE` The API key does not have the scope for this call.",
            "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` No device with this serial in your registry.",
            "x-error-codes": [
              "DEVICE_NOT_FOUND"
            ],
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "`DEVICE_INACTIVE` The device is returned or retired.\n\n`CERTIFICATE_EXISTS` The device already has a valid certificate. Renew it instead.\n\n`REQUEST_PENDING` The device already has a request waiting for approval.\n\n`DUPLICATE_CHIP` This chip ID is already used by another device or a valid certificate.\n\n`RTU_ID_IN_USE` This RTU ID is already used by another device or a valid certificate.",
            "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` Too many requests. Retry after the Retry-After seconds.",
            "x-error-codes": [
              "RATE_LIMITED"
            ],
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "integer"
                },
                "description": "Seconds to wait"
              }
            }
          },
          "503": {
            "description": "`NOT_CONFIGURED` Issuance is not available in this environment right now.",
            "x-error-codes": [
              "NOT_CONFIGURED"
            ],
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      },
      "get": {
        "operationId": "listCertificates",
        "tags": [
          "Certificates"
        ],
        "summary": "List certificates",
        "description": "Certificates issued to your devices, newest first.",
        "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": "Device serial number. Letters, digits and . - _ (max 64). Becomes the certificate CN unless the profile uses rtuId.",
            "schema": {
              "type": "string",
              "pattern": "^[A-Za-z0-9._-]{1,64}$"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "description": "Page size.",
            "schema": {
              "default": 100,
              "type": "integer",
              "minimum": 1,
              "maximum": 1000
            }
          },
          {
            "name": "cursor",
            "in": "query",
            "required": false,
            "description": "nextCursor from the previous page.",
            "schema": {
              "type": "string",
              "maxLength": 200
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CertificateList"
                }
              }
            }
          },
          "400": {
            "description": "`VALIDATION` The request is not valid.",
            "x-error-codes": [
              "VALIDATION"
            ],
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "`CLIENT_CERT_REQUIRED` A client certificate (mTLS) is required.\n\n`API_KEY_REQUIRED` Send the API key in the Authorization: Bearer header.\n\n`INVALID_API_KEY` The API key is not valid.\n\n`API_KEY_REVOKED` The API key has been revoked.\n\n`API_KEY_EXPIRED` The API key has expired.\n\n`CLIENT_CERT_MISMATCH` The client certificate is not the one bound to this API key.\n\n`CLIENT_CERT_REVOKED` The client certificate is revoked or expired.",
            "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` The vendor is not approved.\n\n`INSUFFICIENT_SCOPE` The API key does not have the scope for this call.",
            "x-error-codes": [
              "VENDOR_INACTIVE",
              "INSUFFICIENT_SCOPE"
            ],
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "`RATE_LIMITED` Too many requests. Retry after the Retry-After seconds.",
            "x-error-codes": [
              "RATE_LIMITED"
            ],
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "integer"
                },
                "description": "Seconds to wait"
              }
            }
          }
        }
      }
    },
    "/v1/certificates/batch": {
      "post": {
        "operationId": "issueBatch",
        "tags": [
          "Certificates"
        ],
        "summary": "Issue certificates in bulk",
        "description": "Queues up to 1000 issuance requests and returns 202 with a batch ID right away. Each item is checked like a single issue; one failing item does not stop the others. Poll GET /v1/batches/{id}, then download chains with 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": "Resending with the same key returns the first response (24 h). Use it for retries."
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/BatchRequest"
              }
            }
          }
        },
        "responses": {
          "202": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Batch"
                }
              }
            }
          },
          "400": {
            "description": "`VALIDATION` The request is not valid.",
            "x-error-codes": [
              "VALIDATION"
            ],
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "`CLIENT_CERT_REQUIRED` A client certificate (mTLS) is required.\n\n`API_KEY_REQUIRED` Send the API key in the Authorization: Bearer header.\n\n`INVALID_API_KEY` The API key is not valid.\n\n`API_KEY_REVOKED` The API key has been revoked.\n\n`API_KEY_EXPIRED` The API key has expired.\n\n`CLIENT_CERT_MISMATCH` The client certificate is not the one bound to this API key.\n\n`CLIENT_CERT_REVOKED` The client certificate is revoked or expired.",
            "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` The vendor is suspended. Reads and revocations still work.\n\n`VENDOR_INACTIVE` The vendor is not approved.\n\n`INSUFFICIENT_SCOPE` The API key does not have the scope for this call.",
            "x-error-codes": [
              "VENDOR_SUSPENDED",
              "VENDOR_INACTIVE",
              "INSUFFICIENT_SCOPE"
            ],
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "`RATE_LIMITED` Too many requests. Retry after the Retry-After seconds.",
            "x-error-codes": [
              "RATE_LIMITED"
            ],
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "integer"
                },
                "description": "Seconds to wait"
              }
            }
          }
        }
      }
    },
    "/v1/batches/{id}": {
      "get": {
        "operationId": "getBatch",
        "tags": [
          "Certificates"
        ],
        "summary": "Get a batch",
        "description": "Progress and per-item result of a bulk issue.",
        "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": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Batch"
                }
              }
            }
          },
          "401": {
            "description": "`CLIENT_CERT_REQUIRED` A client certificate (mTLS) is required.\n\n`API_KEY_REQUIRED` Send the API key in the Authorization: Bearer header.\n\n`INVALID_API_KEY` The API key is not valid.\n\n`API_KEY_REVOKED` The API key has been revoked.\n\n`API_KEY_EXPIRED` The API key has expired.\n\n`CLIENT_CERT_MISMATCH` The client certificate is not the one bound to this API key.\n\n`CLIENT_CERT_REVOKED` The client certificate is revoked or expired.",
            "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` The vendor is not approved.\n\n`INSUFFICIENT_SCOPE` The API key does not have the scope for this call.",
            "x-error-codes": [
              "VENDOR_INACTIVE",
              "INSUFFICIENT_SCOPE"
            ],
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "`BATCH_NOT_FOUND` No batch with this ID.",
            "x-error-codes": [
              "BATCH_NOT_FOUND"
            ],
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "`RATE_LIMITED` Too many requests. Retry after the Retry-After seconds.",
            "x-error-codes": [
              "RATE_LIMITED"
            ],
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "integer"
                },
                "description": "Seconds to wait"
              }
            }
          }
        }
      }
    },
    "/v1/certificates/{serial}": {
      "get": {
        "operationId": "getCertificate",
        "tags": [
          "Certificates"
        ],
        "summary": "Get a certificate",
        "description": "One certificate with its PEM.",
        "x-scope": "certs.read",
        "x-blocked-when-suspended": false,
        "parameters": [
          {
            "name": "serial",
            "in": "path",
            "required": true,
            "description": "Serial.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Certificate"
                }
              }
            }
          },
          "401": {
            "description": "`CLIENT_CERT_REQUIRED` A client certificate (mTLS) is required.\n\n`API_KEY_REQUIRED` Send the API key in the Authorization: Bearer header.\n\n`INVALID_API_KEY` The API key is not valid.\n\n`API_KEY_REVOKED` The API key has been revoked.\n\n`API_KEY_EXPIRED` The API key has expired.\n\n`CLIENT_CERT_MISMATCH` The client certificate is not the one bound to this API key.\n\n`CLIENT_CERT_REVOKED` The client certificate is revoked or expired.",
            "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` The vendor is not approved.\n\n`INSUFFICIENT_SCOPE` The API key does not have the scope for this call.",
            "x-error-codes": [
              "VENDOR_INACTIVE",
              "INSUFFICIENT_SCOPE"
            ],
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "`CERTIFICATE_NOT_FOUND` No certificate with this serial for your vendor.",
            "x-error-codes": [
              "CERTIFICATE_NOT_FOUND"
            ],
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "`RATE_LIMITED` Too many requests. Retry after the Retry-After seconds.",
            "x-error-codes": [
              "RATE_LIMITED"
            ],
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "integer"
                },
                "description": "Seconds to wait"
              }
            }
          }
        }
      }
    },
    "/v1/certificates/{serial}/chain": {
      "get": {
        "operationId": "getChain",
        "tags": [
          "Certificates"
        ],
        "summary": "Download the chain",
        "description": "Device certificate followed by the issuing CA, as application/pem-certificate-chain (RFC 8555). The root is not included: devices already hold it as the trust anchor.",
        "x-scope": "certs.read",
        "x-blocked-when-suspended": false,
        "parameters": [
          {
            "name": "serial",
            "in": "path",
            "required": true,
            "description": "Serial.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/pem-certificate-chain": {
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "description": "`CLIENT_CERT_REQUIRED` A client certificate (mTLS) is required.\n\n`API_KEY_REQUIRED` Send the API key in the Authorization: Bearer header.\n\n`INVALID_API_KEY` The API key is not valid.\n\n`API_KEY_REVOKED` The API key has been revoked.\n\n`API_KEY_EXPIRED` The API key has expired.\n\n`CLIENT_CERT_MISMATCH` The client certificate is not the one bound to this API key.\n\n`CLIENT_CERT_REVOKED` The client certificate is revoked or expired.",
            "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` The vendor is not approved.\n\n`INSUFFICIENT_SCOPE` The API key does not have the scope for this call.",
            "x-error-codes": [
              "VENDOR_INACTIVE",
              "INSUFFICIENT_SCOPE"
            ],
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "`CERTIFICATE_NOT_FOUND` No certificate with this serial for your vendor.",
            "x-error-codes": [
              "CERTIFICATE_NOT_FOUND"
            ],
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "`RATE_LIMITED` Too many requests. Retry after the Retry-After seconds.",
            "x-error-codes": [
              "RATE_LIMITED"
            ],
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "integer"
                },
                "description": "Seconds to wait"
              }
            }
          }
        }
      }
    },
    "/v1/certificates/{serial}/renew": {
      "post": {
        "operationId": "renewCertificate",
        "tags": [
          "Certificates"
        ],
        "summary": "Renew a certificate",
        "description": "Issues a new certificate for the same device from a new CSR. The old certificate is revoked as superseded once the new one is issued (after approval on manual issuance).",
        "x-scope": "certs.issue",
        "x-blocked-when-suspended": true,
        "parameters": [
          {
            "name": "serial",
            "in": "path",
            "required": true,
            "description": "Serial.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": false,
            "schema": {
              "type": "string",
              "maxLength": 255
            },
            "description": "Resending with the same key returns the first response (24 h). Use it for retries."
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/RenewRequest"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/IssueResult"
                }
              }
            }
          },
          "202": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/IssueResult"
                }
              }
            }
          },
          "400": {
            "description": "`VALIDATION` The request is not valid.\n\n`INVALID_CSR` The CSR could not be read or does not meet the profile (P-256, signature).",
            "x-error-codes": [
              "VALIDATION",
              "INVALID_CSR"
            ],
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "`CLIENT_CERT_REQUIRED` A client certificate (mTLS) is required.\n\n`API_KEY_REQUIRED` Send the API key in the Authorization: Bearer header.\n\n`INVALID_API_KEY` The API key is not valid.\n\n`API_KEY_REVOKED` The API key has been revoked.\n\n`API_KEY_EXPIRED` The API key has expired.\n\n`CLIENT_CERT_MISMATCH` The client certificate is not the one bound to this API key.\n\n`CLIENT_CERT_REVOKED` The client certificate is revoked or expired.",
            "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` The vendor is suspended. Reads and revocations still work.\n\n`VENDOR_INACTIVE` The vendor is not approved.\n\n`INSUFFICIENT_SCOPE` The API key does not have the scope for this call.",
            "x-error-codes": [
              "VENDOR_SUSPENDED",
              "VENDOR_INACTIVE",
              "INSUFFICIENT_SCOPE"
            ],
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "`CERTIFICATE_NOT_FOUND` No certificate with this serial for your vendor.",
            "x-error-codes": [
              "CERTIFICATE_NOT_FOUND"
            ],
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "`CERTIFICATE_REVOKED` The certificate is already revoked.\n\n`DEVICE_INACTIVE` The device is returned or retired.\n\n`REQUEST_PENDING` The device already has a request waiting for approval.",
            "x-error-codes": [
              "CERTIFICATE_REVOKED",
              "DEVICE_INACTIVE",
              "REQUEST_PENDING"
            ],
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "`RATE_LIMITED` Too many requests. Retry after the Retry-After seconds.",
            "x-error-codes": [
              "RATE_LIMITED"
            ],
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "integer"
                },
                "description": "Seconds to wait"
              }
            }
          }
        }
      }
    },
    "/v1/certificates/{serial}/revoke": {
      "post": {
        "operationId": "revokeCertificate",
        "tags": [
          "Certificates"
        ],
        "summary": "Revoke a certificate",
        "description": "Revokes right away and publishes a new CRL and trust bundle. Receivers stop trusting the certificate within a minute. Works while suspended.",
        "x-scope": "certs.revoke",
        "x-blocked-when-suspended": false,
        "parameters": [
          {
            "name": "serial",
            "in": "path",
            "required": true,
            "description": "Serial.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": false,
            "schema": {
              "type": "string",
              "maxLength": 255
            },
            "description": "Resending with the same key returns the first response (24 h). Use it for retries."
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/RevokeRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Certificate"
                }
              }
            }
          },
          "400": {
            "description": "`VALIDATION` The request is not valid.",
            "x-error-codes": [
              "VALIDATION"
            ],
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "`CLIENT_CERT_REQUIRED` A client certificate (mTLS) is required.\n\n`API_KEY_REQUIRED` Send the API key in the Authorization: Bearer header.\n\n`INVALID_API_KEY` The API key is not valid.\n\n`API_KEY_REVOKED` The API key has been revoked.\n\n`API_KEY_EXPIRED` The API key has expired.\n\n`CLIENT_CERT_MISMATCH` The client certificate is not the one bound to this API key.\n\n`CLIENT_CERT_REVOKED` The client certificate is revoked or expired.",
            "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` The vendor is not approved.\n\n`INSUFFICIENT_SCOPE` The API key does not have the scope for this call.",
            "x-error-codes": [
              "VENDOR_INACTIVE",
              "INSUFFICIENT_SCOPE"
            ],
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "`CERTIFICATE_NOT_FOUND` No certificate with this serial for your vendor.",
            "x-error-codes": [
              "CERTIFICATE_NOT_FOUND"
            ],
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "`CERTIFICATE_REVOKED` The certificate is already revoked.",
            "x-error-codes": [
              "CERTIFICATE_REVOKED"
            ],
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "`RATE_LIMITED` Too many requests. Retry after the Retry-After seconds.",
            "x-error-codes": [
              "RATE_LIMITED"
            ],
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "integer"
                },
                "description": "Seconds to wait"
              }
            }
          }
        }
      }
    },
    "/v1/requests": {
      "get": {
        "operationId": "listRequests",
        "tags": [
          "Requests"
        ],
        "summary": "List issuance requests",
        "description": "Your issuance and renewal requests, newest first.",
        "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": "Page size.",
            "schema": {
              "default": 100,
              "type": "integer",
              "minimum": 1,
              "maximum": 1000
            }
          },
          {
            "name": "cursor",
            "in": "query",
            "required": false,
            "description": "nextCursor from the previous page.",
            "schema": {
              "type": "string",
              "maxLength": 200
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/IssuanceRequestList"
                }
              }
            }
          },
          "400": {
            "description": "`VALIDATION` The request is not valid.",
            "x-error-codes": [
              "VALIDATION"
            ],
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "`CLIENT_CERT_REQUIRED` A client certificate (mTLS) is required.\n\n`API_KEY_REQUIRED` Send the API key in the Authorization: Bearer header.\n\n`INVALID_API_KEY` The API key is not valid.\n\n`API_KEY_REVOKED` The API key has been revoked.\n\n`API_KEY_EXPIRED` The API key has expired.\n\n`CLIENT_CERT_MISMATCH` The client certificate is not the one bound to this API key.\n\n`CLIENT_CERT_REVOKED` The client certificate is revoked or expired.",
            "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` The vendor is not approved.\n\n`INSUFFICIENT_SCOPE` The API key does not have the scope for this call.",
            "x-error-codes": [
              "VENDOR_INACTIVE",
              "INSUFFICIENT_SCOPE"
            ],
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "`RATE_LIMITED` Too many requests. Retry after the Retry-After seconds.",
            "x-error-codes": [
              "RATE_LIMITED"
            ],
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "integer"
                },
                "description": "Seconds to wait"
              }
            }
          }
        }
      }
    },
    "/v1/requests/{id}": {
      "get": {
        "operationId": "getRequest",
        "tags": [
          "Requests"
        ],
        "summary": "Get an issuance request",
        "description": "Status of one request. When approved, certificateSerial points to the certificate.",
        "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": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/IssuanceRequest"
                }
              }
            }
          },
          "401": {
            "description": "`CLIENT_CERT_REQUIRED` A client certificate (mTLS) is required.\n\n`API_KEY_REQUIRED` Send the API key in the Authorization: Bearer header.\n\n`INVALID_API_KEY` The API key is not valid.\n\n`API_KEY_REVOKED` The API key has been revoked.\n\n`API_KEY_EXPIRED` The API key has expired.\n\n`CLIENT_CERT_MISMATCH` The client certificate is not the one bound to this API key.\n\n`CLIENT_CERT_REVOKED` The client certificate is revoked or expired.",
            "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` The vendor is not approved.\n\n`INSUFFICIENT_SCOPE` The API key does not have the scope for this call.",
            "x-error-codes": [
              "VENDOR_INACTIVE",
              "INSUFFICIENT_SCOPE"
            ],
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "`REQUEST_NOT_FOUND` No issuance request with this ID.",
            "x-error-codes": [
              "REQUEST_NOT_FOUND"
            ],
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "`RATE_LIMITED` Too many requests. Retry after the Retry-After seconds.",
            "x-error-codes": [
              "RATE_LIMITED"
            ],
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "integer"
                },
                "description": "Seconds to wait"
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "securitySchemes": {
      "apiKey": {
        "type": "http",
        "scheme": "bearer",
        "description": "API key. Scopes: vendor.read, devices.read, devices.write, certs.read, certs.issue, certs.revoke"
      },
      "clientCert": {
        "type": "mutualTLS",
        "description": "Client certificate issued with the key in the portal"
      }
    },
    "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 time in UTC."
          },
          "completedAt": {
            "anyOf": [
              {
                "type": "string",
                "description": "ISO 8601 time in 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": "Up to 1000 issuance requests."
          }
        },
        "required": [
          "items"
        ]
      },
      "Certificate": {
        "type": "object",
        "properties": {
          "serial": {
            "type": "string",
            "description": "Certificate serial (hex, lower case)."
          },
          "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 time in UTC."
              },
              {
                "type": "null"
              }
            ]
          },
          "notBefore": {
            "type": "string",
            "description": "ISO 8601 time in UTC."
          },
          "notAfter": {
            "type": "string",
            "description": "ISO 8601 time in UTC."
          },
          "issuedAt": {
            "type": "string",
            "description": "ISO 8601 time in UTC."
          },
          "certificatePem": {
            "description": "Only in single-certificate responses.",
            "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": "Pass as cursor for the next page. null on the last page.",
            "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 time in UTC."
                  }
                },
                "required": [
                  "serial",
                  "status",
                  "notAfter"
                ]
              },
              {
                "type": "null"
              }
            ],
            "description": "Latest certificate of the device."
          },
          "createdAt": {
            "type": "string",
            "description": "ISO 8601 time in UTC."
          },
          "updatedAt": {
            "type": "string",
            "description": "ISO 8601 time in 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": "Device serial number. Letters, digits and . - _ (max 64). Becomes the certificate CN unless the profile uses rtuId."
          },
          "deviceType": {
            "type": "string",
            "enum": [
              "rtu",
              "ppc",
              "module"
            ],
            "description": "Device type. Must be one your vendor is approved for."
          },
          "chipId": {
            "type": "string",
            "pattern": "^[0-9A-Fa-f]{2,64}$",
            "description": "Secure element chip ID in hex (e.g. ATECC608 serial). Written to SAN as urn:solarize:chip:{ID}. Unique across devices."
          },
          "rtuId": {
            "type": "string",
            "pattern": "^\\d{1,10}$",
            "description": "RTU ID (digits). Required for the RTU profile: the certificate CN becomes rtu-{RTU ID}. Unique across all vendors."
          },
          "model": {
            "description": "Product model name.",
            "type": "string",
            "minLength": 1,
            "maxLength": 60
          },
          "note": {
            "description": "Free text (lot, factory line, ...).",
            "type": "string",
            "maxLength": 200
          }
        },
        "required": [
          "serial",
          "deviceType"
        ],
        "description": "A device to register."
      },
      "DeviceList": {
        "type": "object",
        "properties": {
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Device"
            }
          },
          "nextCursor": {
            "description": "Pass as cursor for the next page. null on the last page.",
            "type": [
              "string",
              "null"
            ]
          }
        },
        "required": [
          "data",
          "nextCursor"
        ]
      },
      "DeviceUpdate": {
        "type": "object",
        "properties": {
          "status": {
            "description": "New status. retired is final and revokes the valid certificate (cessationOfOperation).",
            "type": "string",
            "enum": [
              "registered",
              "shipped",
              "active",
              "returned",
              "retired"
            ]
          },
          "chipId": {
            "anyOf": [
              {
                "type": "string",
                "pattern": "^[0-9A-Fa-f]{2,64}$",
                "description": "Secure element chip ID in hex (e.g. ATECC608 serial). Written to SAN as urn:solarize:chip:{ID}. Unique across devices."
              },
              {
                "type": "null"
              }
            ]
          },
          "rtuId": {
            "anyOf": [
              {
                "type": "string",
                "pattern": "^\\d{1,10}$",
                "description": "RTU ID (digits). Required for the RTU profile: the certificate CN becomes rtu-{RTU ID}. Unique across all vendors."
              },
              {
                "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": "Stable error code. See Errors."
          },
          "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: waiting for Solarize approval (manual issue mode)."
          },
          "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": "For renewals: the certificate that is revoked (superseded) once the new one is issued.",
            "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 time in UTC."
          },
          "decidedAt": {
            "anyOf": [
              {
                "type": "string",
                "description": "ISO 8601 time in 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": "Pass as cursor for the next page. null on the last page.",
            "type": [
              "string",
              "null"
            ]
          }
        },
        "required": [
          "data",
          "nextCursor"
        ]
      },
      "IssueRequest": {
        "type": "object",
        "properties": {
          "deviceSerial": {
            "type": "string",
            "pattern": "^[A-Za-z0-9._-]{1,64}$",
            "description": "Serial of a registered device."
          },
          "csrPem": {
            "type": "string",
            "minLength": 100,
            "maxLength": 20000,
            "description": "PKCS#10 CSR in PEM (ECDSA P-256). The private key stays on the device. CN and SAN in the CSR are ignored; they come from the device registry."
          },
          "profileId": {
            "description": "Profile ID from GET /v1/profiles. Defaults to the profile for the device type.",
            "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": "Set when issued (201). null while pending (202)."
          },
          "chainPem": {
            "description": "Device certificate + issuing CA (PEM). Install with the root you already trust.",
            "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 time in 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 time in 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 is rtu-{RTU ID}. serial: CN is the device serial."
          },
          "validDays": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991,
            "description": "Certificate lifetime in days."
          },
          "chipCompat": {
            "type": "boolean",
            "description": "Certificates fit secure-element verification (P-256, SHA-256, size limits)."
          },
          "default": {
            "type": "boolean",
            "description": "Used when profileId is omitted."
          }
        },
        "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": "Up to 1000 devices (a shipping list)."
          }
        },
        "required": [
          "devices"
        ]
      },
      "RegisterDevicesResult": {
        "type": "object",
        "properties": {
          "created": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991,
            "description": "Newly registered."
          },
          "unchanged": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991,
            "description": "Already registered with the same values (safe to resend a list)."
          },
          "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 in PEM (ECDSA P-256). The private key stays on the device. CN and SAN in the CSR are ignored; they come from the device registry."
          }
        },
        "required": [
          "csrPem"
        ]
      },
      "RevokeRequest": {
        "type": "object",
        "properties": {
          "reason": {
            "type": "string",
            "enum": [
              "unspecified",
              "keyCompromise",
              "affiliationChanged",
              "superseded",
              "cessationOfOperation"
            ],
            "description": "RFC 5280 reason. keyCompromise if the private key may have leaked."
          }
        },
        "required": [
          "reason"
        ]
      }
    }
  }
}