POST /data-sources/test
Fetches a URL live and evaluates a set of proposed fields against the response without persisting anything. Useful for previewing rule outcomes before saving.

Authentication

Bearer Token (hu_api_key)

Request Body required

application/json
url string (uri) REQUIRED
method string
Enum: GET, POST
headers object | null
root_path string | null
JSONPath root (e.g. `data.services`)
fields object[] REQUIRED
Array of:
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 Per-field evaluation results with fetch timing and raw payload

No response body

502 Fetch failed
curl -X POST 'https://happyuptime.com/api/v1/data-sources/test' \  -H 'Authorization: Bearer YOUR_API_TOKEN' \  -H 'Content-Type: application/json' \  -d '{  "url": "https://example.com",  "method": "GET",  "headers": {},  "root_path": "string",  "fields": [    {      "id": "string",      "path": "string",      "name_template": "string",      "rule_type": "equals",      "rule_config": {},      "degraded_rule_config": {},      "display_order": 0    }  ]}'
const response = await fetch('https://happyuptime.com/api/v1/data-sources/test', {  method: 'POST',  headers: {      "Authorization": "Bearer YOUR_API_TOKEN",      "Content-Type": "application/json"  },  body: JSON.stringify({    "url": "https://example.com",    "method": "GET",    "headers": {},    "root_path": "string",    "fields": [      {        "id": "string",        "path": "string",        "name_template": "string",        "rule_type": "equals",        "rule_config": {},        "degraded_rule_config": {},        "display_order": 0      }    ]  })});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/test', headers=headers, json={  "url": "https://example.com",  "method": "GET",  "headers": {},  "root_path": "string",  "fields": [    {      "id": "string",      "path": "string",      "name_template": "string",      "rule_type": "equals",      "rule_config": {},      "degraded_rule_config": {},      "display_order": 0    }  ]})print(response.json())
502 Response
{  "error": {    "code": "not_found",    "message": "Monitor not found",    "status": 404  }}