Skip to main content

Overview

Alerts are generated when sensor readings exceed thresholds, sensors go offline, or actuators fail. Each alert belongs to a tenant and can be assigned different severity levels.

Get All Alerts for Tenant

curl -X GET "https://api.invernaderos.com/api/v1/tenants/1/alerts" \
  -H "Authorization: Bearer YOUR_TOKEN"
Retrieve all alerts belonging to a specific tenant.

Path Parameters

tenantId
long
required
Unique identifier of the tenant

Response

id
long
Unique identifier of the alert
code
string
Unique readable code (e.g., “ALT-00001”)
tenantId
long
ID of the tenant that owns this alert
sectorId
long
ID of the sector where the alert occurred
sectorCode
string
Code of the sector (e.g., “SEC-00001”)
alertTypeId
short
ID of the alert type (1=THRESHOLD_EXCEEDED, 2=SENSOR_OFFLINE, 3=ACTUATOR_FAILURE, 4=SYSTEM_ERROR)
alertTypeName
string
Name of the alert type
severityId
short
ID of severity (1=INFO, 2=WARNING, 3=ERROR, 4=CRITICAL)
severityName
string
Name of severity level
severityLevel
short
Numeric severity level (1-4)
message
string
Short descriptive message
description
string
Detailed description of the alert
isResolved
boolean
Whether the alert has been resolved
resolvedAt
timestamp
When the alert was resolved (ISO 8601)
resolvedByUserId
long
ID of the user who resolved the alert
resolvedByUserName
string
Username of the user who resolved the alert
createdAt
timestamp
Creation timestamp (ISO 8601)
updatedAt
timestamp
Last update timestamp (ISO 8601)
[
  {
    "id": 1,
    "code": "ALT-00001",
    "tenantId": 1,
    "sectorId": 5,
    "sectorCode": "SEC-00005",
    "alertTypeId": 1,
    "alertTypeName": "THRESHOLD_EXCEEDED",
    "severityId": 4,
    "severityName": "CRITICAL",
    "severityLevel": 4,
    "message": "Temperatura excede el umbral máximo",
    "description": "Se detectó que la temperatura superó los 35°C durante más de 10 minutos en el sector 5",
    "isResolved": false,
    "resolvedAt": null,
    "resolvedByUserId": null,
    "resolvedByUserName": null,
    "createdAt": "2025-03-03T14:30:00Z",
    "updatedAt": "2025-03-03T14:30:00Z"
  },
  {
    "id": 2,
    "code": "ALT-00002",
    "tenantId": 1,
    "sectorId": 3,
    "sectorCode": "SEC-00003",
    "alertTypeId": 2,
    "alertTypeName": "SENSOR_OFFLINE",
    "severityId": 3,
    "severityName": "ERROR",
    "severityLevel": 3,
    "message": "Sensor de humedad sin respuesta",
    "description": "El sensor HUMI-003 no ha enviado datos en los últimos 30 minutos",
    "isResolved": true,
    "resolvedAt": "2025-03-03T15:45:00Z",
    "resolvedByUserId": 1,
    "resolvedByUserName": "jdoe",
    "createdAt": "2025-03-03T15:00:00Z",
    "updatedAt": "2025-03-03T15:45:00Z"
  }
]

Get Alert by ID

curl -X GET "https://api.invernaderos.com/api/v1/tenants/1/alerts/1" \
  -H "Authorization: Bearer YOUR_TOKEN"
Retrieve a specific alert belonging to a tenant.

Path Parameters

tenantId
long
required
Unique identifier of the tenant
alertId
long
required
Unique identifier of the alert

Response

{
  "id": 1,
  "code": "ALT-00001",
  "tenantId": 1,
  "sectorId": 5,
  "sectorCode": "SEC-00005",
  "alertTypeId": 1,
  "alertTypeName": "THRESHOLD_EXCEEDED",
  "severityId": 4,
  "severityName": "CRITICAL",
  "severityLevel": 4,
  "message": "Temperatura excede el umbral máximo",
  "description": "Se detectó que la temperatura superó los 35°C durante más de 10 minutos en el sector 5",
  "isResolved": false,
  "resolvedAt": null,
  "resolvedByUserId": null,
  "resolvedByUserName": null,
  "createdAt": "2025-03-03T14:30:00Z",
  "updatedAt": "2025-03-03T14:30:00Z"
}

Create Alert

curl -X POST "https://api.invernaderos.com/api/v1/tenants/1/alerts" \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "sectorId": 5,
    "alertTypeId": 1,
    "severityId": 4,
    "message": "Temperatura excede el umbral máximo",
    "description": "Se detectó que la temperatura superó los 35°C durante más de 10 minutos"
  }'
Create a new alert for a tenant.

Path Parameters

tenantId
long
required
Unique identifier of the tenant

Request Body

sectorId
long
required
ID of the sector where the alert occurred
alertTypeId
short
Alert type ID (1=THRESHOLD_EXCEEDED, 2=SENSOR_OFFLINE, 3=ACTUATOR_FAILURE, 4=SYSTEM_ERROR)
severityId
short
Severity ID (1=INFO, 2=WARNING, 3=ERROR, 4=CRITICAL)
message
string
Short descriptive message
description
string
Detailed description of the alert

Response

{
  "id": 3,
  "code": "ALT-00003",
  "tenantId": 1,
  "sectorId": 5,
  "sectorCode": "SEC-00005",
  "alertTypeId": 1,
  "alertTypeName": "THRESHOLD_EXCEEDED",
  "severityId": 4,
  "severityName": "CRITICAL",
  "severityLevel": 4,
  "message": "Temperatura excede el umbral máximo",
  "description": "Se detectó que la temperatura superó los 35°C durante más de 10 minutos",
  "isResolved": false,
  "resolvedAt": null,
  "resolvedByUserId": null,
  "resolvedByUserName": null,
  "createdAt": "2025-03-03T21:55:00Z",
  "updatedAt": "2025-03-03T21:55:00Z"
}

Update Alert

curl -X PUT "https://api.invernaderos.com/api/v1/tenants/1/alerts/1" \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "severityId": 2,
    "message": "Temperatura normalizada"
  }'
Update an existing alert. All fields are optional.

Path Parameters

tenantId
long
required
Unique identifier of the tenant
alertId
long
required
Unique identifier of the alert to update

Request Body

All fields are optional. Only provided fields will be updated.
sectorId
long
ID of the sector (must belong to same tenant)
alertTypeId
short
Alert type ID
severityId
short
Severity ID
message
string
Short descriptive message
description
string
Detailed description

Response

{
  "id": 1,
  "code": "ALT-00001",
  "tenantId": 1,
  "sectorId": 5,
  "sectorCode": "SEC-00005",
  "alertTypeId": 1,
  "alertTypeName": "THRESHOLD_EXCEEDED",
  "severityId": 2,
  "severityName": "WARNING",
  "severityLevel": 2,
  "message": "Temperatura normalizada",
  "description": "Se detectó que la temperatura superó los 35°C durante más de 10 minutos en el sector 5",
  "isResolved": false,
  "resolvedAt": null,
  "resolvedByUserId": null,
  "resolvedByUserName": null,
  "createdAt": "2025-03-03T14:30:00Z",
  "updatedAt": "2025-03-03T22:00:00Z"
}

Resolve Alert

curl -X POST "https://api.invernaderos.com/api/v1/tenants/1/alerts/1/resolve" \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "resolvedByUserId": 1
  }'
Mark an alert as resolved.

Path Parameters

tenantId
long
required
Unique identifier of the tenant
alertId
long
required
Unique identifier of the alert to resolve

Request Body

resolvedByUserId
long
ID of the user resolving the alert (optional)

Response

{
  "id": 1,
  "code": "ALT-00001",
  "tenantId": 1,
  "sectorId": 5,
  "sectorCode": "SEC-00005",
  "alertTypeId": 1,
  "alertTypeName": "THRESHOLD_EXCEEDED",
  "severityId": 4,
  "severityName": "CRITICAL",
  "severityLevel": 4,
  "message": "Temperatura excede el umbral máximo",
  "description": "Se detectó que la temperatura superó los 35°C durante más de 10 minutos en el sector 5",
  "isResolved": true,
  "resolvedAt": "2025-03-03T22:05:00Z",
  "resolvedByUserId": 1,
  "resolvedByUserName": "jdoe",
  "createdAt": "2025-03-03T14:30:00Z",
  "updatedAt": "2025-03-03T22:05:00Z"
}

Reopen Alert

curl -X POST "https://api.invernaderos.com/api/v1/tenants/1/alerts/1/reopen" \
  -H "Authorization: Bearer YOUR_TOKEN"
Reopen a previously resolved alert.

Path Parameters

tenantId
long
required
Unique identifier of the tenant
alertId
long
required
Unique identifier of the alert to reopen

Response

{
  "id": 1,
  "code": "ALT-00001",
  "tenantId": 1,
  "sectorId": 5,
  "sectorCode": "SEC-00005",
  "alertTypeId": 1,
  "alertTypeName": "THRESHOLD_EXCEEDED",
  "severityId": 4,
  "severityName": "CRITICAL",
  "severityLevel": 4,
  "message": "Temperatura excede el umbral máximo",
  "description": "Se detectó que la temperatura superó los 35°C durante más de 10 minutos en el sector 5",
  "isResolved": false,
  "resolvedAt": null,
  "resolvedByUserId": null,
  "resolvedByUserName": null,
  "createdAt": "2025-03-03T14:30:00Z",
  "updatedAt": "2025-03-03T22:10:00Z"
}

Delete Alert

curl -X DELETE "https://api.invernaderos.com/api/v1/tenants/1/alerts/1" \
  -H "Authorization: Bearer YOUR_TOKEN"
Delete an alert from a tenant.

Path Parameters

tenantId
long
required
Unique identifier of the tenant
alertId
long
required
Unique identifier of the alert to delete

Response

# Successfully deleted

Alert Filtering

You can filter alerts using query parameters (implementation may vary):

Filter by Resolution Status

GET /api/v1/tenants/1/alerts?isResolved=false
Returns only unresolved alerts that require attention.

Filter by Alert Type

  • THRESHOLD_EXCEEDED (alertTypeId=1): Sensor readings exceed configured thresholds
  • SENSOR_OFFLINE (alertTypeId=2): Sensor stopped sending data
  • ACTUATOR_FAILURE (alertTypeId=3): Actuator malfunction detected
  • SYSTEM_ERROR (alertTypeId=4): System-level errors

Filter by Severity

Informational messages, no action required.

Build docs developers (and LLMs) love