{
 "openapi": "3.1.0",
 "info": {
  "title": "Licers API",
  "version": "2026-11-25",
  "summary": "License keys for software: signed checks, devices, seats, credits and offline files.",
  "contact": {
   "name": "Licers",
   "url": "https://licers.com/contact",
   "email": "support@licers.com"
  },
  "termsOfService": "https://licers.com/terms",
  "description": "Two APIs on one host.\n\n**Client API** (`/api/v1/*`): called by your app, no API key. Answers are signed with Ed25519; the message to verify is in `x-signed-message`: join the fields with `|`, null is an empty string, booleans are 1 or 0. The SDKs do this for you (https://licers.com/sdk). Use them in apps: a client generated from this file does not verify signatures.\n\n**Management API** (`/api/manage/*`): called by your own server with an API key from the API & Webhooks page. Never put an API key into an app you ship."
 },
 "externalDocs": {
  "url": "https://licers.com/docs",
  "description": "Documentation"
 },
 "servers": [
  {
   "url": "https://licers.com"
  }
 ],
 "security": [
  {
   "apiKey": []
  }
 ],
 "tags": [
  {
   "name": "Client API"
  },
  {
   "name": "Account"
  },
  {
   "name": "Products"
  },
  {
   "name": "License keys"
  },
  {
   "name": "Devices"
  },
  {
   "name": "License plans"
  },
  {
   "name": "Remote variables"
  },
  {
   "name": "Releases"
  },
  {
   "name": "Protection"
  },
  {
   "name": "Monitoring"
  }
 ],
 "paths": {
  "/api/v1/validate": {
   "post": {
    "tags": [
     "Client API"
    ],
    "summary": "Check a license key and bind this device",
    "security": [],
    "x-signed-message": "pylicense.v2|product_id|hwid|expires_at|nonce|issued_at|features_b64",
    "operationId": "validate",
    "description": "Call it when your app starts. Verify the signature with your public key: without that, a fake server can answer \"valid\".",
    "requestBody": {
     "required": true,
     "content": {
      "application/json": {
       "schema": {
        "type": "object",
        "properties": {
         "key": {
          "type": "string",
          "description": "The license key",
          "maxLength": 128
         },
         "hwid": {
          "type": "string",
          "description": "The device id. Any stable text; the SDKs use a hash of the machine id",
          "maxLength": 256
         },
         "nonce": {
          "type": "string",
          "description": "A fresh random value per call. It is signed, so an old answer cannot be replayed",
          "maxLength": 64
         },
         "device_name": {
          "type": "string",
          "maxLength": 120
         },
         "platform": {
          "type": "string",
          "maxLength": 60
         }
        },
        "required": [
         "key",
         "hwid",
         "nonce"
        ]
       }
      }
     }
    },
    "responses": {
     "200": {
      "description": "OK",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "properties": {
          "valid": {
           "type": "boolean"
          },
          "product_id": {
           "type": "string"
          },
          "expires_at": {
           "type": [
            "string",
            "null"
           ],
           "description": "ISO date. null: never"
          },
          "features": {
           "type": "object",
           "additionalProperties": true,
           "description": "NOT signed. Use features_b64"
          },
          "features_b64": {
           "type": "string",
           "description": "Signed entitlements: base64 of JSON"
          },
          "usage": {
           "type": "object",
           "properties": {
            "used": {
             "type": "integer"
            },
            "limit": {
             "type": [
              "integer",
              "null"
             ],
             "description": "null: no limit"
            },
            "remaining": {
             "type": [
              "integer",
              "null"
             ]
            },
            "reset": {
             "type": [
              "string",
              "null"
             ]
            },
            "resets_at": {
             "type": [
              "string",
              "null"
             ]
            }
           },
           "required": [
            "used",
            "limit",
            "remaining",
            "reset",
            "resets_at"
           ]
          },
          "usage_sig": {
           "type": "string",
           "description": "Signature of usage"
          },
          "key_alg": {
           "type": "string"
          },
          "nonce": {
           "type": "string",
           "description": "Echo of your nonce. Refuse the answer if it differs"
          },
          "issued_at": {
           "type": "integer",
           "description": "Unix seconds"
          },
          "signature": {
           "type": "string",
           "description": "Ed25519, base64, over the message in x-signed-message"
          }
         },
         "required": [
          "valid",
          "product_id",
          "expires_at",
          "features_b64",
          "nonce",
          "issued_at",
          "signature"
         ]
        }
       }
      }
     },
     "400": {
      "description": "The request is not valid",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Error"
        }
       }
      }
     },
     "403": {
      "description": "Not allowed",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Error"
        }
       }
      }
     },
     "404": {
      "description": "Not found",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Error"
        }
       }
      }
     },
     "429": {
      "description": "Too many requests: see Retry-After",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Error"
        }
       }
      }
     }
    }
   }
  },
  "/api/v1/usage": {
   "post": {
    "tags": [
     "Client API"
    ],
    "summary": "Spend or read usage credits",
    "security": [],
    "x-signed-message": "pylicense.usage.v1|product_id|hwid|amount|used|limit|nonce|issued_at",
    "operationId": "recordUsage",
    "description": "All or nothing. The device must have been validated first. amount 0 only reads the balance.",
    "requestBody": {
     "required": true,
     "content": {
      "application/json": {
       "schema": {
        "type": "object",
        "properties": {
         "key": {
          "type": "string",
          "description": "The license key",
          "maxLength": 128
         },
         "hwid": {
          "type": "string",
          "description": "The device id. Any stable text; the SDKs use a hash of the machine id",
          "maxLength": 256
         },
         "nonce": {
          "type": "string",
          "description": "A fresh random value per call. It is signed, so an old answer cannot be replayed",
          "maxLength": 64
         },
         "amount": {
          "type": "integer",
          "minimum": 0,
          "default": 1
         }
        },
        "required": [
         "key",
         "hwid",
         "nonce"
        ]
       }
      }
     }
    },
    "responses": {
     "200": {
      "description": "OK",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "properties": {
          "ok": {
           "type": "boolean"
          },
          "product_id": {
           "type": "string"
          },
          "amount": {
           "type": "integer"
          },
          "used": {
           "type": "integer"
          },
          "limit": {
           "type": [
            "integer",
            "null"
           ]
          },
          "remaining": {
           "type": [
            "integer",
            "null"
           ]
          },
          "reset": {
           "type": [
            "string",
            "null"
           ]
          },
          "resets_at": {
           "type": [
            "string",
            "null"
           ]
          },
          "nonce": {
           "type": "string",
           "description": "Echo of your nonce. Refuse the answer if it differs"
          },
          "issued_at": {
           "type": "integer",
           "description": "Unix seconds"
          },
          "signature": {
           "type": "string",
           "description": "Ed25519, base64, over the message in x-signed-message"
          }
         },
         "required": [
          "ok",
          "product_id",
          "amount",
          "used",
          "limit",
          "remaining",
          "reset",
          "resets_at",
          "nonce",
          "issued_at",
          "signature"
         ]
        }
       }
      }
     },
     "400": {
      "description": "The request is not valid",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Error"
        }
       }
      }
     },
     "403": {
      "description": "Not allowed",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Error"
        }
       }
      }
     },
     "404": {
      "description": "Not found",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Error"
        }
       }
      }
     },
     "429": {
      "description": "Too many requests: see Retry-After",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Error"
        }
       }
      }
     }
    }
   }
  },
  "/api/v1/variables": {
   "post": {
    "tags": [
     "Client API"
    ],
    "summary": "Read remote variables",
    "security": [],
    "x-signed-message": "pylicense.vars.v1|product_id|hwid|vars_b64|nonce|issued_at",
    "operationId": "getVariables",
    "requestBody": {
     "required": true,
     "content": {
      "application/json": {
       "schema": {
        "type": "object",
        "properties": {
         "key": {
          "type": "string",
          "description": "The license key",
          "maxLength": 128
         },
         "hwid": {
          "type": "string",
          "description": "The device id. Any stable text; the SDKs use a hash of the machine id",
          "maxLength": 256
         },
         "nonce": {
          "type": "string",
          "description": "A fresh random value per call. It is signed, so an old answer cannot be replayed",
          "maxLength": 64
         },
         "names": {
          "type": "array",
          "items": {
           "type": "string"
          },
          "description": "Leave out for all"
         }
        },
        "required": [
         "key",
         "hwid",
         "nonce"
        ]
       }
      }
     }
    },
    "responses": {
     "200": {
      "description": "OK",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "properties": {
          "product_id": {
           "type": "string"
          },
          "variables": {
           "type": "object",
           "additionalProperties": true,
           "description": "NOT signed. Use vars_b64"
          },
          "vars_b64": {
           "type": "string",
           "description": "Signed values: base64 of JSON"
          },
          "nonce": {
           "type": "string",
           "description": "Echo of your nonce. Refuse the answer if it differs"
          },
          "issued_at": {
           "type": "integer",
           "description": "Unix seconds"
          },
          "signature": {
           "type": "string",
           "description": "Ed25519, base64, over the message in x-signed-message"
          }
         },
         "required": [
          "product_id",
          "variables",
          "vars_b64",
          "nonce",
          "issued_at",
          "signature"
         ]
        }
       }
      }
     },
     "400": {
      "description": "The request is not valid",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Error"
        }
       }
      }
     },
     "403": {
      "description": "Not allowed",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Error"
        }
       }
      }
     },
     "404": {
      "description": "Not found",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Error"
        }
       }
      }
     },
     "429": {
      "description": "Too many requests: see Retry-After",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Error"
        }
       }
      }
     }
    }
   }
  },
  "/api/v1/lease": {
   "post": {
    "tags": [
     "Client API"
    ],
    "summary": "Take a floating seat",
    "security": [],
    "x-signed-message": "pylicense.lease.v1|product_id|hwid|lease_id|expires_at|nonce|seats.used|seats.max|issued_at",
    "operationId": "leaseSeat",
    "requestBody": {
     "required": true,
     "content": {
      "application/json": {
       "schema": {
        "type": "object",
        "properties": {
         "key": {
          "type": "string",
          "description": "The license key",
          "maxLength": 128
         },
         "hwid": {
          "type": "string",
          "description": "The device id. Any stable text; the SDKs use a hash of the machine id",
          "maxLength": 256
         },
         "nonce": {
          "type": "string",
          "description": "A fresh random value per call. It is signed, so an old answer cannot be replayed",
          "maxLength": 64
         }
        },
        "required": [
         "key",
         "nonce"
        ]
       }
      }
     }
    },
    "responses": {
     "200": {
      "description": "OK",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "properties": {
          "lease_id": {
           "type": "string"
          },
          "product_id": {
           "type": "string"
          },
          "expires_at": {
           "type": "string"
          },
          "interval": {
           "type": "integer",
           "description": "Send a heartbeat this often, in seconds"
          },
          "seats": {
           "type": "object",
           "properties": {
            "used": {
             "type": "integer"
            },
            "max": {
             "type": "integer"
            }
           },
           "required": [
            "used",
            "max"
           ]
          },
          "nonce": {
           "type": "string",
           "description": "Echo of your nonce. Refuse the answer if it differs"
          },
          "issued_at": {
           "type": "integer",
           "description": "Unix seconds"
          },
          "signature": {
           "type": "string",
           "description": "Ed25519, base64, over the message in x-signed-message"
          }
         },
         "required": [
          "lease_id",
          "product_id",
          "expires_at",
          "interval",
          "seats",
          "nonce",
          "issued_at",
          "signature"
         ]
        }
       }
      }
     },
     "400": {
      "description": "The request is not valid",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Error"
        }
       }
      }
     },
     "403": {
      "description": "Not allowed",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Error"
        }
       }
      }
     },
     "404": {
      "description": "Not found",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Error"
        }
       }
      }
     },
     "409": {
      "description": "All seats are in use",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Error"
        }
       }
      }
     },
     "429": {
      "description": "Too many requests: see Retry-After",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Error"
        }
       }
      }
     }
    }
   }
  },
  "/api/v1/heartbeat": {
   "post": {
    "tags": [
     "Client API"
    ],
    "summary": "Keep a floating seat",
    "security": [],
    "x-signed-message": "pylicense.heartbeat.v1|lease_id|expires_at|nonce|issued_at",
    "operationId": "heartbeatSeat",
    "requestBody": {
     "required": true,
     "content": {
      "application/json": {
       "schema": {
        "type": "object",
        "properties": {
         "lease_id": {
          "type": "string"
         },
         "nonce": {
          "type": "string",
          "description": "A fresh random value per call. It is signed, so an old answer cannot be replayed",
          "maxLength": 64
         }
        },
        "required": [
         "lease_id",
         "nonce"
        ]
       }
      }
     }
    },
    "responses": {
     "200": {
      "description": "OK",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "properties": {
          "ok": {
           "type": "boolean"
          },
          "expires_at": {
           "type": "string"
          },
          "interval": {
           "type": "integer"
          },
          "nonce": {
           "type": "string",
           "description": "Echo of your nonce. Refuse the answer if it differs"
          },
          "issued_at": {
           "type": "integer",
           "description": "Unix seconds"
          },
          "signature": {
           "type": "string",
           "description": "Ed25519, base64, over the message in x-signed-message"
          }
         },
         "required": [
          "ok",
          "expires_at",
          "interval",
          "nonce",
          "issued_at",
          "signature"
         ]
        }
       }
      }
     },
     "400": {
      "description": "The request is not valid",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Error"
        }
       }
      }
     },
     "403": {
      "description": "Not allowed",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Error"
        }
       }
      }
     },
     "404": {
      "description": "Not found",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Error"
        }
       }
      }
     },
     "429": {
      "description": "Too many requests: see Retry-After",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Error"
        }
       }
      }
     }
    }
   }
  },
  "/api/v1/release": {
   "post": {
    "tags": [
     "Client API"
    ],
    "summary": "Free a floating seat",
    "security": [],
    "operationId": "releaseSeat",
    "requestBody": {
     "required": true,
     "content": {
      "application/json": {
       "schema": {
        "type": "object",
        "properties": {
         "lease_id": {
          "type": "string"
         }
        },
        "required": [
         "lease_id"
        ]
       }
      }
     }
    },
    "responses": {
     "200": {
      "description": "OK",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "properties": {
          "released": {
           "type": "boolean"
          }
         },
         "required": [
          "released"
         ]
        }
       }
      }
     },
     "429": {
      "description": "Too many requests: see Retry-After",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Error"
        }
       }
      }
     }
    }
   }
  },
  "/api/v1/update": {
   "post": {
    "tags": [
     "Client API"
    ],
    "summary": "Ask for a newer version",
    "security": [],
    "x-signed-message": "pylicense.update.v1|product_id|channel|update_available|version|filename|size|nonce|issued_at",
    "operationId": "checkUpdate",
    "requestBody": {
     "required": true,
     "content": {
      "application/json": {
       "schema": {
        "type": "object",
        "properties": {
         "key": {
          "type": "string",
          "description": "The license key",
          "maxLength": 128
         },
         "nonce": {
          "type": "string",
          "description": "A fresh random value per call. It is signed, so an old answer cannot be replayed",
          "maxLength": 64
         },
         "current_version": {
          "type": "string"
         },
         "channel": {
          "type": "string",
          "enum": [
           "stable",
           "beta"
          ],
          "default": "stable"
         }
        },
        "required": [
         "key",
         "nonce"
        ]
       }
      }
     }
    },
    "responses": {
     "200": {
      "description": "OK",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "properties": {
          "update_available": {
           "type": "boolean"
          },
          "version": {
           "type": [
            "string",
            "null"
           ]
          },
          "channel": {
           "type": "string"
          },
          "product_id": {
           "type": "string"
          },
          "notes": {
           "type": [
            "string",
            "null"
           ],
           "description": "Not signed"
          },
          "filename": {
           "type": "string"
          },
          "size": {
           "type": "integer"
          },
          "download_url": {
           "type": "string",
           "description": "Not signed"
          },
          "nonce": {
           "type": "string",
           "description": "Echo of your nonce. Refuse the answer if it differs"
          },
          "issued_at": {
           "type": "integer",
           "description": "Unix seconds"
          },
          "signature": {
           "type": "string",
           "description": "Ed25519, base64, over the message in x-signed-message"
          }
         },
         "required": [
          "update_available",
          "version",
          "channel",
          "product_id",
          "nonce",
          "issued_at",
          "signature"
         ]
        }
       }
      }
     },
     "400": {
      "description": "The request is not valid",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Error"
        }
       }
      }
     },
     "403": {
      "description": "Not allowed",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Error"
        }
       }
      }
     },
     "404": {
      "description": "Not found",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Error"
        }
       }
      }
     },
     "429": {
      "description": "Too many requests: see Retry-After",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Error"
        }
       }
      }
     }
    }
   }
  },
  "/api/v1/health": {
   "get": {
    "tags": [
     "Client API"
    ],
    "summary": "Is the service working?",
    "security": [],
    "operationId": "health",
    "description": "History: https://status.licers.com",
    "responses": {
     "200": {
      "description": "OK",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "properties": {
          "ok": {
           "type": "boolean"
          }
         },
         "required": [
          "ok"
         ]
        }
       }
      }
     },
     "503": {
      "description": "The database cannot be read",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Error"
        }
       }
      }
     }
    }
   }
  },
  "/api/manage/signing-key": {
   "get": {
    "tags": [
     "Account"
    ],
    "summary": "Your public key",
    "operationId": "getPublicKey",
    "description": "Safe to ship inside your app.",
    "responses": {
     "200": {
      "description": "OK",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "properties": {
          "public_key": {
           "type": "string",
           "description": "Raw 32-byte Ed25519 key, base64"
          },
          "alg": {
           "type": "string"
          }
         },
         "required": [
          "public_key",
          "alg"
         ]
        }
       }
      }
     },
     "401": {
      "description": "No API key, or a wrong one",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Error"
        }
       }
      }
     }
    }
   }
  },
  "/api/manage/products": {
   "get": {
    "tags": [
     "Products"
    ],
    "summary": "List products",
    "operationId": "listProducts",
    "responses": {
     "200": {
      "description": "OK",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "properties": {
          "products": {
           "type": "array",
           "items": {
            "$ref": "#/components/schemas/Product"
           }
          }
         },
         "required": [
          "products"
         ]
        }
       }
      }
     },
     "401": {
      "description": "No API key, or a wrong one",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Error"
        }
       }
      }
     }
    }
   },
   "post": {
    "tags": [
     "Products"
    ],
    "summary": "Create a product",
    "operationId": "createProduct",
    "requestBody": {
     "required": true,
     "content": {
      "application/json": {
       "schema": {
        "type": "object",
        "properties": {
         "name": {
          "type": "string",
          "maxLength": 120
         },
         "description": {
          "type": "string",
          "maxLength": 1000
         },
         "key_prefix": {
          "type": "string",
          "maxLength": 12
         },
         "version": {
          "type": "string",
          "maxLength": 40
         },
         "distribution": {
          "type": "string",
          "enum": [
           "desktop",
           "cli",
           "container",
           "mobile",
           "library"
          ]
         },
         "offline_allowed": {
          "type": "boolean"
         }
        },
        "required": [
         "name"
        ]
       }
      }
     }
    },
    "responses": {
     "200": {
      "description": "OK",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "properties": {
          "id": {
           "type": "string"
          },
          "name": {
           "type": "string"
          },
          "description": {
           "type": "string"
          },
          "key_prefix": {
           "type": [
            "string",
            "null"
           ]
          }
         },
         "required": [
          "id",
          "name",
          "description",
          "key_prefix"
         ]
        }
       }
      }
     },
     "400": {
      "description": "The request is not valid",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Error"
        }
       }
      }
     },
     "401": {
      "description": "No API key, or a wrong one",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Error"
        }
       }
      }
     },
     "403": {
      "description": "Not allowed",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Error"
        }
       }
      }
     }
    }
   }
  },
  "/api/manage/products/{product_id}": {
   "put": {
    "tags": [
     "Products"
    ],
    "summary": "Change a product",
    "operationId": "updateProduct",
    "parameters": [
     {
      "name": "product_id",
      "in": "path",
      "required": true,
      "description": "The product id",
      "schema": {
       "type": "string"
      }
     }
    ],
    "requestBody": {
     "required": true,
     "content": {
      "application/json": {
       "schema": {
        "type": "object",
        "properties": {
         "name": {
          "type": "string",
          "maxLength": 120
         },
         "description": {
          "type": "string",
          "maxLength": 1000
         },
         "key_prefix": {
          "type": "string",
          "maxLength": 12
         },
         "version": {
          "type": "string",
          "maxLength": 40
         },
         "distribution": {
          "type": "string",
          "enum": [
           "desktop",
           "cli",
           "container",
           "mobile",
           "library"
          ]
         },
         "offline_allowed": {
          "type": "boolean"
         }
        },
        "required": [
         "name"
        ]
       }
      }
     }
    },
    "responses": {
     "200": {
      "description": "OK",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "properties": {
          "status": {
           "type": "string",
           "enum": [
            "updated"
           ]
          }
         },
         "required": [
          "status"
         ]
        }
       }
      }
     },
     "400": {
      "description": "The request is not valid",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Error"
        }
       }
      }
     },
     "401": {
      "description": "No API key, or a wrong one",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Error"
        }
       }
      }
     },
     "403": {
      "description": "Not allowed",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Error"
        }
       }
      }
     },
     "404": {
      "description": "Not found",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Error"
        }
       }
      }
     }
    }
   },
   "delete": {
    "tags": [
     "Products"
    ],
    "summary": "Delete a product with all its keys and devices",
    "operationId": "deleteProduct",
    "description": "Cannot be undone.",
    "parameters": [
     {
      "name": "product_id",
      "in": "path",
      "required": true,
      "description": "The product id",
      "schema": {
       "type": "string"
      }
     }
    ],
    "responses": {
     "200": {
      "description": "OK",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "properties": {
          "status": {
           "type": "string",
           "enum": [
            "deleted"
           ]
          }
         },
         "required": [
          "status"
         ]
        }
       }
      }
     },
     "401": {
      "description": "No API key, or a wrong one",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Error"
        }
       }
      }
     },
     "403": {
      "description": "Not allowed",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Error"
        }
       }
      }
     },
     "404": {
      "description": "Not found",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Error"
        }
       }
      }
     }
    }
   }
  },
  "/api/manage/products/{product_id}/licenses": {
   "get": {
    "tags": [
     "License keys"
    ],
    "summary": "List the keys of a product",
    "operationId": "listLicenses",
    "parameters": [
     {
      "name": "product_id",
      "in": "path",
      "required": true,
      "description": "The product id",
      "schema": {
       "type": "string"
      }
     }
    ],
    "responses": {
     "200": {
      "description": "OK",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "properties": {
          "licenses": {
           "type": "array",
           "items": {
            "$ref": "#/components/schemas/License"
           }
          }
         },
         "required": [
          "licenses"
         ]
        }
       }
      }
     },
     "401": {
      "description": "No API key, or a wrong one",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Error"
        }
       }
      }
     },
     "404": {
      "description": "Not found",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Error"
        }
       }
      }
     }
    }
   },
   "post": {
    "tags": [
     "License keys"
    ],
    "summary": "Create keys in a product",
    "operationId": "createLicenses",
    "parameters": [
     {
      "name": "product_id",
      "in": "path",
      "required": true,
      "description": "The product id",
      "schema": {
       "type": "string"
      }
     }
    ],
    "requestBody": {
     "required": true,
     "content": {
      "application/json": {
       "schema": {
        "type": "object",
        "properties": {
         "max_hwids": {
          "type": "integer",
          "description": "Devices per key",
          "minimum": 1,
          "maximum": 100000,
          "default": 1
         },
         "expires_in_days": {
          "type": "integer",
          "description": "Days until it expires. Leave out for a lifetime key",
          "minimum": 1,
          "maximum": 36500
         },
         "activate_on_use": {
          "type": "boolean",
          "description": "Count those days from the first use"
         },
         "features": {
          "description": "Entitlements: a JSON object, for example {\"pro\": true, \"seats\": 5}",
          "type": "object",
          "additionalProperties": true
         },
         "os_lock": {
          "type": "string",
          "description": "Only this operating system",
          "enum": [
           "windows",
           "linux",
           "macos"
          ]
         },
         "max_concurrent": {
          "type": "integer",
          "description": "Floating seats: how many may run at once",
          "minimum": 1
         },
         "lease_ttl": {
          "type": "integer",
          "description": "Seconds until a silent seat is freed",
          "minimum": 30
         },
         "usage_limit": {
          "type": "integer",
          "description": "Usage credits",
          "minimum": 0
         },
         "usage_reset": {
          "type": "string",
          "description": "Refill of the credits",
          "enum": [
           "daily",
           "monthly"
          ]
         },
         "quantity": {
          "type": "integer",
          "description": "How many keys",
          "minimum": 1,
          "maximum": 100,
          "default": 1
         },
         "customer_name": {
          "type": "string",
          "maxLength": 200
         },
         "customer_email": {
          "type": "string",
          "description": "For the key email and the customer portal",
          "format": "email"
         },
         "email_customer": {
          "type": "boolean",
          "description": "Email the key to customer_email"
         },
         "note": {
          "type": "string",
          "description": "Only you see it",
          "maxLength": 1000
         },
         "key_prefix": {
          "type": "string",
          "description": "For example ACME",
          "maxLength": 12
         },
         "offline_allowed": {
          "type": "boolean",
          "description": "false: no offline files for this key"
         },
         "plan_id": {
          "type": "string",
          "description": "A license plan. Fields sent here win over it"
         }
        }
       }
      }
     }
    },
    "responses": {
     "200": {
      "description": "OK",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "properties": {
          "licenses": {
           "type": "array",
           "items": {
            "type": "object",
            "properties": {
             "id": {
              "type": "string"
             },
             "key": {
              "type": "string"
             },
             "max_hwids": {
              "type": "integer"
             },
             "expires_at": {
              "type": [
               "string",
               "null"
              ]
             },
             "usage_limit": {
              "type": [
               "integer",
               "null"
              ]
             },
             "usage_reset": {
              "type": [
               "string",
               "null"
              ]
             },
             "customer_email": {
              "type": [
               "string",
               "null"
              ]
             }
            },
            "required": [
             "id",
             "key",
             "max_hwids",
             "expires_at",
             "usage_limit",
             "usage_reset",
             "customer_email"
            ]
           }
          },
          "count": {
           "type": "integer"
          },
          "emailed": {
           "type": "integer",
           "description": "How many key emails were queued"
          }
         },
         "required": [
          "licenses",
          "count",
          "emailed"
         ]
        }
       }
      }
     },
     "400": {
      "description": "The request is not valid",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Error"
        }
       }
      }
     },
     "401": {
      "description": "No API key, or a wrong one",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Error"
        }
       }
      }
     },
     "403": {
      "description": "Not allowed",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Error"
        }
       }
      }
     },
     "404": {
      "description": "Not found",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Error"
        }
       }
      }
     }
    }
   }
  },
  "/api/manage/licenses": {
   "get": {
    "tags": [
     "License keys"
    ],
    "summary": "Search keys over all products",
    "operationId": "searchLicenses",
    "parameters": [
     {
      "name": "q",
      "in": "query",
      "required": false,
      "description": "Part of the key, customer, email or note",
      "schema": {
       "type": "string"
      }
     },
     {
      "name": "key",
      "in": "query",
      "required": false,
      "description": "This exact key",
      "schema": {
       "type": "string"
      }
     },
     {
      "name": "product_id",
      "in": "query",
      "required": false,
      "description": "Only this product",
      "schema": {
       "type": "string"
      }
     },
     {
      "name": "status",
      "in": "query",
      "required": false,
      "description": "Only these",
      "schema": {
       "type": "string",
       "enum": [
        "active",
        "revoked",
        "expired",
        "expiring"
       ]
      }
     },
     {
      "name": "limit",
      "in": "query",
      "required": false,
      "description": "At most 200",
      "schema": {
       "type": "integer",
       "minimum": 1,
       "maximum": 200,
       "default": 50
      }
     },
     {
      "name": "offset",
      "in": "query",
      "required": false,
      "description": "Skip this many",
      "schema": {
       "type": "integer",
       "minimum": 0,
       "default": 0
      }
     }
    ],
    "responses": {
     "200": {
      "description": "OK",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "properties": {
          "licenses": {
           "type": "array",
           "items": {
            "$ref": "#/components/schemas/License"
           }
          },
          "total": {
           "type": "integer"
          },
          "limit": {
           "type": "integer"
          },
          "offset": {
           "type": "integer"
          }
         },
         "required": [
          "licenses",
          "total",
          "limit",
          "offset"
         ]
        }
       }
      }
     },
     "400": {
      "description": "The request is not valid",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Error"
        }
       }
      }
     },
     "401": {
      "description": "No API key, or a wrong one",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Error"
        }
       }
      }
     }
    }
   },
   "post": {
    "tags": [
     "License keys"
    ],
    "summary": "Create keys, product optional",
    "operationId": "createLicense",
    "description": "Without product_id the keys go into a default product.",
    "requestBody": {
     "required": true,
     "content": {
      "application/json": {
       "schema": {
        "type": "object",
        "properties": {
         "product_id": {
          "type": "string"
         },
         "max_hwids": {
          "type": "integer",
          "description": "Devices per key",
          "minimum": 1,
          "maximum": 100000,
          "default": 1
         },
         "expires_in_days": {
          "type": "integer",
          "description": "Days until it expires. Leave out for a lifetime key",
          "minimum": 1,
          "maximum": 36500
         },
         "activate_on_use": {
          "type": "boolean",
          "description": "Count those days from the first use"
         },
         "features": {
          "description": "Entitlements: a JSON object, for example {\"pro\": true, \"seats\": 5}",
          "type": "object",
          "additionalProperties": true
         },
         "os_lock": {
          "type": "string",
          "description": "Only this operating system",
          "enum": [
           "windows",
           "linux",
           "macos"
          ]
         },
         "max_concurrent": {
          "type": "integer",
          "description": "Floating seats: how many may run at once",
          "minimum": 1
         },
         "lease_ttl": {
          "type": "integer",
          "description": "Seconds until a silent seat is freed",
          "minimum": 30
         },
         "usage_limit": {
          "type": "integer",
          "description": "Usage credits",
          "minimum": 0
         },
         "usage_reset": {
          "type": "string",
          "description": "Refill of the credits",
          "enum": [
           "daily",
           "monthly"
          ]
         },
         "quantity": {
          "type": "integer",
          "description": "How many keys",
          "minimum": 1,
          "maximum": 100,
          "default": 1
         },
         "customer_name": {
          "type": "string",
          "maxLength": 200
         },
         "customer_email": {
          "type": "string",
          "description": "For the key email and the customer portal",
          "format": "email"
         },
         "email_customer": {
          "type": "boolean",
          "description": "Email the key to customer_email"
         },
         "note": {
          "type": "string",
          "description": "Only you see it",
          "maxLength": 1000
         },
         "key_prefix": {
          "type": "string",
          "description": "For example ACME",
          "maxLength": 12
         },
         "offline_allowed": {
          "type": "boolean",
          "description": "false: no offline files for this key"
         },
         "plan_id": {
          "type": "string",
          "description": "A license plan. Fields sent here win over it"
         }
        }
       }
      }
     }
    },
    "responses": {
     "200": {
      "description": "OK",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "properties": {
          "licenses": {
           "type": "array",
           "items": {
            "type": "object",
            "properties": {
             "id": {
              "type": "string"
             },
             "key": {
              "type": "string"
             },
             "max_hwids": {
              "type": "integer"
             },
             "expires_at": {
              "type": [
               "string",
               "null"
              ]
             },
             "usage_limit": {
              "type": [
               "integer",
               "null"
              ]
             },
             "usage_reset": {
              "type": [
               "string",
               "null"
              ]
             },
             "customer_email": {
              "type": [
               "string",
               "null"
              ]
             }
            },
            "required": [
             "id",
             "key",
             "max_hwids",
             "expires_at",
             "usage_limit",
             "usage_reset",
             "customer_email"
            ]
           }
          },
          "count": {
           "type": "integer"
          },
          "emailed": {
           "type": "integer",
           "description": "How many key emails were queued"
          },
          "product": {
           "type": "object",
           "properties": {
            "id": {
             "type": "string"
            },
            "name": {
             "type": "string"
            }
           },
           "required": [
            "id",
            "name"
           ]
          },
          "used_default": {
           "type": "boolean"
          }
         },
         "required": [
          "licenses",
          "count",
          "emailed"
         ]
        }
       }
      }
     },
     "400": {
      "description": "The request is not valid",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Error"
        }
       }
      }
     },
     "401": {
      "description": "No API key, or a wrong one",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Error"
        }
       }
      }
     },
     "403": {
      "description": "Not allowed",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Error"
        }
       }
      }
     },
     "404": {
      "description": "Not found",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Error"
        }
       }
      }
     }
    }
   }
  },
  "/api/manage/licenses/export": {
   "get": {
    "tags": [
     "License keys"
    ],
    "summary": "Export keys as CSV",
    "operationId": "exportLicenses",
    "parameters": [
     {
      "name": "product_id",
      "in": "query",
      "required": false,
      "description": "Only this product",
      "schema": {
       "type": "string"
      }
     }
    ],
    "responses": {
     "200": {
      "description": "CSV",
      "content": {
       "text/csv": {
        "schema": {
         "type": "string"
        }
       }
      }
     },
     "401": {
      "description": "No API key, or a wrong one",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Error"
        }
       }
      }
     }
    }
   }
  },
  "/api/manage/licenses/{license_id}": {
   "get": {
    "tags": [
     "License keys"
    ],
    "summary": "One key",
    "operationId": "getLicense",
    "parameters": [
     {
      "name": "license_id",
      "in": "path",
      "required": true,
      "description": "The license id (not the key)",
      "schema": {
       "type": "string"
      }
     }
    ],
    "responses": {
     "200": {
      "description": "OK",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "properties": {
          "license": {
           "$ref": "#/components/schemas/License"
          }
         },
         "required": [
          "license"
         ]
        }
       }
      }
     },
     "401": {
      "description": "No API key, or a wrong one",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Error"
        }
       }
      }
     },
     "404": {
      "description": "Not found",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Error"
        }
       }
      }
     }
    }
   },
   "put": {
    "tags": [
     "License keys"
    ],
    "summary": "Change, revoke or reactivate a key",
    "operationId": "updateLicense",
    "description": "Only the fields you send are changed. For a subscription renewal use extend_days: it adds to the days that are left, so renewing early loses nothing, and an expired key works again on the devices it had.",
    "parameters": [
     {
      "name": "license_id",
      "in": "path",
      "required": true,
      "description": "The license id (not the key)",
      "schema": {
       "type": "string"
      }
     }
    ],
    "requestBody": {
     "required": true,
     "content": {
      "application/json": {
       "schema": {
        "type": "object",
        "properties": {
         "status": {
          "type": "string",
          "enum": [
           "active",
           "revoked"
          ]
         },
         "extend_days": {
          "type": "integer",
          "description": "Renewal: adds this many days to the end date (or to today, once expired). For a key that starts on first use, adds them to its length. Not together with expires_in_days",
          "minimum": 1,
          "maximum": 36500,
          "example": 30
         },
         "revoked_message": {
          "type": "string",
          "description": "Shown in the app",
          "maxLength": 300
         },
         "max_hwids": {
          "type": "integer",
          "description": "Devices per key",
          "minimum": 1,
          "maximum": 100000,
          "default": 1
         },
         "expires_in_days": {
          "type": [
           "integer",
           "null"
          ],
          "description": "From today. null: never expires",
          "minimum": 1,
          "maximum": 36500
         },
         "features": {
          "description": "Entitlements: a JSON object, for example {\"pro\": true, \"seats\": 5}",
          "type": "object",
          "additionalProperties": true
         },
         "os_lock": {
          "type": [
           "string",
           "null"
          ],
          "description": "Only this operating system",
          "enum": [
           "windows",
           "linux",
           "macos",
           null
          ]
         },
         "max_concurrent": {
          "type": [
           "integer",
           "null"
          ],
          "description": "Floating seats: how many may run at once",
          "minimum": 1
         },
         "lease_ttl": {
          "type": [
           "integer",
           "null"
          ],
          "description": "Seconds until a silent seat is freed",
          "minimum": 30
         },
         "usage_limit": {
          "type": [
           "integer",
           "null"
          ],
          "description": "Usage credits",
          "minimum": 0
         },
         "usage_reset": {
          "type": [
           "string",
           "null"
          ],
          "description": "Refill of the credits",
          "enum": [
           "daily",
           "monthly",
           null
          ]
         },
         "customer_name": {
          "type": [
           "string",
           "null"
          ],
          "maxLength": 200
         },
         "customer_email": {
          "type": [
           "string",
           "null"
          ],
          "format": "email"
         },
         "note": {
          "type": [
           "string",
           "null"
          ],
          "maxLength": 1000
         },
         "offline_allowed": {
          "type": "boolean"
         }
        }
       }
      }
     }
    },
    "responses": {
     "200": {
      "description": "OK",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "properties": {
          "status": {
           "type": "string",
           "enum": [
            "updated"
           ]
          },
          "license_status": {
           "type": "string",
           "enum": [
            "active",
            "revoked"
           ]
          },
          "expires_at": {
           "type": [
            "string",
            "null"
           ],
           "format": "date-time",
           "description": "null: never, or not started yet"
          },
          "starts_on_first_use_days": {
           "type": "integer",
           "description": "Only for a key that has not been used yet"
          }
         },
         "required": [
          "status"
         ]
        }
       }
      }
     },
     "400": {
      "description": "The request is not valid",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Error"
        }
       }
      }
     },
     "401": {
      "description": "No API key, or a wrong one",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Error"
        }
       }
      }
     },
     "403": {
      "description": "Not allowed",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Error"
        }
       }
      }
     },
     "404": {
      "description": "Not found",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Error"
        }
       }
      }
     }
    }
   },
   "delete": {
    "tags": [
     "License keys"
    ],
    "summary": "Delete a key",
    "operationId": "deleteLicense",
    "description": "Cannot be undone. Revoking keeps the history.",
    "parameters": [
     {
      "name": "license_id",
      "in": "path",
      "required": true,
      "description": "The license id (not the key)",
      "schema": {
       "type": "string"
      }
     }
    ],
    "responses": {
     "200": {
      "description": "OK",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "properties": {
          "status": {
           "type": "string",
           "enum": [
            "deleted"
           ]
          }
         },
         "required": [
          "status"
         ]
        }
       }
      }
     },
     "401": {
      "description": "No API key, or a wrong one",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Error"
        }
       }
      }
     },
     "403": {
      "description": "Not allowed",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Error"
        }
       }
      }
     },
     "404": {
      "description": "Not found",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Error"
        }
       }
      }
     }
    }
   }
  },
  "/api/manage/licenses/{license_id}/email": {
   "post": {
    "tags": [
     "License keys"
    ],
    "summary": "Email the key to its customer",
    "operationId": "emailLicense",
    "parameters": [
     {
      "name": "license_id",
      "in": "path",
      "required": true,
      "description": "The license id (not the key)",
      "schema": {
       "type": "string"
      }
     }
    ],
    "responses": {
     "200": {
      "description": "OK",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "properties": {
          "status": {
           "type": "string"
          },
          "to": {
           "type": "string"
          }
         },
         "required": [
          "status",
          "to"
         ]
        }
       }
      }
     },
     "400": {
      "description": "The request is not valid",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Error"
        }
       }
      }
     },
     "401": {
      "description": "No API key, or a wrong one",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Error"
        }
       }
      }
     },
     "403": {
      "description": "Not allowed",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Error"
        }
       }
      }
     },
     "404": {
      "description": "Not found",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Error"
        }
       }
      }
     },
     "429": {
      "description": "Too many requests: see Retry-After",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Error"
        }
       }
      }
     }
    }
   }
  },
  "/api/manage/licenses/{license_id}/offline": {
   "post": {
    "tags": [
     "License keys"
    ],
    "summary": "Create a signed offline license file",
    "operationId": "createOfflineFile",
    "parameters": [
     {
      "name": "license_id",
      "in": "path",
      "required": true,
      "description": "The license id (not the key)",
      "schema": {
       "type": "string"
      }
     }
    ],
    "requestBody": {
     "required": true,
     "content": {
      "application/json": {
       "schema": {
        "type": "object",
        "properties": {
         "hwid": {
          "type": "string",
          "description": "Leave out: works on any device"
         },
         "expires_in_days": {
          "type": "integer",
          "description": "Life of the file",
          "minimum": 1,
          "maximum": 36500
         }
        }
       }
      }
     }
    },
    "responses": {
     "200": {
      "description": "OK",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "properties": {
          "license_file": {
           "type": "string",
           "description": "Save as license.lic"
          },
          "payload": {
           "type": "object",
           "additionalProperties": true
          },
          "public_key": {
           "type": "string"
          }
         },
         "required": [
          "license_file",
          "payload",
          "public_key"
         ]
        }
       }
      }
     },
     "400": {
      "description": "The request is not valid",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Error"
        }
       }
      }
     },
     "401": {
      "description": "No API key, or a wrong one",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Error"
        }
       }
      }
     },
     "403": {
      "description": "Not allowed",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Error"
        }
       }
      }
     },
     "404": {
      "description": "Not found",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Error"
        }
       }
      }
     }
    }
   }
  },
  "/api/manage/licenses/{license_id}/usage": {
   "get": {
    "tags": [
     "License keys"
    ],
    "summary": "Credits of a key",
    "operationId": "getUsage",
    "parameters": [
     {
      "name": "license_id",
      "in": "path",
      "required": true,
      "description": "The license id (not the key)",
      "schema": {
       "type": "string"
      }
     }
    ],
    "responses": {
     "200": {
      "description": "OK",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Usage"
        }
       }
      }
     },
     "401": {
      "description": "No API key, or a wrong one",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Error"
        }
       }
      }
     },
     "404": {
      "description": "Not found",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Error"
        }
       }
      }
     }
    }
   },
   "post": {
    "tags": [
     "License keys"
    ],
    "summary": "Add, reset or correct credits",
    "operationId": "adjustUsage",
    "parameters": [
     {
      "name": "license_id",
      "in": "path",
      "required": true,
      "description": "The license id (not the key)",
      "schema": {
       "type": "string"
      }
     }
    ],
    "requestBody": {
     "required": true,
     "content": {
      "application/json": {
       "schema": {
        "type": "object",
        "properties": {
         "op": {
          "type": "string",
          "enum": [
           "add",
           "reset",
           "set_used"
          ]
         },
         "amount": {
          "type": "integer",
          "description": "For add and set_used",
          "minimum": 0
         }
        },
        "required": [
         "op"
        ]
       }
      }
     }
    },
    "responses": {
     "200": {
      "description": "OK",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Usage"
        }
       }
      }
     },
     "400": {
      "description": "The request is not valid",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Error"
        }
       }
      }
     },
     "401": {
      "description": "No API key, or a wrong one",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Error"
        }
       }
      }
     },
     "403": {
      "description": "Not allowed",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Error"
        }
       }
      }
     },
     "404": {
      "description": "Not found",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Error"
        }
       }
      }
     }
    }
   }
  },
  "/api/manage/licenses/{license_id}/hwids": {
   "get": {
    "tags": [
     "Devices"
    ],
    "summary": "Devices of a key",
    "operationId": "listDevicesOfLicense",
    "parameters": [
     {
      "name": "license_id",
      "in": "path",
      "required": true,
      "description": "The license id (not the key)",
      "schema": {
       "type": "string"
      }
     }
    ],
    "responses": {
     "200": {
      "description": "OK",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "properties": {
          "hwids": {
           "type": "array",
           "items": {
            "$ref": "#/components/schemas/Device"
           }
          }
         },
         "required": [
          "hwids"
         ]
        }
       }
      }
     },
     "401": {
      "description": "No API key, or a wrong one",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Error"
        }
       }
      }
     },
     "404": {
      "description": "Not found",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Error"
        }
       }
      }
     }
    }
   },
   "post": {
    "tags": [
     "Devices"
    ],
    "summary": "Bind a device by hand",
    "operationId": "addDevice",
    "parameters": [
     {
      "name": "license_id",
      "in": "path",
      "required": true,
      "description": "The license id (not the key)",
      "schema": {
       "type": "string"
      }
     }
    ],
    "requestBody": {
     "required": true,
     "content": {
      "application/json": {
       "schema": {
        "type": "object",
        "properties": {
         "hwid": {
          "type": "string",
          "maxLength": 200
         },
         "device_name": {
          "type": "string",
          "maxLength": 120
         },
         "platform": {
          "type": "string",
          "maxLength": 60
         }
        },
        "required": [
         "hwid"
        ]
       }
      }
     }
    },
    "responses": {
     "200": {
      "description": "OK",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "properties": {
          "status": {
           "type": "string",
           "enum": [
            "added"
           ]
          }
         },
         "required": [
          "status"
         ]
        }
       }
      }
     },
     "400": {
      "description": "The request is not valid",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Error"
        }
       }
      }
     },
     "401": {
      "description": "No API key, or a wrong one",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Error"
        }
       }
      }
     },
     "403": {
      "description": "Not allowed",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Error"
        }
       }
      }
     },
     "404": {
      "description": "Not found",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Error"
        }
       }
      }
     }
    }
   }
  },
  "/api/manage/licenses/{license_id}/reset-hwids": {
   "post": {
    "tags": [
     "Devices"
    ],
    "summary": "Unbind every device of a key",
    "operationId": "resetDevices",
    "parameters": [
     {
      "name": "license_id",
      "in": "path",
      "required": true,
      "description": "The license id (not the key)",
      "schema": {
       "type": "string"
      }
     }
    ],
    "responses": {
     "200": {
      "description": "OK",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "properties": {
          "status": {
           "type": "string",
           "enum": [
            "reset"
           ]
          }
         },
         "required": [
          "status"
         ]
        }
       }
      }
     },
     "401": {
      "description": "No API key, or a wrong one",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Error"
        }
       }
      }
     },
     "403": {
      "description": "Not allowed",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Error"
        }
       }
      }
     },
     "404": {
      "description": "Not found",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Error"
        }
       }
      }
     }
    }
   }
  },
  "/api/manage/licenses/{license_id}/reset-sessions": {
   "post": {
    "tags": [
     "Devices"
    ],
    "summary": "Free every floating seat of a key",
    "operationId": "resetSessions",
    "parameters": [
     {
      "name": "license_id",
      "in": "path",
      "required": true,
      "description": "The license id (not the key)",
      "schema": {
       "type": "string"
      }
     }
    ],
    "responses": {
     "200": {
      "description": "OK",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "properties": {
          "status": {
           "type": "string",
           "enum": [
            "reset"
           ]
          }
         },
         "required": [
          "status"
         ]
        }
       }
      }
     },
     "401": {
      "description": "No API key, or a wrong one",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Error"
        }
       }
      }
     },
     "403": {
      "description": "Not allowed",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Error"
        }
       }
      }
     },
     "404": {
      "description": "Not found",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Error"
        }
       }
      }
     }
    }
   }
  },
  "/api/manage/hwids/{device_id}": {
   "delete": {
    "tags": [
     "Devices"
    ],
    "summary": "Remove one device",
    "operationId": "removeDevice",
    "parameters": [
     {
      "name": "device_id",
      "in": "path",
      "required": true,
      "description": "The id from a device list",
      "schema": {
       "type": "string"
      }
     }
    ],
    "responses": {
     "200": {
      "description": "OK",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "properties": {
          "status": {
           "type": "string",
           "enum": [
            "deleted"
           ]
          }
         },
         "required": [
          "status"
         ]
        }
       }
      }
     },
     "401": {
      "description": "No API key, or a wrong one",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Error"
        }
       }
      }
     },
     "403": {
      "description": "Not allowed",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Error"
        }
       }
      }
     },
     "404": {
      "description": "Not found",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Error"
        }
       }
      }
     }
    }
   }
  },
  "/api/manage/devices": {
   "get": {
    "tags": [
     "Devices"
    ],
    "summary": "All devices",
    "operationId": "listDevices",
    "responses": {
     "200": {
      "description": "OK",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "properties": {
          "devices": {
           "type": "array",
           "items": {
            "type": "object",
            "properties": {
             "id": {
              "type": "string"
             },
             "hwid": {
              "type": "string"
             },
             "device_name": {
              "type": [
               "string",
               "null"
              ]
             },
             "platform": {
              "type": [
               "string",
               "null"
              ]
             },
             "created_at": {
              "type": "string"
             },
             "last_validated": {
              "type": [
               "string",
               "null"
              ]
             },
             "license_id": {
              "type": "string"
             },
             "license_key": {
              "type": "string"
             },
             "product_id": {
              "type": "string"
             },
             "product_name": {
              "type": "string"
             }
            },
            "required": [
             "id",
             "hwid",
             "device_name",
             "platform",
             "created_at",
             "last_validated",
             "license_id",
             "license_key",
             "product_id",
             "product_name"
            ]
           }
          }
         },
         "required": [
          "devices"
         ]
        }
       }
      }
     },
     "401": {
      "description": "No API key, or a wrong one",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Error"
        }
       }
      }
     }
    }
   }
  },
  "/api/manage/logs": {
   "get": {
    "tags": [
     "Monitoring"
    ],
    "summary": "The last 100 license checks",
    "operationId": "listLogs",
    "parameters": [
     {
      "name": "product_id",
      "in": "query",
      "required": false,
      "description": "Only this product",
      "schema": {
       "type": "string"
      }
     },
     {
      "name": "status",
      "in": "query",
      "required": false,
      "description": "Only this result",
      "schema": {
       "type": "string",
       "example": "success"
      }
     },
     {
      "name": "license_id",
      "in": "query",
      "required": false,
      "description": "Only this key",
      "schema": {
       "type": "string"
      }
     }
    ],
    "responses": {
     "200": {
      "description": "OK",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "properties": {
          "logs": {
           "type": "array",
           "items": {
            "type": "object",
            "properties": {
             "id": {
              "type": "string"
             },
             "license_id": {
              "type": [
               "string",
               "null"
              ]
             },
             "product_id": {
              "type": [
               "string",
               "null"
              ]
             },
             "product_name": {
              "type": "string"
             },
             "provided_key": {
              "type": "string"
             },
             "provided_hwid": {
              "type": "string"
             },
             "country": {
              "type": [
               "string",
               "null"
              ]
             },
             "status": {
              "type": "string",
              "description": "success, expired, revoked, hwid_limit, blocked and others"
             },
             "created_at": {
              "type": "string"
             }
            },
            "required": [
             "id",
             "license_id",
             "product_id",
             "product_name",
             "provided_key",
             "provided_hwid",
             "country",
             "status",
             "created_at"
            ]
           }
          }
         },
         "required": [
          "logs"
         ]
        }
       }
      }
     },
     "401": {
      "description": "No API key, or a wrong one",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Error"
        }
       }
      }
     }
    }
   }
  },
  "/api/manage/abuse": {
   "get": {
    "tags": [
     "Monitoring"
    ],
    "summary": "Keys that look shared",
    "operationId": "listSuspicious",
    "responses": {
     "200": {
      "description": "OK",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "properties": {
          "flagged": {
           "type": "array",
           "items": {
            "type": "object",
            "properties": {
             "id": {
              "type": "string"
             },
             "key": {
              "type": "string"
             },
             "ips": {
              "type": "integer"
             },
             "risk": {
              "type": "string",
              "enum": [
               "low",
               "medium",
               "high"
              ]
             }
            },
            "required": [
             "id",
             "key",
             "ips",
             "risk"
            ]
           }
          }
         },
         "required": [
          "flagged"
         ]
        }
       }
      }
     },
     "401": {
      "description": "No API key, or a wrong one",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Error"
        }
       }
      }
     }
    }
   }
  },
  "/api/manage/products/{product_id}/releases": {
   "get": {
    "tags": [
     "Releases"
    ],
    "summary": "List releases",
    "operationId": "listReleases",
    "parameters": [
     {
      "name": "product_id",
      "in": "path",
      "required": true,
      "description": "The product id",
      "schema": {
       "type": "string"
      }
     }
    ],
    "responses": {
     "200": {
      "description": "OK",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "properties": {
          "releases": {
           "type": "array",
           "items": {
            "type": "object",
            "properties": {
             "id": {
              "type": "string"
             },
             "version": {
              "type": "string"
             },
             "channel": {
              "type": "string"
             },
             "notes": {
              "type": [
               "string",
               "null"
              ]
             },
             "external_url": {
              "type": [
               "string",
               "null"
              ]
             },
             "created_at": {
              "type": "string"
             }
            },
            "required": [
             "id",
             "version",
             "channel",
             "notes",
             "external_url",
             "created_at"
            ]
           }
          }
         },
         "required": [
          "releases"
         ]
        }
       }
      }
     },
     "401": {
      "description": "No API key, or a wrong one",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Error"
        }
       }
      }
     },
     "404": {
      "description": "Not found",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Error"
        }
       }
      }
     }
    }
   },
   "post": {
    "tags": [
     "Releases"
    ],
    "summary": "Publish a release",
    "operationId": "createRelease",
    "parameters": [
     {
      "name": "product_id",
      "in": "path",
      "required": true,
      "description": "The product id",
      "schema": {
       "type": "string"
      }
     }
    ],
    "requestBody": {
     "required": true,
     "content": {
      "application/json": {
       "schema": {
        "type": "object",
        "properties": {
         "version": {
          "type": "string",
          "maxLength": 60
         },
         "url": {
          "type": "string",
          "description": "Where your build is. https only",
          "format": "uri"
         },
         "channel": {
          "type": "string",
          "enum": [
           "stable",
           "beta"
          ],
          "default": "stable"
         },
         "notes": {
          "type": "string",
          "maxLength": 2000
         },
         "size": {
          "type": "integer",
          "description": "Bytes",
          "minimum": 1
         }
        },
        "required": [
         "version",
         "url"
        ]
       }
      }
     }
    },
    "responses": {
     "200": {
      "description": "OK",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "properties": {
          "id": {
           "type": "string"
          },
          "version": {
           "type": "string"
          },
          "channel": {
           "type": "string"
          },
          "filename": {
           "type": "string"
          },
          "size": {
           "type": "integer"
          },
          "external_url": {
           "type": "string"
          }
         },
         "required": [
          "id",
          "version",
          "channel",
          "filename",
          "size",
          "external_url"
         ]
        }
       }
      }
     },
     "400": {
      "description": "The request is not valid",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Error"
        }
       }
      }
     },
     "401": {
      "description": "No API key, or a wrong one",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Error"
        }
       }
      }
     },
     "403": {
      "description": "Not allowed",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Error"
        }
       }
      }
     },
     "404": {
      "description": "Not found",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Error"
        }
       }
      }
     },
     "429": {
      "description": "Too many requests: see Retry-After",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Error"
        }
       }
      }
     }
    }
   }
  },
  "/api/manage/releases/{release_id}": {
   "delete": {
    "tags": [
     "Releases"
    ],
    "summary": "Delete a release",
    "operationId": "deleteRelease",
    "parameters": [
     {
      "name": "release_id",
      "in": "path",
      "required": true,
      "description": "The release id",
      "schema": {
       "type": "string"
      }
     }
    ],
    "responses": {
     "200": {
      "description": "OK",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "properties": {
          "status": {
           "type": "string",
           "enum": [
            "deleted"
           ]
          }
         },
         "required": [
          "status"
         ]
        }
       }
      }
     },
     "401": {
      "description": "No API key, or a wrong one",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Error"
        }
       }
      }
     },
     "403": {
      "description": "Not allowed",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Error"
        }
       }
      }
     },
     "404": {
      "description": "Not found",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Error"
        }
       }
      }
     }
    }
   }
  },
  "/api/manage/blocklist": {
   "get": {
    "tags": [
     "Protection"
    ],
    "summary": "List blocks",
    "operationId": "listBlocks",
    "responses": {
     "200": {
      "description": "OK",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "properties": {
          "entries": {
           "type": "array",
           "items": {
            "type": "object",
            "properties": {
             "id": {
              "type": "string"
             },
             "type": {
              "type": "string"
             },
             "value": {
              "type": "string"
             },
             "note": {
              "type": [
               "string",
               "null"
              ]
             },
             "created_at": {
              "type": "string"
             }
            },
            "required": [
             "id",
             "type",
             "value",
             "note",
             "created_at"
            ]
           }
          }
         },
         "required": [
          "entries"
         ]
        }
       }
      }
     },
     "401": {
      "description": "No API key, or a wrong one",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Error"
        }
       }
      }
     }
    }
   },
   "post": {
    "tags": [
     "Protection"
    ],
    "summary": "Block a device, IP address or country",
    "operationId": "addBlock",
    "requestBody": {
     "required": true,
     "content": {
      "application/json": {
       "schema": {
        "type": "object",
        "properties": {
         "type": {
          "type": "string",
          "enum": [
           "hwid",
           "ip",
           "country"
          ]
         },
         "value": {
          "type": "string",
          "maxLength": 200
         },
         "note": {
          "type": "string",
          "maxLength": 200
         }
        },
        "required": [
         "type",
         "value"
        ]
       }
      }
     }
    },
    "responses": {
     "200": {
      "description": "OK",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "properties": {
          "id": {
           "type": "string"
          },
          "type": {
           "type": "string"
          },
          "value": {
           "type": "string"
          }
         },
         "required": [
          "id",
          "type",
          "value"
         ]
        }
       }
      }
     },
     "400": {
      "description": "The request is not valid",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Error"
        }
       }
      }
     },
     "401": {
      "description": "No API key, or a wrong one",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Error"
        }
       }
      }
     },
     "403": {
      "description": "Not allowed",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Error"
        }
       }
      }
     }
    }
   }
  },
  "/api/manage/blocklist/{block_id}": {
   "delete": {
    "tags": [
     "Protection"
    ],
    "summary": "Lift a block",
    "operationId": "removeBlock",
    "parameters": [
     {
      "name": "block_id",
      "in": "path",
      "required": true,
      "description": "The block id",
      "schema": {
       "type": "string"
      }
     }
    ],
    "responses": {
     "200": {
      "description": "OK",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "properties": {
          "status": {
           "type": "string",
           "enum": [
            "deleted"
           ]
          }
         },
         "required": [
          "status"
         ]
        }
       }
      }
     },
     "401": {
      "description": "No API key, or a wrong one",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Error"
        }
       }
      }
     },
     "403": {
      "description": "Not allowed",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Error"
        }
       }
      }
     },
     "404": {
      "description": "Not found",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Error"
        }
       }
      }
     }
    }
   }
  },
  "/api/manage/messages": {
   "get": {
    "tags": [
     "Protection"
    ],
    "summary": "Texts your users see",
    "operationId": "getMessages",
    "responses": {
     "200": {
      "description": "OK",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "properties": {
          "defaults": {
           "type": "object",
           "additionalProperties": true
          },
          "messages": {
           "type": "object",
           "additionalProperties": true
          }
         },
         "required": [
          "defaults",
          "messages"
         ]
        }
       }
      }
     },
     "401": {
      "description": "No API key, or a wrong one",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Error"
        }
       }
      }
     }
    }
   },
   "put": {
    "tags": [
     "Protection"
    ],
    "summary": "Change those texts",
    "operationId": "setMessages",
    "description": "Replaces all of them. A text left out goes back to its default.",
    "requestBody": {
     "required": true,
     "content": {
      "application/json": {
       "schema": {
        "type": "object",
        "properties": {
         "messages": {
          "type": "object",
          "additionalProperties": true,
          "description": "Name to text. The names are in defaults"
         }
        },
        "required": [
         "messages"
        ]
       }
      }
     }
    },
    "responses": {
     "200": {
      "description": "OK",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "properties": {
          "status": {
           "type": "string"
          },
          "messages": {
           "type": "object",
           "additionalProperties": true
          }
         },
         "required": [
          "status",
          "messages"
         ]
        }
       }
      }
     },
     "400": {
      "description": "The request is not valid",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Error"
        }
       }
      }
     },
     "401": {
      "description": "No API key, or a wrong one",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Error"
        }
       }
      }
     },
     "403": {
      "description": "Not allowed",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Error"
        }
       }
      }
     }
    }
   }
  },
  "/api/manage/variables": {
   "get": {
    "tags": [
     "Remote variables"
    ],
    "summary": "List variables",
    "operationId": "listVariables",
    "responses": {
     "200": {
      "description": "OK",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "properties": {
          "variables": {
           "type": "array",
           "items": {
            "$ref": "#/components/schemas/Variable"
           }
          },
          "max": {
           "type": "integer"
          },
          "max_value": {
           "type": "integer"
          }
         },
         "required": [
          "variables",
          "max",
          "max_value"
         ]
        }
       }
      }
     },
     "401": {
      "description": "No API key, or a wrong one",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Error"
        }
       }
      }
     }
    }
   },
   "post": {
    "tags": [
     "Remote variables"
    ],
    "summary": "Create a variable",
    "operationId": "createVariable",
    "requestBody": {
     "required": true,
     "content": {
      "application/json": {
       "schema": {
        "type": "object",
        "properties": {
         "name": {
          "type": "string",
          "pattern": "^[A-Za-z0-9_.-]{1,64}$"
         },
         "value": {
          "type": "string",
          "maxLength": 4000
         },
         "product_id": {
          "type": "string",
          "description": "Leave out: all products"
         },
         "requires_feature": {
          "type": "string",
          "description": "Only keys with this entitlement"
         },
         "note": {
          "type": "string",
          "maxLength": 200
         }
        },
        "required": [
         "name",
         "value"
        ]
       }
      }
     }
    },
    "responses": {
     "200": {
      "description": "OK",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "properties": {
          "id": {
           "type": "string"
          },
          "status": {
           "type": "string"
          }
         },
         "required": [
          "id",
          "status"
         ]
        }
       }
      }
     },
     "400": {
      "description": "The request is not valid",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Error"
        }
       }
      }
     },
     "401": {
      "description": "No API key, or a wrong one",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Error"
        }
       }
      }
     },
     "403": {
      "description": "Not allowed",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Error"
        }
       }
      }
     }
    }
   }
  },
  "/api/manage/variables/{variable_id}": {
   "put": {
    "tags": [
     "Remote variables"
    ],
    "summary": "Change a variable",
    "operationId": "updateVariable",
    "parameters": [
     {
      "name": "variable_id",
      "in": "path",
      "required": true,
      "description": "The variable id",
      "schema": {
       "type": "string"
      }
     }
    ],
    "requestBody": {
     "required": true,
     "content": {
      "application/json": {
       "schema": {
        "type": "object",
        "properties": {
         "name": {
          "type": "string",
          "pattern": "^[A-Za-z0-9_.-]{1,64}$"
         },
         "value": {
          "type": "string",
          "maxLength": 4000
         },
         "product_id": {
          "type": "string"
         },
         "requires_feature": {
          "type": "string"
         },
         "note": {
          "type": "string",
          "maxLength": 200
         }
        }
       }
      }
     }
    },
    "responses": {
     "200": {
      "description": "OK",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "properties": {
          "id": {
           "type": "string"
          },
          "status": {
           "type": "string"
          }
         },
         "required": [
          "id",
          "status"
         ]
        }
       }
      }
     },
     "400": {
      "description": "The request is not valid",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Error"
        }
       }
      }
     },
     "401": {
      "description": "No API key, or a wrong one",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Error"
        }
       }
      }
     },
     "403": {
      "description": "Not allowed",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Error"
        }
       }
      }
     },
     "404": {
      "description": "Not found",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Error"
        }
       }
      }
     }
    }
   },
   "delete": {
    "tags": [
     "Remote variables"
    ],
    "summary": "Delete a variable",
    "operationId": "deleteVariable",
    "parameters": [
     {
      "name": "variable_id",
      "in": "path",
      "required": true,
      "description": "The variable id",
      "schema": {
       "type": "string"
      }
     }
    ],
    "responses": {
     "200": {
      "description": "OK",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "properties": {
          "status": {
           "type": "string",
           "enum": [
            "deleted"
           ]
          }
         },
         "required": [
          "status"
         ]
        }
       }
      }
     },
     "401": {
      "description": "No API key, or a wrong one",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Error"
        }
       }
      }
     },
     "403": {
      "description": "Not allowed",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Error"
        }
       }
      }
     },
     "404": {
      "description": "Not found",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Error"
        }
       }
      }
     }
    }
   }
  },
  "/api/manage/license-plans": {
   "get": {
    "tags": [
     "License plans"
    ],
    "summary": "List plans",
    "operationId": "listPlans",
    "responses": {
     "200": {
      "description": "OK",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "properties": {
          "plans": {
           "type": "array",
           "items": {
            "$ref": "#/components/schemas/LicensePlan"
           }
          },
          "max": {
           "type": "integer"
          }
         },
         "required": [
          "plans",
          "max"
         ]
        }
       }
      }
     },
     "401": {
      "description": "No API key, or a wrong one",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Error"
        }
       }
      }
     }
    }
   },
   "post": {
    "tags": [
     "License plans"
    ],
    "summary": "Create a plan",
    "operationId": "createPlan",
    "requestBody": {
     "required": true,
     "content": {
      "application/json": {
       "schema": {
        "type": "object",
        "properties": {
         "name": {
          "type": "string",
          "maxLength": 80
         },
         "description": {
          "type": "string",
          "maxLength": 200
         },
         "product_id": {
          "type": "string",
          "description": "Leave out: all products"
         },
         "template": {
          "type": "object",
          "properties": {
           "max_hwids": {
            "type": "integer",
            "description": "Devices per key",
            "minimum": 1,
            "maximum": 100000,
            "default": 1
           },
           "expires_in_days": {
            "type": "integer",
            "description": "Days until it expires. Leave out for a lifetime key",
            "minimum": 1,
            "maximum": 36500
           },
           "activate_on_use": {
            "type": "boolean",
            "description": "Count those days from the first use"
           },
           "features": {
            "description": "Entitlements: a JSON object, for example {\"pro\": true, \"seats\": 5}",
            "type": "object",
            "additionalProperties": true
           },
           "os_lock": {
            "type": "string",
            "description": "Only this operating system",
            "enum": [
             "windows",
             "linux",
             "macos"
            ]
           },
           "max_concurrent": {
            "type": "integer",
            "description": "Floating seats: how many may run at once",
            "minimum": 1
           },
           "lease_ttl": {
            "type": "integer",
            "description": "Seconds until a silent seat is freed",
            "minimum": 30
           },
           "usage_limit": {
            "type": "integer",
            "description": "Usage credits",
            "minimum": 0
           },
           "usage_reset": {
            "type": "string",
            "description": "Refill of the credits",
            "enum": [
             "daily",
             "monthly"
            ]
           }
          }
         }
        },
        "required": [
         "name",
         "template"
        ]
       }
      }
     }
    },
    "responses": {
     "200": {
      "description": "OK",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "properties": {
          "id": {
           "type": "string"
          },
          "status": {
           "type": "string"
          }
         },
         "required": [
          "id",
          "status"
         ]
        }
       }
      }
     },
     "400": {
      "description": "The request is not valid",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Error"
        }
       }
      }
     },
     "401": {
      "description": "No API key, or a wrong one",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Error"
        }
       }
      }
     },
     "403": {
      "description": "Not allowed",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Error"
        }
       }
      }
     }
    }
   }
  },
  "/api/manage/license-plans/{plan_id}": {
   "put": {
    "tags": [
     "License plans"
    ],
    "summary": "Change a plan",
    "operationId": "updatePlan",
    "parameters": [
     {
      "name": "plan_id",
      "in": "path",
      "required": true,
      "description": "The plan id",
      "schema": {
       "type": "string"
      }
     }
    ],
    "requestBody": {
     "required": true,
     "content": {
      "application/json": {
       "schema": {
        "type": "object",
        "properties": {
         "name": {
          "type": "string",
          "maxLength": 80
         },
         "description": {
          "type": "string",
          "maxLength": 200
         },
         "product_id": {
          "type": "string"
         },
         "template": {
          "type": "object",
          "properties": {
           "max_hwids": {
            "type": "integer",
            "description": "Devices per key",
            "minimum": 1,
            "maximum": 100000,
            "default": 1
           },
           "expires_in_days": {
            "type": "integer",
            "description": "Days until it expires. Leave out for a lifetime key",
            "minimum": 1,
            "maximum": 36500
           },
           "activate_on_use": {
            "type": "boolean",
            "description": "Count those days from the first use"
           },
           "features": {
            "description": "Entitlements: a JSON object, for example {\"pro\": true, \"seats\": 5}",
            "type": "object",
            "additionalProperties": true
           },
           "os_lock": {
            "type": "string",
            "description": "Only this operating system",
            "enum": [
             "windows",
             "linux",
             "macos"
            ]
           },
           "max_concurrent": {
            "type": "integer",
            "description": "Floating seats: how many may run at once",
            "minimum": 1
           },
           "lease_ttl": {
            "type": "integer",
            "description": "Seconds until a silent seat is freed",
            "minimum": 30
           },
           "usage_limit": {
            "type": "integer",
            "description": "Usage credits",
            "minimum": 0
           },
           "usage_reset": {
            "type": "string",
            "description": "Refill of the credits",
            "enum": [
             "daily",
             "monthly"
            ]
           }
          }
         }
        }
       }
      }
     }
    },
    "responses": {
     "200": {
      "description": "OK",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "properties": {
          "id": {
           "type": "string"
          },
          "status": {
           "type": "string"
          }
         },
         "required": [
          "id",
          "status"
         ]
        }
       }
      }
     },
     "400": {
      "description": "The request is not valid",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Error"
        }
       }
      }
     },
     "401": {
      "description": "No API key, or a wrong one",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Error"
        }
       }
      }
     },
     "403": {
      "description": "Not allowed",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Error"
        }
       }
      }
     },
     "404": {
      "description": "Not found",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Error"
        }
       }
      }
     }
    }
   },
   "delete": {
    "tags": [
     "License plans"
    ],
    "summary": "Delete a plan",
    "operationId": "deletePlan",
    "parameters": [
     {
      "name": "plan_id",
      "in": "path",
      "required": true,
      "description": "The plan id",
      "schema": {
       "type": "string"
      }
     }
    ],
    "responses": {
     "200": {
      "description": "OK",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "properties": {
          "status": {
           "type": "string",
           "enum": [
            "deleted"
           ]
          }
         },
         "required": [
          "status"
         ]
        }
       }
      }
     },
     "401": {
      "description": "No API key, or a wrong one",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Error"
        }
       }
      }
     },
     "403": {
      "description": "Not allowed",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Error"
        }
       }
      }
     },
     "404": {
      "description": "Not found",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Error"
        }
       }
      }
     }
    }
   }
  }
 },
 "components": {
  "securitySchemes": {
   "apiKey": {
    "type": "http",
    "scheme": "bearer",
    "bearerFormat": "sk_live_…",
    "description": "Read-only keys may use GET only"
   }
  },
  "schemas": {
   "Error": {
    "type": "object",
    "properties": {
     "error": {
      "type": "string",
      "description": "Text for a person. For license checks you can reword it on the Custom Messages page"
     },
     "code": {
      "type": "string",
      "description": "For a program, when there is one"
     }
    },
    "required": [
     "error"
    ]
   },
   "Product": {
    "type": "object",
    "properties": {
     "id": {
      "type": "string"
     },
     "name": {
      "type": "string"
     },
     "description": {
      "type": [
       "string",
       "null"
      ]
     },
     "key_prefix": {
      "type": [
       "string",
       "null"
      ]
     },
     "created_at": {
      "type": "string"
     },
     "license_count": {
      "type": "integer"
     },
     "active_count": {
      "type": "integer"
     },
     "release_version": {
      "type": [
       "string",
       "null"
      ]
     }
    },
    "required": [
     "id",
     "name",
     "description",
     "key_prefix",
     "created_at",
     "license_count",
     "active_count",
     "release_version"
    ]
   },
   "License": {
    "type": "object",
    "properties": {
     "id": {
      "type": "string"
     },
     "product_id": {
      "type": "string"
     },
     "key": {
      "type": "string"
     },
     "status": {
      "type": "string",
      "enum": [
       "active",
       "revoked"
      ]
     },
     "max_hwids": {
      "type": "integer"
     },
     "expires_at": {
      "type": [
       "string",
       "null"
      ],
      "description": "ISO date. null: never"
     },
     "customer_name": {
      "type": [
       "string",
       "null"
      ]
     },
     "customer_email": {
      "type": [
       "string",
       "null"
      ]
     },
     "note": {
      "type": [
       "string",
       "null"
      ]
     },
     "features": {
      "type": [
       "string",
       "null"
      ],
      "description": "JSON text"
     },
     "os_lock": {
      "type": [
       "string",
       "null"
      ]
     },
     "max_concurrent": {
      "type": [
       "integer",
       "null"
      ]
     },
     "usage_limit": {
      "type": [
       "integer",
       "null"
      ]
     },
     "usage_used": {
      "type": "integer"
     },
     "created_at": {
      "type": "string"
     },
     "hwid_count": {
      "type": "integer",
      "description": "Devices bound"
     },
     "active_sessions": {
      "type": "integer",
      "description": "Floating seats in use"
     }
    },
    "required": [
     "id",
     "product_id",
     "key",
     "status",
     "max_hwids",
     "expires_at",
     "customer_name",
     "customer_email",
     "note",
     "features",
     "os_lock",
     "max_concurrent",
     "usage_limit",
     "usage_used",
     "created_at",
     "hwid_count",
     "active_sessions"
    ]
   },
   "Device": {
    "type": "object",
    "properties": {
     "id": {
      "type": "string"
     },
     "hwid": {
      "type": "string"
     },
     "device_name": {
      "type": [
       "string",
       "null"
      ]
     },
     "platform": {
      "type": [
       "string",
       "null"
      ]
     },
     "created_at": {
      "type": "string"
     },
     "last_validated": {
      "type": [
       "string",
       "null"
      ]
     }
    },
    "required": [
     "id",
     "hwid",
     "device_name",
     "platform",
     "created_at",
     "last_validated"
    ]
   },
   "LicensePlan": {
    "type": "object",
    "properties": {
     "id": {
      "type": "string"
     },
     "name": {
      "type": "string"
     },
     "description": {
      "type": [
       "string",
       "null"
      ]
     },
     "product_id": {
      "type": "string",
      "description": "Empty: for all products"
     },
     "template": {
      "type": "object",
      "additionalProperties": true,
      "description": "The key options"
     },
     "created_at": {
      "type": "string"
     }
    },
    "required": [
     "id",
     "name",
     "description",
     "product_id",
     "template",
     "created_at"
    ]
   },
   "Variable": {
    "type": "object",
    "properties": {
     "id": {
      "type": "string"
     },
     "name": {
      "type": "string"
     },
     "value": {
      "type": "string"
     },
     "product_id": {
      "type": "string",
      "description": "Empty: for all products"
     },
     "requires_feature": {
      "type": [
       "string",
       "null"
      ]
     },
     "note": {
      "type": [
       "string",
       "null"
      ]
     }
    },
    "required": [
     "id",
     "name",
     "value",
     "product_id",
     "requires_feature",
     "note"
    ]
   },
   "Usage": {
    "type": "object",
    "properties": {
     "usage": {
      "type": "object",
      "properties": {
       "used": {
        "type": "integer"
       },
       "limit": {
        "type": [
         "integer",
         "null"
        ],
        "description": "null: no limit"
       },
       "remaining": {
        "type": [
         "integer",
         "null"
        ]
       },
       "reset": {
        "type": [
         "string",
         "null"
        ]
       },
       "resets_at": {
        "type": [
         "string",
         "null"
        ]
       }
      },
      "required": [
       "used",
       "limit",
       "remaining",
       "reset",
       "resets_at"
      ]
     },
     "daily": {
      "type": "array",
      "items": {
       "type": "object",
       "properties": {
        "day": {
         "type": "string"
        },
        "amount": {
         "type": "integer"
        }
       },
       "required": [
        "day",
        "amount"
       ]
      }
     },
     "lifetime": {
      "type": "integer"
     }
    },
    "required": [
     "usage",
     "daily",
     "lifetime"
    ]
   }
  }
 }
}
