API Reference
SPRAED REST API
> Complete reference for SPRAED's RESTful API with authentication, endpoints, and examples.
API Overview
> RESTful API with JSON responses
Base URL
https://api.spraed.com/v1
All API requests should be made to this base URL with the appropriate endpoint path.
Authentication
Authorization: Bearer YOUR_API_KEY
Include your API key in the Authorization header for all requests.
API Endpoints
> Core endpoints for device and agent management
Devices
GET
/devices
List all connected devices
{
"devices": [
{
"id": "device-123",
"name": "Smart Thermostat",
"type": "thermostat",
"status": "online",
"last_seen": "2024-01-15T10:30:00Z"
}
]
}
POST
/devices
Connect a new device
{
"name": "Smart Thermostat",
"type": "thermostat",
"protocol": "mqtt",
"config": {
"host": "device.local",
"port": 1883
}
}
Agents
GET
/agents
List all AI agents
{
"agents": [
{
"id": "agent-456",
"name": "Temperature Monitor",
"status": "active",
"devices": ["device-123"],
"created_at": "2024-01-15T09:00:00Z"
}
]
}
POST
/agents
Create a new AI agent
{
"name": "Temperature Monitor",
"goal": "Maintain optimal temperature",
"devices": ["device-123"],
"config": {
"target_temp": 72,
"tolerance": 2
}
}
Error Codes
> Standard HTTP status codes and error responses
Common Errors
400 Bad Request:
Invalid request format
401 Unauthorized:
Invalid API key
404 Not Found:
Resource not found
500 Server Error:
Internal server error
Error Response Format
{
"error": {
"code": "INVALID_REQUEST",
"message": "Missing required field: name",
"details": {
"field": "name",
"type": "required"
}
}
}
Ready to Integrate?
> Get your API key and start building today