{
  "openapi": "3.1.0",
  "info": {
    "title": "s.pfos.school Short URL API",
    "version": "1.5.0",
    "summary": "URL shortener of PFOS.school: short links and their QR codes.",
    "description": "Turns http(s) URLs into short links https://s.pfos.school/{code} (HTTP 302 redirects) and draws a QR code for every link. The public endpoints are free and need no sign-up; endpoints with the apiKey security scheme need an API key from the administrator. Signing in with pfos-ID (the PFOS account) is optional: with a pfos-ID access token (pfosId scheme, OAuth 2.0 with the resource https://s.pfos.school; DPoP-bound tokens go as \"Authorization: DPoP\" with a DPoP proof) or a personal API token (personalToken scheme, created on the home page while signed in), the links you create go into your history (/api/v1/me/links) and the rate limits are four times higher, counted per account. How agents authenticate: https://s.pfos.school/auth.md. Links created through the public endpoint, the MCP server or the A2A agent are public and permanent: never shorten URLs that contain secrets or personal information. URLs on s.pfos.school and pfos.school cannot be shortened. AI agents can also use the MCP server at /mcp and the A2A agent at /api/v1/a2a.\n\nVersioning: this is version 1 of the REST API, under /api/v1. The unversioned /api/... paths of the same operations still work as deprecated aliases: they send a Deprecation header (RFC 9745) and a Link to their successor, and no removal date is set. A breaking change gets a new major path (/api/v2); a version that is going away is announced with Deprecation and, at least 6 months ahead, Sunset (RFC 8594) headers. Redirects (/{code}), QR images (/{code}.svg|png) and /mcp are not versioned.\n\nRate limits: the public endpoints are limited per IP address (per account when signed in). Every response of /api/v1, errors included, says which limits apply to the caller in a RateLimit-Policy header; a 429 response carries Retry-After."
  },
  "externalDocs": {
    "description": "API and MCP reference (Markdown)",
    "url": "https://s.pfos.school/docs.md"
  },
  "servers": [
    {
      "url": "https://s.pfos.school"
    }
  ],
  "tags": [
    {
      "name": "links",
      "description": "Short links"
    },
    {
      "name": "account",
      "description": "Your pfos-ID account: who is calling, your history"
    },
    {
      "name": "qr",
      "description": "QR codes of short links"
    },
    {
      "name": "mcp",
      "description": "MCP server for AI agents"
    },
    {
      "name": "a2a",
      "description": "A2A agent for AI agents"
    }
  ],
  "security": [
    {
      "apiKey": []
    }
  ],
  "paths": {
    "/api/v1/public/links": {
      "post": {
        "tags": [
          "links"
        ],
        "operationId": "createPublicLink",
        "summary": "Create a short link (public, no authentication)",
        "description": "Random 7-character code; the link never expires and cannot be edited or deleted through this endpoint. 30 requests per minute per IP address, or 120 per signed-in account (a pfos-ID access token or a personal API token). Signed in, the link also goes into your history; a pfos-ID access token needs the scope links:write (a token for the QR code designer's resource, https://s.pfos.school/qr, works here too).",
        "security": [
          {},
          {
            "personalToken": []
          },
          {
            "pfosId": [
              "links:write"
            ]
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PublicLinkRequest"
              },
              "example": {
                "url": "https://example.com",
                "qr": true
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Created",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CreatedLink"
                }
              }
            },
            "headers": {
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimitPolicy"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/InvalidToken"
          },
          "403": {
            "$ref": "#/components/responses/InsufficientScope"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        }
      }
    },
    "/api/v1/me": {
      "get": {
        "tags": [
          "account"
        ],
        "operationId": "getMe",
        "summary": "Who is calling (a signed-in account or nobody) and its rate limits",
        "description": "No authentication needed: without a token the answer is { signedIn: false, limits }. A pfos-ID access token needs links:read or links:write.",
        "security": [
          {},
          {
            "personalToken": []
          },
          {
            "pfosId": [
              "links:read"
            ]
          },
          {
            "pfosId": [
              "links:write"
            ]
          }
        ],
        "responses": {
          "200": {
            "description": "The caller",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Me"
                }
              }
            },
            "headers": {
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimitPolicy"
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/InvalidToken"
          },
          "403": {
            "$ref": "#/components/responses/InsufficientScope"
          },
          "405": {
            "$ref": "#/components/responses/MethodNotAllowed"
          }
        }
      }
    },
    "/api/v1/me/links": {
      "get": {
        "tags": [
          "account"
        ],
        "operationId": "listHistory",
        "summary": "Your history: the links you created while signed in, newest first",
        "description": "Only links that still exist. createdAt is when the link went into your history. A pfos-ID access token needs links:read.",
        "security": [
          {
            "personalToken": []
          },
          {
            "pfosId": [
              "links:read"
            ]
          }
        ],
        "parameters": [
          {
            "name": "limit",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 20
            }
          },
          {
            "name": "cursor",
            "in": "query",
            "schema": {
              "type": "string"
            },
            "description": "The cursor of the previous page; a page with cursor null is the last one"
          }
        ],
        "responses": {
          "200": {
            "description": "One page of your history",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HistoryPage"
                }
              }
            },
            "headers": {
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimitPolicy"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/InvalidToken"
          },
          "403": {
            "$ref": "#/components/responses/InsufficientScope"
          }
        }
      }
    },
    "/api/v1/me/links/{code}": {
      "delete": {
        "tags": [
          "account"
        ],
        "operationId": "removeFromHistory",
        "summary": "Take a link out of your history (the link stays)",
        "description": "Also 204 when the link was not in your history. A pfos-ID access token needs links:write.",
        "security": [
          {
            "personalToken": []
          },
          {
            "pfosId": [
              "links:write"
            ]
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/code"
          }
        ],
        "responses": {
          "204": {
            "description": "Taken out of the history",
            "headers": {
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimitPolicy"
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/InvalidToken"
          },
          "403": {
            "$ref": "#/components/responses/InsufficientScope"
          },
          "405": {
            "$ref": "#/components/responses/MethodNotAllowed"
          }
        }
      }
    },
    "/api/v1/links": {
      "get": {
        "tags": [
          "links"
        ],
        "operationId": "listLinks",
        "summary": "List links, newest first",
        "parameters": [
          {
            "name": "limit",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 1000,
              "default": 100
            }
          },
          {
            "name": "cursor",
            "in": "query",
            "schema": {
              "type": "string"
            },
            "description": "The cursor of the previous page; a page with cursor null is the last one"
          }
        ],
        "responses": {
          "200": {
            "description": "One page of links",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/LinkPage"
                }
              }
            },
            "headers": {
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimitPolicy"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          }
        }
      },
      "post": {
        "tags": [
          "links"
        ],
        "operationId": "createLink",
        "summary": "Create a short link with an optional custom code and expiry",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/LinkRequest"
              },
              "example": {
                "url": "https://example.com",
                "slug": "campaign-2026",
                "ttl": 86400
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Created",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CreatedLink"
                }
              }
            },
            "headers": {
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimitPolicy"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "409": {
            "description": "The slug is already taken",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "headers": {
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimitPolicy"
              }
            }
          }
        }
      }
    },
    "/api/v1/links/{code}": {
      "get": {
        "tags": [
          "links"
        ],
        "operationId": "getLink",
        "summary": "Get one link",
        "parameters": [
          {
            "$ref": "#/components/parameters/code"
          },
          {
            "name": "qr",
            "in": "query",
            "schema": {
              "type": "boolean"
            },
            "description": "true adds the QR code URLs"
          }
        ],
        "responses": {
          "200": {
            "description": "The link",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Link"
                }
              }
            },
            "headers": {
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimitPolicy"
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      },
      "delete": {
        "tags": [
          "links"
        ],
        "operationId": "deleteLink",
        "summary": "Delete a link",
        "description": "Also 204 when the code does not exist. Redirects are cached for up to 60 seconds per data center, so some regions keep redirecting briefly.",
        "parameters": [
          {
            "$ref": "#/components/parameters/code"
          }
        ],
        "responses": {
          "204": {
            "description": "Deleted",
            "headers": {
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimitPolicy"
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          }
        }
      }
    },
    "/{code}.svg": {
      "get": {
        "tags": [
          "qr"
        ],
        "operationId": "getQrSvg",
        "summary": "QR code of a short link as SVG",
        "description": "The QR code encodes the short URL. Only existing short links have a QR code. Images are cached for 24 hours.",
        "security": [],
        "parameters": [
          {
            "$ref": "#/components/parameters/code"
          },
          {
            "name": "ec",
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "L",
                "M",
                "Q",
                "H"
              ],
              "default": "M",
              "description": "Error correction: L ~7%, M ~15%, Q ~25%, H ~30%. Always H when lw/lh is set."
            }
          },
          {
            "name": "m",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 0,
              "maximum": 16,
              "default": 4,
              "description": "Quiet zone in modules (2 or more recommended)."
            }
          },
          {
            "name": "fg",
            "in": "query",
            "schema": {
              "type": "string",
              "pattern": "^#?([0-9A-Fa-f]{3}|[0-9A-Fa-f]{6})$",
              "default": "000000",
              "description": "Module color (gradient start), hex without #."
            }
          },
          {
            "name": "fg2",
            "in": "query",
            "schema": {
              "type": "string",
              "pattern": "^#?([0-9A-Fa-f]{3}|[0-9A-Fa-f]{6})$",
              "description": "Gradient end color; setting it makes a gradient."
            }
          },
          {
            "name": "grad",
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "d",
                "v",
                "h",
                "r"
              ],
              "default": "d",
              "description": "Gradient direction: d diagonal, v vertical, h horizontal, r radial."
            }
          },
          {
            "name": "bg",
            "in": "query",
            "schema": {
              "type": "string",
              "pattern": "^#?([0-9A-Fa-f]{3}|[0-9A-Fa-f]{6})$|^transparent$",
              "default": "ffffff",
              "description": "Background color, or \"transparent\"."
            }
          },
          {
            "name": "dot",
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "square",
                "rounded",
                "fluid",
                "dots",
                "diamond",
                "vline",
                "hline"
              ],
              "default": "square",
              "description": "Module shape."
            }
          },
          {
            "name": "eye",
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "square",
                "rounded",
                "circle",
                "leaf"
              ],
              "default": "square",
              "description": "Finder ring shape."
            }
          },
          {
            "name": "pupil",
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "square",
                "rounded",
                "circle",
                "leaf"
              ],
              "default": "square",
              "description": "Finder center shape. Pair it with eye as square+square, rounded+rounded, circle+circle, circle+rounded or leaf+leaf."
            }
          },
          {
            "name": "eyec",
            "in": "query",
            "schema": {
              "type": "string",
              "pattern": "^#?([0-9A-Fa-f]{3}|[0-9A-Fa-f]{6})$",
              "description": "Finder ring color (default: the module color)."
            }
          },
          {
            "name": "pupc",
            "in": "query",
            "schema": {
              "type": "string",
              "pattern": "^#?([0-9A-Fa-f]{3}|[0-9A-Fa-f]{6})$",
              "description": "Finder center color (default: the module color)."
            }
          },
          {
            "name": "lw",
            "in": "query",
            "schema": {
              "type": "number",
              "minimum": 0.05,
              "maximum": 0.3,
              "description": "Width of the area kept clear for a logo, as a fraction of the QR width (one of lw/lh alone makes a square)."
            }
          },
          {
            "name": "lh",
            "in": "query",
            "schema": {
              "type": "number",
              "minimum": 0.05,
              "maximum": 0.3,
              "description": "Height of the area kept clear for a logo, as a fraction of the QR width."
            }
          }
        ],
        "responses": {
          "200": {
            "description": "QR code (SVG)",
            "content": {
              "image/svg+xml": {
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "404": {
            "$ref": "#/components/responses/NoSuchLink"
          }
        }
      }
    },
    "/{code}.png": {
      "get": {
        "tags": [
          "qr"
        ],
        "operationId": "getQrPng",
        "summary": "QR code of a short link as PNG",
        "description": "The QR code encodes the short URL. Only existing short links have a QR code. Images are cached for 24 hours.",
        "security": [],
        "parameters": [
          {
            "$ref": "#/components/parameters/code"
          },
          {
            "name": "s",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 2,
              "maximum": 32,
              "default": 8,
              "description": "PNG pixels per QR module."
            }
          },
          {
            "name": "ec",
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "L",
                "M",
                "Q",
                "H"
              ],
              "default": "M",
              "description": "Error correction: L ~7%, M ~15%, Q ~25%, H ~30%. Always H when lw/lh is set."
            }
          },
          {
            "name": "m",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 0,
              "maximum": 16,
              "default": 4,
              "description": "Quiet zone in modules (2 or more recommended)."
            }
          },
          {
            "name": "fg",
            "in": "query",
            "schema": {
              "type": "string",
              "pattern": "^#?([0-9A-Fa-f]{3}|[0-9A-Fa-f]{6})$",
              "default": "000000",
              "description": "Module color (gradient start), hex without #."
            }
          },
          {
            "name": "fg2",
            "in": "query",
            "schema": {
              "type": "string",
              "pattern": "^#?([0-9A-Fa-f]{3}|[0-9A-Fa-f]{6})$",
              "description": "Gradient end color; setting it makes a gradient."
            }
          },
          {
            "name": "grad",
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "d",
                "v",
                "h",
                "r"
              ],
              "default": "d",
              "description": "Gradient direction: d diagonal, v vertical, h horizontal, r radial."
            }
          },
          {
            "name": "bg",
            "in": "query",
            "schema": {
              "type": "string",
              "pattern": "^#?([0-9A-Fa-f]{3}|[0-9A-Fa-f]{6})$|^transparent$",
              "default": "ffffff",
              "description": "Background color, or \"transparent\"."
            }
          },
          {
            "name": "dot",
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "square",
                "rounded",
                "fluid",
                "dots",
                "diamond",
                "vline",
                "hline"
              ],
              "default": "square",
              "description": "Module shape."
            }
          },
          {
            "name": "eye",
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "square",
                "rounded",
                "circle",
                "leaf"
              ],
              "default": "square",
              "description": "Finder ring shape."
            }
          },
          {
            "name": "pupil",
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "square",
                "rounded",
                "circle",
                "leaf"
              ],
              "default": "square",
              "description": "Finder center shape. Pair it with eye as square+square, rounded+rounded, circle+circle, circle+rounded or leaf+leaf."
            }
          },
          {
            "name": "eyec",
            "in": "query",
            "schema": {
              "type": "string",
              "pattern": "^#?([0-9A-Fa-f]{3}|[0-9A-Fa-f]{6})$",
              "description": "Finder ring color (default: the module color)."
            }
          },
          {
            "name": "pupc",
            "in": "query",
            "schema": {
              "type": "string",
              "pattern": "^#?([0-9A-Fa-f]{3}|[0-9A-Fa-f]{6})$",
              "description": "Finder center color (default: the module color)."
            }
          },
          {
            "name": "lw",
            "in": "query",
            "schema": {
              "type": "number",
              "minimum": 0.05,
              "maximum": 0.3,
              "description": "Width of the area kept clear for a logo, as a fraction of the QR width (one of lw/lh alone makes a square)."
            }
          },
          {
            "name": "lh",
            "in": "query",
            "schema": {
              "type": "number",
              "minimum": 0.05,
              "maximum": 0.3,
              "description": "Height of the area kept clear for a logo, as a fraction of the QR width."
            }
          }
        ],
        "responses": {
          "200": {
            "description": "QR code (PNG)",
            "content": {
              "image/png": {
                "schema": {
                  "type": "string",
                  "contentMediaType": "image/png"
                }
              }
            }
          },
          "404": {
            "$ref": "#/components/responses/NoSuchLink"
          }
        }
      }
    },
    "/api/v1/qr": {
      "post": {
        "tags": [
          "qr"
        ],
        "operationId": "renderQrWithLogo",
        "summary": "QR code with a logo (PNG or SVG)",
        "description": "The modules under the logo are removed and error correction becomes H. Rendered on every request (not cached); the logo is not stored. 30 requests per minute per IP address, or 120 per signed-in account (a pfos-ID access token or a personal API token). A pfos-ID access token needs links:write (a token for the QR code designer's resource, https://s.pfos.school/qr, works here too).",
        "security": [
          {},
          {
            "personalToken": []
          },
          {
            "pfosId": [
              "links:write"
            ]
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/QrRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The QR code",
            "content": {
              "image/png": {
                "schema": {
                  "type": "string",
                  "contentMediaType": "image/png"
                }
              },
              "image/svg+xml": {
                "schema": {
                  "type": "string"
                }
              }
            },
            "headers": {
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimitPolicy"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/InvalidToken"
          },
          "403": {
            "$ref": "#/components/responses/InsufficientScope"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "413": {
            "description": "Request body over 2 MB",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "headers": {
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimitPolicy"
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        }
      }
    },
    "/mcp": {
      "post": {
        "tags": [
          "mcp"
        ],
        "operationId": "mcp",
        "summary": "MCP server (Streamable HTTP, no authentication)",
        "description": "JSON-RPC 2.0 messages of the Model Context Protocol, stateless with JSON responses. Tools: shorten_url and get_qr_code. Connect an MCP client to this URL instead of calling it by hand. shorten_url: 30 links per minute per IP address, or 120 per signed-in account (a pfos-ID access token or a personal API token); signed in, the links also go into your history, and a pfos-ID access token needs links:write for it (403 insufficient_scope otherwise).",
        "externalDocs": {
          "description": "MCP Server Card",
          "url": "https://s.pfos.school/mcp/server-card"
        },
        "security": [
          {},
          {
            "personalToken": []
          },
          {
            "pfosId": [
              "links:write"
            ]
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/JsonRpcRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "JSON-RPC response (or a batch of them)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/JsonRpcResponse"
                }
              }
            }
          },
          "202": {
            "description": "Notification accepted (no body)"
          },
          "400": {
            "description": "Bad JSON-RPC or an unsupported MCP-Protocol-Version",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/JsonRpcError"
                }
              }
            }
          },
          "401": {
            "description": "A refused pfos-ID access token or an unknown or revoked personal API token",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/JsonRpcError"
                }
              }
            },
            "headers": {
              "WWW-Authenticate": {
                "description": "Bearer and DPoP challenges with resource_metadata (RFC 9728), and the OAuth error when a token was refused",
                "schema": {
                  "type": "string"
                },
                "example": "Bearer error=\"invalid_token\", error_description=\"The access token has expired.\", resource_metadata=\"https://s.pfos.school/.well-known/oauth-protected-resource\", DPoP algs=\"ES256 EdDSA\", resource_metadata=\"https://s.pfos.school/.well-known/oauth-protected-resource\""
              }
            }
          },
          "403": {
            "description": "Another origin, or a pfos-ID access token without links:write for shorten_url",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/JsonRpcError"
                }
              }
            },
            "headers": {
              "WWW-Authenticate": {
                "description": "Bearer and DPoP challenges with resource_metadata (RFC 9728), and the OAuth error when a token was refused",
                "schema": {
                  "type": "string"
                },
                "example": "Bearer error=\"invalid_token\", error_description=\"The access token has expired.\", resource_metadata=\"https://s.pfos.school/.well-known/oauth-protected-resource\", DPoP algs=\"ES256 EdDSA\", resource_metadata=\"https://s.pfos.school/.well-known/oauth-protected-resource\""
              }
            }
          },
          "405": {
            "description": "Only POST",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/JsonRpcError"
                }
              }
            }
          },
          "413": {
            "description": "Request body over 64 KB",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/JsonRpcError"
                }
              }
            }
          },
          "415": {
            "description": "Content-Type must be application/json",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/JsonRpcError"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/a2a": {
      "post": {
        "tags": [
          "a2a"
        ],
        "operationId": "a2a",
        "summary": "A2A agent (A2A 1.0, JSON-RPC binding)",
        "description": "Agent2Agent protocol 1.0: send the header A2A-Version: 1.0 and JSON-RPC 2.0 requests (SendMessage). The skill shorten-url takes the URL of the message (a text part, or a data part {\"url\": \"...\"}) and answers with a message: a text part and a data part { code, shortUrl, target, qr }, made as by POST /api/v1/public/links. Stateless: no tasks, no streaming, no push notifications. 30 links per minute per IP address, or 120 per signed-in account (a pfos-ID access token or a personal API token). Signed in, the links go into your history; a pfos-ID access token needs links:write. JSON-RPC errors come with HTTP 200, except 401, 403, 413 and 429.",
        "externalDocs": {
          "description": "A2A Agent Card",
          "url": "https://s.pfos.school/.well-known/agent-card.json"
        },
        "security": [
          {},
          {
            "personalToken": []
          },
          {
            "pfosId": [
              "links:write"
            ]
          }
        ],
        "parameters": [
          {
            "name": "A2A-Version",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "const": "1.0"
            },
            "description": "The A2A protocol version (also accepted as the query parameter A2A-Version)"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/JsonRpcRequest"
              },
              "example": {
                "jsonrpc": "2.0",
                "id": 1,
                "method": "SendMessage",
                "params": {
                  "message": {
                    "messageId": "m-1",
                    "role": "ROLE_USER",
                    "parts": [
                      {
                        "text": "Shorten https://example.com/a/long/page"
                      }
                    ]
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "JSON-RPC result ({ message }) or error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/A2aResponse"
                }
              }
            },
            "headers": {
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimitPolicy"
              }
            }
          },
          "401": {
            "description": "A refused pfos-ID access token or personal API token",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/JsonRpcError"
                }
              }
            },
            "headers": {
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimitPolicy"
              },
              "WWW-Authenticate": {
                "description": "Bearer and DPoP challenges with resource_metadata (RFC 9728), and the OAuth error when a token was refused",
                "schema": {
                  "type": "string"
                },
                "example": "Bearer error=\"invalid_token\", error_description=\"The access token has expired.\", resource_metadata=\"https://s.pfos.school/.well-known/oauth-protected-resource\", DPoP algs=\"ES256 EdDSA\", resource_metadata=\"https://s.pfos.school/.well-known/oauth-protected-resource\""
              }
            }
          },
          "403": {
            "description": "A pfos-ID access token without links:write",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/JsonRpcError"
                }
              }
            },
            "headers": {
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimitPolicy"
              },
              "WWW-Authenticate": {
                "description": "Bearer and DPoP challenges with resource_metadata (RFC 9728), and the OAuth error when a token was refused",
                "schema": {
                  "type": "string"
                },
                "example": "Bearer error=\"invalid_token\", error_description=\"The access token has expired.\", resource_metadata=\"https://s.pfos.school/.well-known/oauth-protected-resource\", DPoP algs=\"ES256 EdDSA\", resource_metadata=\"https://s.pfos.school/.well-known/oauth-protected-resource\""
              }
            }
          },
          "405": {
            "description": "Only POST (and OPTIONS for CORS)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/JsonRpcError"
                }
              }
            },
            "headers": {
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimitPolicy"
              }
            }
          },
          "413": {
            "description": "Request body over 64 KB",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/JsonRpcError"
                }
              }
            },
            "headers": {
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimitPolicy"
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/JsonRpcError"
                }
              }
            },
            "headers": {
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimitPolicy"
              },
              "Retry-After": {
                "description": "Seconds to wait before retrying",
                "schema": {
                  "type": "integer",
                  "example": 60
                }
              }
            }
          }
        }
      }
    },
    "/{code}": {
      "get": {
        "tags": [
          "links"
        ],
        "operationId": "redirect",
        "summary": "Redirect to the original URL",
        "security": [],
        "parameters": [
          {
            "$ref": "#/components/parameters/code"
          }
        ],
        "responses": {
          "302": {
            "description": "Redirect to the target URL",
            "headers": {
              "Location": {
                "schema": {
                  "type": "string",
                  "format": "uri"
                }
              }
            }
          },
          "404": {
            "$ref": "#/components/responses/NoSuchLink"
          }
        }
      }
    }
  },
  "components": {
    "securitySchemes": {
      "apiKey": {
        "type": "http",
        "scheme": "bearer",
        "description": "API key issued by the administrator: Authorization: Bearer YOUR_API_KEY"
      },
      "personalToken": {
        "type": "http",
        "scheme": "bearer",
        "description": "Personal API token of a pfos-ID account (spfos_...), created on the home page while signed in with pfos-ID: Authorization: Bearer spfos_... Shown once; works until revoked there."
      },
      "pfosId": {
        "type": "oauth2",
        "description": "pfos-ID access token (OAuth 2.0, https://id.pfos.school) for the resource https://s.pfos.school (RFC 8707: send resource=https://s.pfos.school). Not DPoP-bound: Authorization: Bearer <token>. DPoP-bound (every agent ID's token, RFC 9449): Authorization: DPoP <token> with a DPoP proof (ES256 or EdDSA) per request. Tokens live 10 minutes. Protected resource metadata: https://s.pfos.school/.well-known/oauth-protected-resource; agents: https://s.pfos.school/auth.md",
        "flows": {
          "authorizationCode": {
            "authorizationUrl": "https://id.pfos.school/oauth2/authorize",
            "tokenUrl": "https://id.pfos.school/oauth2/token",
            "scopes": {
              "links:read": "Read the links you created with your account (your history on s.pfos.school).",
              "links:write": "Create short links and QR codes on s.pfos.school in your name, and remove links from your history."
            }
          }
        }
      }
    },
    "parameters": {
      "code": {
        "name": "code",
        "in": "path",
        "required": true,
        "description": "Short code, e.g. Ab3xZ9q",
        "schema": {
          "type": "string",
          "pattern": "^[A-Za-z0-9_-]{1,32}$"
        }
      }
    },
    "headers": {
      "RateLimitPolicy": {
        "description": "The rate limits that apply to the caller (IETF draft-ietf-httpapi-ratelimit-headers): on POST /api/v1/public/links, POST /api/v1/qr and POST /api/v1/a2a the endpoint's own policy, e.g. \"links\";q=30;w=60 per IP address or \"links-pfos-id\";q=120;w=60 per signed-in account; on every other response of /api/v1, all the policies of the caller's tier",
        "schema": {
          "type": "string"
        },
        "example": "\"links\";q=30;w=60, \"qr\";q=30;w=60, \"mcp\";q=30;w=60, \"a2a\";q=30;w=60"
      }
    },
    "schemas": {
      "PublicLinkRequest": {
        "type": "object",
        "required": [
          "url"
        ],
        "properties": {
          "url": {
            "type": "string",
            "format": "uri",
            "maxLength": 8192,
            "description": "http:// or https:// URL to shorten"
          },
          "qr": {
            "type": "boolean",
            "description": "true adds the QR code URLs to the response"
          }
        }
      },
      "LinkRequest": {
        "type": "object",
        "required": [
          "url"
        ],
        "properties": {
          "url": {
            "type": "string",
            "format": "uri",
            "maxLength": 8192,
            "description": "http:// or https:// URL to shorten"
          },
          "slug": {
            "type": "string",
            "pattern": "^[A-Za-z0-9_-]{1,32}$",
            "description": "Custom code; reserved slugs are rejected"
          },
          "ttl": {
            "type": "number",
            "description": "Lifetime in seconds (at least 60); omit for a link that never expires"
          },
          "qr": {
            "type": "boolean",
            "description": "true adds the QR code URLs to the response"
          }
        }
      },
      "QrUrls": {
        "type": "object",
        "required": [
          "svg",
          "png"
        ],
        "properties": {
          "svg": {
            "type": "string",
            "format": "uri",
            "description": "QR code as SVG"
          },
          "png": {
            "type": "string",
            "format": "uri",
            "description": "QR code as PNG"
          }
        }
      },
      "CreatedLink": {
        "type": "object",
        "required": [
          "code",
          "shortUrl",
          "target"
        ],
        "properties": {
          "code": {
            "type": "string",
            "example": "Ab3xZ9q"
          },
          "shortUrl": {
            "type": "string",
            "format": "uri",
            "example": "https://s.pfos.school/Ab3xZ9q"
          },
          "target": {
            "type": "string",
            "format": "uri"
          },
          "createdAt": {
            "type": "integer",
            "description": "Epoch milliseconds (authenticated create only)"
          },
          "custom": {
            "type": "boolean",
            "description": "true when a slug was given (authenticated create only)"
          },
          "qr": {
            "$ref": "#/components/schemas/QrUrls"
          }
        }
      },
      "Link": {
        "type": "object",
        "required": [
          "code",
          "target",
          "shortUrl",
          "createdAt",
          "custom",
          "public"
        ],
        "properties": {
          "code": {
            "type": "string"
          },
          "target": {
            "type": "string",
            "format": "uri"
          },
          "shortUrl": {
            "type": "string",
            "format": "uri"
          },
          "createdAt": {
            "type": "integer",
            "description": "Epoch milliseconds"
          },
          "custom": {
            "type": "boolean"
          },
          "public": {
            "type": "boolean",
            "description": "true for links created through the public endpoint, the MCP server or the A2A agent"
          },
          "qr": {
            "$ref": "#/components/schemas/QrUrls"
          }
        }
      },
      "LinkPage": {
        "type": "object",
        "required": [
          "links",
          "cursor"
        ],
        "properties": {
          "links": {
            "type": "array",
            "items": {
              "allOf": [
                {
                  "$ref": "#/components/schemas/Link"
                }
              ],
              "properties": {
                "expiration": {
                  "type": [
                    "integer",
                    "null"
                  ],
                  "description": "Epoch seconds; null when the link never expires"
                }
              }
            }
          },
          "cursor": {
            "type": [
              "string",
              "null"
            ]
          }
        }
      },
      "QrRequest": {
        "type": "object",
        "required": [
          "link"
        ],
        "properties": {
          "link": {
            "type": "string",
            "description": "Short code or short URL"
          },
          "format": {
            "type": "string",
            "enum": [
              "png",
              "svg"
            ],
            "default": "png"
          },
          "logo": {
            "type": "string",
            "description": "PNG as a data URL (data:image/png;base64,...) or bare base64; up to 1 MB and 1024x1024 px"
          },
          "ls": {
            "type": "number",
            "minimum": 0.05,
            "maximum": 0.3,
            "default": 0.22,
            "description": "Logo size: its longer side as a fraction of the QR width; lw/lh override it"
          },
          "s": {
            "type": "integer",
            "minimum": 2,
            "maximum": 32,
            "default": 8,
            "description": "PNG pixels per QR module."
          },
          "ec": {
            "type": "string",
            "enum": [
              "L",
              "M",
              "Q",
              "H"
            ],
            "default": "M",
            "description": "Error correction: L ~7%, M ~15%, Q ~25%, H ~30%. Always H when lw/lh is set."
          },
          "m": {
            "type": "integer",
            "minimum": 0,
            "maximum": 16,
            "default": 4,
            "description": "Quiet zone in modules (2 or more recommended)."
          },
          "fg": {
            "type": "string",
            "pattern": "^#?([0-9A-Fa-f]{3}|[0-9A-Fa-f]{6})$",
            "default": "000000",
            "description": "Module color (gradient start), hex without #."
          },
          "fg2": {
            "type": "string",
            "pattern": "^#?([0-9A-Fa-f]{3}|[0-9A-Fa-f]{6})$",
            "description": "Gradient end color; setting it makes a gradient."
          },
          "grad": {
            "type": "string",
            "enum": [
              "d",
              "v",
              "h",
              "r"
            ],
            "default": "d",
            "description": "Gradient direction: d diagonal, v vertical, h horizontal, r radial."
          },
          "bg": {
            "type": "string",
            "pattern": "^#?([0-9A-Fa-f]{3}|[0-9A-Fa-f]{6})$|^transparent$",
            "default": "ffffff",
            "description": "Background color, or \"transparent\"."
          },
          "dot": {
            "type": "string",
            "enum": [
              "square",
              "rounded",
              "fluid",
              "dots",
              "diamond",
              "vline",
              "hline"
            ],
            "default": "square",
            "description": "Module shape."
          },
          "eye": {
            "type": "string",
            "enum": [
              "square",
              "rounded",
              "circle",
              "leaf"
            ],
            "default": "square",
            "description": "Finder ring shape."
          },
          "pupil": {
            "type": "string",
            "enum": [
              "square",
              "rounded",
              "circle",
              "leaf"
            ],
            "default": "square",
            "description": "Finder center shape. Pair it with eye as square+square, rounded+rounded, circle+circle, circle+rounded or leaf+leaf."
          },
          "eyec": {
            "type": "string",
            "pattern": "^#?([0-9A-Fa-f]{3}|[0-9A-Fa-f]{6})$",
            "description": "Finder ring color (default: the module color)."
          },
          "pupc": {
            "type": "string",
            "pattern": "^#?([0-9A-Fa-f]{3}|[0-9A-Fa-f]{6})$",
            "description": "Finder center color (default: the module color)."
          },
          "lw": {
            "type": "number",
            "minimum": 0.05,
            "maximum": 0.3,
            "description": "Width of the area kept clear for a logo, as a fraction of the QR width (one of lw/lh alone makes a square)."
          },
          "lh": {
            "type": "number",
            "minimum": 0.05,
            "maximum": 0.3,
            "description": "Height of the area kept clear for a logo, as a fraction of the QR width."
          }
        }
      },
      "Limits": {
        "type": "object",
        "description": "The rate limits that apply to the caller: requests (links for mcp and a2a) per window seconds",
        "properties": {
          "links": {
            "type": "object",
            "required": [
              "quota",
              "window"
            ],
            "properties": {
              "quota": {
                "type": "integer"
              },
              "window": {
                "type": "integer",
                "description": "Seconds"
              }
            }
          },
          "qr": {
            "type": "object",
            "required": [
              "quota",
              "window"
            ],
            "properties": {
              "quota": {
                "type": "integer"
              },
              "window": {
                "type": "integer",
                "description": "Seconds"
              }
            }
          },
          "mcp": {
            "type": "object",
            "required": [
              "quota",
              "window"
            ],
            "properties": {
              "quota": {
                "type": "integer"
              },
              "window": {
                "type": "integer",
                "description": "Seconds"
              }
            }
          },
          "a2a": {
            "type": "object",
            "required": [
              "quota",
              "window"
            ],
            "properties": {
              "quota": {
                "type": "integer"
              },
              "window": {
                "type": "integer",
                "description": "Seconds"
              }
            }
          }
        }
      },
      "Me": {
        "type": "object",
        "required": [
          "signedIn",
          "limits"
        ],
        "properties": {
          "signedIn": {
            "type": "boolean"
          },
          "via": {
            "type": "string",
            "enum": [
              "oauth",
              "token",
              "session"
            ],
            "description": "A pfos-ID access token, a personal API token, or the session on the site"
          },
          "sub": {
            "type": "string",
            "description": "pfos-ID user ID (UUID); the agent's own ID for an agent acting as itself"
          },
          "handle": {
            "type": [
              "string",
              "null"
            ],
            "description": "pfos-ID @handle without \"@\"; null with a token"
          },
          "name": {
            "type": [
              "string",
              "null"
            ],
            "description": "Display name; null with a token"
          },
          "limits": {
            "$ref": "#/components/schemas/Limits"
          },
          "oauth": {
            "type": "object",
            "description": "Only with a pfos-ID access token: what the token says",
            "required": [
              "clientId",
              "principal",
              "scopes",
              "dpop"
            ],
            "properties": {
              "clientId": {
                "type": "string",
                "description": "The client the token was issued to"
              },
              "principal": {
                "type": "string",
                "enum": [
                  "human",
                  "agent"
                ],
                "description": "A person, or an agent acting as itself"
              },
              "mode": {
                "type": [
                  "string",
                  "null"
                ],
                "enum": [
                  "self",
                  "delegate",
                  null
                ],
                "description": "How an agent acts; null for a person"
              },
              "agentId": {
                "type": [
                  "string",
                  "null"
                ],
                "description": "The agent of an agent's token; null for a person"
              },
              "scopes": {
                "type": "array",
                "items": {
                  "type": "string",
                  "enum": [
                    "links:read",
                    "links:write"
                  ]
                }
              },
              "dpop": {
                "type": "boolean",
                "description": "true when the token is DPoP-bound"
              }
            }
          }
        }
      },
      "HistoryPage": {
        "type": "object",
        "required": [
          "links",
          "cursor"
        ],
        "properties": {
          "links": {
            "type": "array",
            "items": {
              "type": "object",
              "required": [
                "code",
                "shortUrl",
                "target",
                "createdAt"
              ],
              "properties": {
                "code": {
                  "type": "string",
                  "example": "Ab3xZ9q"
                },
                "shortUrl": {
                  "type": "string",
                  "format": "uri"
                },
                "target": {
                  "type": "string",
                  "format": "uri"
                },
                "createdAt": {
                  "type": "integer",
                  "description": "Epoch milliseconds: when the link went into your history"
                }
              }
            }
          },
          "cursor": {
            "type": [
              "string",
              "null"
            ]
          }
        }
      },
      "Error": {
        "type": "object",
        "required": [
          "error"
        ],
        "properties": {
          "error": {
            "type": "string",
            "description": "What went wrong, for people and agents"
          }
        }
      },
      "JsonRpcRequest": {
        "type": "object",
        "required": [
          "jsonrpc",
          "method"
        ],
        "description": "A JSON-RPC 2.0 request or notification (the MCP server also takes a batch: an array of them)",
        "properties": {
          "jsonrpc": {
            "const": "2.0"
          },
          "id": {
            "type": [
              "string",
              "integer",
              "null"
            ],
            "description": "The id of the request (null when it could not be read)"
          },
          "method": {
            "type": "string",
            "example": "tools/call"
          },
          "params": {
            "type": "object"
          }
        }
      },
      "JsonRpcErrorObject": {
        "type": "object",
        "required": [
          "code",
          "message"
        ],
        "properties": {
          "code": {
            "type": "integer",
            "description": "JSON-RPC error code (A2A: -32001 TaskNotFoundError, -32004 UnsupportedOperationError, -32009 VersionNotSupportedError, ...)"
          },
          "message": {
            "type": "string"
          },
          "data": {
            "type": "array",
            "description": "A2A: google.rpc.ErrorInfo with the reason (domain a2a-protocol.org)",
            "items": {
              "type": "object",
              "properties": {
                "@type": {
                  "type": "string"
                },
                "reason": {
                  "type": "string"
                },
                "domain": {
                  "type": "string"
                }
              }
            }
          }
        }
      },
      "JsonRpcError": {
        "type": "object",
        "required": [
          "jsonrpc",
          "id",
          "error"
        ],
        "properties": {
          "jsonrpc": {
            "const": "2.0"
          },
          "id": {
            "type": [
              "string",
              "integer",
              "null"
            ],
            "description": "The id of the request (null when it could not be read)"
          },
          "error": {
            "$ref": "#/components/schemas/JsonRpcErrorObject"
          }
        }
      },
      "JsonRpcResponse": {
        "type": "object",
        "required": [
          "jsonrpc",
          "id"
        ],
        "description": "A JSON-RPC 2.0 response: result or error",
        "properties": {
          "jsonrpc": {
            "const": "2.0"
          },
          "id": {
            "type": [
              "string",
              "integer",
              "null"
            ],
            "description": "The id of the request (null when it could not be read)"
          },
          "result": {
            "type": "object"
          },
          "error": {
            "$ref": "#/components/schemas/JsonRpcErrorObject"
          }
        }
      },
      "A2aMessage": {
        "type": "object",
        "required": [
          "messageId",
          "role",
          "parts"
        ],
        "description": "An A2A 1.0 message of the agent",
        "properties": {
          "messageId": {
            "type": "string"
          },
          "contextId": {
            "type": "string"
          },
          "role": {
            "const": "ROLE_AGENT"
          },
          "parts": {
            "type": "array",
            "items": {
              "type": "object",
              "description": "A text part, or a data part with the link ({ code, shortUrl, target, qr }) or { error }",
              "properties": {
                "text": {
                  "type": "string"
                },
                "data": {
                  "type": "object",
                  "properties": {
                    "code": {
                      "type": "string"
                    },
                    "shortUrl": {
                      "type": "string",
                      "format": "uri"
                    },
                    "target": {
                      "type": "string",
                      "format": "uri"
                    },
                    "qr": {
                      "$ref": "#/components/schemas/QrUrls"
                    },
                    "error": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          }
        }
      },
      "A2aResponse": {
        "type": "object",
        "required": [
          "jsonrpc",
          "id"
        ],
        "properties": {
          "jsonrpc": {
            "const": "2.0"
          },
          "id": {
            "type": [
              "string",
              "integer",
              "null"
            ],
            "description": "The id of the request (null when it could not be read)"
          },
          "result": {
            "type": "object",
            "description": "SendMessage: { message }; ListTasks: { tasks: [], nextPageToken, pageSize, totalSize }",
            "properties": {
              "message": {
                "$ref": "#/components/schemas/A2aMessage"
              }
            }
          },
          "error": {
            "$ref": "#/components/schemas/JsonRpcErrorObject"
          }
        }
      }
    },
    "responses": {
      "BadRequest": {
        "description": "Invalid input",
        "headers": {
          "RateLimit-Policy": {
            "$ref": "#/components/headers/RateLimitPolicy"
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        }
      },
      "Unauthorized": {
        "description": "Missing or wrong API key",
        "headers": {
          "RateLimit-Policy": {
            "$ref": "#/components/headers/RateLimitPolicy"
          },
          "WWW-Authenticate": {
            "schema": {
              "type": "string",
              "example": "Bearer realm=\"s.pfos.school API key\""
            }
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            },
            "example": {
              "error": "Unauthorized"
            }
          }
        }
      },
      "InvalidToken": {
        "description": "A refused pfos-ID access token (expired, for another resource, a bad DPoP proof, ...), an unknown or revoked personal API token, or, where an account is required, none",
        "headers": {
          "RateLimit-Policy": {
            "$ref": "#/components/headers/RateLimitPolicy"
          },
          "WWW-Authenticate": {
            "description": "Bearer and DPoP challenges with resource_metadata (RFC 9728), and the OAuth error when a token was refused",
            "schema": {
              "type": "string"
            },
            "example": "Bearer error=\"invalid_token\", error_description=\"The access token has expired.\", resource_metadata=\"https://s.pfos.school/.well-known/oauth-protected-resource\", DPoP algs=\"ES256 EdDSA\", resource_metadata=\"https://s.pfos.school/.well-known/oauth-protected-resource\""
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        }
      },
      "InsufficientScope": {
        "description": "A pfos-ID access token without the scope this needs (named in the challenge)",
        "headers": {
          "RateLimit-Policy": {
            "$ref": "#/components/headers/RateLimitPolicy"
          },
          "WWW-Authenticate": {
            "schema": {
              "type": "string"
            },
            "example": "Bearer error=\"insufficient_scope\", error_description=\"The access token needs the scope links:write for this.\", scope=\"links:write\", resource_metadata=\"https://s.pfos.school/.well-known/oauth-protected-resource\""
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        }
      },
      "NotFound": {
        "description": "The code does not exist or has expired",
        "headers": {
          "RateLimit-Policy": {
            "$ref": "#/components/headers/RateLimitPolicy"
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        }
      },
      "MethodNotAllowed": {
        "description": "Another method",
        "headers": {
          "RateLimit-Policy": {
            "$ref": "#/components/headers/RateLimitPolicy"
          },
          "Allow": {
            "schema": {
              "type": "string"
            }
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            },
            "example": {
              "error": "Method not allowed"
            }
          }
        }
      },
      "NoSuchLink": {
        "description": "The code does not exist or has expired. JSON for clients that ask for it (Accept: application/json), Markdown with links for agents (Accept: text/markdown), plain text otherwise",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            },
            "example": {
              "error": "Not found"
            }
          },
          "text/markdown": {
            "schema": {
              "type": "string"
            }
          },
          "text/plain": {
            "schema": {
              "type": "string"
            }
          }
        }
      },
      "RateLimited": {
        "description": "Rate limit exceeded; wait and retry",
        "headers": {
          "RateLimit-Policy": {
            "$ref": "#/components/headers/RateLimitPolicy"
          },
          "Retry-After": {
            "description": "Seconds to wait before retrying",
            "schema": {
              "type": "integer",
              "example": 60
            }
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        }
      }
    }
  }
}
