{
  "openapi": "3.1.0",
  "info": {
    "title": "Index-Now.ru REST API",
    "version": "1.0.0",
    "description": "API для проектов, сайтов, отправки URL на индексацию, статусов, Sitemap и технического аудита. Авторизация выполняется отдельным Bearer API-токеном из личного кабинета."
  },
  "servers": [
    {
      "url": "https://index-now.ru/api/v1"
    }
  ],
  "security": [
    {
      "bearerAuth": []
    }
  ],
  "paths": {
    "/projects": {
      "get": {
        "summary": "Список проектов и сайтов",
        "operationId": "listProjects",
        "responses": {
          "200": {
            "description": "Проекты организации"
          }
        }
      }
    },
    "/sites": {
      "get": {
        "summary": "Список сайтов",
        "operationId": "listSites",
        "parameters": [
          {
            "name": "projectId",
            "in": "query",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Сайты организации"
          }
        }
      }
    },
    "/submit": {
      "post": {
        "summary": "Отправить URL на индексацию",
        "operationId": "submitUrls",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SubmissionRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "URL приняты"
          }
        }
      }
    },
    "/status/{id}": {
      "get": {
        "summary": "Статус отправки",
        "operationId": "getSubmissionStatus",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Статус отправки"
          }
        }
      }
    },
    "/history": {
      "get": {
        "summary": "История отправок",
        "operationId": "getSubmissionHistory",
        "parameters": [
          {
            "name": "siteId",
            "in": "query",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 200,
              "default": 20
            }
          }
        ],
        "responses": {
          "200": {
            "description": "История отправок"
          }
        }
      }
    },
    "/sitemaps": {
      "get": {
        "summary": "Список отслеживаемых Sitemap",
        "operationId": "listSitemaps",
        "responses": {
          "200": {
            "description": "Sitemap аккаунта"
          }
        }
      }
    },
    "/sitemaps/{id}/check": {
      "post": {
        "summary": "Запустить проверку Sitemap",
        "operationId": "checkSitemap",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Проверка поставлена в очередь"
          }
        }
      }
    },
    "/tools/page-audit": {
      "post": {
        "summary": "Технический SEO-аудит страницы",
        "operationId": "auditPage",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "url"
                ],
                "properties": {
                  "url": {
                    "type": "string",
                    "format": "uri"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Результат аудита"
          },
          "403": {
            "description": "Инструмент недоступен на текущем тарифе"
          }
        }
      }
    }
  },
  "components": {
    "securitySchemes": {
      "bearerAuth": {
        "type": "http",
        "scheme": "bearer",
        "bearerFormat": "API token"
      }
    },
    "schemas": {
      "SubmissionRequest": {
        "type": "object",
        "required": [
          "siteId",
          "urls"
        ],
        "properties": {
          "siteId": {
            "type": "string",
            "format": "uuid"
          },
          "urls": {
            "type": "array",
            "minItems": 1,
            "maxItems": 100,
            "items": {
              "type": "string",
              "format": "uri"
            }
          },
          "engines": {
            "type": "array",
            "items": {
              "type": "string",
              "enum": [
                "google",
                "indexnow",
                "yandex",
                "indexnow_org",
                "indexnow_bing",
                "yandex_webmaster",
                "bing_webmaster",
                "telegram",
                "ping",
                "jina"
              ]
            }
          },
          "submissionMode": {
            "type": "string",
            "enum": [
              "normal",
              "hard",
              "tier",
              "social"
            ],
            "default": "normal"
          }
        }
      }
    }
  }
}
