{
  "openapi": "3.1.0",
  "info": {
    "title": "Quarterslot",
    "version": "1.0.0",
    "description": "Pay-per-call tools for AI agents over x402. Paid operations answer 402 with a PAYMENT-REQUIRED header until a valid payment is attached.",
    "contact": {
      "name": "Quarterslot",
      "email": "hello@quarterslot.dev",
      "url": "https://quarterslot.dev"
    }
  },
  "servers": [
    {
      "url": "https://quarterslot.dev"
    }
  ],
  "paths": {
    "/v1/inboxes": {
      "post": {
        "operationId": "createInbox",
        "summary": "Create a webhook inbox (paid, x402)",
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "ttl_hours": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 168,
                    "default": 168
                  }
                },
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Inbox created",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Inbox"
                }
              }
            }
          },
          "402": {
            "description": "Payment required; see the PAYMENT-REQUIRED header (base64 JSON)"
          },
          "400": {
            "description": "Invalid ttl_hours"
          }
        },
        "x-payment-info": {
          "protocols": [
            "x402"
          ],
          "price": {
            "mode": "fixed",
            "currency": "USD",
            "amount": "0.002"
          }
        }
      }
    },
    "/h/{inbox_id}": {
      "post": {
        "operationId": "deliver",
        "summary": "Deliver a callback (free, unauthenticated; also PUT and PATCH)",
        "parameters": [
          {
            "name": "inbox_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "*/*": {
              "schema": {
                "type": "string",
                "format": "binary",
                "maxLength": 262144
              }
            }
          }
        },
        "responses": {
          "202": {
            "description": "Stored"
          },
          "404": {
            "description": "No such inbox or expired"
          },
          "413": {
            "description": "Over 256 KB"
          },
          "429": {
            "description": "Inbox full (100 messages)"
          }
        }
      }
    },
    "/v1/inboxes/{inbox_id}/messages": {
      "get": {
        "operationId": "listMessages",
        "summary": "Read deliveries, optionally long-polling",
        "security": [
          {
            "inboxToken": []
          }
        ],
        "parameters": [
          {
            "name": "inbox_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "after",
            "in": "query",
            "schema": {
              "type": "integer",
              "default": 0
            },
            "description": "Return messages with seq greater than this"
          },
          {
            "name": "wait",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 0,
              "maximum": 20,
              "default": 0
            },
            "description": "Seconds to wait for a new message if none are pending"
          }
        ],
        "responses": {
          "200": {
            "description": "Messages",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MessageList"
                }
              }
            }
          },
          "404": {
            "description": "Not found, expired, or wrong token"
          }
        }
      }
    },
    "/v1/inboxes/{inbox_id}": {
      "delete": {
        "operationId": "deleteInbox",
        "security": [
          {
            "inboxToken": []
          }
        ],
        "parameters": [
          {
            "name": "inbox_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "204": {
            "description": "Deleted"
          },
          "404": {
            "description": "Not found or wrong token"
          }
        }
      }
    },
    "/v1/convert/docx": {
      "post": {
        "operationId": "convertToDocx",
        "summary": "Convert Markdown or HTML to a Word document",
        "x-payment-info": {
          "protocols": [
            "x402"
          ],
          "price": {
            "mode": "fixed",
            "currency": "USD",
            "amount": "0.002"
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ConvertRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The file (default), or JSON when response=base64",
            "content": {
              "application/vnd.openxmlformats-officedocument.wordprocessingml.document": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ConvertBase64"
                }
              }
            }
          },
          "402": {
            "description": "Payment required; see the PAYMENT-REQUIRED header (base64 JSON)"
          },
          "400": {
            "description": "Invalid input (not charged)"
          },
          "413": {
            "description": "Input over 1 MB"
          }
        }
      }
    },
    "/v1/convert/pptx": {
      "post": {
        "operationId": "convertToPptx",
        "summary": "Convert Markdown or HTML to a PowerPoint deck",
        "x-payment-info": {
          "protocols": [
            "x402"
          ],
          "price": {
            "mode": "fixed",
            "currency": "USD",
            "amount": "0.002"
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ConvertRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The file (default), or JSON when response=base64",
            "content": {
              "application/vnd.openxmlformats-officedocument.presentationml.presentation": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ConvertBase64"
                }
              }
            }
          },
          "402": {
            "description": "Payment required; see the PAYMENT-REQUIRED header (base64 JSON)"
          },
          "400": {
            "description": "Invalid input (not charged)"
          },
          "413": {
            "description": "Input over 1 MB"
          }
        }
      }
    },
    "/v1/convert/pdf": {
      "post": {
        "operationId": "convertToPdf",
        "summary": "Render Markdown or HTML to PDF",
        "x-payment-info": {
          "protocols": [
            "x402"
          ],
          "price": {
            "mode": "fixed",
            "currency": "USD",
            "amount": "0.004"
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ConvertRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The file (default), or JSON when response=base64",
            "content": {
              "application/pdf": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ConvertBase64"
                }
              }
            }
          },
          "402": {
            "description": "Payment required; see the PAYMENT-REQUIRED header (base64 JSON)"
          },
          "400": {
            "description": "Invalid input (not charged)"
          },
          "413": {
            "description": "Input over 1 MB"
          }
        }
      }
    },
    "/v1/visibility/check": {
      "post": {
        "operationId": "checkAiVisibility",
        "summary": "AI visibility (GEO) check across ChatGPT, Gemini and Claude",
        "x-payment-info": {
          "protocols": [
            "x402"
          ],
          "price": {
            "mode": "fixed",
            "currency": "USD",
            "amount": "0.20"
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "brand",
                  "prompt"
                ],
                "additionalProperties": false,
                "properties": {
                  "brand": {
                    "type": "string",
                    "maxLength": 100
                  },
                  "domain": {
                    "type": "string"
                  },
                  "aliases": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    },
                    "maxItems": 5
                  },
                  "competitors": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    },
                    "maxItems": 10
                  },
                  "prompt": {
                    "type": "string",
                    "maxLength": 500
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Per-engine results and summary",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          },
          "402": {
            "description": "Payment required; see the PAYMENT-REQUIRED header (base64 JSON)"
          },
          "400": {
            "description": "Invalid input (not charged)"
          },
          "503": {
            "description": "Engines unavailable or daily capacity reached (not charged)"
          }
        }
      }
    }
  },
  "components": {
    "securitySchemes": {
      "inboxToken": {
        "type": "http",
        "scheme": "bearer"
      }
    },
    "schemas": {
      "Inbox": {
        "type": "object",
        "required": [
          "inbox_id",
          "callback_url",
          "token",
          "messages_url",
          "expires_at"
        ],
        "properties": {
          "inbox_id": {
            "type": "string"
          },
          "callback_url": {
            "type": "string",
            "format": "uri"
          },
          "token": {
            "type": "string"
          },
          "messages_url": {
            "type": "string",
            "format": "uri"
          },
          "expires_at": {
            "type": "string",
            "format": "date-time"
          },
          "limits": {
            "type": "object",
            "properties": {
              "max_messages": {
                "type": "integer"
              },
              "max_body_bytes": {
                "type": "integer"
              }
            }
          }
        }
      },
      "MessageList": {
        "type": "object",
        "properties": {
          "expires_at": {
            "type": "string",
            "format": "date-time"
          },
          "next_after": {
            "type": "integer"
          },
          "messages": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "seq": {
                  "type": "integer"
                },
                "received_at": {
                  "type": "string",
                  "format": "date-time"
                },
                "method": {
                  "type": "string"
                },
                "content_type": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "headers": {
                  "type": "object"
                },
                "size": {
                  "type": "integer"
                },
                "body": {
                  "type": "string"
                },
                "body_base64": {
                  "type": "string"
                }
              }
            }
          }
        }
      },
      "ConvertRequest": {
        "type": "object",
        "properties": {
          "markdown": {
            "type": "string",
            "description": "GitHub-flavored Markdown (send this or html)"
          },
          "html": {
            "type": "string",
            "description": "HTML fragment or full document (send this or markdown)"
          },
          "title": {
            "type": "string",
            "maxLength": 200
          },
          "response": {
            "type": "string",
            "enum": [
              "file",
              "base64"
            ],
            "default": "file"
          },
          "page_size": {
            "type": "string",
            "enum": [
              "letter",
              "a4"
            ],
            "description": "pdf only"
          }
        },
        "additionalProperties": false
      },
      "ConvertBase64": {
        "type": "object",
        "properties": {
          "filename": {
            "type": "string"
          },
          "mime_type": {
            "type": "string"
          },
          "size_bytes": {
            "type": "integer"
          },
          "file_base64": {
            "type": "string"
          }
        }
      }
    }
  }
}
