API Reference
This page provides quick reference for the Terragnos Core API. For complete API documentation, see the OpenAPI specification or use the interactive API explorer.
Quick Reference
Base URL
https://core.example.com/v1
Authentication
All requests require a JWT token:
Authorization: Bearer <your-jwt-token>
Common Endpoints
Objects
| Method | Endpoint | Description |
|---|---|---|
GET | /v1/objects | List objects with optional filtering and pagination |
GET | /v1/objects/{id} | Get object by ID (supports asOf parameter for time-travel) |
POST | /v1/objects | Create new object |
PATCH | /v1/objects/{id} | Update object (requires If-Match header for optimistic locking) |
DELETE | /v1/objects/{id} | Delete object |
GET | /v1/objects/{id}/history | Get object history (transaction and valid time) |
Object Types
| Method | Endpoint | Description |
|---|---|---|
GET | /v1/object-types | List object types |
GET | /v1/object-types/{id} | Get object type |
POST | /v1/object-types | Create object type |
PATCH | /v1/object-types/{id} | Update object type |
DELETE | /v1/object-types/{id} | Delete object type |
Workflows
| Method | Endpoint | Description |
|---|---|---|
GET | /v1/workflows | List workflows |
GET | /v1/workflows/{id} | Get workflow definition |
POST | /v1/workflows | Create workflow state machine |
POST | /v1/objects/{id}/workflow/transitions | Trigger workflow transition |
GET | /v1/objects/{id}/workflow/explain-transitions | Explain available transitions and guards |
Automation
| Method | Endpoint | Description |
|---|---|---|
GET | /v1/automation/rules | List automation rules |
POST | /v1/automation/rules | Create automation rule |
GET | /v1/automation/rules/{id} | Get automation rule definition |
PATCH | /v1/automation/rules/{id} | Update automation rule |
POST | /v1/automation/rules/{id}/publish | Publish rule version |
GET | /v1/automation/rules/{id}/runs | List rule execution history |
GET | /v1/automation/rules/{id}/runs/{runId} | Get detailed execution results |
POST | /v1/automation/triggers/{slug} | Trigger webhook automation |
Layers
| Method | Endpoint | Description |
|---|---|---|
GET | /v1/layers/objects | Get GeoJSON layer |
GET | /v1/layers/objects/stream | Stream GeoJSON (NDJSON) |
GET | /v1/layers/tiles/{layer}/{z}/{x}/{y} | Get vector tile (MVT) |
GET | /v1/layers/ogc/features | OGC API Features |
Relations
| Method | Endpoint | Description |
|---|---|---|
GET | /v1/relations | List relations |
POST | /v1/relations | Create relation |
PATCH | /v1/relations/{id} | Update relation |
DELETE | /v1/relations/{id} | Delete relation |
Query Service
| Method | Endpoint | Description |
|---|---|---|
GET | /v1/queries/objects | Simple DTO-based query with filters |
POST | /v1/queries/objects/run | Advanced JSON DSL query with aggregations and complex filters |
Platform Management
| Method | Endpoint | Description |
|---|---|---|
GET | /v1/health/live | Liveness check |
GET | /v1/health/ready | Readiness check |
GET | /v1/auth/me | Current identity |
GET | /v1/license | License status |
POST | /v1/license | Install license |
GET | /v1/permissions/policy | Get RBAC policy |
PUT | /v1/permissions/policy | Update RBAC policy |
GET | /v1/audit/events | List audit events |
GET | /v1/audit/events/{id}/proof | Verify audit event |
Complete API Documentation
OpenAPI Specification
The complete REST API specification is available at:
- Live endpoint:
GET /openapi/v1.json - Static file:
/openapi/v1.json
Import this into:
- Swagger Editor
- Postman
- Insomnia
- API testing tools
GraphQL Schema
The GraphQL schema is available at:
- Live endpoint:
GET /graphql/schema.gql - Static file:
/graphql/schema.gql
Use with GraphQL clients:
- GraphQL Playground
- Apollo Studio
- Altair GraphQL Client
SDKs
For easier integration, use the official SDKs:
SDKs provide type-safe interfaces and handle authentication automatically.
Error Codes
| Code | Meaning | Common Causes |
|---|---|---|
400 | Bad Request | Invalid request data, missing required fields |
401 | Unauthorized | Missing or invalid JWT token |
403 | Forbidden | Insufficient permissions, license limit exceeded |
404 | Not Found | Resource doesn't exist |
409 | Conflict | Optimistic locking conflict, duplicate resource |
429 | Too Many Requests | Rate limit exceeded |
500 | Internal Server Error | Server error, database connection issue |
Rate Limiting
Default limits:
- Window: 60 seconds
- Limit: 120 requests per window
When exceeded, the API returns 429 Too Many Requests with a Retry-After header.
Pagination
List endpoints support pagination:
GET /v1/objects?limit=25&offset=0
Response includes pagination metadata:
{
"items": [...],
"pagination": {
"limit": 25,
"offset": 0,
"total": 150,
"hasMore": true
}
}
Time-Travel Queries
Many read endpoints support time-travel using the asOf parameter:
# Get object state at specific time
GET /v1/objects/{id}?asOf=2024-01-15T10:30:00Z
# List objects as they existed at a point in time
GET /v1/objects?asOf=2024-01-15T10:30:00Z
# Get layer data at specific time
GET /v1/layers/objects?asOf=2024-01-15T10:30:00Z
The asOf parameter accepts ISO 8601 timestamps. Returns the state of data at that point in time, enabling historical queries and audit trails.
Versioning
The API uses URL-based versioning:
- Current version:
v1 - Future versions:
v2,v3, etc.
Breaking changes only occur in major version updates.