{
  "openapi": "3.1.0",
  "info": {
    "title": "Press5 launch pad",
    "version": "1.0.0",
    "summary": "Publish a static website and get a live HTTPS URL.",
    "description": "Static website hosting for AI tools: one request publishes a site at https://<name>.on.press5.xyz. Games on it get free multiplayer from press5 Play (the /play endpoints): check press5.game.json with POST /play/check before deploying. Sign in by email with /auth/start and /auth/poll for a token. Full guide: https://my.press5.xyz/llms.txt",
    "contact": {
      "name": "Press5",
      "url": "https://press5.xyz/contact"
    },
    "termsOfService": "https://press5.xyz/legal/terms-of-service",
    "x-logo": {
      "url": "https://my.press5.xyz/assets/logo-icon.png"
    }
  },
  "externalDocs": {
    "description": "Guide for AI tools",
    "url": "https://my.press5.xyz/llms.txt"
  },
  "servers": [
    {
      "url": "https://my.press5.xyz/api/v1"
    }
  ],
  "security": [
    {
      "bearer": []
    }
  ],
  "paths": {
    "/deploys": {
      "post": {
        "operationId": "deployNewSite",
        "summary": "Publish a site under a random name",
        "description": "Creates a new site with a random name on the signed-in account.",
        "security": [
          {
            "bearer": []
          }
        ],
        "parameters": [
          {
            "name": "spa",
            "in": "query",
            "required": false,
            "description": "Single-page app: unknown paths serve index.html.",
            "schema": {
              "type": "string",
              "enum": [
                "1"
              ]
            }
          }
        ],
        "requestBody": {
          "required": true,
          "description": "The whole site. Either a .tar.gz (or .tar) of the build folder as the raw body, or JSON with every file, or JSON naming a starter template.",
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/DeployFiles"
              }
            },
            "application/gzip": {
              "schema": {
                "type": "string",
                "format": "binary"
              }
            },
            "application/octet-stream": {
              "schema": {
                "type": "string",
                "format": "binary"
              }
            },
            "multipart/form-data": {
              "schema": {
                "type": "object",
                "properties": {
                  "file": {
                    "type": "string",
                    "format": "binary"
                  }
                },
                "required": [
                  "file"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Deployed (an existing site updated)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Deploy"
                }
              }
            }
          },
          "201": {
            "description": "Deployed (a new site)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Deploy"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "$ref": "#/components/responses/Error"
          },
          "413": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/templates": {
      "get": {
        "operationId": "listTemplates",
        "summary": "List the starter templates (free, and premium ones included with web hosting)",
        "security": [
          {}
        ],
        "responses": {
          "200": {
            "description": "Templates",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "templates": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/Template"
                      }
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/templates/{id}": {
      "get": {
        "operationId": "getTemplate",
        "summary": "Every file of one starter template",
        "security": [
          {}
        ],
        "description": "Add the template's fields as query parameters (e.g. ?name=Rosie%27s) to have them filled in.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The template with its files",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Template"
                }
              }
            }
          },
          "404": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/auth/start": {
      "post": {
        "operationId": "startSignIn",
        "summary": "Email the person a link to approve this tool",
        "security": [
          {}
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "email"
                ],
                "properties": {
                  "email": {
                    "type": "string",
                    "format": "email"
                  },
                  "client": {
                    "type": "string",
                    "description": "Your name as shown to the person, e.g. \"ChatGPT\""
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Sign-in started",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "device_code": {
                      "type": "string"
                    },
                    "user_code": {
                      "type": "string"
                    },
                    "interval": {
                      "type": "integer"
                    },
                    "expires_in": {
                      "type": "integer"
                    }
                  }
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/auth/poll": {
      "post": {
        "operationId": "pollSignIn",
        "summary": "Check whether the person approved; returns the token once",
        "security": [
          {}
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "device_code"
                ],
                "properties": {
                  "device_code": {
                    "type": "string"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Status",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "status": {
                      "type": "string",
                      "enum": [
                        "pending",
                        "approved",
                        "denied",
                        "expired",
                        "claimed"
                      ]
                    },
                    "token": {
                      "type": "string"
                    },
                    "email": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/me": {
      "get": {
        "operationId": "getAccount",
        "summary": "The account, its plan and limits",
        "responses": {
          "200": {
            "description": "Account",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/sites": {
      "get": {
        "operationId": "listSites",
        "summary": "Your sites",
        "responses": {
          "200": {
            "description": "Sites",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "sites": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/Site"
                      }
                    }
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Error"
          }
        }
      },
      "post": {
        "operationId": "createSite",
        "summary": "Reserve a site name without deploying",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "name"
                ],
                "properties": {
                  "name": {
                    "type": "string"
                  },
                  "spa": {
                    "type": "boolean"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Created",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Site"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "$ref": "#/components/responses/Error"
          },
          "409": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/sites/{name}": {
      "get": {
        "operationId": "getSite",
        "summary": "One site with its recent deploys",
        "parameters": [
          {
            "name": "name",
            "in": "path",
            "required": true,
            "description": "Site name: 3-42 lowercase letters, digits and single hyphens.",
            "schema": {
              "type": "string",
              "pattern": "^[a-z0-9]+(-[a-z0-9]+)*$"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Site",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Site"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          }
        }
      },
      "delete": {
        "operationId": "deleteSite",
        "summary": "Delete a site and every deploy (ask the person first)",
        "parameters": [
          {
            "name": "name",
            "in": "path",
            "required": true,
            "description": "Site name: 3-42 lowercase letters, digits and single hyphens.",
            "schema": {
              "type": "string",
              "pattern": "^[a-z0-9]+(-[a-z0-9]+)*$"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Deleted",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "deleted": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/sites/{name}/deploys": {
      "post": {
        "operationId": "deploySite",
        "summary": "Publish a new version of a named site (created the first time if the name is free)",
        "parameters": [
          {
            "name": "name",
            "in": "path",
            "required": true,
            "description": "Site name: 3-42 lowercase letters, digits and single hyphens.",
            "schema": {
              "type": "string",
              "pattern": "^[a-z0-9]+(-[a-z0-9]+)*$"
            }
          },
          {
            "name": "spa",
            "in": "query",
            "required": false,
            "description": "Single-page app: unknown paths serve index.html.",
            "schema": {
              "type": "string",
              "enum": [
                "1"
              ]
            }
          }
        ],
        "requestBody": {
          "required": true,
          "description": "The whole site. Either a .tar.gz (or .tar) of the build folder as the raw body, or JSON with every file, or JSON naming a starter template.",
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/DeployFiles"
              }
            },
            "application/gzip": {
              "schema": {
                "type": "string",
                "format": "binary"
              }
            },
            "application/octet-stream": {
              "schema": {
                "type": "string",
                "format": "binary"
              }
            },
            "multipart/form-data": {
              "schema": {
                "type": "object",
                "properties": {
                  "file": {
                    "type": "string",
                    "format": "binary"
                  }
                },
                "required": [
                  "file"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Deployed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Deploy"
                }
              }
            }
          },
          "201": {
            "description": "Deployed (a new site)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Deploy"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "$ref": "#/components/responses/Error"
          },
          "402": {
            "$ref": "#/components/responses/Error"
          },
          "409": {
            "$ref": "#/components/responses/Error"
          },
          "413": {
            "$ref": "#/components/responses/Error"
          },
          "422": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "$ref": "#/components/responses/Error"
          }
        }
      },
      "get": {
        "operationId": "listDeploys",
        "summary": "The deploys of a site",
        "parameters": [
          {
            "name": "name",
            "in": "path",
            "required": true,
            "description": "Site name: 3-42 lowercase letters, digits and single hyphens.",
            "schema": {
              "type": "string",
              "pattern": "^[a-z0-9]+(-[a-z0-9]+)*$"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Deploys",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "deploys": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "additionalProperties": true
                      }
                    }
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/play/check": {
      "post": {
        "operationId": "checkGame",
        "summary": "Check a press5.game.json before deploying (errors with fixes, warnings, next steps)",
        "security": [
          {}
        ],
        "description": "Send the press5.game.json object itself (or {\"manifest\": <object or text>}). Nothing is saved. Call it until ok is true, then deploy.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "oneOf": [
                  {
                    "$ref": "#/components/schemas/GameManifest"
                  },
                  {
                    "type": "object",
                    "required": [
                      "manifest"
                    ],
                    "properties": {
                      "manifest": {
                        "oneOf": [
                          {
                            "$ref": "#/components/schemas/GameManifest"
                          },
                          {
                            "type": "string"
                          }
                        ]
                      }
                    }
                  }
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The check",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/GameCheck"
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/play/engines": {
      "get": {
        "operationId": "engineReference",
        "summary": "press5 Play server engines (arena, turns, party): what each is for, input, actions, events and settings as JSON Schema",
        "security": [
          {}
        ],
        "responses": {
          "200": {
            "description": "Engines",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "engines": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "additionalProperties": true
                      }
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/play/guard": {
      "get": {
        "operationId": "guardReference",
        "summary": "Anti-cheat (press5 Guard) for relay games: the \"guard\" block format, examples and JSON Schema",
        "security": [
          {}
        ],
        "responses": {
          "200": {
            "description": "Guard reference",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            }
          }
        }
      }
    },
    "/play/errors": {
      "get": {
        "operationId": "playErrors",
        "summary": "Every press5 Play error code with its message and fix",
        "security": [
          {}
        ],
        "responses": {
          "200": {
            "description": "Errors",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "errors": {
                      "type": "object",
                      "additionalProperties": {
                        "type": "object",
                        "properties": {
                          "message": {
                            "type": "string"
                          },
                          "fix": {
                            "type": "string"
                          },
                          "docs": {
                            "type": "string"
                          }
                        }
                      }
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/play/sites/{name}": {
      "get": {
        "operationId": "gameInfo",
        "summary": "A game's multiplayer status: players, rooms, its press5.game.json check and next steps",
        "security": [
          {}
        ],
        "parameters": [
          {
            "name": "name",
            "in": "path",
            "required": true,
            "description": "Site name: 3-42 lowercase letters, digits and single hyphens.",
            "schema": {
              "type": "string",
              "pattern": "^[a-z0-9]+(-[a-z0-9]+)*$"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Game status",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true,
                  "properties": {
                    "next": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    }
                  }
                }
              }
            }
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/play/sites/{name}/leaderboard": {
      "get": {
        "operationId": "gameLeaderboard",
        "summary": "A server-engine game's leaderboard",
        "security": [
          {}
        ],
        "parameters": [
          {
            "name": "name",
            "in": "path",
            "required": true,
            "description": "Site name: 3-42 lowercase letters, digits and single hyphens.",
            "schema": {
              "type": "string",
              "pattern": "^[a-z0-9]+(-[a-z0-9]+)*$"
            }
          },
          {
            "name": "period",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "all",
                "week",
                "day"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Leaderboard",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            }
          },
          "404": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/play/games": {
      "get": {
        "operationId": "listGameKeys",
        "summary": "The account's game keys for native builds (Godot, Unity, Unreal, desktop)",
        "responses": {
          "200": {
            "description": "Game keys",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Error"
          }
        }
      },
      "post": {
        "operationId": "registerGame",
        "summary": "Make a game key (p5g_...) for a native build; shown once",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "name"
                ],
                "properties": {
                  "name": {
                    "type": "string"
                  },
                  "title": {
                    "type": "string"
                  },
                  "site": {
                    "type": "string",
                    "description": "A launch pad site of the same game, so web and native players share rooms"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "The key",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/play/games/{name}": {
      "delete": {
        "operationId": "revokeGameKey",
        "summary": "Stop a game key working (ask the person first)",
        "parameters": [
          {
            "name": "name",
            "in": "path",
            "required": true,
            "description": "Site name: 3-42 lowercase letters, digits and single hyphens.",
            "schema": {
              "type": "string",
              "pattern": "^[a-z0-9]+(-[a-z0-9]+)*$"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Revoked",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/sites/{name}/rollback": {
      "post": {
        "operationId": "rollbackSite",
        "summary": "Put an earlier deploy back live",
        "parameters": [
          {
            "name": "name",
            "in": "path",
            "required": true,
            "description": "Site name: 3-42 lowercase letters, digits and single hyphens.",
            "schema": {
              "type": "string",
              "pattern": "^[a-z0-9]+(-[a-z0-9]+)*$"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "deploy"
                ],
                "properties": {
                  "deploy": {
                    "type": "string"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Rolled back",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Deploy"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    }
  },
  "components": {
    "securitySchemes": {
      "bearer": {
        "type": "http",
        "scheme": "bearer",
        "description": "A p5_ account token, or for one unclaimed site its p5k_ site key."
      }
    },
    "responses": {
      "Error": {
        "description": "Error",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        }
      }
    },
    "schemas": {
      "Error": {
        "type": "object",
        "properties": {
          "error": {
            "type": "object",
            "properties": {
              "code": {
                "type": "string"
              },
              "message": {
                "type": "string"
              },
              "hint": {
                "type": "string"
              }
            }
          }
        }
      },
      "DeployFiles": {
        "type": "object",
        "properties": {
          "files": {
            "type": "array",
            "items": {
              "type": "object",
              "required": [
                "path",
                "content"
              ],
              "properties": {
                "path": {
                  "type": "string",
                  "example": "index.html"
                },
                "content": {
                  "type": "string"
                },
                "encoding": {
                  "type": "string",
                  "enum": [
                    "utf8",
                    "base64"
                  ],
                  "default": "utf8"
                }
              }
            }
          },
          "template": {
            "type": "string",
            "description": "Instead of files: a starter template id from /templates."
          },
          "fields": {
            "type": "object",
            "additionalProperties": {
              "type": "string"
            },
            "description": "With template: text to fill in, by field key."
          },
          "spa": {
            "type": "boolean"
          }
        }
      },
      "Deploy": {
        "type": "object",
        "additionalProperties": true,
        "properties": {
          "url": {
            "type": "string",
            "description": "The live site. Give it to the person."
          },
          "claim_url": {
            "type": "string",
            "description": "Only without an account: the link the person opens to keep the site."
          },
          "site_key": {
            "type": "string",
            "description": "Only without an account: send as Bearer to update the same site. Never show it."
          },
          "site": {
            "type": "string"
          },
          "deploy": {
            "type": "string"
          },
          "https": {
            "type": "string"
          },
          "http_url": {
            "type": "string"
          },
          "expires_at": {
            "type": "string"
          },
          "next": {
            "type": "string",
            "description": "What to tell the person."
          },
          "warnings": {
            "type": "array",
            "items": {
              "type": "string"
            }
          }
        }
      },
      "GameManifest": {
        "type": "object",
        "additionalProperties": true,
        "description": "press5.game.json. Full JSON Schema: https://my.press5.xyz/schemas/press5.game.json"
      },
      "GameCheck": {
        "type": "object",
        "properties": {
          "ok": {
            "type": "boolean"
          },
          "room_type": {
            "type": "string",
            "enum": [
              "relay",
              "server"
            ]
          },
          "engine": {
            "type": [
              "object",
              "null"
            ],
            "properties": {
              "name": {
                "type": "string"
              },
              "version": {
                "type": "integer"
              }
            }
          },
          "errors": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "path": {
                  "type": "string"
                },
                "message": {
                  "type": "string"
                },
                "fix": {
                  "type": "string"
                }
              }
            }
          },
          "warnings": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "path": {
                  "type": "string"
                },
                "message": {
                  "type": "string"
                },
                "fix": {
                  "type": "string"
                }
              }
            }
          },
          "settings": {
            "type": [
              "object",
              "null"
            ],
            "additionalProperties": true,
            "description": "The engine settings with defaults filled in"
          },
          "guard": {
            "type": [
              "object",
              "null"
            ],
            "additionalProperties": true
          },
          "next": {
            "type": "array",
            "items": {
              "type": "string"
            }
          }
        }
      },
      "Site": {
        "type": "object",
        "additionalProperties": true,
        "properties": {
          "name": {
            "type": "string"
          },
          "url": {
            "type": "string"
          },
          "status": {
            "type": "string"
          }
        }
      },
      "Template": {
        "type": "object",
        "additionalProperties": true,
        "properties": {
          "id": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "description": {
            "type": "string"
          },
          "preview_url": {
            "type": "string"
          },
          "fields": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "key": {
                  "type": "string"
                },
                "label": {
                  "type": "string"
                },
                "example": {
                  "type": "string"
                }
              }
            }
          }
        }
      }
    }
  }
}