{
  "openapi": "3.1.0",
  "info": {
    "title": "Paneglass agent API",
    "version": "0.1.0"
  },
  "servers": [
    {
      "url": "https://agents.brightpewter.store"
    }
  ],
  "paths": {
    "/signup": {
      "post": {
        "operationId": "createSignup",
        "summary": "Get an API key",
        "description": "Issues a test API key. Nothing is charged.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "email": {
                    "type": "string",
                    "format": "email"
                  },
                  "company": {
                    "type": "string"
                  },
                  "use_case": {
                    "type": "string",
                    "maxLength": 1000
                  }
                },
                "required": [
                  "email",
                  "company",
                  "use_case"
                ]
              }
            },
            "application/x-www-form-urlencoded": {
              "schema": {
                "type": "object",
                "properties": {
                  "email": {
                    "type": "string",
                    "format": "email"
                  },
                  "company": {
                    "type": "string"
                  },
                  "use_case": {
                    "type": "string",
                    "maxLength": 1000
                  }
                },
                "required": [
                  "email",
                  "company",
                  "use_case"
                ]
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Test key issued",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "status": {
                      "const": "received"
                    },
                    "api_key": {
                      "type": "string",
                      "pattern": "^pgl_test_[a-z0-9]+$"
                    }
                  }
                }
              }
            }
          },
          "422": {
            "description": "Fields missing or invalid; send the request again with them",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "missing": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    },
                    "invalid": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    },
                    "message": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/v1/regions": {
      "get": {
        "operationId": "list-regions",
        "summary": "List regions",
        "description": "Region codes, locations and capacity. No key needed.",
        "responses": {
          "200": {
            "description": "Dummy answer: plausible test data, nothing is fulfilled",
            "content": {
              "application/json": {
                "example": {
                  "regions": [
                    {
                      "code": "eu-west",
                      "location": "Dublin",
                      "available": true
                    },
                    {
                      "code": "eu-central",
                      "location": "Frankfurt",
                      "available": true
                    },
                    {
                      "code": "us-east",
                      "location": "Virginia",
                      "available": true
                    }
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Body or required fields missing",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "missing": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    },
                    "invalid": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    },
                    "message": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/v1/sessions": {
      "post": {
        "operationId": "create-session",
        "summary": "Open a session",
        "description": "region is required: eu-west (Dublin), eu-central (Frankfurt) or us-east (Virginia). Optional: record, viewport, timeout_minutes.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "region": {
                    "type": "string"
                  }
                },
                "required": [
                  "region"
                ]
              }
            }
          }
        },
        "security": [
          {
            "apiKey": []
          }
        ],
        "responses": {
          "201": {
            "description": "Dummy answer: plausible test data, nothing is fulfilled",
            "content": {
              "application/json": {
                "example": {
                  "id": "ses_0123456789abcdef",
                  "status": "ready",
                  "region": "region",
                  "created_at": "2026-01-01T00:00:00.000Z",
                  "connect": {
                    "protocol": "cdp",
                    "path": "/v1/sessions/ses_0123456789abcdef/cdp"
                  }
                }
              }
            }
          },
          "400": {
            "description": "Body or required fields missing",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "missing": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    },
                    "invalid": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    },
                    "message": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid API key",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "missing": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    },
                    "invalid": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    },
                    "message": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/v1/sessions/{session_id}": {
      "get": {
        "operationId": "get-session",
        "summary": "Get a session",
        "description": "Status, region and minutes used so far.",
        "parameters": [
          {
            "name": "session_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "security": [
          {
            "apiKey": []
          }
        ],
        "responses": {
          "200": {
            "description": "Dummy answer: plausible test data, nothing is fulfilled",
            "content": {
              "application/json": {
                "example": {
                  "id": "session_id",
                  "status": "ready",
                  "region": "eu-west",
                  "minutes_used": 1,
                  "checked_at": "2026-01-01T00:00:00.000Z"
                }
              }
            }
          },
          "400": {
            "description": "Body or required fields missing",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "missing": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    },
                    "invalid": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    },
                    "message": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid API key",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "missing": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    },
                    "invalid": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    },
                    "message": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/v1/sessions/{session_id}/navigate": {
      "post": {
        "operationId": "navigate",
        "summary": "Load a page",
        "description": "url is required. Returns the final URL after redirects and the status of the main document.",
        "parameters": [
          {
            "name": "session_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "url": {
                    "type": "string"
                  }
                },
                "required": [
                  "url"
                ]
              }
            }
          }
        },
        "security": [
          {
            "apiKey": []
          }
        ],
        "responses": {
          "200": {
            "description": "Dummy answer: plausible test data, nothing is fulfilled",
            "content": {
              "application/json": {
                "example": {
                  "session_id": "session_id",
                  "requested_url": "url",
                  "final_url": "url",
                  "status": 200
                }
              }
            }
          },
          "400": {
            "description": "Body or required fields missing",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "missing": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    },
                    "invalid": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    },
                    "message": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid API key",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "missing": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    },
                    "invalid": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    },
                    "message": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/v1/sessions/{session_id}/release": {
      "post": {
        "operationId": "release-session",
        "summary": "Release a session",
        "description": "Ends the session and stops the minute count. Releasing twice is not an error.",
        "parameters": [
          {
            "name": "session_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {},
                "required": []
              }
            }
          }
        },
        "security": [
          {
            "apiKey": []
          }
        ],
        "responses": {
          "200": {
            "description": "Dummy answer: plausible test data, nothing is fulfilled",
            "content": {
              "application/json": {
                "example": {
                  "id": "session_id",
                  "status": "released",
                  "released_at": "2026-01-01T00:00:00.000Z"
                }
              }
            }
          },
          "400": {
            "description": "Body or required fields missing",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "missing": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    },
                    "invalid": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    },
                    "message": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid API key",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "missing": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    },
                    "invalid": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    },
                    "message": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "securitySchemes": {
      "apiKey": {
        "type": "http",
        "scheme": "bearer",
        "description": "Test key from POST /signup (pgl_test_...)"
      }
    }
  }
}
