{
    "openapi": "3.0.3",
    "info": {
        "title": "Платформа — доступ к данным каталога",
        "version": "1.0",
        "description": "Машинный доступ к каталогу: JSONL-фид с инкрементальной выгрузкой. Правила — https://plat-forma.com/monitoring/, лимиты — https://plat-forma.com/sla"
    },
    "servers": [
        {
            "url": "https://plat-forma.com"
        }
    ],
    "paths": {
        "/api/catalog.jsonl": {
            "get": {
                "summary": "Каталог построчно (JSONL)",
                "parameters": [
                    {
                        "name": "updated_since",
                        "in": "query",
                        "schema": {
                            "type": "string",
                            "format": "date"
                        },
                        "description": "Только записи, изменённые с этой даты (YYYY-MM-DD)"
                    },
                    {
                        "name": "limit",
                        "in": "query",
                        "schema": {
                            "type": "integer",
                            "maximum": 5000,
                            "default": 1000
                        }
                    },
                    {
                        "name": "offset",
                        "in": "query",
                        "schema": {
                            "type": "integer",
                            "default": 0
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Построчный JSON",
                        "content": {
                            "application/x-ndjson": {
                                "schema": {
                                    "type": "string"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/api/sandbox": {
            "get": {
                "summary": "Песочница: пример структуры записи",
                "responses": {
                    "200": {
                        "description": "Пример данных без ключа"
                    }
                }
            }
        },
        "/lead": {
            "post": {
                "summary": "Заявка на доступ по API",
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/x-www-form-urlencoded": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "name": {
                                        "type": "string"
                                    },
                                    "phone": {
                                        "type": "string"
                                    },
                                    "email": {
                                        "type": "string"
                                    },
                                    "comment": {
                                        "type": "string"
                                    },
                                    "consent_to_personal_data": {
                                        "type": "string",
                                        "enum": [
                                            "agree"
                                        ]
                                    }
                                },
                                "required": [
                                    "name",
                                    "phone",
                                    "email",
                                    "consent_to_personal_data"
                                ]
                            }
                        }
                    }
                },
                "responses": {
                    "303": {
                        "description": "Возврат на страницу с результатом"
                    }
                }
            }
        },
        "/status": {
            "get": {
                "summary": "Состояние проверок",
                "responses": {
                    "200": {
                        "description": "HTML"
                    }
                }
            }
        },
        "/api/v1/webhooks/request": {
            "post": {
                "summary": "Заявка на webhooks: цена и остаток",
                "description": "События: price_changed, stock_changed, product_added, product_removed. Формат уведомления: {event, occurred_at, item:{url,name,article,vendor,price,in_stock,stock_quantity}}. Подпись: X-PF-Signature = HMAC-SHA256(тело, secret). Заявка попадает в статус pending и подтверждается человеком.",
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "url": {
                                        "type": "string",
                                        "format": "uri"
                                    },
                                    "events": {
                                        "type": "array",
                                        "items": {
                                            "type": "string"
                                        }
                                    }
                                },
                                "required": [
                                    "url"
                                ]
                            }
                        }
                    }
                },
                "responses": {
                    "202": {
                        "description": "Заявка принята, статус pending"
                    },
                    "422": {
                        "description": "Ошибка в адресе или событиях"
                    }
                }
            }
        }
    }
}