Skip to main content
Version: 1.0.0

API Reference

The TwinEdge API provides programmatic access to all platform features. Use it to integrate TwinEdge with your existing systems, automate workflows, or build custom applications.

Base URL

All API requests should be made to:

https://api.twinedgeai.com/v1

Authentication

TwinEdge uses API keys for authentication. Include your API key in the Authorization header:

curl -X GET "https://api.twinedgeai.com/v1/devices" \
-H "Authorization: Bearer YOUR_API_KEY"

To create an API key:

  1. Go to SettingsAPI Keys
  2. Click Create New Key
  3. Set permissions and expiration
  4. Copy and securely store your key
Security

Never expose your API key in client-side code. Always use server-side requests or environment variables.

Rate Limits

API requests are rate limited based on your subscription tier:

TierRequests/MinuteRequests/Day
Trial601,000
Starter30010,000
Professional1,000100,000
EnterpriseCustomCustom

Rate limit headers are included in all responses:

X-RateLimit-Limit: 1000
X-RateLimit-Remaining: 999
X-RateLimit-Reset: 1704067200

Response Format

All responses are JSON with a consistent structure:

Success Response

{
"data": { ... },
"meta": {
"page": 1,
"per_page": 20,
"total": 100
}
}

Error Response

{
"error": {
"code": "RESOURCE_NOT_FOUND",
"message": "Device with ID 'xyz' not found",
"details": { ... }
}
}

Common Error Codes

HTTP StatusCodeDescription
400VALIDATION_ERRORInvalid request parameters
401UNAUTHORIZEDMissing or invalid API key
403FORBIDDENInsufficient permissions
404NOT_FOUNDResource not found
429RATE_LIMITEDToo many requests
500INTERNAL_ERRORServer error

API Endpoints

Telemetry

MethodEndpointDescription
GET/telemetryQuery telemetry data
POST/telemetry/ingestIngest telemetry data
GET/telemetry/latestGet latest values

Devices

MethodEndpointDescription
GET/devicesList all devices
POST/devicesCreate a device
GET/devices/{id}Get device details
PUT/devices/{id}Update a device
DELETE/devices/{id}Delete a device

Dashboards

MethodEndpointDescription
GET/dashboardsList dashboards
POST/dashboardsCreate dashboard
GET/dashboards/{id}Get dashboard
PUT/dashboards/{id}Update dashboard

Alerts

MethodEndpointDescription
GET/alertsList alert rules
POST/alertsCreate alert rule
GET/alerts/eventsGet triggered alerts

ML Models

MethodEndpointDescription
GET/ml/modelsList models
POST/ml/trainingStart training job
GET/ml/predictionsGet predictions

SDKs and Libraries

Official client libraries are available for:

  • Python: pip install twinedge
  • JavaScript/TypeScript: npm install @twinedge/sdk

Webhooks

TwinEdge can send webhooks for events like:

  • Alert triggered
  • Device offline
  • Training job completed

Configure webhooks in SettingsIntegrationsWebhooks.

OpenAPI Specification

The OpenAPI 3.0 specification is available from the API:

  • JSON: https://api.twinedgeai.com/openapi.json
  • YAML: https://api.twinedgeai.com/openapi.yaml

Import into Postman, Insomnia, or your favorite API client.