Blasp
Back to Blog

Getting Started with Blasp: A Quick Integration Guide

A step-by-step guide to integrating the Blasp profanity filtering API into your application.

Integrating Blasp into your application takes just a few minutes. This guide walks you through the process from creating your account to making your first API call.

Step 1: Create an Account

Head to blasp.app and sign up for a free account. You'll get 1,000 API requests per month to start—plenty for testing and small projects.

Step 2: Generate an API Key

Once logged in, navigate to your dashboard and generate an API key. Keep this key secure—it's used to authenticate all your API requests.

Step 3: Make Your First Request

Here's a simple example using cURL:

curl -X POST https://blasp.app/api/filter \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -H "Accept: application/json" \
  -d '{"text": "Some text to check"}'

Step 4: Handle the Response

The API returns a JSON response with the following fields:

{
  "original": "Some text to check",
  "filtered": "Some text to check",
  "has_profanity": false,
  "profanities_count": 0,
  "profanities_found": []
}

Integration Examples

PHP

$ch = curl_init('https://blasp.app/api/filter');
curl_setopt_array($ch, [
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_POST => true,
    CURLOPT_HTTPHEADER => [
        'Authorization: Bearer YOUR_API_KEY',
        'Content-Type: application/json',
        'Accept: application/json',
    ],
    CURLOPT_POSTFIELDS => json_encode(['text' => $userInput]),
]);

$response = curl_exec($ch);
curl_close($ch);

$data = json_decode($response, true);
if ($data['has_profanity']) {
    $cleanedText = $data['filtered'];
}

Node.js

const response = await fetch("https://blasp.app/api/filter", {
  method: "POST",
  headers: {
    "Authorization": "Bearer YOUR_API_KEY",
    "Content-Type": "application/json",
  },
  body: JSON.stringify({ text: userInput }),
});

const data = await response.json();
if (data.has_profanity) {
  // Handle the profanity
  const cleanedText = data.filtered;
}

Python

import requests

response = requests.post(
    "https://blasp.app/api/filter",
    headers={"Authorization": "Bearer YOUR_API_KEY"},
    json={"text": user_input},
)

data = response.json()
if data["has_profanity"]:
    cleaned_text = data["filtered"]

Best Practices

  1. Cache your API key securely in environment variables
  2. Handle errors gracefully—network issues happen
  3. Consider async processing for high-volume applications
  4. Test with edge cases before going to production

Next Steps

Now that you have the basics working, explore our documentation to learn about:

  • Multi-language support
  • Custom word lists
  • Configuring the masking character
  • Rate limiting and best practices

Ready to clean up your content?

Try Blasp free with 1,000 API requests per month.

Get Started for Free