Current documentation. Version and compatibility notes.

Dashboard Product API

The dashboard uses a same-origin browser API. Its server holds the OAuth tokens; browser code uses an HttpOnly session cookie. Use this page for dashboard integrations and the Pages authoring workflow. For unattended customer-server work use the Automation API; for external agents and product reads use AppPortal MCP.

Origins and contracts

Sign in at https://dashboard.appportal.io, or the preview dashboard https://dashboard.stage.appportal.io. Requests below run on that same origin. The deployed routing contract is at /.well-known/appportal-bff-openapi.json (use the stage dashboard origin for preview). It describes allowed methods, routes, and security boundaries; some response and request bodies are not fully modeled yet. The examples here supply the bodies needed for the documented workflows.

Read the app directory

Run this in the browser console of your signed-in dashboard. A successful response contains the apps visible to the selected workspace; an empty collection means there are no accessible apps.

const response = await fetch('/api/core/apps', {
  credentials: 'same-origin',
  headers: { Accept: 'application/json' },
});
if (!response.ok) throw new Error(`Apps request failed: ${response.status}`);
const apps = await response.json();
console.log(apps);

Your identity and workspace membership come from the session. App, environment, and platform are authorized telemetry view selectors; setting a header cannot grant access to another account.

Make a scoped request

Set these selectors to an app you can access and one concrete environment. This helper includes the dashboard’s readable CSRF nonce on mutations; it never reads or exports the authentication cookie.

const scope = { appId: '<app-id>', environment: 'production' };

async function portalRequest(path, method = 'GET', body) {
  if (!path.startsWith('/api/')) throw new Error('Use a dashboard /api/ path');
  const headers = {
    Accept: 'application/json',
    'X-AppPortal-AppId': scope.appId,
    'X-AppPortal-Environment': scope.environment,
  };
  if (!['GET', 'HEAD', 'OPTIONS'].includes(method)) {
    const cookies = document.cookie.split('; ');
    const nonce = ['__Host-AppPortal.Csrf', 'AppPortal.Csrf']
      .map(name => cookies.find(cookie => cookie.startsWith(name + '=')))
      .find(Boolean);
    if (!nonce) throw new Error('Sign in again to obtain a CSRF nonce');
    headers['X-AppPortal-CSRF'] = decodeURIComponent(nonce.slice(nonce.indexOf('=') + 1));
  }
  if (body !== undefined) headers['Content-Type'] = 'application/json';
  const response = await fetch(path, {
    method, headers, credentials: 'same-origin',
    body: body === undefined ? undefined : JSON.stringify(body),
  });
  if (!response.ok) throw new Error(`Request failed: ${response.status}`);
  if (response.status === 204) return undefined;
  const text = await response.text();
  return text ? JSON.parse(text) : undefined;
}

const pages = await portalRequest('/api/pages');
console.log(pages);

Follow create, review, and publish a page for mutation bodies and roles. Only run mutations you intend to perform. Do not put SDK, server, upload, or internal keys into this helper.

Read BI and reporting aggregates

Use reporting over REST for bounded usage, stability, platform, and recorded performance results. It documents the paid-plan and analytics permissions, explicit date offsets, and the different dataset and metric-query boundary conventions. Those GET routes use this same authenticated browser session; they do not accept an SDK or Automation key instead.

Errors and retries

  • 400: check the documented body and a concrete environment selector.
  • 401: the dashboard session is missing or expired; sign in again.
  • 403: check workspace membership, app capability, role, plan entitlement, and CSRF nonce.
  • 404: the route or scoped resource does not exist or is not accessible.
  • 409: reload the current resource before retrying a conflicting transition.
  • 429 / 5xx: respect Retry-After when present and retry reads with bounded backoff.

Error body shapes and pagination vary by route. Inspect the response and the route’s contract; do not assume a universal cursor or envelope. Do not automatically retry a mutation after an ambiguous network failure: read its resulting state first.

Read Markdown