API Reference
Complete reference for the FaraCore REST API endpoints.
Base URL
All API endpoints are prefixed with /v1:
http://127.0.0.1:8000/v1Authentication
If FARA_AUTH_TOKEN is set, include it in the Authorization header:
Authorization: Bearer your-tokenActions
POST /v1/actions
Submit an action for evaluation.
curl -X POST http://127.0.0.1:8000/v1/actions \
-H "Content-Type: application/json" \
-d '{
"agent_id": "my-agent",
"tool": "shell",
"operation": "run",
"params": {"cmd": "ls -la"},
"context": {"environment": "production"}
}'Request Body:
agent_id(string, required) - Agent identifiertool(string, required) - Tool nameoperation(string, required) - Operation nameparams(object, optional) - Action parameterscontext(object, optional) - Additional context
Response: Action object with id, status, decision, reason, etc.
GET /v1/actions/{id}
Get details of a specific action.
curl http://127.0.0.1:8000/v1/actions/abc123Response: Complete action object
GET /v1/actions
List actions with optional filters.
# List all actions
curl http://127.0.0.1:8000/v1/actions
# Filter by status
curl "http://127.0.0.1:8000/v1/actions?status=pending_approval"
# Filter by agent
curl "http://127.0.0.1:8000/v1/actions?agent_id=my-agent"
# Filter by tool
curl "http://127.0.0.1:8000/v1/actions?tool=shell"Query Parameters:
status- Filter by statusagent_id- Filter by agent IDtool- Filter by tool namelimit- Limit number of resultsoffset- Offset for pagination
POST /v1/actions/{id}/approval
Approve or deny an action.
curl -X POST http://127.0.0.1:8000/v1/actions/abc123/approval \
-H "Content-Type: application/json" \
-d '{
"token": "approval-token",
"approve": true,
"reason": "Approved for deployment"
}'Request Body:
token(string, required) - Approval token from actionapprove(boolean, required) - true to approve, false to denyreason(string, optional) - Reason for approval/denial
POST /v1/actions/{id}/start
Start execution of an approved action.
curl -X POST http://127.0.0.1:8000/v1/actions/abc123/startPOST /v1/actions/{id}/result
Report the result of an executed action.
curl -X POST http://127.0.0.1:8000/v1/actions/abc123/result \
-H "Content-Type: application/json" \
-d '{
"status": "succeeded",
"output": "Command output here",
"error": null
}'Events
GET /v1/events
Stream real-time events via Server-Sent Events (SSE).
curl -N http://127.0.0.1:8000/v1/eventsQuery Parameters:
status- Filter by statusagent_id- Filter by agent IDtool- Filter by tool name
Event Format:
data: {"type":"action.created","data":{"id":"abc123","status":"pending_approval",...},"timestamp":"2024-01-01T00:00:00Z"}System
GET /health
Health check endpoint. Always returns 200 OK.
curl http://127.0.0.1:8000/healthGET /ready
Readiness check endpoint. Verifies database connectivity.
curl http://127.0.0.1:8000/readyGET /metrics
Prometheus metrics endpoint.
curl http://127.0.0.1:8000/metricsGET /docs
Interactive API documentation (Swagger UI).
http://127.0.0.1:8000/docsResponse Format
All endpoints return JSON. Success responses include the requested data. Error responses include:
{
"error": {
"code": "ERROR_CODE",
"message": "Human-readable error message"
}
}Status Codes
200- Success201- Created400- Bad Request401- Unauthorized404- Not Found422- Validation Error500- Internal Server Error