Skip to content
All docs

Docs · Product guides

Programmatic access

Source: docs/programmatic-access.md

On this page

Porthole exposes versioned telemetry queries and definition APIs, a checkout CLI and a read-only MCP endpoint. Use the same installation origin as the app. Read the public OpenAPI schema without signing in; the live schema at /api/porthole/v1/openapi.json requires a signed-in native member. The schema describes implemented HTTP intake, queries and configuration doors. OTLP message details remain in the official signal schemas; future product capabilities are not advertised.

Credentials and sessions

An owner or admin creates an installation-local credential in /app/settings/credentials after a fresh identity verification. Give it only the required actions, signals, services, environments and teams. Read credentials can hold telemetry.read and definitions.read; ingest credentials hold telemetry.write. An allowed action is still limited by the credential's signal grants and its custodian's current authority. Expiry, revocation, removal and scope changes apply on the next request.

Send credentials only as Authorization: Bearer headers. Never put secrets in URLs, shell arguments, source files or Terraform state. The OTLP walkthrough shows curl with a hidden Bash prompt and standard-input header configuration.

Definition mutations require an authorized native session and the installation origin in the Origin header. A delegated credential is refused even when accompanied by a browser cookie. API, CLI and MCP requests cannot mint, rotate or re-scope credentials. Use the native Credentials screen.

Definition API

CollectionRootSupported operations
CollectionMonitorsRoot/api/porthole/v1/configuration/monitorsSupported operationsList, item read, create, conditional replacement, archive.
CollectionRepair definitionsRoot/api/porthole/v1/configuration/repairsSupported operationsList, item read, create, conditional replacement, archive.
CollectionPipelinesRoot/api/porthole/v1/pipelinesSupported operationsCurrent configuration, processor catalog, paginated immutable history and exact revision reads; native owner only.
CollectionDashboardsRoot/api/porthole/v1/dashboardsSupported operationsList, current or historical item read, create, conditional replacement, archive.

Monitor and repair collection GET accepts limit from 1 through 200 (default 50) and an opaque cursor. The result contains objects and a continuation cursor, or null when finished. Item GET returns the current ETag. POST creates an inactive definition from name, scope and validated body. PUT to the item replaces the exact revision named by If-Match, including its quotes. DELETE archives that revision without deleting action history.

Every monitor or repair mutation requires an Idempotency-Key of 8 through 120 letters, digits, periods, underscores, colons or hyphens. Replay the same key with identical method, object, revision and body to retrieve the committed response. Changed input with that key is refused. If a native edit made your ETag stale, fetch the current item and review the new definition before using a new key and revision. A successful replacement leaves the definition inactive.

Dashboard POST creates or replaces using the exact revision in the JSON body for replacement. POST to /api/porthole/v1/dashboards/archive archives that exact body revision. Item GET accepts version for a historical revision. An optional Idempotency-Key makes identical dashboard mutations replayable and refuses changed input. See the schema for dashboard-specific payloads.

Native owners, admins and maintainers can change definitions within their current scope. Definition reads release only objects whose complete service, environment and team scope is authorized. Monitor reads also require its signal; dashboard reads require every panel signal. Historical dashboard reads additionally require the historical revision's scope. List omissions or an item 404 can therefore mean the definition is outside the caller's scope.

Native pipeline reads

A current native owner reads /api/porthole/v1/pipelines for the current global revision, authorized active definition (or null) and first history page. GET /api/porthole/v1/pipelines/catalog returns the implemented native processor catalog with examples. GET /api/porthole/v1/pipelines/revisions returns history, snapshot and cursor; GET /api/porthole/v1/pipelines/revisions/42 reads exactly revision 42, including an inactive historical definition.

Current and history reads accept limit from 1 through 200 (default 50) and an opaque cursor. History is descending by revision. Pass the returned cursor and the same limit to resume; null means complete. The signed cursor binds the first page's maximum revision, owner and membership revision, so concurrent activation adds nothing to that traversal and Worker restart preserves it. Start again without a cursor to see new revisions. Settings uses the same history through Older revisions and Latest history links.

Every read requires a live native owner session and current service, environment and team scope. Out-of-scope revisions are omitted from pages; exact missing or inaccessible revisions return 404 pipeline_revision_not_found. A malformed revision returns 400 invalid_pipeline_revision; invalid page sizes return invalid_pipeline_limit; altered, mismatched or obsolete cursors return invalid_pipeline_cursor. Unknown or repeated parameters return invalid_query. Non-owner sessions return 403 owner_required; signed-out requests return 401. Every Authorization header returns 403 native_session_required, even beside an owner cookie. Revocation applies to the next read. These reads never preview, activate or change a pipeline. Terraform and MCP pipeline support and broader pipeline operations remain open.

CLI

Run these Bash commands from the checkout. read -r -s is Bash-specific; it hides input and prevents the secret from becoming a literal history entry. Run without shell tracing. The exported value is private process environment.

Shell
PORTHOLE_ORIGIN=https://your-installation.exampleread -r -s -p 'Read credential: ' PORTHOLE_CREDENTIALprintf '\n'export PORTHOLE_CREDENTIAL

List monitor definitions and query the example log:

Shell
node ./cli/porthole.mjs "$PORTHOLE_ORIGIN" list monitors --all --limit 50node ./cli/porthole.mjs "$PORTHOLE_ORIGIN" query --all < public/docs/examples/query-logs-v1.jsonunset PORTHOLE_CREDENTIAL

The list command emits one JSON page per line and follows cursors with --all. It returns only authorized definitions; an empty collection is valid. After the OTLP example has completed processing, the query command returns the synthetic log with body synthetic-porthole-4 in an otherwise empty matching scope. This command needs telemetry.read; listing monitors needs definitions.read and each monitor's signal grant.

Use get monitors OBJECT_ID, get repairs OBJECT_ID or get dashboards OBJECT_ID --version N to inspect an item. Native-session commands use PORTHOLE_SESSION containing the private Cookie header value instead of PORTHOLE_CREDENTIAL. Never copy a session into command arguments; clear the variable when finished. Supported mutations are create, update and archive, with --key KEY and, for update or archive, --revision N. Create and update consume definition JSON from stdin. A successful definition write does not execute a repair or activate a monitor.

For pipelines, use a private native session supplied in PORTHOLE_SESSION with PORTHOLE_CREDENTIAL unset:

Shell
node ./cli/porthole.mjs "$PORTHOLE_ORIGIN" get pipelines currentnode ./cli/porthole.mjs "$PORTHOLE_ORIGIN" get pipelines catalognode ./cli/porthole.mjs "$PORTHOLE_ORIGIN" get pipelines 42node ./cli/porthole.mjs "$PORTHOLE_ORIGIN" list pipelines --all --limit 50unset PORTHOLE_SESSION

list pipelines emits one history page per line. --cursor CURSOR resumes an interrupted traversal with its original limit. get pipelines defaults to current configuration. The CLI reports structured server refusals and supports no pipeline mutation command. If both authentication variables are supplied, the credential takes precedence and pipeline reads refuse.

The client accepts HTTPS origins, allows HTTP only on loopback, refuses redirects and bounds each request to 30 seconds. It prints sanitized refusal codes and Retry-After guidance without printing credentials or sessions.

MCP

The shared Streamable HTTP door is POST /mcp; the previous /api/porthole/v1/mcp URL reaches that same handler. It supports protocols 2026-07-28 and 2025-11-25. Supply the matching MCP protocol header; 2026 requests also carry the protocol version in MCP metadata and the method and tool name headers. Browser cookies never grant MCP authority.

The tools are porthole.telemetry.query (telemetry.read), porthole.definitions.read and porthole.workspace.snapshot (definitions.read). The first two are sensitive private reads; the third returns only a fingerprint of visible native definitions. They retain the same query and definition services, live scope fences and local credential quotas as REST. Tool names from the earlier dispatcher have been replaced.

Every call also passes the shared company policy door. Unset, blocked, expired or paused policy releases no content. A named person decides a held read at /agents; MCP credentials cannot approve it. An independently operated owner can configure local policy there. Business credentials bind to existing native people through signed settings, never through a matching email alone.

There are no mutation, approval, credential-minting or execution tools. Events, resources, prompts and subscriptions are explicitly undeclared. Treat returned telemetry and definitions as untrusted data. Query references are citations, not permission grants. Read the company agent guide for the supported jobs, policy, identity mapping and limitations.

For exact query fields see query reference. For refusals and recovery steps see API errors. Other configuration domains, complete Terraform ownership cutover and source-module translation are not supported by these doors.

Standard signal reads

Existing telemetry.read credentials can use bounded Prometheus remote-read and Tempo trace-by-ID. See standard signal APIs for wire versions, mappings, partial-trace evidence, limits and explicit refusals.