{
  "openapi": "3.1.0",
  "info": {
    "title": "qwerasdf9871.com",
    "version": "1.0.0",
    "description": "Free short links for random stuff. Paste a long URL, get a short one. No account, no ads, no nonsense.\n\nPLEASE READ: qwerasdf9871.com writes down everything, forever. Every URL shortened and every visit to a short link is saved, with the whole request and response, internet address (IP), about where you are, internet company, browser, and a connection \"fingerprint\". Short links are public and may show up in search engines. The site is run for research about internet use. No private stuff please. Using it or its API means you agree. https://qwerasdf9871.com/please-read"
  },
  "servers": [
    {
      "url": "https://qwerasdf9871.com"
    }
  ],
  "externalDocs": {
    "description": "Help for programmers",
    "url": "https://qwerasdf9871.com/docs"
  },
  "paths": {
    "/api/short": {
      "get": {
        "operationId": "makeShortLink",
        "summary": "Make a short link. Send url in the address bar and get JSON back.",
        "parameters": [
          {
            "name": "url",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "description": "The long link. It has to be a public http:// or https:// address.",
              "format": "uri",
              "example": "https://example.com"
            }
          },
          {
            "name": "alias",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "description": "Your own short name, if you want one. 3 to 64 letters, numbers, dashes or underscores. Big and small letters count. A name can only be used once, ever.",
              "pattern": "^[A-Za-z0-9_-]{3,64}$"
            }
          },
          {
            "name": "format",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "description": "How you want the answer: json (the normal way) or text (just the short link).",
              "enum": [
                "json",
                "text"
              ],
              "default": "json"
            }
          }
        ],
        "responses": {
          "201": {
            "description": "It worked!",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ShortLink"
                }
              }
            }
          },
          "default": {
            "$ref": "#/components/responses/ErrorMessage"
          }
        }
      },
      "post": {
        "operationId": "makeShortLinkForm",
        "summary": "Make a short link. Send url as a form or JSON and get JSON back.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "url": {
                    "type": "string",
                    "description": "The long link. It has to be a public http:// or https:// address.",
                    "format": "uri",
                    "example": "https://example.com"
                  },
                  "alias": {
                    "type": "string",
                    "description": "Your own short name, if you want one. 3 to 64 letters, numbers, dashes or underscores. Big and small letters count. A name can only be used once, ever.",
                    "pattern": "^[A-Za-z0-9_-]{3,64}$"
                  },
                  "format": {
                    "type": "string",
                    "description": "How you want the answer: json (the normal way) or text (just the short link).",
                    "enum": [
                      "json",
                      "text"
                    ],
                    "default": "json"
                  }
                },
                "required": [
                  "url"
                ]
              }
            },
            "application/x-www-form-urlencoded": {
              "schema": {
                "type": "object",
                "properties": {
                  "url": {
                    "type": "string",
                    "description": "The long link. It has to be a public http:// or https:// address.",
                    "format": "uri",
                    "example": "https://example.com"
                  },
                  "alias": {
                    "type": "string",
                    "description": "Your own short name, if you want one. 3 to 64 letters, numbers, dashes or underscores. Big and small letters count. A name can only be used once, ever.",
                    "pattern": "^[A-Za-z0-9_-]{3,64}$"
                  },
                  "format": {
                    "type": "string",
                    "description": "How you want the answer: json (the normal way) or text (just the short link).",
                    "enum": [
                      "json",
                      "text"
                    ],
                    "default": "json"
                  }
                },
                "required": [
                  "url"
                ]
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "It worked!",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ShortLink"
                }
              }
            }
          },
          "default": {
            "$ref": "#/components/responses/ErrorMessage"
          }
        }
      }
    },
    "/q": {
      "get": {
        "operationId": "quickShortLink",
        "summary": "Make a short link and get just the short link back as plain text.",
        "parameters": [
          {
            "name": "url",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "description": "The long link. It has to be a public http:// or https:// address.",
              "format": "uri",
              "example": "https://example.com"
            }
          },
          {
            "name": "alias",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "description": "Your own short name, if you want one. 3 to 64 letters, numbers, dashes or underscores. Big and small letters count. A name can only be used once, ever.",
              "pattern": "^[A-Za-z0-9_-]{3,64}$"
            }
          },
          {
            "name": "format",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "description": "How you want the answer: json (the normal way) or text (just the short link).",
              "enum": [
                "json",
                "text"
              ],
              "default": "json"
            }
          }
        ],
        "responses": {
          "201": {
            "description": "It worked!",
            "content": {
              "text/plain": {
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "default": {
            "$ref": "#/components/responses/ErrorMessage"
          }
        }
      },
      "post": {
        "operationId": "quickShortLinkForm",
        "summary": "Make a short link from a form or JSON and get just the short link back as plain text.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "url": {
                    "type": "string",
                    "description": "The long link. It has to be a public http:// or https:// address.",
                    "format": "uri",
                    "example": "https://example.com"
                  },
                  "alias": {
                    "type": "string",
                    "description": "Your own short name, if you want one. 3 to 64 letters, numbers, dashes or underscores. Big and small letters count. A name can only be used once, ever.",
                    "pattern": "^[A-Za-z0-9_-]{3,64}$"
                  },
                  "format": {
                    "type": "string",
                    "description": "How you want the answer: json (the normal way) or text (just the short link).",
                    "enum": [
                      "json",
                      "text"
                    ],
                    "default": "json"
                  }
                },
                "required": [
                  "url"
                ]
              }
            },
            "application/x-www-form-urlencoded": {
              "schema": {
                "type": "object",
                "properties": {
                  "url": {
                    "type": "string",
                    "description": "The long link. It has to be a public http:// or https:// address.",
                    "format": "uri",
                    "example": "https://example.com"
                  },
                  "alias": {
                    "type": "string",
                    "description": "Your own short name, if you want one. 3 to 64 letters, numbers, dashes or underscores. Big and small letters count. A name can only be used once, ever.",
                    "pattern": "^[A-Za-z0-9_-]{3,64}$"
                  },
                  "format": {
                    "type": "string",
                    "description": "How you want the answer: json (the normal way) or text (just the short link).",
                    "enum": [
                      "json",
                      "text"
                    ],
                    "default": "json"
                  }
                },
                "required": [
                  "url"
                ]
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "It worked!",
            "content": {
              "text/plain": {
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "default": {
            "$ref": "#/components/responses/ErrorMessage"
          }
        }
      }
    },
    "/{id}": {
      "get": {
        "operationId": "openShortLink",
        "summary": "Open a short link. It sends you on to the long link with a 302 redirect. HEAD works too.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "description": "The short name of the link: the random one or the one you picked."
            }
          }
        ],
        "responses": {
          "302": {
            "description": "It worked!",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            }
          },
          "default": {
            "$ref": "#/components/responses/ErrorMessage"
          }
        }
      }
    },
    "/api/short/{id}": {
      "get": {
        "operationId": "lookUpShortLink",
        "summary": "See where a short link goes without being sent there.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "description": "The short name of the link: the random one or the one you picked."
            }
          }
        ],
        "responses": {
          "200": {
            "description": "It worked!",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            }
          },
          "default": {
            "$ref": "#/components/responses/ErrorMessage"
          }
        }
      }
    },
    "/docs": {
      "get": {
        "operationId": "helpPage",
        "summary": "The help page for programmers, as a plain HTML page.",
        "responses": {
          "200": {
            "description": "It worked!",
            "content": {
              "text/html": {
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        }
      }
    },
    "/robots.txt": {
      "get": {
        "operationId": "robotsFile",
        "summary": "Rules for search engine robots, and where the list of pages is.",
        "responses": {
          "200": {
            "description": "It worked!",
            "content": {
              "text/plain": {
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        }
      }
    },
    "/sitemap.xml": {
      "get": {
        "operationId": "pageList",
        "summary": "List of the public help pages, for search engines.",
        "responses": {
          "200": {
            "description": "It worked!",
            "content": {
              "application/xml": {
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        }
      }
    },
    "/health": {
      "get": {
        "operationId": "isItUp",
        "summary": "Says if the site is up. It does not check anything outside the site.",
        "responses": {
          "200": {
            "description": "It worked!",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            }
          }
        }
      }
    },
    "/llms.txt": {
      "get": {
        "operationId": "llmsFile",
        "summary": "Plain text help for AI programs.",
        "responses": {
          "200": {
            "description": "It worked!",
            "content": {
              "text/plain": {
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "responses": {
      "ErrorMessage": {
        "description": "There was a problem. Read the message.",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/ErrorMessage"
            }
          }
        }
      }
    },
    "schemas": {
      "ErrorMessage": {
        "type": "object",
        "required": [
          "result",
          "message",
          "code"
        ],
        "properties": {
          "result": {
            "type": "string"
          },
          "message": {
            "type": "string"
          },
          "code": {
            "type": "integer"
          }
        },
        "example": {
          "result": "error",
          "message": "Explanation of the problem.",
          "code": 400
        }
      },
      "ShortLink": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "description": "The short name of the link: the random one or the one you picked."
          },
          "url": {
            "type": "string",
            "description": "The long link. It has to be a public http:// or https:// address.",
            "format": "uri",
            "example": "https://example.com"
          },
          "destination": {
            "type": "string",
            "format": "uri",
            "example": "https://example.com"
          },
          "api_url": {
            "type": "string",
            "format": "uri",
            "example": "https://example.com"
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "title": {
            "type": "string"
          },
          "language": {
            "type": "string"
          }
        }
      }
    }
  }
}
