DocumentationOpen PingAgain
Browse

Developer API

API examples

Use safe curl, JavaScript, and Python examples for common workflows.

These examples use environment variables and the deliberately fake pa_example_token.

List monitors

curl --fail-with-body \
  --header "Authorization: Bearer ${PINGAGAIN_TOKEN:-pa_example_token}" \
  "${PINGAGAIN_BASE_URL}/api/v1/monitors?limit=20"

JavaScript is useful when the API call is part of an existing service:

const response = await fetch(`${process.env.PINGAGAIN_BASE_URL}/api/v1/monitors`, {
  headers: { Authorization: `Bearer ${process.env.PINGAGAIN_TOKEN}` },
});
if (!response.ok) throw new Error(`PingAgain API: ${response.status}`);
const monitors = await response.json();

Create a Website

curl --fail-with-body --request POST \
  --header "Authorization: Bearer ${PINGAGAIN_TOKEN:-pa_example_token}" \
  --header "Content-Type: application/json" \
  --data '{"type":"website","url":"https://example.com"}' \
  "${PINGAGAIN_BASE_URL}/api/v1/monitors"

Validate the HTTP status before using the returned monitor. Monitoring results arrive asynchronously; a successful create response does not mean every Website module has already finished.

Next: review Monitors API or pagination, rate limits, and errors.