# Search stacks, creators, and tokens (/indexify-api-documentation/search/search)

```json
[
  {
    "path": "/api/search.php",
    "method": "post",
    "tags": [
      "Search"
    ],
    "summary": "Search stacks, creators, and tokens",
    "description": "Performs a simple stack name search or a faceted search across stacks, creators, and tokens. If any of `filters`, `sort`, or `pagination` keys are present in the body, the faceted search is used; otherwise simple search is used. No authentication required.\n",
    "operationId": "search",
    "requestBody": {
      "required": true,
      "content": {
        "application/json": {
          "schema": {
            "oneOf": [
              {
                "title": "SimpleSearchRequest",
                "type": "object",
                "required": [
                  "query"
                ],
                "properties": {
                  "query": {
                    "type": "string",
                    "description": "Search query string."
                  }
                }
              },
              {
                "title": "FacetedSearchRequest",
                "type": "object",
                "required": [
                  "query"
                ],
                "properties": {
                  "query": {
                    "type": "string",
                    "description": "Search query string."
                  },
                  "filters": {
                    "type": "object",
                    "properties": {
                      "entity_types": {
                        "type": "array",
                        "items": {
                          "type": "string"
                        },
                        "description": "Entity types to include in results (e.g. stacks, creators, tokens)."
                      }
                    }
                  },
                  "sort": {
                    "type": "object",
                    "properties": {
                      "field": {
                        "type": "string",
                        "description": "Field to sort results by."
                      },
                      "direction": {
                        "type": "string",
                        "enum": [
                          "asc",
                          "desc"
                        ],
                        "description": "Sort direction."
                      }
                    }
                  },
                  "pagination": {
                    "type": "object",
                    "properties": {
                      "page": {
                        "type": "integer",
                        "minimum": 1,
                        "default": 1,
                        "description": "Page number."
                      },
                      "per_page": {
                        "type": "integer",
                        "minimum": 1,
                        "maximum": 50,
                        "default": 20,
                        "description": "Results per page."
                      }
                    }
                  }
                }
              }
            ]
          }
        }
      }
    },
    "responses": {
      "200": {
        "description": "Search results. Shape depends on search mode.",
        "content": {
          "application/json": {
            "schema": {
              "oneOf": [
                {
                  "title": "SimpleSearchResponse",
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {
                      "stack_name": {
                        "type": "string"
                      },
                      "stack_id": {
                        "type": "integer"
                      },
                      "slug": {
                        "type": "string"
                      },
                      "description_truncated": {
                        "type": [
                          "string",
                          "null"
                        ]
                      }
                    }
                  }
                },
                {
                  "title": "FacetedSearchResponse",
                  "type": "object",
                  "properties": {
                    "results": {
                      "type": "object",
                      "properties": {
                        "stacks": {
                          "type": "array",
                          "items": {
                            "type": "object"
                          }
                        },
                        "creators": {
                          "type": "array",
                          "items": {
                            "type": "object"
                          }
                        },
                        "tokens": {
                          "type": "array",
                          "items": {
                            "type": "object"
                          }
                        }
                      }
                    },
                    "facets": {
                      "type": "object",
                      "properties": {
                        "categories": {
                          "type": "object"
                        },
                        "price_ranges": {
                          "type": "object"
                        },
                        "market_cap_ranges": {
                          "type": "object"
                        },
                        "creators": {
                          "type": "object"
                        }
                      }
                    },
                    "meta": {
                      "type": "object",
                      "properties": {
                        "total_results": {
                          "type": "integer"
                        },
                        "query": {
                          "type": "string"
                        },
                        "execution_time": {
                          "type": "number",
                          "description": "Search execution time in seconds."
                        },
                        "page": {
                          "type": "integer"
                        },
                        "per_page": {
                          "type": "integer"
                        },
                        "has_more": {
                          "type": "boolean"
                        }
                      }
                    }
                  }
                }
              ]
            }
          }
        }
      },
      "400": {
        "description": "Missing or empty query.",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        }
      },
      "405": {
        "description": "Method not allowed (only POST is accepted).",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        }
      },
      "415": {
        "description": "Unsupported media type (Content-Type must be application/json).",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        }
      },
      "500": {
        "description": "Internal server error.",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        }
      }
    }
  }
]
```