# API overview

The Sitepulse API manages sites and monitoring settings, starts on-demand checks, and reads results, issues, and reports. Its base URL is:

```text
https://app.sitepulse.dev/api/v1
```

Endpoint paths in this reference are relative to that base. To connect an AI app, use the separate [MCP endpoint](/docs/api/authentication/#mcp-access).

## Create a token

Open **Settings → API & MCP** and create a personal access token. Copy it when shown. Your account must have a verified email address, and protected team routes need active trial or subscription access.

For the example below, select `teams:read`, `sites:write`, `checks:run`, and `checks:read`. Token scopes do not replace team membership or role permissions.

## Find your team

Set the token in your terminal environment, then list your teams:

```bash
export SITEPULSE_TOKEN='YOUR_TOKEN'

curl --fail-with-body -sS \
  -H "Authorization: Bearer ${SITEPULSE_TOKEN}" \
  -H "Accept: application/json" \
  'https://app.sitepulse.dev/api/v1/teams'
```

Copy a team's `uuid` from the response, then set these values for the language example you choose:

```bash
export SITEPULSE_TEAM_UUID='TEAM_UUID_FROM_THE_RESPONSE'
export SITEPULSE_SITE_URL='https://your-public-website.example'
```

Replace the example URL with a real public website. The examples create a site, so use a URL that is not already in that team. Enable Status in the team's monitoring defaults and ensure the team has room for a site and at least one on-demand check.

## Create a site and run a check

Each example creates the site, starts a Status check, and polls up to 60 times, waiting five seconds between pending results. It reports a failed or skipped check instead of treating it as success. Longer checks may need more time; continue polling an existing check rather than creating another site or check.

These are server-side or terminal examples. Keep the token out of browser-delivered code. Use Bash with cURL and jq, Node.js 18 or newer, Python 3, Go, Ruby, or PHP with the cURL extension, respectively. Python, Go, and Ruby examples use their standard libraries.

<details name="create-and-check" open>
<summary>cURL</summary>

```bash
set -euo pipefail
: "${SITEPULSE_TOKEN:?Set SITEPULSE_TOKEN}"
: "${SITEPULSE_TEAM_UUID:?Set SITEPULSE_TEAM_UUID}"
: "${SITEPULSE_SITE_URL:?Set SITEPULSE_SITE_URL}"
base='https://app.sitepulse.dev/api/v1'

site=$(curl --fail-with-body -sS --max-time 30 \
  -H "Authorization: Bearer ${SITEPULSE_TOKEN}" \
  -H 'Accept: application/json' -H 'Content-Type: application/json' \
  -d "$(jq -n --arg url "$SITEPULSE_SITE_URL" '{url: $url, name: "Example"}')" \
  "${base}/teams/${SITEPULSE_TEAM_UUID}/sites")
site_uuid=$(jq -er '.data.uuid' <<< "$site")

checks=$(curl --fail-with-body -sS --max-time 30 \
  -H "Authorization: Bearer ${SITEPULSE_TOKEN}" \
  -H 'Accept: application/json' -H 'Content-Type: application/json' \
  -d '{"tools":["status"]}' "${base}/sites/${site_uuid}/checks")
check_uuid=$(jq -er '.data[0].uuid' <<< "$checks")

for ((attempt = 0; attempt < 60; attempt++)); do
  result=$(curl --fail-with-body -sS --max-time 30 \
    -H "Authorization: Bearer ${SITEPULSE_TOKEN}" \
    -H 'Accept: application/json' "${base}/checks/${check_uuid}")
  status=$(jq -er '.data.status' <<< "$result")
  case "$status" in
    completed) jq '.data' <<< "$result"; exit 0 ;;
    pending) sleep 5 ;;
    *) printf '%s\n' "$result" >&2; exit 1 ;;
  esac
done
printf 'Check %s is still pending; poll it again later.\n' "$check_uuid" >&2
exit 1
```

</details>

<details name="create-and-check">
<summary>JavaScript</summary>

Save as `example.mjs` and run with `node example.mjs`.

```javascript
const { SITEPULSE_TOKEN: token, SITEPULSE_TEAM_UUID: team, SITEPULSE_SITE_URL: url } = process.env;
if (!token || !team || !url) throw new Error('Set the three SITEPULSE environment variables.');
const base = 'https://app.sitepulse.dev/api/v1';

async function request(path, body) {
  const response = await fetch(base + path, {
    method: body === undefined ? 'GET' : 'POST',
    headers: {
      Authorization: `Bearer ${token}`,
      Accept: 'application/json',
      ...(body === undefined ? {} : { 'Content-Type': 'application/json' }),
    },
    body: body === undefined ? undefined : JSON.stringify(body),
    signal: AbortSignal.timeout(30000),
  });
  if (!response.ok) throw new Error(`HTTP ${response.status}: ${await response.text()}`);
  return response.json();
}

const site = await request(`/teams/${team}/sites`, { url, name: 'Example' });
const checks = await request(`/sites/${site.data.uuid}/checks`, { tools: ['status'] });
const checkUuid = checks.data[0].uuid;
let result;
for (let attempt = 0; attempt < 60; attempt++) {
  result = await request(`/checks/${checkUuid}`);
  if (result.data.status !== 'pending') break;
  await new Promise(resolve => setTimeout(resolve, 5000));
}
if (result.data.status !== 'completed') throw new Error(JSON.stringify(result.data));
console.log(result.data);
```

</details>

<details name="create-and-check">
<summary>Python</summary>

Save as `example.py` and run with `python3 example.py`.

```python
import json
import os
import time
from urllib.request import Request, urlopen

base = 'https://app.sitepulse.dev/api/v1'
token = os.environ['SITEPULSE_TOKEN']
team = os.environ['SITEPULSE_TEAM_UUID']
url = os.environ['SITEPULSE_SITE_URL']


def request(path, body=None):
    headers = {'Authorization': f'Bearer {token}', 'Accept': 'application/json'}
    data = None
    if body is not None:
        headers['Content-Type'] = 'application/json'
        data = json.dumps(body).encode()
    with urlopen(Request(base + path, data=data, headers=headers), timeout=30) as response:
        return json.load(response)


site = request(f'/teams/{team}/sites', {'url': url, 'name': 'Example'})
checks = request(f"/sites/{site['data']['uuid']}/checks", {'tools': ['status']})
check_uuid = checks['data'][0]['uuid']
for attempt in range(60):
    result = request(f'/checks/{check_uuid}')
    if result['data']['status'] != 'pending':
        break
    time.sleep(5)
if result['data']['status'] != 'completed':
    raise RuntimeError(result['data'])
print(json.dumps(result['data'], indent=2))
```

</details>

<details name="create-and-check">
<summary>Go</summary>

Save as `example.go` and run with `go run example.go`.

```go
package main

import (
    "bytes"
    "encoding/json"
    "fmt"
    "io"
    "log"
    "net/http"
    "os"
    "time"
)

const base = "https://app.sitepulse.dev/api/v1"
var client = &http.Client{Timeout: 30 * time.Second}

func request(path string, body any, result any) {
    var data []byte
    var err error
    method := http.MethodGet
    if body != nil {
        method = http.MethodPost
        data, err = json.Marshal(body)
        if err != nil { log.Fatal(err) }
    }
    req, err := http.NewRequest(method, base+path, bytes.NewReader(data))
    if err != nil { log.Fatal(err) }
    req.Header.Set("Authorization", "Bearer "+os.Getenv("SITEPULSE_TOKEN"))
    req.Header.Set("Accept", "application/json")
    if body != nil { req.Header.Set("Content-Type", "application/json") }
    resp, err := client.Do(req)
    if err != nil { log.Fatal(err) }
    defer resp.Body.Close()
    if resp.StatusCode < 200 || resp.StatusCode >= 300 {
        message, _ := io.ReadAll(resp.Body)
        log.Fatalf("HTTP %d: %s", resp.StatusCode, message)
    }
    if err := json.NewDecoder(resp.Body).Decode(result); err != nil { log.Fatal(err) }
}

func main() {
    team, url := os.Getenv("SITEPULSE_TEAM_UUID"), os.Getenv("SITEPULSE_SITE_URL")
    if team == "" || url == "" || os.Getenv("SITEPULSE_TOKEN") == "" {
        log.Fatal("Set the three SITEPULSE environment variables.")
    }
    var site struct { Data struct { UUID string `json:"uuid"` } `json:"data"` }
    request("/teams/"+team+"/sites", map[string]string{"url": url, "name": "Example"}, &site)
    var checks struct { Data []struct { UUID string `json:"uuid"` } `json:"data"` }
    request("/sites/"+site.Data.UUID+"/checks", map[string][]string{"tools": {"status"}}, &checks)
    if len(checks.Data) == 0 { log.Fatal("No check returned.") }
    var result struct { Data struct {
        Status string `json:"status"`
        Result json.RawMessage `json:"result"`
        Error json.RawMessage `json:"error"`
    } `json:"data"` }
    for attempt := 0; attempt < 60; attempt++ {
        request("/checks/"+checks.Data[0].UUID, nil, &result)
        if result.Data.Status != "pending" { break }
        time.Sleep(5 * time.Second)
    }
    if result.Data.Status != "completed" { log.Fatalf("Check ended with %s: %s", result.Data.Status, result.Data.Error) }
    fmt.Println(string(result.Data.Result))
}
```

</details>

<details name="create-and-check">
<summary>Ruby</summary>

Save as `example.rb` and run with `ruby example.rb`.

```ruby
require 'json'
require 'net/http'

BASE = 'https://app.sitepulse.dev/api/v1'
TOKEN = ENV.fetch('SITEPULSE_TOKEN')
team = ENV.fetch('SITEPULSE_TEAM_UUID')
url = ENV.fetch('SITEPULSE_SITE_URL')

def request(path, body = nil)
  uri = URI(BASE + path)
  req = body.nil? ? Net::HTTP::Get.new(uri) : Net::HTTP::Post.new(uri)
  req['Authorization'] = "Bearer #{TOKEN}"
  req['Accept'] = 'application/json'
  unless body.nil?
    req['Content-Type'] = 'application/json'
    req.body = JSON.generate(body)
  end
  response = Net::HTTP.start(uri.hostname, uri.port, use_ssl: uri.scheme == 'https',
                             open_timeout: 30, read_timeout: 30) { |http| http.request(req) }
  raise "HTTP #{response.code}: #{response.body}" unless response.is_a?(Net::HTTPSuccess)
  JSON.parse(response.body)
end

site = request("/teams/#{team}/sites", { url: url, name: 'Example' })
checks = request("/sites/#{site['data']['uuid']}/checks", { tools: ['status'] })
check_uuid = checks['data'][0]['uuid']
result = nil
60.times do
  result = request("/checks/#{check_uuid}")
  break unless result['data']['status'] == 'pending'
  sleep 5
end
raise result['data'].inspect unless result['data']['status'] == 'completed'
puts JSON.pretty_generate(result['data'])
```

</details>

<details name="create-and-check">
<summary>PHP</summary>

Save as `example.php` and run with `php example.php`.

```php
<?php

$token = getenv('SITEPULSE_TOKEN');
$team = getenv('SITEPULSE_TEAM_UUID');
$url = getenv('SITEPULSE_SITE_URL');
if (!$token || !$team || !$url) {
    throw new RuntimeException('Set the three SITEPULSE environment variables.');
}

function request(string $path, ?array $body = null): array
{
    $headers = ['Authorization: Bearer '.getenv('SITEPULSE_TOKEN'), 'Accept: application/json'];
    $ch = curl_init('https://app.sitepulse.dev/api/v1'.$path);
    $options = [CURLOPT_RETURNTRANSFER => true, CURLOPT_TIMEOUT => 30];
    if ($body !== null) {
        $headers[] = 'Content-Type: application/json';
        $options[CURLOPT_POST] = true;
        $options[CURLOPT_POSTFIELDS] = json_encode($body, JSON_THROW_ON_ERROR);
    }
    $options[CURLOPT_HTTPHEADER] = $headers;
    curl_setopt_array($ch, $options);
    $response = curl_exec($ch);
    if ($response === false) {
        throw new RuntimeException(curl_error($ch));
    }
    $status = curl_getinfo($ch, CURLINFO_RESPONSE_CODE);
    curl_close($ch);
    if ($status < 200 || $status >= 300) {
        throw new RuntimeException("HTTP {$status}: {$response}");
    }
    return json_decode($response, true, 512, JSON_THROW_ON_ERROR);
}

$site = request("/teams/{$team}/sites", ['url' => $url, 'name' => 'Example']);
$checks = request("/sites/{$site['data']['uuid']}/checks", ['tools' => ['status']]);
$checkUuid = $checks['data'][0]['uuid'];
for ($attempt = 0; $attempt < 60; $attempt++) {
    $result = request("/checks/{$checkUuid}");
    if ($result['data']['status'] !== 'pending') {
        break;
    }
    sleep(5);
}
if ($result['data']['status'] !== 'completed') {
    throw new RuntimeException(json_encode($result['data'], JSON_THROW_ON_ERROR));
}
echo json_encode($result['data'], JSON_PRETTY_PRINT | JSON_THROW_ON_ERROR).PHP_EOL;
```

</details>

## API references

- [Authentication](/docs/api/authentication/) — Tokens, scopes, and MCP setup.
- [Requests and responses](/docs/api/requests-responses/) — Identifiers, pagination, errors, and rate limits.
- [Resources](/docs/api/resources/) — Response fields.
- [Endpoints](/docs/api/endpoints/) — HTTP methods, paths, filters, and request bodies.
- [Check results](/docs/api/check-results/) — Tool-specific results and completion states.

Use the documented `/api/v1` endpoints for integrations. Dashboard-specific routes are not part of this public API.
