FlatWeb API

Version 1 Documentation

Welcome

FlatWeb API lets you create your own search UI while using the FlatWeb API endpoint to perform searches.

The API currently redirects searches to Google.

Step 1 - Create an input

<input id="search">
<button onclick="search()">Search</button>

Step 2 - Add JavaScript

<script>
function search() {

    const query =
        document.getElementById("search").value;

    window.location.href =
        "https://api.flatweb.pw/v1/search/api?q=" +
        encodeURIComponent(query);

}
</script>

What happens?

  1. User types a search.
  2. Your JavaScript stores it in the query variable.
  3. The browser opens the FlatWeb API.
  4. The FlatWeb API redirects the user to a Google search for that query.

API Endpoint

GET /v1/search/api?q=your search

Example

https://api.flatweb.pw/v1/search/api?q=cats

Redirects to

https://www.google.com/search?q=cats

Complete Example

<input id="search" placeholder="Search...">
<button onclick="search()">Search</button>

<script>
function search(){

    const query =
        document.getElementById("search").value;

    window.location.href =
        "https://api.flatweb.pw/v1/search/api?q=" +
        encodeURIComponent(query);

}
</script>

Done!

You can now build any search engine UI you like. Just send the user's query to /v1/search/api, and the API will handle redirecting the search.