{"openapi":"3.1.0","info":{"title":"Screenshot API","version":"1.0.0","description":"Capture screenshots of any public web page and return them as a PNG, JPEG, or WebP image — or as a base64-encoded JSON object for use by AI agents."},"servers":[{"url":"https://mohammedsayed.com"}],"security":[{"ApiKeyAuth":[]}],"components":{"securitySchemes":{"ApiKeyAuth":{"type":"apiKey","in":"header","name":"x-api-key","description":"Your personal API key."}},"schemas":{"ScreenshotRequest":{"type":"object","required":["url"],"properties":{"url":{"type":"string","format":"uri","description":"Fully-qualified URL of the page to screenshot.","example":"https://en.wikipedia.org/wiki/Main_Page"},"width":{"type":"integer","default":1280,"minimum":320,"maximum":2560,"description":"Viewport width in pixels."},"height":{"type":"integer","default":720,"minimum":240,"maximum":2160,"description":"Viewport height in pixels."},"fullPage":{"type":"boolean","default":false,"description":"Capture the full scrollable page."},"format":{"type":"string","enum":["png","jpeg","webp"],"default":"png","description":"Output image format."},"delay":{"type":"integer","default":0,"minimum":0,"maximum":10000,"description":"Milliseconds to wait after page load before capturing."},"responseFormat":{"type":"string","enum":["binary","json"],"default":"binary","description":"Use 'json' to receive a base64-encoded image in a JSON envelope. Recommended for AI agents."}}},"ScreenshotJsonResponse":{"type":"object","properties":{"url":{"type":"string","description":"The URL that was screenshotted."},"mimeType":{"type":"string","example":"image/png"},"format":{"type":"string","example":"png"},"width":{"type":"integer"},"height":{"type":"integer"},"fullPage":{"type":"boolean"},"image":{"type":"string","description":"Base64-encoded image data."}}},"ErrorResponse":{"type":"object","properties":{"error":{"type":"string"}}}}},"paths":{"/api/v1/screenshot":{"post":{"operationId":"takeScreenshot","summary":"Capture a screenshot of a web page","description":"Renders a web page using a headless browser and returns the screenshot. Pass `responseFormat: 'json'` to receive a base64-encoded image suitable for AI agents.","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ScreenshotRequest"}}}},"responses":{"200":{"description":"Screenshot captured. Returns raw image binary (binary mode) or JSON with base64 image (json mode).","content":{"image/png":{"schema":{"type":"string","format":"binary"}},"image/jpeg":{"schema":{"type":"string","format":"binary"}},"image/webp":{"schema":{"type":"string","format":"binary"}},"application/json":{"schema":{"$ref":"#/components/schemas/ScreenshotJsonResponse"}}}},"400":{"description":"Missing or invalid parameters.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"401":{"description":"Missing x-api-key header.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"403":{"description":"Invalid API key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"429":{"description":"Request limit reached.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Failed to render the page.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}},"get":{"operationId":"takeScreenshotGet","summary":"Capture a screenshot via query parameters","description":"Same as POST but accepts options as query string parameters. Convenient for simple integrations.","parameters":[{"name":"url","in":"query","required":true,"schema":{"type":"string","format":"uri"}},{"name":"width","in":"query","schema":{"type":"integer","default":1280}},{"name":"height","in":"query","schema":{"type":"integer","default":720}},{"name":"fullPage","in":"query","schema":{"type":"boolean","default":false}},{"name":"format","in":"query","schema":{"type":"string","enum":["png","jpeg","webp"],"default":"png"}},{"name":"delay","in":"query","schema":{"type":"integer","default":0}},{"name":"responseFormat","in":"query","schema":{"type":"string","enum":["binary","json"],"default":"binary"}}],"responses":{"200":{"description":"Screenshot captured."},"400":{"description":"Invalid parameters."},"401":{"description":"Missing API key."},"403":{"description":"Invalid API key."},"429":{"description":"Rate limit exceeded."},"500":{"description":"Render failed."}}}}}}