Skip to content

Shapes

Shapes define the structure of things in a repository. These endpoints manage shapes directly — as an alternative to creating and revising shapes through the commit endpoint.

All paths are prefixed with /api/repos/:orgName/:repoName.


List all shapes in a repository.

Auth: None (public repos). Private repos require authentication.

[
{
"name": "Sensor",
"kind": "shape",
"active": true,
"version": {
"version": 2,
"operation": "revise",
"data": {
"fields": { "location": "string", "type": "string", "unit": "string" }
},
"dataHash": "a1b2c3d4"
}
}
]
Terminal window
curl "https://api.warmhub.ai/api/repos/myorg/myrepo/shapes"

Get a single shape by name.

Auth: None (public repos). Private repos require authentication.

ParameterTypeDescription
shapeNamestringShape name (URL-encoded)
{
"name": "Sensor",
"kind": "shape",
"active": true,
"version": {
"version": 2,
"operation": "revise",
"data": {
"fields": { "location": "string", "type": "string", "unit": "string" }
},
"dataHash": "a1b2c3d4"
}
}
CodeStatusDescription
NOT_FOUND404Shape not found
Terminal window
curl "https://api.warmhub.ai/api/repos/myorg/myrepo/shapes/Sensor"

Create a new shape.

Auth: Required, repo:write scope.

FieldTypeRequiredDescription
namestringYesShape name
fieldsobjectYesSchema definition object

The name field also accepts shapeName as an alias.

{
"name": "Sensor",
"operation": "add",
"version": 1,
"dataHash": "a1b2c3d4"
}
CodeStatusDescription
ALREADY_EXISTS409A shape with this name already exists
VALIDATION_ERROR400Invalid shape name or fields
RESERVED_NAME400The name is reserved by the system
RATE_LIMITED429Too many shape creation requests. Honor Retry-After before retrying.
Terminal window
curl -X POST https://api.warmhub.ai/api/repos/myorg/myrepo/shapes \
-H "Authorization: Bearer <token>" \
-H "Content-Type: application/json" \
-d '{
"name": "Sensor",
"fields": { "location": "string", "type": "string" }
}'

Revise a shape’s fields. This creates a new version of the shape.

Auth: Required, repo:write scope.

ParameterTypeDescription
shapeNamestringShape name (URL-encoded)
FieldTypeRequiredDescription
fieldsobjectYesUpdated field definitions
{
"name": "Sensor",
"operation": "revise",
"version": 2,
"dataHash": "e5f6g7h8"
}
CodeStatusDescription
NOT_FOUND404Shape not found
VALIDATION_ERROR400Invalid fields
RATE_LIMITED429Too many shape update requests. Honor Retry-After before retrying.
Terminal window
curl -X PATCH https://api.warmhub.ai/api/repos/myorg/myrepo/shapes/Sensor \
-H "Authorization: Bearer <token>" \
-H "Content-Type: application/json" \
-d '{
"fields": { "location": "string", "type": "string", "unit": "string" }
}'

Delete a shape. This deactivates the shape itself. Things and assertions under the shape are not automatically deactivated — deactivate them separately if needed.

Auth: Required, repo:write scope.

ParameterTypeDescription
shapeNamestringShape name (URL-encoded)
{
"ok": true
}
CodeStatusDescription
NOT_FOUND404Shape not found
RATE_LIMITED429Too many shape delete requests. Honor Retry-After before retrying.
Terminal window
curl -X DELETE https://api.warmhub.ai/api/repos/myorg/myrepo/shapes/Sensor \
-H "Authorization: Bearer <token>"