{
  "openapi": "3.1.0",
  "info": {
    "title": "freepastebin.com",
    "version": "1.0.0",
    "description": "Free pastebin for text and code. Create a paste, share a link, download raw text and choose when it expires. No account needed."
  },
  "servers": [
    {
      "url": "https://freepastebin.com"
    }
  ],
  "externalDocs": {
    "description": "API reference with request examples",
    "url": "https://freepastebin.com/docs"
  },
  "paths": {
    "/api/pastes": {
      "get": {
        "operationId": "createPasteGet",
        "summary": "Create a paste. Save delete_token and, for private pastes, read_token. Private share URLs carry the read token in a browser-only fragment.",
        "parameters": [
          {
            "name": "content",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "description": "UTF-8 paste content, maximum 1 MiB."
            }
          },
          {
            "name": "title",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "description": "Optional title.",
              "maxLength": 200
            }
          },
          {
            "name": "language",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "description": "Language label.",
              "maxLength": 40,
              "default": "text"
            }
          },
          {
            "name": "expires_in",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "description": "Retention in seconds. 0 means never. Maximum 10 years.",
              "minimum": 0,
              "maximum": 315360000,
              "default": 2592000
            }
          },
          {
            "name": "visibility",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "description": "Public pastes are indexable. Private pastes require the returned read_token; stored content remains available to the service operator.",
              "enum": [
                "public",
                "private"
              ],
              "default": "public"
            }
          }
        ],
        "responses": {
          "201": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CreatedPaste"
                }
              }
            }
          },
          "default": {
            "$ref": "#/components/responses/Error"
          }
        }
      },
      "post": {
        "operationId": "createPastePost",
        "summary": "Create a paste. Save delete_token and, for private pastes, read_token. Private share URLs carry the read token in a browser-only fragment.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "content": {
                    "type": "string",
                    "description": "UTF-8 paste content, maximum 1 MiB."
                  },
                  "title": {
                    "type": "string",
                    "description": "Optional title.",
                    "maxLength": 200
                  },
                  "language": {
                    "type": "string",
                    "description": "Language label.",
                    "maxLength": 40,
                    "default": "text"
                  },
                  "expires_in": {
                    "type": "integer",
                    "description": "Retention in seconds. 0 means never. Maximum 10 years.",
                    "minimum": 0,
                    "maximum": 315360000,
                    "default": 2592000
                  },
                  "visibility": {
                    "type": "string",
                    "description": "Public pastes are indexable. Private pastes require the returned read_token; stored content remains available to the service operator.",
                    "enum": [
                      "public",
                      "private"
                    ],
                    "default": "public"
                  }
                },
                "required": [
                  "content"
                ]
              }
            },
            "application/x-www-form-urlencoded": {
              "schema": {
                "type": "object",
                "properties": {
                  "content": {
                    "type": "string",
                    "description": "UTF-8 paste content, maximum 1 MiB."
                  },
                  "title": {
                    "type": "string",
                    "description": "Optional title.",
                    "maxLength": 200
                  },
                  "language": {
                    "type": "string",
                    "description": "Language label.",
                    "maxLength": 40,
                    "default": "text"
                  },
                  "expires_in": {
                    "type": "integer",
                    "description": "Retention in seconds. 0 means never. Maximum 10 years.",
                    "minimum": 0,
                    "maximum": 315360000,
                    "default": 2592000
                  },
                  "visibility": {
                    "type": "string",
                    "description": "Public pastes are indexable. Private pastes require the returned read_token; stored content remains available to the service operator.",
                    "enum": [
                      "public",
                      "private"
                    ],
                    "default": "public"
                  }
                },
                "required": [
                  "content"
                ]
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CreatedPaste"
                }
              }
            }
          },
          "default": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/api/pastes/{id}": {
      "get": {
        "operationId": "getPaste",
        "summary": "Retrieve paste content and metadata. Private pastes require a read token.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "description": "Paste ID."
            }
          },
          {
            "name": "read_token",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "description": "Private read token; prefer Authorization: Bearer <read_token>."
            }
          },
          {
            "name": "Authorization",
            "in": "header",
            "required": false,
            "schema": {
              "type": "string",
              "description": "For a private paste, Bearer <read_token>. The read token cannot delete a paste."
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Paste"
                }
              }
            }
          },
          "default": {
            "$ref": "#/components/responses/Error"
          }
        }
      },
      "delete": {
        "operationId": "deleteByBearer",
        "summary": "Delete using Authorization: Bearer <delete_token>.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "description": "Record identifier."
            }
          },
          {
            "name": "Authorization",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "example": "Bearer DELETE_TOKEN"
            }
          }
        ],
        "responses": {
          "204": {
            "description": "Deleted successfully."
          },
          "default": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/raw/{id}": {
      "get": {
        "operationId": "rawPaste",
        "summary": "Retrieve raw UTF-8 text. Supports HEAD and If-None-Match. Private reads are authorized before conditional responses.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "description": "Paste ID."
            }
          },
          {
            "name": "read_token",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "description": "Private read token; prefer Authorization: Bearer <read_token>."
            }
          },
          {
            "name": "Authorization",
            "in": "header",
            "required": false,
            "schema": {
              "type": "string",
              "description": "For a private paste, Bearer <read_token>. The read token cannot delete a paste."
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "text/plain": {
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "default": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/{id}": {
      "get": {
        "operationId": "viewPaste",
        "summary": "View escaped paste HTML. Private pastes require a read token and are not indexable.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "description": "Paste ID."
            }
          },
          {
            "name": "read_token",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "description": "Private read token. Share URLs use #read_token=... in the browser."
            }
          },
          {
            "name": "Authorization",
            "in": "header",
            "required": false,
            "schema": {
              "type": "string",
              "description": "For a private paste, Bearer <read_token>. The read token cannot delete a paste."
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "text/html": {
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "default": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/api/pastes/{id}/delete": {
      "post": {
        "operationId": "deletePaste",
        "summary": "Delete with the creation token.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "description": "Paste ID."
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "delete_token": {
                    "type": "string",
                    "description": "Deletion token."
                  }
                },
                "required": [
                  "delete_token"
                ]
              }
            },
            "application/x-www-form-urlencoded": {
              "schema": {
                "type": "object",
                "properties": {
                  "delete_token": {
                    "type": "string",
                    "description": "Deletion token."
                  }
                },
                "required": [
                  "delete_token"
                ]
              }
            }
          }
        },
        "responses": {
          "204": {
            "description": "Deleted successfully."
          },
          "default": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/docs": {
      "get": {
        "operationId": "documentation",
        "summary": "Server-rendered HTML API reference.",
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "text/html": {
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        }
      }
    },
    "/robots.txt": {
      "get": {
        "operationId": "robots",
        "summary": "Crawler access rules and sitemap location.",
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "text/plain": {
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        }
      }
    },
    "/sitemap.xml": {
      "get": {
        "operationId": "sitemap",
        "summary": "Public documentation sitemap.",
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/xml": {
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        }
      }
    },
    "/health": {
      "get": {
        "operationId": "health",
        "summary": "Worker liveness (does not probe external dependencies).",
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            }
          }
        }
      }
    },
    "/llms.txt": {
      "get": {
        "operationId": "agentGuide",
        "summary": "Plain-text agent usage guide.",
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "text/plain": {
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "responses": {
      "Error": {
        "description": "The request failed. See error.code and error.message for details.",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        }
      }
    },
    "schemas": {
      "Error": {
        "type": "object",
        "required": [
          "error"
        ],
        "properties": {
          "error": {
            "type": "object",
            "required": [
              "code",
              "message"
            ],
            "properties": {
              "code": {
                "type": "integer"
              },
              "message": {
                "type": "string"
              }
            }
          }
        }
      },
      "Paste": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "content": {
            "type": "string"
          },
          "visibility": {
            "type": "string",
            "enum": [
              "public",
              "private"
            ]
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "expires_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "title": {
            "type": "string"
          },
          "language": {
            "type": "string"
          }
        }
      },
      "CreatedPaste": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "url": {
            "type": "string",
            "description": "Public HTTP(S) destination.",
            "format": "uri",
            "example": "https://example.com"
          },
          "raw_url": {
            "type": "string",
            "description": "Public HTTP(S) destination.",
            "format": "uri",
            "example": "https://example.com"
          },
          "api_url": {
            "type": "string",
            "description": "Public HTTP(S) destination.",
            "format": "uri",
            "example": "https://example.com"
          },
          "delete_token": {
            "type": "string"
          },
          "read_token": {
            "type": "string",
            "description": "Only returned when creating a private paste. Save it; only its hash is kept in the paste record."
          },
          "visibility": {
            "type": "string",
            "enum": [
              "public",
              "private"
            ]
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "expires_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "title": {
            "type": "string"
          },
          "language": {
            "type": "string"
          }
        }
      }
    }
  }
}
