Search

Since there's only one endpoint for searches, this page differs from the other documentation pages in structure.

We use a minimal fuzzy search engine to return search results from requests to the /search?q=${search_query} endpoint. There's currently no rate limit on this API endpoint, but there might be in the future, so always check Rate Limits page.

Request Example

Method: GET

Header
{
    "Content-Type": "application/json"
}

There's no body to this request.

Return Example

200 OK
{
    "posts": [ // An array of posts
        {
            // Post data
        }
    ],
    "users": [ // An array of users
        {
            // User data
        }
    ],
    "communities": [ // An array of communities
        {
            // Community data
        }
    ]
}

400 Bad Request
{
    "error": "Query parameter 'q' is required"
}

This error occurs when the request doesn't contain a search query.


500 Internal Server Error
{
    "error": "Failed to search posts"
}

This error occurs when the API fails to query the posts from the database.


500 Internal Server Error
{
    "error": "Failed to search users"
}

This error occurs when the API fails to query the users from the database.


500 Internal Server Error
{
    "error": "Failed to search communities"
}

This error occurs when the API fails to query the communities from the database.

Formatting

The correct formatting for search queries is: /search?q=this+is+spicy , where whitespace characters get replaced with + characters.

Last updated