Reference

The Marsolen API

List, create, edit, pause and delete checks from CI, a script or anything that speaks HTTP. A check made here is the same as one made in the dashboard: the same plan limits, the same 60-second floor, and alerts to the same channels.

Keys

Create an API key in Settings, API keys, and send it as a bearer token. API keys start with mak_. SDK keys (msk_) only register monitors from the Spring Boot starter and report AI agent runs (or send their traces), and are refused everywhere else here, so a key baked into an application cannot delete checks.

shell
export MARSOLEN_KEY=mak_...
curl -H "Authorization: Bearer $MARSOLEN_KEY" https://staging.marsolen.com/api/v1/checks

Checks

RouteDoes
GET /api/v1/checksEvery check on the account.
POST /api/v1/checksCreates a check. 201 with the check.
GET /api/v1/checks/{id}One check.
PATCH /api/v1/checks/{id}Changes the fields you send; null clears an optional one.
DELETE /api/v1/checks/{id}Deletes it and its history. 204.
POST /api/v1/checks/{id}/pauseStops expecting pings or calling the URL.
POST /api/v1/checks/{id}/resumeStarts again from now.
GET /api/v1/channelsThe account's alert channels: id, kind and name.

A cron job

The response carries the ping_url your job calls when it finishes.

shell
curl -X POST https://staging.marsolen.com/api/v1/checks \
  -H "Authorization: Bearer $MARSOLEN_KEY" \
  -H "Content-Type: application/json" \
  -d '{"kind": "heartbeat", "name": "nightly-backup",
       "cron": "0 3 * * *", "timezone": "Europe/Paris",
       "grace_seconds": 600}'
FieldMeaning
nameRequired. Up to 120 characters.
cron or period_secondsOne of the two. A five-field cron expression that runs on some date (0 0 31 2 * never does, and is refused), or how often the job runs, in whole minutes counted in seconds.
timezoneThe zone the cron expression is read in. Default UTC.
grace_secondsHow late a ping may be before the check is down, in whole minutes. Default 300.
run_limit_secondsOptional. Alert when a run that sent /start has not ended within it.

A URL

The URL is checked when it is saved, and called within a minute.

shell
curl -X POST https://staging.marsolen.com/api/v1/checks \
  -H "Authorization: Bearer $MARSOLEN_KEY" \
  -H "Content-Type: application/json" \
  -d '{"kind": "http", "name": "api health",
       "url": "https://example.com/health", "interval_seconds": 60}'
FieldMeaning
name, urlRequired. Redirects are never followed and no request headers are sent, so point it at a health endpoint that needs no credential.
interval_secondsRequired. At least your plan's minimum, in whole minutes.
expected_statusOptional. Any 2xx when absent.
body_containsOptional. Text the first MiB of the response must contain.
max_latency_msOptional. Slower answers fail.
tls_expiry_warn_daysOptional. Send one notice, and warn on the check's page, this many days before the certificate expires.

Both kinds

pausedOn create only. Create the check paused.
channel_idsWhich channels it alerts. Every channel on the account when absent; [] for none. Ids come from GET /api/v1/channels.

Change and delete

shell
curl -X PATCH https://staging.marsolen.com/api/v1/checks/$CHECK_ID \
  -H "Authorization: Bearer $MARSOLEN_KEY" \
  -H "Content-Type: application/json" \
  -d '{"grace_seconds": 1800}'

curl -X DELETE https://staging.marsolen.com/api/v1/checks/$CHECK_ID \
  -H "Authorization: Bearer $MARSOLEN_KEY"

Report an AI agent run

An AI agent can finish with a success ping and still have done nothing, burned ten times its usual tokens, or been rate-limited all night. After each run, send what it did to POST /api/v1/runs, as well as the usual ping. The check's page lists the latest reports, and on a paid plan the rules you tick on the check's form alert about a run that breaks one, about a minute after it arrives. Send it within ten minutes of the run's ping: with "Report missing" ticked, a run that pinged and sent no report alerts too. A monthly budget, in tokens or in euros, is counted from the same reports and sends a notice at 80% and at 100%, without taking the check down. With "Unusual runs" ticked, a run that used far more tokens or cost far more than the check's own last runs, or produced far fewer items, sends a notice too, as a webhook's check.unusual event.

Use the same SDK key (msk_) as @MonitoredSchedule; an API key works too. The check is found by its name among your heartbeat checks.

shell
curl -fsS https://staging.marsolen.com/api/v1/runs \
  -H "Authorization: Bearer $MARSOLEN_SDK_KEY" \
  -H "Content-Type: application/json" \
  -d '{"check": "inbox-triage",
       "model_calls": 14,
       "tokens": {"input": 38000, "output": 3200},
       "models": ["claude-sonnet"],
       "tools": {"search_tickets": 6, "post_comment": 12},
       "provider_errors": {"rate_limit": 0, "other": 0},
       "items": 12}'
FieldMeaning
checkRequired. The name of one of your heartbeat checks.
model_callsRequired. How many times the run called a model.
tokensOptional. input and output token totals for the run.
modelsOptional. The model names it used, at most 10. A run of one model is priced at that model's price in Settings, Model prices.
tokens_by_modelOptional. Each model's own input and output tokens, such as {"claude-sonnet-4-5": {"input": 30000, "output": 2000}}. A run of several models has a cost only with it, since totals cannot be split between two prices. Its models are added to models, and tokens may be left out or must be its sums.
toolsOptional. Each tool's name and how many times it was called, at most 50. List a tool with 0 and the check's page shows that it was never called. The names you send are the ones the "Required tool" rule offers.
provider_errorsOptional. rate_limit and other errors the model provider returned.
itemsOptional. How many things the run produced: comments, emails, rows.
started_at, ended_atOptional. When the run started and ended, as ISO 8601 times. Stored with the report.

Any other field is refused with 422, so a prompt or an output cannot be sent by mistake. Names are identifiers of at most 64 characters, and every count is a whole number. 202 means the report is stored; each key may send 120 a minute.

Or send OpenTelemetry traces

If your agent framework already emits OpenTelemetry's GenAI spans (gen_ai.*), point its OTLP exporter at Marsolen instead of sending a report. Each trace becomes one run, about 15 seconds after its root span arrives (five minutes after its last span when the root is sent elsewhere), and is judged by the same rules.

shell
export OTEL_EXPORTER_OTLP_TRACES_ENDPOINT=https://staging.marsolen.com/api/v1/otlp/v1/traces
export OTEL_EXPORTER_OTLP_TRACES_HEADERS="Authorization=Bearer%20$MARSOLEN_SDK_KEY"
export OTEL_RESOURCE_ATTRIBUTES=marsolen.check=inbox-triage

Model calls (chat, text_completion, generate_content, embeddings) count with their tokens and model, execute_tool spans count as tool calls by gen_ai.tool.name, and a model call that failed is a provider error, a rate limit when its error.type or status says 429. A trace with none of these is not a run. To count a run that called nothing, set marsolen.check on its root span rather than on the resource; marsolen.items on any span adds to items. Each model call's tokens stay with its model, so a run of several models is priced without a split of its own. Only those attributes are read: prompts and outputs your instrumentation records are skipped unread and never stored. Protobuf and JSON are both accepted, gzipped or not.

Errors and limits

401No key, or a key that does not exist.
403An SDK key. Create an API key instead.
404No such check on this account.
422{"error": "...", "fields": {...}} - in plain words: what the dashboard's form says about a field, or your plan's limit and its number.
429More than 120 requests in a minute from one key. Wait for Retry-After.