API Reference
Scrub provides an OpenAI-compatible API, making it easy to integrate with existing applications.
Base URL
https://api.scrub.health/v1
Authentication
All requests require an API key passed in the Authorization header:
Authorization: Bearer YOUR_SCRUB_API_KEY
See Authentication for details.
Endpoints
| Endpoint | Description |
|---|---|
POST /v1/chat/completions | Create a chat completion (OpenAI-compatible) |
Request Format
Scrub accepts requests in OpenAI's chat completions format. This works regardless of which backend provider you've configured (OpenAI, Anthropic, or Google).
{
"model": "gpt-4",
"messages": [
{"role": "system", "content": "You are a helpful assistant."},
{"role": "user", "content": "Hello!"}
],
"temperature": 0.7,
"max_tokens": 1000
}
Response Format
Responses follow OpenAI's format:
{
"id": "chatcmpl-abc123",
"object": "chat.completion",
"created": 1234567890,
"model": "gpt-4",
"choices": [
{
"index": 0,
"message": {
"role": "assistant",
"content": "Hello! How can I help you today?"
},
"finish_reason": "stop"
}
],
"usage": {
"prompt_tokens": 10,
"completion_tokens": 12,
"total_tokens": 22
}
}
PHI Detection Headers
Scrub adds custom headers to responses indicating PHI detection status:
| Header | Description |
|---|---|
X-Scrub-PHI-Detected | true if PHI was found, false otherwise |
X-Scrub-PHI-Types | Comma-separated list of PHI types detected |
X-Scrub-Request-Id | Unique request ID for audit purposes |