POST /data-sources/{id}/fields
Add a new monitoring field to an existing data source. Creates a child `json_api` monitor for the field. Subject to per-source tier limits.

Authentication

Bearer Token (hu_api_key)

Path Parameters

id string required path

Request Body required

application/json
id string
path string REQUIRED
name_template string REQUIRED
rule_type string REQUIRED
Enum: equals, in, diff_lte, truthy, http_ok
rule_config object REQUIRED
degraded_rule_config unknown
display_order number

Responses

200 Field created
application/json
data object
id string
402 Tier field limit reached
curl -X POST 'https://happyuptime.com/api/v1/data-sources/string/fields' \  -H 'Authorization: Bearer YOUR_API_TOKEN' \  -H 'Content-Type: application/json' \  -d '{  "path": "queue.depth",  "name_template": "Queue Depth",  "rule_type": "diff_lte",  "rule_config": {    "fieldA": "queue.depth",    "fieldB": "queue.depth",    "max": 1000  }}'
const response = await fetch('https://happyuptime.com/api/v1/data-sources/string/fields', {  method: 'POST',  headers: {      "Authorization": "Bearer YOUR_API_TOKEN",      "Content-Type": "application/json"  },  body: JSON.stringify({    "path": "queue.depth",    "name_template": "Queue Depth",    "rule_type": "diff_lte",    "rule_config": {      "fieldA": "queue.depth",      "fieldB": "queue.depth",      "max": 1000    }  })});const data = await response.json();console.log(data);
import requestsheaders = {    'Authorization': 'Bearer YOUR_API_TOKEN'}response = requests.post('https://happyuptime.com/api/v1/data-sources/string/fields', headers=headers, json={  "path": "queue.depth",  "name_template": "Queue Depth",  "rule_type": "diff_lte",  "rule_config": {    "fieldA": "queue.depth",    "fieldB": "queue.depth",    "max": 1000  }})print(response.json())
200 Response
{  "data": {    "id": "<string>"  }}