Functions
Retrieves all functions configured for a device. Functions execute in sequence: Decoder → Transform → Rules (parallel) → Storage (parallel). Schedule functions run independently on cron timers.
Function Types:
decoder
Parse raw bytes to JSON
First (one per device)
transformfn
Modify/enrich data with JSONata
Second (one per device)
rule
Trigger actions on conditions
Third (multiple, parallel)
storagefn
Forward to external storage
Fourth (multiple, parallel)
schedule
Poll external APIs on cron
Independent (multiple)
Function Status:
Active: Function running successfullyFailed: Last execution failed (auto-disabled, email sent)Disabled: Manually disabled by user
Response includes: function_type, status, enabled, last_triggered, debounce_period, template_id
Enter your API key with the Bearer prefix, e.g. "Bearer QB_your_api_key_here"
Project ID (UUID format)
3e5c0246-c759-48e8-8345-27db13f11ff7Device ID
5f8d0d55b54764ca6f3a1234Functions retrieved successfully - Returns array of all function types for the device
Unauthorized - Invalid or missing API key
Device not found or access denied
GET /v2/projects/{project_id}/devices/{device_id}/functions HTTP/1.1
Host: api.qubitro.com
Authorization: YOUR_API_KEY
Accept: */*
{
"functions": [
{
"avatar": "text",
"brand": "text",
"conditionType": "text",
"conditions": [
{
"key": "temperature",
"operator": ">",
"value": "30"
}
],
"created": "text",
"cron_properties": {
"cron_expression": "text",
"timezone": "text"
},
"debounce_period": 1,
"description": "text",
"device_id": "text",
"enabled": true,
"from_template": true,
"function_type": "text",
"id": "text",
"interpreter": "text",
"jsonata": "text",
"last_triggered": "text",
"metadata": {
"ANY_ADDITIONAL_PROPERTY": "anything"
},
"model": "text",
"name": "text",
"project_id": "text",
"reason": "text",
"rule_type": "text",
"scheduled_type": "text",
"script": "text",
"source_type": "text",
"status": "text",
"storage_type": "text",
"template_update": true,
"transformation_id": "text"
}
],
"total_count": 1
}Retrieves complete configuration for a specific function including script/expression, conditions, metadata, credentials, and execution status.
Required Query Parameter:
type: Function type - "decoder", "rule", "storage", "transformation", "scheduled"
Response Includes:
Decoder: script, enabled, status, reason (if failed)
Transform: expression, interpreter (JSONata), enabled
Rule: rule_type, conditions, metadata (webhook URI, headers, body), debounce_period, last_triggered, status
Storage: storagefn_type, metadata (database, collection), cred_meta (encrypted credentials), transform_id, last_triggered
Schedule: schedule_type, cron_data (timezone, cron_spec), metadata (URI, method, headers), last_triggered
Use Cases:
View current function configuration
Debug function failures (check reason field)
Clone function to another device
Audit function settings
Enter your API key with the Bearer prefix, e.g. "Bearer QB_your_api_key_here"
Project ID (UUID format)
3e5c0246-c759-48e8-8345-27db13f11ff7Device ID
5f8d0d55b54764ca6f3a1234Function ID
5f8d0d55b54764ca6f3a1234Function type
rulePossible values: Function retrieved successfully - Includes complete configuration
Invalid function type parameter
Unauthorized - Invalid or missing API key
Function not found
GET /v2/projects/{project_id}/devices/{device_id}/functions/{function_id}?type=decoder HTTP/1.1
Host: api.qubitro.com
Authorization: YOUR_API_KEY
Accept: */*
{
"avatar": "text",
"brand": "text",
"conditionType": "text",
"conditions": [
{
"key": "temperature",
"operator": ">",
"value": "30"
}
],
"created": "text",
"cron_properties": {
"cron_expression": "text",
"timezone": "text"
},
"debounce_period": 1,
"description": "text",
"device_id": "text",
"enabled": true,
"from_template": true,
"function_type": "text",
"id": "text",
"interpreter": "text",
"jsonata": "text",
"last_triggered": "text",
"metadata": {
"ANY_ADDITIONAL_PROPERTY": "anything"
},
"model": "text",
"name": "text",
"project_id": "text",
"reason": "text",
"rule_type": "text",
"scheduled_type": "text",
"script": "text",
"source_type": "text",
"status": "text",
"storage_type": "text",
"template_update": true,
"transformation_id": "text"
}FULL REPLACEMENT: Updates the complete function configuration including script, conditions, metadata, and all settings. Use UpdateConfig for partial updates.
Update Scenarios:
Decoder: Update JavaScript decoder script, change parsing logic
Transform: Update JSONata expression, change field transformations
Rule: Update conditions, webhook URL, email templates, debounce period
Storage: Update connection strings, database/collection names, credentials
Schedule: Update cron schedule, API endpoint, timezone
Required Query Parameter:
type: Function type - "decoder", "rule", "storage", "transformation", "scheduled"
Request Body Examples:
Decoder: {"name": "Decoder", "script": "function decoder(input) {...}", "enabled": true}
Rule: {"name": "Alert", "rule_type": "webhook", "conditions": [...], "metadata": {...}, "debounce_period": 5}
Transform: {"name": "Transform", "expression": "$merge([...])", "interpreter": "JSONata"}
Enter your API key with the Bearer prefix, e.g. "Bearer QB_your_api_key_here"
Project ID (UUID format)
3e5c0246-c759-48e8-8345-27db13f11ff7Device ID
5f8d0d55b54764ca6f3a1234Function ID
5f8d0d55b54764ca6f3a1234Function type
rulePossible values: Function updated successfully - Full configuration replaced
Invalid request body - Check required fields for function type
Unauthorized - Invalid or missing API key
Function not found
PUT /v2/projects/{project_id}/devices/{device_id}/functions/{function_id}?type=decoder HTTP/1.1
Host: api.qubitro.com
Authorization: YOUR_API_KEY
Content-Type: application/json
Accept: */*
Content-Length: 2
{}{
"action": "delete device",
"message": "Operation completed successfully",
"success": true
}PARTIAL UPDATE: Updates only specific configuration fields without touching the script or core settings. Use this for quick changes like updating a webhook URL or debounce period.
Supported Function Types:
Rule: Update webhook URI, headers, body template, debounce_period
Storage: Update database name, collection, connection details
Schedule: Update cron schedule, API endpoint, timezone
Not Supported: Decoder and Transform (use Update endpoint instead)
Required Query Parameter:
type: Function type - "rule", "storage", "scheduled"
Use Cases:
Change webhook URL without modifying conditions
Update debounce period without touching rule logic
Rotate database credentials
Modify cron schedule
Example: Update Rule Webhook URL
{"metadata": {"uri": "https://new-webhook.example.com"}}Enter your API key with the Bearer prefix, e.g. "Bearer QB_your_api_key_here"
Project ID (UUID format)
3e5c0246-c759-48e8-8345-27db13f11ff7Device ID
5f8d0d55b54764ca6f3a1234Function ID
5f8d0d55b54764ca6f3a1234Function type
rulePossible values: Function configuration updated successfully
Invalid request body or unsupported function type
Unauthorized - Invalid or missing API key
Function not found
PUT /v2/projects/{project_id}/devices/{device_id}/functions/{function_id}/config?type=rule HTTP/1.1
Host: api.qubitro.com
Authorization: YOUR_API_KEY
Content-Type: application/json
Accept: */*
Content-Length: 2
{}{
"action": "delete device",
"message": "Operation completed successfully",
"success": true
}QUICK TOGGLE: Enables or disables a function without changing its configuration. Useful for temporary disabling during maintenance or debugging.
Required Query Parameters:
type: Function type - "decoder", "rule", "storage", "transformation", "scheduled"enabled: Boolean - true to enable, false to disable
Behavior:
Disable: Function stops executing, data flow continues without it
Enable: Function resumes execution, applies to new data
Status transitions: Active ↔ Disabled
Use Cases:
Temporarily disable rule during maintenance
Test data pipeline without decoder
Pause storage function to external system
Quick troubleshooting without losing configuration
Note: Failed functions must be fixed and enabled via this endpoint to resume
Enter your API key with the Bearer prefix, e.g. "Bearer QB_your_api_key_here"
Project ID (UUID format)
3e5c0246-c759-48e8-8345-27db13f11ff7Device ID
5f8d0d55b54764ca6f3a1234Function ID
5f8d0d55b54764ca6f3a1234Function type
rulePossible values: Enable (true) or disable (false)
trueFunction status updated successfully
Invalid parameters - Check enabled boolean and type values
Unauthorized - Invalid or missing API key
Function not found
PUT /v2/projects/{project_id}/devices/{device_id}/functions/{function_id}/enabled?type=decoder&enabled=true HTTP/1.1
Host: api.qubitro.com
Authorization: YOUR_API_KEY
Accept: */*
{
"action": "delete device",
"message": "Operation completed successfully",
"success": true
}Last updated