Skip to content

Services API Reference

Overview

The Services API enables programmatic management of monitoring services in UptimeHunt. Services represent individual monitoring targets, such as HTTP endpoints or network hosts, that are checked at regular intervals by the global probe network.

Service Types

UptimeHunt supports the following service types:

HTTP Service

Monitor HTTP/HTTPS endpoints with comprehensive request configuration including: - Multiple HTTP methods (GET, POST, HEAD) - Authentication (Basic, Bearer Token) - Custom headers - Request body data - Response validation

PING Service

Monitor network connectivity using ICMP ping for: - IPv4 and IPv6 addresses - Domain names (resolved to IP) - Round-trip time measurement - Packet loss detection

Authentication

All Services API endpoints require authentication using a JWT Bearer token. Include the token in the Authorization header:

Authorization: Bearer <your_access_token>

Endpoints

List All Services

Retrieve all monitoring services for the authenticated user.

Endpoint: GET /api/v1/services

Authentication: Required

Query Parameters:

Parameter Type Required Description
project_id integer No Filter services by project ID. Use "null" for unassigned services
enabled boolean No Filter by enabled status (true/false)
type string No Filter by service type (http, ping)

Response Format:

{
  "data": [
    {
      "id": 1,
      "name": "Production API",
      "type": "http",
      "enabled": true,
      "interval": 3,
      "project_id": 5,
      "project": {
        "id": 5,
        "name": "Production Services",
        "color": "#3B82F6",
        "icon": "server"
      },
      "config": {
        "method": "GET",
        "url": "https://api.example.com/health",
        "auth_type": "bearer",
        "headers": [
          {
            "name": "Accept",
            "value": "application/json"
          }
        ]
      },
      "date_created": "2025-10-01T14:30:00Z",
      "date_modified": "2025-10-05T09:15:00Z"
    },
    {
      "id": 2,
      "name": "Database Server",
      "type": "ping",
      "enabled": true,
      "interval": 5,
      "project_id": null,
      "project": null,
      "config": {
        "ip": "192.168.1.100"
      },
      "date_created": "2025-10-02T10:00:00Z",
      "date_modified": "2025-10-02T10:00:00Z"
    }
  ],
  "meta": {
    "total": 2
  }
}

Status Codes:

Code Description
200 Success
401 Unauthorized - Invalid or missing authentication token

cURL Example:

curl -X GET "https://api.uptimehunt.com/api/v1/services" \
  -H "Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..."

Filter by Project:

curl -X GET "https://api.uptimehunt.com/api/v1/services?project_id=5" \
  -H "Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..."

Filter by Enabled Status:

curl -X GET "https://api.uptimehunt.com/api/v1/services?enabled=true" \
  -H "Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..."

Create a Service

Create a new monitoring service.

Endpoint: POST /api/v1/services

Authentication: Required

Request Body:

The request body varies based on service type. All services require common fields, with additional type-specific fields.

Common Fields:

Field Type Required Description
type string Yes Service type: "http" or "ping"
name string Yes Service name (max 128 characters)
enabled boolean No Enable/disable monitoring (default: true)
interval integer No Check interval in minutes (default: 3)
project_id integer No Associate service with a project

HTTP Service Fields:

Field Type Required Description
url string Yes URL to monitor (max 4096 characters)
method string No HTTP method: GET, POST, HEAD (default: GET)
auth_type string No Authentication: none, basic, bearer (default: none)
auth_username string No Username for basic authentication
auth_password string No Password for basic authentication
auth_bearer_token string No Bearer token for token authentication
post_data string No Request body for POST requests
headers array No Array of custom headers [{name, value}]

PING Service Fields:

Field Type Required Description
ip string Yes IP address or domain name (max 255 characters)

Response Format:

Returns the created service with an HTTP 201 status.

{
  "id": 3,
  "name": "Production API",
  "type": "http",
  "enabled": true,
  "interval": 3,
  "project_id": null,
  "project": null,
  "config": {
    "method": "GET",
    "url": "https://api.example.com/health",
    "auth_type": "none",
    "headers": []
  },
  "date_created": "2025-10-05T15:30:00Z",
  "date_modified": "2025-10-05T15:30:00Z"
}

Status Codes:

Code Description
201 Service created successfully
400 Bad request - Invalid or missing required fields
401 Unauthorized - Invalid or missing authentication token
422 Validation error - Invalid field values

Example 1: Create Simple HTTP Service (GET request)

curl -X POST "https://api.uptimehunt.com/api/v1/services" \
  -H "Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..." \
  -H "Content-Type: application/json" \
  -d '{
    "type": "http",
    "name": "Website Homepage",
    "enabled": true,
    "interval": 3,
    "url": "https://www.example.com",
    "method": "GET"
  }'

Example 2: Create HTTP Service with Basic Authentication

curl -X POST "https://api.uptimehunt.com/api/v1/services" \
  -H "Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..." \
  -H "Content-Type: application/json" \
  -d '{
    "type": "http",
    "name": "Protected API Endpoint",
    "enabled": true,
    "interval": 5,
    "url": "https://api.example.com/protected",
    "method": "GET",
    "auth_type": "basic",
    "auth_username": "api_user",
    "auth_password": "secure_password"
  }'

Example 3: Create HTTP Service with Bearer Token and Custom Headers

curl -X POST "https://api.uptimehunt.com/api/v1/services" \
  -H "Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..." \
  -H "Content-Type: application/json" \
  -d '{
    "type": "http",
    "name": "REST API with Token",
    "enabled": true,
    "interval": 3,
    "url": "https://api.example.com/v1/status",
    "method": "GET",
    "auth_type": "bearer",
    "auth_bearer_token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIn0",
    "headers": [
      {
        "name": "Accept",
        "value": "application/json"
      },
      {
        "name": "X-API-Version",
        "value": "v1"
      }
    ]
  }'

Example 4: Create HTTP Service with POST Data

curl -X POST "https://api.uptimehunt.com/api/v1/services" \
  -H "Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..." \
  -H "Content-Type: application/json" \
  -d '{
    "type": "http",
    "name": "Webhook Endpoint",
    "enabled": true,
    "interval": 10,
    "url": "https://webhooks.example.com/test",
    "method": "POST",
    "post_data": "{\"event\": \"heartbeat\", \"timestamp\": \"{{timestamp}}\"}",
    "headers": [
      {
        "name": "Content-Type",
        "value": "application/json"
      }
    ]
  }'

Example 5: Create PING Service

curl -X POST "https://api.uptimehunt.com/api/v1/services" \
  -H "Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..." \
  -H "Content-Type: application/json" \
  -d '{
    "type": "ping",
    "name": "Database Server",
    "enabled": true,
    "interval": 5,
    "ip": "192.168.1.100"
  }'

Example 6: Create PING Service with Domain Name

curl -X POST "https://api.uptimehunt.com/api/v1/services" \
  -H "Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..." \
  -H "Content-Type: application/json" \
  -d '{
    "type": "ping",
    "name": "DNS Server",
    "enabled": true,
    "interval": 3,
    "ip": "dns.google.com"
  }'

Example 7: Create Service with Project Assignment

curl -X POST "https://api.uptimehunt.com/api/v1/services" \
  -H "Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..." \
  -H "Content-Type: application/json" \
  -d '{
    "type": "http",
    "name": "Production API",
    "enabled": true,
    "interval": 3,
    "project_id": 5,
    "url": "https://api.example.com/health",
    "method": "GET"
  }'

Get Service Details

Retrieve details for a specific service.

Endpoint: GET /api/v1/services/{id}

Authentication: Required

Path Parameters:

Parameter Type Required Description
id integer Yes Service ID

Response Format:

{
  "data": {
    "id": 1,
    "name": "Production API",
    "type": "http",
    "enabled": true,
    "interval": 3,
    "project_id": 5,
    "project": {
      "id": 5,
      "name": "Production Services",
      "color": "#3B82F6",
      "icon": "server"
    },
    "config": {
      "method": "GET",
      "url": "https://api.example.com/health",
      "auth_type": "bearer",
      "auth_bearer_token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...",
      "headers": [
        {
          "name": "Accept",
          "value": "application/json"
        }
      ]
    },
    "date_created": "2025-10-01T14:30:00Z",
    "date_modified": "2025-10-05T09:15:00Z"
  }
}

Status Codes:

Code Description
200 Success
401 Unauthorized - Invalid or missing authentication token
404 Service not found or does not belong to authenticated user

cURL Example:

curl -X GET "https://api.uptimehunt.com/api/v1/services/1" \
  -H "Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..."

Update Service

Update an existing service. This endpoint supports partial updates (PATCH semantics).

Endpoint: PUT /api/v1/services/{id} or PATCH /api/v1/services/{id}

Authentication: Required

Path Parameters:

Parameter Type Required Description
id integer Yes Service ID

Request Body:

Only include fields you want to update. The type field cannot be changed after creation.

Common Updatable Fields:

Field Type Description
name string Service name
enabled boolean Enable/disable monitoring
interval integer Check interval in minutes
project_id integer Project association (use null to unassign)

HTTP Service Updatable Fields:

Field Type Description
url string URL to monitor
method string HTTP method
auth_type string Authentication type
auth_username string Basic auth username
auth_password string Basic auth password
auth_bearer_token string Bearer token
post_data string Request body
headers array Custom headers

PING Service Updatable Fields:

Field Type Description
ip string IP address or domain

Response Format:

Returns the updated service.

{
  "data": {
    "id": 1,
    "name": "Updated API Name",
    "type": "http",
    "enabled": false,
    "interval": 5,
    "project_id": 5,
    "project": {
      "id": 5,
      "name": "Production Services",
      "color": "#3B82F6",
      "icon": "server"
    },
    "config": {
      "method": "GET",
      "url": "https://api.example.com/health",
      "auth_type": "bearer",
      "headers": []
    },
    "date_created": "2025-10-01T14:30:00Z",
    "date_modified": "2025-10-05T16:45:00Z"
  }
}

Status Codes:

Code Description
200 Service updated successfully
400 Bad request - Invalid field values
401 Unauthorized - Invalid or missing authentication token
404 Service not found or does not belong to authenticated user
422 Validation error - Invalid field values

Example 1: Update Service Name and Interval

curl -X PUT "https://api.uptimehunt.com/api/v1/services/1" \
  -H "Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..." \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Updated Service Name",
    "interval": 10
  }'

Example 2: Disable a Service

curl -X PATCH "https://api.uptimehunt.com/api/v1/services/1" \
  -H "Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..." \
  -H "Content-Type: application/json" \
  -d '{
    "enabled": false
  }'

Example 3: Update HTTP Service URL and Headers

curl -X PUT "https://api.uptimehunt.com/api/v1/services/1" \
  -H "Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..." \
  -H "Content-Type: application/json" \
  -d '{
    "url": "https://api.example.com/v2/health",
    "headers": [
      {
        "name": "Accept",
        "value": "application/json"
      },
      {
        "name": "X-API-Version",
        "value": "2.0"
      }
    ]
  }'

Example 4: Change Authentication Method

curl -X PUT "https://api.uptimehunt.com/api/v1/services/1" \
  -H "Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..." \
  -H "Content-Type: application/json" \
  -d '{
    "auth_type": "basic",
    "auth_username": "newuser",
    "auth_password": "newpass",
    "auth_bearer_token": null
  }'

Example 5: Assign Service to Project

curl -X PATCH "https://api.uptimehunt.com/api/v1/services/1" \
  -H "Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..." \
  -H "Content-Type: application/json" \
  -d '{
    "project_id": 7
  }'

Example 6: Remove Service from Project

curl -X PATCH "https://api.uptimehunt.com/api/v1/services/1" \
  -H "Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..." \
  -H "Content-Type: application/json" \
  -d '{
    "project_id": null
  }'

Example 7: Update PING Service IP

curl -X PUT "https://api.uptimehunt.com/api/v1/services/2" \
  -H "Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..." \
  -H "Content-Type: application/json" \
  -d '{
    "ip": "10.0.0.50"
  }'

Delete Service

Permanently delete a service and all its associated check history.

Endpoint: DELETE /api/v1/services/{id}

Authentication: Required

Path Parameters:

Parameter Type Required Description
id integer Yes Service ID

Response: No content (HTTP 204)

Status Codes:

Code Description
204 Service deleted successfully
401 Unauthorized - Invalid or missing authentication token
404 Service not found or does not belong to authenticated user

cURL Example:

curl -X DELETE "https://api.uptimehunt.com/api/v1/services/1" \
  -H "Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..."

Service Object Schema

Complete HTTP Service Object

{
  "id": 1,
  "name": "Production API",
  "type": "http",
  "enabled": true,
  "interval": 3,
  "project_id": 5,
  "project": {
    "id": 5,
    "name": "Production Services",
    "color": "#3B82F6",
    "icon": "server"
  },
  "config": {
    "method": "POST",
    "url": "https://api.example.com/webhook",
    "auth_type": "bearer",
    "auth_username": null,
    "auth_password": null,
    "auth_bearer_token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...",
    "post_data": "{\"event\": \"test\"}",
    "headers": [
      {
        "name": "Content-Type",
        "value": "application/json"
      },
      {
        "name": "X-API-Key",
        "value": "secret-key-123"
      }
    ]
  },
  "date_created": "2025-10-01T14:30:00Z",
  "date_modified": "2025-10-05T09:15:00Z"
}

Complete PING Service Object

{
  "id": 2,
  "name": "Database Server",
  "type": "ping",
  "enabled": true,
  "interval": 5,
  "project_id": null,
  "project": null,
  "config": {
    "ip": "192.168.1.100"
  },
  "date_created": "2025-10-02T10:00:00Z",
  "date_modified": "2025-10-02T10:00:00Z"
}

Field Descriptions

Field Type Description
id integer Unique service identifier
name string Service display name
type string Service type: "http" or "ping"
enabled boolean Whether monitoring is active
interval integer Check interval in minutes (1-60)
project_id integer|null Associated project ID or null
project object|null Project summary object or null
config object Service-type-specific configuration
date_created string ISO 8601 timestamp of creation
date_modified string ISO 8601 timestamp of last modification

Error Responses

Validation Errors

Status Code: 400 Bad Request

{
  "error": {
    "message": "Validation failed",
    "details": {
      "url": ["This field is required."],
      "interval": ["Ensure this value is greater than or equal to 1."]
    }
  }
}

Authentication Errors

Status Code: 401 Unauthorized

{
  "error": {
    "message": "Authentication credentials were not provided."
  }
}

Not Found Errors

Status Code: 404 Not Found

{
  "error": {
    "message": "Service not found"
  }
}

Service Type Validation

Status Code: 400 Bad Request

{
  "error": {
    "message": "Service type is required"
  }
}

Status Code: 400 Bad Request

{
  "error": {
    "message": "Unknown service type: invalid_type"
  }
}

Validation Rules

Common Validation

Field Validation Rules
name Required, max 128 characters
enabled Boolean value
interval Integer between 1 and 60
project_id Must be a valid project owned by the user

HTTP Service Validation

Field Validation Rules
url Required, valid URL format, max 4096 characters, must include protocol (http:// or https://)
method Must be one of: GET, POST, HEAD
auth_type Must be one of: none, basic, bearer
auth_username Required if auth_type is "basic", max 128 characters
auth_password Required if auth_type is "basic", max 128 characters
auth_bearer_token Required if auth_type is "bearer", max 512 characters
post_data Optional, any valid string
headers[].name Required, max 64 characters
headers[].value Required, max 4096 characters

PING Service Validation

Field Validation Rules
ip Required, valid IPv4, IPv6, or domain name, max 255 characters

Best Practices

Service Creation

  1. Use Descriptive Names: Choose clear, meaningful names that identify the monitored resource
  2. Set Appropriate Intervals: Balance monitoring frequency with system load:
  3. Critical services: 1-3 minutes
  4. Standard services: 5-10 minutes
  5. Low-priority services: 15-30 minutes
  6. Organize with Projects: Group related services using projects for easier management
  7. Test Authentication: Verify authentication credentials work before creating the service

Service Updates

  1. Use PATCH for Partial Updates: Only send fields that need to be changed
  2. Disable Before Major Changes: Temporarily disable services when making significant configuration changes
  3. Update Check Intervals Carefully: Frequent checks consume more resources

Security

  1. Protect Credentials: Never log or expose authentication credentials in client-side code
  2. Use HTTPS: Always monitor HTTPS endpoints when available
  3. Rotate Tokens: Regularly update bearer tokens and passwords
  4. Secure Custom Headers: Avoid including sensitive data in custom headers unless necessary

Performance

  1. Filter Queries: Use query parameters to reduce response payload size
  2. Monitor Service Count: Be aware of your service quota limits

Code Examples

JavaScript/TypeScript (fetch)

// List all services
async function listServices() {
  const response = await fetch('https://api.uptimehunt.com/api/v1/services', {
    headers: {
      'Authorization': `Bearer ${accessToken}`,
    },
  });

  const data = await response.json();
  return data.data;
}

// Create HTTP service
async function createHttpService(serviceData) {
  const response = await fetch('https://api.uptimehunt.com/api/v1/services', {
    method: 'POST',
    headers: {
      'Authorization': `Bearer ${accessToken}`,
      'Content-Type': 'application/json',
    },
    body: JSON.stringify({
      type: 'http',
      name: serviceData.name,
      enabled: true,
      interval: 3,
      url: serviceData.url,
      method: 'GET',
      headers: serviceData.headers || [],
    }),
  });

  return await response.json();
}

// Update service
async function updateService(serviceId, updates) {
  const response = await fetch(
    `https://api.uptimehunt.com/api/v1/services/${serviceId}`,
    {
      method: 'PATCH',
      headers: {
        'Authorization': `Bearer ${accessToken}`,
        'Content-Type': 'application/json',
      },
      body: JSON.stringify(updates),
    }
  );

  return await response.json();
}

// Delete service
async function deleteService(serviceId) {
  await fetch(`https://api.uptimehunt.com/api/v1/services/${serviceId}`, {
    method: 'DELETE',
    headers: {
      'Authorization': `Bearer ${accessToken}`,
    },
  });
}

Python (requests)

import requests

BASE_URL = 'https://api.uptimehunt.com/api/v1'
ACCESS_TOKEN = 'your_access_token'

# List all services
def list_services():
    response = requests.get(
        f'{BASE_URL}/services',
        headers={'Authorization': f'Bearer {ACCESS_TOKEN}'}
    )
    return response.json()['data']

# Create HTTP service
def create_http_service(name, url, headers=None):
    data = {
        'type': 'http',
        'name': name,
        'enabled': True,
        'interval': 3,
        'url': url,
        'method': 'GET',
        'headers': headers or [],
    }

    response = requests.post(
        f'{BASE_URL}/services',
        headers={
            'Authorization': f'Bearer {ACCESS_TOKEN}',
            'Content-Type': 'application/json',
        },
        json=data
    )
    return response.json()

# Create PING service
def create_ping_service(name, ip):
    data = {
        'type': 'ping',
        'name': name,
        'enabled': True,
        'interval': 5,
        'ip': ip,
    }

    response = requests.post(
        f'{BASE_URL}/services',
        headers={
            'Authorization': f'Bearer {ACCESS_TOKEN}',
            'Content-Type': 'application/json',
        },
        json=data
    )
    return response.json()

# Update service
def update_service(service_id, **updates):
    response = requests.patch(
        f'{BASE_URL}/services/{service_id}',
        headers={
            'Authorization': f'Bearer {ACCESS_TOKEN}',
            'Content-Type': 'application/json',
        },
        json=updates
    )
    return response.json()

# Delete service
def delete_service(service_id):
    requests.delete(
        f'{BASE_URL}/services/{service_id}',
        headers={'Authorization': f'Bearer {ACCESS_TOKEN}'}
    )

PHP

<?php
$baseUrl = 'https://api.uptimehunt.com/api/v1';
$accessToken = 'your_access_token';

// List all services
function listServices($baseUrl, $accessToken) {
    $ch = curl_init("$baseUrl/services");
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
    curl_setopt($ch, CURLOPT_HTTPHEADER, [
        "Authorization: Bearer $accessToken"
    ]);

    $response = curl_exec($ch);
    curl_close($ch);

    return json_decode($response, true)['data'];
}

// Create HTTP service
function createHttpService($baseUrl, $accessToken, $name, $url) {
    $data = [
        'type' => 'http',
        'name' => $name,
        'enabled' => true,
        'interval' => 3,
        'url' => $url,
        'method' => 'GET',
    ];

    $ch = curl_init("$baseUrl/services");
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
    curl_setopt($ch, CURLOPT_POST, true);
    curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($data));
    curl_setopt($ch, CURLOPT_HTTPHEADER, [
        "Authorization: Bearer $accessToken",
        "Content-Type: application/json"
    ]);

    $response = curl_exec($ch);
    curl_close($ch);

    return json_decode($response, true);
}

// Update service
function updateService($baseUrl, $accessToken, $serviceId, $updates) {
    $ch = curl_init("$baseUrl/services/$serviceId");
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
    curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'PATCH');
    curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($updates));
    curl_setopt($ch, CURLOPT_HTTPHEADER, [
        "Authorization: Bearer $accessToken",
        "Content-Type: application/json"
    ]);

    $response = curl_exec($ch);
    curl_close($ch);

    return json_decode($response, true);
}

// Delete service
function deleteService($baseUrl, $accessToken, $serviceId) {
    $ch = curl_init("$baseUrl/services/$serviceId");
    curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'DELETE');
    curl_setopt($ch, CURLOPT_HTTPHEADER, [
        "Authorization: Bearer $accessToken"
    ]);

    curl_exec($ch);
    curl_close($ch);
}
?>


Support

For additional assistance with the Services API: