Skip to Content
APIsConstraints

The Constraint Engine is the central geospatial store for the UDAI platform. All geographic shapes (mission envelopes, flight plan envelopes, airspace restriction zones, geofences, asset corridors) are stored here as PostGIS geometries. Business records (Mission, Flight Plan, Airspace Zone) reference their shape via constraint_uuid.

Access: POST /constraints, GET /constraints/{uuid}, and POST /constraints/intersect are gated by JWT and organisation policies (AdminPlus for create). See Access control.

Data Model: Constraint

Enum: constraint_type: 1=Mission, 2=Flight Plan, 3=Airspace Zone, 4=Geofence, 5=Asset Corridor, 6=Weather Cell


Constraint Engine Endpoints Summary

EndpointMethodOperation NameDescription
/constraintsPOSTCreate ConstraintCreate a new spatial constraint
/constraints/\{constraint_uuid\}GETGet One ConstraintGet specific constraint details
/constraints/intersectPOSTGet Constraint IntersectionsQuery constraints by geospatial intersection

Create Constraint

POST /constraints

Request Body:

{ "constraint_type": 2, "ref_uuid": "c1d2e3f4-1234-4abc-9000-aabbccddeeff", "geometry_2d": { "type": "Polygon", "coordinates": [ [ [ 77.123, 28.567 ], [ 77.124, 28.567 ], [ 77.124, 28.566 ], [ 77.123, 28.566 ], [ 77.123, 28.567 ] ] ] }, "min_height": 30, "max_height": 120, "active_from": "2025-07-05T08:00:00Z", "active_to": "2025-07-05T09:30:00Z", "metadata": { "priority": 2 } }

Responses:

  • 201 Created:
{ "message": "Constraint created successfully", "data": { ... } }
  • 400 Bad Request:
{ "error": "'constraint_type' must be a valid constraint type enum (1–6)" }
  • 409 Conflict:
{ "error": "A constraint for this ref_uuid already exists" }
  • 422 Unprocessable Entity:
{ "error": "'geometry_2d' must be a valid closed GeoJSON Polygon" }

Get One Constraint

GET /constraints/{constraint_uuid}

Responses:

  • 200 OK:
{ "data": { "constraint_uuid": "cst-a1b2c3d4-e5f6-7890-abcd-ef1234567890", "constraint_type": 2, "ref_uuid": "c1d2e3f4-1234-4abc-9000-aabbccddeeff", "geometry_2d": { "type": "Polygon", "coordinates": [ [ [ 77.123, 28.567 ], [ 77.124, 28.567 ], [ 77.124, 28.566 ], [ 77.123, 28.566 ], [ 77.123, 28.567 ] ] ] }, "min_height": 30, "max_height": 120, "active_from": "2025-07-05T08:00:00Z", "active_to": "2025-07-05T09:30:00Z", "metadata": { "priority": 2 }, "created_at": "2025-07-04T18:00:00Z", "updated_at": "2025-07-04T18:00:00Z" } }
  • 404 Not Found:
{ "error": "Constraint not found" }

Get Constraint Intersections

The primary function of the Constraint Engine: answer the question: “what constraints overlap this volume/trajectory?”

POST /constraints/intersect

Query all constraints whose 2D footprint intersects the given polygon, optionally filtered by height range, time window, and constraint type.

Request Body:

{ "geometry_2d": { "type": "Polygon", "coordinates": [ [ [ 77.1, 28.55 ], [ 77.2, 28.55 ], [ 77.2, 28.45 ], [ 77.1, 28.45 ], [ 77.1, 28.55 ] ] ] }, "min_height": 0, "max_height": 150, "active_from": "2025-07-05T08:00:00Z", "active_to": "2025-07-05T10:00:00Z", "constraint_types": [ 1, 2, 3 ] }
FieldTypeDescription
geometry_2dGeoJSON PolygonThe footprint to check intersections against
min_height / max_heightdoubleAltitude range filter (metres AGL)
active_from / active_totimestamp (optional)Only return constraints active within this window
constraint_typesint[] (optional)Filter to specific constraint types: omit for all

Responses:

  • 200 OK:
{ "data": { "query_geometry": { "type": "Polygon", "coordinates": [ [ [ 77.1, 28.55 ], [ 77.2, 28.55 ], [ 77.2, 28.45 ], [ 77.1, 28.45 ], [ 77.1, 28.55 ] ] ] }, "result_count": 1, "constraints": [ { "constraint_uuid": "cst-zone-001", "constraint_type": 3, "ref_uuid": "4f39caae-2a73-426e-bb0c-239e25a01a14", "min_height": 0, "max_height": 400, "active_from": null, "active_to": null, "metadata": { "zone_type": 1, "restriction_level": "RED" } } ] } }
  • 400 Bad Request:
{ "error": "'constraint_types' contains an invalid type value" }
  • 422 Unprocessable Entity:
{ "error": "'geometry_2d' must be a valid closed GeoJSON Polygon" }
Last updated on