{
  "openapi": "3.1.1",
  "info": {
    "title": "Links.Web | v1",
    "version": "1.0.0"
  },
  "servers": [
    {
      "url": "https://flitlink.com/"
    }
  ],
  "paths": {
    "/version": {
      "get": {
        "tags": [
          "Links.Web"
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/llms.txt": {
      "get": {
        "tags": [
          "Links.Web"
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/sitemap.xml": {
      "get": {
        "tags": [
          "Links.Web"
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/robots.txt": {
      "get": {
        "tags": [
          "Links.Web"
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/stripe/webhook": {
      "post": {
        "tags": [
          "Links.Web"
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/app/links/{id}/qr.png": {
      "get": {
        "tags": [
          "Links.Web"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/tools/qr": {
      "get": {
        "tags": [
          "Links.Web"
        ],
        "parameters": [
          {
            "name": "data",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "format",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "size",
            "in": "query",
            "schema": {
              "pattern": "^-?(?:0|[1-9]\\d*)$",
              "type": [
                "integer",
                "string"
              ],
              "format": "int32"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/qr/site.svg": {
      "get": {
        "tags": [
          "Links.Web"
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/{slug}": {
      "get": {
        "tags": [
          "Links.Web"
        ],
        "parameters": [
          {
            "name": "slug",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/api/v1/links": {
      "post": {
        "tags": [
          "Links.Web"
        ],
        "summary": "Create a short link",
        "description": "Shortens `url`. Optional: `slug` (3-64 chars, letters/digits/hyphens), `title`, `domain` (one of GET /api/v1/domains). Free plan: 50 links/month (402 + code=free_plan_limit beyond that). Supports an Idempotency-Key header.",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateLinkBody"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      },
      "get": {
        "tags": [
          "Links.Web"
        ],
        "summary": "List links",
        "description": "Newest first. `limit` up to 100; pass `next_cursor` back as `cursor` to page.",
        "parameters": [
          {
            "name": "limit",
            "in": "query",
            "schema": {
              "pattern": "^-?(?:0|[1-9]\\d*)$",
              "type": [
                "integer",
                "string"
              ],
              "format": "int32"
            }
          },
          {
            "name": "cursor",
            "in": "query",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/api/v1/links/{id}": {
      "get": {
        "tags": [
          "Links.Web"
        ],
        "summary": "Get a link",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      },
      "patch": {
        "tags": [
          "Links.Web"
        ],
        "summary": "Update a link",
        "description": "Any of `url`, `title`, `status` ('active' | 'disabled'). Disabled links return 404 on redirect.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PatchLinkBody"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      },
      "delete": {
        "tags": [
          "Links.Web"
        ],
        "summary": "Delete a link",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/api/v1/links/{id}/stats": {
      "get": {
        "tags": [
          "Links.Web"
        ],
        "summary": "Link statistics",
        "description": "Lifetime total plus a last-30-days daily series (clicks + unique visitors).",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/api/v1/links/{id}/qr": {
      "get": {
        "tags": [
          "Links.Web"
        ],
        "summary": "QR code for a link",
        "description": "`format` = png (default) or svg; `size` = pixels per module (2-40, default 10).",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "format",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "size",
            "in": "query",
            "schema": {
              "pattern": "^-?(?:0|[1-9]\\d*)$",
              "type": [
                "integer",
                "string"
              ],
              "format": "int32"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/api/v1/domains": {
      "get": {
        "tags": [
          "Links.Web"
        ],
        "summary": "List usable domains",
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "CreateLinkBody": {
        "required": [
          "url",
          "slug",
          "title",
          "domain"
        ],
        "type": "object",
        "properties": {
          "url": {
            "type": "string"
          },
          "slug": {
            "type": [
              "null",
              "string"
            ]
          },
          "title": {
            "type": [
              "null",
              "string"
            ]
          },
          "domain": {
            "type": [
              "null",
              "string"
            ]
          }
        }
      },
      "PatchLinkBody": {
        "required": [
          "url",
          "title",
          "status"
        ],
        "type": "object",
        "properties": {
          "url": {
            "type": [
              "null",
              "string"
            ]
          },
          "title": {
            "type": [
              "null",
              "string"
            ]
          },
          "status": {
            "type": [
              "null",
              "string"
            ]
          }
        }
      }
    }
  },
  "tags": [
    {
      "name": "Links.Web"
    }
  ]
}