{
  "openapi": "3.0.0",
  "info": {
    "title": "AI Prompts Collection API",
    "description": "RESTful API for accessing 127,966+ curated AI prompts for ChatGPT, Claude, Gemini, and Perplexity",
    "version": "3.0.0",
    "contact": {
      "name": "AI Prompts Collection",
      "url": "https://aiprompts.run",
      "email": "support@aiprompts.run"
    },
    "license": {
      "name": "CC BY 4.0",
      "url": "https://creativecommons.org/licenses/by/4.0/"
    }
  },
  "servers": [
    {
      "url": "https://aiprompts.run/api",
      "description": "Production API Server"
    }
  ],
  "paths": {
    "/answers": {
      "get": {
        "summary": "Search AI prompts",
        "description": "Search through the database of AI prompts with query parameters",
        "parameters": [
          {
            "name": "q",
            "in": "query",
            "description": "Search query string",
            "required": true,
            "schema": {
              "type": "string",
              "example": "marketing"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "description": "Maximum number of results to return",
            "schema": {
              "type": "integer",
              "default": 50,
              "minimum": 1,
              "maximum": 100
            }
          },
          {
            "name": "offset",
            "in": "query",
            "description": "Number of results to skip for pagination",
            "schema": {
              "type": "integer",
              "default": 0,
              "minimum": 0
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response with prompt results",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/Prompt"
                  }
                }
              }
            }
          },
          "400": {
            "description": "Bad request - invalid parameters"
          },
          "429": {
            "description": "Rate limit exceeded"
          }
        }
      }
    },
    "/dataset.json": {
      "get": {
        "summary": "Get complete dataset",
        "description": "Download the complete AI prompts dataset in JSON format",
        "responses": {
          "200": {
            "description": "Complete dataset",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "metadata": {
                      "$ref": "#/components/schemas/DatasetMetadata"
                    },
                    "prompts": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/Prompt"
                      }
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/bot-health": {
      "get": {
        "summary": "Bot health status",
        "description": "Get health status and statistics for AI bot crawling",
        "responses": {
          "200": {
            "description": "Health status information",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BotHealth"
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "Prompt": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "description": "Unique prompt identifier"
          },
          "title": {
            "type": "string",
            "description": "Prompt title"
          },
          "prompt": {
            "type": "string",
            "description": "The actual prompt text"
          },
          "categories": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Categories this prompt belongs to"
          },
          "lang": {
            "type": "string",
            "description": "Language code (e.g., 'en', 'tr')"
          },
          "popularity": {
            "type": "integer",
            "description": "Popularity score"
          }
        },
        "required": ["id", "title", "prompt", "categories"]
      },
      "DatasetMetadata": {
        "type": "object",
        "properties": {
          "total_prompts": {
            "type": "integer",
            "example": 127966
          },
          "categories": {
            "type": "integer",
            "example": 54
          },
          "last_updated": {
            "type": "string",
            "format": "date-time"
          },
          "version": {
            "type": "string",
            "example": "3.0"
          },
          "license": {
            "type": "string",
            "example": "CC BY 4.0"
          }
        }
      },
      "BotHealth": {
        "type": "object",
        "properties": {
          "status": {
            "type": "string",
            "enum": ["healthy", "degraded", "down"]
          },
          "last_crawl": {
            "type": "string",
            "format": "date-time"
          },
          "crawl_frequency": {
            "type": "string",
            "example": "daily"
          },
          "supported_bots": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "example": ["OAI-SearchBot", "PerplexityBot", "ClaudeBot"]
          }
        }
      }
    }
  },
  "tags": [
    {
      "name": "search",
      "description": "Prompt search operations"
    },
    {
      "name": "dataset",
      "description": "Dataset access operations"
    },
    {
      "name": "health",
      "description": "System health and monitoring"
    }
  ]
}
