{
    "openapi": "3.0.3",
    "info": {
        "title": "Possy.ru API",
        "description": "Данные о товарах по штрихкоду: название, бренд, категория, вес, картинка, ссылка.",
        "version": "1.0.0",
        "contact": {
            "url": "https:\/\/possy.ru\/api\/docs"
        }
    },
    "servers": [
        {
            "url": "https:\/\/possy.ru"
        }
    ],
    "components": {
        "securitySchemes": {
            "ApiKey": {
                "type": "apiKey",
                "in": "header",
                "name": "X-API-Key"
            }
        },
        "schemas": {
            "BarcodeItem": {
                "type": "object",
                "properties": {
                    "found": {
                        "type": "boolean"
                    },
                    "barcode": {
                        "type": "string"
                    },
                    "name": {
                        "type": "string"
                    },
                    "brand": {
                        "type": "string"
                    },
                    "category": {
                        "type": "string"
                    },
                    "weight": {
                        "type": "string"
                    },
                    "image": {
                        "type": "string"
                    },
                    "url": {
                        "type": "string"
                    }
                }
            },
            "MatchItem": {
                "type": "object",
                "properties": {
                    "barcode": {
                        "type": "string"
                    },
                    "name": {
                        "type": "string"
                    },
                    "image": {
                        "type": "string"
                    }
                }
            },
            "ExportItem": {
                "type": "object",
                "properties": {
                    "barcode": {
                        "type": "string"
                    },
                    "name": {
                        "type": "string"
                    },
                    "brand": {
                        "type": "string"
                    },
                    "category": {
                        "type": "string"
                    },
                    "image": {
                        "type": "string"
                    },
                    "updated_at": {
                        "type": "string"
                    }
                }
            }
        }
    },
    "paths": {
        "\/api\/barcode\/{code}": {
            "get": {
                "summary": "Товар по штрихкоду",
                "operationId": "getBarcode",
                "security": [
                    {
                        "ApiKey": []
                    }
                ],
                "parameters": [
                    {
                        "name": "code",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Товар найден",
                        "content": {
                            "application\/json": {
                                "schema": {
                                    "$ref": "#\/components\/schemas\/BarcodeItem"
                                }
                            }
                        }
                    },
                    "402": {
                        "description": "Недостаточно баланса"
                    },
                    "404": {
                        "description": "Код не найден"
                    }
                }
            }
        },
        "\/api\/match": {
            "post": {
                "summary": "Пакетная проверка до 500 кодов",
                "operationId": "matchBarcodes",
                "security": [
                    {
                        "ApiKey": []
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application\/json": {
                            "schema": {
                                "type": "object",
                                "required": [
                                    "barcodes"
                                ],
                                "properties": {
                                    "barcodes": {
                                        "type": "array",
                                        "items": {
                                            "type": "string"
                                        },
                                        "maxItems": 500
                                    }
                                }
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Найденные товары",
                        "content": {
                            "application\/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "requested": {
                                            "type": "integer"
                                        },
                                        "found": {
                                            "type": "integer"
                                        },
                                        "items": {
                                            "type": "array",
                                            "items": {
                                                "$ref": "#\/components\/schemas\/MatchItem"
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "400": {
                        "description": "Пустой список кодов"
                    },
                    "402": {
                        "description": "Недостаточно баланса"
                    }
                }
            }
        },
        "\/api\/export": {
            "get": {
                "summary": "Выгрузка каталога",
                "operationId": "exportCatalog",
                "security": [
                    {
                        "ApiKey": []
                    }
                ],
                "parameters": [
                    {
                        "name": "limit",
                        "in": "query",
                        "schema": {
                            "type": "integer",
                            "default": 1000,
                            "maximum": 5000
                        }
                    },
                    {
                        "name": "offset",
                        "in": "query",
                        "schema": {
                            "type": "integer",
                            "default": 0
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Страница каталога",
                        "content": {
                            "application\/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "total": {
                                            "type": "integer"
                                        },
                                        "limit": {
                                            "type": "integer"
                                        },
                                        "offset": {
                                            "type": "integer"
                                        },
                                        "items": {
                                            "type": "array",
                                            "items": {
                                                "$ref": "#\/components\/schemas\/ExportItem"
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "402": {
                        "description": "Недостаточно баланса"
                    }
                }
            }
        }
    }
}