{
  "openapi": "3.1.0",
  "info": {
    "title": "PandaQR API",
    "version": "1.0.0",
    "description": "Permanent QR codes with replaceable content. Bearer tokens from the Developer dashboard. 60 requests/minute/token. Times are Unix milliseconds. Maximum image size: 2 MiB. HTTPS only in production."
  },
  "servers": [
    {
      "url": "https://app.pandaqr.xyz/api/v1"
    }
  ],
  "security": [
    {
      "bearerAuth": []
    }
  ],
  "paths": {
    "/qrs": {
      "get": {
        "operationId": "listQrs",
        "summary": "List QR codes",
        "description": "Required scopes: qrs:read. Account ownership is always enforced.",
        "tags": [
          "QR codes"
        ],
        "parameters": [
          {
            "name": "limit",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 20
            }
          },
          {
            "name": "cursor",
            "in": "query",
            "schema": {
              "type": "string"
            },
            "description": "next_cursor from previous page; descending QR id order"
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/QrList"
                }
              }
            }
          },
          "400": {
            "description": "API error; use error.code and X-Request-Id",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "API error; use error.code and X-Request-Id",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "API error; use error.code and X-Request-Id",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "API error; use error.code and X-Request-Id",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "API error; use error.code and X-Request-Id",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "413": {
            "description": "API error; use error.code and X-Request-Id",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "415": {
            "description": "API error; use error.code and X-Request-Id",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "API error; use error.code and X-Request-Id",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "integer"
                },
                "description": "Seconds until retry"
              }
            }
          },
          "500": {
            "description": "API error; use error.code and X-Request-Id",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      },
      "post": {
        "operationId": "createQr",
        "summary": "Create a dynamic QR",
        "description": "Required scopes: qrs:write. Account ownership is always enforced.",
        "tags": [
          "QR codes"
        ],
        "parameters": [
          {
            "name": "Idempotency-Key",
            "in": "header",
            "description": "Optional unique key; same exact request replays for 24 hours. Different payload returns 409. Reuse exact bytes and Content-Type, including multipart boundary.",
            "schema": {
              "type": "string",
              "maxLength": 128,
              "pattern": "^[A-Za-z0-9._:-]+$"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateQr"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/QrResponse"
                }
              }
            }
          },
          "400": {
            "description": "API error; use error.code and X-Request-Id",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "API error; use error.code and X-Request-Id",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "API error; use error.code and X-Request-Id",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "API error; use error.code and X-Request-Id",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "API error; use error.code and X-Request-Id",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "413": {
            "description": "API error; use error.code and X-Request-Id",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "415": {
            "description": "API error; use error.code and X-Request-Id",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "API error; use error.code and X-Request-Id",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "integer"
                },
                "description": "Seconds until retry"
              }
            }
          },
          "500": {
            "description": "API error; use error.code and X-Request-Id",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/qrs/{id}": {
      "parameters": [
        {
          "name": "id",
          "in": "path",
          "required": true,
          "description": "QR id (not its short slug)",
          "schema": {
            "type": "string"
          }
        }
      ],
      "get": {
        "operationId": "getQr",
        "summary": "Get a QR",
        "description": "Required scopes: qrs:read. Account ownership is always enforced.",
        "tags": [
          "QR codes"
        ],
        "parameters": [],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/QrResponse"
                }
              }
            }
          },
          "400": {
            "description": "API error; use error.code and X-Request-Id",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "API error; use error.code and X-Request-Id",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "API error; use error.code and X-Request-Id",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "API error; use error.code and X-Request-Id",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "API error; use error.code and X-Request-Id",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "413": {
            "description": "API error; use error.code and X-Request-Id",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "415": {
            "description": "API error; use error.code and X-Request-Id",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "API error; use error.code and X-Request-Id",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "integer"
                },
                "description": "Seconds until retry"
              }
            }
          },
          "500": {
            "description": "API error; use error.code and X-Request-Id",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      },
      "patch": {
        "operationId": "updateQr",
        "summary": "Update content or settings",
        "description": "Required scopes: qrs:write. Account ownership is always enforced.",
        "tags": [
          "QR codes"
        ],
        "parameters": [
          {
            "name": "Idempotency-Key",
            "in": "header",
            "description": "Optional unique key; same exact request replays for 24 hours. Different payload returns 409. Reuse exact bytes and Content-Type, including multipart boundary.",
            "schema": {
              "type": "string",
              "maxLength": 128,
              "pattern": "^[A-Za-z0-9._:-]+$"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdateQr"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/QrResponse"
                }
              }
            }
          },
          "400": {
            "description": "API error; use error.code and X-Request-Id",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "API error; use error.code and X-Request-Id",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "API error; use error.code and X-Request-Id",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "API error; use error.code and X-Request-Id",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "API error; use error.code and X-Request-Id",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "413": {
            "description": "API error; use error.code and X-Request-Id",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "415": {
            "description": "API error; use error.code and X-Request-Id",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "API error; use error.code and X-Request-Id",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "integer"
                },
                "description": "Seconds until retry"
              }
            }
          },
          "500": {
            "description": "API error; use error.code and X-Request-Id",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      },
      "delete": {
        "operationId": "deleteQr",
        "summary": "Permanently delete a QR",
        "description": "Required scopes: qrs:delete. Account ownership is always enforced.",
        "tags": [
          "QR codes"
        ],
        "parameters": [
          {
            "name": "Idempotency-Key",
            "in": "header",
            "description": "Optional unique key; same exact request replays for 24 hours. Different payload returns 409. Reuse exact bytes and Content-Type, including multipart boundary.",
            "schema": {
              "type": "string",
              "maxLength": 128,
              "pattern": "^[A-Za-z0-9._:-]+$"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DeleteResponse"
                }
              }
            }
          },
          "400": {
            "description": "API error; use error.code and X-Request-Id",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "API error; use error.code and X-Request-Id",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "API error; use error.code and X-Request-Id",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "API error; use error.code and X-Request-Id",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "API error; use error.code and X-Request-Id",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "413": {
            "description": "API error; use error.code and X-Request-Id",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "415": {
            "description": "API error; use error.code and X-Request-Id",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "API error; use error.code and X-Request-Id",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "integer"
                },
                "description": "Seconds until retry"
              }
            }
          },
          "500": {
            "description": "API error; use error.code and X-Request-Id",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/images": {
      "post": {
        "operationId": "uploadImage",
        "summary": "Upload an image for creating or updating a QR",
        "description": "Required scopes: images:write. Account ownership is always enforced.",
        "tags": [
          "QR codes"
        ],
        "parameters": [
          {
            "name": "Idempotency-Key",
            "in": "header",
            "description": "Optional unique key; same exact request replays for 24 hours. Different payload returns 409. Reuse exact bytes and Content-Type, including multipart boundary.",
            "schema": {
              "type": "string",
              "maxLength": 128,
              "pattern": "^[A-Za-z0-9._:-]+$"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "image/png": {
              "schema": {
                "type": "string",
                "format": "binary"
              }
            },
            "image/jpeg": {
              "schema": {
                "type": "string",
                "format": "binary"
              }
            },
            "image/webp": {
              "schema": {
                "type": "string",
                "format": "binary"
              }
            },
            "application/octet-stream": {
              "schema": {
                "type": "string",
                "format": "binary"
              }
            },
            "multipart/form-data": {
              "schema": {
                "type": "object",
                "required": [
                  "file"
                ],
                "properties": {
                  "file": {
                    "type": "string",
                    "format": "binary"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ImageResponse"
                }
              }
            }
          },
          "400": {
            "description": "API error; use error.code and X-Request-Id",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "API error; use error.code and X-Request-Id",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "API error; use error.code and X-Request-Id",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "API error; use error.code and X-Request-Id",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "API error; use error.code and X-Request-Id",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "413": {
            "description": "API error; use error.code and X-Request-Id",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "415": {
            "description": "API error; use error.code and X-Request-Id",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "API error; use error.code and X-Request-Id",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "integer"
                },
                "description": "Seconds until retry"
              }
            }
          },
          "500": {
            "description": "API error; use error.code and X-Request-Id",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/qrs/{id}/image": {
      "parameters": [
        {
          "name": "id",
          "in": "path",
          "required": true,
          "description": "QR id (not its short slug)",
          "schema": {
            "type": "string"
          }
        }
      ],
      "put": {
        "operationId": "replaceQrImage",
        "summary": "Replace an image QR in one request",
        "description": "Required scopes: qrs:write, images:write. Account ownership is always enforced.",
        "tags": [
          "QR codes"
        ],
        "parameters": [
          {
            "name": "Idempotency-Key",
            "in": "header",
            "description": "Optional unique key; same exact request replays for 24 hours. Different payload returns 409. Reuse exact bytes and Content-Type, including multipart boundary.",
            "schema": {
              "type": "string",
              "maxLength": 128,
              "pattern": "^[A-Za-z0-9._:-]+$"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "image/png": {
              "schema": {
                "type": "string",
                "format": "binary"
              }
            },
            "image/jpeg": {
              "schema": {
                "type": "string",
                "format": "binary"
              }
            },
            "image/webp": {
              "schema": {
                "type": "string",
                "format": "binary"
              }
            },
            "application/octet-stream": {
              "schema": {
                "type": "string",
                "format": "binary"
              }
            },
            "multipart/form-data": {
              "schema": {
                "type": "object",
                "required": [
                  "file"
                ],
                "properties": {
                  "file": {
                    "type": "string",
                    "format": "binary"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/QrResponse"
                }
              }
            }
          },
          "400": {
            "description": "API error; use error.code and X-Request-Id",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "API error; use error.code and X-Request-Id",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "API error; use error.code and X-Request-Id",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "API error; use error.code and X-Request-Id",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "API error; use error.code and X-Request-Id",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "413": {
            "description": "API error; use error.code and X-Request-Id",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "415": {
            "description": "API error; use error.code and X-Request-Id",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "API error; use error.code and X-Request-Id",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "integer"
                },
                "description": "Seconds until retry"
              }
            }
          },
          "500": {
            "description": "API error; use error.code and X-Request-Id",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "securitySchemes": {
      "bearerAuth": {
        "type": "http",
        "scheme": "bearer",
        "bearerFormat": "pqr_live_…"
      }
    },
    "schemas": {
      "CreateQr": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "title": {
            "type": "string",
            "maxLength": 120
          },
          "description": {
            "type": "string",
            "maxLength": 500
          },
          "note": {
            "type": "string",
            "maxLength": 1000
          },
          "target": {
            "oneOf": [
              {
                "type": "object",
                "properties": {
                  "type": {
                    "type": "string",
                    "const": "image"
                  },
                  "payload": {
                    "type": "object",
                    "properties": {
                      "r2_key": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 256
                      },
                      "mime": {
                        "type": "string",
                        "enum": [
                          "image/png",
                          "image/jpeg",
                          "image/webp"
                        ]
                      },
                      "width": {
                        "type": "integer",
                        "exclusiveMinimum": 0,
                        "maximum": 9007199254740991
                      },
                      "height": {
                        "type": "integer",
                        "exclusiveMinimum": 0,
                        "maximum": 9007199254740991
                      }
                    },
                    "required": [
                      "r2_key",
                      "mime"
                    ],
                    "additionalProperties": false
                  }
                },
                "required": [
                  "type",
                  "payload"
                ],
                "additionalProperties": false
              },
              {
                "type": "object",
                "properties": {
                  "type": {
                    "type": "string",
                    "const": "url"
                  },
                  "payload": {
                    "type": "object",
                    "properties": {
                      "url": {
                        "type": "string",
                        "maxLength": 2048,
                        "format": "uri"
                      }
                    },
                    "required": [
                      "url"
                    ],
                    "additionalProperties": false
                  }
                },
                "required": [
                  "type",
                  "payload"
                ],
                "additionalProperties": false
              },
              {
                "type": "object",
                "properties": {
                  "type": {
                    "type": "string",
                    "const": "multilink"
                  },
                  "payload": {
                    "type": "object",
                    "properties": {
                      "title": {
                        "type": "string",
                        "maxLength": 100
                      },
                      "description": {
                        "type": "string",
                        "maxLength": 500
                      },
                      "items": {
                        "minItems": 1,
                        "maxItems": 10,
                        "type": "array",
                        "items": {
                          "type": "object",
                          "properties": {
                            "label": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 80
                            },
                            "url": {
                              "type": "string",
                              "maxLength": 2048,
                              "format": "uri"
                            }
                          },
                          "required": [
                            "label",
                            "url"
                          ],
                          "additionalProperties": false
                        }
                      }
                    },
                    "required": [
                      "items"
                    ],
                    "additionalProperties": false
                  }
                },
                "required": [
                  "type",
                  "payload"
                ],
                "additionalProperties": false
              }
            ]
          },
          "expiry": {
            "type": "object",
            "properties": {
              "enabled": {
                "type": "boolean"
              },
              "window_seconds": {
                "type": "integer",
                "exclusiveMinimum": 0,
                "maximum": 31622400
              },
              "lead_times": {
                "maxItems": 5,
                "type": "array",
                "items": {
                  "type": "integer",
                  "exclusiveMinimum": 0,
                  "maximum": 31622400
                }
              },
              "action": {
                "type": "string",
                "enum": [
                  "keep",
                  "pause"
                ]
              }
            },
            "required": [
              "enabled"
            ],
            "additionalProperties": false
          }
        },
        "required": [
          "target"
        ],
        "additionalProperties": false
      },
      "UpdateQr": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "title": {
            "type": "string",
            "maxLength": 120
          },
          "description": {
            "type": "string",
            "maxLength": 500
          },
          "note": {
            "anyOf": [
              {
                "type": "string",
                "maxLength": 1000
              },
              {
                "type": "null"
              }
            ]
          },
          "status": {
            "type": "string",
            "enum": [
              "active",
              "paused"
            ]
          },
          "target": {
            "oneOf": [
              {
                "type": "object",
                "properties": {
                  "type": {
                    "type": "string",
                    "const": "image"
                  },
                  "payload": {
                    "type": "object",
                    "properties": {
                      "r2_key": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 256
                      },
                      "mime": {
                        "type": "string",
                        "enum": [
                          "image/png",
                          "image/jpeg",
                          "image/webp"
                        ]
                      },
                      "width": {
                        "type": "integer",
                        "exclusiveMinimum": 0,
                        "maximum": 9007199254740991
                      },
                      "height": {
                        "type": "integer",
                        "exclusiveMinimum": 0,
                        "maximum": 9007199254740991
                      }
                    },
                    "required": [
                      "r2_key",
                      "mime"
                    ],
                    "additionalProperties": false
                  }
                },
                "required": [
                  "type",
                  "payload"
                ],
                "additionalProperties": false
              },
              {
                "type": "object",
                "properties": {
                  "type": {
                    "type": "string",
                    "const": "url"
                  },
                  "payload": {
                    "type": "object",
                    "properties": {
                      "url": {
                        "type": "string",
                        "maxLength": 2048,
                        "format": "uri"
                      }
                    },
                    "required": [
                      "url"
                    ],
                    "additionalProperties": false
                  }
                },
                "required": [
                  "type",
                  "payload"
                ],
                "additionalProperties": false
              },
              {
                "type": "object",
                "properties": {
                  "type": {
                    "type": "string",
                    "const": "multilink"
                  },
                  "payload": {
                    "type": "object",
                    "properties": {
                      "title": {
                        "type": "string",
                        "maxLength": 100
                      },
                      "description": {
                        "type": "string",
                        "maxLength": 500
                      },
                      "items": {
                        "minItems": 1,
                        "maxItems": 10,
                        "type": "array",
                        "items": {
                          "type": "object",
                          "properties": {
                            "label": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 80
                            },
                            "url": {
                              "type": "string",
                              "maxLength": 2048,
                              "format": "uri"
                            }
                          },
                          "required": [
                            "label",
                            "url"
                          ],
                          "additionalProperties": false
                        }
                      }
                    },
                    "required": [
                      "items"
                    ],
                    "additionalProperties": false
                  }
                },
                "required": [
                  "type",
                  "payload"
                ],
                "additionalProperties": false
              }
            ]
          },
          "expiry": {
            "type": "object",
            "properties": {
              "enabled": {
                "type": "boolean"
              },
              "window_seconds": {
                "type": "integer",
                "exclusiveMinimum": 0,
                "maximum": 31622400
              },
              "lead_times": {
                "maxItems": 5,
                "type": "array",
                "items": {
                  "type": "integer",
                  "exclusiveMinimum": 0,
                  "maximum": 31622400
                }
              },
              "action": {
                "type": "string",
                "enum": [
                  "keep",
                  "pause"
                ]
              }
            },
            "required": [
              "enabled"
            ],
            "additionalProperties": false
          }
        },
        "additionalProperties": false,
        "minProperties": 1
      },
      "Qr": {
        "type": "object",
        "required": [
          "id",
          "slug",
          "scan_url",
          "target",
          "status",
          "created_at",
          "updated_at"
        ],
        "properties": {
          "id": {
            "type": "string"
          },
          "slug": {
            "type": "string"
          },
          "scan_url": {
            "type": "string",
            "format": "uri"
          },
          "title": {
            "type": [
              "string",
              "null"
            ]
          },
          "description": {
            "type": [
              "string",
              "null"
            ]
          },
          "note": {
            "type": [
              "string",
              "null"
            ]
          },
          "status": {
            "enum": [
              "active",
              "paused"
            ]
          },
          "target": {
            "oneOf": [
              {
                "type": "object",
                "properties": {
                  "type": {
                    "type": "string",
                    "const": "image"
                  },
                  "payload": {
                    "type": "object",
                    "properties": {
                      "r2_key": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 256
                      },
                      "mime": {
                        "type": "string",
                        "enum": [
                          "image/png",
                          "image/jpeg",
                          "image/webp"
                        ]
                      },
                      "width": {
                        "type": "integer",
                        "exclusiveMinimum": 0,
                        "maximum": 9007199254740991
                      },
                      "height": {
                        "type": "integer",
                        "exclusiveMinimum": 0,
                        "maximum": 9007199254740991
                      }
                    },
                    "required": [
                      "r2_key",
                      "mime"
                    ],
                    "additionalProperties": false
                  }
                },
                "required": [
                  "type",
                  "payload"
                ],
                "additionalProperties": false
              },
              {
                "type": "object",
                "properties": {
                  "type": {
                    "type": "string",
                    "const": "url"
                  },
                  "payload": {
                    "type": "object",
                    "properties": {
                      "url": {
                        "type": "string",
                        "maxLength": 2048,
                        "format": "uri"
                      }
                    },
                    "required": [
                      "url"
                    ],
                    "additionalProperties": false
                  }
                },
                "required": [
                  "type",
                  "payload"
                ],
                "additionalProperties": false
              },
              {
                "type": "object",
                "properties": {
                  "type": {
                    "type": "string",
                    "const": "multilink"
                  },
                  "payload": {
                    "type": "object",
                    "properties": {
                      "title": {
                        "type": "string",
                        "maxLength": 100
                      },
                      "description": {
                        "type": "string",
                        "maxLength": 500
                      },
                      "items": {
                        "minItems": 1,
                        "maxItems": 10,
                        "type": "array",
                        "items": {
                          "type": "object",
                          "properties": {
                            "label": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 80
                            },
                            "url": {
                              "type": "string",
                              "maxLength": 2048,
                              "format": "uri"
                            }
                          },
                          "required": [
                            "label",
                            "url"
                          ],
                          "additionalProperties": false
                        }
                      }
                    },
                    "required": [
                      "items"
                    ],
                    "additionalProperties": false
                  }
                },
                "required": [
                  "type",
                  "payload"
                ],
                "additionalProperties": false
              }
            ]
          },
          "expiry": {
            "type": "object"
          },
          "scan_total": {
            "type": "integer"
          },
          "last_scan_at": {
            "type": [
              "integer",
              "null"
            ]
          },
          "created_at": {
            "type": "integer",
            "description": "Unix milliseconds"
          },
          "updated_at": {
            "type": "integer",
            "description": "Unix milliseconds"
          }
        }
      },
      "QrResponse": {
        "type": "object",
        "required": [
          "ok",
          "data"
        ],
        "properties": {
          "ok": {
            "const": true
          },
          "data": {
            "type": "object",
            "required": [
              "qr"
            ],
            "properties": {
              "qr": {
                "$ref": "#/components/schemas/Qr"
              }
            }
          }
        }
      },
      "QrList": {
        "type": "object",
        "required": [
          "ok",
          "data"
        ],
        "properties": {
          "ok": {
            "const": true
          },
          "data": {
            "type": "object",
            "required": [
              "qrs",
              "next_cursor"
            ],
            "properties": {
              "qrs": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/Qr"
                }
              },
              "next_cursor": {
                "type": [
                  "string",
                  "null"
                ]
              }
            }
          }
        }
      },
      "ImageResponse": {
        "type": "object",
        "required": [
          "ok",
          "data"
        ],
        "properties": {
          "ok": {
            "const": true
          },
          "data": {
            "type": "object",
            "required": [
              "image"
            ],
            "properties": {
              "image": {
                "type": "object",
                "required": [
                  "r2_key",
                  "mime",
                  "size",
                  "public_url"
                ],
                "properties": {
                  "r2_key": {
                    "type": "string"
                  },
                  "mime": {
                    "enum": [
                      "image/png",
                      "image/jpeg",
                      "image/webp"
                    ]
                  },
                  "size": {
                    "type": "integer"
                  },
                  "public_url": {
                    "type": "string"
                  }
                }
              }
            }
          }
        }
      },
      "DeleteResponse": {
        "type": "object",
        "required": [
          "ok",
          "data"
        ],
        "properties": {
          "ok": {
            "const": true
          },
          "data": {
            "type": "object",
            "required": [
              "deleted"
            ],
            "properties": {
              "deleted": {
                "const": true
              }
            }
          }
        }
      },
      "Error": {
        "type": "object",
        "required": [
          "ok",
          "error"
        ],
        "properties": {
          "ok": {
            "const": false
          },
          "error": {
            "type": "object",
            "required": [
              "code",
              "message"
            ],
            "properties": {
              "code": {
                "type": "string"
              },
              "message": {
                "type": "string"
              }
            }
          }
        }
      }
    }
  }
}
