API Overview
NopeSight provides a comprehensive REST API for all platform features.
Base URL
https://your-instance.nopesight.com/api
Authentication
API Token
# Header
Authorization: Bearer your-api-token
# Example
curl -H "Authorization: Bearer your-api-token" \
https://api.nopesight.com/api/cmdb/ci
JWT Authentication
# Login
POST /api/auth/login
{
"username": "user",
"password": "password"
}
# Response
{
"token": "jwt-token",
"refreshToken": "refresh-token"
}
Core Endpoints
CMDB APIs
# Configuration Items
GET /api/cmdb/ci # List CIs
POST /api/cmdb/ci # Create CI
GET /api/cmdb/ci/:id # Get CI
PUT /api/cmdb/ci/:id # Update CI
DELETE /api/cmdb/ci/:id # Delete CI
# Relationships
GET /api/cmdb/relationships # List relationships
POST /api/cmdb/relationships # Create relationship
Discovery APIs
# Scan Data
POST /api/discovery/scan-data # Submit scan data
GET /api/discovery/scan-data # List scan data
# Tokens
POST /api/discovery/tokens # Create token
GET /api/discovery/tokens # List tokens
Event APIs
# Events
POST /api/events/ingest # Ingest event
GET /api/events # List events
GET /api/events/:id # Get event
PATCH /api/events/:id/status # Update status
# Webhooks
POST /api/events/webhook/:source
AI APIs
# Analysis
POST /api/ai/analyze # Analyze text/CI
POST /api/ai/generate-insights # Generate insights
POST /api/ai/discover-relationships
# Search
GET /api/ai/search-semantic # Semantic search
Request Format
Headers
Content-Type: application/json
Authorization: Bearer token
X-Department: IT
Request Body
{
"name": "server-01",
"type": "Server",
"attributes": {
"os": "Ubuntu 22.04",
"ip": "192.168.1.10"
}
}
Response Format
Success Response
{
"success": true,
"data": {
"_id": "123",
"name": "server-01",
"type": "Server"
}
}
Error Response
{
"success": false,
"error": {
"code": "VALIDATION_ERROR",
"message": "Invalid input",
"details": {
"field": "name",
"reason": "Required field"
}
}
}
Pagination
Query Parameters
GET /api/cmdb/ci?page=1&limit=20&sort=-createdAt
Response
{
"data": [...],
"pagination": {
"page": 1,
"limit": 20,
"total": 150,
"pages": 8
}
}
Rate Limiting
Limits
- Standard: 100 requests/minute
- Bulk operations: 10 requests/minute
- AI endpoints: 10 requests/minute
Headers
X-RateLimit-Limit: 100
X-RateLimit-Remaining: 95
X-RateLimit-Reset: 1640995200
Error Codes
| Code | Description |
|---|---|
| 400 | Bad Request |
| 401 | Unauthorized |
| 403 | Forbidden |
| 404 | Not Found |
| 429 | Too Many Requests |
| 500 | Internal Server Error |
Best Practices
- Use pagination for large datasets
- Include proper error handling
- Respect rate limits
- Use appropriate HTTP methods
- Include descriptive user agents
- Handle token expiration
SDK Support
JavaScript/TypeScript
import { NopeSightClient } from '@nopesight/sdk';
const client = new NopeSightClient({
apiKey: 'your-api-key',
baseUrl: 'https://api.nopesight.com'
});
const cis = await client.cmdb.listCIs();
Python
from nopesight import Client
client = Client(api_key='your-api-key')
cis = client.cmdb.list_cis()