Skip to content

Word Filter API

The Basic Word Filter API lets you submit text and receive both the original version and a filtered version. The filtered output replaces matched swear words with hash symbols.

Response Format

All successful responses are returned in JSON format.

{
    "credit": "API Data from <a href='https://dev.tylermwise.uk/v1/wordfilter'>tylermwise.com</a>",
    "text": "TEXT_GOES HERE",
    "filter_text": "TEXT_GOES HERE"
}

Response Fields:

  • credit (string) - Attribution text for the API source, returned as HTML.
  • text (string) - The original unfiltered text.
  • filter_text (string) - The filtered version of the submitted text.

Authentication Methods

This endpoint is publicly accessible and does not require authentication.

Characteristics:

  • No authentication required
  • JSON response format
  • Returns both raw and filtered text
  • Suitable for lightweight moderation and content checks

Usage:

curl "https://api.tylermwise.uk/v1/wordfilter?q=TEXT_GOES+HERE"

You can fetch and decode the API response in PHP using file_get_contents() and json_decode().

Example:

<?php
    $contents = file_get_contents("https://api.tylermwise.uk/v1/wordfilter?q=TEXT_GOES+HERE");
    $data = json_decode($contents);
?>

Endpoint

GET /v1/wordfilter

Example Request

curl "https://api.tylermwise.uk/v1/wordfilter?q=TEXT_GOES+HERE"

Example Response

{
    "credit": "API Data from <a href='https://dev.tylermwise.uk/v1/wordfilter'>tylermwise.com</a>",
    "text": "TEXT_GOES HERE",
    "filter_text": "TEXT_GOES HERE"
}

Query Parameters

Parameter Type Required Description
q string Yes The text you want to filter.

PHP Usage

Fetch API Data

<?php
    $contents = file_get_contents("https://api.tylermwise.uk/v1/wordfilter?q=TEXT_GOES+HERE");
    $data = json_decode($contents);
?>

Output Filtered Text

<?php echo $data->filter_text; ?>

Output Unfiltered Text

<?php echo $data->text; ?>

Output API Credit

<?php echo $data->credit; ?>

Response Fields

Field Type Description
credit string Attribution text for the API source.
text string The original submitted text.
filter_text string The filtered text with matched words replaced by #.

Notes

  • The q parameter is passed in the URL query string.
  • If the submitted text contains swear words, the filtered output replaces them with # characters.
  • The endpoint returns both the filtered and unfiltered versions in the same response.
  • The original source asks for attribution when the API is used heavily.

HTTP Status Codes

Standard responses may include:

  • 200 - Success.
  • 400 - Bad Request.
  • 429 - Too Many Requests.
  • 500 - Internal Server Error.

Versioning

This page documents version 1 of the Basic Word Filter API, available under the /v1/ path.