Installation
Install the Respectify SDK for your language and set up authentication.
Installation
- Python
- PHP
- REST API
composer require respectify/respectify-php
Requirements: PHP 7.4+, ReactPHP
No installation needed. Use any HTTP client (curl, httpx, Guzzle, etc.)
Getting Your API Key
- Sign up at respectify.ai
- Go to your API Keys in the dashboard
- Create a new API key
Treat your API key like a password. Never hardcode it in source code. Use environment variables or a secrets manager.
Client Setup
- Python
- PHP
- REST API
Network calls take time. The async client lets your code do other things while waiting, via other coroutines. The blocking client is simpler for straightforward code where parallel requests, or waiting for network responses, isn't an issue. If you're unsure, start with the blocking client.
- Blocking Client
- Async Client
import os
from respectify import RespectifyClient
client = RespectifyClient(
email=os.environ['RESPECTIFY_EMAIL'],
api_key=os.environ['RESPECTIFY_API_KEY']
)
import os
from respectify import RespectifyAsyncClient
client = RespectifyAsyncClient(
email=os.environ['RESPECTIFY_EMAIL'],
api_key=os.environ['RESPECTIFY_API_KEY']
)
The PHP client is async, built on ReactPHP. API calls return promises; call $client->run() to execute the event loop.
use Respectify\RespectifyClientAsync;
$client = new RespectifyClientAsync(
getenv('RESPECTIFY_EMAIL'),
getenv('RESPECTIFY_API_KEY')
);
Include these headers in every request:
curl -X POST https://app.respectify.ai/v0.2/commentscore \
-H "X-User-Email: your@email.com" \
-H "X-API-Key: your-api-key-here" \
-H "Content-Type: application/json" \
-d '{"comment": "...", "article_context_id": "..."}'
Verifying Credentials
Test that your credentials work and check your subscription status:
- Python
- PHP
- REST API
- Blocking Client
- Async Client
result = client.check_user_credentials()
print(f"Active: {result.active}")
print(f"Plan: {result.plan_name}")
print(f"Endpoints: {result.allowed_endpoints}")
result = await client.check_user_credentials()
print(f"Active: {result.active}")
print(f"Plan: {result.plan_name}")
print(f"Endpoints: {result.allowed_endpoints}")
$client->checkUserCredentials()
->then(function ($result) {
echo "Active: " . ($result['active'] ? 'Yes' : 'No') . "\n";
echo "Plan: " . $result['plan_name'] . "\n";
});
$client->run();
curl -X GET https://app.respectify.ai/v0.2/usercheck \
-H "X-User-Email: your@email.com" \
-H "X-API-Key: your-api-key-here"
Response:
{
"active": true,
"status": "ACTIVE",
"plan_name": "Professional",
"allowed_endpoints": ["antispam", "commentscore", "relevance", "dogwhistle", "megacall"],
"expires": "2025-12-31T23:59:59Z"
}