PUT/v1/monitors/external/{external_id}

Create or update a monitor

Creates the monitor that has this external_id, or updates it if it already exists. A script that provisions monitors from its own list can run as often as needed without creating duplicates, and without storing Hyperping's identifiers.

Request

Path Parameters
external_idstringrequired
Your own identifier for the monitor, unique within the project: 1 to 128 letters, digits, ., _, : or -, starting with a letter or a digit.
Example:"client-42"

Body

The same fields as Create a monitor, browser checks included.

  • When no monitor of the project has this external_id, the request creates one: the fields required on create are required here too, like name, and script for a browser check.
  • When a monitor has it, the request updates that monitor like Update a monitor: only the fields you send change, and a monitor can't be turned into a browser check or back.
  • external_id can be left out of the body. If you send it, it must be the one in the path.

Response

Returns the monitor object: with status code 201 when the request created it, 200 when it updated it.

Errors

Error responses
422validation
A field is invalid, a field required to create the monitor is missing, the external_id in the path is malformed, or the one in the body differs from it
409A monitor with this external_id already exists
Two requests created this external_id at the same time. The body carries the uuid of the monitor that won; sending the request again updates it.
403read-only key
The API key has read-only permissions
RequestcURL
curl -X PUT https://api.hyperping.io/v1/monitors/external/client-42 \
  -H "Authorization: Bearer ${API_TOKEN}" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Help center - Acme",
    "protocol": "browser",
    "url": "https://help.acme.com",
    "group_id": 12,
    "script": "import { test, expect } from \"@playwright/test\";\n\ntest(\"help center loads\", async ({ page }) => {\n  await page.goto(process.env.BASE_URL);\n  await expect(page.getByRole(\"searchbox\")).toBeVisible();\n});\n",
    "env_variables": [
      { "name": "BASE_URL", "value": "https://help.acme.com" }
    ]
  }'
201 CreatedJSON
{
  "name": "Help center - Acme",
  "url": "https://help.acme.com",
  "uuid": "mon_7BLzvBqgJYdvpm",
  "external_id": "client-42",
  "protocol": "browser",
  "paused": false,
  "regions": [
    "frankfurt",
    "sanfrancisco"
  ],
  "check_frequency": 300,
  "status": "up",
  "group_id": 12,
  "sort_order": 1,
  "env_variables": [
    { "name": "BASE_URL" }
  ],
  "script": "import { test, expect } from \"@playwright/test\";\n\ntest(\"help center loads\", async ({ page }) => {\n  await page.goto(process.env.BASE_URL);\n  await expect(page.getByRole(\"searchbox\")).toBeVisible();\n});\n"
}
Same request againcURL
# Updates mon_7BLzvBqgJYdvpm instead of creating a second monitor
curl -X PUT https://api.hyperping.io/v1/monitors/external/client-42 \
  -H "Authorization: Bearer ${API_TOKEN}" \
  -H "Content-Type: application/json" \
  -d '{ "check_frequency": 600 }'
200 OKJSON
{
  "name": "Help center - Acme",
  "uuid": "mon_7BLzvBqgJYdvpm",
  "external_id": "client-42",
  "protocol": "browser",
  "check_frequency": 600
}