{
    "openapi": "3.1.0",
    "info": {
        "title": "AI Tools List API",
        "version": "1.0.0",
        "description": "Read the published AI tools catalog and submit your own project for moderation."
    },
    "servers": [
        {
            "url": "https://listaihub.com/api/v1"
        }
    ],
    "paths": {
        "/tools": {
            "get": {
                "operationId": "listTools",
                "summary": "Search published tools",
                "parameters": [
                    {
                        "name": "q",
                        "in": "query",
                        "schema": {
                            "type": "string",
                            "maxLength": 100
                        }
                    },
                    {
                        "name": "category",
                        "in": "query",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "pricing",
                        "in": "query",
                        "schema": {
                            "type": "string",
                            "enum": [
                                "free",
                                "freemium",
                                "paid",
                                "free_trial",
                                "open_source"
                            ]
                        }
                    },
                    {
                        "name": "locale",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "string",
                            "enum": [
                                "en",
                                "ar",
                                "ru",
                                "uk",
                                "pl",
                                "de",
                                "es",
                                "fr"
                            ]
                        }
                    },
                    {
                        "name": "page",
                        "in": "query",
                        "schema": {
                            "type": "integer",
                            "minimum": 1,
                            "maximum": 500
                        }
                    },
                    {
                        "name": "per_page",
                        "in": "query",
                        "schema": {
                            "type": "integer",
                            "minimum": 1,
                            "maximum": 50
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Page of tools"
                    },
                    "422": {
                        "description": "Error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/tools/{slug}": {
            "get": {
                "operationId": "getTool",
                "summary": "Get one published tool",
                "parameters": [
                    {
                        "name": "slug",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "locale",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "string",
                            "enum": [
                                "en",
                                "ar",
                                "ru",
                                "uk",
                                "pl",
                                "de",
                                "es",
                                "fr"
                            ]
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Tool"
                    },
                    "404": {
                        "description": "Error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/categories": {
            "get": {
                "operationId": "listCategories",
                "summary": "List categories",
                "parameters": [
                    {
                        "name": "locale",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "string",
                            "enum": [
                                "en",
                                "ar",
                                "ru",
                                "uk",
                                "pl",
                                "de",
                                "es",
                                "fr"
                            ]
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Categories"
                    }
                }
            }
        },
        "/submissions": {
            "post": {
                "operationId": "submitTool",
                "summary": "Submit a project for moderation",
                "description": "Requires a bearer token created in the account area. The listing is published only after an editor approves it.",
                "security": [
                    {
                        "bearerAuth": []
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/Submission"
                            }
                        }
                    }
                },
                "responses": {
                    "201": {
                        "description": "Submission accepted for moderation"
                    },
                    "401": {
                        "description": "Error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "Error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "Error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                }
            }
        }
    },
    "components": {
        "securitySchemes": {
            "bearerAuth": {
                "type": "http",
                "scheme": "bearer"
            }
        },
        "schemas": {
            "Error": {
                "type": "object",
                "properties": {
                    "error": {
                        "type": "object",
                        "properties": {
                            "code": {
                                "type": "string"
                            },
                            "message": {
                                "type": "string"
                            },
                            "fields": {
                                "type": "object"
                            }
                        }
                    }
                }
            },
            "Submission": {
                "type": "object",
                "required": [
                    "url",
                    "name",
                    "tagline",
                    "pricing_model",
                    "categories"
                ],
                "properties": {
                    "url": {
                        "type": "string",
                        "format": "uri"
                    },
                    "name": {
                        "type": "string",
                        "minLength": 2,
                        "maxLength": 80
                    },
                    "tagline": {
                        "type": "string",
                        "minLength": 5,
                        "maxLength": 200
                    },
                    "description": {
                        "type": "string",
                        "maxLength": 2000
                    },
                    "logo_url": {
                        "type": "string",
                        "format": "uri",
                        "pattern": "^https://"
                    },
                    "pricing_model": {
                        "type": "string",
                        "enum": [
                            "free",
                            "freemium",
                            "paid",
                            "free_trial",
                            "open_source"
                        ]
                    },
                    "categories": {
                        "type": "array",
                        "minItems": 1,
                        "maxItems": 5,
                        "items": {
                            "type": "string"
                        }
                    },
                    "contact_email": {
                        "type": "string",
                        "format": "email"
                    }
                }
            }
        }
    }
}