{
  "openapi": "3.0.3",
  "info": {
    "title": "Keymint API",
    "description": "License key management system API. The API is versioned: this document is the authoritative contract for the current version. Backward-compatible changes (new optional fields, new endpoints, new response headers) ship without notice. Breaking changes are introduced only in a new dated contract and announced in the changelog and release emails at least 30 days before the old contract stops working. Deprecated endpoints and fields are listed in the changelog with a removal timeline, and sunsetting endpoints respond with Deprecation and Sunset HTTP headers naming the retirement date.\n\nRequest bodies are limited to 64 KB (413 `payload_too_large`), and every field has a maximum length or value; see the Error Codes page.",
    "version": "2.0.0",
    "contact": {
      "name": "Keymint Support",
      "url": "https://keymint.dev"
    },
    "x-versioning-policy": "Versioning is declared in info.version. Backward-compatible changes ship without notice; breaking changes require a new dated contract and are announced at least 30 days in advance in the changelog and release emails.",
    "x-deprecation-policy": "Deprecations are listed in the changelog (https://keymint.dev/docs/changelog) with a removal timeline. Sunsetting endpoints respond with Deprecation and Sunset HTTP headers naming the retirement date."
  },
  "servers": [
    {
      "url": "https://api.keymint.dev",
      "description": "Production server"
    }
  ],
  "security": [
    {
      "bearerAuth": []
    }
  ],
  "paths": {
    "/customer": {
      "post": {
        "summary": "Create Customer",
        "description": "Create a customer to assign license keys to. Requires an `admin` key or the `customer:write` grant; product-bound keys are refused. Counts against the plan's customer limit.",
        "tags": [
          "Customers"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PostcustomerRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Customer created",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PostcustomerSuccessResponse"
                },
                "example": {
                  "action": "addCustomer",
                  "status": true,
                  "data": {
                    "id": "078116d0069c32407b4f63",
                    "name": "Jane Doe",
                    "email": "jane@example.com"
                  },
                  "message": "Customer added",
                  "code": 0
                }
              }
            }
          },
          "400": {
            "description": "Invalid request. Validation errors name the field: `Field '<name>' is required.` or `Field '<name>': <problem>`, and keep the legacy `error: { code: \"VALIDATION_ERROR\" }` object. A body that isn't valid JSON is also `invalid_request`. An `Idempotency-Key` reused with a different method, path, query or body returns `idempotency_mismatch`. An `Idempotency-Key` longer than 255 characters, or with characters outside printable ASCII, returns `invalid_request`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "examples": {
                  "missingField": {
                    "summary": "Required field missing",
                    "value": {
                      "success": false,
                      "message": "Field 'name' is required.",
                      "code": 1,
                      "errorCode": "invalid_request",
                      "error": {
                        "code": "VALIDATION_ERROR",
                        "message": "Field 'name' is required."
                      }
                    }
                  },
                  "tooShort": {
                    "summary": "Field under its minimum",
                    "value": {
                      "success": false,
                      "message": "Field 'name': customer name must be at least 3 characters",
                      "code": 1,
                      "errorCode": "invalid_request",
                      "error": {
                        "code": "VALIDATION_ERROR",
                        "message": "Field 'name': customer name must be at least 3 characters"
                      }
                    }
                  },
                  "invalidJson": {
                    "summary": "Body is not valid JSON",
                    "value": {
                      "message": "Request body is not valid JSON",
                      "code": 1,
                      "errorCode": "invalid_request"
                    }
                  },
                  "idempotencyMismatch": {
                    "summary": "Idempotency-Key reused for a different request",
                    "value": {
                      "message": "Idempotency key reused with different request parameters or payload (or a legacy record).",
                      "code": 1,
                      "errorCode": "idempotency_mismatch"
                    }
                  },
                  "idempotencyKeyInvalid": {
                    "summary": "Idempotency-Key too long",
                    "value": {
                      "message": "Idempotency-Key must be 1 to 255 printable ASCII characters.",
                      "code": 1,
                      "errorCode": "invalid_request"
                    }
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/UnauthorizedCustomer"
          },
          "403": {
            "description": "The workspace's plan doesn't allow another customer.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "message": "Your workspace has reached the maximum allowed Customers (100) for your current plan.",
                  "code": 1,
                  "errorCode": "forbidden"
                }
              }
            }
          },
          "409": {
            "description": "Another customer in this workspace already has this email (`conflict`, code 2). A request with the same `Idempotency-Key` is still running (`idempotency_in_progress`), or an old idempotency record can't be replayed (`idempotency_legacy`).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "examples": {
                  "duplicateEmail": {
                    "summary": "Email already used in this workspace",
                    "value": {
                      "message": "Customer email jane@example.com already exists in this workspace.",
                      "code": 2,
                      "errorCode": "conflict"
                    }
                  },
                  "inProgress": {
                    "summary": "Same Idempotency-Key still running",
                    "value": {
                      "message": "A request with this idempotency key is currently in progress.",
                      "code": 1,
                      "errorCode": "idempotency_in_progress"
                    }
                  }
                }
              }
            }
          },
          "413": {
            "$ref": "#/components/responses/PayloadTooLarge"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        },
        "operationId": "createCustomer",
        "parameters": [
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": false,
            "description": "Optional on this endpoint. A client-generated key (use a fresh UUID v4 per operation) that makes a retry return the original result instead of repeating the change. `X-Idempotency-Key` is accepted too. Records are kept for 24 hours; It must be 1 to 255 printable ASCII characters; a longer value, or one with other characters, returns `400` `invalid_request` before anything runs.",
            "schema": {
              "type": "string",
              "maxLength": 255,
              "example": "9b1deb4d-3b7d-4bad-9bdd-2b0d7b3dcb6d",
              "minLength": 1,
              "pattern": "^[\\x20-\\x7E]+$"
            }
          }
        ]
      },
      "get": {
        "summary": "Get All Customers",
        "description": "List the workspace's customers, newest first. Requires a `read-only` or `admin` key or the `customer:read` grant. A product-bound API key can't list customers: it is refused with 401 `api_key_invalid`.",
        "tags": [
          "Customers"
        ],
        "parameters": [
          {
            "name": "page",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "default": 1
            },
            "description": "Page number (default 1). Values below 1 or not numbers are treated as 1."
          },
          {
            "name": "limit",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 10
            },
            "description": "Customers per page, 1–100 (default 10). Larger values are capped at 100."
          },
          {
            "name": "email",
            "in": "query",
            "schema": {
              "type": "string",
              "example": "acme.com"
            },
            "description": "Optional search: a case-insensitive match anywhere in the customer's name or email (first 100 characters used)."
          }
        ],
        "responses": {
          "200": {
            "description": "Customers",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/GetcustomerResponse"
                },
                "example": {
                  "action": "getPaginatedCustomers",
                  "status": true,
                  "data": [
                    {
                      "id": "078116d0069c32407b4f63",
                      "name": "Jane Doe",
                      "email": "jane@example.com",
                      "active": true,
                      "createdAt": "2026-09-01T18:45:38.060Z",
                      "updatedAt": "2026-09-01T18:45:38.060Z"
                    }
                  ],
                  "meta": {
                    "total": 1,
                    "page": 1,
                    "limit": 10,
                    "totalPages": 1
                  },
                  "code": 0
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/UnauthorizedCustomer"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        },
        "operationId": "getCustomer"
      },
      "put": {
        "summary": "Update Customer",
        "description": "Update a customer's name and email. Send both: omitting `email` removes it. Requires an `admin` key or the `customer:write` grant; product-bound keys are refused. Emails are unique within a workspace.\n\nThe same operation is served at `/customer/by-id`; both paths behave identically.",
        "tags": [
          "Customers"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "allOf": [
                  {
                    "$ref": "#/components/schemas/PutcustomercustomerIdRequest"
                  },
                  {
                    "type": "object",
                    "properties": {
                      "customerId": {
                        "type": "string",
                        "minLength": 22,
                        "maxLength": 256,
                        "example": "078116d0069c32407b4f63",
                        "description": "The customer to update. 22–256 characters."
                      }
                    },
                    "required": [
                      "customerId"
                    ]
                  }
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Customer updated (also when nothing changed)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PutcustomercustomerIdResponse"
                },
                "example": {
                  "action": "updateCustomer",
                  "status": true,
                  "data": {
                    "id": "078116d0069c32407b4f63",
                    "name": "Jane Doe",
                    "email": "jane@example.com",
                    "active": true,
                    "createdAt": "2026-09-01T18:45:38.060Z",
                    "updatedAt": "2026-11-07T10:00:00.000Z"
                  },
                  "message": "Customer updated",
                  "code": 0
                }
              }
            }
          },
          "400": {
            "description": "Invalid request. Validation errors name the field: `Field '<name>' is required.` or `Field '<name>': <problem>`, and keep the legacy `error: { code: \"VALIDATION_ERROR\" }` object. A body that isn't valid JSON is also `invalid_request`. An `Idempotency-Key` reused with a different method, path, query or body returns `idempotency_mismatch`. An `Idempotency-Key` longer than 255 characters, or with characters outside printable ASCII, returns `invalid_request`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "examples": {
                  "missingField": {
                    "summary": "Required field missing",
                    "value": {
                      "success": false,
                      "message": "Field 'customerId' is required.",
                      "code": 1,
                      "errorCode": "invalid_request",
                      "error": {
                        "code": "VALIDATION_ERROR",
                        "message": "Field 'customerId' is required."
                      }
                    }
                  },
                  "tooShort": {
                    "summary": "Field under its minimum",
                    "value": {
                      "success": false,
                      "message": "Field 'customerId': customer ID must be at least 22 characters",
                      "code": 1,
                      "errorCode": "invalid_request",
                      "error": {
                        "code": "VALIDATION_ERROR",
                        "message": "Field 'customerId': customer ID must be at least 22 characters"
                      }
                    }
                  },
                  "invalidJson": {
                    "summary": "Body is not valid JSON",
                    "value": {
                      "message": "Request body is not valid JSON",
                      "code": 1,
                      "errorCode": "invalid_request"
                    }
                  },
                  "idempotencyMismatch": {
                    "summary": "Idempotency-Key reused for a different request",
                    "value": {
                      "message": "Idempotency key reused with different request parameters or payload (or a legacy record).",
                      "code": 1,
                      "errorCode": "idempotency_mismatch"
                    }
                  },
                  "idempotencyKeyInvalid": {
                    "summary": "Idempotency-Key too long",
                    "value": {
                      "message": "Idempotency-Key must be 1 to 255 printable ASCII characters.",
                      "code": 1,
                      "errorCode": "invalid_request"
                    }
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/UnauthorizedCustomer"
          },
          "403": {
            "description": "The customer holds licenses and the key lacks `license:read`, which changing their email requires.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "message": "This customer has licenses. Changing their email requires permission: license:read",
                  "code": 1,
                  "errorCode": "forbidden"
                }
              }
            }
          },
          "404": {
            "description": "No customer with this ID in the workspace.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "message": "customer with ID 078116d0069c32407b4f63 not found",
                  "code": 1,
                  "errorCode": "not_found"
                }
              }
            }
          },
          "409": {
            "description": "Another customer in this workspace already has this email (`conflict`, code 2). A request with the same `Idempotency-Key` is still running (`idempotency_in_progress`), or an old idempotency record can't be replayed (`idempotency_legacy`).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "examples": {
                  "duplicateEmail": {
                    "summary": "Email already used in this workspace",
                    "value": {
                      "message": "Customer email jane@example.com already exists in this workspace.",
                      "code": 2,
                      "errorCode": "conflict"
                    }
                  },
                  "inProgress": {
                    "summary": "Same Idempotency-Key still running",
                    "value": {
                      "message": "A request with this idempotency key is currently in progress.",
                      "code": 1,
                      "errorCode": "idempotency_in_progress"
                    }
                  }
                }
              }
            }
          },
          "413": {
            "$ref": "#/components/responses/PayloadTooLarge"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        },
        "operationId": "updateCustomer",
        "parameters": [
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": false,
            "description": "Optional on this endpoint. A client-generated key (use a fresh UUID v4 per operation) that makes a retry return the original result instead of repeating the change. `X-Idempotency-Key` is accepted too. Records are kept for 24 hours; It must be 1 to 255 printable ASCII characters; a longer value, or one with other characters, returns `400` `invalid_request` before anything runs.",
            "schema": {
              "type": "string",
              "maxLength": 255,
              "example": "9b1deb4d-3b7d-4bad-9bdd-2b0d7b3dcb6d",
              "minLength": 1,
              "pattern": "^[\\x20-\\x7E]+$"
            }
          }
        ]
      },
      "delete": {
        "summary": "Delete Customer",
        "description": "Permanently delete a customer. Their license keys are kept and unassigned. Requires an `admin` key or the `customer:delete` grant; product-bound keys are refused. If the customer holds keys, the key also needs `license:manage` (or `license:write`) to unassign them.\n\nThe same operation is served at `/customer/by-id`; both paths behave identically.",
        "tags": [
          "Customers"
        ],
        "parameters": [
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": false,
            "description": "Optional on this endpoint. A client-generated key (use a fresh UUID v4 per operation) that makes a retry return the original result instead of repeating the change. `X-Idempotency-Key` is accepted too. Records are kept for 24 hours; It must be 1 to 255 printable ASCII characters; a longer value, or one with other characters, returns `400` `invalid_request` before anything runs.",
            "schema": {
              "type": "string",
              "maxLength": 255,
              "example": "9b1deb4d-3b7d-4bad-9bdd-2b0d7b3dcb6d",
              "minLength": 1,
              "pattern": "^[\\x20-\\x7E]+$"
            }
          },
          {
            "name": "customerId",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "example": "078116d0069c32407b4f63"
            },
            "description": "The customer ID."
          }
        ],
        "responses": {
          "200": {
            "description": "Customer deleted",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DeletecustomercustomerIdResponse"
                },
                "example": {
                  "action": "removeCustomer",
                  "status": true,
                  "customerName": "Jane Doe",
                  "customerEmail": "jane@example.com",
                  "message": "Customer deleted",
                  "code": 0
                }
              }
            }
          },
          "400": {
            "description": "`customerId` query parameter missing, or an `Idempotency-Key` reused for a different request. An `Idempotency-Key` longer than 255 characters, or with characters outside printable ASCII, returns `invalid_request`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "examples": {
                  "missingCustomerId": {
                    "summary": "customerId missing",
                    "value": {
                      "message": "Bad Request: customerId is required",
                      "code": 1,
                      "errorCode": "invalid_request"
                    }
                  },
                  "idempotencyMismatch": {
                    "summary": "Idempotency-Key reused",
                    "value": {
                      "message": "Idempotency key reused with different request parameters or payload (or a legacy record).",
                      "code": 1,
                      "errorCode": "idempotency_mismatch"
                    }
                  },
                  "idempotencyKeyInvalid": {
                    "summary": "Idempotency-Key too long",
                    "value": {
                      "message": "Idempotency-Key must be 1 to 255 printable ASCII characters.",
                      "code": 1,
                      "errorCode": "invalid_request"
                    }
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/UnauthorizedCustomer"
          },
          "403": {
            "description": "The customer holds license keys and the API key can't unassign them.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "message": "This customer has license keys attached. You need license management permission ('license:manage', or legacy 'license:write') to unlink them.",
                  "code": 1,
                  "errorCode": "forbidden"
                }
              }
            }
          },
          "404": {
            "description": "No customer with this ID in the workspace.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "message": "customer with ID 078116d0069c32407b4f63 not found",
                  "code": 1,
                  "errorCode": "not_found"
                }
              }
            }
          },
          "409": {
            "$ref": "#/components/responses/IdempotencyConflict"
          },
          "413": {
            "$ref": "#/components/responses/PayloadTooLarge"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        },
        "operationId": "deleteCustomer"
      }
    },
    "/customer/by-id": {
      "get": {
        "summary": "Get Customer",
        "description": "Get one customer. Requires a `read-only` or `admin` key or the `customer:read` grant; product-bound keys are refused.",
        "tags": [
          "Customers"
        ],
        "parameters": [
          {
            "name": "customerId",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "example": "078116d0069c32407b4f63"
            },
            "description": "The customer ID."
          }
        ],
        "responses": {
          "200": {
            "description": "The customer",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/GetcustomercustomerIdResponse"
                },
                "example": {
                  "action": "getCustomerById",
                  "status": true,
                  "data": [
                    {
                      "id": "078116d0069c32407b4f63",
                      "name": "Jane Doe",
                      "email": "jane@example.com",
                      "active": true,
                      "createdAt": "2026-09-01T18:45:38.060Z",
                      "updatedAt": "2026-09-01T18:45:38.060Z"
                    }
                  ],
                  "code": 0
                }
              }
            }
          },
          "400": {
            "description": "`customerId` query parameter missing.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "message": "Bad Request: customerId query parameter is required",
                  "code": 1,
                  "errorCode": "invalid_request"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/UnauthorizedCustomer"
          },
          "404": {
            "description": "No customer with this ID in the workspace.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "message": "customer with ID 078116d0069c32407b4f63 not found",
                  "code": 1,
                  "errorCode": "not_found"
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        },
        "operationId": "getCustomerById"
      },
      "put": {
        "summary": "Update Customer",
        "description": "Update a customer's name and email. Send both: omitting `email` removes it. Requires an `admin` key or the `customer:write` grant; product-bound keys are refused. Emails are unique within a workspace.",
        "tags": [
          "Customers"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "allOf": [
                  {
                    "$ref": "#/components/schemas/PutcustomercustomerIdRequest"
                  },
                  {
                    "type": "object",
                    "properties": {
                      "customerId": {
                        "type": "string",
                        "minLength": 22,
                        "maxLength": 256,
                        "example": "078116d0069c32407b4f63",
                        "description": "The customer to update. 22–256 characters."
                      }
                    },
                    "required": [
                      "customerId"
                    ]
                  }
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Customer updated (also when nothing changed)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PutcustomercustomerIdResponse"
                },
                "example": {
                  "action": "updateCustomer",
                  "status": true,
                  "data": {
                    "id": "078116d0069c32407b4f63",
                    "name": "Jane Doe",
                    "email": "jane@example.com",
                    "active": true,
                    "createdAt": "2026-09-01T18:45:38.060Z",
                    "updatedAt": "2026-11-07T10:00:00.000Z"
                  },
                  "message": "Customer updated",
                  "code": 0
                }
              }
            }
          },
          "400": {
            "description": "Invalid request. Validation errors name the field: `Field '<name>' is required.` or `Field '<name>': <problem>`, and keep the legacy `error: { code: \"VALIDATION_ERROR\" }` object. A body that isn't valid JSON is also `invalid_request`. An `Idempotency-Key` reused with a different method, path, query or body returns `idempotency_mismatch`. An `Idempotency-Key` longer than 255 characters, or with characters outside printable ASCII, returns `invalid_request`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "examples": {
                  "missingField": {
                    "summary": "Required field missing",
                    "value": {
                      "success": false,
                      "message": "Field 'customerId' is required.",
                      "code": 1,
                      "errorCode": "invalid_request",
                      "error": {
                        "code": "VALIDATION_ERROR",
                        "message": "Field 'customerId' is required."
                      }
                    }
                  },
                  "tooShort": {
                    "summary": "Field under its minimum",
                    "value": {
                      "success": false,
                      "message": "Field 'customerId': customer ID must be at least 22 characters",
                      "code": 1,
                      "errorCode": "invalid_request",
                      "error": {
                        "code": "VALIDATION_ERROR",
                        "message": "Field 'customerId': customer ID must be at least 22 characters"
                      }
                    }
                  },
                  "invalidJson": {
                    "summary": "Body is not valid JSON",
                    "value": {
                      "message": "Request body is not valid JSON",
                      "code": 1,
                      "errorCode": "invalid_request"
                    }
                  },
                  "idempotencyMismatch": {
                    "summary": "Idempotency-Key reused for a different request",
                    "value": {
                      "message": "Idempotency key reused with different request parameters or payload (or a legacy record).",
                      "code": 1,
                      "errorCode": "idempotency_mismatch"
                    }
                  },
                  "idempotencyKeyInvalid": {
                    "summary": "Idempotency-Key too long",
                    "value": {
                      "message": "Idempotency-Key must be 1 to 255 printable ASCII characters.",
                      "code": 1,
                      "errorCode": "invalid_request"
                    }
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/UnauthorizedCustomer"
          },
          "403": {
            "description": "The customer holds licenses and the key lacks `license:read`, which changing their email requires.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "message": "This customer has licenses. Changing their email requires permission: license:read",
                  "code": 1,
                  "errorCode": "forbidden"
                }
              }
            }
          },
          "404": {
            "description": "No customer with this ID in the workspace.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "message": "customer with ID 078116d0069c32407b4f63 not found",
                  "code": 1,
                  "errorCode": "not_found"
                }
              }
            }
          },
          "409": {
            "description": "Another customer in this workspace already has this email (`conflict`, code 2). A request with the same `Idempotency-Key` is still running (`idempotency_in_progress`), or an old idempotency record can't be replayed (`idempotency_legacy`).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "examples": {
                  "duplicateEmail": {
                    "summary": "Email already used in this workspace",
                    "value": {
                      "message": "Customer email jane@example.com already exists in this workspace.",
                      "code": 2,
                      "errorCode": "conflict"
                    }
                  },
                  "inProgress": {
                    "summary": "Same Idempotency-Key still running",
                    "value": {
                      "message": "A request with this idempotency key is currently in progress.",
                      "code": 1,
                      "errorCode": "idempotency_in_progress"
                    }
                  }
                }
              }
            }
          },
          "413": {
            "$ref": "#/components/responses/PayloadTooLarge"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        },
        "operationId": "updateCustomerById",
        "parameters": [
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": false,
            "description": "Optional on this endpoint. A client-generated key (use a fresh UUID v4 per operation) that makes a retry return the original result instead of repeating the change. `X-Idempotency-Key` is accepted too. Records are kept for 24 hours; It must be 1 to 255 printable ASCII characters; a longer value, or one with other characters, returns `400` `invalid_request` before anything runs.",
            "schema": {
              "type": "string",
              "maxLength": 255,
              "example": "9b1deb4d-3b7d-4bad-9bdd-2b0d7b3dcb6d",
              "minLength": 1,
              "pattern": "^[\\x20-\\x7E]+$"
            }
          }
        ]
      },
      "delete": {
        "summary": "Delete Customer",
        "description": "Permanently delete a customer. Their license keys are kept and unassigned. Requires an `admin` key or the `customer:delete` grant; product-bound keys are refused. If the customer holds keys, the key also needs `license:manage` (or `license:write`) to unassign them.",
        "tags": [
          "Customers"
        ],
        "parameters": [
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": false,
            "description": "Optional on this endpoint. A client-generated key (use a fresh UUID v4 per operation) that makes a retry return the original result instead of repeating the change. `X-Idempotency-Key` is accepted too. Records are kept for 24 hours; It must be 1 to 255 printable ASCII characters; a longer value, or one with other characters, returns `400` `invalid_request` before anything runs.",
            "schema": {
              "type": "string",
              "maxLength": 255,
              "example": "9b1deb4d-3b7d-4bad-9bdd-2b0d7b3dcb6d",
              "minLength": 1,
              "pattern": "^[\\x20-\\x7E]+$"
            }
          },
          {
            "name": "customerId",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "example": "078116d0069c32407b4f63"
            },
            "description": "The customer ID."
          }
        ],
        "responses": {
          "200": {
            "description": "Customer deleted",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DeletecustomercustomerIdResponse"
                },
                "example": {
                  "action": "removeCustomer",
                  "status": true,
                  "customerName": "Jane Doe",
                  "customerEmail": "jane@example.com",
                  "message": "Customer deleted",
                  "code": 0
                }
              }
            }
          },
          "400": {
            "description": "`customerId` query parameter missing, or an `Idempotency-Key` reused for a different request. An `Idempotency-Key` longer than 255 characters, or with characters outside printable ASCII, returns `invalid_request`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "examples": {
                  "missingCustomerId": {
                    "summary": "customerId missing",
                    "value": {
                      "message": "Bad Request: customerId is required",
                      "code": 1,
                      "errorCode": "invalid_request"
                    }
                  },
                  "idempotencyMismatch": {
                    "summary": "Idempotency-Key reused",
                    "value": {
                      "message": "Idempotency key reused with different request parameters or payload (or a legacy record).",
                      "code": 1,
                      "errorCode": "idempotency_mismatch"
                    }
                  },
                  "idempotencyKeyInvalid": {
                    "summary": "Idempotency-Key too long",
                    "value": {
                      "message": "Idempotency-Key must be 1 to 255 printable ASCII characters.",
                      "code": 1,
                      "errorCode": "invalid_request"
                    }
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/UnauthorizedCustomer"
          },
          "403": {
            "description": "The customer holds license keys and the API key can't unassign them.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "message": "This customer has license keys attached. You need license management permission ('license:manage', or legacy 'license:write') to unlink them.",
                  "code": 1,
                  "errorCode": "forbidden"
                }
              }
            }
          },
          "404": {
            "description": "No customer with this ID in the workspace.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "message": "customer with ID 078116d0069c32407b4f63 not found",
                  "code": 1,
                  "errorCode": "not_found"
                }
              }
            }
          },
          "409": {
            "$ref": "#/components/responses/IdempotencyConflict"
          },
          "413": {
            "$ref": "#/components/responses/PayloadTooLarge"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        },
        "operationId": "deleteCustomerById"
      }
    },
    "/customer/keys": {
      "get": {
        "summary": "Get Customer Keys",
        "description": "List a customer's license keys with the key values masked. Requires a `read-only` or `admin` key or the `customer:read` grant; product-bound keys are refused.",
        "tags": [
          "Customers",
          "License Keys"
        ],
        "parameters": [
          {
            "name": "customerId",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "example": "078116d0069c32407b4f63"
            },
            "description": "The customer ID."
          }
        ],
        "responses": {
          "200": {
            "description": "The customer's keys (a bare array)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/GetcustomercustomerIdkeysResponse"
                },
                "example": [
                  {
                    "id": "wrl8Xq5v8dfGEQYe9bTcvT",
                    "key": "A8E2****7J2K",
                    "productId": "4898d6707ffa56ed9b0eea",
                    "productName": "Acme Desktop",
                    "customerId": "078116d0069c32407b4f63",
                    "customerData": [
                      {
                        "id": "078116d0069c32407b4f63",
                        "name": "Jane Doe",
                        "email": "jane@example.com"
                      }
                    ],
                    "licenseType": "node-locked",
                    "activated": true,
                    "vendorDisabled": false,
                    "activations": 1,
                    "maxActivations": 3,
                    "maxConcurrentSessions": null,
                    "heartbeatInterval": null,
                    "sessionLeaseDuration": null,
                    "expirationDate": null,
                    "activationDate": "2026-09-02T09:00:00.000Z",
                    "createdAt": "2026-09-01T18:45:38.060Z",
                    "updatedAt": "2026-09-02T09:00:00.000Z",
                    "versionId": null,
                    "version": null,
                    "allowedHosts": null,
                    "customerCanSelfReset": false,
                    "metadata": {
                      "is_trial": false
                    },
                    "devices": [
                      {
                        "hostId": "mac-studio-m2",
                        "deviceTag": "MacBook Pro",
                        "activationTime": "2026-09-02T09:00:00.000Z"
                      }
                    ]
                  }
                ]
              }
            }
          },
          "400": {
            "description": "`customerId` query parameter missing.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "message": "Bad Request: customerId query parameter is required",
                  "code": 1,
                  "errorCode": "invalid_request"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/UnauthorizedCustomer"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        },
        "operationId": "getCustomerKeys"
      }
    },
    "/customer/disable": {
      "post": {
        "summary": "Toggle Status",
        "description": "Toggle a customer between active and disabled (each call flips it). Licenses assigned to a disabled customer can't be activated or checked out. Requires an `admin` key or the `customer:write` grant; product-bound keys are refused.",
        "tags": [
          "Customers"
        ],
        "parameters": [
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": false,
            "description": "Optional on this endpoint. A client-generated key (use a fresh UUID v4 per operation) that makes a retry return the original result instead of repeating the change. `X-Idempotency-Key` is accepted too. Records are kept for 24 hours; It must be 1 to 255 printable ASCII characters; a longer value, or one with other characters, returns `400` `invalid_request` before anything runs.",
            "schema": {
              "type": "string",
              "maxLength": 255,
              "example": "9b1deb4d-3b7d-4bad-9bdd-2b0d7b3dcb6d",
              "minLength": 1,
              "pattern": "^[\\x20-\\x7E]+$"
            }
          },
          {
            "name": "customerId",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "example": "078116d0069c32407b4f63"
            },
            "description": "The customer ID."
          }
        ],
        "responses": {
          "200": {
            "description": "Status toggled",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PostcustomercustomerIddisableResponse"
                },
                "example": {
                  "action": "toggleActive",
                  "status": true,
                  "customerName": "Jane Doe",
                  "active": false
                }
              }
            }
          },
          "400": {
            "description": "`customerId` query parameter missing, or an `Idempotency-Key` reused for a different request. An `Idempotency-Key` longer than 255 characters, or with characters outside printable ASCII, returns `invalid_request`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "examples": {
                  "missingCustomerId": {
                    "summary": "customerId missing",
                    "value": {
                      "message": "Bad Request: customerId query parameter is required",
                      "code": 1,
                      "errorCode": "invalid_request"
                    }
                  },
                  "idempotencyMismatch": {
                    "summary": "Idempotency-Key reused",
                    "value": {
                      "message": "Idempotency key reused with different request parameters or payload (or a legacy record).",
                      "code": 1,
                      "errorCode": "idempotency_mismatch"
                    }
                  },
                  "idempotencyKeyInvalid": {
                    "summary": "Idempotency-Key too long",
                    "value": {
                      "message": "Idempotency-Key must be 1 to 255 printable ASCII characters.",
                      "code": 1,
                      "errorCode": "invalid_request"
                    }
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/UnauthorizedCustomer"
          },
          "404": {
            "description": "No customer with this ID in the workspace.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "message": "customer with ID 078116d0069c32407b4f63 not found",
                  "code": 1,
                  "errorCode": "not_found"
                }
              }
            }
          },
          "409": {
            "$ref": "#/components/responses/IdempotencyConflict"
          },
          "413": {
            "$ref": "#/components/responses/PayloadTooLarge"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        },
        "operationId": "createCustomerDisable"
      }
    },
    "/key": {
      "post": {
        "summary": "Create Key",
        "description": "Create one or more license keys (`amountKeys`), optionally assigned to an existing or new customer. Requires an `admin` key or the `license:manage` grant; a product-bound key works only for its products. Counts against the plan's license (and, with `newCustomer`, customer) limits.",
        "tags": [
          "License Keys"
        ],
        "responses": {
          "200": {
            "description": "Keys created",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PostkeyResponse"
                },
                "example": {
                  "code": 0,
                  "key": "T8XTR-AI21B-2990H-85SB5",
                  "keys": [
                    "T8XTR-AI21B-2990H-85SB5"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Invalid request. Validation errors name the field: `Field '<name>' is required.` or `Field '<name>': <problem>`, and keep the legacy `error: { code: \"VALIDATION_ERROR\" }` object. A body that isn't valid JSON is also `invalid_request`. An `Idempotency-Key` reused with a different method, path, query or body returns `idempotency_mismatch`. An `Idempotency-Key` longer than 255 characters, or with characters outside printable ASCII, returns `invalid_request`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "examples": {
                  "missingField": {
                    "summary": "Required field missing",
                    "value": {
                      "success": false,
                      "message": "Field 'licenseKey' is required.",
                      "code": 1,
                      "errorCode": "invalid_request",
                      "error": {
                        "code": "VALIDATION_ERROR",
                        "message": "Field 'licenseKey' is required."
                      }
                    }
                  },
                  "tooShort": {
                    "summary": "Field under its minimum",
                    "value": {
                      "success": false,
                      "message": "Field 'productId': product ID must be at least 22 characters",
                      "code": 1,
                      "errorCode": "invalid_request",
                      "error": {
                        "code": "VALIDATION_ERROR",
                        "message": "Field 'productId': product ID must be at least 22 characters"
                      }
                    }
                  },
                  "invalidJson": {
                    "summary": "Body is not valid JSON",
                    "value": {
                      "message": "Request body is not valid JSON",
                      "code": 1,
                      "errorCode": "invalid_request"
                    }
                  },
                  "conflictingCustomer": {
                    "summary": "customerId and newCustomer both set",
                    "value": {
                      "message": "Cannot provide both customerId and newCustomer",
                      "code": 1,
                      "errorCode": "invalid_request"
                    }
                  },
                  "idempotencyMismatch": {
                    "summary": "Idempotency-Key reused for a different request",
                    "value": {
                      "message": "Idempotency key reused with different request parameters or payload (or a legacy record).",
                      "code": 1,
                      "errorCode": "idempotency_mismatch"
                    }
                  },
                  "idempotencyKeyInvalid": {
                    "summary": "Idempotency-Key too long",
                    "value": {
                      "message": "Idempotency-Key must be 1 to 255 printable ASCII characters.",
                      "code": 1,
                      "errorCode": "invalid_request"
                    }
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "description": "The `customerId` isn't in this workspace (`customer_not_found`), the plan doesn't allow more licenses, floating licenses or customers, or the product is archived (`forbidden`), or the key isn't allowed from this IP address.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "examples": {
                  "customerNotFound": {
                    "summary": "Customer not in this workspace",
                    "value": {
                      "message": "Customer not found",
                      "code": 1,
                      "errorCode": "customer_not_found"
                    }
                  },
                  "planLimit": {
                    "summary": "Plan limit",
                    "value": {
                      "message": "Adding 1 license key(s) would exceed the maximum allowed (100) for your current plan. Your workspace currently has 100.",
                      "code": 1,
                      "errorCode": "forbidden"
                    }
                  },
                  "ipNotAllowed": {
                    "summary": "IP allowlist",
                    "value": {
                      "message": "This API key is not allowed from this IP address",
                      "code": 1,
                      "errorCode": "ip_not_allowed"
                    }
                  }
                }
              }
            }
          },
          "404": {
            "description": "No active product with this ID in the API key's workspace.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "message": "Product not found or inactive",
                  "code": 1,
                  "errorCode": "product_not_found"
                }
              }
            }
          },
          "409": {
            "description": "A conflicting record was written at the same time (`conflict`, code 2); retry. A request with the same `Idempotency-Key` is still running (`idempotency_in_progress`), or an old idempotency record can't be replayed (`idempotency_legacy`).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "examples": {
                  "conflict": {
                    "summary": "Conflicting record",
                    "value": {
                      "message": "A conflicting record already exists. Please retry.",
                      "code": 2,
                      "errorCode": "conflict"
                    }
                  },
                  "inProgress": {
                    "summary": "Same Idempotency-Key still running",
                    "value": {
                      "message": "A request with this idempotency key is currently in progress.",
                      "code": 1,
                      "errorCode": "idempotency_in_progress"
                    }
                  }
                }
              }
            }
          },
          "413": {
            "$ref": "#/components/responses/PayloadTooLarge"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PostkeyRequest"
              },
              "examples": {
                "nodeLockedKey": {
                  "summary": "Create node-locked key",
                  "value": {
                    "productId": "4898d6707ffa56ed9b0eea",
                    "maxActivations": "1",
                    "customerId": "078116d0069c32407b4f63",
                    "allowedHosts": [
                      "MACHINE-A1B2C3"
                    ]
                  }
                },
                "newCustomer": {
                  "summary": "Create key for new customer",
                  "value": {
                    "productId": "4898d6707ffa56ed9b0eea",
                    "maxActivations": "5",
                    "newCustomer": {
                      "name": "John Doe",
                      "email": "john.doe@example.com"
                    }
                  }
                },
                "existingCustomer": {
                  "summary": "Create key for existing customer",
                  "value": {
                    "productId": "4898d6707ffa56ed9b0eea",
                    "maxActivations": "5",
                    "customerId": "078116d0069c32407b4f63"
                  }
                },
                "unassignedKey": {
                  "summary": "Create unassigned key",
                  "value": {
                    "productId": "4898d6707ffa56ed9b0eea",
                    "maxActivations": "5"
                  }
                },
                "floatingKey": {
                  "summary": "Create floating key with 10 seats",
                  "value": {
                    "productId": "4898d6707ffa56ed9b0eea",
                    "licenseType": "floating",
                    "maxConcurrentSessions": 10,
                    "heartbeatInterval": 60,
                    "sessionLeaseDuration": 300
                  }
                },
                "bulkKeys": {
                  "summary": "Create 25 unassigned keys",
                  "value": {
                    "productId": "4898d6707ffa56ed9b0eea",
                    "maxActivations": 2,
                    "amountKeys": 25
                  }
                }
              }
            }
          }
        },
        "operationId": "createKey",
        "parameters": [
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": false,
            "description": "Optional on this endpoint. A client-generated key (use a fresh UUID v4 per operation) that makes a retry return the original result instead of repeating the change. `X-Idempotency-Key` is accepted too. Records are kept for 24 hours; It must be 1 to 255 printable ASCII characters; a longer value, or one with other characters, returns `400` `invalid_request` before anything runs.",
            "schema": {
              "type": "string",
              "maxLength": 255,
              "example": "9b1deb4d-3b7d-4bad-9bdd-2b0d7b3dcb6d",
              "minLength": 1,
              "pattern": "^[\\x20-\\x7E]+$"
            }
          }
        ]
      },
      "get": {
        "summary": "Get Key Info",
        "description": "Get a license's details, devices and customer. Requires a `read-only` or `admin` key, or any key with the `license:read` grant; a product-bound key works only for its products. Only `admin` keys see the raw key, device IP addresses and the unmasked customer name and email. Send the license key in the `x-license-key` header rather than the query string, so it stays out of logs.",
        "tags": [
          "License Keys"
        ],
        "parameters": [
          {
            "name": "productId",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 22,
              "maxLength": 256,
              "example": "4898d6707ffa56ed9b0eea"
            },
            "description": "The product ID. 22–256 characters."
          },
          {
            "name": "x-license-key",
            "in": "header",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 20,
              "maxLength": 256
            },
            "description": "The license key (preferred over the query parameter). 20–256 characters."
          },
          {
            "name": "licenseKey",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 20,
              "maxLength": 256
            },
            "description": "The license key, if you don't send `x-license-key`. 20–256 characters."
          }
        ],
        "responses": {
          "200": {
            "description": "Successfully retrieved license key information",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/GetkeyResponse"
                },
                "example": {
                  "data": {
                    "license": {
                      "id": "wrl8Xq5v8dfGEQYe9bTcvT",
                      "key": "GG6GM-ZMN6C-AWMQQ-2A5X5",
                      "productId": "4898d6707ffa56ed9b0eea",
                      "maxActivations": null,
                      "activations": 1,
                      "activated": true,
                      "expirationDate": null,
                      "metadata": {
                        "features": {},
                        "is_trial": false
                      },
                      "allowedHosts": null,
                      "licenseType": "node-locked",
                      "maxConcurrentSessions": null,
                      "heartbeatInterval": 60,
                      "sessionLeaseDuration": 300,
                      "customerCanSelfReset": true,
                      "vendorDisabled": false,
                      "devices": [
                        {
                          "id": "TyqX7jyXsEqHsEATHJpVl6",
                          "hostId": "dev-machine-01",
                          "deviceTag": "N/A",
                          "ipAddress": "102.176.94.191",
                          "activationTime": "2026-08-18T01:04:00.642Z"
                        }
                      ],
                      "versionId": null,
                      "version": null,
                      "createdAt": "2026-08-15T23:22:24.208Z",
                      "updatedAt": "2026-08-15T23:22:24.216Z",
                      "billingArchivedAt": null,
                      "lastUsedAt": "2026-08-18T01:04:00.642Z",
                      "activationDate": "2026-08-18T01:04:00.642Z"
                    },
                    "customer": null
                  },
                  "code": 0
                }
              }
            }
          },
          "400": {
            "description": "`productId` or the license key missing, or a value outside its limits.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "examples": {
                  "missing": {
                    "summary": "productId or license key missing",
                    "value": {
                      "message": "Bad Request: productId and licenseKey are required (supply licenseKey via x-license-key header or query param)",
                      "code": 1,
                      "errorCode": "invalid_request"
                    }
                  },
                  "tooShort": {
                    "summary": "Value under its minimum",
                    "value": {
                      "success": false,
                      "message": "Field 'licenseKey': license key must be at least 20 characters",
                      "code": 1,
                      "errorCode": "invalid_request",
                      "error": {
                        "code": "VALIDATION_ERROR",
                        "message": "Field 'licenseKey': license key must be at least 20 characters"
                      }
                    }
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "description": "The API key isn't allowed from this IP address.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "message": "This API key is not allowed from this IP address",
                  "code": 1,
                  "errorCode": "ip_not_allowed"
                }
              }
            }
          },
          "404": {
            "description": "No license with this key for the product, or the product doesn't exist or is inactive.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "examples": {
                  "licenseNotFound": {
                    "summary": "No license with this key for the product",
                    "value": {
                      "message": "License key not found",
                      "code": 1,
                      "errorCode": "license_not_found"
                    }
                  },
                  "productNotFound": {
                    "summary": "Product missing or inactive",
                    "value": {
                      "message": "Product not found or inactive",
                      "code": 1,
                      "errorCode": "product_not_found"
                    }
                  }
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        },
        "operationId": "getKey"
      },
      "patch": {
        "summary": "Update License Key",
        "description": "Update a license's settings, assign an existing customer, or create and assign a new one. Send only the fields to change. Requires an `admin` key or the `license:manage` grant; a product-bound key works only for its products.",
        "operationId": "updateLicenseKey",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "productId",
                  "licenseKey"
                ],
                "description": "Send only the fields to change.",
                "properties": {
                  "productId": {
                    "type": "string",
                    "minLength": 22,
                    "maxLength": 256,
                    "example": "4898d6707ffa56ed9b0eea",
                    "description": "The product the license belongs to. 22–256 characters."
                  },
                  "licenseKey": {
                    "type": "string",
                    "minLength": 20,
                    "maxLength": 256,
                    "example": "A8E2K-9F1BC-3D4GH-7J2KM",
                    "description": "The license key to update. 20–256 characters."
                  },
                  "maxActivations": {
                    "oneOf": [
                      {
                        "type": "integer",
                        "minimum": 0,
                        "maximum": 1000000
                      },
                      {
                        "type": "string",
                        "maxLength": 20,
                        "pattern": "^([0-9]+|unlimited)?$"
                      }
                    ],
                    "nullable": true,
                    "example": 3,
                    "description": "New activation limit: a whole number from 0 to 1,000,000 (JSON number or string of digits), `\"unlimited\"`, or null for unlimited. Negative, decimal or other text values return 400 `invalid_request` naming the field; an empty string returns 400 `Invalid maxActivations value`."
                  },
                  "expiryDate": {
                    "type": "string",
                    "format": "date-time",
                    "maxLength": 64,
                    "nullable": true,
                    "description": "New ISO 8601 expiry date, up to 64 characters. Null or an empty string removes the expiry (the key never expires); omit the field to keep the current one."
                  },
                  "customerId": {
                    "type": "string",
                    "minLength": 22,
                    "maxLength": 256,
                    "example": "078116d0069c32407b4f63",
                    "description": "An existing customer in this workspace to assign, or null to unassign the current customer. 22–256 characters.",
                    "nullable": true
                  },
                  "newCustomer": {
                    "type": "object",
                    "description": "Create a customer and assign the license to them. Can't be combined with `customerId`.",
                    "properties": {
                      "name": {
                        "type": "string",
                        "minLength": 3,
                        "maxLength": 255,
                        "example": "Jane Doe",
                        "description": "Customer name. 3–255 characters after trimming; can't be a URL or contain control characters."
                      },
                      "email": {
                        "type": "string",
                        "format": "email",
                        "minLength": 3,
                        "maxLength": 320,
                        "example": "jane@example.com",
                        "description": "Optional. A valid email address, 3–320 characters."
                      }
                    },
                    "required": [
                      "name"
                    ]
                  },
                  "metadata": {
                    "type": "object",
                    "additionalProperties": true,
                    "description": "Replaces the license's metadata. At most 10,000 characters when serialized as JSON.",
                    "example": {
                      "is_trial": false,
                      "features": {
                        "pro_mode": true
                      }
                    }
                  },
                  "versionId": {
                    "type": "string",
                    "maxLength": 64,
                    "nullable": true,
                    "description": "Product version ID (up to 64 characters), or null to clear it."
                  },
                  "allowedHosts": {
                    "type": "array",
                    "maxItems": 100,
                    "items": {
                      "type": "string",
                      "maxLength": 255
                    },
                    "nullable": true,
                    "description": "Replaces the allowed host IDs; null clears the restriction. At most 100 host IDs of up to 255 characters each.",
                    "example": [
                      "mac-studio-m2"
                    ]
                  },
                  "licenseType": {
                    "type": "string",
                    "enum": [
                      "node-locked",
                      "floating"
                    ],
                    "description": "The license type."
                  },
                  "maxConcurrentSessions": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 1000000,
                    "nullable": true,
                    "description": "Floating licenses: concurrent seats, 1–1,000,000. Null or omitted means no seat limit."
                  },
                  "heartbeatInterval": {
                    "type": "integer",
                    "minimum": 60,
                    "maximum": 86400,
                    "nullable": true,
                    "description": "Floating licenses: seconds between heartbeats, 60–86,400. Null means the default of 60."
                  },
                  "sessionLeaseDuration": {
                    "type": "integer",
                    "minimum": 300,
                    "maximum": 31536000,
                    "nullable": true,
                    "description": "Floating licenses: seat lease in seconds, 300–31,536,000. Null means the default of 300."
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "License updated",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 0
                    },
                    "message": {
                      "type": "string",
                      "example": "License key updated successfully"
                    },
                    "affectedCount": {
                      "type": "integer",
                      "example": 1
                    }
                  }
                },
                "example": {
                  "code": 0,
                  "message": "License key updated successfully",
                  "affectedCount": 1
                }
              }
            }
          },
          "400": {
            "description": "Invalid request. Validation errors name the field: `Field '<name>' is required.` or `Field '<name>': <problem>`, and keep the legacy `error: { code: \"VALIDATION_ERROR\" }` object. A body that isn't valid JSON is also `invalid_request`. An `Idempotency-Key` reused with a different method, path, query or body returns `idempotency_mismatch`. An `Idempotency-Key` longer than 255 characters, or with characters outside printable ASCII, returns `invalid_request`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "examples": {
                  "missingField": {
                    "summary": "Required field missing",
                    "value": {
                      "success": false,
                      "message": "Field 'licenseKey' is required.",
                      "code": 1,
                      "errorCode": "invalid_request",
                      "error": {
                        "code": "VALIDATION_ERROR",
                        "message": "Field 'licenseKey' is required."
                      }
                    }
                  },
                  "tooShort": {
                    "summary": "Field under its minimum",
                    "value": {
                      "success": false,
                      "message": "Field 'productId': product ID must be at least 22 characters",
                      "code": 1,
                      "errorCode": "invalid_request",
                      "error": {
                        "code": "VALIDATION_ERROR",
                        "message": "Field 'productId': product ID must be at least 22 characters"
                      }
                    }
                  },
                  "invalidJson": {
                    "summary": "Body is not valid JSON",
                    "value": {
                      "message": "Request body is not valid JSON",
                      "code": 1,
                      "errorCode": "invalid_request"
                    }
                  },
                  "conflictingCustomer": {
                    "summary": "customerId and newCustomer both set",
                    "value": {
                      "message": "Cannot provide both customerId and newCustomer",
                      "code": 1,
                      "errorCode": "invalid_request"
                    }
                  },
                  "badMaxActivations": {
                    "summary": "maxActivations not a number",
                    "value": {
                      "message": "Invalid maxActivations value",
                      "code": 1,
                      "errorCode": "invalid_request"
                    }
                  },
                  "idempotencyMismatch": {
                    "summary": "Idempotency-Key reused for a different request",
                    "value": {
                      "message": "Idempotency key reused with different request parameters or payload (or a legacy record).",
                      "code": 1,
                      "errorCode": "idempotency_mismatch"
                    }
                  },
                  "idempotencyKeyInvalid": {
                    "summary": "Idempotency-Key too long",
                    "value": {
                      "message": "Idempotency-Key must be 1 to 255 printable ASCII characters.",
                      "code": 1,
                      "errorCode": "invalid_request"
                    }
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "description": "The `customerId` isn't in this workspace, a plan limit or rule refuses the change (`forbidden`), the key has no workspace, or the key isn't allowed from this IP address.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "examples": {
                  "customerNotFound": {
                    "summary": "Customer not in this workspace",
                    "value": {
                      "message": "Customer not found",
                      "code": 1,
                      "errorCode": "customer_not_found"
                    }
                  },
                  "ipNotAllowed": {
                    "summary": "IP allowlist",
                    "value": {
                      "message": "This API key is not allowed from this IP address",
                      "code": 1,
                      "errorCode": "ip_not_allowed"
                    }
                  },
                  "noWorkspace": {
                    "summary": "Key without a workspace",
                    "value": {
                      "message": "This API key is not associated with a workspace",
                      "code": 1,
                      "errorCode": "api_key_no_workspace"
                    }
                  }
                }
              }
            }
          },
          "404": {
            "description": "No license with this key for the product, or the product doesn't exist or is inactive.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "examples": {
                  "licenseNotFound": {
                    "summary": "No license with this key for the product",
                    "value": {
                      "message": "License key not found",
                      "code": 1,
                      "errorCode": "license_not_found"
                    }
                  },
                  "productNotFound": {
                    "summary": "Product missing or inactive",
                    "value": {
                      "message": "Product not found or inactive",
                      "code": 1,
                      "errorCode": "product_not_found"
                    }
                  }
                }
              }
            }
          },
          "409": {
            "description": "A conflicting record was written at the same time (`conflict`, code 2); retry. A request with the same `Idempotency-Key` is still running (`idempotency_in_progress`), or an old idempotency record can't be replayed (`idempotency_legacy`).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "examples": {
                  "conflict": {
                    "summary": "Conflicting record",
                    "value": {
                      "message": "A conflicting record already exists. Please retry.",
                      "code": 2,
                      "errorCode": "conflict"
                    }
                  },
                  "inProgress": {
                    "summary": "Same Idempotency-Key still running",
                    "value": {
                      "message": "A request with this idempotency key is currently in progress.",
                      "code": 1,
                      "errorCode": "idempotency_in_progress"
                    }
                  }
                }
              }
            }
          },
          "413": {
            "$ref": "#/components/responses/PayloadTooLarge"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        },
        "parameters": [
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": false,
            "description": "Optional on this endpoint. A client-generated key (use a fresh UUID v4 per operation) that makes a retry return the original result instead of repeating the change. `X-Idempotency-Key` is accepted too. Records are kept for 24 hours; It must be 1 to 255 printable ASCII characters; a longer value, or one with other characters, returns `400` `invalid_request` before anything runs.",
            "schema": {
              "type": "string",
              "maxLength": 255,
              "example": "9b1deb4d-3b7d-4bad-9bdd-2b0d7b3dcb6d",
              "minLength": 1,
              "pattern": "^[\\x20-\\x7E]+$"
            }
          }
        ]
      },
      "delete": {
        "summary": "Delete Key",
        "description": "Permanently delete a license key and its device activations. Requires an `admin` key, or the `license:delete` (or `license:*`) grant; `license:manage` alone isn't enough. A product-bound key works only for its products.",
        "operationId": "deleteLicenseKey",
        "tags": [
          "License Keys"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": false,
            "description": "Optional on this endpoint. A client-generated key (use a fresh UUID v4 per operation) that makes a retry return the original result instead of repeating the change. `X-Idempotency-Key` is accepted too. Records are kept for 24 hours; It must be 1 to 255 printable ASCII characters; a longer value, or one with other characters, returns `400` `invalid_request` before anything runs.",
            "schema": {
              "type": "string",
              "maxLength": 255,
              "example": "9b1deb4d-3b7d-4bad-9bdd-2b0d7b3dcb6d",
              "minLength": 1,
              "pattern": "^[\\x20-\\x7E]+$"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/DeletekeyRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "License key deleted",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DeletekeyResponse"
                },
                "example": {
                  "message": "Key deleted",
                  "code": 0
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequestIdempotent"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "description": "The API key isn't allowed from this IP address.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "message": "This API key is not allowed from this IP address",
                  "code": 1,
                  "errorCode": "ip_not_allowed"
                }
              }
            }
          },
          "404": {
            "description": "No license with this key for the product, or the product doesn't exist or is inactive.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "examples": {
                  "licenseNotFound": {
                    "summary": "No license with this key for the product",
                    "value": {
                      "message": "License key not found",
                      "code": 1,
                      "errorCode": "license_not_found"
                    }
                  },
                  "productNotFound": {
                    "summary": "Product missing or inactive",
                    "value": {
                      "message": "Product not found or inactive",
                      "code": 1,
                      "errorCode": "product_not_found"
                    }
                  }
                }
              }
            }
          },
          "409": {
            "$ref": "#/components/responses/IdempotencyConflict"
          },
          "413": {
            "$ref": "#/components/responses/PayloadTooLarge"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        }
      }
    },
    "/key/activate": {
      "post": {
        "summary": "Activate Key",
        "description": "Activate a node-locked license on a device. Requires a `client` or `admin` key, or the `license:activate` grant; a product-bound key works only for its products. A `client` key may include `licensee` to claim an unassigned license.",
        "tags": [
          "License Keys"
        ],
        "responses": {
          "200": {
            "description": "License key activated successfully",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PostkeyactivateResponse"
                },
                "example": {
                  "code": 0,
                  "message": "License valid",
                  "expirationDate": "2027-03-01T00:00:00.000Z",
                  "licenseeName": "J*** D**",
                  "licenseeEmail": "j***@example.com",
                  "metadata": {
                    "features": {
                      "Pro Mode": true
                    },
                    "hostId": "mac-studio-m2"
                  },
                  "versionId": null
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequestIdempotent"
          },
          "401": {
            "description": "The API key is missing, invalid or not allowed here (`api_key_missing` / `api_key_invalid`), or the key was accepted but the license can't be used: unknown key, expired, blocked, a floating license, assigned to a disabled customer, device not in `allowedHosts`, or the claimed licensee's customer is disabled. All license cases return the same `license_invalid_or_forbidden` body so keys can't be probed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "examples": {
                  "licenseRejected": {
                    "summary": "License can't be used",
                    "value": {
                      "message": "Invalid license key or insufficient permissions",
                      "code": 1,
                      "errorCode": "license_invalid_or_forbidden"
                    }
                  },
                  "apiKeyInvalid": {
                    "summary": "API key invalid or not allowed",
                    "value": {
                      "message": "Invalid API key or insufficient permissions",
                      "code": 1,
                      "errorCode": "api_key_invalid"
                    }
                  }
                }
              }
            }
          },
          "402": {
            "description": "The vendor's workspace subscription doesn't cover this activation: restricted mode, a new device or licensee claim during the continuity period, or a license archived when the plan lapsed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "message": "Workspace subscription required for this license operation",
                  "code": 2,
                  "errorCode": "subscription_required"
                }
              }
            }
          },
          "403": {
            "description": "The license is active on `maxActivations` devices (`activation_limit_reached`), the plan doesn't allow creating the claimed licensee (`licensee_not_allowed`), or the API key isn't allowed from this IP address.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "examples": {
                  "activationLimit": {
                    "summary": "Activation limit reached",
                    "value": {
                      "message": "Activation limit reached",
                      "code": 2,
                      "errorCode": "activation_limit_reached"
                    }
                  },
                  "licenseeNotAllowed": {
                    "summary": "Licensee claim not allowed",
                    "value": {
                      "message": "Unable to assign licensee for this plan",
                      "code": 2,
                      "errorCode": "licensee_not_allowed"
                    }
                  },
                  "ipNotAllowed": {
                    "summary": "IP allowlist",
                    "value": {
                      "message": "This API key is not allowed from this IP address",
                      "code": 1,
                      "errorCode": "ip_not_allowed"
                    }
                  }
                }
              }
            }
          },
          "404": {
            "description": "No active product with this ID in the API key's workspace.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "message": "Product not found or inactive",
                  "code": 1,
                  "errorCode": "product_not_found"
                }
              }
            }
          },
          "409": {
            "$ref": "#/components/responses/IdempotencyConflict"
          },
          "413": {
            "$ref": "#/components/responses/PayloadTooLarge"
          },
          "429": {
            "description": "Rate limited. On this endpoint the plan limit, the per-IP share for `client` keys and the per-action limit all answer with the nested shape and `code: 3`. Calls for the same license key are also limited to 5 per minute (shared with deactivate and checkout), answered as `Too many activation attempts. Please try again later.` in the same shape. The Free-plan monthly quota answers `quota_exceeded` with `code: 1`, and the Idempotency-Key budget answers the flat `rate_limited` body. Honor `Retry-After`; see Rate Limits.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "examples": {
                  "rateLimited": {
                    "summary": "Plan, per-IP or per-action limit",
                    "value": {
                      "success": false,
                      "message": "Too many requests. Please try again later.",
                      "code": 3,
                      "errorCode": "rate_limited",
                      "error": {
                        "code": "RATE_LIMIT_EXCEEDED",
                        "message": "Too many requests. Please try again later."
                      }
                    }
                  },
                  "perLicense": {
                    "summary": "Per-license limit",
                    "value": {
                      "success": false,
                      "message": "Too many activation attempts. Please try again later.",
                      "code": 3,
                      "errorCode": "rate_limited",
                      "error": {
                        "code": "RATE_LIMIT_EXCEEDED",
                        "message": "Too many activation attempts. Please try again later."
                      }
                    }
                  },
                  "quotaExceeded": {
                    "summary": "Free-plan monthly quota",
                    "value": {
                      "message": "Monthly API request limit reached. Upgrade your plan to raise your limit.",
                      "code": 1,
                      "errorCode": "quota_exceeded"
                    }
                  }
                }
              }
            }
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PostkeyactivateRequest"
              }
            }
          }
        },
        "operationId": "createKeyActivate",
        "parameters": [
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": false,
            "description": "Optional on this endpoint. A client-generated key (use a fresh UUID v4 per operation) that makes a retry return the original result instead of repeating the change. `X-Idempotency-Key` is accepted too. Records are kept for 24 hours; It must be 1 to 255 printable ASCII characters; a longer value, or one with other characters, returns `400` `invalid_request` before anything runs.",
            "schema": {
              "type": "string",
              "maxLength": 255,
              "example": "9b1deb4d-3b7d-4bad-9bdd-2b0d7b3dcb6d",
              "minLength": 1,
              "pattern": "^[\\x20-\\x7E]+$"
            }
          }
        ]
      }
    },
    "/key/deactivate": {
      "post": {
        "summary": "Deactivate Key",
        "description": "Remove a device activation to free its slot. Requires a `client` or `admin` key, or the `license:activate` grant; a product-bound key works only for its products. `client` keys must send `hostId` and can only remove that device; an admin key may omit it to remove every device.",
        "tags": [
          "License Keys"
        ],
        "responses": {
          "200": {
            "description": "Device(s) deactivated",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PostkeydeactivateResponse"
                },
                "example": {
                  "message": "Key deactivated",
                  "code": 0,
                  "devicesRemoved": 1
                }
              }
            }
          },
          "400": {
            "description": "Invalid request. Validation errors name the field: `Field '<name>' is required.` or `Field '<name>': <problem>`, and keep the legacy `error: { code: \"VALIDATION_ERROR\" }` object. A body that isn't valid JSON is also `invalid_request`. An `Idempotency-Key` reused with a different method, path, query or body returns `idempotency_mismatch`. An `Idempotency-Key` longer than 255 characters, or with characters outside printable ASCII, returns `invalid_request`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "examples": {
                  "missingField": {
                    "summary": "Required field missing",
                    "value": {
                      "success": false,
                      "message": "Field 'licenseKey' is required.",
                      "code": 1,
                      "errorCode": "invalid_request",
                      "error": {
                        "code": "VALIDATION_ERROR",
                        "message": "Field 'licenseKey' is required."
                      }
                    }
                  },
                  "tooShort": {
                    "summary": "Field under its minimum",
                    "value": {
                      "success": false,
                      "message": "Field 'productId': product ID must be at least 22 characters",
                      "code": 1,
                      "errorCode": "invalid_request",
                      "error": {
                        "code": "VALIDATION_ERROR",
                        "message": "Field 'productId': product ID must be at least 22 characters"
                      }
                    }
                  },
                  "invalidJson": {
                    "summary": "Body is not valid JSON",
                    "value": {
                      "message": "Request body is not valid JSON",
                      "code": 1,
                      "errorCode": "invalid_request"
                    }
                  },
                  "hostIdRequired": {
                    "summary": "client key without hostId",
                    "value": {
                      "message": "hostId is required for client-scoped deactivation",
                      "code": 1,
                      "errorCode": "invalid_request"
                    }
                  },
                  "idempotencyMismatch": {
                    "summary": "Idempotency-Key reused for a different request",
                    "value": {
                      "message": "Idempotency key reused with different request parameters or payload (or a legacy record).",
                      "code": 1,
                      "errorCode": "idempotency_mismatch"
                    }
                  },
                  "idempotencyKeyInvalid": {
                    "summary": "Idempotency-Key too long",
                    "value": {
                      "message": "Idempotency-Key must be 1 to 255 printable ASCII characters.",
                      "code": 1,
                      "errorCode": "invalid_request"
                    }
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "description": "The API key isn't allowed from this IP address.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "message": "This API key is not allowed from this IP address",
                  "code": 1,
                  "errorCode": "ip_not_allowed"
                }
              }
            }
          },
          "404": {
            "description": "No license with this key for the product, the license is blocked, `hostId` isn't activated on it, or the product doesn't exist or is inactive.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "examples": {
                  "licenseNotFound": {
                    "summary": "No license with this key for the product",
                    "value": {
                      "message": "License key not found",
                      "code": 1,
                      "errorCode": "license_not_found"
                    }
                  },
                  "productNotFound": {
                    "summary": "Product missing or inactive",
                    "value": {
                      "message": "Product not found or inactive",
                      "code": 1,
                      "errorCode": "product_not_found"
                    }
                  }
                }
              }
            }
          },
          "409": {
            "description": "The device holds an unexpired offline license, so its activation is kept until `offlineValidUntil` (`offline_license_held`). A dashboard reset still frees it. A request with the same `Idempotency-Key` is still running (`idempotency_in_progress`), or an old idempotency record can't be replayed (`idempotency_legacy`).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "examples": {
                  "offlineLicenseHeld": {
                    "summary": "Device holds an offline license",
                    "value": {
                      "message": "This device holds an offline license, so its activation is kept until that license expires.",
                      "code": 1,
                      "errorCode": "offline_license_held",
                      "offlineValidUntil": "2026-12-01T00:00:00.000Z"
                    }
                  },
                  "inProgress": {
                    "summary": "Same Idempotency-Key still running",
                    "value": {
                      "message": "A request with this idempotency key is currently in progress.",
                      "code": 1,
                      "errorCode": "idempotency_in_progress"
                    }
                  }
                }
              }
            }
          },
          "413": {
            "$ref": "#/components/responses/PayloadTooLarge"
          },
          "429": {
            "description": "Rate limited. The plan's per-minute limit (and, for `client` keys, the per-IP share) answers `rate_limited`; on the Free plan the monthly quota answers `quota_exceeded`. Calls for the same license key are also limited to 5 per minute (shared with activate and checkout), answered `Too many deactivation attempts. Please try again later.` with `rate_limited`. Honor `Retry-After`; see Rate Limits.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "examples": {
                  "rateLimited": {
                    "summary": "Per-minute limit",
                    "value": {
                      "message": "Too many requests. Please try again later.",
                      "code": 1,
                      "errorCode": "rate_limited"
                    }
                  },
                  "quotaExceeded": {
                    "summary": "Free-plan monthly quota",
                    "value": {
                      "message": "Monthly API request limit reached. Upgrade your plan to raise your limit.",
                      "code": 1,
                      "errorCode": "quota_exceeded"
                    }
                  }
                }
              }
            }
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PostkeydeactivateRequest"
              }
            }
          }
        },
        "operationId": "createKeyDeactivate",
        "parameters": [
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": false,
            "description": "Optional on this endpoint. A client-generated key (use a fresh UUID v4 per operation) that makes a retry return the original result instead of repeating the change. `X-Idempotency-Key` is accepted too. Records are kept for 24 hours; It must be 1 to 255 printable ASCII characters; a longer value, or one with other characters, returns `400` `invalid_request` before anything runs.",
            "schema": {
              "type": "string",
              "maxLength": 255,
              "example": "9b1deb4d-3b7d-4bad-9bdd-2b0d7b3dcb6d",
              "minLength": 1,
              "pattern": "^[\\x20-\\x7E]+$"
            }
          }
        ]
      }
    },
    "/key/block": {
      "post": {
        "summary": "Block Key",
        "description": "Block a license: activation, signing, checkout and heartbeats with it fail until it is unblocked. Existing device activations stay recorded. Requires an `admin` key or the `license:manage` grant; a product-bound key works only for its products.",
        "tags": [
          "License Keys"
        ],
        "responses": {
          "200": {
            "description": "License key blocked successfully",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PostkeyblockResponse"
                },
                "example": {
                  "message": "Key blocked",
                  "code": 0
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequestIdempotent"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "description": "The API key isn't allowed from this IP address.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "message": "This API key is not allowed from this IP address",
                  "code": 1,
                  "errorCode": "ip_not_allowed"
                }
              }
            }
          },
          "404": {
            "description": "No license with this key for the product, or the product doesn't exist or is inactive.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "examples": {
                  "licenseNotFound": {
                    "summary": "No license with this key for the product",
                    "value": {
                      "message": "License key not found",
                      "code": 1,
                      "errorCode": "license_not_found"
                    }
                  },
                  "productNotFound": {
                    "summary": "Product missing or inactive",
                    "value": {
                      "message": "Product not found or inactive",
                      "code": 1,
                      "errorCode": "product_not_found"
                    }
                  }
                }
              }
            }
          },
          "409": {
            "$ref": "#/components/responses/IdempotencyConflict"
          },
          "413": {
            "$ref": "#/components/responses/PayloadTooLarge"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PostkeyblockRequest"
              }
            }
          }
        },
        "operationId": "createKeyBlock",
        "parameters": [
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": false,
            "description": "Optional on this endpoint. A client-generated key (use a fresh UUID v4 per operation) that makes a retry return the original result instead of repeating the change. `X-Idempotency-Key` is accepted too. Records are kept for 24 hours; It must be 1 to 255 printable ASCII characters; a longer value, or one with other characters, returns `400` `invalid_request` before anything runs.",
            "schema": {
              "type": "string",
              "maxLength": 255,
              "example": "9b1deb4d-3b7d-4bad-9bdd-2b0d7b3dcb6d",
              "minLength": 1,
              "pattern": "^[\\x20-\\x7E]+$"
            }
          }
        ]
      }
    },
    "/key/unblock": {
      "post": {
        "summary": "Unblock Key",
        "description": "Re-enable a blocked license. Requires an `admin` key or the `license:manage` grant; a product-bound key works only for its products. Refused while the workspace is in billing continuity or restricted mode, and for licenses archived when the plan lapsed.",
        "tags": [
          "License Keys"
        ],
        "responses": {
          "200": {
            "description": "License key unblocked successfully",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PostkeyunblockResponse"
                },
                "example": {
                  "message": "Key unblocked",
                  "code": 0
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequestIdempotent"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "description": "The workspace must renew or finish its Free-plan resource selection first, or the license was archived when the plan lapsed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "examples": {
                  "planSelectionRequired": {
                    "summary": "Workspace in continuity or restricted mode",
                    "value": {
                      "message": "Renew or complete the Free-plan resource selection before re-enabling licenses",
                      "code": 2,
                      "errorCode": "plan_selection_required"
                    }
                  },
                  "licenseArchived": {
                    "summary": "License archived",
                    "value": {
                      "message": "Archived licenses cannot be re-enabled",
                      "code": 2,
                      "errorCode": "license_archived"
                    }
                  }
                }
              }
            }
          },
          "403": {
            "description": "The API key isn't allowed from this IP address.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "message": "This API key is not allowed from this IP address",
                  "code": 1,
                  "errorCode": "ip_not_allowed"
                }
              }
            }
          },
          "404": {
            "description": "No license with this key for the product, or the product doesn't exist or is inactive.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "examples": {
                  "licenseNotFound": {
                    "summary": "No license with this key for the product",
                    "value": {
                      "message": "License key not found",
                      "code": 1,
                      "errorCode": "license_not_found"
                    }
                  },
                  "productNotFound": {
                    "summary": "Product missing or inactive",
                    "value": {
                      "message": "Product not found or inactive",
                      "code": 1,
                      "errorCode": "product_not_found"
                    }
                  }
                }
              }
            }
          },
          "409": {
            "$ref": "#/components/responses/IdempotencyConflict"
          },
          "413": {
            "$ref": "#/components/responses/PayloadTooLarge"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PostkeyunblockRequest"
              }
            }
          }
        },
        "operationId": "createKeyUnblock",
        "parameters": [
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": false,
            "description": "Optional on this endpoint. A client-generated key (use a fresh UUID v4 per operation) that makes a retry return the original result instead of repeating the change. `X-Idempotency-Key` is accepted too. Records are kept for 24 hours; It must be 1 to 255 printable ASCII characters; a longer value, or one with other characters, returns `400` `invalid_request` before anything runs.",
            "schema": {
              "type": "string",
              "maxLength": 255,
              "example": "9b1deb4d-3b7d-4bad-9bdd-2b0d7b3dcb6d",
              "minLength": 1,
              "pattern": "^[\\x20-\\x7E]+$"
            }
          }
        ]
      }
    },
    "/key/checkout": {
      "post": {
        "summary": "Checkout Floating Session",
        "description": "Check out a floating seat for a host. Requires a `client` or `admin` key, or the `license:activate` grant; a product-bound key works only for its products. Ignores `Idempotency-Key`. A repeat checkout for a host that still has an active session extends it and must prove possession with `timestamp` and `signature`.",
        "tags": [
          "License Keys"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "productId": {
                    "type": "string",
                    "minLength": 22,
                    "maxLength": 256,
                    "example": "4898d6707ffa56ed9b0eea",
                    "description": "The product ID. 22–256 characters."
                  },
                  "licenseKey": {
                    "type": "string",
                    "minLength": 20,
                    "maxLength": 256,
                    "example": "A8E2K-9F1BC-3D4GH-7J2KM",
                    "description": "The license key. 20–256 characters."
                  },
                  "hostId": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 64,
                    "example": "mac-studio-m2",
                    "description": "Unique host or device identifier. Required. 1–64 characters."
                  },
                  "deviceTag": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 64,
                    "example": "MacBook Pro",
                    "description": "Optional human-readable device label. 1–64 characters."
                  },
                  "userIdentifier": {
                    "type": "string",
                    "maxLength": 255,
                    "description": "Optional user identifier recorded for audits, up to 255 characters."
                  },
                  "timestamp": {
                    "oneOf": [
                      {
                        "type": "string",
                        "maxLength": 128
                      },
                      {
                        "type": "number"
                      }
                    ],
                    "description": "Only for extending this host's existing active session: the session's current `nextNonce` from the previous checkout or heartbeat. A string of up to 128 characters (or a number)."
                  },
                  "signature": {
                    "type": "string",
                    "minLength": 64,
                    "maxLength": 64,
                    "description": "Only for extending an existing session: HMAC-SHA256 of `\"<sessionId>:<timestamp>\"` keyed with the previous `sessionSecret`. Exactly 64 hexadecimal characters."
                  }
                },
                "required": [
                  "productId",
                  "licenseKey",
                  "hostId"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Seat checked out successfully",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 0
                    },
                    "message": {
                      "type": "string",
                      "description": "\"Seat checked out\", or \"Existing session extended\" for a signed repeat checkout."
                    },
                    "sessionId": {
                      "type": "string"
                    },
                    "sessionSecret": {
                      "type": "string",
                      "description": "A temporary cryptographic secret returned on checkout, used by the client to sign subsequent heartbeat and checkin requests."
                    },
                    "nextNonce": {
                      "type": "string",
                      "description": "The initial rotating cryptographic nonce generated by the server. Must be passed in the subsequent heartbeat or checkin request as the timestamp parameter."
                    },
                    "expiresAt": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "heartbeatInterval": {
                      "type": "integer",
                      "description": "Seconds between heartbeats (60 unless the license sets another value)."
                    },
                    "metadata": {
                      "type": "object",
                      "nullable": true,
                      "additionalProperties": true,
                      "description": "The license metadata (or null)."
                    },
                    "expirationDate": {
                      "type": "string",
                      "format": "date-time",
                      "nullable": true,
                      "description": "When the license itself expires (ISO 8601), or null if it never expires. Not to be confused with `expiresAt`, the seat lease."
                    },
                    "currentSessions": {
                      "type": "integer"
                    },
                    "maxSessions": {
                      "type": "integer",
                      "nullable": true,
                      "description": "The license's seat limit; null means no limit."
                    },
                    "licenseeName": {
                      "type": "string",
                      "description": "Masked name of the assigned customer. Omitted when the license has no customer."
                    },
                    "licenseeEmail": {
                      "type": "string",
                      "description": "Masked email of the assigned customer. Omitted when the license has no customer."
                    }
                  }
                },
                "example": {
                  "code": 0,
                  "message": "Seat checked out",
                  "sessionId": "Tq3bXhW9sYk2LmN4pR7sT9",
                  "sessionSecret": "3f1c0e…(64 hex characters)",
                  "nextNonce": "Vb2kQ9xLmN4pR7sT9vW1yZ3a",
                  "expiresAt": "2026-11-07T10:05:00.000Z",
                  "heartbeatInterval": 60,
                  "metadata": {},
                  "expirationDate": null,
                  "currentSessions": 3,
                  "maxSessions": 10
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "description": "The API key is missing, invalid or not allowed here (`api_key_missing` / `api_key_invalid`); the license can't be used: unknown, expired, blocked, not floating, or assigned to a disabled customer (`license_invalid_or_forbidden`); or a repeat checkout for this host has a missing or wrong signature (`session_invalid`).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "examples": {
                  "licenseRejected": {
                    "summary": "License can't be used",
                    "value": {
                      "message": "Invalid license key or insufficient permissions",
                      "code": 1,
                      "errorCode": "license_invalid_or_forbidden"
                    }
                  },
                  "sessionInvalid": {
                    "summary": "Repeat checkout without a valid signature",
                    "value": {
                      "message": "Invalid license or session",
                      "code": 1,
                      "errorCode": "session_invalid"
                    }
                  },
                  "apiKeyInvalid": {
                    "summary": "API key invalid or not allowed",
                    "value": {
                      "message": "Invalid API key or insufficient permissions",
                      "code": 1,
                      "errorCode": "api_key_invalid"
                    }
                  }
                }
              }
            }
          },
          "402": {
            "description": "The vendor's workspace subscription doesn't cover this checkout: restricted mode, a license archived when the plan lapsed, or a new session during the continuity period.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "examples": {
                  "checkout": {
                    "summary": "Restricted or archived",
                    "value": {
                      "message": "Workspace subscription required for floating license checkout",
                      "code": 2,
                      "errorCode": "subscription_required"
                    }
                  },
                  "newSession": {
                    "summary": "New session during continuity",
                    "value": {
                      "message": "Workspace subscription required for a new floating session",
                      "code": 2,
                      "errorCode": "subscription_required"
                    }
                  }
                }
              }
            }
          },
          "403": {
            "description": "Every seat is in use (`floating_seats_full`, code 4, with `currentSessions` and `maxSessions`), the API key has no workspace, or it isn't allowed from this IP address.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "examples": {
                  "seatsFull": {
                    "summary": "No seats left",
                    "value": {
                      "message": "No available seats. 10/10 concurrent sessions active.",
                      "code": 4,
                      "errorCode": "floating_seats_full",
                      "currentSessions": 10,
                      "maxSessions": 10
                    }
                  },
                  "ipNotAllowed": {
                    "summary": "IP allowlist",
                    "value": {
                      "message": "This API key is not allowed from this IP address",
                      "code": 1,
                      "errorCode": "ip_not_allowed"
                    }
                  }
                }
              }
            }
          },
          "404": {
            "description": "No active product with this ID in the API key's workspace.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "message": "Product not found or inactive",
                  "code": 1,
                  "errorCode": "product_not_found"
                }
              }
            }
          },
          "413": {
            "$ref": "#/components/responses/PayloadTooLarge"
          },
          "429": {
            "description": "Rate limited. On this endpoint the plan limit, the per-IP share for `client` keys and the per-action limit all answer with the nested shape and `code: 3`. Calls for the same license key are also limited to 5 per minute (shared with deactivate and checkout), answered as `Too many checkout attempts. Please try again later.` in the same shape. The Free-plan monthly quota answers `quota_exceeded` with `code: 1`, and the Idempotency-Key budget answers the flat `rate_limited` body. Honor `Retry-After`; see Rate Limits.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "examples": {
                  "rateLimited": {
                    "summary": "Plan, per-IP or per-action limit",
                    "value": {
                      "success": false,
                      "message": "Too many requests. Please try again later.",
                      "code": 3,
                      "errorCode": "rate_limited",
                      "error": {
                        "code": "RATE_LIMIT_EXCEEDED",
                        "message": "Too many requests. Please try again later."
                      }
                    }
                  },
                  "perLicense": {
                    "summary": "Per-license limit",
                    "value": {
                      "success": false,
                      "message": "Too many checkout attempts. Please try again later.",
                      "code": 3,
                      "errorCode": "rate_limited",
                      "error": {
                        "code": "RATE_LIMIT_EXCEEDED",
                        "message": "Too many checkout attempts. Please try again later."
                      }
                    }
                  },
                  "quotaExceeded": {
                    "summary": "Free-plan monthly quota",
                    "value": {
                      "message": "Monthly API request limit reached. Upgrade your plan to raise your limit.",
                      "code": 1,
                      "errorCode": "quota_exceeded"
                    }
                  }
                }
              }
            }
          }
        },
        "operationId": "createKeyCheckout"
      }
    },
    "/key/heartbeat": {
      "post": {
        "summary": "Heartbeat Floating Session",
        "description": "Extend a floating session's lease and get the next nonce. Requires a `client` or `admin` key, or the `license:activate` grant; a product-bound key works only for its products. Ignores `Idempotency-Key`. A session that lapsed less than 15 seconds ago can still be renewed if its seat wasn't taken.",
        "tags": [
          "License Keys"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "productId": {
                    "type": "string",
                    "minLength": 22,
                    "maxLength": 256,
                    "example": "4898d6707ffa56ed9b0eea",
                    "description": "The product ID. 22–256 characters."
                  },
                  "licenseKey": {
                    "type": "string",
                    "minLength": 20,
                    "maxLength": 256,
                    "example": "A8E2K-9F1BC-3D4GH-7J2KM",
                    "description": "The license key. 20–256 characters."
                  },
                  "sessionId": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 255,
                    "example": "Tq3bXhW9sYk2LmN4pR7sT9",
                    "description": "The `sessionId` returned by checkout. 1–255 characters."
                  },
                  "timestamp": {
                    "oneOf": [
                      {
                        "type": "string",
                        "maxLength": 128
                      },
                      {
                        "type": "number"
                      }
                    ],
                    "description": "The current `nextNonce` from the previous checkout or heartbeat response (the server requires an exact match; it is not a clock time). A string of up to 128 characters (or a number)."
                  },
                  "signature": {
                    "type": "string",
                    "minLength": 64,
                    "maxLength": 64,
                    "description": "HMAC-SHA256 of `\"<sessionId>:<timestamp>\"` keyed with the `sessionSecret` from checkout. Each nonce works once. Exactly 64 hexadecimal characters."
                  }
                },
                "required": [
                  "productId",
                  "licenseKey",
                  "sessionId",
                  "timestamp",
                  "signature"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Heartbeat extended successfully",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "code": {
                      "type": "integer",
                      "example": 0
                    },
                    "message": {
                      "type": "string"
                    },
                    "expiresAt": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "nextNonce": {
                      "type": "string",
                      "description": "The newly rotated cryptographic nonce generated by the server. This must be used for the next subsequent heartbeat or checkin request."
                    }
                  }
                },
                "example": {
                  "code": 0,
                  "message": "Heartbeat received",
                  "expiresAt": "2026-11-07T10:10:00.000Z",
                  "nextNonce": "Kp8sT2vW1yZ3aB4cD5eF6gH7"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "description": "The API key is missing, invalid or not allowed here (`api_key_*`), or the license or session can't be used: unknown or blocked license, expired license, disabled customer, wrong signature or stale nonce (`session_invalid`).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "examples": {
                  "sessionInvalid": {
                    "summary": "Session can't be used",
                    "value": {
                      "message": "Invalid license or session",
                      "code": 1,
                      "errorCode": "session_invalid"
                    }
                  },
                  "apiKeyInvalid": {
                    "summary": "API key invalid or not allowed",
                    "value": {
                      "message": "Invalid API key or insufficient permissions",
                      "code": 1,
                      "errorCode": "api_key_invalid"
                    }
                  }
                }
              }
            }
          },
          "402": {
            "description": "The workspace is in restricted mode, or the license was archived when the plan lapsed (outside the continuity period).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "message": "Workspace subscription required for floating license heartbeat",
                  "code": 2,
                  "errorCode": "subscription_required"
                }
              }
            }
          },
          "403": {
            "description": "The API key isn't allowed from this IP address.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "message": "This API key is not allowed from this IP address",
                  "code": 1,
                  "errorCode": "ip_not_allowed"
                }
              }
            }
          },
          "404": {
            "description": "No active product with this ID in the API key's workspace.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "message": "Product not found or inactive",
                  "code": 1,
                  "errorCode": "product_not_found"
                }
              }
            }
          },
          "410": {
            "description": "The session is unknown, checked in, expired more than 15 seconds ago, or its seat was taken by another host. Check out again.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "message": "Session expired or invalid. Please checkout again.",
                  "code": 5,
                  "errorCode": "session_expired"
                }
              }
            }
          },
          "413": {
            "$ref": "#/components/responses/PayloadTooLarge"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        },
        "operationId": "createKeyHeartbeat"
      }
    },
    "/key/checkin": {
      "post": {
        "summary": "Checkin Floating Session",
        "description": "Release a floating seat. Requires a `client` or `admin` key, or the `license:activate` grant; a product-bound key works only for its products. Ignores `Idempotency-Key`. Checking in a session that is already checked in returns 200 again.",
        "tags": [
          "License Keys"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "productId": {
                    "type": "string",
                    "minLength": 22,
                    "maxLength": 256,
                    "example": "4898d6707ffa56ed9b0eea",
                    "description": "The product ID. 22–256 characters."
                  },
                  "licenseKey": {
                    "type": "string",
                    "minLength": 20,
                    "maxLength": 256,
                    "example": "A8E2K-9F1BC-3D4GH-7J2KM",
                    "description": "The license key. 20–256 characters."
                  },
                  "sessionId": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 255,
                    "example": "Tq3bXhW9sYk2LmN4pR7sT9",
                    "description": "The `sessionId` returned by checkout. 1–255 characters."
                  },
                  "timestamp": {
                    "oneOf": [
                      {
                        "type": "string",
                        "maxLength": 128
                      },
                      {
                        "type": "number"
                      }
                    ],
                    "description": "The current `nextNonce` from the previous checkout or heartbeat response (the server requires an exact match; it is not a clock time). A string of up to 128 characters (or a number)."
                  },
                  "signature": {
                    "type": "string",
                    "minLength": 64,
                    "maxLength": 64,
                    "description": "HMAC-SHA256 of `\"<sessionId>:<timestamp>\"` keyed with the `sessionSecret` from checkout.  Exactly 64 hexadecimal characters."
                  }
                },
                "required": [
                  "productId",
                  "licenseKey",
                  "sessionId",
                  "timestamp",
                  "signature"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Session checked in successfully",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "code": {
                      "type": "integer"
                    },
                    "message": {
                      "type": "string",
                      "description": "\"Seat released\", or \"Session already checked in\" for a repeat checkin."
                    }
                  }
                },
                "example": {
                  "message": "Seat released",
                  "code": 0
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "description": "The API key is missing, invalid or not allowed here (`api_key_*`), or the license is unknown or the signature or nonce doesn't match (`session_invalid`).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "examples": {
                  "sessionInvalid": {
                    "summary": "Session can't be used",
                    "value": {
                      "message": "Invalid license or session",
                      "code": 1,
                      "errorCode": "session_invalid"
                    }
                  },
                  "apiKeyInvalid": {
                    "summary": "API key invalid or not allowed",
                    "value": {
                      "message": "Invalid API key or insufficient permissions",
                      "code": 1,
                      "errorCode": "api_key_invalid"
                    }
                  }
                }
              }
            }
          },
          "403": {
            "description": "The API key isn't allowed from this IP address.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "message": "This API key is not allowed from this IP address",
                  "code": 1,
                  "errorCode": "ip_not_allowed"
                }
              }
            }
          },
          "404": {
            "description": "No active product with this ID in the API key's workspace.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "message": "Product not found or inactive",
                  "code": 1,
                  "errorCode": "product_not_found"
                }
              }
            }
          },
          "410": {
            "description": "No session with this ID for the license. Check out again.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "message": "Session expired or invalid. Please checkout again.",
                  "code": 5,
                  "errorCode": "session_expired"
                }
              }
            }
          },
          "413": {
            "$ref": "#/components/responses/PayloadTooLarge"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        },
        "operationId": "createKeyCheckin"
      }
    },
    "/key/sign": {
      "post": {
        "summary": "Sign Offline Key",
        "description": "Sign an offline license file for a machine. Like an activation, it uses a device slot, and the slot stays taken until the file expires. Requires an `admin` key or the `license:sign` grant; a product-bound key works only for its products. Refused while the workspace is in billing continuity or restricted mode.",
        "tags": [
          "License Keys"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "productId": {
                    "type": "string",
                    "minLength": 22,
                    "maxLength": 256,
                    "example": "4898d6707ffa56ed9b0eea",
                    "description": "The product ID. 22–256 characters."
                  },
                  "licenseKey": {
                    "type": "string",
                    "minLength": 20,
                    "maxLength": 256,
                    "example": "A8E2K-9F1BC-3D4GH-7J2KM",
                    "description": "The license key. 20–256 characters."
                  },
                  "hostId": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 64,
                    "example": "mac-studio-m2",
                    "description": "The machine code (hardware fingerprint) to bind the offline license to. Required. 1–64 characters."
                  },
                  "ttl": {
                    "type": "integer",
                    "minimum": 60,
                    "maximum": 315360000,
                    "description": "Optional lifetime of the signed file in seconds, 60–315,360,000 (10 years). Required when the license has no expiry date and the product has no maximum offline lifetime; can't run past the license's expiry date."
                  }
                },
                "required": [
                  "productId",
                  "licenseKey",
                  "hostId"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Offline license key signed successfully",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "file": {
                      "type": "string",
                      "description": "The signed license file as a JSON string: `{ signedDate, signedKey, keyId, publicKeyFingerprint }`, where `signedKey` is an EdDSA (Ed25519) JWT."
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid request. Validation errors name the field: `Field '<name>' is required.` or `Field '<name>': <problem>`, and keep the legacy `error: { code: \"VALIDATION_ERROR\" }` object. A body that isn't valid JSON is also `invalid_request`. Signing problems (no TTL for a license without an expiry, a TTL past the expiry, no signing key for the workspace) are also `invalid_request`. A request without `hostId` is refused with `invalid_request` (the body also keeps the legacy `error: { code: \"BAD_REQUEST\" }` object). An `Idempotency-Key` reused with a different method, path, query or body returns `idempotency_mismatch`. An `Idempotency-Key` longer than 255 characters, or with characters outside printable ASCII, returns `invalid_request`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "examples": {
                  "missingField": {
                    "summary": "Required field missing",
                    "value": {
                      "success": false,
                      "message": "Field 'licenseKey' is required.",
                      "code": 1,
                      "errorCode": "invalid_request",
                      "error": {
                        "code": "VALIDATION_ERROR",
                        "message": "Field 'licenseKey' is required."
                      }
                    }
                  },
                  "tooShort": {
                    "summary": "Field under its minimum",
                    "value": {
                      "success": false,
                      "message": "Field 'productId': product ID must be at least 22 characters",
                      "code": 1,
                      "errorCode": "invalid_request",
                      "error": {
                        "code": "VALIDATION_ERROR",
                        "message": "Field 'productId': product ID must be at least 22 characters"
                      }
                    }
                  },
                  "invalidJson": {
                    "summary": "Body is not valid JSON",
                    "value": {
                      "message": "Request body is not valid JSON",
                      "code": 1,
                      "errorCode": "invalid_request"
                    }
                  },
                  "ttlRequired": {
                    "summary": "No expiry and no TTL",
                    "value": {
                      "message": "This license has no expiration. Please provide a TTL.",
                      "code": 1,
                      "errorCode": "invalid_request"
                    }
                  },
                  "ttlTooLong": {
                    "summary": "TTL past the license expiry",
                    "value": {
                      "message": "Requested TTL exceeds license expiration date.",
                      "code": 1,
                      "errorCode": "invalid_request"
                    }
                  },
                  "idempotencyMismatch": {
                    "summary": "Idempotency-Key reused for a different request",
                    "value": {
                      "message": "Idempotency key reused with different request parameters or payload (or a legacy record).",
                      "code": 1,
                      "errorCode": "idempotency_mismatch"
                    }
                  },
                  "missingHostId": {
                    "summary": "hostId missing",
                    "value": {
                      "success": false,
                      "message": "hostId (machine code) is required for offline signing",
                      "errorCode": "invalid_request",
                      "error": {
                        "code": "BAD_REQUEST",
                        "message": "hostId (machine code) is required for offline signing"
                      },
                      "code": 1
                    }
                  },
                  "idempotencyKeyInvalid": {
                    "summary": "Idempotency-Key too long",
                    "value": {
                      "message": "Idempotency-Key must be 1 to 255 printable ASCII characters.",
                      "code": 1,
                      "errorCode": "invalid_request"
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "The API key is missing, invalid or not allowed here, or the license can't be used (`license_invalid_or_forbidden`, same cases as activate). When the key passes the endpoint check but fails the product or permission check, the body is `api_key_invalid` and also keeps the legacy `error: { code: \"UNAUTHORIZED\" }` object.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "examples": {
                  "licenseRejected": {
                    "summary": "License can't be used",
                    "value": {
                      "message": "Invalid license key or insufficient permissions",
                      "code": 1,
                      "errorCode": "license_invalid_or_forbidden"
                    }
                  },
                  "apiKeyInvalid": {
                    "summary": "API key invalid or not allowed",
                    "value": {
                      "message": "Invalid API key or insufficient permissions",
                      "code": 1,
                      "errorCode": "api_key_invalid"
                    }
                  }
                }
              }
            }
          },
          "402": {
            "description": "The workspace is in billing continuity or restricted mode, or the license was archived when the plan lapsed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "examples": {
                  "signing": {
                    "summary": "Continuity or restricted mode",
                    "value": {
                      "message": "An active subscription is required to sign offline licenses",
                      "code": 2,
                      "errorCode": "subscription_required"
                    }
                  },
                  "archived": {
                    "summary": "License archived",
                    "value": {
                      "message": "Workspace subscription required for this license operation",
                      "code": 2,
                      "errorCode": "subscription_required"
                    }
                  }
                }
              }
            }
          },
          "403": {
            "description": "The license is already active on `maxActivations` devices (`activation_limit_reached`), the API key isn't allowed from this IP address (`ip_not_allowed`), the key has no workspace (`api_key_no_workspace`), or offline licenses aren't available on the plan (`forbidden`). The last three also keep the legacy `error: { code: \"FORBIDDEN\" }` object.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "examples": {
                  "activationLimit": {
                    "summary": "Activation limit reached",
                    "value": {
                      "message": "Activation limit reached",
                      "code": 2,
                      "errorCode": "activation_limit_reached"
                    }
                  },
                  "ipNotAllowed": {
                    "summary": "IP not on the key's allowlist",
                    "value": {
                      "success": false,
                      "message": "This API key is not allowed from this IP address",
                      "errorCode": "ip_not_allowed",
                      "error": {
                        "code": "FORBIDDEN",
                        "message": "This API key is not allowed from this IP address"
                      },
                      "code": 1
                    }
                  },
                  "noWorkspace": {
                    "summary": "Key has no workspace",
                    "value": {
                      "success": false,
                      "message": "API key is not associated with an organization",
                      "errorCode": "api_key_no_workspace",
                      "error": {
                        "code": "FORBIDDEN",
                        "message": "API key is not associated with an organization"
                      },
                      "code": 1
                    }
                  },
                  "planGate": {
                    "summary": "Offline licenses not on this plan",
                    "value": {
                      "success": false,
                      "message": "Feature not allowed by current plan",
                      "errorCode": "forbidden",
                      "error": {
                        "code": "FORBIDDEN",
                        "message": "Feature not allowed by current plan"
                      },
                      "code": 1
                    }
                  }
                }
              }
            }
          },
          "404": {
            "description": "No active product with this ID (`product_not_found`). The body also keeps the legacy `error: { code: \"NOT_FOUND\" }` object.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "success": false,
                  "message": "Product not found or inactive",
                  "errorCode": "product_not_found",
                  "error": {
                    "code": "NOT_FOUND",
                    "message": "Product not found or inactive"
                  },
                  "code": 1
                }
              }
            }
          },
          "409": {
            "description": "The device was deactivated while the file was being signed (`retry`); try again. A request with the same `Idempotency-Key` is still running (`idempotency_in_progress`), or an old idempotency record can't be replayed (`idempotency_legacy`).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "examples": {
                  "retry": {
                    "summary": "Device deactivated while signing",
                    "value": {
                      "message": "The device was deactivated while signing. Try again.",
                      "code": 1,
                      "errorCode": "retry"
                    }
                  },
                  "inProgress": {
                    "summary": "Same Idempotency-Key still running",
                    "value": {
                      "message": "A request with this idempotency key is currently in progress.",
                      "code": 1,
                      "errorCode": "idempotency_in_progress"
                    }
                  }
                }
              }
            }
          },
          "413": {
            "$ref": "#/components/responses/PayloadTooLarge"
          },
          "429": {
            "description": "Rate limited. On this endpoint the plan limit, the per-IP share for `client` keys and the per-action limit all answer with the nested shape and `code: 3`. The Free-plan monthly quota answers `quota_exceeded` with `code: 1`, and the Idempotency-Key budget answers the flat `rate_limited` body. Honor `Retry-After`; see Rate Limits.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "examples": {
                  "rateLimited": {
                    "summary": "Plan, per-IP or per-action limit",
                    "value": {
                      "success": false,
                      "message": "Too many requests. Please try again later.",
                      "code": 3,
                      "errorCode": "rate_limited",
                      "error": {
                        "code": "RATE_LIMIT_EXCEEDED",
                        "message": "Too many requests. Please try again later."
                      }
                    }
                  },
                  "quotaExceeded": {
                    "summary": "Free-plan monthly quota",
                    "value": {
                      "message": "Monthly API request limit reached. Upgrade your plan to raise your limit.",
                      "code": 1,
                      "errorCode": "quota_exceeded"
                    }
                  }
                }
              }
            }
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        },
        "operationId": "createKeySign",
        "parameters": [
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": false,
            "description": "Optional on this endpoint. A client-generated key (use a fresh UUID v4 per operation) that makes a retry return the original result instead of repeating the change. `X-Idempotency-Key` is accepted too. Records are kept for 24 hours; It must be 1 to 255 printable ASCII characters; a longer value, or one with other characters, returns `400` `invalid_request` before anything runs.",
            "schema": {
              "type": "string",
              "maxLength": 255,
              "example": "9b1deb4d-3b7d-4bad-9bdd-2b0d7b3dcb6d",
              "minLength": 1,
              "pattern": "^[\\x20-\\x7E]+$"
            }
          }
        ]
      }
    }
  },
  "components": {
    "securitySchemes": {
      "bearerAuth": {
        "type": "http",
        "scheme": "bearer",
        "bearerFormat": "API key",
        "description": "Your Keymint API key"
      }
    },
    "schemas": {
      "PostcustomerRequest": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "minLength": 3,
            "maxLength": 255,
            "example": "Jane Doe",
            "description": "Customer name. 3–255 characters after trimming; can't be a URL or contain control characters."
          },
          "email": {
            "type": "string",
            "format": "email",
            "minLength": 3,
            "maxLength": 320,
            "example": "jane@example.com",
            "description": "Optional. An empty string or null is treated as no email. Must be unique within the workspace. A valid email address, 3–320 characters."
          }
        },
        "required": [
          "name"
        ]
      },
      "PostcustomerSuccessResponse": {
        "type": "object",
        "properties": {
          "action": {
            "type": "string",
            "example": "addCustomer"
          },
          "status": {
            "type": "boolean"
          },
          "message": {
            "type": "string",
            "example": "Customer added"
          },
          "data": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string"
              },
              "name": {
                "type": "string"
              },
              "email": {
                "type": "string",
                "format": "email",
                "nullable": true
              }
            }
          },
          "code": {
            "type": "integer",
            "example": 0
          }
        }
      },
      "GetcustomerResponse": {
        "type": "object",
        "properties": {
          "action": {
            "type": "string",
            "example": "getPaginatedCustomers"
          },
          "status": {
            "type": "boolean"
          },
          "data": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string"
                },
                "name": {
                  "type": "string"
                },
                "email": {
                  "type": "string",
                  "format": "email",
                  "nullable": true
                },
                "active": {
                  "type": "boolean"
                },
                "createdAt": {
                  "type": "string",
                  "format": "date-time"
                },
                "updatedAt": {
                  "type": "string",
                  "format": "date-time"
                }
              }
            }
          },
          "meta": {
            "type": "object",
            "properties": {
              "total": {
                "type": "integer"
              },
              "page": {
                "type": "integer"
              },
              "limit": {
                "type": "integer"
              },
              "totalPages": {
                "type": "integer"
              }
            }
          },
          "code": {
            "type": "integer",
            "example": 0
          }
        }
      },
      "GetcustomercustomerIdResponse": {
        "type": "object",
        "properties": {
          "action": {
            "type": "string",
            "example": "getCustomerById"
          },
          "status": {
            "type": "boolean"
          },
          "data": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string"
                },
                "name": {
                  "type": "string"
                },
                "email": {
                  "type": "string",
                  "format": "email",
                  "nullable": true
                },
                "active": {
                  "type": "boolean"
                },
                "createdAt": {
                  "type": "string",
                  "format": "date-time"
                },
                "updatedAt": {
                  "type": "string",
                  "format": "date-time"
                }
              }
            },
            "description": "A one-element array holding the customer."
          },
          "code": {
            "type": "integer",
            "example": 0
          }
        }
      },
      "PutcustomercustomerIdRequest": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "minLength": 3,
            "maxLength": 255,
            "example": "Jane Doe",
            "description": "The customer's name (required on every update). 3–255 characters after trimming; can't be a URL or contain control characters."
          },
          "email": {
            "type": "string",
            "format": "email",
            "minLength": 3,
            "maxLength": 320,
            "example": "jane@example.com",
            "description": "The customer's email. Omitting it, or sending an empty string or null, removes the email. Must be unique within the workspace; changing the email of a customer who holds licenses needs the `license:read` permission. A valid email address, 3–320 characters."
          }
        },
        "required": [
          "name"
        ]
      },
      "PutcustomercustomerIdResponse": {
        "type": "object",
        "properties": {
          "action": {
            "type": "string",
            "example": "updateCustomer"
          },
          "status": {
            "type": "boolean"
          },
          "data": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string"
              },
              "name": {
                "type": "string"
              },
              "email": {
                "type": "string",
                "format": "email",
                "nullable": true
              },
              "active": {
                "type": "boolean"
              },
              "createdAt": {
                "type": "string",
                "format": "date-time"
              },
              "updatedAt": {
                "type": "string",
                "format": "date-time"
              }
            },
            "description": "The customer record after the update: the same public fields as `GET /customer/by-id`."
          },
          "message": {
            "type": "string",
            "example": "Customer updated"
          },
          "code": {
            "type": "integer",
            "example": 0
          }
        }
      },
      "DeletecustomercustomerIdResponse": {
        "type": "object",
        "properties": {
          "action": {
            "type": "string",
            "example": "removeCustomer"
          },
          "status": {
            "type": "boolean"
          },
          "customerName": {
            "type": "string"
          },
          "customerEmail": {
            "type": "string",
            "nullable": true
          },
          "message": {
            "type": "string",
            "example": "Customer deleted"
          },
          "code": {
            "type": "integer",
            "example": 0
          }
        }
      },
      "GetcustomercustomerIdkeysResponse": {
        "type": "array",
        "description": "The customer's license keys, newest first. Not wrapped in an object and without a `code` field. An unknown customer ID returns an empty array.",
        "items": {
          "type": "object",
          "properties": {
            "id": {
              "type": "string"
            },
            "key": {
              "type": "string",
              "description": "Masked: the first and last four characters (`A8E2****7J2K`)."
            },
            "productId": {
              "type": "string"
            },
            "productName": {
              "type": "string"
            },
            "customerId": {
              "type": "string",
              "nullable": true
            },
            "customerData": {
              "type": "array",
              "items": {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string"
                  },
                  "name": {
                    "type": "string"
                  },
                  "email": {
                    "type": "string",
                    "nullable": true
                  }
                }
              }
            },
            "licenseType": {
              "type": "string",
              "enum": [
                "node-locked",
                "floating"
              ]
            },
            "activated": {
              "type": "boolean"
            },
            "vendorDisabled": {
              "type": "boolean"
            },
            "activations": {
              "type": "integer",
              "description": "Device activations (node-locked) or devices with a floating session (floating)."
            },
            "maxActivations": {
              "type": "integer",
              "nullable": true,
              "description": "Activation limit; for floating licenses the seat limit. Null means unlimited."
            },
            "maxConcurrentSessions": {
              "type": "integer",
              "nullable": true
            },
            "heartbeatInterval": {
              "type": "integer",
              "nullable": true
            },
            "sessionLeaseDuration": {
              "type": "integer",
              "nullable": true
            },
            "expirationDate": {
              "type": "string",
              "format": "date-time",
              "nullable": true
            },
            "activationDate": {
              "type": "string",
              "format": "date-time",
              "nullable": true
            },
            "createdAt": {
              "type": "string",
              "format": "date-time"
            },
            "updatedAt": {
              "type": "string",
              "format": "date-time"
            },
            "versionId": {
              "type": "string",
              "nullable": true
            },
            "version": {
              "type": "string",
              "nullable": true
            },
            "allowedHosts": {
              "type": "array",
              "items": {
                "type": "string"
              },
              "nullable": true
            },
            "customerCanSelfReset": {
              "type": "boolean"
            },
            "metadata": {
              "type": "object",
              "nullable": true,
              "additionalProperties": true,
              "description": "The license metadata (or null)."
            },
            "devices": {
              "type": "array",
              "items": {
                "type": "object",
                "properties": {
                  "hostId": {
                    "type": "string"
                  },
                  "deviceTag": {
                    "type": "string"
                  },
                  "activationTime": {
                    "type": "string",
                    "format": "date-time"
                  }
                }
              }
            }
          }
        }
      },
      "PostcustomercustomerIddisableResponse": {
        "type": "object",
        "description": "No `message` or `code` field on this endpoint.",
        "properties": {
          "action": {
            "type": "string",
            "example": "toggleActive"
          },
          "status": {
            "type": "boolean"
          },
          "customerName": {
            "type": "string"
          },
          "active": {
            "type": "boolean",
            "description": "The customer's new status."
          }
        }
      },
      "PostkeyRequest": {
        "type": "object",
        "properties": {
          "productId": {
            "type": "string",
            "minLength": 22,
            "maxLength": 256,
            "example": "4898d6707ffa56ed9b0eea",
            "description": "The product to create the key for. 22–256 characters."
          },
          "maxActivations": {
            "oneOf": [
              {
                "type": "integer",
                "minimum": 0,
                "maximum": 1000000
              },
              {
                "type": "string",
                "maxLength": 20,
                "pattern": "^([0-9]+|unlimited)?$"
              }
            ],
            "nullable": true,
            "example": "5",
            "description": "Maximum device activations: a whole number from 0 to 1,000,000 (as a JSON number or a string of digits), or `\"unlimited\"`. Omitted, null or an empty string means unlimited. Negative, decimal or other text values return 400 `invalid_request`."
          },
          "expiryDate": {
            "type": "string",
            "format": "date-time",
            "maxLength": 64,
            "nullable": true,
            "description": "Optional ISO 8601 expiry date, up to 64 characters. Omitted, null or an empty string means the key never expires."
          },
          "customerId": {
            "type": "string",
            "minLength": 22,
            "maxLength": 256,
            "example": "078116d0069c32407b4f63",
            "description": "Optional: an existing customer in this workspace to assign. Can't be combined with `newCustomer`. 22–256 characters."
          },
          "newCustomer": {
            "type": "object",
            "description": "Optional: create a customer and assign the key to them. Can't be combined with `customerId`.",
            "properties": {
              "name": {
                "type": "string",
                "minLength": 3,
                "maxLength": 255,
                "example": "Jane Doe",
                "description": "Customer name. 3–255 characters after trimming; can't be a URL or contain control characters."
              },
              "email": {
                "type": "string",
                "format": "email",
                "minLength": 3,
                "maxLength": 320,
                "example": "jane@example.com",
                "description": "Optional. A valid email address, 3–320 characters."
              }
            },
            "required": [
              "name"
            ]
          },
          "format": {
            "$ref": "#/components/schemas/KeyFormat"
          },
          "amountKeys": {
            "oneOf": [
              {
                "type": "integer",
                "minimum": 1,
                "maximum": 256
              },
              {
                "type": "string",
                "pattern": "^\\d{1,5}$"
              }
            ],
            "default": "1",
            "example": "1",
            "description": "How many keys to create in one request, 1–256 (JSON number or string of digits). Default 1. All keys are returned in `keys`."
          },
          "metadata": {
            "type": "object",
            "additionalProperties": true,
            "description": "Optional key-value data stored on the license (for example `is_trial` and `features`). At most 10,000 characters when serialized as JSON.",
            "example": {
              "is_trial": false,
              "features": {
                "pro_mode": true
              }
            }
          },
          "versionId": {
            "type": "string",
            "maxLength": 64,
            "description": "Optional product version ID to tie the key to, up to 64 characters."
          },
          "allowedHosts": {
            "type": "array",
            "maxItems": 100,
            "items": {
              "type": "string",
              "maxLength": 255
            },
            "nullable": true,
            "description": "Optional: the only host IDs that may activate this key. At most 100 host IDs of up to 255 characters each.",
            "example": [
              "mac-studio-m2"
            ]
          },
          "licenseType": {
            "type": "string",
            "enum": [
              "node-locked",
              "floating"
            ],
            "default": "node-locked",
            "description": "License type (default node-locked). Floating licenses must be available on the workspace's plan."
          },
          "maxConcurrentSessions": {
            "type": "integer",
            "minimum": 1,
            "maximum": 1000000,
            "nullable": true,
            "description": "Floating licenses: concurrent seats, 1–1,000,000. Null or omitted means no seat limit."
          },
          "heartbeatInterval": {
            "type": "integer",
            "minimum": 60,
            "maximum": 86400,
            "nullable": true,
            "description": "Floating licenses: seconds between heartbeats, 60–86,400. Null means the default of 60."
          },
          "sessionLeaseDuration": {
            "type": "integer",
            "minimum": 300,
            "maximum": 31536000,
            "nullable": true,
            "description": "Floating licenses: seat lease in seconds, 300–31,536,000. Null means the default of 300."
          }
        },
        "required": [
          "productId"
        ],
        "not": {
          "allOf": [
            {
              "required": [
                "customerId"
              ]
            },
            {
              "required": [
                "newCustomer"
              ]
            }
          ]
        }
      },
      "PostkeyResponse": {
        "type": "object",
        "properties": {
          "code": {
            "type": "integer",
            "example": 0
          },
          "key": {
            "type": "string",
            "description": "The first created key."
          },
          "keys": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Every created key (one per `amountKeys`). Raw keys are returned only here; store them."
          }
        }
      },
      "GetkeyResponse": {
        "type": "object",
        "properties": {
          "data": {
            "type": "object",
            "properties": {
              "license": {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string"
                  },
                  "key": {
                    "type": "string",
                    "description": "The raw license key for `admin` keys; masked (`A8E2****7J2K`) for every other key."
                  },
                  "productId": {
                    "type": "string"
                  },
                  "maxActivations": {
                    "type": "integer",
                    "nullable": true,
                    "description": "Null means unlimited."
                  },
                  "activations": {
                    "type": "integer"
                  },
                  "devices": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string"
                        },
                        "hostId": {
                          "type": "string"
                        },
                        "deviceTag": {
                          "type": "string",
                          "nullable": true
                        },
                        "ipAddress": {
                          "type": "string",
                          "nullable": true
                        },
                        "activationTime": {
                          "type": "string",
                          "format": "date-time"
                        }
                      }
                    },
                    "description": "Activated devices. `ipAddress` is left out for keys other than `admin`."
                  },
                  "activated": {
                    "type": "boolean"
                  },
                  "expirationDate": {
                    "type": "string",
                    "format": "date-time",
                    "nullable": true
                  },
                  "metadata": {
                    "type": "object",
                    "nullable": true,
                    "additionalProperties": true,
                    "description": "The license metadata (or null)."
                  },
                  "allowedHosts": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    },
                    "nullable": true,
                    "description": "Authorized machine IDs for node‑locked licenses"
                  },
                  "versionId": {
                    "type": "string",
                    "nullable": true,
                    "description": "The ID of the product version associated with this license key"
                  },
                  "version": {
                    "type": "object",
                    "nullable": true,
                    "description": "Detailed information about the associated product version",
                    "properties": {
                      "id": {
                        "type": "string"
                      },
                      "version": {
                        "type": "string"
                      },
                      "description": {
                        "type": "string",
                        "nullable": true
                      },
                      "active": {
                        "type": "boolean"
                      }
                    }
                  },
                  "createdAt": {
                    "type": "string",
                    "format": "date-time"
                  },
                  "updatedAt": {
                    "type": "string",
                    "format": "date-time"
                  },
                  "activationDate": {
                    "type": "string",
                    "format": "date-time",
                    "nullable": true
                  },
                  "customerCanSelfReset": {
                    "type": "boolean",
                    "description": "Whether the customer may self-reset activations. Defaults to false."
                  },
                  "vendorDisabled": {
                    "type": "boolean",
                    "description": "True when blocked by the vendor"
                  },
                  "licenseType": {
                    "type": "string",
                    "enum": [
                      "node-locked",
                      "floating"
                    ]
                  },
                  "maxConcurrentSessions": {
                    "type": "integer",
                    "nullable": true,
                    "description": "Floating licenses only: concurrent session cap"
                  },
                  "heartbeatInterval": {
                    "type": "integer",
                    "nullable": true,
                    "description": "Seconds between required heartbeats (floating)"
                  },
                  "sessionLeaseDuration": {
                    "type": "integer",
                    "nullable": true,
                    "description": "Session lease window in seconds (floating)"
                  },
                  "billingArchivedAt": {
                    "type": "string",
                    "format": "date-time",
                    "nullable": true,
                    "description": "Set when the license was archived because the workspace's plan lapsed."
                  },
                  "lastUsedAt": {
                    "type": "string",
                    "format": "date-time",
                    "nullable": true,
                    "description": "Last time the license was used: an activation (including a device that was already activated), deactivation, offline signing, or a floating checkout, heartbeat or checkin. Accurate to the hour. null if it hasn't been used since November 2026, when this field was added. Looking a license up with this endpoint doesn't count as use."
                  }
                }
              },
              "customer": {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string"
                  },
                  "name": {
                    "type": "string"
                  },
                  "email": {
                    "type": "string",
                    "format": "email"
                  },
                  "active": {
                    "type": "boolean"
                  }
                },
                "nullable": true,
                "description": "The assigned customer, or null. For keys other than `admin`, `name` and `email` are masked."
              }
            }
          },
          "code": {
            "type": "integer"
          }
        }
      },
      "PostkeyactivateRequest": {
        "type": "object",
        "properties": {
          "productId": {
            "type": "string",
            "minLength": 22,
            "maxLength": 256,
            "example": "4898d6707ffa56ed9b0eea",
            "description": "The product ID. 22–256 characters."
          },
          "licenseKey": {
            "type": "string",
            "minLength": 20,
            "maxLength": 256,
            "example": "A8E2K-9F1BC-3D4GH-7J2KM",
            "description": "The license key. 20–256 characters."
          },
          "hostId": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64,
            "example": "mac-studio-m2",
            "description": "Stable device or installation identifier. Omit it (or send \"N/A\") to use the license's single shared hostless slot. 1–64 characters."
          },
          "deviceTag": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64,
            "example": "MacBook Pro",
            "description": "Optional human-readable device label. 1–64 characters."
          },
          "licensee": {
            "type": "object",
            "description": "Optional first-time licensee claim. Applies only while the license has no customer: Keymint reuses the workspace customer with this email or creates one (the workspace's plan must allow another customer). Ignored when the license already has a customer.",
            "properties": {
              "name": {
                "type": "string",
                "minLength": 3,
                "maxLength": 255,
                "example": "Jane Doe",
                "description": "Licensee name. 3–255 characters after trimming; can't be a URL or contain control characters."
              },
              "email": {
                "type": "string",
                "format": "email",
                "minLength": 3,
                "maxLength": 320,
                "example": "jane@example.com",
                "description": "Licensee email (lower-cased before use). A valid email address, 3–320 characters."
              }
            },
            "required": [
              "name",
              "email"
            ]
          }
        },
        "required": [
          "productId",
          "licenseKey"
        ]
      },
      "PostkeyactivateResponse": {
        "type": "object",
        "properties": {
          "code": {
            "type": "integer"
          },
          "message": {
            "type": "string"
          },
          "expirationDate": {
            "type": "string",
            "format": "date-time",
            "nullable": true,
            "description": "When the license expires (ISO 8601), or null if it never expires. Use it to show the days remaining; client keys need no extra permission."
          },
          "licenseeName": {
            "type": "string",
            "description": "Masked name of the assigned customer. Omitted when the license has no customer."
          },
          "licenseeEmail": {
            "type": "string",
            "description": "Masked email of the assigned customer. Omitted when the license has no customer."
          },
          "metadata": {
            "type": "object",
            "additionalProperties": true,
            "description": "The license metadata plus `hostId`: the host ID this activation was recorded under (\"N/A\" for hostless activations).",
            "properties": {
              "hostId": {
                "type": "string"
              }
            },
            "example": {
              "features": {
                "pro_mode": true
              },
              "hostId": "mac-studio-m2"
            }
          },
          "versionId": {
            "type": "string",
            "nullable": true,
            "description": "The ID of the product version associated with this license key"
          },
          "version": {
            "type": "object",
            "nullable": true,
            "description": "Present only when the license is tied to a product version.",
            "properties": {
              "version": {
                "type": "string"
              }
            }
          }
        }
      },
      "PostkeydeactivateRequest": {
        "type": "object",
        "properties": {
          "productId": {
            "type": "string",
            "minLength": 22,
            "maxLength": 256,
            "example": "4898d6707ffa56ed9b0eea",
            "description": "The product ID. 22–256 characters."
          },
          "licenseKey": {
            "type": "string",
            "minLength": 20,
            "maxLength": 256,
            "example": "A8E2K-9F1BC-3D4GH-7J2KM",
            "description": "The license key. 20–256 characters."
          },
          "hostId": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64,
            "example": "mac-studio-m2",
            "description": "The device to deactivate. Required for `client` keys; an admin key may omit it to remove every device (devices holding an unexpired offline license are kept). 1–64 characters."
          }
        },
        "required": [
          "productId",
          "licenseKey"
        ]
      },
      "PostkeydeactivateResponse": {
        "type": "object",
        "properties": {
          "message": {
            "type": "string",
            "example": "Key deactivated"
          },
          "code": {
            "type": "integer",
            "example": 0
          },
          "devicesRemoved": {
            "type": "integer",
            "description": "Devices removed by this call."
          },
          "devicesKept": {
            "type": "integer",
            "description": "Present when `hostId` was omitted and some devices were kept because they hold an unexpired offline license."
          }
        },
        "example": {
          "message": "Key deactivated",
          "code": 0,
          "devicesRemoved": 1
        }
      },
      "PostkeyblockRequest": {
        "type": "object",
        "properties": {
          "productId": {
            "type": "string",
            "minLength": 22,
            "maxLength": 256,
            "example": "4898d6707ffa56ed9b0eea",
            "description": "The product ID. 22–256 characters."
          },
          "licenseKey": {
            "type": "string",
            "minLength": 20,
            "maxLength": 256,
            "example": "A8E2K-9F1BC-3D4GH-7J2KM",
            "description": "The license key. 20–256 characters."
          }
        },
        "required": [
          "productId",
          "licenseKey"
        ]
      },
      "PostkeyblockResponse": {
        "type": "object",
        "properties": {
          "message": {
            "type": "string"
          },
          "code": {
            "type": "integer"
          }
        },
        "example": {
          "code": 0,
          "message": "Key blocked"
        }
      },
      "PostkeyunblockRequest": {
        "type": "object",
        "properties": {
          "productId": {
            "type": "string",
            "minLength": 22,
            "maxLength": 256,
            "example": "4898d6707ffa56ed9b0eea",
            "description": "The product ID. 22–256 characters."
          },
          "licenseKey": {
            "type": "string",
            "minLength": 20,
            "maxLength": 256,
            "example": "A8E2K-9F1BC-3D4GH-7J2KM",
            "description": "The license key. 20–256 characters."
          }
        },
        "required": [
          "productId",
          "licenseKey"
        ]
      },
      "PostkeyunblockResponse": {
        "type": "object",
        "properties": {
          "message": {
            "type": "string"
          },
          "code": {
            "type": "integer"
          }
        },
        "example": {
          "code": 0,
          "message": "Key unblocked"
        }
      },
      "ErrorResponse": {
        "type": "object",
        "description": "Error body. Every error has a top-level `message`, a non-zero integer `code` and a stable string `errorCode`. Branch on `errorCode`; `message` is for people and may be reworded. Validation errors and the nested rate-limit shape also carry `success: false` and an `error` object with a legacy string code (`VALIDATION_ERROR`, `RATE_LIMIT_EXCEEDED`); the 405 body carries `error` as the string `\"Method not allowed\"`; some bodies carry extra fields (`offlineValidUntil`, `currentSessions`, `maxSessions`). New fields may be added; ignore unknown ones.",
        "properties": {
          "message": {
            "type": "string"
          },
          "code": {
            "type": "integer",
            "description": "1 = general error; 2 = license or subscription constraint (activation limit, licensee not allowed, subscription required, archived license, conflict); 3 = rate limit on activate, checkout and sign; 4 = floating seat limit reached; 5 = floating session ended, check out again."
          },
          "success": {
            "type": "boolean"
          },
          "error": {
            "oneOf": [
              {
                "type": "object",
                "properties": {
                  "code": {
                    "type": "string",
                    "description": "Legacy string code, e.g. VALIDATION_ERROR, RATE_LIMIT_EXCEEDED, NOT_FOUND"
                  },
                  "message": {
                    "type": "string"
                  }
                }
              },
              {
                "type": "string"
              }
            ],
            "description": "Legacy field kept for older clients. Use `errorCode`."
          },
          "errorCode": {
            "type": "string",
            "enum": [
              "api_key_missing",
              "api_key_invalid",
              "api_key_no_workspace",
              "ip_not_allowed",
              "forbidden",
              "license_invalid_or_forbidden",
              "license_not_found",
              "activation_limit_reached",
              "licensee_not_allowed",
              "offline_license_held",
              "floating_seats_full",
              "session_invalid",
              "session_expired",
              "product_not_found",
              "customer_not_found",
              "not_found",
              "subscription_required",
              "license_archived",
              "plan_selection_required",
              "invalid_request",
              "payload_too_large",
              "method_not_allowed",
              "rate_limited",
              "quota_exceeded",
              "conflict",
              "retry",
              "idempotency_in_progress",
              "idempotency_mismatch",
              "idempotency_legacy",
              "service_unavailable",
              "idempotency_unavailable",
              "server_error"
            ],
            "description": "Stable machine-readable error code. See the Error Codes page for what each means."
          }
        },
        "required": [
          "code",
          "message",
          "errorCode"
        ]
      },
      "KeyFormat": {
        "type": "object",
        "description": "Custom format for the generated keys. The format must give at least 60 bits of entropy (sections × sectionLength × floor(log2(distinct characters))), otherwise the request is refused with 400.",
        "properties": {
          "sections": {
            "type": "integer",
            "minimum": 1,
            "maximum": 10,
            "description": "Number of sections, 1–10 (default 4)."
          },
          "sectionLength": {
            "type": "integer",
            "minimum": 1,
            "maximum": 32,
            "description": "Characters per section, 1–32 (default 5)."
          },
          "separator": {
            "type": "string",
            "maxLength": 3,
            "description": "Separator between sections, up to 3 characters."
          },
          "charset": {
            "type": "string",
            "minLength": 2,
            "maxLength": 100,
            "pattern": "^[^\\s]+$",
            "description": "Characters to generate keys from, 2–100 characters with no whitespace (default A–Z and 0–9)."
          },
          "prefix": {
            "type": "string",
            "maxLength": 16,
            "description": "Fixed text at the start of each key, up to 16 characters."
          },
          "suffix": {
            "type": "string",
            "maxLength": 16,
            "description": "Fixed text at the end of each key, up to 16 characters."
          },
          "case": {
            "type": "string",
            "enum": [
              "upper",
              "lower",
              "mixed"
            ],
            "description": "Letter case of the generated keys (default upper)."
          }
        }
      },
      "DeletekeyRequest": {
        "type": "object",
        "properties": {
          "productId": {
            "type": "string",
            "minLength": 22,
            "maxLength": 256,
            "example": "4898d6707ffa56ed9b0eea",
            "description": "The product the license belongs to. 22–256 characters."
          },
          "licenseKey": {
            "type": "string",
            "minLength": 20,
            "maxLength": 256,
            "example": "A8E2K-9F1BC-3D4GH-7J2KM",
            "description": "The license key to delete. 20–256 characters."
          }
        },
        "required": [
          "productId",
          "licenseKey"
        ]
      },
      "DeletekeyResponse": {
        "type": "object",
        "properties": {
          "message": {
            "type": "string"
          },
          "code": {
            "type": "integer"
          }
        },
        "example": {
          "code": 0,
          "message": "Key deleted"
        }
      }
    },
    "parameters": {
      "IdempotencyKey": {
        "name": "Idempotency-Key",
        "in": "header",
        "required": false,
        "description": "Optional on this endpoint. A client-generated key (use a fresh UUID v4 per operation) that makes a retry return the original result instead of repeating the change. `X-Idempotency-Key` is accepted too. Records are kept for 24 hours; It must be 1 to 255 printable ASCII characters; a longer value, or one with other characters, returns `400` `invalid_request` before anything runs.",
        "schema": {
          "type": "string",
          "maxLength": 255,
          "example": "9b1deb4d-3b7d-4bad-9bdd-2b0d7b3dcb6d",
          "minLength": 1,
          "pattern": "^[\\x20-\\x7E]+$"
        }
      }
    },
    "responses": {
      "PayloadTooLarge": {
        "description": "The request body is over 64 KB (65,536 bytes), checked from `Content-Length` before anything else runs and again when the body is read.",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/ErrorResponse"
            },
            "example": {
              "message": "Request body is too large (64 KB maximum).",
              "code": 1,
              "errorCode": "payload_too_large"
            }
          }
        }
      },
      "ServiceUnavailable": {
        "description": "Authorization or idempotency storage is temporarily unavailable (only for requests that send `Idempotency-Key`). Nothing was changed; retry with the same `Idempotency-Key`.",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/ErrorResponse"
            },
            "examples": {
              "serviceUnavailable": {
                "summary": "Authorization unavailable",
                "value": {
                  "message": "Service temporarily unavailable. Retry later.",
                  "code": 1,
                  "errorCode": "service_unavailable"
                }
              },
              "idempotencyUnavailable": {
                "summary": "Idempotency storage unavailable",
                "value": {
                  "message": "Idempotency service unavailable. Retry the same request later.",
                  "code": 1,
                  "errorCode": "idempotency_unavailable"
                }
              }
            }
          }
        }
      },
      "RateLimited": {
        "description": "Rate limited. The plan's per-minute limit (and, for `client` keys, the per-IP share) answers `rate_limited`; on the Free plan the monthly quota answers `quota_exceeded`. Honor `Retry-After`; see Rate Limits.",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/ErrorResponse"
            },
            "examples": {
              "rateLimited": {
                "summary": "Per-minute limit",
                "value": {
                  "message": "Too many requests. Please try again later.",
                  "code": 1,
                  "errorCode": "rate_limited"
                }
              },
              "quotaExceeded": {
                "summary": "Free-plan monthly quota",
                "value": {
                  "message": "Monthly API request limit reached. Upgrade your plan to raise your limit.",
                  "code": 1,
                  "errorCode": "quota_exceeded"
                }
              }
            }
          }
        }
      },
      "Unauthorized": {
        "description": "No API key (`api_key_missing`), or the key is unknown, expired or revoked, or its scope, grants or product binding don't allow this request (`api_key_invalid`). Every 401 carries a `WWW-Authenticate` header.",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/ErrorResponse"
            },
            "examples": {
              "invalid": {
                "summary": "Invalid or not allowed",
                "value": {
                  "message": "Invalid API key or insufficient permissions",
                  "code": 1,
                  "errorCode": "api_key_invalid"
                }
              },
              "missing": {
                "summary": "No Authorization header",
                "value": {
                  "message": "Missing API key. Send Authorization: Bearer <key>.",
                  "code": 1,
                  "errorCode": "api_key_missing"
                }
              }
            }
          }
        }
      },
      "UnauthorizedCustomer": {
        "description": "No API key (`api_key_missing`), or the key is unknown, expired or revoked, or its scope, grants or product binding don't allow this request (`api_key_invalid`). Customer endpoints are org-wide, so a product-bound API key (one restricted to one or more products) is always refused here with `api_key_invalid`. An IP allowlist mismatch also returns `api_key_invalid` on these endpoints. Every 401 carries a `WWW-Authenticate` header.",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/ErrorResponse"
            },
            "examples": {
              "invalid": {
                "summary": "Invalid or not allowed",
                "value": {
                  "message": "Invalid API key or insufficient permissions",
                  "code": 1,
                  "errorCode": "api_key_invalid"
                }
              },
              "missing": {
                "summary": "No Authorization header",
                "value": {
                  "message": "Missing API key. Send Authorization: Bearer <key>.",
                  "code": 1,
                  "errorCode": "api_key_missing"
                }
              }
            }
          }
        }
      },
      "BadRequest": {
        "description": "Invalid request. Validation errors name the field: `Field '<name>' is required.` or `Field '<name>': <problem>`, and keep the legacy `error: { code: \"VALIDATION_ERROR\" }` object. A body that isn't valid JSON is also `invalid_request`.",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/ErrorResponse"
            },
            "examples": {
              "missingField": {
                "summary": "Required field missing",
                "value": {
                  "success": false,
                  "message": "Field 'licenseKey' is required.",
                  "code": 1,
                  "errorCode": "invalid_request",
                  "error": {
                    "code": "VALIDATION_ERROR",
                    "message": "Field 'licenseKey' is required."
                  }
                }
              },
              "tooShort": {
                "summary": "Field under its minimum",
                "value": {
                  "success": false,
                  "message": "Field 'productId': product ID must be at least 22 characters",
                  "code": 1,
                  "errorCode": "invalid_request",
                  "error": {
                    "code": "VALIDATION_ERROR",
                    "message": "Field 'productId': product ID must be at least 22 characters"
                  }
                }
              },
              "invalidJson": {
                "summary": "Body is not valid JSON",
                "value": {
                  "message": "Request body is not valid JSON",
                  "code": 1,
                  "errorCode": "invalid_request"
                }
              }
            }
          }
        }
      },
      "BadRequestIdempotent": {
        "description": "Invalid request. Validation errors name the field: `Field '<name>' is required.` or `Field '<name>': <problem>`, and keep the legacy `error: { code: \"VALIDATION_ERROR\" }` object. A body that isn't valid JSON is also `invalid_request`. An `Idempotency-Key` reused with a different method, path, query or body returns `idempotency_mismatch`. An `Idempotency-Key` longer than 255 characters, or with characters outside printable ASCII, returns `invalid_request`.",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/ErrorResponse"
            },
            "examples": {
              "missingField": {
                "summary": "Required field missing",
                "value": {
                  "success": false,
                  "message": "Field 'licenseKey' is required.",
                  "code": 1,
                  "errorCode": "invalid_request",
                  "error": {
                    "code": "VALIDATION_ERROR",
                    "message": "Field 'licenseKey' is required."
                  }
                }
              },
              "tooShort": {
                "summary": "Field under its minimum",
                "value": {
                  "success": false,
                  "message": "Field 'productId': product ID must be at least 22 characters",
                  "code": 1,
                  "errorCode": "invalid_request",
                  "error": {
                    "code": "VALIDATION_ERROR",
                    "message": "Field 'productId': product ID must be at least 22 characters"
                  }
                }
              },
              "invalidJson": {
                "summary": "Body is not valid JSON",
                "value": {
                  "message": "Request body is not valid JSON",
                  "code": 1,
                  "errorCode": "invalid_request"
                }
              },
              "idempotencyMismatch": {
                "summary": "Idempotency-Key reused for a different request",
                "value": {
                  "message": "Idempotency key reused with different request parameters or payload (or a legacy record).",
                  "code": 1,
                  "errorCode": "idempotency_mismatch"
                }
              },
              "idempotencyKeyInvalid": {
                "summary": "Idempotency-Key too long",
                "value": {
                  "message": "Idempotency-Key must be 1 to 255 printable ASCII characters.",
                  "code": 1,
                  "errorCode": "invalid_request"
                }
              }
            }
          }
        }
      },
      "IdempotencyConflict": {
        "description": "A request with the same `Idempotency-Key` is still running (`idempotency_in_progress`), or an old idempotency record can't be replayed (`idempotency_legacy`).",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/ErrorResponse"
            },
            "example": {
              "message": "A request with this idempotency key is currently in progress.",
              "code": 1,
              "errorCode": "idempotency_in_progress"
            }
          }
        }
      }
    }
  }
}
