{
  "openapi": "3.1.0",
  "info": {
    "title": "Index Pages API",
    "version": "1.0.0",
    "summary": "Submit URLs for indexing and follow their progress.",
    "description": "Programmatic access to Index Pages: create a draft order from a list of URLs, run it, and follow its progress. The API does exactly what the dashboard does – same orders, same price, same balance.\n\n## Authentication\n\nSend an API key in every request: `Authorization: Bearer ipk_live_…`. Keys are created and revoked in the dashboard under Settings → API keys and are shown once. Each key carries scopes: `orders:read`, `orders:write`, `orders:run`, `balance:read`. A key without `orders:run` cannot spend money. A missing, unknown, revoked or expired key gets `401 unauthorized`; a key without the scope an operation needs gets `403 forbidden_scope`. The scope each operation needs is listed in its description and in the `x-required-scope` extension.\n\n## General rules\n\n- **JSON only.** Responses are `application/json`; errors are `application/problem+json` (RFC 9457). A request body must be sent as `Content-Type: application/json` (otherwise `415 unsupported_media_type`); a body that does not parse gets `400 invalid_json`. A body larger than one order can hold gets `413` (`type: about:blank`), one with an unexpected structure `400 invalid_json`; a POST with a query string gets `422 validation_failed`.\n- **Versioning.** The version is in the path (`/v1`). There are no breaking changes within v1; new fields may appear in responses at any time, and clients must ignore fields they do not know.\n- **Ids.** An order id is a 16-character opaque string, the same one shown in the dashboard URL.\n- **Time.** RFC 3339 in UTC with a `Z` suffix: `2026-10-10T12:00:00Z`.\n- **Money.** A decimal string with two digits after the point plus a `currency` field: `\"12.50\"`, `\"USD\"`. Never a float.\n- **Pagination.** Cursor-based. Query parameters `limit` (default 20, maximum 100) and `cursor`. A page is `{\"data\": [...], \"next_cursor\": \"...\" | null, \"has_more\": true | false}`. Orders come newest first; the URLs of an order come in submission order. Pass `next_cursor` back as `cursor` to get the next page; the cursor is opaque and belongs to the list it came from – a malformed or foreign cursor gets `422 validation_failed` with `invalid_cursor` on field `cursor`.\n- **Idempotency.** `POST /orders` and `POST /orders/{orderId}/run` accept an optional `Idempotency-Key` header (up to 255 characters). The key is scoped to your API key and kept for 24 hours. Repeating a request with the same key, method, path and body returns the stored status and body with `Idempotent-Replayed: true` (error responses are stored too). A response larger than 8 KB is not stored, and one account keeps at most 2000 live entries across all its API keys: past either limit the request is still processed, only the replay is missing and a retry is validated afresh. The same key with a different request gets `422 idempotency_key_reused`; the same key while the first request is still running gets `409 idempotency_key_in_flight`.\n- **Rate limits.** Per key: 120 requests per minute across the API, 30 per minute for `POST /orders`, 10 per minute for `POST /orders/{orderId}/run`. Requests without a valid key share a limit of 20 per minute per IP address. Every response carries `X-RateLimit-Limit` and `X-RateLimit-Remaining`; when the limit is hit the API answers `429 rate_limited` with `Retry-After` in seconds and `X-RateLimit-Reset` as the Unix time the limit resets.\n- **Other accounts' orders** answer `404 not_found`, never `403`: a response does not reveal whether an id exists.\n- **No CORS.** The API is meant for servers, scripts and tools; never put a key in a browser.\n\n## Errors\n\nEvery error is a problem document with the standard RFC 9457 fields plus a stable, machine-readable `code`. Validation errors add `errors[]` with one entry per rejected field. The full list of codes is in `components.x-error-codes`; `type` links to its explanation on the documentation page. An unknown path gets `404 not_found`; a known path with another method gets `405 method_not_allowed` with an `Allow` header. An error outside this contract (for example `413` from the edge for an oversized body) has `type: about:blank` and no `code`.\n\n## Per-URL detail retention\n\nPer-URL statuses (`GET /orders/{orderId}/urls`) are kept until three days after the order's `campaign_ends_at`. After that the endpoint returns an empty list, while the order itself and its `urls_total` / `urls_done` counters stay available.\n",
    "contact": {
      "name": "Index Pages support",
      "url": "https://index-pages.com/contact/"
    },
    "termsOfService": "https://index-pages.com/terms/"
  },
  "externalDocs": {
    "description": "API guide",
    "url": "https://index-pages.com/api/"
  },
  "servers": [
    {
      "url": "https://api.index-pages.com/v1"
    }
  ],
  "security": [
    {
      "bearer": []
    }
  ],
  "tags": [
    {
      "name": "Account",
      "description": "Balance, pricing and limits."
    },
    {
      "name": "Orders",
      "description": "Create, run, follow and delete orders."
    },
    {
      "name": "Meta",
      "description": "This specification."
    }
  ],
  "paths": {
    "/account": {
      "get": {
        "operationId": "getAccount",
        "tags": [
          "Account"
        ],
        "summary": "Get the account",
        "description": "Balance, current price per URL, order limits and the key making the request.\n\nRequires scope `balance:read`.",
        "x-required-scope": "balance:read",
        "responses": {
          "200": {
            "description": "The account.",
            "headers": {
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Account"
                },
                "examples": {
                  "account": {
                    "summary": "Account",
                    "value": {
                      "balance": "12.50",
                      "currency": "USD",
                      "price_per_url": "1.00",
                      "limits": {
                        "min_urls_per_order": 1,
                        "max_urls_per_order": 1000,
                        "max_draft_orders": 100
                      },
                      "key": {
                        "name": "ci",
                        "prefix": "ipk_live_ab12",
                        "scopes": [
                          "orders:read",
                          "orders:write",
                          "orders:run",
                          "balance:read"
                        ]
                      }
                    }
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    },
    "/orders": {
      "get": {
        "operationId": "listOrders",
        "tags": [
          "Orders"
        ],
        "summary": "List orders",
        "description": "Orders of the account, newest first, one page at a time. Deleted drafts are not listed.\n\nRequires scope `orders:read`.",
        "x-required-scope": "orders:read",
        "parameters": [
          {
            "$ref": "#/components/parameters/limit"
          },
          {
            "$ref": "#/components/parameters/cursor"
          },
          {
            "$ref": "#/components/parameters/status"
          }
        ],
        "responses": {
          "200": {
            "description": "A page of orders.",
            "headers": {
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OrderPage"
                },
                "examples": {
                  "first_page": {
                    "summary": "First page with more to follow",
                    "value": {
                      "data": [
                        {
                          "id": "k3j4h5g6f7d8s9a0",
                          "title": "October sitemap",
                          "comment": null,
                          "status": "in_progress",
                          "urls_total": 120,
                          "urls_done": 37,
                          "price_per_url": "1.00",
                          "cost": "120.00",
                          "currency": "USD",
                          "created_at": "2026-10-10T12:00:00Z",
                          "started_at": "2026-10-10T12:05:00Z",
                          "campaign_ends_at": "2026-10-24T12:05:00Z"
                        },
                        {
                          "id": "m1n2b3v4c5x6z7l8",
                          "title": "Untitled Order 3",
                          "comment": null,
                          "status": "done",
                          "urls_total": 40,
                          "urls_done": 40,
                          "price_per_url": "1.00",
                          "cost": "40.00",
                          "currency": "USD",
                          "created_at": "2026-09-20T08:30:00Z",
                          "started_at": "2026-09-20T08:31:12Z",
                          "campaign_ends_at": "2026-10-04T08:31:12Z"
                        }
                      ],
                      "next_cursor": "eyJpZCI6NDIsIl9wb2ludHNUb05leHRJdGVtcyI6dHJ1ZX0",
                      "has_more": true
                    }
                  },
                  "last_page": {
                    "summary": "Last page",
                    "value": {
                      "data": [
                        {
                          "id": "m1n2b3v4c5x6z7l8",
                          "title": "Untitled Order 3",
                          "comment": null,
                          "status": "done",
                          "urls_total": 40,
                          "urls_done": 40,
                          "price_per_url": "1.00",
                          "cost": "40.00",
                          "currency": "USD",
                          "created_at": "2026-09-20T08:30:00Z",
                          "started_at": "2026-09-20T08:31:12Z",
                          "campaign_ends_at": "2026-10-04T08:31:12Z"
                        }
                      ],
                      "next_cursor": null,
                      "has_more": false
                    }
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "422": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      },
      "post": {
        "operationId": "createOrder",
        "tags": [
          "Orders"
        ],
        "summary": "Create a draft order",
        "description": "Creates a draft from a list of URLs. A draft is free; nothing is charged until the order is run. Every URL is checked and every rejection is listed in `errors[]` under its index, so one request reports all problems at once. Rate limit: 30 requests per minute per key on top of the general limit.\n\nRequires scope `orders:write`.",
        "x-required-scope": "orders:write",
        "parameters": [
          {
            "$ref": "#/components/parameters/Idempotency-Key"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateOrderRequest"
              },
              "examples": {
                "full": {
                  "summary": "URLs with a title and a comment",
                  "value": {
                    "urls": [
                      "https://example.com/a",
                      "https://example.com/b"
                    ],
                    "title": "October sitemap",
                    "comment": "Blog posts from the October batch"
                  }
                },
                "minimal": {
                  "summary": "URLs only, title generated",
                  "value": {
                    "urls": [
                      "https://example.com/a"
                    ]
                  }
                }
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "The draft was created.",
            "headers": {
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "Location": {
                "$ref": "#/components/headers/Location"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/Idempotent-Replayed"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Order"
                },
                "examples": {
                  "draft": {
                    "summary": "New draft",
                    "value": {
                      "id": "q7w8e9r0t1y2u3i4",
                      "title": "October sitemap",
                      "comment": "Blog posts from the October batch",
                      "status": "draft",
                      "urls_total": 2,
                      "urls_done": 0,
                      "price_per_url": "1.00",
                      "cost": "2.00",
                      "currency": "USD",
                      "created_at": "2026-10-10T12:00:00Z",
                      "started_at": null,
                      "campaign_ends_at": null
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "The request body is not valid JSON.",
            "headers": {
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/Idempotent-Replayed"
              }
            },
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                },
                "examples": {
                  "invalid_json": {
                    "summary": "Body does not parse",
                    "value": {
                      "type": "https://index-pages.com/api/#err-invalid_json",
                      "title": "Invalid JSON",
                      "status": 400,
                      "detail": "The request body is not valid JSON.",
                      "code": "invalid_json"
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "The API key is missing, malformed, unknown, revoked or expired.",
            "headers": {
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "WWW-Authenticate": {
                "$ref": "#/components/headers/WWW-Authenticate"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/Idempotent-Replayed"
              }
            },
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                },
                "examples": {
                  "unauthorized": {
                    "summary": "No valid key",
                    "value": {
                      "type": "https://index-pages.com/api/#err-unauthorized",
                      "title": "Unauthorized",
                      "status": 401,
                      "detail": "A valid API key is required: send it as `Authorization: Bearer <key>`.",
                      "code": "unauthorized"
                    }
                  }
                }
              }
            }
          },
          "403": {
            "description": "The key lacks the required scope, or the account is frozen.",
            "headers": {
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/Idempotent-Replayed"
              }
            },
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ForbiddenScopeProblem"
                },
                "examples": {
                  "forbidden_scope": {
                    "summary": "Key lacks the scope",
                    "value": {
                      "type": "https://index-pages.com/api/#err-forbidden_scope",
                      "title": "Missing scope",
                      "status": 403,
                      "detail": "This key does not have the orders:run scope.",
                      "code": "forbidden_scope",
                      "required_scope": "orders:run"
                    }
                  },
                  "account_frozen": {
                    "summary": "Account is frozen",
                    "value": {
                      "type": "https://index-pages.com/api/#err-account_frozen",
                      "title": "Account frozen",
                      "status": 403,
                      "detail": "This account is frozen. Contact support.",
                      "code": "account_frozen"
                    }
                  }
                }
              }
            }
          },
          "409": {
            "description": "A request with the same `Idempotency-Key` is still being processed. Retry later.",
            "headers": {
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/Idempotent-Replayed"
              }
            },
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                },
                "examples": {
                  "idempotency_key_in_flight": {
                    "summary": "Same key still running",
                    "value": {
                      "type": "https://index-pages.com/api/#err-idempotency_key_in_flight",
                      "title": "Request in progress",
                      "status": 409,
                      "detail": "A request with this Idempotency-Key is still being processed.",
                      "code": "idempotency_key_in_flight"
                    }
                  }
                }
              }
            }
          },
          "415": {
            "description": "The request body is not sent as `application/json`.",
            "headers": {
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/Idempotent-Replayed"
              }
            },
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                },
                "examples": {
                  "unsupported_media_type": {
                    "summary": "Wrong Content-Type",
                    "value": {
                      "type": "https://index-pages.com/api/#err-unsupported_media_type",
                      "title": "Unsupported media type",
                      "status": 415,
                      "detail": "The request body must be JSON, sent with `Content-Type: application/json`.",
                      "code": "unsupported_media_type"
                    }
                  }
                }
              }
            }
          },
          "422": {
            "description": "The URLs or other fields were rejected, the draft limit is reached, or the `Idempotency-Key` was reused with a different request.",
            "headers": {
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/Idempotent-Replayed"
              }
            },
            "content": {
              "application/problem+json": {
                "schema": {
                  "anyOf": [
                    {
                      "$ref": "#/components/schemas/ValidationProblem"
                    },
                    {
                      "$ref": "#/components/schemas/DraftLimitProblem"
                    }
                  ]
                },
                "examples": {
                  "validation_failed": {
                    "summary": "Some URLs rejected",
                    "value": {
                      "type": "https://index-pages.com/api/#err-validation_failed",
                      "title": "Validation failed",
                      "status": 422,
                      "detail": "2 of 120 URLs were rejected.",
                      "code": "validation_failed",
                      "errors": [
                        {
                          "field": "urls[3]",
                          "code": "invalid_url",
                          "message": "Not a valid URL."
                        },
                        {
                          "field": "urls[17]",
                          "code": "private_host",
                          "message": "Points to a private or internal address."
                        }
                      ]
                    }
                  },
                  "too_many": {
                    "summary": "Too many URLs",
                    "value": {
                      "type": "https://index-pages.com/api/#err-validation_failed",
                      "title": "Validation failed",
                      "status": 422,
                      "detail": "1 field was rejected.",
                      "code": "validation_failed",
                      "errors": [
                        {
                          "field": "urls",
                          "code": "too_many",
                          "message": "At most 1000 URLs per order."
                        }
                      ]
                    }
                  },
                  "title_too_long": {
                    "summary": "Title too long",
                    "value": {
                      "type": "https://index-pages.com/api/#err-validation_failed",
                      "title": "Validation failed",
                      "status": 422,
                      "detail": "1 field was rejected.",
                      "code": "validation_failed",
                      "errors": [
                        {
                          "field": "title",
                          "code": "max",
                          "message": "Must not be greater than 255 characters."
                        }
                      ]
                    }
                  },
                  "idempotency_key_too_long": {
                    "summary": "Idempotency-Key too long",
                    "value": {
                      "type": "https://index-pages.com/api/#err-validation_failed",
                      "title": "Validation failed",
                      "status": 422,
                      "detail": "1 field was rejected.",
                      "code": "validation_failed",
                      "errors": [
                        {
                          "field": "Idempotency-Key",
                          "code": "too_long",
                          "message": "Must not be greater than 255 characters."
                        }
                      ]
                    }
                  },
                  "draft_limit_reached": {
                    "summary": "Too many drafts",
                    "value": {
                      "type": "https://index-pages.com/api/#err-draft_limit_reached",
                      "title": "Draft limit reached",
                      "status": 422,
                      "detail": "This account already has 100 draft orders. Run or delete some first.",
                      "code": "draft_limit_reached",
                      "limit": 100
                    }
                  },
                  "idempotency_key_reused": {
                    "summary": "Key reused with another body",
                    "value": {
                      "type": "https://index-pages.com/api/#err-idempotency_key_reused",
                      "title": "Idempotency key reused",
                      "status": 422,
                      "detail": "This Idempotency-Key was already used for a different request.",
                      "code": "idempotency_key_reused"
                    }
                  }
                }
              }
            }
          },
          "429": {
            "description": "Too many requests.",
            "headers": {
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "Retry-After": {
                "$ref": "#/components/headers/Retry-After"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/Idempotent-Replayed"
              }
            },
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                },
                "examples": {
                  "rate_limited": {
                    "summary": "Limit hit",
                    "value": {
                      "type": "https://index-pages.com/api/#err-rate_limited",
                      "title": "Too many requests",
                      "status": 429,
                      "detail": "Too many requests. Retry after the number of seconds in Retry-After.",
                      "code": "rate_limited"
                    }
                  }
                }
              }
            }
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    },
    "/orders/{orderId}": {
      "parameters": [
        {
          "$ref": "#/components/parameters/orderId"
        }
      ],
      "get": {
        "operationId": "getOrder",
        "tags": [
          "Orders"
        ],
        "summary": "Get an order",
        "description": "One order with its progress counters.\n\nRequires scope `orders:read`.",
        "x-required-scope": "orders:read",
        "responses": {
          "200": {
            "description": "The order.",
            "headers": {
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Order"
                },
                "examples": {
                  "in_progress": {
                    "summary": "Order in progress",
                    "value": {
                      "id": "k3j4h5g6f7d8s9a0",
                      "title": "October sitemap",
                      "comment": null,
                      "status": "in_progress",
                      "urls_total": 120,
                      "urls_done": 37,
                      "price_per_url": "1.00",
                      "cost": "120.00",
                      "currency": "USD",
                      "created_at": "2026-10-10T12:00:00Z",
                      "started_at": "2026-10-10T12:05:00Z",
                      "campaign_ends_at": "2026-10-24T12:05:00Z"
                    }
                  },
                  "draft": {
                    "summary": "Draft",
                    "value": {
                      "id": "q7w8e9r0t1y2u3i4",
                      "title": "October sitemap",
                      "comment": "Blog posts from the October batch",
                      "status": "draft",
                      "urls_total": 2,
                      "urls_done": 0,
                      "price_per_url": "1.00",
                      "cost": "2.00",
                      "currency": "USD",
                      "created_at": "2026-10-10T12:00:00Z",
                      "started_at": null,
                      "campaign_ends_at": null
                    }
                  },
                  "done": {
                    "summary": "Finished order",
                    "value": {
                      "id": "m1n2b3v4c5x6z7l8",
                      "title": "Untitled Order 3",
                      "comment": null,
                      "status": "done",
                      "urls_total": 40,
                      "urls_done": 40,
                      "price_per_url": "1.00",
                      "cost": "40.00",
                      "currency": "USD",
                      "created_at": "2026-09-20T08:30:00Z",
                      "started_at": "2026-09-20T08:31:12Z",
                      "campaign_ends_at": "2026-10-04T08:31:12Z"
                    }
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      },
      "delete": {
        "operationId": "deleteOrder",
        "tags": [
          "Orders"
        ],
        "summary": "Delete a draft",
        "description": "Deletes a draft permanently. Orders that have been run cannot be deleted through the API – it never hides history.\n\nRequires scope `orders:write`.",
        "x-required-scope": "orders:write",
        "responses": {
          "204": {
            "description": "The draft was deleted.",
            "headers": {
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              }
            }
          },
          "409": {
            "description": "The order is not a draft.",
            "headers": {
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              }
            },
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                },
                "examples": {
                  "order_not_deletable": {
                    "summary": "Order was already run",
                    "value": {
                      "type": "https://index-pages.com/api/#err-order_not_deletable",
                      "title": "Order cannot be deleted",
                      "status": 409,
                      "detail": "Only draft orders can be deleted. This order is in_progress.",
                      "code": "order_not_deletable"
                    }
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    },
    "/orders/{orderId}/run": {
      "parameters": [
        {
          "$ref": "#/components/parameters/orderId"
        }
      ],
      "post": {
        "operationId": "runOrder",
        "tags": [
          "Orders"
        ],
        "summary": "Run a draft",
        "description": "Charges the order's `cost` to the balance and starts the work. Takes no body; one sent anyway is ignored, but a non-empty body with a `Content-Type` other than JSON gets `415`, and one that does not parse gets `400`. Send an `Idempotency-Key` so a retry after a network failure cannot charge twice. Rate limit: 10 requests per minute per key on top of the general limit.\n\nRequires scope `orders:run`.",
        "x-required-scope": "orders:run",
        "parameters": [
          {
            "$ref": "#/components/parameters/Idempotency-Key"
          }
        ],
        "responses": {
          "200": {
            "description": "The order was charged and is now `in_progress`.",
            "headers": {
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/Idempotent-Replayed"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Order"
                },
                "examples": {
                  "started": {
                    "summary": "Started order",
                    "value": {
                      "id": "q7w8e9r0t1y2u3i4",
                      "title": "October sitemap",
                      "comment": "Blog posts from the October batch",
                      "status": "in_progress",
                      "urls_total": 2,
                      "urls_done": 0,
                      "price_per_url": "1.00",
                      "cost": "2.00",
                      "currency": "USD",
                      "created_at": "2026-10-10T12:00:00Z",
                      "started_at": "2026-10-10T12:05:00Z",
                      "campaign_ends_at": "2026-10-24T12:05:00Z"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "The request body is not valid JSON.",
            "headers": {
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/Idempotent-Replayed"
              }
            },
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                },
                "examples": {
                  "invalid_json": {
                    "summary": "Body does not parse",
                    "value": {
                      "type": "https://index-pages.com/api/#err-invalid_json",
                      "title": "Invalid JSON",
                      "status": 400,
                      "detail": "The request body is not valid JSON.",
                      "code": "invalid_json"
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "The API key is missing, malformed, unknown, revoked or expired.",
            "headers": {
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "WWW-Authenticate": {
                "$ref": "#/components/headers/WWW-Authenticate"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/Idempotent-Replayed"
              }
            },
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                },
                "examples": {
                  "unauthorized": {
                    "summary": "No valid key",
                    "value": {
                      "type": "https://index-pages.com/api/#err-unauthorized",
                      "title": "Unauthorized",
                      "status": 401,
                      "detail": "A valid API key is required: send it as `Authorization: Bearer <key>`.",
                      "code": "unauthorized"
                    }
                  }
                }
              }
            }
          },
          "402": {
            "description": "The balance does not cover the order's cost.",
            "headers": {
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/Idempotent-Replayed"
              }
            },
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/InsufficientBalanceProblem"
                },
                "examples": {
                  "insufficient_balance": {
                    "summary": "Not enough balance",
                    "value": {
                      "type": "https://index-pages.com/api/#err-insufficient_balance",
                      "title": "Insufficient balance",
                      "status": 402,
                      "detail": "This order costs $120.00, your balance is $12.50.",
                      "code": "insufficient_balance",
                      "required": "120.00",
                      "available": "12.50",
                      "currency": "USD"
                    }
                  }
                }
              }
            }
          },
          "403": {
            "description": "The key lacks the required scope, or the account is frozen.",
            "headers": {
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/Idempotent-Replayed"
              }
            },
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ForbiddenScopeProblem"
                },
                "examples": {
                  "forbidden_scope": {
                    "summary": "Key lacks the scope",
                    "value": {
                      "type": "https://index-pages.com/api/#err-forbidden_scope",
                      "title": "Missing scope",
                      "status": 403,
                      "detail": "This key does not have the orders:run scope.",
                      "code": "forbidden_scope",
                      "required_scope": "orders:run"
                    }
                  },
                  "account_frozen": {
                    "summary": "Account is frozen",
                    "value": {
                      "type": "https://index-pages.com/api/#err-account_frozen",
                      "title": "Account frozen",
                      "status": 403,
                      "detail": "This account is frozen. Contact support.",
                      "code": "account_frozen"
                    }
                  }
                }
              }
            }
          },
          "404": {
            "description": "The order does not exist, belongs to another account, or was deleted.",
            "headers": {
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/Idempotent-Replayed"
              }
            },
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                },
                "examples": {
                  "not_found": {
                    "summary": "No such order",
                    "value": {
                      "type": "https://index-pages.com/api/#err-not_found",
                      "title": "Not found",
                      "status": 404,
                      "detail": "Order not found.",
                      "code": "not_found"
                    }
                  }
                }
              }
            }
          },
          "409": {
            "description": "The order is not a draft, or a request with the same `Idempotency-Key` is still being processed.",
            "headers": {
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/Idempotent-Replayed"
              }
            },
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                },
                "examples": {
                  "order_not_executable": {
                    "summary": "Order was already run",
                    "value": {
                      "type": "https://index-pages.com/api/#err-order_not_executable",
                      "title": "Order cannot be run",
                      "status": 409,
                      "detail": "Only draft orders can be run. This order is in_progress.",
                      "code": "order_not_executable"
                    }
                  },
                  "idempotency_key_in_flight": {
                    "summary": "Same key still running",
                    "value": {
                      "type": "https://index-pages.com/api/#err-idempotency_key_in_flight",
                      "title": "Request in progress",
                      "status": 409,
                      "detail": "A request with this Idempotency-Key is still being processed.",
                      "code": "idempotency_key_in_flight"
                    }
                  }
                }
              }
            }
          },
          "415": {
            "description": "The request body is not sent as `application/json`.",
            "headers": {
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/Idempotent-Replayed"
              }
            },
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                },
                "examples": {
                  "unsupported_media_type": {
                    "summary": "Wrong Content-Type",
                    "value": {
                      "type": "https://index-pages.com/api/#err-unsupported_media_type",
                      "title": "Unsupported media type",
                      "status": 415,
                      "detail": "The request body must be JSON, sent with `Content-Type: application/json`.",
                      "code": "unsupported_media_type"
                    }
                  }
                }
              }
            }
          },
          "422": {
            "description": "The `Idempotency-Key` was already used with a different request, or is longer than 255 characters.",
            "headers": {
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/Idempotent-Replayed"
              }
            },
            "content": {
              "application/problem+json": {
                "schema": {
                  "anyOf": [
                    {
                      "$ref": "#/components/schemas/ValidationProblem"
                    },
                    {
                      "$ref": "#/components/schemas/Problem"
                    }
                  ]
                },
                "examples": {
                  "idempotency_key_reused": {
                    "summary": "Key reused on another order",
                    "value": {
                      "type": "https://index-pages.com/api/#err-idempotency_key_reused",
                      "title": "Idempotency key reused",
                      "status": 422,
                      "detail": "This Idempotency-Key was already used for a different request.",
                      "code": "idempotency_key_reused"
                    }
                  },
                  "idempotency_key_too_long": {
                    "summary": "Idempotency-Key too long",
                    "value": {
                      "type": "https://index-pages.com/api/#err-validation_failed",
                      "title": "Validation failed",
                      "status": 422,
                      "detail": "1 field was rejected.",
                      "code": "validation_failed",
                      "errors": [
                        {
                          "field": "Idempotency-Key",
                          "code": "too_long",
                          "message": "Must not be greater than 255 characters."
                        }
                      ]
                    }
                  }
                }
              }
            }
          },
          "429": {
            "description": "Too many requests.",
            "headers": {
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "Retry-After": {
                "$ref": "#/components/headers/Retry-After"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/Idempotent-Replayed"
              }
            },
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                },
                "examples": {
                  "rate_limited": {
                    "summary": "Limit hit",
                    "value": {
                      "type": "https://index-pages.com/api/#err-rate_limited",
                      "title": "Too many requests",
                      "status": 429,
                      "detail": "Too many requests. Retry after the number of seconds in Retry-After.",
                      "code": "rate_limited"
                    }
                  }
                }
              }
            }
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    },
    "/orders/{orderId}/urls": {
      "parameters": [
        {
          "$ref": "#/components/parameters/orderId"
        }
      ],
      "get": {
        "operationId": "listOrderUrls",
        "tags": [
          "Orders"
        ],
        "summary": "List the URLs of an order",
        "description": "Per-URL status, one page at a time, in the order the URLs were submitted (not newest first). The cursor is a position in that list and works the same for a draft and for an order that has been run. Every URL of a draft is `pending`.\n\n**Retention:** per-URL detail is kept until three days after the order's `campaign_ends_at`. After that this endpoint returns an empty list (`data: []`, `has_more: false`), while the order and its `urls_total` / `urls_done` counters remain available through `GET /orders/{orderId}`.\n\nRequires scope `orders:read`.",
        "x-required-scope": "orders:read",
        "parameters": [
          {
            "$ref": "#/components/parameters/limit"
          },
          {
            "$ref": "#/components/parameters/cursor"
          }
        ],
        "responses": {
          "200": {
            "description": "A page of URLs.",
            "headers": {
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OrderUrlPage"
                },
                "examples": {
                  "in_progress": {
                    "summary": "Order in progress",
                    "value": {
                      "data": [
                        {
                          "url": "https://example.com/a",
                          "status": "done"
                        },
                        {
                          "url": "https://example.com/b",
                          "status": "in_progress"
                        },
                        {
                          "url": "https://example.com/c",
                          "status": "pending"
                        }
                      ],
                      "next_cursor": "eyJpZCI6MTAzLCJfcG9pbnRzVG9OZXh0SXRlbXMiOnRydWV9",
                      "has_more": true
                    }
                  },
                  "expired": {
                    "summary": "Per-URL detail has expired",
                    "value": {
                      "data": [],
                      "next_cursor": null,
                      "has_more": false
                    }
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "422": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    },
    "/openapi.json": {
      "get": {
        "operationId": "getOpenApi",
        "tags": [
          "Meta"
        ],
        "summary": "Get this specification",
        "description": "This OpenAPI 3.1 document. No key needed. Cached for an hour (`Cache-Control: public, max-age=3600`).",
        "security": [],
        "responses": {
          "200": {
            "description": "The OpenAPI document.",
            "headers": {
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "Cache-Control": {
                "description": "Always `public, max-age=3600`.",
                "schema": {
                  "type": "string"
                },
                "example": "public, max-age=3600"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "description": "An OpenAPI 3.1 document."
                },
                "examples": {
                  "spec": {
                    "summary": "Abridged",
                    "value": {
                      "openapi": "3.1.0",
                      "info": {
                        "title": "Index Pages API",
                        "version": "1.0.0"
                      },
                      "paths": {}
                    }
                  }
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    }
  },
  "components": {
    "securitySchemes": {
      "bearer": {
        "type": "http",
        "scheme": "bearer",
        "bearerFormat": "API key",
        "description": "An API key from the dashboard (Settings → API keys): `ipk_live_` followed by 40 letters and digits."
      }
    },
    "schemas": {
      "OrderId": {
        "type": "string",
        "description": "Opaque order id, the same one shown in the dashboard URL.",
        "pattern": "^[a-z0-9]{16}$",
        "examples": [
          "k3j4h5g6f7d8s9a0"
        ]
      },
      "Money": {
        "type": "string",
        "description": "Decimal amount with exactly two digits after the point. Always paired with `currency`.",
        "pattern": "^[0-9]+\\.[0-9]{2}$",
        "examples": [
          "12.50"
        ]
      },
      "Currency": {
        "type": "string",
        "description": "ISO 4217 currency code.",
        "enum": [
          "USD"
        ]
      },
      "Timestamp": {
        "type": "string",
        "format": "date-time",
        "description": "RFC 3339 in UTC with a `Z` suffix.",
        "examples": [
          "2026-10-10T12:00:00Z"
        ]
      },
      "OrderStatus": {
        "type": "string",
        "enum": [
          "draft",
          "in_progress",
          "done",
          "error"
        ],
        "description": "`draft` – created, not paid or started yet; `in_progress` – paid and being worked on; `done` – finished; `error` – stopped by a failure, contact support."
      },
      "OrderUrlStatus": {
        "type": "string",
        "enum": [
          "pending",
          "in_progress",
          "done"
        ],
        "description": "`pending` – waiting (every URL of a draft is `pending`); `in_progress` – being worked on; `done` – finished."
      },
      "Scope": {
        "type": "string",
        "enum": [
          "orders:read",
          "orders:write",
          "orders:run",
          "balance:read"
        ],
        "description": "`orders:read` – list and read orders and their URLs; `orders:write` – create and delete drafts; `orders:run` – run a draft, which charges the balance; `balance:read` – read the account."
      },
      "ErrorCode": {
        "type": "string",
        "enum": [
          "invalid_json",
          "unauthorized",
          "insufficient_balance",
          "forbidden_scope",
          "account_frozen",
          "not_found",
          "method_not_allowed",
          "order_not_executable",
          "order_not_deletable",
          "idempotency_key_in_flight",
          "unsupported_media_type",
          "validation_failed",
          "draft_limit_reached",
          "idempotency_key_reused",
          "rate_limited",
          "internal_error"
        ],
        "description": "Stable machine-readable error code. See `components.x-error-codes` for the HTTP status and meaning of each."
      },
      "Order": {
        "type": "object",
        "required": [
          "id",
          "title",
          "comment",
          "status",
          "urls_total",
          "urls_done",
          "price_per_url",
          "cost",
          "currency",
          "created_at",
          "started_at",
          "campaign_ends_at"
        ],
        "properties": {
          "id": {
            "$ref": "#/components/schemas/OrderId"
          },
          "title": {
            "type": "string",
            "maxLength": 255,
            "description": "Order title. When none is given at creation, one is generated: `Untitled Order`, then `Untitled Order 2`, `Untitled Order 3` and so on."
          },
          "comment": {
            "type": [
              "string",
              "null"
            ],
            "maxLength": 1000,
            "description": "Free-form note, or `null`."
          },
          "status": {
            "$ref": "#/components/schemas/OrderStatus"
          },
          "urls_total": {
            "type": "integer",
            "minimum": 0,
            "description": "Number of URLs in the order."
          },
          "urls_done": {
            "type": "integer",
            "minimum": 0,
            "description": "Number of URLs finished so far. Kept after the per-URL detail expires."
          },
          "price_per_url": {
            "$ref": "#/components/schemas/Money",
            "description": "Price of one URL in this order."
          },
          "cost": {
            "$ref": "#/components/schemas/Money",
            "description": "`price_per_url × urls_total`. For a draft this is what `run` will charge."
          },
          "currency": {
            "$ref": "#/components/schemas/Currency"
          },
          "created_at": {
            "$ref": "#/components/schemas/Timestamp"
          },
          "started_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time",
            "description": "When the order was run and the balance charged. `null` for a draft."
          },
          "campaign_ends_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time",
            "description": "When work on the order ends. `null` for a draft. Per-URL detail is kept until three days after this moment."
          }
        },
        "examples": [
          {
            "id": "k3j4h5g6f7d8s9a0",
            "title": "October sitemap",
            "comment": null,
            "status": "in_progress",
            "urls_total": 120,
            "urls_done": 37,
            "price_per_url": "1.00",
            "cost": "120.00",
            "currency": "USD",
            "created_at": "2026-10-10T12:00:00Z",
            "started_at": "2026-10-10T12:05:00Z",
            "campaign_ends_at": "2026-10-24T12:05:00Z"
          }
        ]
      },
      "OrderUrl": {
        "type": "object",
        "required": [
          "url",
          "status"
        ],
        "properties": {
          "url": {
            "type": "string",
            "format": "uri",
            "description": "The URL as submitted."
          },
          "status": {
            "$ref": "#/components/schemas/OrderUrlStatus"
          }
        },
        "examples": [
          {
            "url": "https://example.com/page",
            "status": "pending"
          }
        ]
      },
      "AccountLimits": {
        "type": "object",
        "required": [
          "min_urls_per_order",
          "max_urls_per_order",
          "max_draft_orders"
        ],
        "properties": {
          "min_urls_per_order": {
            "type": "integer",
            "minimum": 1
          },
          "max_urls_per_order": {
            "type": "integer",
            "minimum": 1
          },
          "max_draft_orders": {
            "type": "integer",
            "minimum": 1,
            "description": "Draft orders the account may hold at once."
          }
        }
      },
      "ApiKeyInfo": {
        "type": "object",
        "description": "The key that made this request. The secret itself is never returned.",
        "required": [
          "name",
          "prefix",
          "scopes"
        ],
        "properties": {
          "name": {
            "type": "string",
            "maxLength": 64
          },
          "prefix": {
            "type": "string",
            "description": "First 13 characters of the key (the `ipk_live_` prefix and four more), to tell keys apart.",
            "examples": [
              "ipk_live_ab12"
            ]
          },
          "scopes": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Scope"
            },
            "uniqueItems": true
          }
        }
      },
      "Account": {
        "type": "object",
        "description": "Balance, pricing and limits. No email or other profile data is exposed, so a read-only key does not reveal the owner.",
        "required": [
          "balance",
          "currency",
          "price_per_url",
          "limits",
          "key"
        ],
        "properties": {
          "balance": {
            "$ref": "#/components/schemas/Money"
          },
          "currency": {
            "$ref": "#/components/schemas/Currency"
          },
          "price_per_url": {
            "$ref": "#/components/schemas/Money",
            "description": "Price of one URL for a new order."
          },
          "limits": {
            "$ref": "#/components/schemas/AccountLimits"
          },
          "key": {
            "$ref": "#/components/schemas/ApiKeyInfo"
          }
        }
      },
      "CreateOrderRequest": {
        "type": "object",
        "required": [
          "urls"
        ],
        "additionalProperties": false,
        "properties": {
          "urls": {
            "type": "array",
            "items": {
              "type": "string",
              "format": "uri"
            },
            "description": "URLs to index, as a JSON array of strings (not a newline-separated string). Each must be an absolute http or https URL to a public host. The allowed count is `limits.min_urls_per_order`–`limits.max_urls_per_order` from `GET /account`. Every element is checked and every rejection is reported in `errors[]` under its index."
          },
          "title": {
            "type": [
              "string",
              "null"
            ],
            "maxLength": 255,
            "description": "Optional. Generated when omitted. Control characters are stripped."
          },
          "comment": {
            "type": [
              "string",
              "null"
            ],
            "maxLength": 1000,
            "description": "Optional note. Control characters are stripped."
          }
        },
        "examples": [
          {
            "urls": [
              "https://example.com/a",
              "https://example.com/b"
            ],
            "title": "October sitemap",
            "comment": "Blog posts from the October batch"
          }
        ]
      },
      "Page": {
        "type": "object",
        "required": [
          "data",
          "next_cursor",
          "has_more"
        ],
        "properties": {
          "next_cursor": {
            "type": [
              "string",
              "null"
            ],
            "description": "Pass as `cursor` to get the next page. `null` on the last page."
          },
          "has_more": {
            "type": "boolean",
            "description": "Whether another page follows."
          }
        }
      },
      "OrderPage": {
        "allOf": [
          {
            "$ref": "#/components/schemas/Page"
          },
          {
            "type": "object",
            "required": [
              "data"
            ],
            "properties": {
              "data": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/Order"
                },
                "description": "Orders, newest first."
              }
            }
          }
        ]
      },
      "OrderUrlPage": {
        "allOf": [
          {
            "$ref": "#/components/schemas/Page"
          },
          {
            "type": "object",
            "required": [
              "data"
            ],
            "properties": {
              "data": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/OrderUrl"
                },
                "description": "URLs of the order, in submission order. Empty once the per-URL detail has expired."
              }
            }
          }
        ]
      },
      "Problem": {
        "type": "object",
        "description": "RFC 9457 problem details plus a stable `code`. More fields may appear for specific codes. A problem outside this contract (such as `413` from the edge) has `type: about:blank` and no `code`.",
        "required": [
          "type",
          "title",
          "status"
        ],
        "properties": {
          "type": {
            "type": "string",
            "format": "uri-reference",
            "description": "Link to the explanation of this code, or `about:blank` for an error outside this contract.",
            "examples": [
              "https://index-pages.com/api/#err-not_found"
            ]
          },
          "title": {
            "type": "string",
            "description": "Short human-readable summary, the same for every occurrence of the code."
          },
          "status": {
            "type": "integer",
            "minimum": 400,
            "maximum": 599
          },
          "detail": {
            "type": "string",
            "description": "Human-readable explanation of this occurrence."
          },
          "code": {
            "$ref": "#/components/schemas/ErrorCode"
          }
        }
      },
      "ValidationError": {
        "type": "object",
        "required": [
          "field",
          "code",
          "message"
        ],
        "properties": {
          "field": {
            "type": "string",
            "description": "Path of the field: `urls`, `urls[3]`, `title`, `comment`, `status`, `limit`, `cursor`, `Idempotency-Key`.",
            "examples": [
              "urls[3]"
            ]
          },
          "code": {
            "type": "string",
            "description": "Machine-readable reason. For an element `urls[i]`: `invalid_url`, `unsupported_scheme`, `private_host`, `too_long`, `invalid_characters`. For the `urls` list as a whole: `too_few`, `too_many`, `required`, `not_a_list`. For `cursor`: `invalid_cursor` (malformed, or taken from another list). For an `Idempotency-Key` header over 255 characters: `too_long` on field `Idempotency-Key`. For a query string on a POST: `not_allowed` on field `query` – write requests take parameters in the JSON body only. For any other field: the name of the failed rule in snake_case – `required`, `string`, `integer`, `array`, `min`, `max`, `in`. New codes may be added; treat unknown ones as a generic failure.",
            "examples": [
              "invalid_url"
            ]
          },
          "message": {
            "type": "string",
            "description": "Human-readable explanation."
          }
        }
      },
      "ValidationProblem": {
        "allOf": [
          {
            "$ref": "#/components/schemas/Problem"
          },
          {
            "type": "object",
            "required": [
              "errors"
            ],
            "properties": {
              "errors": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/ValidationError"
                },
                "minItems": 1
              }
            }
          }
        ]
      },
      "InsufficientBalanceProblem": {
        "allOf": [
          {
            "$ref": "#/components/schemas/Problem"
          },
          {
            "type": "object",
            "required": [
              "required",
              "available",
              "currency"
            ],
            "properties": {
              "required": {
                "$ref": "#/components/schemas/Money",
                "description": "Cost of the order."
              },
              "available": {
                "$ref": "#/components/schemas/Money",
                "description": "Current balance."
              },
              "currency": {
                "$ref": "#/components/schemas/Currency"
              }
            }
          }
        ]
      },
      "ForbiddenScopeProblem": {
        "allOf": [
          {
            "$ref": "#/components/schemas/Problem"
          },
          {
            "type": "object",
            "properties": {
              "required_scope": {
                "$ref": "#/components/schemas/Scope",
                "description": "Present for `forbidden_scope`: the scope the key is missing."
              }
            }
          }
        ]
      },
      "DraftLimitProblem": {
        "allOf": [
          {
            "$ref": "#/components/schemas/Problem"
          },
          {
            "type": "object",
            "properties": {
              "limit": {
                "type": "integer",
                "description": "Present for `draft_limit_reached`: the number of drafts an account may hold."
              }
            }
          }
        ]
      }
    },
    "parameters": {
      "orderId": {
        "name": "orderId",
        "in": "path",
        "required": true,
        "description": "Order id.",
        "schema": {
          "$ref": "#/components/schemas/OrderId"
        },
        "example": "k3j4h5g6f7d8s9a0"
      },
      "limit": {
        "name": "limit",
        "in": "query",
        "required": false,
        "description": "Page size.",
        "schema": {
          "type": "integer",
          "minimum": 1,
          "maximum": 100,
          "default": 20
        },
        "example": 50
      },
      "cursor": {
        "name": "cursor",
        "in": "query",
        "required": false,
        "description": "`next_cursor` from the previous page of the same list. Omit for the first page. A malformed cursor, or one from another list, gets `422 validation_failed` with code `invalid_cursor` on field `cursor`.",
        "schema": {
          "type": "string"
        }
      },
      "status": {
        "name": "status",
        "in": "query",
        "required": false,
        "description": "Return only orders in this status. Any other value gets `422 validation_failed`.",
        "schema": {
          "$ref": "#/components/schemas/OrderStatus"
        },
        "example": "in_progress"
      },
      "Idempotency-Key": {
        "name": "Idempotency-Key",
        "in": "header",
        "required": false,
        "description": "Optional unique key, such as a UUID, that makes a retry safe. Kept for 24 hours per API key. See the idempotency rules in the API description.",
        "schema": {
          "type": "string",
          "minLength": 1,
          "maxLength": 255
        },
        "example": "6f1c2a9e-8f0b-4c55-a7f2-3d9f1e0b7c41"
      }
    },
    "headers": {
      "X-RateLimit-Limit": {
        "description": "Requests allowed per minute in the limiter that applies to this request.",
        "schema": {
          "type": "integer"
        },
        "example": 120
      },
      "X-RateLimit-Remaining": {
        "description": "Requests left in the current minute.",
        "schema": {
          "type": "integer"
        },
        "example": 117
      },
      "Retry-After": {
        "description": "Seconds to wait before retrying.",
        "required": true,
        "schema": {
          "type": "integer"
        },
        "example": 42
      },
      "X-RateLimit-Reset": {
        "description": "Unix time, in seconds, when the limit resets. Sent only with `429`.",
        "schema": {
          "type": "integer"
        },
        "example": 1795435690
      },
      "Location": {
        "description": "URL of the created order.",
        "required": true,
        "schema": {
          "type": "string",
          "format": "uri"
        },
        "example": "https://api.index-pages.com/v1/orders/q7w8e9r0t1y2u3i4"
      },
      "Idempotent-Replayed": {
        "description": "`true` when this is a stored response replayed for a repeated `Idempotency-Key` (successes and 4xx errors are stored; 5xx, responses over 8 KB and entries past the per-account cap are not). Absent otherwise.",
        "schema": {
          "type": "string",
          "enum": [
            "true"
          ]
        }
      },
      "WWW-Authenticate": {
        "description": "Always `Bearer`.",
        "required": true,
        "schema": {
          "type": "string"
        },
        "example": "Bearer"
      }
    },
    "responses": {
      "Unauthorized": {
        "description": "The API key is missing, malformed, unknown, revoked or expired.",
        "headers": {
          "X-RateLimit-Limit": {
            "$ref": "#/components/headers/X-RateLimit-Limit"
          },
          "X-RateLimit-Remaining": {
            "$ref": "#/components/headers/X-RateLimit-Remaining"
          },
          "WWW-Authenticate": {
            "$ref": "#/components/headers/WWW-Authenticate"
          }
        },
        "content": {
          "application/problem+json": {
            "schema": {
              "$ref": "#/components/schemas/Problem"
            },
            "examples": {
              "unauthorized": {
                "summary": "No valid key",
                "value": {
                  "type": "https://index-pages.com/api/#err-unauthorized",
                  "title": "Unauthorized",
                  "status": 401,
                  "detail": "A valid API key is required: send it as `Authorization: Bearer <key>`.",
                  "code": "unauthorized"
                }
              }
            }
          }
        }
      },
      "Forbidden": {
        "description": "The key lacks the required scope, or the account is frozen.",
        "headers": {
          "X-RateLimit-Limit": {
            "$ref": "#/components/headers/X-RateLimit-Limit"
          },
          "X-RateLimit-Remaining": {
            "$ref": "#/components/headers/X-RateLimit-Remaining"
          }
        },
        "content": {
          "application/problem+json": {
            "schema": {
              "$ref": "#/components/schemas/ForbiddenScopeProblem"
            },
            "examples": {
              "forbidden_scope": {
                "summary": "Key lacks the scope",
                "value": {
                  "type": "https://index-pages.com/api/#err-forbidden_scope",
                  "title": "Missing scope",
                  "status": 403,
                  "detail": "This key does not have the orders:run scope.",
                  "code": "forbidden_scope",
                  "required_scope": "orders:run"
                }
              },
              "account_frozen": {
                "summary": "Account is frozen",
                "value": {
                  "type": "https://index-pages.com/api/#err-account_frozen",
                  "title": "Account frozen",
                  "status": 403,
                  "detail": "This account is frozen. Contact support.",
                  "code": "account_frozen"
                }
              }
            }
          }
        }
      },
      "NotFound": {
        "description": "The order does not exist, belongs to another account, or was deleted.",
        "headers": {
          "X-RateLimit-Limit": {
            "$ref": "#/components/headers/X-RateLimit-Limit"
          },
          "X-RateLimit-Remaining": {
            "$ref": "#/components/headers/X-RateLimit-Remaining"
          }
        },
        "content": {
          "application/problem+json": {
            "schema": {
              "$ref": "#/components/schemas/Problem"
            },
            "examples": {
              "not_found": {
                "summary": "No such order",
                "value": {
                  "type": "https://index-pages.com/api/#err-not_found",
                  "title": "Not found",
                  "status": 404,
                  "detail": "Order not found.",
                  "code": "not_found"
                }
              }
            }
          }
        }
      },
      "ValidationFailed": {
        "description": "A query parameter is invalid, or `cursor` is malformed or belongs to another list.",
        "headers": {
          "X-RateLimit-Limit": {
            "$ref": "#/components/headers/X-RateLimit-Limit"
          },
          "X-RateLimit-Remaining": {
            "$ref": "#/components/headers/X-RateLimit-Remaining"
          }
        },
        "content": {
          "application/problem+json": {
            "schema": {
              "$ref": "#/components/schemas/ValidationProblem"
            },
            "examples": {
              "bad_status": {
                "summary": "Unknown status filter",
                "value": {
                  "type": "https://index-pages.com/api/#err-validation_failed",
                  "title": "Validation failed",
                  "status": 422,
                  "detail": "1 field was rejected.",
                  "code": "validation_failed",
                  "errors": [
                    {
                      "field": "status",
                      "code": "in",
                      "message": "Must be one of: draft, in_progress, done, error."
                    }
                  ]
                }
              },
              "bad_limit": {
                "summary": "Limit out of range",
                "value": {
                  "type": "https://index-pages.com/api/#err-validation_failed",
                  "title": "Validation failed",
                  "status": 422,
                  "detail": "1 field was rejected.",
                  "code": "validation_failed",
                  "errors": [
                    {
                      "field": "limit",
                      "code": "max",
                      "message": "Must not be greater than 100."
                    }
                  ]
                }
              },
              "bad_cursor": {
                "summary": "Cursor malformed or from another list",
                "value": {
                  "type": "https://index-pages.com/api/#err-validation_failed",
                  "title": "Validation failed",
                  "status": 422,
                  "detail": "1 field was rejected.",
                  "code": "validation_failed",
                  "errors": [
                    {
                      "field": "cursor",
                      "code": "invalid_cursor",
                      "message": "This cursor is not valid for this list."
                    }
                  ]
                }
              }
            }
          }
        }
      },
      "RateLimited": {
        "description": "Too many requests.",
        "headers": {
          "X-RateLimit-Limit": {
            "$ref": "#/components/headers/X-RateLimit-Limit"
          },
          "X-RateLimit-Remaining": {
            "$ref": "#/components/headers/X-RateLimit-Remaining"
          },
          "Retry-After": {
            "$ref": "#/components/headers/Retry-After"
          },
          "X-RateLimit-Reset": {
            "$ref": "#/components/headers/X-RateLimit-Reset"
          }
        },
        "content": {
          "application/problem+json": {
            "schema": {
              "$ref": "#/components/schemas/Problem"
            },
            "examples": {
              "rate_limited": {
                "summary": "Limit hit",
                "value": {
                  "type": "https://index-pages.com/api/#err-rate_limited",
                  "title": "Too many requests",
                  "status": 429,
                  "detail": "Too many requests. Retry after the number of seconds in Retry-After.",
                  "code": "rate_limited"
                }
              }
            }
          }
        }
      },
      "InternalError": {
        "description": "Unexpected server error. Safe to retry with the same `Idempotency-Key`, if one was sent.",
        "headers": {
          "X-RateLimit-Limit": {
            "$ref": "#/components/headers/X-RateLimit-Limit"
          },
          "X-RateLimit-Remaining": {
            "$ref": "#/components/headers/X-RateLimit-Remaining"
          }
        },
        "content": {
          "application/problem+json": {
            "schema": {
              "$ref": "#/components/schemas/Problem"
            },
            "examples": {
              "internal_error": {
                "summary": "Server error",
                "value": {
                  "type": "https://index-pages.com/api/#err-internal_error",
                  "title": "Internal error",
                  "status": 500,
                  "detail": "Something went wrong on our side.",
                  "code": "internal_error"
                }
              }
            }
          }
        }
      }
    },
    "x-error-codes": {
      "invalid_json": {
        "status": 400,
        "title": "Invalid JSON",
        "description": "The request body could not be parsed as JSON."
      },
      "unauthorized": {
        "status": 401,
        "title": "Unauthorized",
        "description": "The key is missing, not sent as a Bearer token, unknown, revoked or expired. The reason is not disclosed; the response carries `WWW-Authenticate: Bearer`."
      },
      "insufficient_balance": {
        "status": 402,
        "title": "Insufficient balance",
        "description": "Running the order needs more than the account balance. Extra fields: `required`, `available`, `currency`."
      },
      "forbidden_scope": {
        "status": 403,
        "title": "Missing scope",
        "description": "The key lacks the scope the operation needs. Extra field: `required_scope`."
      },
      "account_frozen": {
        "status": 403,
        "title": "Account frozen",
        "description": "The account is frozen; every request is refused."
      },
      "not_found": {
        "status": 404,
        "title": "Not found",
        "description": "No such route, or no such order – including another account's order and a deleted one."
      },
      "method_not_allowed": {
        "status": 405,
        "title": "Method not allowed",
        "description": "The path exists but does not accept this HTTP method."
      },
      "order_not_executable": {
        "status": 409,
        "title": "Order cannot be run",
        "description": "`run` was called on an order that is not a draft."
      },
      "order_not_deletable": {
        "status": 409,
        "title": "Order cannot be deleted",
        "description": "`DELETE` was called on an order that is not a draft."
      },
      "idempotency_key_in_flight": {
        "status": 409,
        "title": "Request in progress",
        "description": "A request with the same `Idempotency-Key` is still being processed."
      },
      "unsupported_media_type": {
        "status": 415,
        "title": "Unsupported media type",
        "description": "The request has a body that is not sent as `Content-Type: application/json`."
      },
      "validation_failed": {
        "status": 422,
        "title": "Validation failed",
        "description": "One or more fields are invalid; each failure is listed in `errors[]`."
      },
      "draft_limit_reached": {
        "status": 422,
        "title": "Draft limit reached",
        "description": "The account already holds the maximum number of draft orders. Extra field: `limit`."
      },
      "idempotency_key_reused": {
        "status": 422,
        "title": "Idempotency key reused",
        "description": "The `Idempotency-Key` was already used with a different method, path or body."
      },
      "rate_limited": {
        "status": 429,
        "title": "Too many requests",
        "description": "Too many requests; wait for the number of seconds in `Retry-After`."
      },
      "internal_error": {
        "status": 500,
        "title": "Internal error",
        "description": "Something failed on our side. No details are exposed."
      }
    }
  }
}
