AI field discovery
Fetches a URL (or uses a provided `sample_json`) and uses AI to suggest monitoring fields with rule configs. Each suggestion includes a dry-eval against the live payload.
POST
/data-sources/discover
Fetches a URL (or uses a provided `sample_json`) and uses AI to suggest monitoring fields with rule configs. Each suggestion includes a dry-eval against the live payload.
Authentication
Bearer Token (hu_api_key)
Request Body required
application/jsonurl
string (uri)
URL to fetch (required unless sample_json is provided)
method
string
Enum:
GET, POSTheaders
object | null
auth_type
string | null
Enum:
basic, bearer, api_keyauth_config
object | null
sample_json
unknown
Pre-fetched JSON payload (skips the live fetch)
Responses
200
Suggested fields with dry-eval results and prompt version
No response body
429
AI usage limit reached
502
Fetch failed or AI returned invalid schema
curl -X POST 'https://happyuptime.com/api/v1/data-sources/discover' \ -H 'Authorization: Bearer YOUR_API_TOKEN' \ -H 'Content-Type: application/json' \ -d '{ "url": "https://example.com", "method": "GET", "headers": {}, "auth_type": "basic", "auth_config": {}, "sample_json": null}'
const response = await fetch('https://happyuptime.com/api/v1/data-sources/discover', { method: 'POST', headers: { "Authorization": "Bearer YOUR_API_TOKEN", "Content-Type": "application/json" }, body: JSON.stringify({ "url": "https://example.com", "method": "GET", "headers": {}, "auth_type": "basic", "auth_config": {}, "sample_json": null })});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/discover', headers=headers, json={ "url": "https://example.com", "method": "GET", "headers": {}, "auth_type": "basic", "auth_config": {}, "sample_json": null})print(response.json())
429
Response
{ "error": { "code": "not_found", "message": "Monitor not found", "status": 404 }}
API Playground
Try this endpoint
POST
/data-sources/discover