{
    "openapi": "3.1.0",
    "info": {
        "title": "qr API",
        "version": "1.0.0",
        "description": "Free dynamic QR codes that never expire. Create a code for any link, change its target later, get scan stats.\n\nNo key needed to create single codes (anonymous: small quotas, returns an edit_url for the human). With a free API key (create one in your account) you can list, change, bulk-create and get stats. Quotas per plan: GET /limits. MCP server for AI agents: https://qr.viennastruggle.at/mcp"
    },
    "servers": [
        {
            "url": "https://qr.viennastruggle.at/api/v1"
        }
    ],
    "components": {
        "securitySchemes": {
            "bearer": {
                "type": "http",
                "scheme": "bearer"
            },
            "apiKey": {
                "type": "apiKey",
                "in": "header",
                "name": "X-API-Key"
            }
        }
    },
    "security": [
        [],
        {
            "bearer": []
        },
        {
            "apiKey": []
        }
    ],
    "paths": {
        "/codes": {
            "post": {
                "operationId": "createCode",
                "summary": "Create a QR code for a link",
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "required": [
                                    "target_url"
                                ],
                                "properties": {
                                    "target_url": {
                                        "type": "string",
                                        "format": "uri"
                                    },
                                    "title": {
                                        "type": "string"
                                    },
                                    "style": {
                                        "type": "object",
                                        "description": "Optional look of the code. Every style is test-scanned; if it does not scan, the default is used.",
                                        "properties": {
                                            "shape": {
                                                "type": "string",
                                                "enum": [
                                                    "square",
                                                    "dots"
                                                ]
                                            },
                                            "corners": {
                                                "type": "string",
                                                "enum": [
                                                    "square",
                                                    "rounded",
                                                    "round"
                                                ]
                                            },
                                            "color": {
                                                "type": "string",
                                                "enum": [
                                                    "classic",
                                                    "pop",
                                                    "gradient",
                                                    "berry",
                                                    "ocean",
                                                    "forest"
                                                ]
                                            },
                                            "dots_color": {
                                                "type": "string",
                                                "pattern": "^#[0-9a-fA-F]{6}$",
                                                "description": "Custom dark color for the dots (overrides color)."
                                            },
                                            "corners_color": {
                                                "type": "string",
                                                "pattern": "^#[0-9a-fA-F]{6}$"
                                            },
                                            "emoji": {
                                                "type": "string",
                                                "enum": [
                                                    "1f3a8",
                                                    "1f5bc",
                                                    "1f3ad",
                                                    "1f3b5",
                                                    "1f3b8",
                                                    "1f3a4",
                                                    "1f3a7",
                                                    "1faa9",
                                                    "1f3ac",
                                                    "1f4f7",
                                                    "2728",
                                                    "1f525",
                                                    "2764",
                                                    "1f49c",
                                                    "2b50",
                                                    "1f31e",
                                                    "1f334",
                                                    "1f308",
                                                    "1f30a",
                                                    "1f389",
                                                    "1f37a",
                                                    "1f377",
                                                    "2615",
                                                    "1f355",
                                                    "1f6cd",
                                                    "1f39f",
                                                    "1f4cd",
                                                    "1f4bf",
                                                    "1f984",
                                                    "1f441",
                                                    "1f300",
                                                    "1f480"
                                                ],
                                                "description": "Twemoji code point for an emoji in the middle, e.g. 1f3a8 (artist palette)."
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                },
                "responses": {
                    "201": {
                        "description": "Created",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "code": {
                                            "type": "string"
                                        },
                                        "title": {
                                            "type": "string"
                                        },
                                        "target_url": {
                                            "type": "string",
                                            "format": "uri"
                                        },
                                        "short_url": {
                                            "type": "string",
                                            "format": "uri",
                                            "description": "The URL inside the QR code. Never changes."
                                        },
                                        "active": {
                                            "type": "boolean"
                                        },
                                        "created_at": {
                                            "type": "string"
                                        },
                                        "image_png": {
                                            "type": "string",
                                            "format": "uri"
                                        },
                                        "image_svg": {
                                            "type": "string",
                                            "format": "uri"
                                        },
                                        "manage_url": {
                                            "type": "string",
                                            "format": "uri",
                                            "description": "For account codes: the page in the app."
                                        },
                                        "edit_url": {
                                            "type": "string",
                                            "format": "uri",
                                            "description": "For anonymous codes: secret link for the human to change the code later. Show it to the user."
                                        },
                                        "style": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "Error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "error": {
                                            "type": "object",
                                            "properties": {
                                                "code": {
                                                    "type": "string"
                                                },
                                                "message": {
                                                    "type": "string"
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "Error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "error": {
                                            "type": "object",
                                            "properties": {
                                                "code": {
                                                    "type": "string"
                                                },
                                                "message": {
                                                    "type": "string"
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            },
            "get": {
                "operationId": "listCodes",
                "summary": "List your codes (API key)",
                "parameters": [
                    {
                        "name": "limit",
                        "in": "query",
                        "schema": {
                            "type": "integer",
                            "maximum": 100
                        }
                    },
                    {
                        "name": "offset",
                        "in": "query",
                        "schema": {
                            "type": "integer"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    },
                    "401": {
                        "description": "Error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "error": {
                                            "type": "object",
                                            "properties": {
                                                "code": {
                                                    "type": "string"
                                                },
                                                "message": {
                                                    "type": "string"
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        },
        "/codes/bulk": {
            "post": {
                "operationId": "createCodesBulk",
                "summary": "Create many codes at once (API key)",
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "required": [
                                    "items"
                                ],
                                "properties": {
                                    "campaign": {
                                        "type": "string",
                                        "description": "Optional: put the codes into a new campaign with this name."
                                    },
                                    "items": {
                                        "type": "array",
                                        "items": {
                                            "type": "object",
                                            "required": [
                                                "target_url"
                                            ],
                                            "properties": {
                                                "target_url": {
                                                    "type": "string"
                                                },
                                                "title": {
                                                    "type": "string"
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                },
                "responses": {
                    "201": {
                        "description": "Created"
                    },
                    "401": {
                        "description": "Error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "error": {
                                            "type": "object",
                                            "properties": {
                                                "code": {
                                                    "type": "string"
                                                },
                                                "message": {
                                                    "type": "string"
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "Error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "error": {
                                            "type": "object",
                                            "properties": {
                                                "code": {
                                                    "type": "string"
                                                },
                                                "message": {
                                                    "type": "string"
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        },
        "/codes/{code}": {
            "get": {
                "operationId": "getCode",
                "summary": "Get one code",
                "parameters": [
                    {
                        "name": "code",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "edit_key",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "string"
                        },
                        "description": "For anonymous codes: the key from edit_url."
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "code": {
                                            "type": "string"
                                        },
                                        "title": {
                                            "type": "string"
                                        },
                                        "target_url": {
                                            "type": "string",
                                            "format": "uri"
                                        },
                                        "short_url": {
                                            "type": "string",
                                            "format": "uri",
                                            "description": "The URL inside the QR code. Never changes."
                                        },
                                        "active": {
                                            "type": "boolean"
                                        },
                                        "created_at": {
                                            "type": "string"
                                        },
                                        "image_png": {
                                            "type": "string",
                                            "format": "uri"
                                        },
                                        "image_svg": {
                                            "type": "string",
                                            "format": "uri"
                                        },
                                        "manage_url": {
                                            "type": "string",
                                            "format": "uri",
                                            "description": "For account codes: the page in the app."
                                        },
                                        "edit_url": {
                                            "type": "string",
                                            "format": "uri",
                                            "description": "For anonymous codes: secret link for the human to change the code later. Show it to the user."
                                        },
                                        "style": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "Error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "error": {
                                            "type": "object",
                                            "properties": {
                                                "code": {
                                                    "type": "string"
                                                },
                                                "message": {
                                                    "type": "string"
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            },
            "patch": {
                "operationId": "updateCode",
                "summary": "Change where a code leads (or its title / active state)",
                "parameters": [
                    {
                        "name": "code",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "edit_key",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "string"
                        },
                        "description": "For anonymous codes: the key from edit_url."
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "target_url": {
                                        "type": "string"
                                    },
                                    "title": {
                                        "type": "string"
                                    },
                                    "active": {
                                        "type": "boolean"
                                    }
                                }
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Updated",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "code": {
                                            "type": "string"
                                        },
                                        "title": {
                                            "type": "string"
                                        },
                                        "target_url": {
                                            "type": "string",
                                            "format": "uri"
                                        },
                                        "short_url": {
                                            "type": "string",
                                            "format": "uri",
                                            "description": "The URL inside the QR code. Never changes."
                                        },
                                        "active": {
                                            "type": "boolean"
                                        },
                                        "created_at": {
                                            "type": "string"
                                        },
                                        "image_png": {
                                            "type": "string",
                                            "format": "uri"
                                        },
                                        "image_svg": {
                                            "type": "string",
                                            "format": "uri"
                                        },
                                        "manage_url": {
                                            "type": "string",
                                            "format": "uri",
                                            "description": "For account codes: the page in the app."
                                        },
                                        "edit_url": {
                                            "type": "string",
                                            "format": "uri",
                                            "description": "For anonymous codes: secret link for the human to change the code later. Show it to the user."
                                        },
                                        "style": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "Error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "error": {
                                            "type": "object",
                                            "properties": {
                                                "code": {
                                                    "type": "string"
                                                },
                                                "message": {
                                                    "type": "string"
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "Error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "error": {
                                            "type": "object",
                                            "properties": {
                                                "code": {
                                                    "type": "string"
                                                },
                                                "message": {
                                                    "type": "string"
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            },
            "delete": {
                "operationId": "deleteCode",
                "summary": "Delete a code (printed copies stop working)",
                "parameters": [
                    {
                        "name": "code",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "edit_key",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "string"
                        },
                        "description": "For anonymous codes: the key from edit_url."
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Deleted"
                    },
                    "404": {
                        "description": "Error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "error": {
                                            "type": "object",
                                            "properties": {
                                                "code": {
                                                    "type": "string"
                                                },
                                                "message": {
                                                    "type": "string"
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        },
        "/codes/{code}/stats": {
            "get": {
                "operationId": "getCodeStats",
                "summary": "Scan statistics",
                "parameters": [
                    {
                        "name": "code",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "edit_key",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "string"
                        },
                        "description": "For anonymous codes: the key from edit_url."
                    },
                    {
                        "name": "days",
                        "in": "query",
                        "schema": {
                            "type": "integer",
                            "default": 30
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    },
                    "404": {
                        "description": "Error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "error": {
                                            "type": "object",
                                            "properties": {
                                                "code": {
                                                    "type": "string"
                                                },
                                                "message": {
                                                    "type": "string"
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        },
        "/limits": {
            "get": {
                "operationId": "getLimits",
                "summary": "Your plan and quotas",
                "responses": {
                    "200": {
                        "description": "OK"
                    }
                }
            }
        }
    }
}