API Endpoints
ApiRules provides a comprehensive set of endpoints for managing your APIs and rules.
Authentication
All API requests require an API key to be included in the header:
Authorization: Bearer your-api-key
Validation Endpoint
The /v1/check
endpoint allows you to perform custom validation requests against your configured rules.
Request
POST /v1/check
Headers
Authorization: Bearer your-api-key
Content-Type: application/json
x-openai-token: your-openai-token # Optional: Use your own OpenAI token
Request Body
{
"endpointId": "string", // Required: The ID of the endpoint to validate against
"payload": "string", // Required: The content to validate
"mode": "strict|advisory" // Required: Validation mode
}
Response
Success Response (200 OK)
{
"decision": true | false // on validation rules and LLM response
}
Error Responses
- 400 Bad Request
{
"errors": [
{
"type": "field",
"msg": "endpointId is required",
"path": "endpointId",
"location": "body"
}
]
}
- 401 Unauthorized
{
"error": "Missing API key"
}
- 403 Forbidden
{
"error": "Invalid API key"
}
- 429 Too Many Requests
{
"error": "Too many requests, please try again later."
}
Example Usage
// Using fetch JS
const response = await fetch('https://api.apirules.io/v1/check', {
method: 'POST',
headers: {
'Authorization': 'Bearer your-api-key',
'Content-Type': 'application/json'
},
body: JSON.stringify({
endpointId: 'createComment',
payload: 'Hello, world!',
mode: 'strict'
})
});
const decision = await response.json();
# Using requests PYTHON
import requests
response = requests.post(
'https://api.apirules.io/v1/check',
headers={
'Authorization': 'Bearer your-api-key',
'Content-Type': 'application/json'
},
json={
'endpointId': 'createComment',
'payload': 'Hello, world!',
'mode': 'strict'
}
)
result = response.json()
Notes
- The endpoint is rate-limited to protect against abuse
- You can use your own OpenAI token by including it in the
x-openai-token
header - The response is cached for performance optimization
- All validation attempts are logged for monitoring and auditing