{
  "openapi": "3.1.0",
  "info": {
    "title": "Auto Schedule API",
    "version": "1.1.0",
    "description": "Start a scheduled web page's capture now. Results arrive by webhook (capture.succeeded, capture.failed, delivery.completed, capture.changed, sitemap_run.completed).",
    "contact": {
      "email": "support@websitescreenshotworld.com"
    }
  },
  "servers": [
    {
      "url": "https://autoapi.websitescreenshotworld.com"
    }
  ],
  "security": [
    {
      "apiKey": []
    }
  ],
  "paths": {
    "/auto-schedule/v1/web-pages/{web_page_id}/trigger-now": {
      "post": {
        "operationId": "triggerNow",
        "summary": "Capture a web page now",
        "description": "The web page is created in the dashboard; its id is the `schedule_id` in webhooks. Idempotent: a second call while the first capture is pending answers `already_pending`.",
        "parameters": [
          {
            "name": "web_page_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Queued, or already pending.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TriggerResult"
                }
              }
            }
          },
          "400": {
            "description": "The id is not a web page id. Codes: `web_page_id_invalid`, `validation_failed`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Bad key. Codes: `api_key_invalid`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "The plan does not allow it. Codes: `feature_not_available`, `no_trigger_allowance`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "No such web page for this account. Codes: `web_page_not_found`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "The web page is a sitemap schedule, which runs only on its schedule. Codes: `sitemap_schedule_not_triggerable`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Too many requests. Codes: `rate_limited`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "headers": {
              "Retry-After": {
                "description": "Seconds to wait.",
                "schema": {
                  "type": "integer"
                }
              }
            }
          },
          "503": {
            "description": "A service is down; retry after the hint. Codes: `service_unavailable`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "headers": {
              "Retry-After": {
                "description": "Seconds to wait.",
                "schema": {
                  "type": "integer"
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "securitySchemes": {
      "apiKey": {
        "type": "apiKey",
        "in": "header",
        "name": "X-Api-Key"
      }
    },
    "schemas": {
      "TriggerResult": {
        "type": "object",
        "required": [
          "success",
          "status",
          "web_page_id",
          "triggered_by",
          "triggered_at",
          "message"
        ],
        "properties": {
          "success": {
            "type": "boolean",
            "const": true
          },
          "status": {
            "type": "string",
            "enum": [
              "triggered",
              "already_pending"
            ],
            "description": "`already_pending`: a capture for this web page is already queued or running; nothing new was started and nothing was charged."
          },
          "web_page_id": {
            "type": "string",
            "format": "uuid"
          },
          "triggered_by": {
            "type": "string",
            "enum": [
              "api",
              "ui"
            ]
          },
          "triggered_at": {
            "type": "string",
            "format": "date-time",
            "description": "When the capture was queued (for `already_pending`, the original trigger). UTC, ISO 8601 with milliseconds."
          },
          "message": {
            "type": "string",
            "description": "One sentence for a person."
          }
        }
      },
      "Error": {
        "type": "object",
        "required": [
          "success",
          "error_code",
          "error_message",
          "retry_after_seconds"
        ],
        "properties": {
          "success": {
            "type": "boolean",
            "const": false
          },
          "error_code": {
            "type": "string",
            "examples": [
              "rate_limited"
            ],
            "description": "A stable, lowercase token. Switch on this, never on the HTTP status or the message."
          },
          "error_message": {
            "type": "string",
            "description": "One sentence for a person. The wording can change between releases."
          },
          "retry_after_seconds": {
            "description": "Seconds to wait before retrying. Set on rate_limited, capture_busy, service_unavailable and idempotency_key_in_use; mirrors the Retry-After header.",
            "type": [
              "integer",
              "null"
            ]
          }
        }
      }
    }
  }
}
