Skip to main content

API overview

The Observiant API is a JSON-over-HTTPS API served by your environment. Use it to manage targets from your inventory or automation tooling, and to pull measurements, traceroutes and events into your own systems.

Base URL​

Send requests to your environment's address. All endpoints are under /api:

https://<subdomain>.observiant.com/api

The portal's Environment page shows your environment's address. The API is available over HTTPS only. Every request needs an API key, as described in Authentication.

Endpoints​

These endpoints are available to API keys. Requests to any other path or method return 403 Forbidden.

MethodPathPurpose
GET/api/targetsList targets
POST/api/targetsCreate a target
GET/api/targets/{target_id}Get a target
PUT/api/targets/{target_id}Replace a target
DELETE/api/targets/{target_id}Delete a target and its data
GET/api/targets/{target_id}/agentsList agent assignments
PUT/api/targets/{target_id}/agents/{agent_label}Assign an agent
DELETE/api/targets/{target_id}/agents/{agent_label}Remove an assignment
GET/api/targets/{target_id}/ipinfoResolve a target's address, network and country
GET/api/targets/{target_id}/data/latencyLatency and loss time series
GET/api/targets/{target_id}/mtrList traceroute summaries
GET/api/targets/{target_id}/mtr/markersRepresentative traceroutes for a time window
GET/api/targets/{target_id}/mtr/nearestTraceroute closest to a point in time
GET/api/mtr/{result_id}Get a full traceroute report
GET/api/targets/{target_id}/path-changesRoute changes
GET/api/events/mtrCorrelated packet-loss events

Requests​

  • Send request bodies as JSON with Content-Type: application/json. A body must contain exactly one JSON object of at most 64 KiB.
  • Unknown fields are rejected with 400 Bad Request, so a misspelled field name fails instead of being silently ignored.
  • Query parameters are optional unless an endpoint says otherwise.
  • URL-encode path segments. Agent labels can contain spaces, which you send as %20.

Responses​

Responses are JSON. Successful requests return:

StatusReturned by
200 OKReads, and target creation, which returns the new target.
204 No ContentTarget updates, deletions, and agent assignment changes. There is no body.

Fields that do not apply to a resource can be absent. For example, HTTP-specific fields appear only on HTTP targets. Ignore fields you do not recognize, because new fields can be added to responses.

Identifiers​

Targets and traceroute reports have server-assigned IDs (target_id and result_id). IDs are 26-character strings made of letters and digits, such as 01M4MZ5T3A76E4RBFKGBD5MP8V. Treat them as opaque, case-sensitive values.

Timestamps​

Every timestamp, in requests and responses, is a Unix time in milliseconds, UTC. Time ranges given with start and end include both ends.

date +%s000 # now
echo $(( $(date +%s) - 3600 ))000 # one hour ago
import time

now_ms = int(time.time() * 1000)
one_hour_ago_ms = now_ms - 3600 * 1000

Agent labels and display names​

Responses that come from agents carry two names:

  • agent_label is the agent's stable identifier. Use it in filters such as agent_label=sys-amsterdam and in agent assignments.
  • display_name is the human-readable name shown in the dashboard. Use it for presentation only, because it can change. When an agent has no separate display name, display_name equals the label.

System agent labels begin with sys-. A user agent's label is the name you gave it when you added it in the dashboard.

To find system agent labels, read any measurement response. For example, every series returned by latency and loss includes both agent_label and display_name.

Errors​

Errors come from two layers, which you can tell apart by the response body.

Authorization errors are returned before the request reaches your environment. They have an empty body:

StatusMeaning
401 UnauthorizedMissing, malformed or revoked API key, or a key from another Organization.
403 ForbiddenThe endpoint or method is not available to API keys.
404 Not FoundThe address is not an active Observiant environment.
503 Service UnavailableAuthorization is temporarily unavailable. Retry with backoff.

API errors have a JSON body with an error message:

{"error": "family must be auto, ipv4 or ipv6"}
StatusMeaning
400 Bad RequestA parameter or field is invalid, missing or unknown. The message names the problem.
403 ForbiddenYour plan's target limit is reached (target creation only).
404 Not FoundThe target, traceroute report or assignment does not exist, or there is no data to return.
500 Internal Server ErrorThe request failed in Observiant. Retry with backoff.
502 Bad GatewayA target's hostname could not be resolved (address lookups only).

Error messages are written for people and can change. Base your automation on status codes, and log the message for troubleshooting.

Limits and pagination​

List endpoints cap the number of results per request:

EndpointOrderDefaultMaximumTime range
GET /api/targetsLabelAll targetsAll targets—
GET …/data/latencyTime, oldest first——Default last 24 hours; any length
GET …/mtrTime, newest first50500Unbounded by default; up to 30 days when both ends are given
GET …/mtr/markersTime, oldest first300500start and end required; up to 366 days
GET …/path-changesTime, oldest first500500Unbounded by default; up to 30 days when both ends are given
GET /api/events/mtrMost recently seen first100 per page500 per pageDefault last 24 hours; up to 30 days

Traceroute and path-change lists use time-based paging: to fetch the next set, repeat the request with a range that starts or ends just past the last item you received. Each reference page explains the exact steps. Correlated events use page numbers.

Measurements change every 15 seconds and traceroutes less often, so polling more often than once a minute returns little new data.

Data retention​

Your plan sets how long Observiant keeps latency measurements and traceroutes. Path changes and correlated events are kept for as long as traceroutes. Requests for older data return empty results.