Dokumentation
Bläddra i dokumentationen

Analytics REST API

The Privatus Analytics REST API: add .json to any app URL and send a token. Conventions and a reference of every operation, generated from the code.

Visa som Markdown

Every page and action in Privatus Analytics is also an API endpoint. There's no separate /api/v1: add .json to a URL and send an API token.

sh
curl https://privatusanalytics.com/sites/pa_7Q2K9XH3AB/stats/aggregate.json?period=7d \
  -H "Authorization: Bearer $PRIVATUS_TOKEN"
json
{
  "data": {
    "period": { "from": "2026-09-23T00:00:00Z", "to": "2026-09-30T00:00:00Z" },
    "metrics": {
      "visitors": 1840, "visits": 2310, "pageviews": 5122,
      "views_per_visit": 2.22, "bounce_rate": 41.3,
      "visit_duration": 48000, "revenue": 129900
    }
  }
}

The reference below lists every operation with its method, path, permission, input schema and response schema. It's generated from the running code, as is the OpenAPI 3.1 document, so neither can drift from what the server does. The same operations are MCP tools.

Conventions#

Base URL https://privatusanalytics.com
Format JSON. Add .json to the path (or send Accept: application/json)
Auth Authorization: Bearer pat_… (Authentication)
Ids Public ids with a prefix: ws_… workspaces, pa_… sites, seg_… segments, wh_… webhooks
Reads GET with query parameters
Writes POST, PATCH, DELETE with a JSON body of flat fields
Success { "data": … }, plus "meta" for lists
Errors { "error": { "code", "message", "details" } } (Errors)
Lists page and per_page (max 100) (Pagination)
Times ISO 8601 in UTC. Date parameters (from, to) are days in the site's timezone
Money Minor units (cents) in the site currency, e.g. revenue: 129900 = 1,299.00
Durations Milliseconds

Common tasks#

Task Operation
List workspaces GET /workspaces.json
List sites GET /workspaces/{workspace_id}/sites.json
Headline metrics GET /sites/{site_id}/stats/aggregate.json
Chart data GET /sites/{site_id}/stats/timeseries.json
Top pages, sources, countries… GET /sites/{site_id}/breakdown/{dimension}.json
Everything on the Overview GET /sites/{site_id}/overview.json
Live visitors GET /sites/{site_id}/live.json
Add a note (e.g. a deploy) POST /sites/{site_id}/notes.json

See Stats endpoints and Examples.

In this section#

Authentication · Errors · Pagination · Rate limits · Filters · Stats endpoints · Examples · Webhooks · Changelog and deprecation

Sending data in is a different API: see Server-side ingest.

Alla operationer

Autentisering

Skicka Authorization: Bearer pat_…. Skapa token under Arbetsytans inställningar, API-token. Guide för autentisering.

JSON överallt

Lägg till .json på vilken sökväg som helst. Svar är { "data": … } och fel är { "error": { "code", "message" } }. Fel.

MCP

Skicka JSON-RPC med POST till https://privatusanalytics.com/mcp med samma token. Varje operation nedan är ett verktyg. MCP-guide.

Ladda ner openapi.json · 285 operationer

API-token

POST /workspaces/:workspace_id/api_tokens.json Skapa en API-token (token returneras en gång) api_tokens_create

Behörighet: member

Exempel
curl -X POST https://privatusanalytics.com/workspaces/:workspace_id/api_tokens.json \
  -H "Authorization: Bearer $PRIVATUS_TOKEN" \
  -H "Content-Type: application/json" -d '{…}'
Indata
{
  "type": "object",
  "properties": {
    "name": {
      "type": "string",
      "description": "Ett namn att känna igen token på",
      "examples": [
        "CI deploys"
      ]
    },
    "permissions": {
      "type": "array",
      "items": {
        "type": "string",
        "enum": [
          "analytics.read",
          "analytics.export",
          "content.write",
          "sites.manage",
          "uptime.manage",
          "members.manage",
          "tokens.manage",
          "billing.manage",
          "workspace.manage"
        ]
      },
      "description": "Behörigheter (utelämna för alla dina, en tom lista nekas)"
    },
    "site_ids": {
      "type": "array",
      "items": {
        "type": "string"
      },
      "description": "Begränsa till dessa webbplats-id (pa_…). Tomt = alla",
      "default": []
    },
    "expires_at": {
      "type": "string",
      "format": "date-time",
      "description": "Utgångstid (ISO 8601). Tomt = aldrig"
    },
    "allowed_ips": {
      "type": "array",
      "items": {
        "type": "string"
      },
      "description": "Acceptera bara förfrågningar från dessa IP-adresser/CIDR",
      "default": []
    },
    "workspace_id": {
      "type": "string",
      "description": "Arbetsyte-id, t.ex. ws_7Q2K9XH3AB"
    }
  },
  "required": [
    "name",
    "workspace_id"
  ]
}
Svarsdata
{
  "type": "object",
  "properties": {
    "id": {
      "type": "string",
      "format": "uuid"
    },
    "name": {
      "type": "string"
    },
    "token": {
      "anyOf": [
        {
          "type": "string",
          "description": "Själva token: returneras bara när den skapas"
        },
        {
          "type": "null"
        }
      ]
    },
    "token_prefix": {
      "type": "string",
      "description": "De första tecknen, för att känna igen token"
    },
    "owner": {
      "type": "string",
      "description": "E-post till medlemmen som äger den"
    },
    "permissions": {
      "type": "array",
      "items": {
        "type": "string"
      }
    },
    "site_ids": {
      "type": "array",
      "items": {
        "type": "string"
      },
      "description": "Begränsad till dessa webbplatser (tomt = alla)"
    },
    "allowed_ips": {
      "type": "array",
      "items": {
        "type": "string"
      }
    },
    "oauth_client": {
      "anyOf": [
        {
          "type": "string",
          "description": "MCP-klient som fick den"
        },
        {
          "type": "null"
        }
      ]
    },
    "status": {
      "type": "string",
      "description": "active, expired eller revoked"
    },
    "expires_at": {
      "anyOf": [
        {
          "type": "string",
          "format": "date-time"
        },
        {
          "type": "null"
        }
      ]
    },
    "last_used_at": {
      "anyOf": [
        {
          "type": "string",
          "format": "date-time"
        },
        {
          "type": "null"
        }
      ]
    },
    "revoked_at": {
      "anyOf": [
        {
          "type": "string",
          "format": "date-time"
        },
        {
          "type": "null"
        }
      ]
    },
    "created_at": {
      "type": "string",
      "format": "date-time"
    }
  }
}
DELETE /workspaces/:workspace_id/api_tokens/:id.json Återkalla en API-token api_tokens_delete

Behörighet: member

Exempel
curl -X DELETE https://privatusanalytics.com/workspaces/:workspace_id/api_tokens/:id.json \
  -H "Authorization: Bearer $PRIVATUS_TOKEN" \
  -H "Content-Type: application/json" -d '{…}'
Indata
{
  "type": "object",
  "properties": {
    "workspace_id": {
      "type": "string",
      "description": "Arbetsyte-id, t.ex. ws_7Q2K9XH3AB"
    },
    "id": {
      "type": "string",
      "description": "Id för resursen"
    }
  },
  "required": [
    "workspace_id",
    "id"
  ]
}
Svarsdata
{
  "type": "object",
  "properties": {
    "id": {
      "type": "string",
      "format": "uuid"
    },
    "name": {
      "type": "string"
    },
    "token": {
      "anyOf": [
        {
          "type": "string",
          "description": "Själva token: returneras bara när den skapas"
        },
        {
          "type": "null"
        }
      ]
    },
    "token_prefix": {
      "type": "string",
      "description": "De första tecknen, för att känna igen token"
    },
    "owner": {
      "type": "string",
      "description": "E-post till medlemmen som äger den"
    },
    "permissions": {
      "type": "array",
      "items": {
        "type": "string"
      }
    },
    "site_ids": {
      "type": "array",
      "items": {
        "type": "string"
      },
      "description": "Begränsad till dessa webbplatser (tomt = alla)"
    },
    "allowed_ips": {
      "type": "array",
      "items": {
        "type": "string"
      }
    },
    "oauth_client": {
      "anyOf": [
        {
          "type": "string",
          "description": "MCP-klient som fick den"
        },
        {
          "type": "null"
        }
      ]
    },
    "status": {
      "type": "string",
      "description": "active, expired eller revoked"
    },
    "expires_at": {
      "anyOf": [
        {
          "type": "string",
          "format": "date-time"
        },
        {
          "type": "null"
        }
      ]
    },
    "last_used_at": {
      "anyOf": [
        {
          "type": "string",
          "format": "date-time"
        },
        {
          "type": "null"
        }
      ]
    },
    "revoked_at": {
      "anyOf": [
        {
          "type": "string",
          "format": "date-time"
        },
        {
          "type": "null"
        }
      ]
    },
    "created_at": {
      "type": "string",
      "format": "date-time"
    }
  }
}
GET /workspaces/:workspace_id/api_tokens.json Lista API-token api_tokens_list

Behörighet: member

Exempel
curl https://privatusanalytics.com/workspaces/:workspace_id/api_tokens.json \
  -H "Authorization: Bearer $PRIVATUS_TOKEN"
Indata
{
  "type": "object",
  "properties": {
    "include_revoked": {
      "type": "boolean",
      "description": "Lista även återkallade och utgångna token",
      "default": false
    },
    "workspace_id": {
      "type": "string",
      "description": "Arbetsyte-id, t.ex. ws_7Q2K9XH3AB"
    },
    "page": {
      "type": "integer",
      "description": "Sida (från 1)"
    },
    "per_page": {
      "type": "integer",
      "description": "Resultat per sida (max 100)"
    }
  },
  "required": [
    "workspace_id"
  ]
}
Svarsdata
{
  "type": "array",
  "items": {
    "type": "object",
    "properties": {
      "id": {
        "type": "string",
        "format": "uuid"
      },
      "name": {
        "type": "string"
      },
      "token": {
        "anyOf": [
          {
            "type": "string",
            "description": "Själva token: returneras bara när den skapas"
          },
          {
            "type": "null"
          }
        ]
      },
      "token_prefix": {
        "type": "string",
        "description": "De första tecknen, för att känna igen token"
      },
      "owner": {
        "type": "string",
        "description": "E-post till medlemmen som äger den"
      },
      "permissions": {
        "type": "array",
        "items": {
          "type": "string"
        }
      },
      "site_ids": {
        "type": "array",
        "items": {
          "type": "string"
        },
        "description": "Begränsad till dessa webbplatser (tomt = alla)"
      },
      "allowed_ips": {
        "type": "array",
        "items": {
          "type": "string"
        }
      },
      "oauth_client": {
        "anyOf": [
          {
            "type": "string",
            "description": "MCP-klient som fick den"
          },
          {
            "type": "null"
          }
        ]
      },
      "status": {
        "type": "string",
        "description": "active, expired eller revoked"
      },
      "expires_at": {
        "anyOf": [
          {
            "type": "string",
            "format": "date-time"
          },
          {
            "type": "null"
          }
        ]
      },
      "last_used_at": {
        "anyOf": [
          {
            "type": "string",
            "format": "date-time"
          },
          {
            "type": "null"
          }
        ]
      },
      "revoked_at": {
        "anyOf": [
          {
            "type": "string",
            "format": "date-time"
          },
          {
            "type": "null"
          }
        ]
      },
      "created_at": {
        "type": "string",
        "format": "date-time"
      }
    }
  }
}

Affiliateprogram

GET /account/affiliate/commissions.json Lista dina affiliateprovisioner affiliate_commissions_list

Provisioner, återtaganden vid återbetalning och chargeback samt återföringar, nyast först. Beloppen anges i cent.

Behörighet: member

Exempel
curl https://privatusanalytics.com/account/affiliate/commissions.json \
  -H "Authorization: Bearer $PRIVATUS_TOKEN"
Indata
{
  "type": "object",
  "properties": {
    "status": {
      "type": "string",
      "description": "Endast provisioner med den här statusen",
      "enum": [
        "pending",
        "approved",
        "paid",
        "void"
      ]
    },
    "page": {
      "type": "integer",
      "description": "Sida (från 1)"
    },
    "per_page": {
      "type": "integer",
      "description": "Resultat per sida (max 100)"
    }
  },
  "required": []
}
Svarsdata
{
  "type": "array",
  "items": {
    "type": "object",
    "properties": {
      "id": {
        "type": "string",
        "format": "uuid",
        "description": "Provisions-id"
      },
      "kind": {
        "type": "string",
        "description": "commission, clawback (återbetalning eller chargeback) eller reversal"
      },
      "status": {
        "type": "string",
        "description": "pending (på vänt), approved (kan betalas ut), paid eller void"
      },
      "amount_cents": {
        "type": "integer",
        "description": "Din andel i cent (negativ vid ett återtagande)"
      },
      "basis_cents": {
        "type": "integer",
        "description": "Nettobetalningen (exklusive skatt) som den beräknades på, i cent"
      },
      "currency": {
        "type": "string",
        "description": "ISO-valutakod"
      },
      "earned_at": {
        "type": "string",
        "format": "date-time",
        "description": "När betalningen (eller återbetalningen) skedde"
      },
      "approved_at": {
        "anyOf": [
          {
            "type": "string",
            "format": "date-time",
            "description": "När den blev möjlig att betala ut"
          },
          {
            "type": "null"
          }
        ]
      },
      "paid_at": {
        "anyOf": [
          {
            "type": "string",
            "format": "date-time",
            "description": "När den betalades ut"
          },
          {
            "type": "null"
          }
        ]
      }
    }
  }
}
GET /account/affiliate/signup-box.json Hämta koden och resultaten för din registreringsruta för affiliates affiliate_signup_box_get

Inbäddningskoden för din registreringsruta (ett skript och en vanlig iframe) för det valda temat, attributen som förifyller formuläret, händelserna som skriptet skickar på din sida samt rutans siffror: registreringar som väntar på bekräftelse, bekräftade registreringar och betalande kunder. available är false tills din affiliateansökan har godkänts.

Behörighet: member

Exempel
curl https://privatusanalytics.com/account/affiliate/signup-box.json \
  -H "Authorization: Bearer $PRIVATUS_TOKEN"
Indata
{
  "type": "object",
  "properties": {
    "theme": {
      "type": "string",
      "description": "Rutans tema: auto (följer besökarens enhet), light eller dark",
      "enum": [
        "auto",
        "light",
        "dark"
      ],
      "examples": [
        "auto"
      ],
      "default": "auto"
    }
  },
  "required": []
}
Svarsdata
{
  "type": "object",
  "properties": {
    "available": {
      "type": "boolean",
      "description": "Om du har en registreringsruta (endast godkända affiliates)"
    },
    "theme": {
      "type": "string",
      "description": "Temat som koden byggdes för"
    },
    "frame_url": {
      "anyOf": [
        {
          "type": "string",
          "description": "Rutans adress, för en vanlig iframe"
        },
        {
          "type": "null"
        }
      ]
    },
    "script": {
      "anyOf": [
        {
          "type": "string",
          "description": "Inbäddningskoden för skriptet: ett element och inläsningsskriptet"
        },
        {
          "type": "null"
        }
      ]
    },
    "iframe": {
      "anyOf": [
        {
          "type": "string",
          "description": "Inbäddningskoden för den vanliga iframen"
        },
        {
          "type": "null"
        }
      ]
    },
    "prefill_attributes": {
      "type": "array",
      "description": "Attribut på elementet som förifyller formuläret för inloggade besökare"
    },
    "events": {
      "type": "array",
      "description": "DOM-händelser som skriptet skickar på elementet"
    },
    "waiting": {
      "type": "integer",
      "description": "Registreringar vars mejlade länk ännu inte har öppnats"
    },
    "signups": {
      "type": "integer",
      "description": "Bekräftade registreringar som kom via rutan"
    },
    "customers": {
      "type": "integer",
      "description": "De som blev betalande kunder"
    }
  }
}
GET /account/affiliate.json Hämta din affiliatestatus, rekommendationslänk och statistik affiliate_get

Status för din affiliateansökan, rekommendationslänk, registreringar och betalande kunder du har värvat, samt saldon per valuta (på vänt, kan betalas ut, utbetalt). status är none när du inte har ansökt.

Behörighet: member

Exempel
curl https://privatusanalytics.com/account/affiliate.json \
  -H "Authorization: Bearer $PRIVATUS_TOKEN"
Indata
{
  "type": "object",
  "properties": {},
  "required": []
}
Svarsdata
{
  "type": "object",
  "properties": {
    "status": {
      "type": "string",
      "description": "none (inte ansökt), pending, approved, rejected eller suspended"
    },
    "code": {
      "anyOf": [
        {
          "type": "string",
          "description": "Din rekommendationskod"
        },
        {
          "type": "null"
        }
      ]
    },
    "referral_url": {
      "anyOf": [
        {
          "type": "string",
          "description": "Länken att dela (endast godkända affiliates)"
        },
        {
          "type": "null"
        }
      ]
    },
    "payout_method": {
      "anyOf": [
        {
          "type": "string",
          "description": "wise eller credit"
        },
        {
          "type": "null"
        }
      ]
    },
    "rejection_reason": {
      "anyOf": [
        {
          "type": "string",
          "description": "Varför den senaste ansökan avslogs"
        },
        {
          "type": "null"
        }
      ]
    },
    "applied_at": {
      "anyOf": [
        {
          "type": "string",
          "format": "date-time",
          "description": "När du ansökte"
        },
        {
          "type": "null"
        }
      ]
    },
    "approved_at": {
      "anyOf": [
        {
          "type": "string",
          "format": "date-time",
          "description": "När ansökan godkändes"
        },
        {
          "type": "null"
        }
      ]
    },
    "credit_blocked": {
      "anyOf": [
        {
          "type": "string",
          "description": "Varför kontokrediten väntar: program (arbetsytan är med i ett rabattprogram), no_subscription eller no_workspace. null när inget blockerar den"
        },
        {
          "type": "null"
        }
      ]
    },
    "signups": {
      "type": "integer",
      "description": "Konton som skapats via din länk eller kod"
    },
    "customers": {
      "type": "integer",
      "description": "Värvade arbetsytor som har betalat"
    },
    "balances": {
      "type": "array",
      "description": "Per valuta: pending_cents (på vänt), approved_cents (kan betalas ut) och paid_cents"
    },
    "payouts": {
      "type": "array",
      "description": "Senaste utbetalningar med amount_cents, currency, payout_method, status (applied: kontokredit som väntar på din nästa förnyelse, eller paid), applied_at och paid_at"
    },
    "terms": {
      "type": "object",
      "description": "Provision i procent, månader, väntedagar och utbetalningsgränsen för Wise i cent"
    }
  }
}

Analys

GET /sites/:site_id/overview.json Webbplatsöversikt: mätvärden, diagramserier, toppaneler, live-besökare och anteckningar stats_overview

Behörighet: analytics.read

Exempel
curl https://privatusanalytics.com/sites/:site_id/overview.json \
  -H "Authorization: Bearer $PRIVATUS_TOKEN"
Indata
{
  "type": "object",
  "properties": {
    "period": {
      "type": "string",
      "description": "Förinställt datumintervall. Använd custom med from/to",
      "enum": [
        "today",
        "yesterday",
        "24h",
        "7d",
        "14d",
        "28d",
        "30d",
        "90d",
        "mtd",
        "last_month",
        "qtd",
        "last_quarter",
        "ytd",
        "12mo",
        "last_year",
        "all",
        "custom"
      ],
      "default": "30d"
    },
    "from": {
      "type": "string",
      "format": "date",
      "description": "Start för eget intervall (webbplatsens tidszon)"
    },
    "to": {
      "type": "string",
      "format": "date",
      "description": "Slut för eget intervall, inklusive"
    },
    "compare": {
      "type": "string",
      "description": "Jämförelseperiod",
      "enum": [
        "none",
        "previous_period",
        "previous_year",
        "custom"
      ],
      "default": "none"
    },
    "compare_from": {
      "type": "string",
      "format": "date",
      "description": "Start för egen jämförelse"
    },
    "compare_to": {
      "type": "string",
      "format": "date",
      "description": "Slut för egen jämförelse"
    },
    "match_weekday": {
      "type": "boolean",
      "description": "Justera jämförelsedagarna efter veckodag",
      "default": false
    },
    "filters": {
      "type": "array",
      "items": {},
      "description": "Filter: [[\"dimension\",\"operator\",\"value\"], …]. Operatorer: is, is_not, any_of, none_of, contains, not_contains, starts_with, regex, not_regex, gt, lt, between. Omslut villkor med {\"any\": [...]} för ELLER.",
      "default": []
    },
    "segment_id": {
      "type": "string",
      "description": "Tillämpa ett sparat segment (seg_…)"
    },
    "include_imported": {
      "type": "boolean",
      "description": "Lägg till importerade historiska data (datum före den första inbyggda händelsen, ignoreras när filter eller ett segment tillämpas)",
      "default": false
    },
    "interval": {
      "type": "string",
      "description": "Intervallstorlek för diagrammet",
      "enum": [
        "auto",
        "minute",
        "hour",
        "day",
        "week",
        "month",
        "quarter",
        "year"
      ],
      "default": "auto"
    },
    "panels": {
      "type": "array",
      "items": {
        "type": "string"
      },
      "description": "Dimensioner att ta med toppvärden för",
      "default": [
        "channel",
        "referrer",
        "page",
        "entry_page",
        "country",
        "device",
        "browser",
        "os",
        "utm_campaign",
        "event",
        "goal"
      ]
    },
    "site_id": {
      "type": "string",
      "description": "Webbplats-id, t.ex. pa_7Q2K9XH3AB"
    }
  },
  "required": [
    "site_id"
  ]
}
Svarsdata
{
  "type": "object"
}
GET /sites/:site_id/experiments.json Experimentrapport: konverteringsgrad per variant, uplift mot kontroll och signifikans (z-test för två proportioner) experiments_report

Behörighet: analytics.read

Exempel
curl https://privatusanalytics.com/sites/:site_id/experiments.json \
  -H "Authorization: Bearer $PRIVATUS_TOKEN"
Indata
{
  "type": "object",
  "properties": {
    "period": {
      "type": "string",
      "description": "Förinställt datumintervall. Använd custom med from/to",
      "enum": [
        "today",
        "yesterday",
        "24h",
        "7d",
        "14d",
        "28d",
        "30d",
        "90d",
        "mtd",
        "last_month",
        "qtd",
        "last_quarter",
        "ytd",
        "12mo",
        "last_year",
        "all",
        "custom"
      ],
      "default": "30d"
    },
    "from": {
      "type": "string",
      "format": "date",
      "description": "Start för eget intervall (webbplatsens tidszon)"
    },
    "to": {
      "type": "string",
      "format": "date",
      "description": "Slut för eget intervall, inklusive"
    },
    "compare": {
      "type": "string",
      "description": "Jämförelseperiod",
      "enum": [
        "none",
        "previous_period",
        "previous_year",
        "custom"
      ],
      "default": "none"
    },
    "compare_from": {
      "type": "string",
      "format": "date",
      "description": "Start för egen jämförelse"
    },
    "compare_to": {
      "type": "string",
      "format": "date",
      "description": "Slut för egen jämförelse"
    },
    "match_weekday": {
      "type": "boolean",
      "description": "Justera jämförelsedagarna efter veckodag",
      "default": false
    },
    "filters": {
      "type": "array",
      "items": {},
      "description": "Filter: [[\"dimension\",\"operator\",\"value\"], …]. Operatorer: is, is_not, any_of, none_of, contains, not_contains, starts_with, regex, not_regex, gt, lt, between. Omslut villkor med {\"any\": [...]} för ELLER.",
      "default": []
    },
    "segment_id": {
      "type": "string",
      "description": "Tillämpa ett sparat segment (seg_…)"
    },
    "include_imported": {
      "type": "boolean",
      "description": "Lägg till importerade historiska data (datum före den första inbyggda händelsen, ignoreras när filter eller ett segment tillämpas)",
      "default": false
    },
    "property": {
      "type": "string",
      "description": "Händelseegenskap som håller varianten, t.ex. variant",
      "examples": [
        "variant"
      ]
    },
    "goal_id": {
      "type": "string",
      "description": "Mål som räknas som en konvertering (goal_…)"
    },
    "control": {
      "type": "string",
      "description": "Kontrollvariant (standard är \"control\" om den finns, annars varianten med flest besök)"
    },
    "site_id": {
      "type": "string",
      "description": "Webbplats-id, t.ex. pa_7Q2K9XH3AB"
    }
  },
  "required": [
    "property",
    "goal_id",
    "site_id"
  ]
}
Svarsdata
{
  "type": "object"
}
GET /sites/:site_id/insights.json Anmärkningsvärda förändringar jämfört med föregående period, på vanligt språk (största förändringar, ändrad målkonvertering) insights_get

Behörighet: analytics.read

Exempel
curl https://privatusanalytics.com/sites/:site_id/insights.json \
  -H "Authorization: Bearer $PRIVATUS_TOKEN"
Indata
{
  "type": "object",
  "properties": {
    "period": {
      "type": "string",
      "description": "Hela dagar fram till igår, jämfört med lika många dagar före",
      "enum": [
        "7d",
        "14d",
        "28d",
        "30d"
      ],
      "default": "7d"
    },
    "limit": {
      "type": "integer",
      "description": "Max antal insikter (1 till 20)",
      "default": 8
    },
    "site_id": {
      "type": "string",
      "description": "Webbplats-id, t.ex. pa_7Q2K9XH3AB"
    }
  },
  "required": [
    "site_id"
  ]
}
Svarsdata
{
  "type": "object"
}
GET /sites/:site_id/journeys.json Resor: de 3 vanligaste stegvägarna efter en sida (eller valfri ingång), eller före en sida eller ett mål journeys_explore

Behörighet: analytics.read

Exempel
curl https://privatusanalytics.com/sites/:site_id/journeys.json \
  -H "Authorization: Bearer $PRIVATUS_TOKEN"
Indata
{
  "type": "object",
  "properties": {
    "period": {
      "type": "string",
      "description": "Förinställt datumintervall. Använd custom med from/to",
      "enum": [
        "today",
        "yesterday",
        "24h",
        "7d",
        "14d",
        "28d",
        "30d",
        "90d",
        "mtd",
        "last_month",
        "qtd",
        "last_quarter",
        "ytd",
        "12mo",
        "last_year",
        "all",
        "custom"
      ],
      "default": "30d"
    },
    "from": {
      "type": "string",
      "format": "date",
      "description": "Start för eget intervall (webbplatsens tidszon)"
    },
    "to": {
      "type": "string",
      "format": "date",
      "description": "Slut för eget intervall, inklusive"
    },
    "compare": {
      "type": "string",
      "description": "Jämförelseperiod",
      "enum": [
        "none",
        "previous_period",
        "previous_year",
        "custom"
      ],
      "default": "none"
    },
    "compare_from": {
      "type": "string",
      "format": "date",
      "description": "Start för egen jämförelse"
    },
    "compare_to": {
      "type": "string",
      "format": "date",
      "description": "Slut för egen jämförelse"
    },
    "match_weekday": {
      "type": "boolean",
      "description": "Justera jämförelsedagarna efter veckodag",
      "default": false
    },
    "filters": {
      "type": "array",
      "items": {},
      "description": "Filter: [[\"dimension\",\"operator\",\"value\"], …]. Operatorer: is, is_not, any_of, none_of, contains, not_contains, starts_with, regex, not_regex, gt, lt, between. Omslut villkor med {\"any\": [...]} för ELLER.",
      "default": []
    },
    "segment_id": {
      "type": "string",
      "description": "Tillämpa ett sparat segment (seg_…)"
    },
    "include_imported": {
      "type": "boolean",
      "description": "Lägg till importerade historiska data (datum före den första inbyggda händelsen, ignoreras när filter eller ett segment tillämpas)",
      "default": false
    },
    "mode": {
      "type": "string",
      "description": "forward: sidor efter startsidan, reverse: sidor som leder till slutsidan eller målet",
      "enum": [
        "forward",
        "reverse"
      ],
      "default": "forward"
    },
    "path": {
      "type": "string",
      "description": "Startsida (forward) eller slutsida (reverse). Tomt betyder valfri ingång (endast forward)"
    },
    "goal_id": {
      "type": "string",
      "description": "Reverse-läge: sluta vid det här målet (goal_…) istället för en sida"
    },
    "limit": {
      "type": "integer",
      "description": "Sidor som visas per steg (max 12)",
      "default": 6
    },
    "site_id": {
      "type": "string",
      "description": "Webbplats-id, t.ex. pa_7Q2K9XH3AB"
    }
  },
  "required": [
    "site_id"
  ]
}
Svarsdata
{
  "type": "object"
}
GET /sites/:site_id/pages/detail.json Sidinformation: mätvärden, föregående och nästa sidor, källor, Web Vitals, händelser och klickkarta för en sökväg pages_detail

Behörighet: analytics.read

Exempel
curl https://privatusanalytics.com/sites/:site_id/pages/detail.json \
  -H "Authorization: Bearer $PRIVATUS_TOKEN"
Indata
{
  "type": "object",
  "properties": {
    "period": {
      "type": "string",
      "description": "Förinställt datumintervall. Använd custom med from/to",
      "enum": [
        "today",
        "yesterday",
        "24h",
        "7d",
        "14d",
        "28d",
        "30d",
        "90d",
        "mtd",
        "last_month",
        "qtd",
        "last_quarter",
        "ytd",
        "12mo",
        "last_year",
        "all",
        "custom"
      ],
      "default": "30d"
    },
    "from": {
      "type": "string",
      "format": "date",
      "description": "Start för eget intervall (webbplatsens tidszon)"
    },
    "to": {
      "type": "string",
      "format": "date",
      "description": "Slut för eget intervall, inklusive"
    },
    "compare": {
      "type": "string",
      "description": "Jämförelseperiod",
      "enum": [
        "none",
        "previous_period",
        "previous_year",
        "custom"
      ],
      "default": "none"
    },
    "compare_from": {
      "type": "string",
      "format": "date",
      "description": "Start för egen jämförelse"
    },
    "compare_to": {
      "type": "string",
      "format": "date",
      "description": "Slut för egen jämförelse"
    },
    "match_weekday": {
      "type": "boolean",
      "description": "Justera jämförelsedagarna efter veckodag",
      "default": false
    },
    "filters": {
      "type": "array",
      "items": {},
      "description": "Filter: [[\"dimension\",\"operator\",\"value\"], …]. Operatorer: is, is_not, any_of, none_of, contains, not_contains, starts_with, regex, not_regex, gt, lt, between. Omslut villkor med {\"any\": [...]} för ELLER.",
      "default": []
    },
    "segment_id": {
      "type": "string",
      "description": "Tillämpa ett sparat segment (seg_…)"
    },
    "include_imported": {
      "type": "boolean",
      "description": "Lägg till importerade historiska data (datum före den första inbyggda händelsen, ignoreras när filter eller ett segment tillämpas)",
      "default": false
    },
    "path": {
      "type": "string",
      "description": "Sidans sökväg, t.ex. /pricing",
      "examples": [
        "/pricing"
      ]
    },
    "site_id": {
      "type": "string",
      "description": "Webbplats-id, t.ex. pa_7Q2K9XH3AB"
    }
  },
  "required": [
    "path",
    "site_id"
  ]
}
Svarsdata
{
  "type": "object"
}
GET /sites/:site_id/stats/aggregate.json Huvudmått för en period (med jämförelse) stats_aggregate

Behörighet: analytics.read

Exempel
curl https://privatusanalytics.com/sites/:site_id/stats/aggregate.json \
  -H "Authorization: Bearer $PRIVATUS_TOKEN"
Indata
{
  "type": "object",
  "properties": {
    "period": {
      "type": "string",
      "description": "Förinställt datumintervall. Använd custom med from/to",
      "enum": [
        "today",
        "yesterday",
        "24h",
        "7d",
        "14d",
        "28d",
        "30d",
        "90d",
        "mtd",
        "last_month",
        "qtd",
        "last_quarter",
        "ytd",
        "12mo",
        "last_year",
        "all",
        "custom"
      ],
      "default": "30d"
    },
    "from": {
      "type": "string",
      "format": "date",
      "description": "Start för eget intervall (webbplatsens tidszon)"
    },
    "to": {
      "type": "string",
      "format": "date",
      "description": "Slut för eget intervall, inklusive"
    },
    "compare": {
      "type": "string",
      "description": "Jämförelseperiod",
      "enum": [
        "none",
        "previous_period",
        "previous_year",
        "custom"
      ],
      "default": "none"
    },
    "compare_from": {
      "type": "string",
      "format": "date",
      "description": "Start för egen jämförelse"
    },
    "compare_to": {
      "type": "string",
      "format": "date",
      "description": "Slut för egen jämförelse"
    },
    "match_weekday": {
      "type": "boolean",
      "description": "Justera jämförelsedagarna efter veckodag",
      "default": false
    },
    "filters": {
      "type": "array",
      "items": {},
      "description": "Filter: [[\"dimension\",\"operator\",\"value\"], …]. Operatorer: is, is_not, any_of, none_of, contains, not_contains, starts_with, regex, not_regex, gt, lt, between. Omslut villkor med {\"any\": [...]} för ELLER.",
      "default": []
    },
    "segment_id": {
      "type": "string",
      "description": "Tillämpa ett sparat segment (seg_…)"
    },
    "include_imported": {
      "type": "boolean",
      "description": "Lägg till importerade historiska data (datum före den första inbyggda händelsen, ignoreras när filter eller ett segment tillämpas)",
      "default": false
    },
    "site_id": {
      "type": "string",
      "description": "Webbplats-id, t.ex. pa_7Q2K9XH3AB"
    }
  },
  "required": [
    "site_id"
  ]
}
Svarsdata
{
  "type": "object"
}
GET /sites/:site_id/breakdown/:dimension.json Toppvärden för en dimension (sidor, källor, länder…) stats_breakdown

Behörighet: analytics.read

Exempel
curl https://privatusanalytics.com/sites/:site_id/breakdown/:dimension.json \
  -H "Authorization: Bearer $PRIVATUS_TOKEN"
Indata
{
  "type": "object",
  "properties": {
    "period": {
      "type": "string",
      "description": "Förinställt datumintervall. Använd custom med from/to",
      "enum": [
        "today",
        "yesterday",
        "24h",
        "7d",
        "14d",
        "28d",
        "30d",
        "90d",
        "mtd",
        "last_month",
        "qtd",
        "last_quarter",
        "ytd",
        "12mo",
        "last_year",
        "all",
        "custom"
      ],
      "default": "30d"
    },
    "from": {
      "type": "string",
      "format": "date",
      "description": "Start för eget intervall (webbplatsens tidszon)"
    },
    "to": {
      "type": "string",
      "format": "date",
      "description": "Slut för eget intervall, inklusive"
    },
    "compare": {
      "type": "string",
      "description": "Jämförelseperiod",
      "enum": [
        "none",
        "previous_period",
        "previous_year",
        "custom"
      ],
      "default": "none"
    },
    "compare_from": {
      "type": "string",
      "format": "date",
      "description": "Start för egen jämförelse"
    },
    "compare_to": {
      "type": "string",
      "format": "date",
      "description": "Slut för egen jämförelse"
    },
    "match_weekday": {
      "type": "boolean",
      "description": "Justera jämförelsedagarna efter veckodag",
      "default": false
    },
    "filters": {
      "type": "array",
      "items": {},
      "description": "Filter: [[\"dimension\",\"operator\",\"value\"], …]. Operatorer: is, is_not, any_of, none_of, contains, not_contains, starts_with, regex, not_regex, gt, lt, between. Omslut villkor med {\"any\": [...]} för ELLER.",
      "default": []
    },
    "segment_id": {
      "type": "string",
      "description": "Tillämpa ett sparat segment (seg_…)"
    },
    "include_imported": {
      "type": "boolean",
      "description": "Lägg till importerade historiska data (datum före den första inbyggda händelsen, ignoreras när filter eller ett segment tillämpas)",
      "default": false
    },
    "dimension": {
      "type": "string",
      "description": "Dimension för resursen"
    },
    "limit": {
      "type": "integer",
      "description": "Rader per sida (max 1000)",
      "default": 10
    },
    "page": {
      "type": "integer",
      "description": "Sidnummer",
      "default": 1
    },
    "sort": {
      "type": "string",
      "description": "Sorteringsmätvärde",
      "enum": [
        "visitors",
        "visits",
        "pageviews",
        "revenue"
      ]
    },
    "site_id": {
      "type": "string",
      "description": "Webbplats-id, t.ex. pa_7Q2K9XH3AB"
    }
  },
  "required": [
    "dimension",
    "site_id"
  ]
}
Svarsdata
{
  "type": "object"
}
GET /sites/:site_id/stats/timeseries.json Mätvärden per tidsintervall för diagram stats_timeseries

Behörighet: analytics.read

Exempel
curl https://privatusanalytics.com/sites/:site_id/stats/timeseries.json \
  -H "Authorization: Bearer $PRIVATUS_TOKEN"
Indata
{
  "type": "object",
  "properties": {
    "period": {
      "type": "string",
      "description": "Förinställt datumintervall. Använd custom med from/to",
      "enum": [
        "today",
        "yesterday",
        "24h",
        "7d",
        "14d",
        "28d",
        "30d",
        "90d",
        "mtd",
        "last_month",
        "qtd",
        "last_quarter",
        "ytd",
        "12mo",
        "last_year",
        "all",
        "custom"
      ],
      "default": "30d"
    },
    "from": {
      "type": "string",
      "format": "date",
      "description": "Start för eget intervall (webbplatsens tidszon)"
    },
    "to": {
      "type": "string",
      "format": "date",
      "description": "Slut för eget intervall, inklusive"
    },
    "compare": {
      "type": "string",
      "description": "Jämförelseperiod",
      "enum": [
        "none",
        "previous_period",
        "previous_year",
        "custom"
      ],
      "default": "none"
    },
    "compare_from": {
      "type": "string",
      "format": "date",
      "description": "Start för egen jämförelse"
    },
    "compare_to": {
      "type": "string",
      "format": "date",
      "description": "Slut för egen jämförelse"
    },
    "match_weekday": {
      "type": "boolean",
      "description": "Justera jämförelsedagarna efter veckodag",
      "default": false
    },
    "filters": {
      "type": "array",
      "items": {},
      "description": "Filter: [[\"dimension\",\"operator\",\"value\"], …]. Operatorer: is, is_not, any_of, none_of, contains, not_contains, starts_with, regex, not_regex, gt, lt, between. Omslut villkor med {\"any\": [...]} för ELLER.",
      "default": []
    },
    "segment_id": {
      "type": "string",
      "description": "Tillämpa ett sparat segment (seg_…)"
    },
    "include_imported": {
      "type": "boolean",
      "description": "Lägg till importerade historiska data (datum före den första inbyggda händelsen, ignoreras när filter eller ett segment tillämpas)",
      "default": false
    },
    "interval": {
      "type": "string",
      "description": "Intervallstorlek. auto väljer en för intervallet",
      "enum": [
        "auto",
        "minute",
        "hour",
        "day",
        "week",
        "month",
        "quarter",
        "year"
      ],
      "default": "auto"
    },
    "site_id": {
      "type": "string",
      "description": "Webbplats-id, t.ex. pa_7Q2K9XH3AB"
    }
  },
  "required": [
    "site_id"
  ]
}
Svarsdata
{
  "type": "object"
}

Anteckningar

POST /sites/:site_id/notes.json Lägg till en anteckning på en webbplats (använd källan "deploy" för release-webhooks) notes_create

Behörighet: content.write

Exempel
curl -X POST https://privatusanalytics.com/sites/:site_id/notes.json \
  -H "Authorization: Bearer $PRIVATUS_TOKEN" \
  -H "Content-Type: application/json" -d '{…}'
Indata
{
  "type": "object",
  "properties": {
    "date": {
      "type": "string",
      "format": "date",
      "description": "Anteckningens dag (webbplatsens tidszon). Standard är idag"
    },
    "end_date": {
      "type": "string",
      "format": "date",
      "description": "Sista dagen, för ett datumintervall"
    },
    "title": {
      "type": "string",
      "description": "Kort titel som visas i diagram",
      "examples": [
        "Launched new pricing"
      ]
    },
    "body": {
      "type": "string",
      "description": "Detaljer (Markdown)"
    },
    "url": {
      "type": "string",
      "description": "Länk, t.ex. en PR eller ändringslogg"
    },
    "color": {
      "type": "string",
      "description": "Nålens färg",
      "enum": [
        "neutral",
        "brand",
        "blue",
        "amber",
        "red",
        "violet"
      ]
    },
    "source": {
      "type": "string",
      "description": "manual, eller deploy för release-webhooks",
      "enum": [
        "manual",
        "deploy",
        "system",
        "import",
        "incident"
      ],
      "default": "manual"
    },
    "version": {
      "type": "string",
      "description": "Deploys: releaseversion eller commit, används för standardtiteln"
    },
    "site_id": {
      "type": "string",
      "description": "Webbplats-id, t.ex. pa_7Q2K9XH3AB"
    }
  },
  "required": [
    "site_id"
  ]
}
Svarsdata
{
  "type": "object",
  "properties": {
    "id": {
      "type": "string",
      "description": "Antecknings-id, t.ex. note_7Q2K9XH3AB"
    },
    "site_id": {
      "anyOf": [
        {
          "type": "string",
          "description": "Webbplats, eller null för anteckningar för hela arbetsytan"
        },
        {
          "type": "null"
        }
      ]
    },
    "date": {
      "type": "string",
      "format": "date"
    },
    "end_date": {
      "anyOf": [
        {
          "type": "string",
          "format": "date"
        },
        {
          "type": "null"
        }
      ]
    },
    "title": {
      "type": "string"
    },
    "body": {
      "anyOf": [
        {
          "type": "string",
          "description": "Markdown"
        },
        {
          "type": "null"
        }
      ]
    },
    "url": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ]
    },
    "color": {
      "type": "string",
      "description": "neutral, brand, blue, amber, red, violet"
    },
    "source": {
      "type": "string",
      "description": "manual, deploy, system, import, incident"
    },
    "created_at": {
      "type": "string",
      "format": "date-time"
    }
  }
}
DELETE /sites/:site_id/notes/:id.json Ta bort en anteckning notes_delete

Behörighet: content.write

Exempel
curl -X DELETE https://privatusanalytics.com/sites/:site_id/notes/:id.json \
  -H "Authorization: Bearer $PRIVATUS_TOKEN" \
  -H "Content-Type: application/json" -d '{…}'
Indata
{
  "type": "object",
  "properties": {
    "site_id": {
      "type": "string",
      "description": "Webbplats-id, t.ex. pa_7Q2K9XH3AB"
    },
    "id": {
      "type": "string",
      "description": "Id för resursen"
    }
  },
  "required": [
    "site_id",
    "id"
  ]
}
Svarsdata
{
  "type": "object",
  "properties": {
    "id": {
      "type": "string",
      "description": "Antecknings-id, t.ex. note_7Q2K9XH3AB"
    },
    "site_id": {
      "anyOf": [
        {
          "type": "string",
          "description": "Webbplats, eller null för anteckningar för hela arbetsytan"
        },
        {
          "type": "null"
        }
      ]
    },
    "date": {
      "type": "string",
      "format": "date"
    },
    "end_date": {
      "anyOf": [
        {
          "type": "string",
          "format": "date"
        },
        {
          "type": "null"
        }
      ]
    },
    "title": {
      "type": "string"
    },
    "body": {
      "anyOf": [
        {
          "type": "string",
          "description": "Markdown"
        },
        {
          "type": "null"
        }
      ]
    },
    "url": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ]
    },
    "color": {
      "type": "string",
      "description": "neutral, brand, blue, amber, red, violet"
    },
    "source": {
      "type": "string",
      "description": "manual, deploy, system, import, incident"
    },
    "created_at": {
      "type": "string",
      "format": "date-time"
    }
  }
}
GET /sites/:site_id/notes.json Lista anteckningar för en webbplats (inklusive anteckningar för hela arbetsytan) notes_list

Behörighet: analytics.read

Exempel
curl https://privatusanalytics.com/sites/:site_id/notes.json \
  -H "Authorization: Bearer $PRIVATUS_TOKEN"
Indata
{
  "type": "object",
  "properties": {
    "from": {
      "type": "string",
      "format": "date",
      "description": "Endast anteckningar från och med det här datumet"
    },
    "to": {
      "type": "string",
      "format": "date",
      "description": "Endast anteckningar till och med det här datumet"
    },
    "source": {
      "type": "string",
      "description": "Endast anteckningar från den här källan",
      "enum": [
        "manual",
        "deploy",
        "system",
        "import",
        "incident"
      ]
    },
    "query": {
      "type": "string",
      "description": "Sök i titel, text och länk"
    },
    "site_id": {
      "type": "string",
      "description": "Webbplats-id, t.ex. pa_7Q2K9XH3AB"
    },
    "page": {
      "type": "integer",
      "description": "Sida (från 1)"
    },
    "per_page": {
      "type": "integer",
      "description": "Resultat per sida (max 100)"
    }
  },
  "required": [
    "site_id"
  ]
}
Svarsdata
{
  "type": "array",
  "items": {
    "type": "object",
    "properties": {
      "id": {
        "type": "string",
        "description": "Antecknings-id, t.ex. note_7Q2K9XH3AB"
      },
      "site_id": {
        "anyOf": [
          {
            "type": "string",
            "description": "Webbplats, eller null för anteckningar för hela arbetsytan"
          },
          {
            "type": "null"
          }
        ]
      },
      "date": {
        "type": "string",
        "format": "date"
      },
      "end_date": {
        "anyOf": [
          {
            "type": "string",
            "format": "date"
          },
          {
            "type": "null"
          }
        ]
      },
      "title": {
        "type": "string"
      },
      "body": {
        "anyOf": [
          {
            "type": "string",
            "description": "Markdown"
          },
          {
            "type": "null"
          }
        ]
      },
      "url": {
        "anyOf": [
          {
            "type": "string"
          },
          {
            "type": "null"
          }
        ]
      },
      "color": {
        "type": "string",
        "description": "neutral, brand, blue, amber, red, violet"
      },
      "source": {
        "type": "string",
        "description": "manual, deploy, system, import, incident"
      },
      "created_at": {
        "type": "string",
        "format": "date-time"
      }
    }
  }
}
GET /sites/:site_id/notes/:id.json Hämta en anteckning notes_get

Behörighet: analytics.read

Exempel
curl https://privatusanalytics.com/sites/:site_id/notes/:id.json \
  -H "Authorization: Bearer $PRIVATUS_TOKEN"
Indata
{
  "type": "object",
  "properties": {
    "site_id": {
      "type": "string",
      "description": "Webbplats-id, t.ex. pa_7Q2K9XH3AB"
    },
    "id": {
      "type": "string",
      "description": "Id för resursen"
    }
  },
  "required": [
    "site_id",
    "id"
  ]
}
Svarsdata
{
  "type": "object",
  "properties": {
    "id": {
      "type": "string",
      "description": "Antecknings-id, t.ex. note_7Q2K9XH3AB"
    },
    "site_id": {
      "anyOf": [
        {
          "type": "string",
          "description": "Webbplats, eller null för anteckningar för hela arbetsytan"
        },
        {
          "type": "null"
        }
      ]
    },
    "date": {
      "type": "string",
      "format": "date"
    },
    "end_date": {
      "anyOf": [
        {
          "type": "string",
          "format": "date"
        },
        {
          "type": "null"
        }
      ]
    },
    "title": {
      "type": "string"
    },
    "body": {
      "anyOf": [
        {
          "type": "string",
          "description": "Markdown"
        },
        {
          "type": "null"
        }
      ]
    },
    "url": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ]
    },
    "color": {
      "type": "string",
      "description": "neutral, brand, blue, amber, red, violet"
    },
    "source": {
      "type": "string",
      "description": "manual, deploy, system, import, incident"
    },
    "created_at": {
      "type": "string",
      "format": "date-time"
    }
  }
}
PATCH /sites/:site_id/notes/:id.json Redigera en anteckning notes_update

Behörighet: content.write

Exempel
curl -X PATCH https://privatusanalytics.com/sites/:site_id/notes/:id.json \
  -H "Authorization: Bearer $PRIVATUS_TOKEN" \
  -H "Content-Type: application/json" -d '{…}'
Indata
{
  "type": "object",
  "properties": {
    "date": {
      "type": "string",
      "format": "date",
      "description": "Anteckningens dag"
    },
    "end_date": {
      "type": "string",
      "format": "date",
      "description": "Sista dagen, för ett datumintervall"
    },
    "title": {
      "type": "string",
      "description": "Kort titel som visas i diagram"
    },
    "body": {
      "type": "string",
      "description": "Detaljer (Markdown)"
    },
    "url": {
      "type": "string",
      "description": "Länk"
    },
    "color": {
      "type": "string",
      "description": "Nålens färg",
      "enum": [
        "neutral",
        "brand",
        "blue",
        "amber",
        "red",
        "violet"
      ]
    },
    "site_id": {
      "type": "string",
      "description": "Webbplats-id, t.ex. pa_7Q2K9XH3AB"
    },
    "id": {
      "type": "string",
      "description": "Id för resursen"
    }
  },
  "required": [
    "site_id",
    "id"
  ]
}
Svarsdata
{
  "type": "object",
  "properties": {
    "id": {
      "type": "string",
      "description": "Antecknings-id, t.ex. note_7Q2K9XH3AB"
    },
    "site_id": {
      "anyOf": [
        {
          "type": "string",
          "description": "Webbplats, eller null för anteckningar för hela arbetsytan"
        },
        {
          "type": "null"
        }
      ]
    },
    "date": {
      "type": "string",
      "format": "date"
    },
    "end_date": {
      "anyOf": [
        {
          "type": "string",
          "format": "date"
        },
        {
          "type": "null"
        }
      ]
    },
    "title": {
      "type": "string"
    },
    "body": {
      "anyOf": [
        {
          "type": "string",
          "description": "Markdown"
        },
        {
          "type": "null"
        }
      ]
    },
    "url": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ]
    },
    "color": {
      "type": "string",
      "description": "neutral, brand, blue, amber, red, violet"
    },
    "source": {
      "type": "string",
      "description": "manual, deploy, system, import, incident"
    },
    "created_at": {
      "type": "string",
      "format": "date-time"
    }
  }
}
POST /workspaces/:workspace_id/notes.json Lägg till en anteckning för hela arbetsytan (visas på varje webbplats) workspace_notes_create

Behörighet: content.write

Exempel
curl -X POST https://privatusanalytics.com/workspaces/:workspace_id/notes.json \
  -H "Authorization: Bearer $PRIVATUS_TOKEN" \
  -H "Content-Type: application/json" -d '{…}'
Indata
{
  "type": "object",
  "properties": {
    "date": {
      "type": "string",
      "format": "date",
      "description": "Anteckningens dag (webbplatsens tidszon). Standard är idag"
    },
    "end_date": {
      "type": "string",
      "format": "date",
      "description": "Sista dagen, för ett datumintervall"
    },
    "title": {
      "type": "string",
      "description": "Kort titel som visas i diagram",
      "examples": [
        "Launched new pricing"
      ]
    },
    "body": {
      "type": "string",
      "description": "Detaljer (Markdown)"
    },
    "url": {
      "type": "string",
      "description": "Länk, t.ex. en PR eller ändringslogg"
    },
    "color": {
      "type": "string",
      "description": "Nålens färg",
      "enum": [
        "neutral",
        "brand",
        "blue",
        "amber",
        "red",
        "violet"
      ]
    },
    "source": {
      "type": "string",
      "description": "manual, eller deploy för release-webhooks",
      "enum": [
        "manual",
        "deploy",
        "system",
        "import",
        "incident"
      ],
      "default": "manual"
    },
    "version": {
      "type": "string",
      "description": "Deploys: releaseversion eller commit, används för standardtiteln"
    },
    "workspace_id": {
      "type": "string",
      "description": "Arbetsyte-id, t.ex. ws_7Q2K9XH3AB"
    }
  },
  "required": [
    "workspace_id"
  ]
}
Svarsdata
{
  "type": "object",
  "properties": {
    "id": {
      "type": "string",
      "description": "Antecknings-id, t.ex. note_7Q2K9XH3AB"
    },
    "site_id": {
      "anyOf": [
        {
          "type": "string",
          "description": "Webbplats, eller null för anteckningar för hela arbetsytan"
        },
        {
          "type": "null"
        }
      ]
    },
    "date": {
      "type": "string",
      "format": "date"
    },
    "end_date": {
      "anyOf": [
        {
          "type": "string",
          "format": "date"
        },
        {
          "type": "null"
        }
      ]
    },
    "title": {
      "type": "string"
    },
    "body": {
      "anyOf": [
        {
          "type": "string",
          "description": "Markdown"
        },
        {
          "type": "null"
        }
      ]
    },
    "url": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ]
    },
    "color": {
      "type": "string",
      "description": "neutral, brand, blue, amber, red, violet"
    },
    "source": {
      "type": "string",
      "description": "manual, deploy, system, import, incident"
    },
    "created_at": {
      "type": "string",
      "format": "date-time"
    }
  }
}
DELETE /workspaces/:workspace_id/notes/:id.json Ta bort en arbetsytenotering workspace_notes_delete

Behörighet: content.write

Exempel
curl -X DELETE https://privatusanalytics.com/workspaces/:workspace_id/notes/:id.json \
  -H "Authorization: Bearer $PRIVATUS_TOKEN" \
  -H "Content-Type: application/json" -d '{…}'
Indata
{
  "type": "object",
  "properties": {
    "workspace_id": {
      "type": "string",
      "description": "Arbetsyte-id, t.ex. ws_7Q2K9XH3AB"
    },
    "id": {
      "type": "string",
      "description": "Id för resursen"
    }
  },
  "required": [
    "workspace_id",
    "id"
  ]
}
Svarsdata
{
  "type": "object",
  "properties": {
    "id": {
      "type": "string",
      "description": "Antecknings-id, t.ex. note_7Q2K9XH3AB"
    },
    "site_id": {
      "anyOf": [
        {
          "type": "string",
          "description": "Webbplats, eller null för anteckningar för hela arbetsytan"
        },
        {
          "type": "null"
        }
      ]
    },
    "date": {
      "type": "string",
      "format": "date"
    },
    "end_date": {
      "anyOf": [
        {
          "type": "string",
          "format": "date"
        },
        {
          "type": "null"
        }
      ]
    },
    "title": {
      "type": "string"
    },
    "body": {
      "anyOf": [
        {
          "type": "string",
          "description": "Markdown"
        },
        {
          "type": "null"
        }
      ]
    },
    "url": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ]
    },
    "color": {
      "type": "string",
      "description": "neutral, brand, blue, amber, red, violet"
    },
    "source": {
      "type": "string",
      "description": "manual, deploy, system, import, incident"
    },
    "created_at": {
      "type": "string",
      "format": "date-time"
    }
  }
}
GET /workspaces/:workspace_id/notes.json Lista anteckningar i en arbetsyta workspace_notes_list

Behörighet: analytics.read

Exempel
curl https://privatusanalytics.com/workspaces/:workspace_id/notes.json \
  -H "Authorization: Bearer $PRIVATUS_TOKEN"
Indata
{
  "type": "object",
  "properties": {
    "from": {
      "type": "string",
      "format": "date",
      "description": "Endast anteckningar från och med det här datumet"
    },
    "to": {
      "type": "string",
      "format": "date",
      "description": "Endast anteckningar till och med det här datumet"
    },
    "source": {
      "type": "string",
      "description": "Endast anteckningar från den här källan",
      "enum": [
        "manual",
        "deploy",
        "system",
        "import",
        "incident"
      ]
    },
    "query": {
      "type": "string",
      "description": "Sök i titel, text och länk"
    },
    "workspace_id": {
      "type": "string",
      "description": "Arbetsyte-id, t.ex. ws_7Q2K9XH3AB"
    },
    "page": {
      "type": "integer",
      "description": "Sida (från 1)"
    },
    "per_page": {
      "type": "integer",
      "description": "Resultat per sida (max 100)"
    }
  },
  "required": [
    "workspace_id"
  ]
}
Svarsdata
{
  "type": "array",
  "items": {
    "type": "object",
    "properties": {
      "id": {
        "type": "string",
        "description": "Antecknings-id, t.ex. note_7Q2K9XH3AB"
      },
      "site_id": {
        "anyOf": [
          {
            "type": "string",
            "description": "Webbplats, eller null för anteckningar för hela arbetsytan"
          },
          {
            "type": "null"
          }
        ]
      },
      "date": {
        "type": "string",
        "format": "date"
      },
      "end_date": {
        "anyOf": [
          {
            "type": "string",
            "format": "date"
          },
          {
            "type": "null"
          }
        ]
      },
      "title": {
        "type": "string"
      },
      "body": {
        "anyOf": [
          {
            "type": "string",
            "description": "Markdown"
          },
          {
            "type": "null"
          }
        ]
      },
      "url": {
        "anyOf": [
          {
            "type": "string"
          },
          {
            "type": "null"
          }
        ]
      },
      "color": {
        "type": "string",
        "description": "neutral, brand, blue, amber, red, violet"
      },
      "source": {
        "type": "string",
        "description": "manual, deploy, system, import, incident"
      },
      "created_at": {
        "type": "string",
        "format": "date-time"
      }
    }
  }
}
PATCH /workspaces/:workspace_id/notes/:id.json Redigera en arbetsyteanteckning workspace_notes_update

Behörighet: content.write

Exempel
curl -X PATCH https://privatusanalytics.com/workspaces/:workspace_id/notes/:id.json \
  -H "Authorization: Bearer $PRIVATUS_TOKEN" \
  -H "Content-Type: application/json" -d '{…}'
Indata
{
  "type": "object",
  "properties": {
    "date": {
      "type": "string",
      "format": "date",
      "description": "Anteckningens dag"
    },
    "end_date": {
      "type": "string",
      "format": "date",
      "description": "Sista dagen, för ett datumintervall"
    },
    "title": {
      "type": "string",
      "description": "Kort titel som visas i diagram"
    },
    "body": {
      "type": "string",
      "description": "Detaljer (Markdown)"
    },
    "url": {
      "type": "string",
      "description": "Länk"
    },
    "color": {
      "type": "string",
      "description": "Nålens färg",
      "enum": [
        "neutral",
        "brand",
        "blue",
        "amber",
        "red",
        "violet"
      ]
    },
    "workspace_id": {
      "type": "string",
      "description": "Arbetsyte-id, t.ex. ws_7Q2K9XH3AB"
    },
    "id": {
      "type": "string",
      "description": "Id för resursen"
    }
  },
  "required": [
    "workspace_id",
    "id"
  ]
}
Svarsdata
{
  "type": "object",
  "properties": {
    "id": {
      "type": "string",
      "description": "Antecknings-id, t.ex. note_7Q2K9XH3AB"
    },
    "site_id": {
      "anyOf": [
        {
          "type": "string",
          "description": "Webbplats, eller null för anteckningar för hela arbetsytan"
        },
        {
          "type": "null"
        }
      ]
    },
    "date": {
      "type": "string",
      "format": "date"
    },
    "end_date": {
      "anyOf": [
        {
          "type": "string",
          "format": "date"
        },
        {
          "type": "null"
        }
      ]
    },
    "title": {
      "type": "string"
    },
    "body": {
      "anyOf": [
        {
          "type": "string",
          "description": "Markdown"
        },
        {
          "type": "null"
        }
      ]
    },
    "url": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ]
    },
    "color": {
      "type": "string",
      "description": "neutral, brand, blue, amber, red, violet"
    },
    "source": {
      "type": "string",
      "description": "manual, deploy, system, import, incident"
    },
    "created_at": {
      "type": "string",
      "format": "date-time"
    }
  }
}

Arbetsytor

GET /workspaces/:workspace_id/white_label.json Hämta white label-varumärket white_label_get

Behörighet: workspace.manage

Exempel
curl https://privatusanalytics.com/workspaces/:workspace_id/white_label.json \
  -H "Authorization: Bearer $PRIVATUS_TOKEN"
Indata
{
  "type": "object",
  "properties": {
    "workspace_id": {
      "type": "string",
      "description": "Arbetsyte-id, t.ex. ws_7Q2K9XH3AB"
    }
  },
  "required": [
    "workspace_id"
  ]
}
Svarsdata
{
  "type": "object",
  "properties": {
    "workspace_id": {
      "type": "string"
    },
    "brand_name": {
      "anyOf": [
        {
          "type": "string",
          "description": "Namn som visas istället för Privatus Analytics"
        },
        {
          "type": "null"
        }
      ]
    },
    "brand_logo_url": {
      "anyOf": [
        {
          "type": "string",
          "description": "URL till logotypbild"
        },
        {
          "type": "null"
        }
      ]
    },
    "brand_color": {
      "anyOf": [
        {
          "type": "string",
          "description": "Accentfärg"
        },
        {
          "type": "null"
        }
      ]
    },
    "hide_branding": {
      "type": "boolean",
      "description": "Privatus Analytics varumärke är dolt"
    },
    "available": {
      "type": "boolean",
      "description": "Planen inkluderar white label"
    },
    "active": {
      "type": "boolean",
      "description": "Varumärket används just nu"
    }
  }
}
PATCH /workspaces/:workspace_id/white_label.json Ange white label-varumärket för delade instrumentpaneler och e-postrapporter (Business) white_label_update

Behörighet: workspace.manage

Exempel
curl -X PATCH https://privatusanalytics.com/workspaces/:workspace_id/white_label.json \
  -H "Authorization: Bearer $PRIVATUS_TOKEN" \
  -H "Content-Type: application/json" -d '{…}'
Indata
{
  "type": "object",
  "properties": {
    "brand_name": {
      "type": "string",
      "description": "Namn som visas istället för Privatus Analytics (tomt tar bort det)"
    },
    "brand_logo_url": {
      "type": "string",
      "description": "https-URL till en logotypbild (tomt tar bort den)"
    },
    "brand_color": {
      "type": "string",
      "description": "Accentfärg, t.ex. #06755b"
    },
    "hide_branding": {
      "type": "boolean",
      "description": "Dölj \"Privatus Analytics\" på delade instrumentpaneler och e-postrapporter"
    },
    "workspace_id": {
      "type": "string",
      "description": "Arbetsyte-id, t.ex. ws_7Q2K9XH3AB"
    }
  },
  "required": [
    "workspace_id"
  ]
}
Svarsdata
{
  "type": "object",
  "properties": {
    "workspace_id": {
      "type": "string"
    },
    "brand_name": {
      "anyOf": [
        {
          "type": "string",
          "description": "Namn som visas istället för Privatus Analytics"
        },
        {
          "type": "null"
        }
      ]
    },
    "brand_logo_url": {
      "anyOf": [
        {
          "type": "string",
          "description": "URL till logotypbild"
        },
        {
          "type": "null"
        }
      ]
    },
    "brand_color": {
      "anyOf": [
        {
          "type": "string",
          "description": "Accentfärg"
        },
        {
          "type": "null"
        }
      ]
    },
    "hide_branding": {
      "type": "boolean",
      "description": "Privatus Analytics varumärke är dolt"
    },
    "available": {
      "type": "boolean",
      "description": "Planen inkluderar white label"
    },
    "active": {
      "type": "boolean",
      "description": "Varumärket används just nu"
    }
  }
}
GET /workspaces/:workspace_id/security.json Hämta säkerhetsinställningar för arbetsytan workspace_security_get

Behörighet: workspace.manage

Exempel
curl https://privatusanalytics.com/workspaces/:workspace_id/security.json \
  -H "Authorization: Bearer $PRIVATUS_TOKEN"
Indata
{
  "type": "object",
  "properties": {
    "workspace_id": {
      "type": "string",
      "description": "Arbetsyte-id, t.ex. ws_7Q2K9XH3AB"
    }
  },
  "required": [
    "workspace_id"
  ]
}
Svarsdata
{
  "type": "object",
  "properties": {
    "workspace_id": {
      "type": "string"
    },
    "enforce_2fa": {
      "type": "boolean",
      "description": "Medlemmar måste ställa in 2FA"
    },
    "login_methods": {
      "type": "array",
      "items": {
        "type": "string"
      },
      "description": "Tillåtna inloggningsmetoder"
    },
    "session_ttl_hours": {
      "anyOf": [
        {
          "type": "integer",
          "description": "Sessionens livslängd (null = ingen)"
        },
        {
          "type": "null"
        }
      ]
    },
    "app_ip_allowlist": {
      "type": "array",
      "items": {
        "type": "string"
      },
      "description": "Tillåtna IP-adresser/CIDR (tomt = varifrån som helst)"
    },
    "support_access_until": {
      "anyOf": [
        {
          "type": "string",
          "format": "date-time",
          "description": "Privatus Analytics support får se arbetsytan till och med"
        },
        {
          "type": "null"
        }
      ]
    }
  }
}
PATCH /workspaces/:workspace_id/security.json Uppdatera säkerhetsinställningar för arbetsytan (2FA, inloggningsmetoder, sessionslängd, IP-tillåtlista, supportåtkomst) workspace_security_update

Behörighet: workspace.manage

Exempel
curl -X PATCH https://privatusanalytics.com/workspaces/:workspace_id/security.json \
  -H "Authorization: Bearer $PRIVATUS_TOKEN" \
  -H "Content-Type: application/json" -d '{…}'
Indata
{
  "type": "object",
  "properties": {
    "enforce_2fa": {
      "type": "boolean",
      "description": "Kräv att medlemmar ställer in 2FA"
    },
    "login_methods": {
      "type": "array",
      "items": {
        "type": "string",
        "enum": [
          "password",
          "magic_link",
          "passkey",
          "google",
          "github",
          "sso"
        ]
      },
      "description": "Tillåtna inloggningsmetoder"
    },
    "session_ttl_hours": {
      "type": "integer",
      "description": "Logga ut medlemmar efter så här många timmar (0 = ingen gräns)"
    },
    "app_ip_allowlist": {
      "type": "array",
      "items": {
        "type": "string"
      },
      "description": "Tillåt bara åtkomst till appen och API:et från dessa IP-adresser/CIDR (Business). Tomt = varifrån som helst"
    },
    "support_access": {
      "type": "boolean",
      "description": "Låt Privatus Analytics support se arbetsytan i 7 dagar"
    },
    "workspace_id": {
      "type": "string",
      "description": "Arbetsyte-id, t.ex. ws_7Q2K9XH3AB"
    }
  },
  "required": [
    "workspace_id"
  ]
}
Svarsdata
{
  "type": "object",
  "properties": {
    "workspace_id": {
      "type": "string"
    },
    "enforce_2fa": {
      "type": "boolean",
      "description": "Medlemmar måste ställa in 2FA"
    },
    "login_methods": {
      "type": "array",
      "items": {
        "type": "string"
      },
      "description": "Tillåtna inloggningsmetoder"
    },
    "session_ttl_hours": {
      "anyOf": [
        {
          "type": "integer",
          "description": "Sessionens livslängd (null = ingen)"
        },
        {
          "type": "null"
        }
      ]
    },
    "app_ip_allowlist": {
      "type": "array",
      "items": {
        "type": "string"
      },
      "description": "Tillåtna IP-adresser/CIDR (tomt = varifrån som helst)"
    },
    "support_access_until": {
      "anyOf": [
        {
          "type": "string",
          "format": "date-time",
          "description": "Privatus Analytics support får se arbetsytan till och med"
        },
        {
          "type": "null"
        }
      ]
    }
  }
}
POST /workspaces.json Skapa en arbetsyta (du blir ägare) workspaces_create

Behörighet: member · Endast HTTP (inte ett MCP-verktyg)

Exempel
curl -X POST https://privatusanalytics.com/workspaces.json \
  -H "Authorization: Bearer $PRIVATUS_TOKEN" \
  -H "Content-Type: application/json" -d '{…}'
Indata
{
  "type": "object",
  "properties": {
    "name": {
      "type": "string",
      "description": "Arbetsytans namn",
      "examples": [
        "Acme Inc"
      ]
    },
    "timezone": {
      "type": "string",
      "description": "Standardtidszon för rapportering (standard är användarens)"
    },
    "currency": {
      "type": "string",
      "description": "Standardvaluta (ISO 4217)",
      "default": "USD"
    },
    "how_heard": {
      "type": "string",
      "description": "Hur du hörde talas om oss"
    }
  },
  "required": [
    "name"
  ]
}
Svarsdata
{
  "type": "object",
  "properties": {
    "id": {
      "type": "string",
      "description": "Arbetsyte-id, t.ex. ws_7Q2K9XH3AB"
    },
    "name": {
      "type": "string"
    },
    "timezone": {
      "type": "string",
      "description": "Standardtidszon för rapportering"
    },
    "currency": {
      "type": "string",
      "description": "Standardvaluta"
    },
    "plan": {
      "type": "string",
      "description": "free, pro, business eller enterprise"
    },
    "plan_events": {
      "type": "integer",
      "description": "Händelser per månad som ingår i planen"
    },
    "subscription_status": {
      "type": "string"
    },
    "role": {
      "type": "string",
      "description": "Din roll i den här arbetsytan"
    },
    "created_at": {
      "type": "string",
      "format": "date-time"
    }
  }
}
DELETE /workspaces/:id.json Ta bort en arbetsyta och alla dess webbplatser (endast ägaren, avslutar eventuell prenumeration) workspaces_delete

Behörighet: workspace.manage

Exempel
curl -X DELETE https://privatusanalytics.com/workspaces/:id.json \
  -H "Authorization: Bearer $PRIVATUS_TOKEN" \
  -H "Content-Type: application/json" -d '{…}'
Indata
{
  "type": "object",
  "properties": {
    "confirm": {
      "type": "string",
      "description": "Skriv arbetsytans namn för att bekräfta"
    },
    "id": {
      "type": "string",
      "description": "Id för resursen"
    }
  },
  "required": [
    "confirm",
    "id"
  ]
}
Svarsdata
{
  "type": "object",
  "properties": {
    "id": {
      "type": "string",
      "description": "Arbetsyte-id, t.ex. ws_7Q2K9XH3AB"
    },
    "name": {
      "type": "string"
    },
    "timezone": {
      "type": "string",
      "description": "Standardtidszon för rapportering"
    },
    "currency": {
      "type": "string",
      "description": "Standardvaluta"
    },
    "plan": {
      "type": "string",
      "description": "free, pro, business eller enterprise"
    },
    "plan_events": {
      "type": "integer",
      "description": "Händelser per månad som ingår i planen"
    },
    "subscription_status": {
      "type": "string"
    },
    "role": {
      "type": "string",
      "description": "Din roll i den här arbetsytan"
    },
    "created_at": {
      "type": "string",
      "format": "date-time"
    }
  }
}
GET /workspaces.json Lista dina arbetsytor workspaces_list

Behörighet: member

Exempel
curl https://privatusanalytics.com/workspaces.json \
  -H "Authorization: Bearer $PRIVATUS_TOKEN"
Indata
{
  "type": "object",
  "properties": {
    "page": {
      "type": "integer",
      "description": "Sida (från 1)"
    },
    "per_page": {
      "type": "integer",
      "description": "Resultat per sida (max 100)"
    }
  },
  "required": []
}
Svarsdata
{
  "type": "array",
  "items": {
    "type": "object",
    "properties": {
      "id": {
        "type": "string",
        "description": "Arbetsyte-id, t.ex. ws_7Q2K9XH3AB"
      },
      "name": {
        "type": "string"
      },
      "timezone": {
        "type": "string",
        "description": "Standardtidszon för rapportering"
      },
      "currency": {
        "type": "string",
        "description": "Standardvaluta"
      },
      "plan": {
        "type": "string",
        "description": "free, pro, business eller enterprise"
      },
      "plan_events": {
        "type": "integer",
        "description": "Händelser per månad som ingår i planen"
      },
      "subscription_status": {
        "type": "string"
      },
      "role": {
        "type": "string",
        "description": "Din roll i den här arbetsytan"
      },
      "created_at": {
        "type": "string",
        "format": "date-time"
      }
    }
  }
}
GET /workspaces/:id.json Hämta en arbetsyta workspaces_get

Behörighet: member

Exempel
curl https://privatusanalytics.com/workspaces/:id.json \
  -H "Authorization: Bearer $PRIVATUS_TOKEN"
Indata
{
  "type": "object",
  "properties": {
    "id": {
      "type": "string",
      "description": "Id för resursen"
    }
  },
  "required": [
    "id"
  ]
}
Svarsdata
{
  "type": "object",
  "properties": {
    "id": {
      "type": "string",
      "description": "Arbetsyte-id, t.ex. ws_7Q2K9XH3AB"
    },
    "name": {
      "type": "string"
    },
    "timezone": {
      "type": "string",
      "description": "Standardtidszon för rapportering"
    },
    "currency": {
      "type": "string",
      "description": "Standardvaluta"
    },
    "plan": {
      "type": "string",
      "description": "free, pro, business eller enterprise"
    },
    "plan_events": {
      "type": "integer",
      "description": "Händelser per månad som ingår i planen"
    },
    "subscription_status": {
      "type": "string"
    },
    "role": {
      "type": "string",
      "description": "Din roll i den här arbetsytan"
    },
    "created_at": {
      "type": "string",
      "format": "date-time"
    }
  }
}
PATCH /workspaces/:id.json Uppdatera arbetsytans inställningar workspaces_update

Behörighet: workspace.manage

Exempel
curl -X PATCH https://privatusanalytics.com/workspaces/:id.json \
  -H "Authorization: Bearer $PRIVATUS_TOKEN" \
  -H "Content-Type: application/json" -d '{…}'
Indata
{
  "type": "object",
  "properties": {
    "name": {
      "type": "string",
      "description": "Arbetsytans namn"
    },
    "timezone": {
      "type": "string",
      "description": "Standardtidszon för rapportering"
    },
    "currency": {
      "type": "string",
      "description": "Standardvaluta (ISO 4217)"
    },
    "id": {
      "type": "string",
      "description": "Id för resursen"
    }
  },
  "required": [
    "id"
  ]
}
Svarsdata
{
  "type": "object",
  "properties": {
    "id": {
      "type": "string",
      "description": "Arbetsyte-id, t.ex. ws_7Q2K9XH3AB"
    },
    "name": {
      "type": "string"
    },
    "timezone": {
      "type": "string",
      "description": "Standardtidszon för rapportering"
    },
    "currency": {
      "type": "string",
      "description": "Standardvaluta"
    },
    "plan": {
      "type": "string",
      "description": "free, pro, business eller enterprise"
    },
    "plan_events": {
      "type": "integer",
      "description": "Händelser per månad som ingår i planen"
    },
    "subscription_status": {
      "type": "string"
    },
    "role": {
      "type": "string",
      "description": "Din roll i den här arbetsytan"
    },
    "created_at": {
      "type": "string",
      "format": "date-time"
    }
  }
}

Assistent

POST /sites/:site_id/ask.json Ställ en fråga i en ny konversation (räknas mot den månatliga gränsen för AI-frågor) assistant_ask

Behörighet: analytics.read

Exempel
curl -X POST https://privatusanalytics.com/sites/:site_id/ask.json \
  -H "Authorization: Bearer $PRIVATUS_TOKEN" \
  -H "Content-Type: application/json" -d '{…}'
Indata
{
  "type": "object",
  "properties": {
    "question": {
      "type": "string",
      "description": "Din första fråga på vanligt språk",
      "examples": [
        "How many visitors did we have last week?"
      ]
    },
    "site_id": {
      "type": "string",
      "description": "Webbplats-id, t.ex. pa_7Q2K9XH3AB"
    }
  },
  "required": [
    "question",
    "site_id"
  ]
}
Svarsdata
{
  "type": "object",
  "properties": {
    "id": {
      "type": "string",
      "description": "Konversations-id, t.ex. ask_7Q2K9XH3AB"
    },
    "site_id": {
      "anyOf": [
        {
          "type": "string",
          "description": "Webbplats-id"
        },
        {
          "type": "null"
        }
      ]
    },
    "title": {
      "anyOf": [
        {
          "type": "string",
          "description": "Den första frågan, förkortad"
        },
        {
          "type": "null"
        }
      ]
    },
    "created_at": {
      "type": "string",
      "format": "date-time"
    },
    "updated_at": {
      "type": "string",
      "format": "date-time",
      "description": "Tid för det senaste meddelandet"
    },
    "expires_at": {
      "type": "string",
      "format": "date-time",
      "description": "Tas bort automatiskt efter den här tiden (30 dagar efter det sista meddelandet)"
    },
    "messages": {
      "type": "object",
      "properties": {
        "id": {
          "type": "string",
          "format": "uuid",
          "description": "Meddelande-id i konversationen"
        },
        "role": {
          "type": "string",
          "description": "user (frågan) eller assistant (svaret)"
        },
        "content": {
          "type": "string",
          "description": "Frågan, eller svaret i Markdown"
        },
        "queries": {
          "type": "array",
          "items": {
            "type": "object"
          },
          "description": "Så här kom jag fram till det: de exakta API-frågorna bakom svaret, som [{tool, input, status, error}]"
        },
        "chart": {
          "anyOf": [
            {
              "type": "object",
              "description": "Diagram över svaret: {type: line, labels, series, comparison, metric, format} eller {type: table, columns, rows}"
            },
            {
              "type": "null"
            }
          ]
        },
        "goal_draft": {
          "anyOf": [
            {
              "type": "object",
              "description": "Ett mål som assistenten föreslår, att bekräfta med goals_create"
            },
            {
              "type": "null"
            }
          ]
        },
        "input_tokens": {
          "anyOf": [
            {
              "type": "integer",
              "description": "Använda indatatoken för modellen"
            },
            {
              "type": "null"
            }
          ]
        },
        "output_tokens": {
          "anyOf": [
            {
              "type": "integer",
              "description": "Använda utdatatoken för modellen"
            },
            {
              "type": "null"
            }
          ]
        },
        "created_at": {
          "type": "string",
          "format": "date-time"
        }
      },
      "description": "Frågor och svar, äldst först"
    }
  }
}
DELETE /sites/:site_id/ask/:id.json Ta bort en Fråga-konversation och dess meddelanden assistant_conversations_delete

Behörighet: analytics.read

Exempel
curl -X DELETE https://privatusanalytics.com/sites/:site_id/ask/:id.json \
  -H "Authorization: Bearer $PRIVATUS_TOKEN" \
  -H "Content-Type: application/json" -d '{…}'
Indata
{
  "type": "object",
  "properties": {
    "site_id": {
      "type": "string",
      "description": "Webbplats-id, t.ex. pa_7Q2K9XH3AB"
    },
    "id": {
      "type": "string",
      "description": "Id för resursen"
    }
  },
  "required": [
    "site_id",
    "id"
  ]
}
Svarsdata
{
  "type": "object",
  "properties": {
    "id": {
      "type": "string",
      "description": "Konversations-id, t.ex. ask_7Q2K9XH3AB"
    },
    "site_id": {
      "anyOf": [
        {
          "type": "string",
          "description": "Webbplats-id"
        },
        {
          "type": "null"
        }
      ]
    },
    "title": {
      "anyOf": [
        {
          "type": "string",
          "description": "Den första frågan, förkortad"
        },
        {
          "type": "null"
        }
      ]
    },
    "created_at": {
      "type": "string",
      "format": "date-time"
    },
    "updated_at": {
      "type": "string",
      "format": "date-time",
      "description": "Tid för det senaste meddelandet"
    },
    "expires_at": {
      "type": "string",
      "format": "date-time",
      "description": "Tas bort automatiskt efter den här tiden (30 dagar efter det sista meddelandet)"
    }
  }
}
GET /sites/:site_id/ask.json Lista dina Fråga-konversationer för en webbplats assistant_conversations_list

Behörighet: analytics.read

Exempel
curl https://privatusanalytics.com/sites/:site_id/ask.json \
  -H "Authorization: Bearer $PRIVATUS_TOKEN"
Indata
{
  "type": "object",
  "properties": {
    "site_id": {
      "type": "string",
      "description": "Webbplats-id, t.ex. pa_7Q2K9XH3AB"
    },
    "page": {
      "type": "integer",
      "description": "Sida (från 1)"
    },
    "per_page": {
      "type": "integer",
      "description": "Resultat per sida (max 100)"
    }
  },
  "required": [
    "site_id"
  ]
}
Svarsdata
{
  "type": "array",
  "items": {
    "type": "object",
    "properties": {
      "id": {
        "type": "string",
        "description": "Konversations-id, t.ex. ask_7Q2K9XH3AB"
      },
      "site_id": {
        "anyOf": [
          {
            "type": "string",
            "description": "Webbplats-id"
          },
          {
            "type": "null"
          }
        ]
      },
      "title": {
        "anyOf": [
          {
            "type": "string",
            "description": "Den första frågan, förkortad"
          },
          {
            "type": "null"
          }
        ]
      },
      "created_at": {
        "type": "string",
        "format": "date-time"
      },
      "updated_at": {
        "type": "string",
        "format": "date-time",
        "description": "Tid för det senaste meddelandet"
      },
      "expires_at": {
        "type": "string",
        "format": "date-time",
        "description": "Tas bort automatiskt efter den här tiden (30 dagar efter det sista meddelandet)"
      }
    }
  }
}
GET /sites/:site_id/ask/:id.json En Fråga-konversation: frågor, svar, frågorna bakom dem och diagram assistant_conversations_get

Behörighet: analytics.read

Exempel
curl https://privatusanalytics.com/sites/:site_id/ask/:id.json \
  -H "Authorization: Bearer $PRIVATUS_TOKEN"
Indata
{
  "type": "object",
  "properties": {
    "site_id": {
      "type": "string",
      "description": "Webbplats-id, t.ex. pa_7Q2K9XH3AB"
    },
    "id": {
      "type": "string",
      "description": "Id för resursen"
    }
  },
  "required": [
    "site_id",
    "id"
  ]
}
Svarsdata
{
  "type": "object",
  "properties": {
    "id": {
      "type": "string",
      "description": "Konversations-id, t.ex. ask_7Q2K9XH3AB"
    },
    "site_id": {
      "anyOf": [
        {
          "type": "string",
          "description": "Webbplats-id"
        },
        {
          "type": "null"
        }
      ]
    },
    "title": {
      "anyOf": [
        {
          "type": "string",
          "description": "Den första frågan, förkortad"
        },
        {
          "type": "null"
        }
      ]
    },
    "created_at": {
      "type": "string",
      "format": "date-time"
    },
    "updated_at": {
      "type": "string",
      "format": "date-time",
      "description": "Tid för det senaste meddelandet"
    },
    "expires_at": {
      "type": "string",
      "format": "date-time",
      "description": "Tas bort automatiskt efter den här tiden (30 dagar efter det sista meddelandet)"
    },
    "messages": {
      "type": "object",
      "properties": {
        "id": {
          "type": "string",
          "format": "uuid",
          "description": "Meddelande-id i konversationen"
        },
        "role": {
          "type": "string",
          "description": "user (frågan) eller assistant (svaret)"
        },
        "content": {
          "type": "string",
          "description": "Frågan, eller svaret i Markdown"
        },
        "queries": {
          "type": "array",
          "items": {
            "type": "object"
          },
          "description": "Så här kom jag fram till det: de exakta API-frågorna bakom svaret, som [{tool, input, status, error}]"
        },
        "chart": {
          "anyOf": [
            {
              "type": "object",
              "description": "Diagram över svaret: {type: line, labels, series, comparison, metric, format} eller {type: table, columns, rows}"
            },
            {
              "type": "null"
            }
          ]
        },
        "goal_draft": {
          "anyOf": [
            {
              "type": "object",
              "description": "Ett mål som assistenten föreslår, att bekräfta med goals_create"
            },
            {
              "type": "null"
            }
          ]
        },
        "input_tokens": {
          "anyOf": [
            {
              "type": "integer",
              "description": "Använda indatatoken för modellen"
            },
            {
              "type": "null"
            }
          ]
        },
        "output_tokens": {
          "anyOf": [
            {
              "type": "integer",
              "description": "Använda utdatatoken för modellen"
            },
            {
              "type": "null"
            }
          ]
        },
        "created_at": {
          "type": "string",
          "format": "date-time"
        }
      },
      "description": "Frågor och svar, äldst först"
    }
  }
}
POST /sites/:site_id/ask/:ask_conversation_id/messages.json Ställ en följdfråga i en konversation (räknas mot den månatliga gränsen för AI-frågor). Returnerar svaret. assistant_ask_followup

Behörighet: analytics.read

Exempel
curl -X POST https://privatusanalytics.com/sites/:site_id/ask/:ask_conversation_id/messages.json \
  -H "Authorization: Bearer $PRIVATUS_TOKEN" \
  -H "Content-Type: application/json" -d '{…}'
Indata
{
  "type": "object",
  "properties": {
    "question": {
      "type": "string",
      "description": "Din fråga på vanligt språk",
      "examples": [
        "Which pages had the most visitors last week?"
      ]
    },
    "site_id": {
      "type": "string",
      "description": "Webbplats-id, t.ex. pa_7Q2K9XH3AB"
    },
    "ask_conversation_id": {
      "type": "string",
      "description": "Ask conversation för resursen"
    }
  },
  "required": [
    "question",
    "site_id",
    "ask_conversation_id"
  ]
}
Svarsdata
{
  "type": "object",
  "properties": {
    "id": {
      "type": "string",
      "format": "uuid",
      "description": "Meddelande-id i konversationen"
    },
    "role": {
      "type": "string",
      "description": "user (frågan) eller assistant (svaret)"
    },
    "content": {
      "type": "string",
      "description": "Frågan, eller svaret i Markdown"
    },
    "queries": {
      "type": "array",
      "items": {
        "type": "object"
      },
      "description": "Så här kom jag fram till det: de exakta API-frågorna bakom svaret, som [{tool, input, status, error}]"
    },
    "chart": {
      "anyOf": [
        {
          "type": "object",
          "description": "Diagram över svaret: {type: line, labels, series, comparison, metric, format} eller {type: table, columns, rows}"
        },
        {
          "type": "null"
        }
      ]
    },
    "goal_draft": {
      "anyOf": [
        {
          "type": "object",
          "description": "Ett mål som assistenten föreslår, att bekräfta med goals_create"
        },
        {
          "type": "null"
        }
      ]
    },
    "input_tokens": {
      "anyOf": [
        {
          "type": "integer",
          "description": "Använda indatatoken för modellen"
        },
        {
          "type": "null"
        }
      ]
    },
    "output_tokens": {
      "anyOf": [
        {
          "type": "integer",
          "description": "Använda utdatatoken för modellen"
        },
        {
          "type": "null"
        }
      ]
    },
    "created_at": {
      "type": "string",
      "format": "date-time"
    }
  }
}

Aviseringar

POST /alerts/:id/acknowledge.json Kvittera den senaste incidenten alerts_acknowledge

Behörighet: analytics.read

Exempel
curl -X POST https://privatusanalytics.com/alerts/:id/acknowledge.json \
  -H "Authorization: Bearer $PRIVATUS_TOKEN" \
  -H "Content-Type: application/json" -d '{…}'
Indata
{
  "type": "object",
  "properties": {
    "id": {
      "type": "string",
      "description": "Id för resursen"
    }
  },
  "required": [
    "id"
  ]
}
Svarsdata
{
  "type": "object",
  "properties": {
    "id": {
      "type": "string",
      "description": "Aviserings-id, t.ex. alr_7Q2K9XH3AB"
    },
    "site_id": {
      "anyOf": [
        {
          "type": "string",
          "description": "Webbplats-id (null för användningsaviseringar)"
        },
        {
          "type": "null"
        }
      ]
    },
    "name": {
      "type": "string"
    },
    "kind": {
      "type": "string",
      "description": "threshold, anomaly, goal, no_data, usage, uptime, ssl eller vitals"
    },
    "metric": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ]
    },
    "operator": {
      "anyOf": [
        {
          "type": "string",
          "description": "gt, gte, lt eller lte"
        },
        {
          "type": "null"
        }
      ]
    },
    "threshold": {
      "anyOf": [
        {
          "type": "number"
        },
        {
          "type": "null"
        }
      ]
    },
    "window_minutes": {
      "type": "integer"
    },
    "sensitivity": {
      "type": "string",
      "description": "känslighet för anomaly"
    },
    "goal_id": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ]
    },
    "channel_ids": {
      "type": "array",
      "items": {
        "type": "string"
      },
      "description": "Id för aviseringskanaler"
    },
    "state": {
      "type": "string",
      "description": "ok eller triggered"
    },
    "enabled": {
      "type": "boolean"
    },
    "muted_until": {
      "anyOf": [
        {
          "type": "string",
          "format": "date-time"
        },
        {
          "type": "null"
        }
      ]
    },
    "last_triggered_at": {
      "anyOf": [
        {
          "type": "string",
          "format": "date-time"
        },
        {
          "type": "null"
        }
      ]
    },
    "last_evaluated_at": {
      "anyOf": [
        {
          "type": "string",
          "format": "date-time"
        },
        {
          "type": "null"
        }
      ]
    },
    "created_at": {
      "type": "string",
      "format": "date-time"
    }
  }
}
POST /workspaces/:workspace_id/alerts.json Skapa en avisering alerts_create

Behörighet: content.write

Exempel
curl -X POST https://privatusanalytics.com/workspaces/:workspace_id/alerts.json \
  -H "Authorization: Bearer $PRIVATUS_TOKEN" \
  -H "Content-Type: application/json" -d '{…}'
Indata
{
  "type": "object",
  "properties": {
    "site_id": {
      "type": "string",
      "description": "Webbplats-id (pa_…). Krävs utom för användningsaviseringar"
    },
    "metric": {
      "type": "string",
      "description": "threshold/anomaly: visitors, visits, pageviews, bounce_rate eller conversion. vitals: lcp, inp, cls, fcp eller ttfb"
    },
    "operator": {
      "type": "string",
      "description": "Jämförelse (gt, gte, lt, lte). anomaly: lt bara nedgångar, gt bara toppar, tomt båda",
      "enum": [
        "gt",
        "gte",
        "lt",
        "lte"
      ]
    },
    "threshold": {
      "type": "number",
      "description": "threshold: mätvärde, goal: slutföranden, no_data: timmar, usage: procent, ssl: dagar, vitals: ms (CLS: poäng)"
    },
    "window_minutes": {
      "type": "integer",
      "description": "Utvärderingsfönster i minuter (5 till 10080)"
    },
    "sensitivity": {
      "type": "string",
      "description": "anomaly: low, medium eller high",
      "enum": [
        "low",
        "medium",
        "high"
      ]
    },
    "goal_id": {
      "type": "string",
      "description": "goal- och conversion-aviseringar: mål-id (goal_…)"
    },
    "uptime_check_id": {
      "type": "string",
      "description": "uptime/ssl: kontroll-id (standard: alla webbplatsens kontroller)"
    },
    "channel_ids": {
      "type": "array",
      "items": {
        "type": "string"
      },
      "description": "Id för aviseringskanaler (nch_…)"
    },
    "enabled": {
      "type": "boolean",
      "description": "Utvärdera den här aviseringen"
    },
    "name": {
      "type": "string",
      "description": "Aviseringens namn",
      "examples": [
        "Traffic dropped"
      ]
    },
    "kind": {
      "type": "string",
      "description": "threshold, anomaly, goal, no_data, usage, uptime, ssl eller vitals",
      "enum": [
        "threshold",
        "anomaly",
        "goal",
        "no_data",
        "usage",
        "uptime",
        "ssl",
        "vitals"
      ]
    },
    "workspace_id": {
      "type": "string",
      "description": "Arbetsyte-id, t.ex. ws_7Q2K9XH3AB"
    }
  },
  "required": [
    "name",
    "kind",
    "workspace_id"
  ]
}
Svarsdata
{
  "type": "object",
  "properties": {
    "id": {
      "type": "string",
      "description": "Aviserings-id, t.ex. alr_7Q2K9XH3AB"
    },
    "site_id": {
      "anyOf": [
        {
          "type": "string",
          "description": "Webbplats-id (null för användningsaviseringar)"
        },
        {
          "type": "null"
        }
      ]
    },
    "name": {
      "type": "string"
    },
    "kind": {
      "type": "string",
      "description": "threshold, anomaly, goal, no_data, usage, uptime, ssl eller vitals"
    },
    "metric": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ]
    },
    "operator": {
      "anyOf": [
        {
          "type": "string",
          "description": "gt, gte, lt eller lte"
        },
        {
          "type": "null"
        }
      ]
    },
    "threshold": {
      "anyOf": [
        {
          "type": "number"
        },
        {
          "type": "null"
        }
      ]
    },
    "window_minutes": {
      "type": "integer"
    },
    "sensitivity": {
      "type": "string",
      "description": "känslighet för anomaly"
    },
    "goal_id": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ]
    },
    "channel_ids": {
      "type": "array",
      "items": {
        "type": "string"
      },
      "description": "Id för aviseringskanaler"
    },
    "state": {
      "type": "string",
      "description": "ok eller triggered"
    },
    "enabled": {
      "type": "boolean"
    },
    "muted_until": {
      "anyOf": [
        {
          "type": "string",
          "format": "date-time"
        },
        {
          "type": "null"
        }
      ]
    },
    "last_triggered_at": {
      "anyOf": [
        {
          "type": "string",
          "format": "date-time"
        },
        {
          "type": "null"
        }
      ]
    },
    "last_evaluated_at": {
      "anyOf": [
        {
          "type": "string",
          "format": "date-time"
        },
        {
          "type": "null"
        }
      ]
    },
    "created_at": {
      "type": "string",
      "format": "date-time"
    }
  }
}
DELETE /alerts/:id.json Ta bort en avisering alerts_delete

Behörighet: content.write

Exempel
curl -X DELETE https://privatusanalytics.com/alerts/:id.json \
  -H "Authorization: Bearer $PRIVATUS_TOKEN" \
  -H "Content-Type: application/json" -d '{…}'
Indata
{
  "type": "object",
  "properties": {
    "id": {
      "type": "string",
      "description": "Id för resursen"
    }
  },
  "required": [
    "id"
  ]
}
Svarsdata
{
  "type": "object",
  "properties": {
    "id": {
      "type": "string",
      "description": "Aviserings-id, t.ex. alr_7Q2K9XH3AB"
    },
    "site_id": {
      "anyOf": [
        {
          "type": "string",
          "description": "Webbplats-id (null för användningsaviseringar)"
        },
        {
          "type": "null"
        }
      ]
    },
    "name": {
      "type": "string"
    },
    "kind": {
      "type": "string",
      "description": "threshold, anomaly, goal, no_data, usage, uptime, ssl eller vitals"
    },
    "metric": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ]
    },
    "operator": {
      "anyOf": [
        {
          "type": "string",
          "description": "gt, gte, lt eller lte"
        },
        {
          "type": "null"
        }
      ]
    },
    "threshold": {
      "anyOf": [
        {
          "type": "number"
        },
        {
          "type": "null"
        }
      ]
    },
    "window_minutes": {
      "type": "integer"
    },
    "sensitivity": {
      "type": "string",
      "description": "känslighet för anomaly"
    },
    "goal_id": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ]
    },
    "channel_ids": {
      "type": "array",
      "items": {
        "type": "string"
      },
      "description": "Id för aviseringskanaler"
    },
    "state": {
      "type": "string",
      "description": "ok eller triggered"
    },
    "enabled": {
      "type": "boolean"
    },
    "muted_until": {
      "anyOf": [
        {
          "type": "string",
          "format": "date-time"
        },
        {
          "type": "null"
        }
      ]
    },
    "last_triggered_at": {
      "anyOf": [
        {
          "type": "string",
          "format": "date-time"
        },
        {
          "type": "null"
        }
      ]
    },
    "last_evaluated_at": {
      "anyOf": [
        {
          "type": "string",
          "format": "date-time"
        },
        {
          "type": "null"
        }
      ]
    },
    "created_at": {
      "type": "string",
      "format": "date-time"
    }
  }
}
GET /alerts/:id/history.json Incidenthistorik för en avisering alerts_history

Behörighet: analytics.read

Exempel
curl https://privatusanalytics.com/alerts/:id/history.json \
  -H "Authorization: Bearer $PRIVATUS_TOKEN"
Indata
{
  "type": "object",
  "properties": {
    "open": {
      "type": "boolean",
      "description": "Endast olösta incidenter",
      "default": false
    },
    "id": {
      "type": "string",
      "description": "Id för resursen"
    },
    "page": {
      "type": "integer",
      "description": "Sida (från 1)"
    },
    "per_page": {
      "type": "integer",
      "description": "Resultat per sida (max 100)"
    }
  },
  "required": [
    "id"
  ]
}
Svarsdata
{
  "type": "array",
  "items": {
    "type": "object",
    "properties": {
      "triggered_at": {
        "type": "string",
        "format": "date-time"
      },
      "resolved_at": {
        "anyOf": [
          {
            "type": "string",
            "format": "date-time"
          },
          {
            "type": "null"
          }
        ]
      },
      "value": {
        "anyOf": [
          {
            "type": "number",
            "description": "Uppmätt värde när den utlöstes"
          },
          {
            "type": "null"
          }
        ]
      },
      "message": {
        "anyOf": [
          {
            "type": "string"
          },
          {
            "type": "null"
          }
        ]
      },
      "acknowledged_at": {
        "anyOf": [
          {
            "type": "string",
            "format": "date-time"
          },
          {
            "type": "null"
          }
        ]
      },
      "acknowledged_by": {
        "anyOf": [
          {
            "type": "string",
            "description": "Namn på medlemmen som kvitterade"
          },
          {
            "type": "null"
          }
        ]
      }
    }
  }
}
GET /workspaces/:workspace_id/alerts.json Lista aviseringar alerts_list

Behörighet: analytics.read

Exempel
curl https://privatusanalytics.com/workspaces/:workspace_id/alerts.json \
  -H "Authorization: Bearer $PRIVATUS_TOKEN"
Indata
{
  "type": "object",
  "properties": {
    "site_id": {
      "type": "string",
      "description": "Endast aviseringar för den här webbplatsen (pa_…)"
    },
    "state": {
      "type": "string",
      "description": "Endast aviseringar som är ok eller utlösta",
      "enum": [
        "ok",
        "triggered"
      ]
    },
    "kind": {
      "type": "string",
      "description": "Endast den här typen",
      "enum": [
        "threshold",
        "anomaly",
        "goal",
        "no_data",
        "usage",
        "uptime",
        "ssl",
        "vitals"
      ]
    },
    "workspace_id": {
      "type": "string",
      "description": "Arbetsyte-id, t.ex. ws_7Q2K9XH3AB"
    },
    "page": {
      "type": "integer",
      "description": "Sida (från 1)"
    },
    "per_page": {
      "type": "integer",
      "description": "Resultat per sida (max 100)"
    }
  },
  "required": [
    "workspace_id"
  ]
}
Svarsdata
{
  "type": "array",
  "items": {
    "type": "object",
    "properties": {
      "id": {
        "type": "string",
        "description": "Aviserings-id, t.ex. alr_7Q2K9XH3AB"
      },
      "site_id": {
        "anyOf": [
          {
            "type": "string",
            "description": "Webbplats-id (null för användningsaviseringar)"
          },
          {
            "type": "null"
          }
        ]
      },
      "name": {
        "type": "string"
      },
      "kind": {
        "type": "string",
        "description": "threshold, anomaly, goal, no_data, usage, uptime, ssl eller vitals"
      },
      "metric": {
        "anyOf": [
          {
            "type": "string"
          },
          {
            "type": "null"
          }
        ]
      },
      "operator": {
        "anyOf": [
          {
            "type": "string",
            "description": "gt, gte, lt eller lte"
          },
          {
            "type": "null"
          }
        ]
      },
      "threshold": {
        "anyOf": [
          {
            "type": "number"
          },
          {
            "type": "null"
          }
        ]
      },
      "window_minutes": {
        "type": "integer"
      },
      "sensitivity": {
        "type": "string",
        "description": "känslighet för anomaly"
      },
      "goal_id": {
        "anyOf": [
          {
            "type": "string"
          },
          {
            "type": "null"
          }
        ]
      },
      "channel_ids": {
        "type": "array",
        "items": {
          "type": "string"
        },
        "description": "Id för aviseringskanaler"
      },
      "state": {
        "type": "string",
        "description": "ok eller triggered"
      },
      "enabled": {
        "type": "boolean"
      },
      "muted_until": {
        "anyOf": [
          {
            "type": "string",
            "format": "date-time"
          },
          {
            "type": "null"
          }
        ]
      },
      "last_triggered_at": {
        "anyOf": [
          {
            "type": "string",
            "format": "date-time"
          },
          {
            "type": "null"
          }
        ]
      },
      "last_evaluated_at": {
        "anyOf": [
          {
            "type": "string",
            "format": "date-time"
          },
          {
            "type": "null"
          }
        ]
      },
      "created_at": {
        "type": "string",
        "format": "date-time"
      }
    }
  }
}
POST /alerts/:id/mute.json Tysta (eller slå på) en aviserings notiser alerts_mute

Behörighet: content.write

Exempel
curl -X POST https://privatusanalytics.com/alerts/:id/mute.json \
  -H "Authorization: Bearer $PRIVATUS_TOKEN" \
  -H "Content-Type: application/json" -d '{…}'
Indata
{
  "type": "object",
  "properties": {
    "minutes": {
      "type": "integer",
      "description": "Tysta i så här många minuter (0 slår på igen, max 30 dagar)",
      "default": 60
    },
    "id": {
      "type": "string",
      "description": "Id för resursen"
    }
  },
  "required": [
    "id"
  ]
}
Svarsdata
{
  "type": "object",
  "properties": {
    "id": {
      "type": "string",
      "description": "Aviserings-id, t.ex. alr_7Q2K9XH3AB"
    },
    "site_id": {
      "anyOf": [
        {
          "type": "string",
          "description": "Webbplats-id (null för användningsaviseringar)"
        },
        {
          "type": "null"
        }
      ]
    },
    "name": {
      "type": "string"
    },
    "kind": {
      "type": "string",
      "description": "threshold, anomaly, goal, no_data, usage, uptime, ssl eller vitals"
    },
    "metric": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ]
    },
    "operator": {
      "anyOf": [
        {
          "type": "string",
          "description": "gt, gte, lt eller lte"
        },
        {
          "type": "null"
        }
      ]
    },
    "threshold": {
      "anyOf": [
        {
          "type": "number"
        },
        {
          "type": "null"
        }
      ]
    },
    "window_minutes": {
      "type": "integer"
    },
    "sensitivity": {
      "type": "string",
      "description": "känslighet för anomaly"
    },
    "goal_id": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ]
    },
    "channel_ids": {
      "type": "array",
      "items": {
        "type": "string"
      },
      "description": "Id för aviseringskanaler"
    },
    "state": {
      "type": "string",
      "description": "ok eller triggered"
    },
    "enabled": {
      "type": "boolean"
    },
    "muted_until": {
      "anyOf": [
        {
          "type": "string",
          "format": "date-time"
        },
        {
          "type": "null"
        }
      ]
    },
    "last_triggered_at": {
      "anyOf": [
        {
          "type": "string",
          "format": "date-time"
        },
        {
          "type": "null"
        }
      ]
    },
    "last_evaluated_at": {
      "anyOf": [
        {
          "type": "string",
          "format": "date-time"
        },
        {
          "type": "null"
        }
      ]
    },
    "created_at": {
      "type": "string",
      "format": "date-time"
    }
  }
}
GET /alerts/:id.json Hämta en avisering alerts_get

Behörighet: analytics.read

Exempel
curl https://privatusanalytics.com/alerts/:id.json \
  -H "Authorization: Bearer $PRIVATUS_TOKEN"
Indata
{
  "type": "object",
  "properties": {
    "id": {
      "type": "string",
      "description": "Id för resursen"
    }
  },
  "required": [
    "id"
  ]
}
Svarsdata
{
  "type": "object",
  "properties": {
    "id": {
      "type": "string",
      "description": "Aviserings-id, t.ex. alr_7Q2K9XH3AB"
    },
    "site_id": {
      "anyOf": [
        {
          "type": "string",
          "description": "Webbplats-id (null för användningsaviseringar)"
        },
        {
          "type": "null"
        }
      ]
    },
    "name": {
      "type": "string"
    },
    "kind": {
      "type": "string",
      "description": "threshold, anomaly, goal, no_data, usage, uptime, ssl eller vitals"
    },
    "metric": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ]
    },
    "operator": {
      "anyOf": [
        {
          "type": "string",
          "description": "gt, gte, lt eller lte"
        },
        {
          "type": "null"
        }
      ]
    },
    "threshold": {
      "anyOf": [
        {
          "type": "number"
        },
        {
          "type": "null"
        }
      ]
    },
    "window_minutes": {
      "type": "integer"
    },
    "sensitivity": {
      "type": "string",
      "description": "känslighet för anomaly"
    },
    "goal_id": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ]
    },
    "channel_ids": {
      "type": "array",
      "items": {
        "type": "string"
      },
      "description": "Id för aviseringskanaler"
    },
    "state": {
      "type": "string",
      "description": "ok eller triggered"
    },
    "enabled": {
      "type": "boolean"
    },
    "muted_until": {
      "anyOf": [
        {
          "type": "string",
          "format": "date-time"
        },
        {
          "type": "null"
        }
      ]
    },
    "last_triggered_at": {
      "anyOf": [
        {
          "type": "string",
          "format": "date-time"
        },
        {
          "type": "null"
        }
      ]
    },
    "last_evaluated_at": {
      "anyOf": [
        {
          "type": "string",
          "format": "date-time"
        },
        {
          "type": "null"
        }
      ]
    },
    "created_at": {
      "type": "string",
      "format": "date-time"
    }
  }
}
PATCH /alerts/:id.json Uppdatera en avisering alerts_update

Behörighet: content.write

Exempel
curl -X PATCH https://privatusanalytics.com/alerts/:id.json \
  -H "Authorization: Bearer $PRIVATUS_TOKEN" \
  -H "Content-Type: application/json" -d '{…}'
Indata
{
  "type": "object",
  "properties": {
    "site_id": {
      "type": "string",
      "description": "Webbplats-id (pa_…). Krävs utom för användningsaviseringar"
    },
    "metric": {
      "type": "string",
      "description": "threshold/anomaly: visitors, visits, pageviews, bounce_rate eller conversion. vitals: lcp, inp, cls, fcp eller ttfb"
    },
    "operator": {
      "type": "string",
      "description": "Jämförelse (gt, gte, lt, lte). anomaly: lt bara nedgångar, gt bara toppar, tomt båda",
      "enum": [
        "gt",
        "gte",
        "lt",
        "lte"
      ]
    },
    "threshold": {
      "type": "number",
      "description": "threshold: mätvärde, goal: slutföranden, no_data: timmar, usage: procent, ssl: dagar, vitals: ms (CLS: poäng)"
    },
    "window_minutes": {
      "type": "integer",
      "description": "Utvärderingsfönster i minuter (5 till 10080)"
    },
    "sensitivity": {
      "type": "string",
      "description": "anomaly: low, medium eller high",
      "enum": [
        "low",
        "medium",
        "high"
      ]
    },
    "goal_id": {
      "type": "string",
      "description": "goal- och conversion-aviseringar: mål-id (goal_…)"
    },
    "uptime_check_id": {
      "type": "string",
      "description": "uptime/ssl: kontroll-id (standard: alla webbplatsens kontroller)"
    },
    "channel_ids": {
      "type": "array",
      "items": {
        "type": "string"
      },
      "description": "Id för aviseringskanaler (nch_…)"
    },
    "enabled": {
      "type": "boolean",
      "description": "Utvärdera den här aviseringen"
    },
    "name": {
      "type": "string",
      "description": "Aviseringens namn"
    },
    "kind": {
      "type": "string",
      "description": "Typ av avisering",
      "enum": [
        "threshold",
        "anomaly",
        "goal",
        "no_data",
        "usage",
        "uptime",
        "ssl",
        "vitals"
      ]
    },
    "id": {
      "type": "string",
      "description": "Id för resursen"
    }
  },
  "required": [
    "id"
  ]
}
Svarsdata
{
  "type": "object",
  "properties": {
    "id": {
      "type": "string",
      "description": "Aviserings-id, t.ex. alr_7Q2K9XH3AB"
    },
    "site_id": {
      "anyOf": [
        {
          "type": "string",
          "description": "Webbplats-id (null för användningsaviseringar)"
        },
        {
          "type": "null"
        }
      ]
    },
    "name": {
      "type": "string"
    },
    "kind": {
      "type": "string",
      "description": "threshold, anomaly, goal, no_data, usage, uptime, ssl eller vitals"
    },
    "metric": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ]
    },
    "operator": {
      "anyOf": [
        {
          "type": "string",
          "description": "gt, gte, lt eller lte"
        },
        {
          "type": "null"
        }
      ]
    },
    "threshold": {
      "anyOf": [
        {
          "type": "number"
        },
        {
          "type": "null"
        }
      ]
    },
    "window_minutes": {
      "type": "integer"
    },
    "sensitivity": {
      "type": "string",
      "description": "känslighet för anomaly"
    },
    "goal_id": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ]
    },
    "channel_ids": {
      "type": "array",
      "items": {
        "type": "string"
      },
      "description": "Id för aviseringskanaler"
    },
    "state": {
      "type": "string",
      "description": "ok eller triggered"
    },
    "enabled": {
      "type": "boolean"
    },
    "muted_until": {
      "anyOf": [
        {
          "type": "string",
          "format": "date-time"
        },
        {
          "type": "null"
        }
      ]
    },
    "last_triggered_at": {
      "anyOf": [
        {
          "type": "string",
          "format": "date-time"
        },
        {
          "type": "null"
        }
      ]
    },
    "last_evaluated_at": {
      "anyOf": [
        {
          "type": "string",
          "format": "date-time"
        },
        {
          "type": "null"
        }
      ]
    },
    "created_at": {
      "type": "string",
      "format": "date-time"
    }
  }
}
GET /sites/:site_id/alerts.json Lista aviseringar för en webbplats site_alerts_list

Behörighet: analytics.read

Exempel
curl https://privatusanalytics.com/sites/:site_id/alerts.json \
  -H "Authorization: Bearer $PRIVATUS_TOKEN"
Indata
{
  "type": "object",
  "properties": {
    "state": {
      "type": "string",
      "description": "Endast aviseringar som är ok eller utlösta",
      "enum": [
        "ok",
        "triggered"
      ]
    },
    "kind": {
      "type": "string",
      "description": "Endast den här typen",
      "enum": [
        "threshold",
        "anomaly",
        "goal",
        "no_data",
        "usage",
        "uptime",
        "ssl",
        "vitals"
      ]
    },
    "site_id": {
      "type": "string",
      "description": "Webbplats-id, t.ex. pa_7Q2K9XH3AB"
    },
    "page": {
      "type": "integer",
      "description": "Sida (från 1)"
    },
    "per_page": {
      "type": "integer",
      "description": "Resultat per sida (max 100)"
    }
  },
  "required": [
    "site_id"
  ]
}
Svarsdata
{
  "type": "array",
  "items": {
    "type": "object",
    "properties": {
      "id": {
        "type": "string",
        "description": "Aviserings-id, t.ex. alr_7Q2K9XH3AB"
      },
      "site_id": {
        "anyOf": [
          {
            "type": "string",
            "description": "Webbplats-id (null för användningsaviseringar)"
          },
          {
            "type": "null"
          }
        ]
      },
      "name": {
        "type": "string"
      },
      "kind": {
        "type": "string",
        "description": "threshold, anomaly, goal, no_data, usage, uptime, ssl eller vitals"
      },
      "metric": {
        "anyOf": [
          {
            "type": "string"
          },
          {
            "type": "null"
          }
        ]
      },
      "operator": {
        "anyOf": [
          {
            "type": "string",
            "description": "gt, gte, lt eller lte"
          },
          {
            "type": "null"
          }
        ]
      },
      "threshold": {
        "anyOf": [
          {
            "type": "number"
          },
          {
            "type": "null"
          }
        ]
      },
      "window_minutes": {
        "type": "integer"
      },
      "sensitivity": {
        "type": "string",
        "description": "känslighet för anomaly"
      },
      "goal_id": {
        "anyOf": [
          {
            "type": "string"
          },
          {
            "type": "null"
          }
        ]
      },
      "channel_ids": {
        "type": "array",
        "items": {
          "type": "string"
        },
        "description": "Id för aviseringskanaler"
      },
      "state": {
        "type": "string",
        "description": "ok eller triggered"
      },
      "enabled": {
        "type": "boolean"
      },
      "muted_until": {
        "anyOf": [
          {
            "type": "string",
            "format": "date-time"
          },
          {
            "type": "null"
          }
        ]
      },
      "last_triggered_at": {
        "anyOf": [
          {
            "type": "string",
            "format": "date-time"
          },
          {
            "type": "null"
          }
        ]
      },
      "last_evaluated_at": {
        "anyOf": [
          {
            "type": "string",
            "format": "date-time"
          },
          {
            "type": "null"
          }
        ]
      },
      "created_at": {
        "type": "string",
        "format": "date-time"
      }
    }
  }
}

Aviseringskanaler

POST /workspaces/:workspace_id/channels.json Lägg till en aviseringskanal notification_channels_create

Behörighet: content.write

Exempel
curl -X POST https://privatusanalytics.com/workspaces/:workspace_id/channels.json \
  -H "Authorization: Bearer $PRIVATUS_TOKEN" \
  -H "Content-Type: application/json" -d '{…}'
Indata
{
  "type": "object",
  "properties": {
    "url": {
      "type": "string",
      "description": "Webhook-URL (slack, teams, discord, webhook), HTTPS"
    },
    "secret": {
      "type": "string",
      "description": "webhook: HMAC-hemlighet för X-Privatus-Signature"
    },
    "emails": {
      "type": "array",
      "items": {
        "type": "string"
      },
      "description": "email: mottagaradresser (max 20)"
    },
    "routing_key": {
      "type": "string",
      "description": "pagerduty: integrationsnyckel för Events API v2"
    },
    "api_key": {
      "type": "string",
      "description": "opsgenie: API-integrationsnyckel"
    },
    "region": {
      "type": "string",
      "description": "opsgenie: kontots region",
      "enum": [
        "us",
        "eu"
      ]
    },
    "kind": {
      "type": "string",
      "description": "email, slack, teams, discord, webhook, pagerduty, opsgenie eller push",
      "enum": [
        "email",
        "slack",
        "teams",
        "discord",
        "webhook",
        "pagerduty",
        "opsgenie",
        "push"
      ]
    },
    "name": {
      "type": "string",
      "description": "Visningsnamn",
      "examples": [
        "#alerts"
      ]
    },
    "workspace_id": {
      "type": "string",
      "description": "Arbetsyte-id, t.ex. ws_7Q2K9XH3AB"
    }
  },
  "required": [
    "kind",
    "name",
    "workspace_id"
  ]
}
Svarsdata
{
  "type": "object",
  "properties": {
    "id": {
      "type": "string",
      "description": "Kanal-id, t.ex. nch_7Q2K9XH3AB"
    },
    "kind": {
      "type": "string",
      "description": "email, slack, teams, discord, webhook, pagerduty, opsgenie eller push"
    },
    "name": {
      "type": "string"
    },
    "target": {
      "type": "string",
      "description": "Maskerat mål"
    },
    "last_used_at": {
      "anyOf": [
        {
          "type": "string",
          "format": "date-time"
        },
        {
          "type": "null"
        }
      ]
    },
    "created_at": {
      "type": "string",
      "format": "date-time"
    }
  }
}
DELETE /channels/:id.json Ta bort en aviseringskanal notification_channels_delete

Behörighet: content.write

Exempel
curl -X DELETE https://privatusanalytics.com/channels/:id.json \
  -H "Authorization: Bearer $PRIVATUS_TOKEN" \
  -H "Content-Type: application/json" -d '{…}'
Indata
{
  "type": "object",
  "properties": {
    "id": {
      "type": "string",
      "description": "Id för resursen"
    }
  },
  "required": [
    "id"
  ]
}
Svarsdata
{
  "type": "object",
  "properties": {
    "id": {
      "type": "string",
      "description": "Kanal-id, t.ex. nch_7Q2K9XH3AB"
    },
    "kind": {
      "type": "string",
      "description": "email, slack, teams, discord, webhook, pagerduty, opsgenie eller push"
    },
    "name": {
      "type": "string"
    },
    "target": {
      "type": "string",
      "description": "Maskerat mål"
    },
    "last_used_at": {
      "anyOf": [
        {
          "type": "string",
          "format": "date-time"
        },
        {
          "type": "null"
        }
      ]
    },
    "created_at": {
      "type": "string",
      "format": "date-time"
    }
  }
}
GET /workspaces/:workspace_id/channels.json Lista aviseringskanaler notification_channels_list

Behörighet: analytics.read

Exempel
curl https://privatusanalytics.com/workspaces/:workspace_id/channels.json \
  -H "Authorization: Bearer $PRIVATUS_TOKEN"
Indata
{
  "type": "object",
  "properties": {
    "kind": {
      "type": "string",
      "description": "Endast kanaler av den här typen",
      "enum": [
        "email",
        "slack",
        "teams",
        "discord",
        "webhook",
        "pagerduty",
        "opsgenie",
        "push"
      ]
    },
    "workspace_id": {
      "type": "string",
      "description": "Arbetsyte-id, t.ex. ws_7Q2K9XH3AB"
    },
    "page": {
      "type": "integer",
      "description": "Sida (från 1)"
    },
    "per_page": {
      "type": "integer",
      "description": "Resultat per sida (max 100)"
    }
  },
  "required": [
    "workspace_id"
  ]
}
Svarsdata
{
  "type": "array",
  "items": {
    "type": "object",
    "properties": {
      "id": {
        "type": "string",
        "description": "Kanal-id, t.ex. nch_7Q2K9XH3AB"
      },
      "kind": {
        "type": "string",
        "description": "email, slack, teams, discord, webhook, pagerduty, opsgenie eller push"
      },
      "name": {
        "type": "string"
      },
      "target": {
        "type": "string",
        "description": "Maskerat mål"
      },
      "last_used_at": {
        "anyOf": [
          {
            "type": "string",
            "format": "date-time"
          },
          {
            "type": "null"
          }
        ]
      },
      "created_at": {
        "type": "string",
        "format": "date-time"
      }
    }
  }
}
POST /channels/:id/send_test.json Skicka ett testmeddelande via en kanal notification_channels_send_test

Behörighet: content.write

Exempel
curl -X POST https://privatusanalytics.com/channels/:id/send_test.json \
  -H "Authorization: Bearer $PRIVATUS_TOKEN" \
  -H "Content-Type: application/json" -d '{…}'
Indata
{
  "type": "object",
  "properties": {
    "id": {
      "type": "string",
      "description": "Id för resursen"
    }
  },
  "required": [
    "id"
  ]
}
Svarsdata
{
  "type": "object",
  "properties": {
    "id": {
      "type": "string",
      "description": "Kanal-id, t.ex. nch_7Q2K9XH3AB"
    },
    "kind": {
      "type": "string",
      "description": "email, slack, teams, discord, webhook, pagerduty, opsgenie eller push"
    },
    "name": {
      "type": "string"
    },
    "target": {
      "type": "string",
      "description": "Maskerat mål"
    },
    "last_used_at": {
      "anyOf": [
        {
          "type": "string",
          "format": "date-time"
        },
        {
          "type": "null"
        }
      ]
    },
    "created_at": {
      "type": "string",
      "format": "date-time"
    }
  }
}
GET /channels/:id.json Hämta en aviseringskanal notification_channels_get

Behörighet: analytics.read

Exempel
curl https://privatusanalytics.com/channels/:id.json \
  -H "Authorization: Bearer $PRIVATUS_TOKEN"
Indata
{
  "type": "object",
  "properties": {
    "id": {
      "type": "string",
      "description": "Id för resursen"
    }
  },
  "required": [
    "id"
  ]
}
Svarsdata
{
  "type": "object",
  "properties": {
    "id": {
      "type": "string",
      "description": "Kanal-id, t.ex. nch_7Q2K9XH3AB"
    },
    "kind": {
      "type": "string",
      "description": "email, slack, teams, discord, webhook, pagerduty, opsgenie eller push"
    },
    "name": {
      "type": "string"
    },
    "target": {
      "type": "string",
      "description": "Maskerat mål"
    },
    "last_used_at": {
      "anyOf": [
        {
          "type": "string",
          "format": "date-time"
        },
        {
          "type": "null"
        }
      ]
    },
    "created_at": {
      "type": "string",
      "format": "date-time"
    }
  }
}
PATCH /channels/:id.json Uppdatera en aviseringskanal notification_channels_update

Behörighet: content.write

Exempel
curl -X PATCH https://privatusanalytics.com/channels/:id.json \
  -H "Authorization: Bearer $PRIVATUS_TOKEN" \
  -H "Content-Type: application/json" -d '{…}'
Indata
{
  "type": "object",
  "properties": {
    "url": {
      "type": "string",
      "description": "Webhook-URL (slack, teams, discord, webhook), HTTPS"
    },
    "secret": {
      "type": "string",
      "description": "webhook: HMAC-hemlighet för X-Privatus-Signature"
    },
    "emails": {
      "type": "array",
      "items": {
        "type": "string"
      },
      "description": "email: mottagaradresser (max 20)"
    },
    "routing_key": {
      "type": "string",
      "description": "pagerduty: integrationsnyckel för Events API v2"
    },
    "api_key": {
      "type": "string",
      "description": "opsgenie: API-integrationsnyckel"
    },
    "region": {
      "type": "string",
      "description": "opsgenie: kontots region",
      "enum": [
        "us",
        "eu"
      ]
    },
    "name": {
      "type": "string",
      "description": "Visningsnamn"
    },
    "id": {
      "type": "string",
      "description": "Id för resursen"
    }
  },
  "required": [
    "id"
  ]
}
Svarsdata
{
  "type": "object",
  "properties": {
    "id": {
      "type": "string",
      "description": "Kanal-id, t.ex. nch_7Q2K9XH3AB"
    },
    "kind": {
      "type": "string",
      "description": "email, slack, teams, discord, webhook, pagerduty, opsgenie eller push"
    },
    "name": {
      "type": "string"
    },
    "target": {
      "type": "string",
      "description": "Maskerat mål"
    },
    "last_used_at": {
      "anyOf": [
        {
          "type": "string",
          "format": "date-time"
        },
        {
          "type": "null"
        }
      ]
    },
    "created_at": {
      "type": "string",
      "format": "date-time"
    }
  }
}
POST /push_subscription.json Registrera en webbläsare för pushnotiser push_subscriptions_create

Behörighet: member

Exempel
curl -X POST https://privatusanalytics.com/push_subscription.json \
  -H "Authorization: Bearer $PRIVATUS_TOKEN" \
  -H "Content-Type: application/json" -d '{…}'
Indata
{
  "type": "object",
  "properties": {
    "endpoint": {
      "type": "string",
      "description": "PushSubscription.endpoint från webbläsaren"
    },
    "p256dh": {
      "type": "string",
      "description": "PushSubscription keys.p256dh (base64url)"
    },
    "auth": {
      "type": "string",
      "description": "PushSubscription keys.auth (base64url)"
    }
  },
  "required": [
    "endpoint",
    "p256dh",
    "auth"
  ]
}
Svarsdata
{
  "type": "object",
  "properties": {
    "endpoint_host": {
      "type": "string",
      "description": "Värd för pushtjänsten"
    },
    "created_at": {
      "type": "string",
      "format": "date-time"
    }
  }
}
DELETE /push_subscription.json Ta bort en webbläsares pushregistrering push_subscriptions_delete

Behörighet: member

Exempel
curl -X DELETE https://privatusanalytics.com/push_subscription.json \
  -H "Authorization: Bearer $PRIVATUS_TOKEN" \
  -H "Content-Type: application/json" -d '{…}'
Indata
{
  "type": "object",
  "properties": {
    "endpoint": {
      "type": "string",
      "description": "PushSubscription.endpoint att ta bort"
    }
  },
  "required": [
    "endpoint"
  ]
}
Svarsdata
{
  "type": "object",
  "properties": {
    "endpoint_host": {
      "type": "string",
      "description": "Värd för pushtjänsten"
    },
    "created_at": {
      "type": "string",
      "format": "date-time"
    }
  }
}

Crawlers

POST /sites/:site_id/crawlers/connection.json Synkronisera träffar från AI-crawlers från en Cloudflare-zon (kräver ett Cloudflare-medgivande från webbläsaren) crawlers_cloudflare_connect

Behörighet: sites.manage

Exempel
curl -X POST https://privatusanalytics.com/sites/:site_id/crawlers/connection.json \
  -H "Authorization: Bearer $PRIVATUS_TOKEN" \
  -H "Content-Type: application/json" -d '{…}'
Indata
{
  "type": "object",
  "properties": {
    "zone_id": {
      "type": "string",
      "description": "Cloudflare-zonens id, från crawlers_cloudflare_zones",
      "examples": [
        "023e105f4ecef8ad9ca31a8372d0c353"
      ]
    },
    "site_id": {
      "type": "string",
      "description": "Webbplats-id, t.ex. pa_7Q2K9XH3AB"
    }
  },
  "required": [
    "zone_id",
    "site_id"
  ]
}
Svarsdata
{
  "type": "object",
  "properties": {
    "zone_id": {
      "type": "string",
      "description": "Cloudflare-zonens id"
    },
    "zone_name": {
      "type": "string",
      "description": "Cloudflare-zonens namn, till exempel example.com"
    },
    "status": {
      "type": "string",
      "description": "active eller error"
    },
    "last_synced_at": {
      "anyOf": [
        {
          "type": "string",
          "format": "date-time",
          "description": "När crawler-träffar senast importerades, eller null före den första importen"
        },
        {
          "type": "null"
        }
      ]
    },
    "created_at": {
      "type": "string",
      "format": "date-time"
    }
  }
}
DELETE /sites/:site_id/crawlers/connection.json Koppla från Cloudflare och radera de crawler-träffar som importerats därifrån crawlers_cloudflare_disconnect

Behörighet: sites.manage

Exempel
curl -X DELETE https://privatusanalytics.com/sites/:site_id/crawlers/connection.json \
  -H "Authorization: Bearer $PRIVATUS_TOKEN" \
  -H "Content-Type: application/json" -d '{…}'
Indata
{
  "type": "object",
  "properties": {
    "site_id": {
      "type": "string",
      "description": "Webbplats-id, t.ex. pa_7Q2K9XH3AB"
    }
  },
  "required": [
    "site_id"
  ]
}
Svarsdata
{
  "type": "object",
  "properties": {
    "zone_id": {
      "type": "string",
      "description": "Cloudflare-zonens id"
    },
    "zone_name": {
      "type": "string",
      "description": "Cloudflare-zonens namn, till exempel example.com"
    },
    "status": {
      "type": "string",
      "description": "active eller error"
    },
    "last_synced_at": {
      "anyOf": [
        {
          "type": "string",
          "format": "date-time",
          "description": "När crawler-träffar senast importerades, eller null före den första importen"
        },
        {
          "type": "null"
        }
      ]
    },
    "created_at": {
      "type": "string",
      "format": "date-time"
    }
  }
}
POST /sites/:site_id/crawlers/sync.json Importera crawler-träffar från Cloudflare nu crawlers_cloudflare_sync

Behörighet: sites.manage

Exempel
curl -X POST https://privatusanalytics.com/sites/:site_id/crawlers/sync.json \
  -H "Authorization: Bearer $PRIVATUS_TOKEN" \
  -H "Content-Type: application/json" -d '{…}'
Indata
{
  "type": "object",
  "properties": {
    "site_id": {
      "type": "string",
      "description": "Webbplats-id, t.ex. pa_7Q2K9XH3AB"
    }
  },
  "required": [
    "site_id"
  ]
}
Svarsdata
{
  "type": "object",
  "properties": {
    "zone_id": {
      "type": "string",
      "description": "Cloudflare-zonens id"
    },
    "zone_name": {
      "type": "string",
      "description": "Cloudflare-zonens namn, till exempel example.com"
    },
    "status": {
      "type": "string",
      "description": "active eller error"
    },
    "last_synced_at": {
      "anyOf": [
        {
          "type": "string",
          "format": "date-time",
          "description": "När crawler-träffar senast importerades, eller null före den första importen"
        },
        {
          "type": "null"
        }
      ]
    },
    "created_at": {
      "type": "string",
      "format": "date-time"
    }
  }
}
GET /sites/:site_id/crawlers/zones.json Lista de Cloudflare-zoner du kan ansluta (kräver ett Cloudflare-medgivande från webbläsaren) crawlers_cloudflare_zones

Behörighet: sites.manage

Exempel
curl https://privatusanalytics.com/sites/:site_id/crawlers/zones.json \
  -H "Authorization: Bearer $PRIVATUS_TOKEN"
Indata
{
  "type": "object",
  "properties": {
    "site_id": {
      "type": "string",
      "description": "Webbplats-id, t.ex. pa_7Q2K9XH3AB"
    }
  },
  "required": [
    "site_id"
  ]
}
Svarsdata
{
  "type": "object"
}
GET /sites/:site_id/crawlers.json Rapport om AI-crawlers: träffar per crawler över tid, toppsökvägar per crawler, per kategori crawlers_report

Behörighet: analytics.read

Exempel
curl https://privatusanalytics.com/sites/:site_id/crawlers.json \
  -H "Authorization: Bearer $PRIVATUS_TOKEN"
Indata
{
  "type": "object",
  "properties": {
    "period": {
      "type": "string",
      "description": "Förinställt datumintervall. Använd custom med from/to",
      "enum": [
        "today",
        "yesterday",
        "24h",
        "7d",
        "14d",
        "28d",
        "30d",
        "90d",
        "mtd",
        "last_month",
        "qtd",
        "last_quarter",
        "ytd",
        "12mo",
        "last_year",
        "all",
        "custom"
      ],
      "default": "30d"
    },
    "from": {
      "type": "string",
      "format": "date",
      "description": "Start för eget intervall (webbplatsens tidszon)"
    },
    "to": {
      "type": "string",
      "format": "date",
      "description": "Slut för eget intervall, inklusive"
    },
    "category": {
      "type": "string",
      "description": "ai, search, seo, other eller all",
      "enum": [
        "all",
        "ai",
        "search",
        "seo",
        "other"
      ],
      "default": "ai"
    },
    "crawler": {
      "type": "string",
      "description": "Endast den här crawlern, t.ex. GPTBot"
    },
    "site_id": {
      "type": "string",
      "description": "Webbplats-id, t.ex. pa_7Q2K9XH3AB"
    }
  },
  "required": [
    "site_id"
  ]
}
Svarsdata
{
  "type": "object"
}

Datalagersynkning

POST /workspaces/:workspace_id/warehouses.json Lägg till en datalagerdestination warehouse_destinations_create

Behörighet: workspace.manage

Exempel
curl -X POST https://privatusanalytics.com/workspaces/:workspace_id/warehouses.json \
  -H "Authorization: Bearer $PRIVATUS_TOKEN" \
  -H "Content-Type: application/json" -d '{…}'
Indata
{
  "type": "object",
  "properties": {
    "name": {
      "type": "string",
      "description": "Visningsnamn, t.ex. Data lake"
    },
    "site_ids": {
      "type": "array",
      "items": {
        "type": "string"
      },
      "description": "Webbplatser att skicka (pa_…). Tomt skickar alla webbplatser"
    },
    "bucket": {
      "type": "string",
      "description": "s3: bucket-namn"
    },
    "region": {
      "type": "string",
      "description": "s3: region, t.ex. us-east-1 (auto för R2)"
    },
    "prefix": {
      "type": "string",
      "description": "s3/azure: sökvägsprefix, t.ex. privatus/events"
    },
    "endpoint": {
      "type": "string",
      "description": "s3: https-endpoint för S3-kompatibel lagring (GCS interoperability, R2, MinIO)"
    },
    "access_key_id": {
      "type": "string",
      "description": "s3: access key id"
    },
    "secret_access_key": {
      "type": "string",
      "description": "s3: secret access key (skrivskyddad)"
    },
    "service_account_json": {
      "type": "string",
      "description": "bigquery: JSON-nyckel för tjänstekonto med BigQuery Data Editor (skrivskyddad)"
    },
    "project_id": {
      "type": "string",
      "description": "bigquery: projekt-id (standard: från nyckeln)"
    },
    "dataset": {
      "type": "string",
      "description": "bigquery: dataset-id"
    },
    "table": {
      "type": "string",
      "description": "bigquery/snowflake: tabellnamn (kolumner: schema v1)"
    },
    "account": {
      "type": "string",
      "description": "snowflake: kontoidentifierare, t.ex. xy12345.us-east-1 eller myorg-myaccount"
    },
    "user": {
      "type": "string",
      "description": "snowflake: användare med nyckelparsautentisering"
    },
    "private_key": {
      "type": "string",
      "description": "snowflake: privat RSA-nyckel i PEM (skrivskyddad)"
    },
    "database": {
      "type": "string",
      "description": "snowflake: databas"
    },
    "schema": {
      "type": "string",
      "description": "snowflake: schema"
    },
    "warehouse": {
      "type": "string",
      "description": "snowflake: virtuellt datalager"
    },
    "role": {
      "type": "string",
      "description": "snowflake: roll (valfritt)"
    },
    "sas_url": {
      "type": "string",
      "description": "azure: SAS-URL för container med skapa-/skrivbehörighet (skrivskyddad)"
    },
    "kind": {
      "type": "string",
      "description": "s3 (även GCS/R2/MinIO), bigquery, snowflake eller azure",
      "enum": [
        "s3",
        "bigquery",
        "snowflake",
        "azure"
      ]
    },
    "workspace_id": {
      "type": "string",
      "description": "Arbetsyte-id, t.ex. ws_7Q2K9XH3AB"
    }
  },
  "required": [
    "kind",
    "workspace_id"
  ]
}
Svarsdata
{
  "type": "object",
  "properties": {
    "id": {
      "type": "string",
      "description": "Mål-id, t.ex. whd_7Q2K9XH3AB"
    },
    "kind": {
      "type": "string",
      "description": "s3, bigquery, snowflake eller azure"
    },
    "name": {
      "type": "string"
    },
    "target": {
      "type": "string",
      "description": "Vart data går: s3://bucket/prefix, project.dataset.table, account/database.schema.table eller Azure-containern"
    },
    "configured": {
      "type": "array",
      "items": {
        "type": "string"
      },
      "description": "Namn på inställningar som är ifyllda (värden returneras aldrig)"
    },
    "site_ids": {
      "type": "array",
      "items": {
        "type": "string"
      },
      "description": "Skickade webbplatser (pa_…). Tomt betyder alla webbplatser"
    },
    "schedule": {
      "type": "string",
      "description": "daily: 02:00 UTC, skickar föregående UTC-dag"
    },
    "schema_version": {
      "type": "string",
      "description": "Radschema som skickas"
    },
    "last_run_at": {
      "anyOf": [
        {
          "type": "string",
          "format": "date-time"
        },
        {
          "type": "null"
        }
      ]
    },
    "next_run_at": {
      "anyOf": [
        {
          "type": "string",
          "format": "date-time"
        },
        {
          "type": "null"
        }
      ]
    },
    "last_error": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ]
    },
    "created_at": {
      "type": "string",
      "format": "date-time"
    }
  }
}
DELETE /warehouses/:id.json Ta bort en datalagerdestination warehouse_destinations_delete

Behörighet: workspace.manage

Exempel
curl -X DELETE https://privatusanalytics.com/warehouses/:id.json \
  -H "Authorization: Bearer $PRIVATUS_TOKEN" \
  -H "Content-Type: application/json" -d '{…}'
Indata
{
  "type": "object",
  "properties": {
    "id": {
      "type": "string",
      "description": "Id för resursen"
    }
  },
  "required": [
    "id"
  ]
}
Svarsdata
{
  "type": "object",
  "properties": {
    "id": {
      "type": "string",
      "description": "Mål-id, t.ex. whd_7Q2K9XH3AB"
    },
    "kind": {
      "type": "string",
      "description": "s3, bigquery, snowflake eller azure"
    },
    "name": {
      "type": "string"
    },
    "target": {
      "type": "string",
      "description": "Vart data går: s3://bucket/prefix, project.dataset.table, account/database.schema.table eller Azure-containern"
    },
    "configured": {
      "type": "array",
      "items": {
        "type": "string"
      },
      "description": "Namn på inställningar som är ifyllda (värden returneras aldrig)"
    },
    "site_ids": {
      "type": "array",
      "items": {
        "type": "string"
      },
      "description": "Skickade webbplatser (pa_…). Tomt betyder alla webbplatser"
    },
    "schedule": {
      "type": "string",
      "description": "daily: 02:00 UTC, skickar föregående UTC-dag"
    },
    "schema_version": {
      "type": "string",
      "description": "Radschema som skickas"
    },
    "last_run_at": {
      "anyOf": [
        {
          "type": "string",
          "format": "date-time"
        },
        {
          "type": "null"
        }
      ]
    },
    "next_run_at": {
      "anyOf": [
        {
          "type": "string",
          "format": "date-time"
        },
        {
          "type": "null"
        }
      ]
    },
    "last_error": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ]
    },
    "created_at": {
      "type": "string",
      "format": "date-time"
    }
  }
}
GET /workspaces/:workspace_id/warehouses.json Lista datalagerdestinationer warehouse_destinations_list

Behörighet: workspace.manage

Exempel
curl https://privatusanalytics.com/workspaces/:workspace_id/warehouses.json \
  -H "Authorization: Bearer $PRIVATUS_TOKEN"
Indata
{
  "type": "object",
  "properties": {
    "kind": {
      "type": "string",
      "description": "Endast mål av den här typen",
      "enum": [
        "s3",
        "bigquery",
        "snowflake",
        "azure"
      ]
    },
    "workspace_id": {
      "type": "string",
      "description": "Arbetsyte-id, t.ex. ws_7Q2K9XH3AB"
    },
    "page": {
      "type": "integer",
      "description": "Sida (från 1)"
    },
    "per_page": {
      "type": "integer",
      "description": "Resultat per sida (max 100)"
    }
  },
  "required": [
    "workspace_id"
  ]
}
Svarsdata
{
  "type": "array",
  "items": {
    "type": "object",
    "properties": {
      "id": {
        "type": "string",
        "description": "Mål-id, t.ex. whd_7Q2K9XH3AB"
      },
      "kind": {
        "type": "string",
        "description": "s3, bigquery, snowflake eller azure"
      },
      "name": {
        "type": "string"
      },
      "target": {
        "type": "string",
        "description": "Vart data går: s3://bucket/prefix, project.dataset.table, account/database.schema.table eller Azure-containern"
      },
      "configured": {
        "type": "array",
        "items": {
          "type": "string"
        },
        "description": "Namn på inställningar som är ifyllda (värden returneras aldrig)"
      },
      "site_ids": {
        "type": "array",
        "items": {
          "type": "string"
        },
        "description": "Skickade webbplatser (pa_…). Tomt betyder alla webbplatser"
      },
      "schedule": {
        "type": "string",
        "description": "daily: 02:00 UTC, skickar föregående UTC-dag"
      },
      "schema_version": {
        "type": "string",
        "description": "Radschema som skickas"
      },
      "last_run_at": {
        "anyOf": [
          {
            "type": "string",
            "format": "date-time"
          },
          {
            "type": "null"
          }
        ]
      },
      "next_run_at": {
        "anyOf": [
          {
            "type": "string",
            "format": "date-time"
          },
          {
            "type": "null"
          }
        ]
      },
      "last_error": {
        "anyOf": [
          {
            "type": "string"
          },
          {
            "type": "null"
          }
        ]
      },
      "created_at": {
        "type": "string",
        "format": "date-time"
      }
    }
  }
}
GET /warehouses/:id.json Hämta en datalagerdestination (inga hemligheter) warehouse_destinations_get

Behörighet: workspace.manage

Exempel
curl https://privatusanalytics.com/warehouses/:id.json \
  -H "Authorization: Bearer $PRIVATUS_TOKEN"
Indata
{
  "type": "object",
  "properties": {
    "id": {
      "type": "string",
      "description": "Id för resursen"
    }
  },
  "required": [
    "id"
  ]
}
Svarsdata
{
  "type": "object",
  "properties": {
    "id": {
      "type": "string",
      "description": "Mål-id, t.ex. whd_7Q2K9XH3AB"
    },
    "kind": {
      "type": "string",
      "description": "s3, bigquery, snowflake eller azure"
    },
    "name": {
      "type": "string"
    },
    "target": {
      "type": "string",
      "description": "Vart data går: s3://bucket/prefix, project.dataset.table, account/database.schema.table eller Azure-containern"
    },
    "configured": {
      "type": "array",
      "items": {
        "type": "string"
      },
      "description": "Namn på inställningar som är ifyllda (värden returneras aldrig)"
    },
    "site_ids": {
      "type": "array",
      "items": {
        "type": "string"
      },
      "description": "Skickade webbplatser (pa_…). Tomt betyder alla webbplatser"
    },
    "schedule": {
      "type": "string",
      "description": "daily: 02:00 UTC, skickar föregående UTC-dag"
    },
    "schema_version": {
      "type": "string",
      "description": "Radschema som skickas"
    },
    "last_run_at": {
      "anyOf": [
        {
          "type": "string",
          "format": "date-time"
        },
        {
          "type": "null"
        }
      ]
    },
    "next_run_at": {
      "anyOf": [
        {
          "type": "string",
          "format": "date-time"
        },
        {
          "type": "null"
        }
      ]
    },
    "last_error": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ]
    },
    "created_at": {
      "type": "string",
      "format": "date-time"
    }
  }
}
POST /warehouses/:id/sync.json Köa en synkning av en dag nu warehouse_destinations_sync

Behörighet: workspace.manage

Exempel
curl -X POST https://privatusanalytics.com/warehouses/:id/sync.json \
  -H "Authorization: Bearer $PRIVATUS_TOKEN" \
  -H "Content-Type: application/json" -d '{…}'
Indata
{
  "type": "object",
  "properties": {
    "date": {
      "type": "string",
      "format": "date",
      "description": "UTC-dag att skicka, t.ex. 2026-09-28 (standard: igår)"
    },
    "id": {
      "type": "string",
      "description": "Id för resursen"
    }
  },
  "required": [
    "id"
  ]
}
Svarsdata
{
  "type": "object",
  "properties": {
    "id": {
      "type": "string",
      "description": "Mål-id, t.ex. whd_7Q2K9XH3AB"
    },
    "kind": {
      "type": "string",
      "description": "s3, bigquery, snowflake eller azure"
    },
    "name": {
      "type": "string"
    },
    "target": {
      "type": "string",
      "description": "Vart data går: s3://bucket/prefix, project.dataset.table, account/database.schema.table eller Azure-containern"
    },
    "configured": {
      "type": "array",
      "items": {
        "type": "string"
      },
      "description": "Namn på inställningar som är ifyllda (värden returneras aldrig)"
    },
    "site_ids": {
      "type": "array",
      "items": {
        "type": "string"
      },
      "description": "Skickade webbplatser (pa_…). Tomt betyder alla webbplatser"
    },
    "schedule": {
      "type": "string",
      "description": "daily: 02:00 UTC, skickar föregående UTC-dag"
    },
    "schema_version": {
      "type": "string",
      "description": "Radschema som skickas"
    },
    "last_run_at": {
      "anyOf": [
        {
          "type": "string",
          "format": "date-time"
        },
        {
          "type": "null"
        }
      ]
    },
    "next_run_at": {
      "anyOf": [
        {
          "type": "string",
          "format": "date-time"
        },
        {
          "type": "null"
        }
      ]
    },
    "last_error": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ]
    },
    "created_at": {
      "type": "string",
      "format": "date-time"
    }
  }
}
PATCH /warehouses/:id.json Uppdatera en datalagerdestination (tomma hemligheter behålls) warehouse_destinations_update

Behörighet: workspace.manage

Exempel
curl -X PATCH https://privatusanalytics.com/warehouses/:id.json \
  -H "Authorization: Bearer $PRIVATUS_TOKEN" \
  -H "Content-Type: application/json" -d '{…}'
Indata
{
  "type": "object",
  "properties": {
    "name": {
      "type": "string",
      "description": "Visningsnamn, t.ex. Data lake"
    },
    "site_ids": {
      "type": "array",
      "items": {
        "type": "string"
      },
      "description": "Webbplatser att skicka (pa_…). Tomt skickar alla webbplatser"
    },
    "bucket": {
      "type": "string",
      "description": "s3: bucket-namn"
    },
    "region": {
      "type": "string",
      "description": "s3: region, t.ex. us-east-1 (auto för R2)"
    },
    "prefix": {
      "type": "string",
      "description": "s3/azure: sökvägsprefix, t.ex. privatus/events"
    },
    "endpoint": {
      "type": "string",
      "description": "s3: https-endpoint för S3-kompatibel lagring (GCS interoperability, R2, MinIO)"
    },
    "access_key_id": {
      "type": "string",
      "description": "s3: access key id"
    },
    "secret_access_key": {
      "type": "string",
      "description": "s3: secret access key (skrivskyddad)"
    },
    "service_account_json": {
      "type": "string",
      "description": "bigquery: JSON-nyckel för tjänstekonto med BigQuery Data Editor (skrivskyddad)"
    },
    "project_id": {
      "type": "string",
      "description": "bigquery: projekt-id (standard: från nyckeln)"
    },
    "dataset": {
      "type": "string",
      "description": "bigquery: dataset-id"
    },
    "table": {
      "type": "string",
      "description": "bigquery/snowflake: tabellnamn (kolumner: schema v1)"
    },
    "account": {
      "type": "string",
      "description": "snowflake: kontoidentifierare, t.ex. xy12345.us-east-1 eller myorg-myaccount"
    },
    "user": {
      "type": "string",
      "description": "snowflake: användare med nyckelparsautentisering"
    },
    "private_key": {
      "type": "string",
      "description": "snowflake: privat RSA-nyckel i PEM (skrivskyddad)"
    },
    "database": {
      "type": "string",
      "description": "snowflake: databas"
    },
    "schema": {
      "type": "string",
      "description": "snowflake: schema"
    },
    "warehouse": {
      "type": "string",
      "description": "snowflake: virtuellt datalager"
    },
    "role": {
      "type": "string",
      "description": "snowflake: roll (valfritt)"
    },
    "sas_url": {
      "type": "string",
      "description": "azure: SAS-URL för container med skapa-/skrivbehörighet (skrivskyddad)"
    },
    "id": {
      "type": "string",
      "description": "Id för resursen"
    }
  },
  "required": [
    "id"
  ]
}
Svarsdata
{
  "type": "object",
  "properties": {
    "id": {
      "type": "string",
      "description": "Mål-id, t.ex. whd_7Q2K9XH3AB"
    },
    "kind": {
      "type": "string",
      "description": "s3, bigquery, snowflake eller azure"
    },
    "name": {
      "type": "string"
    },
    "target": {
      "type": "string",
      "description": "Vart data går: s3://bucket/prefix, project.dataset.table, account/database.schema.table eller Azure-containern"
    },
    "configured": {
      "type": "array",
      "items": {
        "type": "string"
      },
      "description": "Namn på inställningar som är ifyllda (värden returneras aldrig)"
    },
    "site_ids": {
      "type": "array",
      "items": {
        "type": "string"
      },
      "description": "Skickade webbplatser (pa_…). Tomt betyder alla webbplatser"
    },
    "schedule": {
      "type": "string",
      "description": "daily: 02:00 UTC, skickar föregående UTC-dag"
    },
    "schema_version": {
      "type": "string",
      "description": "Radschema som skickas"
    },
    "last_run_at": {
      "anyOf": [
        {
          "type": "string",
          "format": "date-time"
        },
        {
          "type": "null"
        }
      ]
    },
    "next_run_at": {
      "anyOf": [
        {
          "type": "string",
          "format": "date-time"
        },
        {
          "type": "null"
        }
      ]
    },
    "last_error": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ]
    },
    "created_at": {
      "type": "string",
      "format": "date-time"
    }
  }
}

Delning

GET /badge/:site_id.json Besöksräknarmärke (SVG) för en publik webbplats badges_get

Behörighet: public · Endast HTTP (inte ett MCP-verktyg)

Exempel
curl https://privatusanalytics.com/badge/:site_id.json
Indata
{
  "type": "object",
  "properties": {
    "site_id": {
      "type": "string",
      "description": "Webbplats-id, t.ex. pa_7Q2K9XH3AB"
    }
  },
  "required": [
    "site_id"
  ]
}
Svarsdata
{
  "type": "object"
}
GET /share/:token/breakdown/:dimension.json Toppvärden för en delad dimension shares_breakdown

Behörighet: public

Exempel
curl https://privatusanalytics.com/share/:token/breakdown/:dimension.json
Indata
{
  "type": "object",
  "properties": {
    "dimension": {
      "type": "string",
      "description": "Dimension för resursen"
    },
    "period": {
      "type": "string",
      "description": "Förinställt datumintervall (ignoreras om länken låser det)",
      "enum": [
        "today",
        "yesterday",
        "24h",
        "7d",
        "14d",
        "28d",
        "30d",
        "90d",
        "mtd",
        "last_month",
        "qtd",
        "last_quarter",
        "ytd",
        "12mo",
        "last_year",
        "all",
        "custom"
      ],
      "default": "30d"
    },
    "from": {
      "type": "string",
      "format": "date",
      "description": "Start för eget intervall"
    },
    "to": {
      "type": "string",
      "format": "date",
      "description": "Slut för eget intervall, inklusive"
    },
    "filters": {
      "type": "array",
      "items": {},
      "description": "Extra filter, om länken tillåter dem",
      "default": []
    },
    "limit": {
      "type": "integer",
      "description": "Rader (max 100)",
      "default": 10
    },
    "token": {
      "type": "string",
      "description": "Token för resursen"
    }
  },
  "required": [
    "dimension",
    "token"
  ]
}
Svarsdata
{
  "type": "object"
}
GET /share/:token.json Översikt av delad instrumentpanel för en delningstoken shares_overview

Behörighet: public

Exempel
curl https://privatusanalytics.com/share/:token.json
Indata
{
  "type": "object",
  "properties": {
    "period": {
      "type": "string",
      "description": "Förinställt datumintervall (ignoreras om länken låser det)",
      "enum": [
        "today",
        "yesterday",
        "24h",
        "7d",
        "14d",
        "28d",
        "30d",
        "90d",
        "mtd",
        "last_month",
        "qtd",
        "last_quarter",
        "ytd",
        "12mo",
        "last_year",
        "all",
        "custom"
      ],
      "default": "30d"
    },
    "from": {
      "type": "string",
      "format": "date",
      "description": "Start för eget intervall"
    },
    "to": {
      "type": "string",
      "format": "date",
      "description": "Slut för eget intervall, inklusive"
    },
    "compare": {
      "type": "string",
      "description": "Jämförelseperiod",
      "enum": [
        "none",
        "previous_period",
        "previous_year",
        "custom"
      ],
      "default": "none"
    },
    "filters": {
      "type": "array",
      "items": {},
      "description": "Extra filter, om länken tillåter dem: [[\"dimension\",\"operator\",\"value\"], …]",
      "default": []
    },
    "interval": {
      "type": "string",
      "description": "Intervallstorlek för diagrammet",
      "enum": [
        "auto",
        "minute",
        "hour",
        "day",
        "week",
        "month",
        "quarter",
        "year"
      ],
      "default": "auto"
    },
    "token": {
      "type": "string",
      "description": "Token för resursen"
    }
  },
  "required": [
    "token"
  ]
}
Svarsdata
{
  "type": "object"
}

Dokumentation

GET /docs/api.json Lista alla API-operationer och MCP-verktyg docs_api

Behörighet: public

Exempel
curl https://privatusanalytics.com/docs/api.json
Indata
{
  "type": "object",
  "properties": {
    "page": {
      "type": "integer",
      "description": "Sida (från 1)"
    },
    "per_page": {
      "type": "integer",
      "description": "Resultat per sida (max 100)"
    }
  },
  "required": []
}
Svarsdata
{
  "type": "array",
  "items": {
    "type": "object",
    "properties": {
      "tool_name": {
        "type": "string",
        "description": "MCP-verktygsnamn och OpenAPI operationId"
      },
      "summary": {
        "type": "string"
      },
      "description": {
        "anyOf": [
          {
            "type": "string"
          },
          {
            "type": "null"
          }
        ]
      },
      "group": {
        "type": "string"
      },
      "verb": {
        "type": "string",
        "description": "HTTP-metod"
      },
      "path": {
        "type": "string",
        "description": "Sökvägsmall. Lägg till .json för JSON"
      },
      "permission": {
        "anyOf": [
          {
            "type": "string"
          },
          {
            "type": "null"
          }
        ]
      },
      "input_schema": {
        "type": "object",
        "description": "JSON Schema för indata"
      },
      "response_schema": {
        "type": "object",
        "description": "JSON Schema för `data`"
      }
    }
  }
}
GET /docs.json Lista dokumentationssidor docs_list

Behörighet: public

Exempel
curl https://privatusanalytics.com/docs.json
Indata
{
  "type": "object",
  "properties": {
    "page": {
      "type": "integer",
      "description": "Sida (från 1)"
    },
    "per_page": {
      "type": "integer",
      "description": "Resultat per sida (max 100)"
    }
  },
  "required": []
}
Svarsdata
{
  "type": "array",
  "items": {
    "type": "object",
    "properties": {
      "title": {
        "type": "string",
        "description": "Sidtitel"
      },
      "description": {
        "type": "string",
        "description": "Sammanfattning på en rad"
      },
      "path": {
        "type": "string",
        "description": "Sidans sökväg. Lägg till .md för Markdown eller .json för JSON"
      },
      "section": {
        "type": "string",
        "description": "Avsnittets slug, t.ex. tracker"
      }
    }
  }
}
GET /openapi.json OpenAPI 3.1-dokument för hela API:et docs_openapi

Behörighet: public

Exempel
curl https://privatusanalytics.com/openapi.json
Indata
{
  "type": "object",
  "properties": {},
  "required": []
}
Svarsdata
{
  "type": "object"
}
GET /docs/:section/:page.json Läs en dokumentationssida (Markdown och HTML) docs_get

section och page kommer från sidans sökväg /docs/<section>/<page>. Använd sidan "index" för en översikt av ett avsnitt.

Behörighet: public

Exempel
curl https://privatusanalytics.com/docs/:section/:page.json
Indata
{
  "type": "object",
  "properties": {
    "section": {
      "type": "string",
      "description": "Section för resursen"
    },
    "page": {
      "type": "string",
      "description": "Page för resursen"
    }
  },
  "required": [
    "section",
    "page"
  ]
}
Svarsdata
{
  "type": "object",
  "properties": {
    "title": {
      "type": "string",
      "description": "Sidtitel"
    },
    "description": {
      "type": "string",
      "description": "Sammanfattning på en rad"
    },
    "path": {
      "type": "string",
      "description": "Sidans sökväg. Lägg till .md för Markdown eller .json för JSON"
    },
    "section": {
      "type": "string",
      "description": "Avsnittets slug, t.ex. tracker"
    },
    "headings": {
      "type": "array",
      "items": {
        "type": "object"
      },
      "description": "Avsnitt på sidan (id och text)"
    },
    "full_markdown": {
      "type": "string",
      "description": "Sidan som Markdown (titeln ingår)"
    },
    "html": {
      "type": "string",
      "description": "Sidans innehåll renderat som HTML"
    }
  }
}

Drifttid

POST /sites/:site_id/uptime.json Lägg till en drifttidskontroll för en webbplats uptime_checks_create

Behörighet: uptime.manage

Exempel
curl -X POST https://privatusanalytics.com/sites/:site_id/uptime.json \
  -H "Authorization: Bearer $PRIVATUS_TOKEN" \
  -H "Content-Type: application/json" -d '{…}'
Indata
{
  "type": "object",
  "properties": {
    "name": {
      "type": "string",
      "description": "Visningsnamn (standard är målet)"
    },
    "kind": {
      "type": "string",
      "description": "http (statuskod), keyword (innehållet har), tcp (värd:port) eller dns (namnet slås upp)",
      "enum": [
        "http",
        "keyword",
        "tcp",
        "dns"
      ],
      "default": "http"
    },
    "url": {
      "type": "string",
      "description": "URL för http-/keyword-kontroller",
      "examples": [
        "https://example.com/health"
      ]
    },
    "host": {
      "type": "string",
      "description": "Värdnamn för tcp-/dns-kontroller"
    },
    "port": {
      "type": "integer",
      "description": "TCP-port för tcp-kontroller"
    },
    "keyword": {
      "type": "string",
      "description": "Text som svarets innehåll måste ha (keyword)"
    },
    "expected_status": {
      "type": "integer",
      "description": "Förväntad HTTP-statuskod",
      "default": 200
    },
    "http_method": {
      "type": "string",
      "description": "HTTP-metod",
      "enum": [
        "GET",
        "HEAD"
      ],
      "default": "GET"
    },
    "interval_seconds": {
      "type": "integer",
      "description": "Sekunder mellan kontroller (planens minimum gäller, standard 300 eller minimum)"
    },
    "timeout_seconds": {
      "type": "integer",
      "description": "Sekunder innan en prob får timeout (1-30)",
      "default": 20
    },
    "public": {
      "type": "boolean",
      "description": "Får visas på publika statussidor",
      "default": false
    },
    "site_id": {
      "type": "string",
      "description": "Webbplats-id, t.ex. pa_7Q2K9XH3AB"
    }
  },
  "required": [
    "site_id"
  ]
}
Svarsdata
{
  "type": "object",
  "properties": {
    "id": {
      "type": "string",
      "description": "Kontroll-id (upc_…)"
    },
    "workspace_id": {
      "type": "string"
    },
    "site_id": {
      "anyOf": [
        {
          "type": "string",
          "description": "Webbplats som kontrollen tillhör"
        },
        {
          "type": "null"
        }
      ]
    },
    "name": {
      "type": "string"
    },
    "kind": {
      "type": "string",
      "description": "http, keyword, tcp eller dns"
    },
    "url": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ]
    },
    "host": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ]
    },
    "port": {
      "anyOf": [
        {
          "type": "integer"
        },
        {
          "type": "null"
        }
      ]
    },
    "keyword": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ]
    },
    "expected_status": {
      "type": "integer"
    },
    "http_method": {
      "type": "string"
    },
    "interval_seconds": {
      "type": "integer"
    },
    "timeout_seconds": {
      "type": "integer"
    },
    "status": {
      "type": "string",
      "description": "up, down, pending eller paused"
    },
    "enabled": {
      "type": "boolean"
    },
    "public": {
      "type": "boolean",
      "description": "Får visas på statussidor"
    },
    "last_checked_at": {
      "anyOf": [
        {
          "type": "string",
          "format": "date-time"
        },
        {
          "type": "null"
        }
      ]
    },
    "next_check_at": {
      "anyOf": [
        {
          "type": "string",
          "format": "date-time"
        },
        {
          "type": "null"
        }
      ]
    },
    "last_response_ms": {
      "anyOf": [
        {
          "type": "integer"
        },
        {
          "type": "null"
        }
      ]
    },
    "ssl_expires_at": {
      "anyOf": [
        {
          "type": "string",
          "format": "date-time"
        },
        {
          "type": "null"
        }
      ]
    },
    "ssl_issuer": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ]
    },
    "domain_expires_at": {
      "anyOf": [
        {
          "type": "string",
          "format": "date-time"
        },
        {
          "type": "null"
        }
      ]
    },
    "created_at": {
      "type": "string",
      "format": "date-time"
    }
  }
}
DELETE /uptime/checks/:id.json Ta bort en drifttidskontroll och dess historik uptime_checks_delete

Behörighet: uptime.manage

Exempel
curl -X DELETE https://privatusanalytics.com/uptime/checks/:id.json \
  -H "Authorization: Bearer $PRIVATUS_TOKEN" \
  -H "Content-Type: application/json" -d '{…}'
Indata
{
  "type": "object",
  "properties": {
    "id": {
      "type": "string",
      "description": "Id för resursen"
    }
  },
  "required": [
    "id"
  ]
}
Svarsdata
{
  "type": "object",
  "properties": {
    "id": {
      "type": "string",
      "description": "Kontroll-id (upc_…)"
    },
    "workspace_id": {
      "type": "string"
    },
    "site_id": {
      "anyOf": [
        {
          "type": "string",
          "description": "Webbplats som kontrollen tillhör"
        },
        {
          "type": "null"
        }
      ]
    },
    "name": {
      "type": "string"
    },
    "kind": {
      "type": "string",
      "description": "http, keyword, tcp eller dns"
    },
    "url": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ]
    },
    "host": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ]
    },
    "port": {
      "anyOf": [
        {
          "type": "integer"
        },
        {
          "type": "null"
        }
      ]
    },
    "keyword": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ]
    },
    "expected_status": {
      "type": "integer"
    },
    "http_method": {
      "type": "string"
    },
    "interval_seconds": {
      "type": "integer"
    },
    "timeout_seconds": {
      "type": "integer"
    },
    "status": {
      "type": "string",
      "description": "up, down, pending eller paused"
    },
    "enabled": {
      "type": "boolean"
    },
    "public": {
      "type": "boolean",
      "description": "Får visas på statussidor"
    },
    "last_checked_at": {
      "anyOf": [
        {
          "type": "string",
          "format": "date-time"
        },
        {
          "type": "null"
        }
      ]
    },
    "next_check_at": {
      "anyOf": [
        {
          "type": "string",
          "format": "date-time"
        },
        {
          "type": "null"
        }
      ]
    },
    "last_response_ms": {
      "anyOf": [
        {
          "type": "integer"
        },
        {
          "type": "null"
        }
      ]
    },
    "ssl_expires_at": {
      "anyOf": [
        {
          "type": "string",
          "format": "date-time"
        },
        {
          "type": "null"
        }
      ]
    },
    "ssl_issuer": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ]
    },
    "domain_expires_at": {
      "anyOf": [
        {
          "type": "string",
          "format": "date-time"
        },
        {
          "type": "null"
        }
      ]
    },
    "created_at": {
      "type": "string",
      "format": "date-time"
    }
  }
}
GET /sites/:site_id/uptime.json Lista en webbplats drifttidskontroller uptime_checks_list

Behörighet: analytics.read

Exempel
curl https://privatusanalytics.com/sites/:site_id/uptime.json \
  -H "Authorization: Bearer $PRIVATUS_TOKEN"
Indata
{
  "type": "object",
  "properties": {
    "status": {
      "type": "string",
      "description": "Endast kontroller i det här tillståndet",
      "enum": [
        "up",
        "down",
        "pending",
        "paused"
      ]
    },
    "query": {
      "type": "string",
      "description": "Filtrera efter namn eller mål"
    },
    "site_id": {
      "type": "string",
      "description": "Webbplats-id, t.ex. pa_7Q2K9XH3AB"
    },
    "page": {
      "type": "integer",
      "description": "Sida (från 1)"
    },
    "per_page": {
      "type": "integer",
      "description": "Resultat per sida (max 100)"
    }
  },
  "required": [
    "site_id"
  ]
}
Svarsdata
{
  "type": "array",
  "items": {
    "type": "object",
    "properties": {
      "id": {
        "type": "string",
        "description": "Kontroll-id (upc_…)"
      },
      "workspace_id": {
        "type": "string"
      },
      "site_id": {
        "anyOf": [
          {
            "type": "string",
            "description": "Webbplats som kontrollen tillhör"
          },
          {
            "type": "null"
          }
        ]
      },
      "name": {
        "type": "string"
      },
      "kind": {
        "type": "string",
        "description": "http, keyword, tcp eller dns"
      },
      "url": {
        "anyOf": [
          {
            "type": "string"
          },
          {
            "type": "null"
          }
        ]
      },
      "host": {
        "anyOf": [
          {
            "type": "string"
          },
          {
            "type": "null"
          }
        ]
      },
      "port": {
        "anyOf": [
          {
            "type": "integer"
          },
          {
            "type": "null"
          }
        ]
      },
      "keyword": {
        "anyOf": [
          {
            "type": "string"
          },
          {
            "type": "null"
          }
        ]
      },
      "expected_status": {
        "type": "integer"
      },
      "http_method": {
        "type": "string"
      },
      "interval_seconds": {
        "type": "integer"
      },
      "timeout_seconds": {
        "type": "integer"
      },
      "status": {
        "type": "string",
        "description": "up, down, pending eller paused"
      },
      "enabled": {
        "type": "boolean"
      },
      "public": {
        "type": "boolean",
        "description": "Får visas på statussidor"
      },
      "last_checked_at": {
        "anyOf": [
          {
            "type": "string",
            "format": "date-time"
          },
          {
            "type": "null"
          }
        ]
      },
      "next_check_at": {
        "anyOf": [
          {
            "type": "string",
            "format": "date-time"
          },
          {
            "type": "null"
          }
        ]
      },
      "last_response_ms": {
        "anyOf": [
          {
            "type": "integer"
          },
          {
            "type": "null"
          }
        ]
      },
      "ssl_expires_at": {
        "anyOf": [
          {
            "type": "string",
            "format": "date-time"
          },
          {
            "type": "null"
          }
        ]
      },
      "ssl_issuer": {
        "anyOf": [
          {
            "type": "string"
          },
          {
            "type": "null"
          }
        ]
      },
      "domain_expires_at": {
        "anyOf": [
          {
            "type": "string",
            "format": "date-time"
          },
          {
            "type": "null"
          }
        ]
      },
      "created_at": {
        "type": "string",
        "format": "date-time"
      }
    }
  }
}
POST /uptime/checks/:id/pause.json Pausa en drifttidskontroll uptime_checks_pause

Behörighet: uptime.manage

Exempel
curl -X POST https://privatusanalytics.com/uptime/checks/:id/pause.json \
  -H "Authorization: Bearer $PRIVATUS_TOKEN" \
  -H "Content-Type: application/json" -d '{…}'
Indata
{
  "type": "object",
  "properties": {
    "id": {
      "type": "string",
      "description": "Id för resursen"
    }
  },
  "required": [
    "id"
  ]
}
Svarsdata
{
  "type": "object",
  "properties": {
    "id": {
      "type": "string",
      "description": "Kontroll-id (upc_…)"
    },
    "workspace_id": {
      "type": "string"
    },
    "site_id": {
      "anyOf": [
        {
          "type": "string",
          "description": "Webbplats som kontrollen tillhör"
        },
        {
          "type": "null"
        }
      ]
    },
    "name": {
      "type": "string"
    },
    "kind": {
      "type": "string",
      "description": "http, keyword, tcp eller dns"
    },
    "url": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ]
    },
    "host": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ]
    },
    "port": {
      "anyOf": [
        {
          "type": "integer"
        },
        {
          "type": "null"
        }
      ]
    },
    "keyword": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ]
    },
    "expected_status": {
      "type": "integer"
    },
    "http_method": {
      "type": "string"
    },
    "interval_seconds": {
      "type": "integer"
    },
    "timeout_seconds": {
      "type": "integer"
    },
    "status": {
      "type": "string",
      "description": "up, down, pending eller paused"
    },
    "enabled": {
      "type": "boolean"
    },
    "public": {
      "type": "boolean",
      "description": "Får visas på statussidor"
    },
    "last_checked_at": {
      "anyOf": [
        {
          "type": "string",
          "format": "date-time"
        },
        {
          "type": "null"
        }
      ]
    },
    "next_check_at": {
      "anyOf": [
        {
          "type": "string",
          "format": "date-time"
        },
        {
          "type": "null"
        }
      ]
    },
    "last_response_ms": {
      "anyOf": [
        {
          "type": "integer"
        },
        {
          "type": "null"
        }
      ]
    },
    "ssl_expires_at": {
      "anyOf": [
        {
          "type": "string",
          "format": "date-time"
        },
        {
          "type": "null"
        }
      ]
    },
    "ssl_issuer": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ]
    },
    "domain_expires_at": {
      "anyOf": [
        {
          "type": "string",
          "format": "date-time"
        },
        {
          "type": "null"
        }
      ]
    },
    "created_at": {
      "type": "string",
      "format": "date-time"
    }
  }
}
POST /uptime/checks/:id/resume.json Återuppta en pausad drifttidskontroll uptime_checks_resume

Behörighet: uptime.manage

Exempel
curl -X POST https://privatusanalytics.com/uptime/checks/:id/resume.json \
  -H "Authorization: Bearer $PRIVATUS_TOKEN" \
  -H "Content-Type: application/json" -d '{…}'
Indata
{
  "type": "object",
  "properties": {
    "id": {
      "type": "string",
      "description": "Id för resursen"
    }
  },
  "required": [
    "id"
  ]
}
Svarsdata
{
  "type": "object",
  "properties": {
    "id": {
      "type": "string",
      "description": "Kontroll-id (upc_…)"
    },
    "workspace_id": {
      "type": "string"
    },
    "site_id": {
      "anyOf": [
        {
          "type": "string",
          "description": "Webbplats som kontrollen tillhör"
        },
        {
          "type": "null"
        }
      ]
    },
    "name": {
      "type": "string"
    },
    "kind": {
      "type": "string",
      "description": "http, keyword, tcp eller dns"
    },
    "url": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ]
    },
    "host": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ]
    },
    "port": {
      "anyOf": [
        {
          "type": "integer"
        },
        {
          "type": "null"
        }
      ]
    },
    "keyword": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ]
    },
    "expected_status": {
      "type": "integer"
    },
    "http_method": {
      "type": "string"
    },
    "interval_seconds": {
      "type": "integer"
    },
    "timeout_seconds": {
      "type": "integer"
    },
    "status": {
      "type": "string",
      "description": "up, down, pending eller paused"
    },
    "enabled": {
      "type": "boolean"
    },
    "public": {
      "type": "boolean",
      "description": "Får visas på statussidor"
    },
    "last_checked_at": {
      "anyOf": [
        {
          "type": "string",
          "format": "date-time"
        },
        {
          "type": "null"
        }
      ]
    },
    "next_check_at": {
      "anyOf": [
        {
          "type": "string",
          "format": "date-time"
        },
        {
          "type": "null"
        }
      ]
    },
    "last_response_ms": {
      "anyOf": [
        {
          "type": "integer"
        },
        {
          "type": "null"
        }
      ]
    },
    "ssl_expires_at": {
      "anyOf": [
        {
          "type": "string",
          "format": "date-time"
        },
        {
          "type": "null"
        }
      ]
    },
    "ssl_issuer": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ]
    },
    "domain_expires_at": {
      "anyOf": [
        {
          "type": "string",
          "format": "date-time"
        },
        {
          "type": "null"
        }
      ]
    },
    "created_at": {
      "type": "string",
      "format": "date-time"
    }
  }
}
GET /uptime/checks/:id.json Hämta en drifttidskontroll: drifttid 24 h/7 d/30 d, svarstider och incidenter uptime_checks_get

Behörighet: analytics.read

Exempel
curl https://privatusanalytics.com/uptime/checks/:id.json \
  -H "Authorization: Bearer $PRIVATUS_TOKEN"
Indata
{
  "type": "object",
  "properties": {
    "range": {
      "type": "string",
      "description": "Fönster för diagrammet över svarstider",
      "enum": [
        "24h",
        "7d",
        "30d"
      ],
      "default": "24h"
    },
    "id": {
      "type": "string",
      "description": "Id för resursen"
    }
  },
  "required": [
    "id"
  ]
}
Svarsdata
{
  "type": "object",
  "properties": {
    "check": {
      "type": "object",
      "properties": {
        "id": {
          "type": "string",
          "description": "Kontroll-id (upc_…)"
        },
        "workspace_id": {
          "type": "string"
        },
        "site_id": {
          "anyOf": [
            {
              "type": "string",
              "description": "Webbplats som kontrollen tillhör"
            },
            {
              "type": "null"
            }
          ]
        },
        "name": {
          "type": "string"
        },
        "kind": {
          "type": "string",
          "description": "http, keyword, tcp eller dns"
        },
        "url": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ]
        },
        "host": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ]
        },
        "port": {
          "anyOf": [
            {
              "type": "integer"
            },
            {
              "type": "null"
            }
          ]
        },
        "keyword": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ]
        },
        "expected_status": {
          "type": "integer"
        },
        "http_method": {
          "type": "string"
        },
        "interval_seconds": {
          "type": "integer"
        },
        "timeout_seconds": {
          "type": "integer"
        },
        "status": {
          "type": "string",
          "description": "up, down, pending eller paused"
        },
        "enabled": {
          "type": "boolean"
        },
        "public": {
          "type": "boolean",
          "description": "Får visas på statussidor"
        },
        "last_checked_at": {
          "anyOf": [
            {
              "type": "string",
              "format": "date-time"
            },
            {
              "type": "null"
            }
          ]
        },
        "next_check_at": {
          "anyOf": [
            {
              "type": "string",
              "format": "date-time"
            },
            {
              "type": "null"
            }
          ]
        },
        "last_response_ms": {
          "anyOf": [
            {
              "type": "integer"
            },
            {
              "type": "null"
            }
          ]
        },
        "ssl_expires_at": {
          "anyOf": [
            {
              "type": "string",
              "format": "date-time"
            },
            {
              "type": "null"
            }
          ]
        },
        "ssl_issuer": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ]
        },
        "domain_expires_at": {
          "anyOf": [
            {
              "type": "string",
              "format": "date-time"
            },
            {
              "type": "null"
            }
          ]
        },
        "created_at": {
          "type": "string",
          "format": "date-time"
        }
      }
    },
    "uptime": {
      "type": "object",
      "description": "Drifttid i % för 24 h, 7 d och 30 d"
    },
    "range": {
      "type": "string",
      "description": "Fönster för response_times"
    },
    "response_times": {
      "type": "object",
      "description": "Genomsnittlig svarstid i ms per intervall: {unit, labels, series: {location: [ms…]}}"
    },
    "incidents": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "started_at": {
            "type": "string",
            "format": "date-time"
          },
          "resolved_at": {
            "anyOf": [
              {
                "type": "string",
                "format": "date-time"
              },
              {
                "type": "null"
              }
            ]
          },
          "duration_seconds": {
            "type": "integer",
            "description": "Hittills, om den fortfarande är öppen"
          },
          "cause": {
            "anyOf": [
              {
                "type": "string",
                "description": "Vanligaste felet, t.ex. timeout eller status_503"
              },
              {
                "type": "null"
              }
            ]
          },
          "failed_locations": {
            "type": "array",
            "items": {
              "type": "string"
            }
          }
        }
      }
    }
  }
}
PATCH /uptime/checks/:id.json Ändra en drifttidskontroll uptime_checks_update

Behörighet: uptime.manage

Exempel
curl -X PATCH https://privatusanalytics.com/uptime/checks/:id.json \
  -H "Authorization: Bearer $PRIVATUS_TOKEN" \
  -H "Content-Type: application/json" -d '{…}'
Indata
{
  "type": "object",
  "properties": {
    "name": {
      "type": "string",
      "description": "Visningsnamn (standard är målet)"
    },
    "kind": {
      "type": "string",
      "description": "http (statuskod), keyword (innehållet har), tcp (värd:port) eller dns (namnet slås upp)",
      "enum": [
        "http",
        "keyword",
        "tcp",
        "dns"
      ]
    },
    "url": {
      "type": "string",
      "description": "URL för http-/keyword-kontroller",
      "examples": [
        "https://example.com/health"
      ]
    },
    "host": {
      "type": "string",
      "description": "Värdnamn för tcp-/dns-kontroller"
    },
    "port": {
      "type": "integer",
      "description": "TCP-port för tcp-kontroller"
    },
    "keyword": {
      "type": "string",
      "description": "Text som svarets innehåll måste ha (keyword)"
    },
    "expected_status": {
      "type": "integer",
      "description": "Förväntad HTTP-statuskod"
    },
    "http_method": {
      "type": "string",
      "description": "HTTP-metod",
      "enum": [
        "GET",
        "HEAD"
      ]
    },
    "interval_seconds": {
      "type": "integer",
      "description": "Sekunder mellan kontroller (planens minimum gäller, standard 300 eller minimum)"
    },
    "timeout_seconds": {
      "type": "integer",
      "description": "Sekunder innan en prob får timeout (1-30)"
    },
    "public": {
      "type": "boolean",
      "description": "Får visas på publika statussidor"
    },
    "id": {
      "type": "string",
      "description": "Id för resursen"
    }
  },
  "required": [
    "id"
  ]
}
Svarsdata
{
  "type": "object",
  "properties": {
    "id": {
      "type": "string",
      "description": "Kontroll-id (upc_…)"
    },
    "workspace_id": {
      "type": "string"
    },
    "site_id": {
      "anyOf": [
        {
          "type": "string",
          "description": "Webbplats som kontrollen tillhör"
        },
        {
          "type": "null"
        }
      ]
    },
    "name": {
      "type": "string"
    },
    "kind": {
      "type": "string",
      "description": "http, keyword, tcp eller dns"
    },
    "url": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ]
    },
    "host": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ]
    },
    "port": {
      "anyOf": [
        {
          "type": "integer"
        },
        {
          "type": "null"
        }
      ]
    },
    "keyword": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ]
    },
    "expected_status": {
      "type": "integer"
    },
    "http_method": {
      "type": "string"
    },
    "interval_seconds": {
      "type": "integer"
    },
    "timeout_seconds": {
      "type": "integer"
    },
    "status": {
      "type": "string",
      "description": "up, down, pending eller paused"
    },
    "enabled": {
      "type": "boolean"
    },
    "public": {
      "type": "boolean",
      "description": "Får visas på statussidor"
    },
    "last_checked_at": {
      "anyOf": [
        {
          "type": "string",
          "format": "date-time"
        },
        {
          "type": "null"
        }
      ]
    },
    "next_check_at": {
      "anyOf": [
        {
          "type": "string",
          "format": "date-time"
        },
        {
          "type": "null"
        }
      ]
    },
    "last_response_ms": {
      "anyOf": [
        {
          "type": "integer"
        },
        {
          "type": "null"
        }
      ]
    },
    "ssl_expires_at": {
      "anyOf": [
        {
          "type": "string",
          "format": "date-time"
        },
        {
          "type": "null"
        }
      ]
    },
    "ssl_issuer": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ]
    },
    "domain_expires_at": {
      "anyOf": [
        {
          "type": "string",
          "format": "date-time"
        },
        {
          "type": "null"
        }
      ]
    },
    "created_at": {
      "type": "string",
      "format": "date-time"
    }
  }
}
GET /uptime/probes.json Probens datacenter, User-Agent och IP-intervall för utgående trafik (för att tillåtlista våra drifttidsprober) uptime_probes_list

Behörighet: public · Endast HTTP (inte ett MCP-verktyg)

Exempel
curl https://privatusanalytics.com/uptime/probes.json
Indata
{
  "type": "object",
  "properties": {},
  "required": []
}
Svarsdata
{
  "type": "object"
}
POST /uptime/probes/results.json Skicka in resultat från en extern probe-agent (Bearer-token för uptime probe) uptime_probes_results

Behörighet: public · Endast HTTP (inte ett MCP-verktyg)

Exempel
curl -X POST https://privatusanalytics.com/uptime/probes/results.json \
  -H "Content-Type: application/json" -d '{…}'
Indata
{
  "type": "object",
  "properties": {
    "results": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "check_id": {
            "type": "string"
          },
          "location": {
            "type": "string"
          },
          "ok": {
            "type": "boolean"
          },
          "status_code": {
            "type": "integer"
          },
          "response_ms": {
            "type": "integer"
          },
          "error": {
            "type": "string"
          },
          "checked_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "description": "Probresultat: [{check_id, location, ok, status_code, response_ms, error, checked_at}]"
    }
  },
  "required": [
    "results"
  ]
}
Svarsdata
{
  "type": "object"
}
POST /workspaces/:workspace_id/uptime.json Lägg till en drifttidskontroll för arbetsytan (inte kopplad till en webbplats) workspace_uptime_checks_create

Behörighet: uptime.manage

Exempel
curl -X POST https://privatusanalytics.com/workspaces/:workspace_id/uptime.json \
  -H "Authorization: Bearer $PRIVATUS_TOKEN" \
  -H "Content-Type: application/json" -d '{…}'
Indata
{
  "type": "object",
  "properties": {
    "name": {
      "type": "string",
      "description": "Visningsnamn (standard är målet)"
    },
    "kind": {
      "type": "string",
      "description": "http (statuskod), keyword (innehållet har), tcp (värd:port) eller dns (namnet slås upp)",
      "enum": [
        "http",
        "keyword",
        "tcp",
        "dns"
      ],
      "default": "http"
    },
    "url": {
      "type": "string",
      "description": "URL för http-/keyword-kontroller",
      "examples": [
        "https://example.com/health"
      ]
    },
    "host": {
      "type": "string",
      "description": "Värdnamn för tcp-/dns-kontroller"
    },
    "port": {
      "type": "integer",
      "description": "TCP-port för tcp-kontroller"
    },
    "keyword": {
      "type": "string",
      "description": "Text som svarets innehåll måste ha (keyword)"
    },
    "expected_status": {
      "type": "integer",
      "description": "Förväntad HTTP-statuskod",
      "default": 200
    },
    "http_method": {
      "type": "string",
      "description": "HTTP-metod",
      "enum": [
        "GET",
        "HEAD"
      ],
      "default": "GET"
    },
    "interval_seconds": {
      "type": "integer",
      "description": "Sekunder mellan kontroller (planens minimum gäller, standard 300 eller minimum)"
    },
    "timeout_seconds": {
      "type": "integer",
      "description": "Sekunder innan en prob får timeout (1-30)",
      "default": 20
    },
    "public": {
      "type": "boolean",
      "description": "Får visas på publika statussidor",
      "default": false
    },
    "workspace_id": {
      "type": "string",
      "description": "Arbetsyte-id, t.ex. ws_7Q2K9XH3AB"
    }
  },
  "required": [
    "workspace_id"
  ]
}
Svarsdata
{
  "type": "object",
  "properties": {
    "id": {
      "type": "string",
      "description": "Kontroll-id (upc_…)"
    },
    "workspace_id": {
      "type": "string"
    },
    "site_id": {
      "anyOf": [
        {
          "type": "string",
          "description": "Webbplats som kontrollen tillhör"
        },
        {
          "type": "null"
        }
      ]
    },
    "name": {
      "type": "string"
    },
    "kind": {
      "type": "string",
      "description": "http, keyword, tcp eller dns"
    },
    "url": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ]
    },
    "host": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ]
    },
    "port": {
      "anyOf": [
        {
          "type": "integer"
        },
        {
          "type": "null"
        }
      ]
    },
    "keyword": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ]
    },
    "expected_status": {
      "type": "integer"
    },
    "http_method": {
      "type": "string"
    },
    "interval_seconds": {
      "type": "integer"
    },
    "timeout_seconds": {
      "type": "integer"
    },
    "status": {
      "type": "string",
      "description": "up, down, pending eller paused"
    },
    "enabled": {
      "type": "boolean"
    },
    "public": {
      "type": "boolean",
      "description": "Får visas på statussidor"
    },
    "last_checked_at": {
      "anyOf": [
        {
          "type": "string",
          "format": "date-time"
        },
        {
          "type": "null"
        }
      ]
    },
    "next_check_at": {
      "anyOf": [
        {
          "type": "string",
          "format": "date-time"
        },
        {
          "type": "null"
        }
      ]
    },
    "last_response_ms": {
      "anyOf": [
        {
          "type": "integer"
        },
        {
          "type": "null"
        }
      ]
    },
    "ssl_expires_at": {
      "anyOf": [
        {
          "type": "string",
          "format": "date-time"
        },
        {
          "type": "null"
        }
      ]
    },
    "ssl_issuer": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ]
    },
    "domain_expires_at": {
      "anyOf": [
        {
          "type": "string",
          "format": "date-time"
        },
        {
          "type": "null"
        }
      ]
    },
    "created_at": {
      "type": "string",
      "format": "date-time"
    }
  }
}
GET /workspaces/:workspace_id/uptime.json Lista alla drifttidskontroller i en arbetsyta workspace_uptime_checks_list

Behörighet: analytics.read

Exempel
curl https://privatusanalytics.com/workspaces/:workspace_id/uptime.json \
  -H "Authorization: Bearer $PRIVATUS_TOKEN"
Indata
{
  "type": "object",
  "properties": {
    "status": {
      "type": "string",
      "description": "Endast kontroller i det här tillståndet",
      "enum": [
        "up",
        "down",
        "pending",
        "paused"
      ]
    },
    "query": {
      "type": "string",
      "description": "Filtrera efter namn eller mål"
    },
    "workspace_id": {
      "type": "string",
      "description": "Arbetsyte-id, t.ex. ws_7Q2K9XH3AB"
    },
    "page": {
      "type": "integer",
      "description": "Sida (från 1)"
    },
    "per_page": {
      "type": "integer",
      "description": "Resultat per sida (max 100)"
    }
  },
  "required": [
    "workspace_id"
  ]
}
Svarsdata
{
  "type": "array",
  "items": {
    "type": "object",
    "properties": {
      "id": {
        "type": "string",
        "description": "Kontroll-id (upc_…)"
      },
      "workspace_id": {
        "type": "string"
      },
      "site_id": {
        "anyOf": [
          {
            "type": "string",
            "description": "Webbplats som kontrollen tillhör"
          },
          {
            "type": "null"
          }
        ]
      },
      "name": {
        "type": "string"
      },
      "kind": {
        "type": "string",
        "description": "http, keyword, tcp eller dns"
      },
      "url": {
        "anyOf": [
          {
            "type": "string"
          },
          {
            "type": "null"
          }
        ]
      },
      "host": {
        "anyOf": [
          {
            "type": "string"
          },
          {
            "type": "null"
          }
        ]
      },
      "port": {
        "anyOf": [
          {
            "type": "integer"
          },
          {
            "type": "null"
          }
        ]
      },
      "keyword": {
        "anyOf": [
          {
            "type": "string"
          },
          {
            "type": "null"
          }
        ]
      },
      "expected_status": {
        "type": "integer"
      },
      "http_method": {
        "type": "string"
      },
      "interval_seconds": {
        "type": "integer"
      },
      "timeout_seconds": {
        "type": "integer"
      },
      "status": {
        "type": "string",
        "description": "up, down, pending eller paused"
      },
      "enabled": {
        "type": "boolean"
      },
      "public": {
        "type": "boolean",
        "description": "Får visas på statussidor"
      },
      "last_checked_at": {
        "anyOf": [
          {
            "type": "string",
            "format": "date-time"
          },
          {
            "type": "null"
          }
        ]
      },
      "next_check_at": {
        "anyOf": [
          {
            "type": "string",
            "format": "date-time"
          },
          {
            "type": "null"
          }
        ]
      },
      "last_response_ms": {
        "anyOf": [
          {
            "type": "integer"
          },
          {
            "type": "null"
          }
        ]
      },
      "ssl_expires_at": {
        "anyOf": [
          {
            "type": "string",
            "format": "date-time"
          },
          {
            "type": "null"
          }
        ]
      },
      "ssl_issuer": {
        "anyOf": [
          {
            "type": "string"
          },
          {
            "type": "null"
          }
        ]
      },
      "domain_expires_at": {
        "anyOf": [
          {
            "type": "string",
            "format": "date-time"
          },
          {
            "type": "null"
          }
        ]
      },
      "created_at": {
        "type": "string",
        "format": "date-time"
      }
    }
  }
}

E-postrapporter

DELETE /recipients/:id.json Ta bort en mottagare från en e-postrapport email_report_recipients_delete

Behörighet: content.write

Exempel
curl -X DELETE https://privatusanalytics.com/recipients/:id.json \
  -H "Authorization: Bearer $PRIVATUS_TOKEN" \
  -H "Content-Type: application/json" -d '{…}'
Indata
{
  "type": "object",
  "properties": {
    "id": {
      "type": "string",
      "description": "Id för resursen"
    }
  },
  "required": [
    "id"
  ]
}
Svarsdata
{
  "type": "object",
  "properties": {
    "id": {
      "type": "string",
      "description": "Mottagar-id, t.ex. rcp_7Q2K9XH3AB"
    },
    "email": {
      "type": "string",
      "description": "Adressen"
    },
    "status": {
      "type": "string",
      "description": "active, pending, declined eller unsubscribed"
    },
    "invited_at": {
      "anyOf": [
        {
          "type": "string",
          "format": "date-time",
          "description": "När den senaste inbjudan skickades"
        },
        {
          "type": "null"
        }
      ]
    },
    "expires_at": {
      "anyOf": [
        {
          "type": "string",
          "format": "date-time",
          "description": "När en väntande inbjudan går ut"
        },
        {
          "type": "null"
        }
      ]
    },
    "confirmed_at": {
      "anyOf": [
        {
          "type": "string",
          "format": "date-time",
          "description": "När adressen blev aktiv"
        },
        {
          "type": "null"
        }
      ]
    }
  }
}
GET /reports/:report_id/recipients.json Lista mottagarna av en e-postrapport med deras status email_report_recipients_list

Statusar: active (får rapporter), pending (inbjuden, har inte accepterat ännu), declined eller unsubscribed. Lägg till eller ta bort adresser via rapportens mottagarlista.

Behörighet: analytics.read

Exempel
curl https://privatusanalytics.com/reports/:report_id/recipients.json \
  -H "Authorization: Bearer $PRIVATUS_TOKEN"
Indata
{
  "type": "object",
  "properties": {
    "status": {
      "type": "string",
      "description": "Endast mottagare med den här statusen",
      "enum": [
        "pending",
        "active",
        "declined",
        "unsubscribed"
      ]
    },
    "report_id": {
      "type": "string",
      "description": "Report för resursen"
    },
    "page": {
      "type": "integer",
      "description": "Sida (från 1)"
    },
    "per_page": {
      "type": "integer",
      "description": "Resultat per sida (max 100)"
    }
  },
  "required": [
    "report_id"
  ]
}
Svarsdata
{
  "type": "array",
  "items": {
    "type": "object",
    "properties": {
      "id": {
        "type": "string",
        "description": "Mottagar-id, t.ex. rcp_7Q2K9XH3AB"
      },
      "email": {
        "type": "string",
        "description": "Adressen"
      },
      "status": {
        "type": "string",
        "description": "active, pending, declined eller unsubscribed"
      },
      "invited_at": {
        "anyOf": [
          {
            "type": "string",
            "format": "date-time",
            "description": "När den senaste inbjudan skickades"
          },
          {
            "type": "null"
          }
        ]
      },
      "expires_at": {
        "anyOf": [
          {
            "type": "string",
            "format": "date-time",
            "description": "När en väntande inbjudan går ut"
          },
          {
            "type": "null"
          }
        ]
      },
      "confirmed_at": {
        "anyOf": [
          {
            "type": "string",
            "format": "date-time",
            "description": "När adressen blev aktiv"
          },
          {
            "type": "null"
          }
        ]
      }
    }
  }
}
POST /recipients/:id/resend.json Skicka en väntande rapportinbjudan igen email_report_recipients_resend

Skickar inbjudan igen med nya länkar. Tillåts en gång var 7:e dag per adress och rapport.

Behörighet: content.write

Exempel
curl -X POST https://privatusanalytics.com/recipients/:id/resend.json \
  -H "Authorization: Bearer $PRIVATUS_TOKEN" \
  -H "Content-Type: application/json" -d '{…}'
Indata
{
  "type": "object",
  "properties": {
    "id": {
      "type": "string",
      "description": "Id för resursen"
    }
  },
  "required": [
    "id"
  ]
}
Svarsdata
{
  "type": "object",
  "properties": {
    "id": {
      "type": "string",
      "description": "Mottagar-id, t.ex. rcp_7Q2K9XH3AB"
    },
    "email": {
      "type": "string",
      "description": "Adressen"
    },
    "status": {
      "type": "string",
      "description": "active, pending, declined eller unsubscribed"
    },
    "invited_at": {
      "anyOf": [
        {
          "type": "string",
          "format": "date-time",
          "description": "När den senaste inbjudan skickades"
        },
        {
          "type": "null"
        }
      ]
    },
    "expires_at": {
      "anyOf": [
        {
          "type": "string",
          "format": "date-time",
          "description": "När en väntande inbjudan går ut"
        },
        {
          "type": "null"
        }
      ]
    },
    "confirmed_at": {
      "anyOf": [
        {
          "type": "string",
          "format": "date-time",
          "description": "När adressen blev aktiv"
        },
        {
          "type": "null"
        }
      ]
    }
  }
}
POST /workspaces/:workspace_id/reports.json Skapa en e-postrapport email_reports_create

Behörighet: content.write

Exempel
curl -X POST https://privatusanalytics.com/workspaces/:workspace_id/reports.json \
  -H "Authorization: Bearer $PRIVATUS_TOKEN" \
  -H "Content-Type: application/json" -d '{…}'
Indata
{
  "type": "object",
  "properties": {
    "site_ids": {
      "type": "array",
      "items": {
        "type": "string"
      },
      "description": "Webbplats-id (pa_…) som ingår i rapporten"
    },
    "frequency": {
      "type": "string",
      "description": "daily, weekly (på veckodag) eller monthly (den 1:a)",
      "enum": [
        "daily",
        "weekly",
        "monthly"
      ]
    },
    "hour": {
      "type": "integer",
      "description": "Timme på dagen att skicka (0 till 23, arbetsytans tidszon)"
    },
    "weekday": {
      "type": "integer",
      "description": "Veckorapporter: 0 = söndag … 6 = lördag"
    },
    "recipients": {
      "type": "array",
      "items": {
        "type": "string"
      },
      "description": "E-postadresser (inget konto behövs). Posterna kan skiljas åt med kommatecken eller radbrytning. Medlemmar i arbetsytan läggs till direkt. Alla andra får en inbjudan och får rapporter först när de har accepterat den. Adresser som har avböjt rapporter nekas"
    },
    "blocks": {
      "type": "array",
      "items": {
        "type": "string"
      },
      "description": "Innehåll: kpis, chart, pages, sources, goals, campaigns, vitals, uptime"
    },
    "attach_pdf": {
      "type": "boolean",
      "description": "Bifoga en PDF-version"
    },
    "intro": {
      "type": "string",
      "description": "Egen introduktionstext (max 2000 tecken)"
    },
    "enabled": {
      "type": "boolean",
      "description": "Skicka enligt schema"
    },
    "name": {
      "type": "string",
      "description": "Rapportens namn",
      "examples": [
        "Weekly traffic"
      ]
    },
    "workspace_id": {
      "type": "string",
      "description": "Arbetsyte-id, t.ex. ws_7Q2K9XH3AB"
    }
  },
  "required": [
    "name",
    "workspace_id"
  ]
}
Svarsdata
{
  "type": "object",
  "properties": {
    "id": {
      "type": "string",
      "description": "Rapport-id, t.ex. rep_7Q2K9XH3AB"
    },
    "name": {
      "type": "string"
    },
    "site_ids": {
      "type": "array",
      "items": {
        "type": "string"
      },
      "description": "Webbplats-id i rapporten"
    },
    "frequency": {
      "type": "string",
      "description": "daily, weekly eller monthly"
    },
    "hour": {
      "type": "integer",
      "description": "Sändningstimme (arbetsytans tidszon)"
    },
    "weekday": {
      "type": "integer",
      "description": "Veckovis: 0 = söndag … 6 = lördag"
    },
    "recipients": {
      "type": "array",
      "items": {
        "type": "string"
      },
      "description": "Varje adress på rapporten, oavsett status"
    },
    "recipient_details": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "description": "Mottagar-id, t.ex. rcp_7Q2K9XH3AB"
          },
          "email": {
            "type": "string",
            "description": "Adressen"
          },
          "status": {
            "type": "string",
            "description": "active, pending, declined eller unsubscribed"
          },
          "invited_at": {
            "anyOf": [
              {
                "type": "string",
                "format": "date-time",
                "description": "När den senaste inbjudan skickades"
              },
              {
                "type": "null"
              }
            ]
          },
          "expires_at": {
            "anyOf": [
              {
                "type": "string",
                "format": "date-time",
                "description": "När en väntande inbjudan går ut"
              },
              {
                "type": "null"
              }
            ]
          },
          "confirmed_at": {
            "anyOf": [
              {
                "type": "string",
                "format": "date-time",
                "description": "När adressen blev aktiv"
              },
              {
                "type": "null"
              }
            ]
          }
        }
      },
      "description": "Varje mottagare med sin opt-in-status (endast aktiva mottagare får rapporter)"
    },
    "blocks": {
      "type": "array",
      "items": {
        "type": "string"
      },
      "description": "Innehållsblock"
    },
    "attach_pdf": {
      "type": "boolean"
    },
    "intro": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ]
    },
    "enabled": {
      "type": "boolean"
    },
    "last_sent_at": {
      "anyOf": [
        {
          "type": "string",
          "format": "date-time"
        },
        {
          "type": "null"
        }
      ]
    },
    "next_run_at": {
      "anyOf": [
        {
          "type": "string",
          "format": "date-time"
        },
        {
          "type": "null"
        }
      ]
    },
    "created_at": {
      "type": "string",
      "format": "date-time"
    }
  }
}
GET /reports/:id/deliveries.json Leveranslogg för en e-postrapport email_reports_deliveries

Behörighet: analytics.read

Exempel
curl https://privatusanalytics.com/reports/:id/deliveries.json \
  -H "Authorization: Bearer $PRIVATUS_TOKEN"
Indata
{
  "type": "object",
  "properties": {
    "status": {
      "type": "string",
      "description": "Endast leveranser med den här statusen",
      "enum": [
        "sent",
        "test",
        "failed",
        "skipped"
      ]
    },
    "id": {
      "type": "string",
      "description": "Id för resursen"
    },
    "page": {
      "type": "integer",
      "description": "Sida (från 1)"
    },
    "per_page": {
      "type": "integer",
      "description": "Resultat per sida (max 100)"
    }
  },
  "required": [
    "id"
  ]
}
Svarsdata
{
  "type": "array",
  "items": {
    "type": "object",
    "properties": {
      "status": {
        "type": "string",
        "description": "sent, test, failed eller skipped"
      },
      "recipients_count": {
        "type": "integer"
      },
      "error": {
        "anyOf": [
          {
            "type": "string"
          },
          {
            "type": "null"
          }
        ]
      },
      "sent_at": {
        "type": "string",
        "format": "date-time"
      }
    }
  }
}
DELETE /reports/:id.json Ta bort en e-postrapport email_reports_delete

Behörighet: content.write

Exempel
curl -X DELETE https://privatusanalytics.com/reports/:id.json \
  -H "Authorization: Bearer $PRIVATUS_TOKEN" \
  -H "Content-Type: application/json" -d '{…}'
Indata
{
  "type": "object",
  "properties": {
    "id": {
      "type": "string",
      "description": "Id för resursen"
    }
  },
  "required": [
    "id"
  ]
}
Svarsdata
{
  "type": "object",
  "properties": {
    "id": {
      "type": "string",
      "description": "Rapport-id, t.ex. rep_7Q2K9XH3AB"
    },
    "name": {
      "type": "string"
    },
    "site_ids": {
      "type": "array",
      "items": {
        "type": "string"
      },
      "description": "Webbplats-id i rapporten"
    },
    "frequency": {
      "type": "string",
      "description": "daily, weekly eller monthly"
    },
    "hour": {
      "type": "integer",
      "description": "Sändningstimme (arbetsytans tidszon)"
    },
    "weekday": {
      "type": "integer",
      "description": "Veckovis: 0 = söndag … 6 = lördag"
    },
    "recipients": {
      "type": "array",
      "items": {
        "type": "string"
      },
      "description": "Varje adress på rapporten, oavsett status"
    },
    "recipient_details": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "description": "Mottagar-id, t.ex. rcp_7Q2K9XH3AB"
          },
          "email": {
            "type": "string",
            "description": "Adressen"
          },
          "status": {
            "type": "string",
            "description": "active, pending, declined eller unsubscribed"
          },
          "invited_at": {
            "anyOf": [
              {
                "type": "string",
                "format": "date-time",
                "description": "När den senaste inbjudan skickades"
              },
              {
                "type": "null"
              }
            ]
          },
          "expires_at": {
            "anyOf": [
              {
                "type": "string",
                "format": "date-time",
                "description": "När en väntande inbjudan går ut"
              },
              {
                "type": "null"
              }
            ]
          },
          "confirmed_at": {
            "anyOf": [
              {
                "type": "string",
                "format": "date-time",
                "description": "När adressen blev aktiv"
              },
              {
                "type": "null"
              }
            ]
          }
        }
      },
      "description": "Varje mottagare med sin opt-in-status (endast aktiva mottagare får rapporter)"
    },
    "blocks": {
      "type": "array",
      "items": {
        "type": "string"
      },
      "description": "Innehållsblock"
    },
    "attach_pdf": {
      "type": "boolean"
    },
    "intro": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ]
    },
    "enabled": {
      "type": "boolean"
    },
    "last_sent_at": {
      "anyOf": [
        {
          "type": "string",
          "format": "date-time"
        },
        {
          "type": "null"
        }
      ]
    },
    "next_run_at": {
      "anyOf": [
        {
          "type": "string",
          "format": "date-time"
        },
        {
          "type": "null"
        }
      ]
    },
    "created_at": {
      "type": "string",
      "format": "date-time"
    }
  }
}
GET /workspaces/:workspace_id/reports.json Lista e-postrapporter email_reports_list

Behörighet: analytics.read

Exempel
curl https://privatusanalytics.com/workspaces/:workspace_id/reports.json \
  -H "Authorization: Bearer $PRIVATUS_TOKEN"
Indata
{
  "type": "object",
  "properties": {
    "frequency": {
      "type": "string",
      "description": "Endast rapporter med den här frekvensen",
      "enum": [
        "daily",
        "weekly",
        "monthly"
      ]
    },
    "workspace_id": {
      "type": "string",
      "description": "Arbetsyte-id, t.ex. ws_7Q2K9XH3AB"
    },
    "page": {
      "type": "integer",
      "description": "Sida (från 1)"
    },
    "per_page": {
      "type": "integer",
      "description": "Resultat per sida (max 100)"
    }
  },
  "required": [
    "workspace_id"
  ]
}
Svarsdata
{
  "type": "array",
  "items": {
    "type": "object",
    "properties": {
      "id": {
        "type": "string",
        "description": "Rapport-id, t.ex. rep_7Q2K9XH3AB"
      },
      "name": {
        "type": "string"
      },
      "site_ids": {
        "type": "array",
        "items": {
          "type": "string"
        },
        "description": "Webbplats-id i rapporten"
      },
      "frequency": {
        "type": "string",
        "description": "daily, weekly eller monthly"
      },
      "hour": {
        "type": "integer",
        "description": "Sändningstimme (arbetsytans tidszon)"
      },
      "weekday": {
        "type": "integer",
        "description": "Veckovis: 0 = söndag … 6 = lördag"
      },
      "recipients": {
        "type": "array",
        "items": {
          "type": "string"
        },
        "description": "Varje adress på rapporten, oavsett status"
      },
      "recipient_details": {
        "type": "array",
        "items": {
          "type": "object",
          "properties": {
            "id": {
              "type": "string",
              "description": "Mottagar-id, t.ex. rcp_7Q2K9XH3AB"
            },
            "email": {
              "type": "string",
              "description": "Adressen"
            },
            "status": {
              "type": "string",
              "description": "active, pending, declined eller unsubscribed"
            },
            "invited_at": {
              "anyOf": [
                {
                  "type": "string",
                  "format": "date-time",
                  "description": "När den senaste inbjudan skickades"
                },
                {
                  "type": "null"
                }
              ]
            },
            "expires_at": {
              "anyOf": [
                {
                  "type": "string",
                  "format": "date-time",
                  "description": "När en väntande inbjudan går ut"
                },
                {
                  "type": "null"
                }
              ]
            },
            "confirmed_at": {
              "anyOf": [
                {
                  "type": "string",
                  "format": "date-time",
                  "description": "När adressen blev aktiv"
                },
                {
                  "type": "null"
                }
              ]
            }
          }
        },
        "description": "Varje mottagare med sin opt-in-status (endast aktiva mottagare får rapporter)"
      },
      "blocks": {
        "type": "array",
        "items": {
          "type": "string"
        },
        "description": "Innehållsblock"
      },
      "attach_pdf": {
        "type": "boolean"
      },
      "intro": {
        "anyOf": [
          {
            "type": "string"
          },
          {
            "type": "null"
          }
        ]
      },
      "enabled": {
        "type": "boolean"
      },
      "last_sent_at": {
        "anyOf": [
          {
            "type": "string",
            "format": "date-time"
          },
          {
            "type": "null"
          }
        ]
      },
      "next_run_at": {
        "anyOf": [
          {
            "type": "string",
            "format": "date-time"
          },
          {
            "type": "null"
          }
        ]
      },
      "created_at": {
        "type": "string",
        "format": "date-time"
      }
    }
  }
}
POST /reports/:id/send_test.json Skicka en e-postrapport nu som ett test email_reports_send_test

Behörighet: content.write

Exempel
curl -X POST https://privatusanalytics.com/reports/:id/send_test.json \
  -H "Authorization: Bearer $PRIVATUS_TOKEN" \
  -H "Content-Type: application/json" -d '{…}'
Indata
{
  "type": "object",
  "properties": {
    "recipient": {
      "type": "string",
      "description": "Skicka testet hit (standard: din e-post)"
    },
    "id": {
      "type": "string",
      "description": "Id för resursen"
    }
  },
  "required": [
    "id"
  ]
}
Svarsdata
{
  "type": "object",
  "properties": {
    "status": {
      "type": "string",
      "description": "sent, test, failed eller skipped"
    },
    "recipients_count": {
      "type": "integer"
    },
    "error": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ]
    },
    "sent_at": {
      "type": "string",
      "format": "date-time"
    }
  }
}
GET /reports/:id.json Hämta en e-postrapport email_reports_get

Behörighet: analytics.read

Exempel
curl https://privatusanalytics.com/reports/:id.json \
  -H "Authorization: Bearer $PRIVATUS_TOKEN"
Indata
{
  "type": "object",
  "properties": {
    "id": {
      "type": "string",
      "description": "Id för resursen"
    }
  },
  "required": [
    "id"
  ]
}
Svarsdata
{
  "type": "object",
  "properties": {
    "id": {
      "type": "string",
      "description": "Rapport-id, t.ex. rep_7Q2K9XH3AB"
    },
    "name": {
      "type": "string"
    },
    "site_ids": {
      "type": "array",
      "items": {
        "type": "string"
      },
      "description": "Webbplats-id i rapporten"
    },
    "frequency": {
      "type": "string",
      "description": "daily, weekly eller monthly"
    },
    "hour": {
      "type": "integer",
      "description": "Sändningstimme (arbetsytans tidszon)"
    },
    "weekday": {
      "type": "integer",
      "description": "Veckovis: 0 = söndag … 6 = lördag"
    },
    "recipients": {
      "type": "array",
      "items": {
        "type": "string"
      },
      "description": "Varje adress på rapporten, oavsett status"
    },
    "recipient_details": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "description": "Mottagar-id, t.ex. rcp_7Q2K9XH3AB"
          },
          "email": {
            "type": "string",
            "description": "Adressen"
          },
          "status": {
            "type": "string",
            "description": "active, pending, declined eller unsubscribed"
          },
          "invited_at": {
            "anyOf": [
              {
                "type": "string",
                "format": "date-time",
                "description": "När den senaste inbjudan skickades"
              },
              {
                "type": "null"
              }
            ]
          },
          "expires_at": {
            "anyOf": [
              {
                "type": "string",
                "format": "date-time",
                "description": "När en väntande inbjudan går ut"
              },
              {
                "type": "null"
              }
            ]
          },
          "confirmed_at": {
            "anyOf": [
              {
                "type": "string",
                "format": "date-time",
                "description": "När adressen blev aktiv"
              },
              {
                "type": "null"
              }
            ]
          }
        }
      },
      "description": "Varje mottagare med sin opt-in-status (endast aktiva mottagare får rapporter)"
    },
    "blocks": {
      "type": "array",
      "items": {
        "type": "string"
      },
      "description": "Innehållsblock"
    },
    "attach_pdf": {
      "type": "boolean"
    },
    "intro": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ]
    },
    "enabled": {
      "type": "boolean"
    },
    "last_sent_at": {
      "anyOf": [
        {
          "type": "string",
          "format": "date-time"
        },
        {
          "type": "null"
        }
      ]
    },
    "next_run_at": {
      "anyOf": [
        {
          "type": "string",
          "format": "date-time"
        },
        {
          "type": "null"
        }
      ]
    },
    "created_at": {
      "type": "string",
      "format": "date-time"
    }
  }
}
PATCH /reports/:id.json Uppdatera en e-postrapport email_reports_update

Behörighet: content.write

Exempel
curl -X PATCH https://privatusanalytics.com/reports/:id.json \
  -H "Authorization: Bearer $PRIVATUS_TOKEN" \
  -H "Content-Type: application/json" -d '{…}'
Indata
{
  "type": "object",
  "properties": {
    "site_ids": {
      "type": "array",
      "items": {
        "type": "string"
      },
      "description": "Webbplats-id (pa_…) som ingår i rapporten"
    },
    "frequency": {
      "type": "string",
      "description": "daily, weekly (på veckodag) eller monthly (den 1:a)",
      "enum": [
        "daily",
        "weekly",
        "monthly"
      ]
    },
    "hour": {
      "type": "integer",
      "description": "Timme på dagen att skicka (0 till 23, arbetsytans tidszon)"
    },
    "weekday": {
      "type": "integer",
      "description": "Veckorapporter: 0 = söndag … 6 = lördag"
    },
    "recipients": {
      "type": "array",
      "items": {
        "type": "string"
      },
      "description": "E-postadresser (inget konto behövs). Posterna kan skiljas åt med kommatecken eller radbrytning. Medlemmar i arbetsytan läggs till direkt. Alla andra får en inbjudan och får rapporter först när de har accepterat den. Adresser som har avböjt rapporter nekas"
    },
    "blocks": {
      "type": "array",
      "items": {
        "type": "string"
      },
      "description": "Innehåll: kpis, chart, pages, sources, goals, campaigns, vitals, uptime"
    },
    "attach_pdf": {
      "type": "boolean",
      "description": "Bifoga en PDF-version"
    },
    "intro": {
      "type": "string",
      "description": "Egen introduktionstext (max 2000 tecken)"
    },
    "enabled": {
      "type": "boolean",
      "description": "Skicka enligt schema"
    },
    "name": {
      "type": "string",
      "description": "Rapportens namn"
    },
    "id": {
      "type": "string",
      "description": "Id för resursen"
    }
  },
  "required": [
    "id"
  ]
}
Svarsdata
{
  "type": "object",
  "properties": {
    "id": {
      "type": "string",
      "description": "Rapport-id, t.ex. rep_7Q2K9XH3AB"
    },
    "name": {
      "type": "string"
    },
    "site_ids": {
      "type": "array",
      "items": {
        "type": "string"
      },
      "description": "Webbplats-id i rapporten"
    },
    "frequency": {
      "type": "string",
      "description": "daily, weekly eller monthly"
    },
    "hour": {
      "type": "integer",
      "description": "Sändningstimme (arbetsytans tidszon)"
    },
    "weekday": {
      "type": "integer",
      "description": "Veckovis: 0 = söndag … 6 = lördag"
    },
    "recipients": {
      "type": "array",
      "items": {
        "type": "string"
      },
      "description": "Varje adress på rapporten, oavsett status"
    },
    "recipient_details": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "description": "Mottagar-id, t.ex. rcp_7Q2K9XH3AB"
          },
          "email": {
            "type": "string",
            "description": "Adressen"
          },
          "status": {
            "type": "string",
            "description": "active, pending, declined eller unsubscribed"
          },
          "invited_at": {
            "anyOf": [
              {
                "type": "string",
                "format": "date-time",
                "description": "När den senaste inbjudan skickades"
              },
              {
                "type": "null"
              }
            ]
          },
          "expires_at": {
            "anyOf": [
              {
                "type": "string",
                "format": "date-time",
                "description": "När en väntande inbjudan går ut"
              },
              {
                "type": "null"
              }
            ]
          },
          "confirmed_at": {
            "anyOf": [
              {
                "type": "string",
                "format": "date-time",
                "description": "När adressen blev aktiv"
              },
              {
                "type": "null"
              }
            ]
          }
        }
      },
      "description": "Varje mottagare med sin opt-in-status (endast aktiva mottagare får rapporter)"
    },
    "blocks": {
      "type": "array",
      "items": {
        "type": "string"
      },
      "description": "Innehållsblock"
    },
    "attach_pdf": {
      "type": "boolean"
    },
    "intro": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ]
    },
    "enabled": {
      "type": "boolean"
    },
    "last_sent_at": {
      "anyOf": [
        {
          "type": "string",
          "format": "date-time"
        },
        {
          "type": "null"
        }
      ]
    },
    "next_run_at": {
      "anyOf": [
        {
          "type": "string",
          "format": "date-time"
        },
        {
          "type": "null"
        }
      ]
    },
    "created_at": {
      "type": "string",
      "format": "date-time"
    }
  }
}
POST /reports/invites/:token/accept.json Acceptera en rapportinbjudan report_invites_accept

Behörighet: public · Endast HTTP (inte ett MCP-verktyg)

Exempel
curl -X POST https://privatusanalytics.com/reports/invites/:token/accept.json \
  -H "Content-Type: application/json" -d '{…}'
Indata
{
  "type": "object",
  "properties": {
    "token": {
      "type": "string",
      "description": "Token för resursen"
    }
  },
  "required": [
    "token"
  ]
}
Svarsdata
{
  "type": "object",
  "properties": {
    "id": {
      "type": "string",
      "description": "Mottagar-id, t.ex. rcp_7Q2K9XH3AB"
    },
    "email": {
      "type": "string",
      "description": "Adressen"
    },
    "status": {
      "type": "string",
      "description": "active, pending, declined eller unsubscribed"
    },
    "invited_at": {
      "anyOf": [
        {
          "type": "string",
          "format": "date-time",
          "description": "När den senaste inbjudan skickades"
        },
        {
          "type": "null"
        }
      ]
    },
    "expires_at": {
      "anyOf": [
        {
          "type": "string",
          "format": "date-time",
          "description": "När en väntande inbjudan går ut"
        },
        {
          "type": "null"
        }
      ]
    },
    "confirmed_at": {
      "anyOf": [
        {
          "type": "string",
          "format": "date-time",
          "description": "När adressen blev aktiv"
        },
        {
          "type": "null"
        }
      ]
    }
  }
}
POST /reports/invites/:token/decline.json Tacka nej till en rapportinbjudan report_invites_decline

Behörighet: public · Endast HTTP (inte ett MCP-verktyg)

Exempel
curl -X POST https://privatusanalytics.com/reports/invites/:token/decline.json \
  -H "Content-Type: application/json" -d '{…}'
Indata
{
  "type": "object",
  "properties": {
    "token": {
      "type": "string",
      "description": "Token för resursen"
    }
  },
  "required": [
    "token"
  ]
}
Svarsdata
{
  "type": "object",
  "properties": {
    "id": {
      "type": "string",
      "description": "Mottagar-id, t.ex. rcp_7Q2K9XH3AB"
    },
    "email": {
      "type": "string",
      "description": "Adressen"
    },
    "status": {
      "type": "string",
      "description": "active, pending, declined eller unsubscribed"
    },
    "invited_at": {
      "anyOf": [
        {
          "type": "string",
          "format": "date-time",
          "description": "När den senaste inbjudan skickades"
        },
        {
          "type": "null"
        }
      ]
    },
    "expires_at": {
      "anyOf": [
        {
          "type": "string",
          "format": "date-time",
          "description": "När en väntande inbjudan går ut"
        },
        {
          "type": "null"
        }
      ]
    },
    "confirmed_at": {
      "anyOf": [
        {
          "type": "string",
          "format": "date-time",
          "description": "När adressen blev aktiv"
        },
        {
          "type": "null"
        }
      ]
    }
  }
}
POST /reports/resubscribe/:token.json Få rapporter igen efter avregistrering report_resubscribes_confirm

Behörighet: public · Endast HTTP (inte ett MCP-verktyg)

Exempel
curl -X POST https://privatusanalytics.com/reports/resubscribe/:token.json \
  -H "Content-Type: application/json" -d '{…}'
Indata
{
  "type": "object",
  "properties": {
    "token": {
      "type": "string",
      "description": "Token för resursen"
    }
  },
  "required": [
    "token"
  ]
}
Svarsdata
{
  "type": "object"
}
POST /reports/unsubscribe/:token/resubscribe.json Mejla en adress en länk för att få rapporter igen report_resubscribes_create

Behörighet: public · Endast HTTP (inte ett MCP-verktyg)

Exempel
curl -X POST https://privatusanalytics.com/reports/unsubscribe/:token/resubscribe.json \
  -H "Content-Type: application/json" -d '{…}'
Indata
{
  "type": "object",
  "properties": {
    "token": {
      "type": "string",
      "description": "Token för resursen"
    }
  },
  "required": [
    "token"
  ]
}
Svarsdata
{
  "type": "object"
}
POST /reports/unsubscribe/:token.json Avsluta prenumerationen på en e-postrapport för en adress report_unsubscribes_create

Behörighet: public · Endast HTTP (inte ett MCP-verktyg)

Exempel
curl -X POST https://privatusanalytics.com/reports/unsubscribe/:token.json \
  -H "Content-Type: application/json" -d '{…}'
Indata
{
  "type": "object",
  "properties": {
    "token": {
      "type": "string",
      "description": "Token för resursen"
    }
  },
  "required": [
    "token"
  ]
}
Svarsdata
{
  "type": "object"
}

Exporter

POST /workspaces/:workspace_id/exports.json Köa en export (skapas i bakgrunden) exports_create

Behörighet: analytics.export

Exempel
curl -X POST https://privatusanalytics.com/workspaces/:workspace_id/exports.json \
  -H "Authorization: Bearer $PRIVATUS_TOKEN" \
  -H "Content-Type: application/json" -d '{…}'
Indata
{
  "type": "object",
  "properties": {
    "site_id": {
      "type": "string",
      "description": "Webbplats att exportera (pa_…)",
      "examples": [
        "pa_7Q2K9XH3AB"
      ]
    },
    "kind": {
      "type": "string",
      "description": "aggregated: mätvärden per tidsintervall och dimensioner. pageviews/events/raw: en rad per träff (Pro och uppåt). imported: importerad dagsstatistik. dashboard: ZIP med översiktspanelerna",
      "enum": [
        "aggregated",
        "pageviews",
        "events",
        "imported",
        "raw",
        "dashboard"
      ],
      "default": "aggregated"
    },
    "file_format": {
      "type": "string",
      "description": "csv, json eller xlsx (aggregated, pageviews, events, imported), csv eller ndjson (raw), zip (dashboard)",
      "enum": [
        "csv",
        "json",
        "xlsx",
        "ndjson",
        "zip"
      ],
      "default": "csv"
    },
    "from": {
      "type": "string",
      "format": "date",
      "description": "Första dagen, i exportens tidszon",
      "examples": [
        "2026-09-01"
      ]
    },
    "to": {
      "type": "string",
      "format": "date",
      "description": "Sista dagen, inklusive (max 400 dagar, raw 93 dagar)",
      "examples": [
        "2026-09-28"
      ]
    },
    "timezone": {
      "type": "string",
      "description": "Tidszon för datum och gruppering, t.ex. America/New_York (standard: webbplatsens tidszon)"
    },
    "grouping": {
      "type": "string",
      "description": "Tidsintervall för aggregerade exporter",
      "enum": [
        "hour",
        "day",
        "week",
        "month",
        "quarter",
        "year"
      ],
      "default": "day"
    },
    "dimensions": {
      "type": "array",
      "items": {
        "type": "string"
      },
      "description": "Besöksdimensioner att gruppera aggregerade exporter efter (upp till 6), t.ex. country, channel, entry_page. För importerade exporter: de importerade dimensionerna att ta med",
      "default": []
    },
    "metrics": {
      "type": "array",
      "items": {
        "type": "string"
      },
      "description": "Mätvärden för aggregerade exporter (standard alla): visitors, visits, pageviews, bounce_rate, visit_duration, views_per_visit, revenue",
      "default": []
    },
    "fields": {
      "type": "array",
      "items": {
        "type": "string"
      },
      "description": "Kolumner för exporter av pageviews/events/raw (standard är alla utom visit_id, vital_value, selector): occurred_at, kind, name, visit_id, hostname, path, referrer_host, referrer_path, channel, utm_source, utm_medium, utm_campaign, utm_content, utm_term, ref, paid_click, country, language, device, browser, browser_major, os, os_major, screen_bucket, engaged_ms, scroll_depth, revenue_minor, currency, vital_value, selector, props",
      "default": []
    },
    "filters": {
      "type": "array",
      "items": {},
      "description": "Filter, samma format som statistik-API:et: [[\"dimension\",\"operator\",\"value\"], …]",
      "default": []
    },
    "segment_id": {
      "type": "string",
      "description": "Tillämpa ett sparat segment (seg_…)"
    },
    "workspace_id": {
      "type": "string",
      "description": "Arbetsyte-id, t.ex. ws_7Q2K9XH3AB"
    }
  },
  "required": [
    "site_id",
    "from",
    "to",
    "workspace_id"
  ]
}
Svarsdata
{
  "type": "object",
  "properties": {
    "id": {
      "type": "string",
      "description": "Export-id, t.ex. exp_7Q2K9XH3AB"
    },
    "site_id": {
      "anyOf": [
        {
          "type": "string",
          "description": "Exporterad webbplats (pa_…)"
        },
        {
          "type": "null"
        }
      ]
    },
    "kind": {
      "type": "string",
      "description": "aggregated, pageviews, events, imported, raw eller dashboard"
    },
    "format": {
      "type": "string",
      "description": "csv, json, xlsx, ndjson eller zip"
    },
    "status": {
      "type": "string",
      "description": "queued, running, complete, failed eller expired"
    },
    "params": {
      "type": "object",
      "description": "Exportdefinitionen (datum, tidszon, gruppering, dimensioner, mätvärden, fält, filter)"
    },
    "row_count": {
      "anyOf": [
        {
          "type": "integer",
          "description": "Skrivna rader"
        },
        {
          "type": "null"
        }
      ]
    },
    "error": {
      "anyOf": [
        {
          "type": "string",
          "description": "Varför exporten misslyckades"
        },
        {
          "type": "null"
        }
      ]
    },
    "completed_at": {
      "anyOf": [
        {
          "type": "string",
          "format": "date-time"
        },
        {
          "type": "null"
        }
      ]
    },
    "expires_at": {
      "anyOf": [
        {
          "type": "string",
          "format": "date-time",
          "description": "När filen tas bort"
        },
        {
          "type": "null"
        }
      ]
    },
    "download_url": {
      "anyOf": [
        {
          "type": "string",
          "description": "Sökväg som returnerar en kortlivad signerad fillänk (exports_download)"
        },
        {
          "type": "null"
        }
      ]
    },
    "created_at": {
      "type": "string",
      "format": "date-time"
    }
  }
}
DELETE /exports/:id.json Ta bort en export och dess fil exports_delete

Behörighet: analytics.export

Exempel
curl -X DELETE https://privatusanalytics.com/exports/:id.json \
  -H "Authorization: Bearer $PRIVATUS_TOKEN" \
  -H "Content-Type: application/json" -d '{…}'
Indata
{
  "type": "object",
  "properties": {
    "id": {
      "type": "string",
      "description": "Id för resursen"
    }
  },
  "required": [
    "id"
  ]
}
Svarsdata
{
  "type": "object",
  "properties": {
    "id": {
      "type": "string",
      "description": "Export-id, t.ex. exp_7Q2K9XH3AB"
    },
    "site_id": {
      "anyOf": [
        {
          "type": "string",
          "description": "Exporterad webbplats (pa_…)"
        },
        {
          "type": "null"
        }
      ]
    },
    "kind": {
      "type": "string",
      "description": "aggregated, pageviews, events, imported, raw eller dashboard"
    },
    "format": {
      "type": "string",
      "description": "csv, json, xlsx, ndjson eller zip"
    },
    "status": {
      "type": "string",
      "description": "queued, running, complete, failed eller expired"
    },
    "params": {
      "type": "object",
      "description": "Exportdefinitionen (datum, tidszon, gruppering, dimensioner, mätvärden, fält, filter)"
    },
    "row_count": {
      "anyOf": [
        {
          "type": "integer",
          "description": "Skrivna rader"
        },
        {
          "type": "null"
        }
      ]
    },
    "error": {
      "anyOf": [
        {
          "type": "string",
          "description": "Varför exporten misslyckades"
        },
        {
          "type": "null"
        }
      ]
    },
    "completed_at": {
      "anyOf": [
        {
          "type": "string",
          "format": "date-time"
        },
        {
          "type": "null"
        }
      ]
    },
    "expires_at": {
      "anyOf": [
        {
          "type": "string",
          "format": "date-time",
          "description": "När filen tas bort"
        },
        {
          "type": "null"
        }
      ]
    },
    "download_url": {
      "anyOf": [
        {
          "type": "string",
          "description": "Sökväg som returnerar en kortlivad signerad fillänk (exports_download)"
        },
        {
          "type": "null"
        }
      ]
    },
    "created_at": {
      "type": "string",
      "format": "date-time"
    }
  }
}
GET /exports/:id/download.json Hämta en signerad länk till filen (giltig i 10 minuter) exports_download

Behörighet: analytics.export

Exempel
curl https://privatusanalytics.com/exports/:id/download.json \
  -H "Authorization: Bearer $PRIVATUS_TOKEN"
Indata
{
  "type": "object",
  "properties": {
    "id": {
      "type": "string",
      "description": "Id för resursen"
    }
  },
  "required": [
    "id"
  ]
}
Svarsdata
{
  "type": "object"
}
GET /workspaces/:workspace_id/exports.json Lista exporter (jobbkön) exports_list

Behörighet: analytics.export

Exempel
curl https://privatusanalytics.com/workspaces/:workspace_id/exports.json \
  -H "Authorization: Bearer $PRIVATUS_TOKEN"
Indata
{
  "type": "object",
  "properties": {
    "site_id": {
      "type": "string",
      "description": "Endast exporter för den här webbplatsen (pa_…)"
    },
    "status": {
      "type": "string",
      "description": "Endast exporter med den här statusen",
      "enum": [
        "queued",
        "running",
        "complete",
        "failed",
        "expired"
      ]
    },
    "kind": {
      "type": "string",
      "description": "Endast exporter av den här typen",
      "enum": [
        "aggregated",
        "pageviews",
        "events",
        "imported",
        "raw",
        "dashboard"
      ]
    },
    "workspace_id": {
      "type": "string",
      "description": "Arbetsyte-id, t.ex. ws_7Q2K9XH3AB"
    },
    "page": {
      "type": "integer",
      "description": "Sida (från 1)"
    },
    "per_page": {
      "type": "integer",
      "description": "Resultat per sida (max 100)"
    }
  },
  "required": [
    "workspace_id"
  ]
}
Svarsdata
{
  "type": "array",
  "items": {
    "type": "object",
    "properties": {
      "id": {
        "type": "string",
        "description": "Export-id, t.ex. exp_7Q2K9XH3AB"
      },
      "site_id": {
        "anyOf": [
          {
            "type": "string",
            "description": "Exporterad webbplats (pa_…)"
          },
          {
            "type": "null"
          }
        ]
      },
      "kind": {
        "type": "string",
        "description": "aggregated, pageviews, events, imported, raw eller dashboard"
      },
      "format": {
        "type": "string",
        "description": "csv, json, xlsx, ndjson eller zip"
      },
      "status": {
        "type": "string",
        "description": "queued, running, complete, failed eller expired"
      },
      "params": {
        "type": "object",
        "description": "Exportdefinitionen (datum, tidszon, gruppering, dimensioner, mätvärden, fält, filter)"
      },
      "row_count": {
        "anyOf": [
          {
            "type": "integer",
            "description": "Skrivna rader"
          },
          {
            "type": "null"
          }
        ]
      },
      "error": {
        "anyOf": [
          {
            "type": "string",
            "description": "Varför exporten misslyckades"
          },
          {
            "type": "null"
          }
        ]
      },
      "completed_at": {
        "anyOf": [
          {
            "type": "string",
            "format": "date-time"
          },
          {
            "type": "null"
          }
        ]
      },
      "expires_at": {
        "anyOf": [
          {
            "type": "string",
            "format": "date-time",
            "description": "När filen tas bort"
          },
          {
            "type": "null"
          }
        ]
      },
      "download_url": {
        "anyOf": [
          {
            "type": "string",
            "description": "Sökväg som returnerar en kortlivad signerad fillänk (exports_download)"
          },
          {
            "type": "null"
          }
        ]
      },
      "created_at": {
        "type": "string",
        "format": "date-time"
      }
    }
  }
}
POST /workspaces/:workspace_id/exports/preview.json Förhandsgranska en export: de första 20 raderna och det uppskattade antalet rader exports_preview

Behörighet: analytics.export

Exempel
curl -X POST https://privatusanalytics.com/workspaces/:workspace_id/exports/preview.json \
  -H "Authorization: Bearer $PRIVATUS_TOKEN" \
  -H "Content-Type: application/json" -d '{…}'
Indata
{
  "type": "object",
  "properties": {
    "site_id": {
      "type": "string",
      "description": "Webbplats att exportera (pa_…)",
      "examples": [
        "pa_7Q2K9XH3AB"
      ]
    },
    "kind": {
      "type": "string",
      "description": "aggregated: mätvärden per tidsintervall och dimensioner. pageviews/events/raw: en rad per träff (Pro och uppåt). imported: importerad dagsstatistik. dashboard: ZIP med översiktspanelerna",
      "enum": [
        "aggregated",
        "pageviews",
        "events",
        "imported",
        "raw",
        "dashboard"
      ],
      "default": "aggregated"
    },
    "file_format": {
      "type": "string",
      "description": "csv, json eller xlsx (aggregated, pageviews, events, imported), csv eller ndjson (raw), zip (dashboard)",
      "enum": [
        "csv",
        "json",
        "xlsx",
        "ndjson",
        "zip"
      ],
      "default": "csv"
    },
    "from": {
      "type": "string",
      "format": "date",
      "description": "Första dagen, i exportens tidszon",
      "examples": [
        "2026-09-01"
      ]
    },
    "to": {
      "type": "string",
      "format": "date",
      "description": "Sista dagen, inklusive (max 400 dagar, raw 93 dagar)",
      "examples": [
        "2026-09-28"
      ]
    },
    "timezone": {
      "type": "string",
      "description": "Tidszon för datum och gruppering, t.ex. America/New_York (standard: webbplatsens tidszon)"
    },
    "grouping": {
      "type": "string",
      "description": "Tidsintervall för aggregerade exporter",
      "enum": [
        "hour",
        "day",
        "week",
        "month",
        "quarter",
        "year"
      ],
      "default": "day"
    },
    "dimensions": {
      "type": "array",
      "items": {
        "type": "string"
      },
      "description": "Besöksdimensioner att gruppera aggregerade exporter efter (upp till 6), t.ex. country, channel, entry_page. För importerade exporter: de importerade dimensionerna att ta med",
      "default": []
    },
    "metrics": {
      "type": "array",
      "items": {
        "type": "string"
      },
      "description": "Mätvärden för aggregerade exporter (standard alla): visitors, visits, pageviews, bounce_rate, visit_duration, views_per_visit, revenue",
      "default": []
    },
    "fields": {
      "type": "array",
      "items": {
        "type": "string"
      },
      "description": "Kolumner för exporter av pageviews/events/raw (standard är alla utom visit_id, vital_value, selector): occurred_at, kind, name, visit_id, hostname, path, referrer_host, referrer_path, channel, utm_source, utm_medium, utm_campaign, utm_content, utm_term, ref, paid_click, country, language, device, browser, browser_major, os, os_major, screen_bucket, engaged_ms, scroll_depth, revenue_minor, currency, vital_value, selector, props",
      "default": []
    },
    "filters": {
      "type": "array",
      "items": {},
      "description": "Filter, samma format som statistik-API:et: [[\"dimension\",\"operator\",\"value\"], …]",
      "default": []
    },
    "segment_id": {
      "type": "string",
      "description": "Tillämpa ett sparat segment (seg_…)"
    },
    "workspace_id": {
      "type": "string",
      "description": "Arbetsyte-id, t.ex. ws_7Q2K9XH3AB"
    }
  },
  "required": [
    "site_id",
    "from",
    "to",
    "workspace_id"
  ]
}
Svarsdata
{
  "type": "object"
}
GET /exports/:id.json Hämta en export och dess status exports_get

Behörighet: analytics.export

Exempel
curl https://privatusanalytics.com/exports/:id.json \
  -H "Authorization: Bearer $PRIVATUS_TOKEN"
Indata
{
  "type": "object",
  "properties": {
    "id": {
      "type": "string",
      "description": "Id för resursen"
    }
  },
  "required": [
    "id"
  ]
}
Svarsdata
{
  "type": "object",
  "properties": {
    "id": {
      "type": "string",
      "description": "Export-id, t.ex. exp_7Q2K9XH3AB"
    },
    "site_id": {
      "anyOf": [
        {
          "type": "string",
          "description": "Exporterad webbplats (pa_…)"
        },
        {
          "type": "null"
        }
      ]
    },
    "kind": {
      "type": "string",
      "description": "aggregated, pageviews, events, imported, raw eller dashboard"
    },
    "format": {
      "type": "string",
      "description": "csv, json, xlsx, ndjson eller zip"
    },
    "status": {
      "type": "string",
      "description": "queued, running, complete, failed eller expired"
    },
    "params": {
      "type": "object",
      "description": "Exportdefinitionen (datum, tidszon, gruppering, dimensioner, mätvärden, fält, filter)"
    },
    "row_count": {
      "anyOf": [
        {
          "type": "integer",
          "description": "Skrivna rader"
        },
        {
          "type": "null"
        }
      ]
    },
    "error": {
      "anyOf": [
        {
          "type": "string",
          "description": "Varför exporten misslyckades"
        },
        {
          "type": "null"
        }
      ]
    },
    "completed_at": {
      "anyOf": [
        {
          "type": "string",
          "format": "date-time"
        },
        {
          "type": "null"
        }
      ]
    },
    "expires_at": {
      "anyOf": [
        {
          "type": "string",
          "format": "date-time",
          "description": "När filen tas bort"
        },
        {
          "type": "null"
        }
      ]
    },
    "download_url": {
      "anyOf": [
        {
          "type": "string",
          "description": "Sökväg som returnerar en kortlivad signerad fillänk (exports_download)"
        },
        {
          "type": "null"
        }
      ]
    },
    "created_at": {
      "type": "string",
      "format": "date-time"
    }
  }
}

Fakturering

POST /workspaces/:workspace_id/billing/badge.json Anmäl dig till eller av från märkesbonusen (gratisplanen) billing_badge

Behörighet: billing.manage

Exempel
curl -X POST https://privatusanalytics.com/workspaces/:workspace_id/billing/badge.json \
  -H "Authorization: Bearer $PRIVATUS_TOKEN" \
  -H "Content-Type: application/json" -d '{…}'
Indata
{
  "type": "object",
  "properties": {
    "enabled": {
      "type": "boolean",
      "description": "true för att verifiera märket och få bonusen"
    },
    "workspace_id": {
      "type": "string",
      "description": "Arbetsyte-id, t.ex. ws_7Q2K9XH3AB"
    }
  },
  "required": [
    "enabled",
    "workspace_id"
  ]
}
Svarsdata
{
  "type": "object",
  "properties": {
    "workspace_id": {
      "type": "string"
    },
    "plan": {
      "type": "string",
      "description": "free, pro, business eller enterprise"
    },
    "plan_events": {
      "type": "integer",
      "description": "Händelser per månad i den betalda nivån"
    },
    "allowance": {
      "type": "integer",
      "description": "Händelser per månad inklusive eventuell märkesbonus"
    },
    "billing_interval": {
      "anyOf": [
        {
          "type": "string",
          "description": "month eller year"
        },
        {
          "type": "null"
        }
      ]
    },
    "price": {
      "anyOf": [
        {
          "type": "integer",
          "description": "USD per faktureringsintervall"
        },
        {
          "type": "null"
        }
      ]
    },
    "subscription_status": {
      "type": "string",
      "description": "none, trialing, active, past_due, paused eller canceled"
    },
    "current_period_ends_at": {
      "anyOf": [
        {
          "type": "string",
          "format": "date-time",
          "description": "Förnyas eller slutar"
        },
        {
          "type": "null"
        }
      ]
    },
    "cancel_at_period_end": {
      "type": "boolean"
    },
    "canceled_at": {
      "anyOf": [
        {
          "type": "string",
          "format": "date-time"
        },
        {
          "type": "null"
        }
      ]
    },
    "auto_upgrade": {
      "type": "boolean"
    },
    "discount": {
      "anyOf": [
        {
          "type": "object",
          "properties": {
            "program": {
              "type": "string",
              "description": "nonprofit, education, open_source, open_source_free eller agency"
            },
            "status": {
              "type": "string",
              "description": "pending, approved (ännu inte på prenumerationen), active, rejected eller revoked"
            },
            "percent": {
              "anyOf": [
                {
                  "type": "integer",
                  "description": "Procent rabatt på Pro och Business (null för det kostnadsfria programmet för öppen källkod)"
                },
                {
                  "type": "null"
                }
              ]
            },
            "comp_events": {
              "anyOf": [
                {
                  "type": "integer",
                  "description": "Kostnadsfria händelser per månad (endast det kostnadsfria programmet för öppen källkod)"
                },
                {
                  "type": "null"
                }
              ]
            },
            "organization_name": {
              "type": "string",
              "description": "Namn på organisation, skola, projekt eller byrå"
            },
            "website": {
              "anyOf": [
                {
                  "type": "string",
                  "description": "Webbplats"
                },
                {
                  "type": "null"
                }
              ]
            },
            "proof_url": {
              "anyOf": [
                {
                  "type": "string",
                  "description": "Länk till intyg eller URL till kodförråd"
                },
                {
                  "type": "null"
                }
              ]
            },
            "license": {
              "anyOf": [
                {
                  "type": "string",
                  "description": "OSI-licens (öppen källkod)"
                },
                {
                  "type": "null"
                }
              ]
            },
            "note": {
              "anyOf": [
                {
                  "type": "string",
                  "description": "Anteckning till granskningen"
                },
                {
                  "type": "null"
                }
              ]
            },
            "rejection_reason": {
              "anyOf": [
                {
                  "type": "string",
                  "description": "Varför ansökan inte godkändes"
                },
                {
                  "type": "null"
                }
              ]
            },
            "created_at": {
              "type": "string",
              "format": "date-time",
              "description": "Ansökt"
            },
            "reviewed_at": {
              "anyOf": [
                {
                  "type": "string",
                  "format": "date-time",
                  "description": "Granskad"
                },
                {
                  "type": "null"
                }
              ]
            },
            "applied_at": {
              "anyOf": [
                {
                  "type": "string",
                  "format": "date-time",
                  "description": "Rabatten aktiv sedan"
                },
                {
                  "type": "null"
                }
              ]
            },
            "revoked_at": {
              "anyOf": [
                {
                  "type": "string",
                  "format": "date-time",
                  "description": "Programmet avslutat"
                },
                {
                  "type": "null"
                }
              ]
            }
          },
          "description": "Den senaste ansökan till ett rabattprogram, eller null"
        },
        {
          "type": "null"
        }
      ]
    },
    "discount_percent": {
      "anyOf": [
        {
          "type": "integer",
          "description": "Procent rabatt på Pro och Business från ett godkänt program, eller null"
        },
        {
          "type": "null"
        }
      ]
    },
    "billing_emails": {
      "type": "array",
      "items": {
        "type": "string"
      }
    },
    "tax_id": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ]
    },
    "badge": {
      "type": "object",
      "description": "Märkesbonus (gratisplanen)"
    },
    "usage": {
      "type": "object",
      "properties": {
        "month": {
          "type": "string",
          "format": "date",
          "description": "Första dagen i den rapporterade månaden"
        },
        "events": {
          "type": "integer",
          "description": "Debiterbara händelser (sidvisningar och egna händelser)"
        },
        "bots": {
          "type": "integer",
          "description": "Bottträffar som filtrerats bort (debiteras inte)"
        },
        "allowance": {
          "type": "integer",
          "description": "Händelser som ingår, inklusive eventuell märkesbonus"
        },
        "percent": {
          "type": "number",
          "description": "Händelser i procent av kvoten"
        },
        "forecast": {
          "anyOf": [
            {
              "type": "integer",
              "description": "Beräknat antal händelser vid månadens slut"
            },
            {
              "type": "null"
            }
          ]
        },
        "forecast_percent": {
          "anyOf": [
            {
              "type": "number"
            },
            {
              "type": "null"
            }
          ]
        },
        "days_left": {
          "type": "integer",
          "description": "Dagar kvar av månaden"
        },
        "status": {
          "type": "string",
          "description": "ok, warning (80%+), over (en tidigare månad på eller över kvoten), locked eller paused"
        },
        "sites": {
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "site_id": {
                "type": "string"
              },
              "domain": {
                "type": "string"
              },
              "name": {
                "type": "string"
              },
              "events": {
                "type": "integer",
                "description": "Sidvisningar och egna händelser den här månaden"
              },
              "share": {
                "type": "number",
                "description": "Procent av arbetsytans totala"
              }
            }
          },
          "description": "Händelser per webbplats"
        },
        "history": {
          "type": "array",
          "description": "Tidigare månader, nyast först"
        },
        "access_locked_at": {
          "anyOf": [
            {
              "type": "string",
              "format": "date-time",
              "description": "Instrumentpanelerna låsta av Privatus Analytics personal sedan"
            },
            {
              "type": "null"
            }
          ]
        },
        "collection_paused": {
          "type": "boolean",
          "description": "True medan nya händelser släpps (månadsgränsen är nådd, eller personalen har pausat insamlingen)"
        },
        "pause_reason": {
          "anyOf": [
            {
              "type": "string",
              "description": "Varför insamlingen är pausad: limit (månadskvoten är nådd) eller staff. null när insamling pågår"
            },
            {
              "type": "null"
            }
          ]
        },
        "collection_paused_at": {
          "anyOf": [
            {
              "type": "string",
              "format": "date-time",
              "description": "När personalen pausade insamlingen"
            },
            {
              "type": "null"
            }
          ]
        },
        "resumes_at": {
          "anyOf": [
            {
              "type": "string",
              "format": "date-time",
              "description": "När en gränspaus hävs: början av nästa månad (UTC), eller tidigare vid en uppgradering. Annars null"
            },
            {
              "type": "null"
            }
          ]
        }
      },
      "description": "Den här månaden hittills"
    }
  }
}
POST /workspaces/:workspace_id/billing/cancel.json Avsluta vid slutet av faktureringsperioden billing_cancel

Behörighet: billing.manage

Exempel
curl -X POST https://privatusanalytics.com/workspaces/:workspace_id/billing/cancel.json \
  -H "Authorization: Bearer $PRIVATUS_TOKEN" \
  -H "Content-Type: application/json" -d '{…}'
Indata
{
  "type": "object",
  "properties": {
    "reason": {
      "type": "string",
      "description": "Främsta orsaken till uppsägningen (valfri enkät)",
      "enum": [
        "too_expensive",
        "missing_features",
        "switching_tool",
        "not_using",
        "temporary",
        "other"
      ]
    },
    "comment": {
      "type": "string",
      "description": "Allt vi skulle kunna göra bättre"
    },
    "workspace_id": {
      "type": "string",
      "description": "Arbetsyte-id, t.ex. ws_7Q2K9XH3AB"
    }
  },
  "required": [
    "workspace_id"
  ]
}
Svarsdata
{
  "type": "object",
  "properties": {
    "workspace_id": {
      "type": "string"
    },
    "plan": {
      "type": "string",
      "description": "free, pro, business eller enterprise"
    },
    "plan_events": {
      "type": "integer",
      "description": "Händelser per månad i den betalda nivån"
    },
    "allowance": {
      "type": "integer",
      "description": "Händelser per månad inklusive eventuell märkesbonus"
    },
    "billing_interval": {
      "anyOf": [
        {
          "type": "string",
          "description": "month eller year"
        },
        {
          "type": "null"
        }
      ]
    },
    "price": {
      "anyOf": [
        {
          "type": "integer",
          "description": "USD per faktureringsintervall"
        },
        {
          "type": "null"
        }
      ]
    },
    "subscription_status": {
      "type": "string",
      "description": "none, trialing, active, past_due, paused eller canceled"
    },
    "current_period_ends_at": {
      "anyOf": [
        {
          "type": "string",
          "format": "date-time",
          "description": "Förnyas eller slutar"
        },
        {
          "type": "null"
        }
      ]
    },
    "cancel_at_period_end": {
      "type": "boolean"
    },
    "canceled_at": {
      "anyOf": [
        {
          "type": "string",
          "format": "date-time"
        },
        {
          "type": "null"
        }
      ]
    },
    "auto_upgrade": {
      "type": "boolean"
    },
    "discount": {
      "anyOf": [
        {
          "type": "object",
          "properties": {
            "program": {
              "type": "string",
              "description": "nonprofit, education, open_source, open_source_free eller agency"
            },
            "status": {
              "type": "string",
              "description": "pending, approved (ännu inte på prenumerationen), active, rejected eller revoked"
            },
            "percent": {
              "anyOf": [
                {
                  "type": "integer",
                  "description": "Procent rabatt på Pro och Business (null för det kostnadsfria programmet för öppen källkod)"
                },
                {
                  "type": "null"
                }
              ]
            },
            "comp_events": {
              "anyOf": [
                {
                  "type": "integer",
                  "description": "Kostnadsfria händelser per månad (endast det kostnadsfria programmet för öppen källkod)"
                },
                {
                  "type": "null"
                }
              ]
            },
            "organization_name": {
              "type": "string",
              "description": "Namn på organisation, skola, projekt eller byrå"
            },
            "website": {
              "anyOf": [
                {
                  "type": "string",
                  "description": "Webbplats"
                },
                {
                  "type": "null"
                }
              ]
            },
            "proof_url": {
              "anyOf": [
                {
                  "type": "string",
                  "description": "Länk till intyg eller URL till kodförråd"
                },
                {
                  "type": "null"
                }
              ]
            },
            "license": {
              "anyOf": [
                {
                  "type": "string",
                  "description": "OSI-licens (öppen källkod)"
                },
                {
                  "type": "null"
                }
              ]
            },
            "note": {
              "anyOf": [
                {
                  "type": "string",
                  "description": "Anteckning till granskningen"
                },
                {
                  "type": "null"
                }
              ]
            },
            "rejection_reason": {
              "anyOf": [
                {
                  "type": "string",
                  "description": "Varför ansökan inte godkändes"
                },
                {
                  "type": "null"
                }
              ]
            },
            "created_at": {
              "type": "string",
              "format": "date-time",
              "description": "Ansökt"
            },
            "reviewed_at": {
              "anyOf": [
                {
                  "type": "string",
                  "format": "date-time",
                  "description": "Granskad"
                },
                {
                  "type": "null"
                }
              ]
            },
            "applied_at": {
              "anyOf": [
                {
                  "type": "string",
                  "format": "date-time",
                  "description": "Rabatten aktiv sedan"
                },
                {
                  "type": "null"
                }
              ]
            },
            "revoked_at": {
              "anyOf": [
                {
                  "type": "string",
                  "format": "date-time",
                  "description": "Programmet avslutat"
                },
                {
                  "type": "null"
                }
              ]
            }
          },
          "description": "Den senaste ansökan till ett rabattprogram, eller null"
        },
        {
          "type": "null"
        }
      ]
    },
    "discount_percent": {
      "anyOf": [
        {
          "type": "integer",
          "description": "Procent rabatt på Pro och Business från ett godkänt program, eller null"
        },
        {
          "type": "null"
        }
      ]
    },
    "billing_emails": {
      "type": "array",
      "items": {
        "type": "string"
      }
    },
    "tax_id": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ]
    },
    "badge": {
      "type": "object",
      "description": "Märkesbonus (gratisplanen)"
    },
    "usage": {
      "type": "object",
      "properties": {
        "month": {
          "type": "string",
          "format": "date",
          "description": "Första dagen i den rapporterade månaden"
        },
        "events": {
          "type": "integer",
          "description": "Debiterbara händelser (sidvisningar och egna händelser)"
        },
        "bots": {
          "type": "integer",
          "description": "Bottträffar som filtrerats bort (debiteras inte)"
        },
        "allowance": {
          "type": "integer",
          "description": "Händelser som ingår, inklusive eventuell märkesbonus"
        },
        "percent": {
          "type": "number",
          "description": "Händelser i procent av kvoten"
        },
        "forecast": {
          "anyOf": [
            {
              "type": "integer",
              "description": "Beräknat antal händelser vid månadens slut"
            },
            {
              "type": "null"
            }
          ]
        },
        "forecast_percent": {
          "anyOf": [
            {
              "type": "number"
            },
            {
              "type": "null"
            }
          ]
        },
        "days_left": {
          "type": "integer",
          "description": "Dagar kvar av månaden"
        },
        "status": {
          "type": "string",
          "description": "ok, warning (80%+), over (en tidigare månad på eller över kvoten), locked eller paused"
        },
        "sites": {
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "site_id": {
                "type": "string"
              },
              "domain": {
                "type": "string"
              },
              "name": {
                "type": "string"
              },
              "events": {
                "type": "integer",
                "description": "Sidvisningar och egna händelser den här månaden"
              },
              "share": {
                "type": "number",
                "description": "Procent av arbetsytans totala"
              }
            }
          },
          "description": "Händelser per webbplats"
        },
        "history": {
          "type": "array",
          "description": "Tidigare månader, nyast först"
        },
        "access_locked_at": {
          "anyOf": [
            {
              "type": "string",
              "format": "date-time",
              "description": "Instrumentpanelerna låsta av Privatus Analytics personal sedan"
            },
            {
              "type": "null"
            }
          ]
        },
        "collection_paused": {
          "type": "boolean",
          "description": "True medan nya händelser släpps (månadsgränsen är nådd, eller personalen har pausat insamlingen)"
        },
        "pause_reason": {
          "anyOf": [
            {
              "type": "string",
              "description": "Varför insamlingen är pausad: limit (månadskvoten är nådd) eller staff. null när insamling pågår"
            },
            {
              "type": "null"
            }
          ]
        },
        "collection_paused_at": {
          "anyOf": [
            {
              "type": "string",
              "format": "date-time",
              "description": "När personalen pausade insamlingen"
            },
            {
              "type": "null"
            }
          ]
        },
        "resumes_at": {
          "anyOf": [
            {
              "type": "string",
              "format": "date-time",
              "description": "När en gränspaus hävs: början av nästa månad (UTC), eller tidigare vid en uppgradering. Annars null"
            },
            {
              "type": "null"
            }
          ]
        }
      },
      "description": "Den här månaden hittills"
    }
  }
}
POST /workspaces/:workspace_id/billing/change_plan.json Byt plan, nivå eller intervall (proportionerligt) billing_change_plan

Behörighet: billing.manage

Exempel
curl -X POST https://privatusanalytics.com/workspaces/:workspace_id/billing/change_plan.json \
  -H "Authorization: Bearer $PRIVATUS_TOKEN" \
  -H "Content-Type: application/json" -d '{…}'
Indata
{
  "type": "object",
  "properties": {
    "plan": {
      "type": "string",
      "description": "Plan att byta till: pro eller business",
      "enum": [
        "pro",
        "business"
      ]
    },
    "events": {
      "type": "integer",
      "description": "Händelser per månad för nivån, från GET /plans",
      "examples": [
        1000000
      ]
    },
    "interval": {
      "type": "string",
      "description": "Faktureringsintervall. Årsbetalning ger 2 månader gratis",
      "enum": [
        "month",
        "year"
      ],
      "default": "month"
    },
    "workspace_id": {
      "type": "string",
      "description": "Arbetsyte-id, t.ex. ws_7Q2K9XH3AB"
    }
  },
  "required": [
    "plan",
    "events",
    "workspace_id"
  ]
}
Svarsdata
{
  "type": "object",
  "properties": {
    "workspace_id": {
      "type": "string"
    },
    "plan": {
      "type": "string",
      "description": "free, pro, business eller enterprise"
    },
    "plan_events": {
      "type": "integer",
      "description": "Händelser per månad i den betalda nivån"
    },
    "allowance": {
      "type": "integer",
      "description": "Händelser per månad inklusive eventuell märkesbonus"
    },
    "billing_interval": {
      "anyOf": [
        {
          "type": "string",
          "description": "month eller year"
        },
        {
          "type": "null"
        }
      ]
    },
    "price": {
      "anyOf": [
        {
          "type": "integer",
          "description": "USD per faktureringsintervall"
        },
        {
          "type": "null"
        }
      ]
    },
    "subscription_status": {
      "type": "string",
      "description": "none, trialing, active, past_due, paused eller canceled"
    },
    "current_period_ends_at": {
      "anyOf": [
        {
          "type": "string",
          "format": "date-time",
          "description": "Förnyas eller slutar"
        },
        {
          "type": "null"
        }
      ]
    },
    "cancel_at_period_end": {
      "type": "boolean"
    },
    "canceled_at": {
      "anyOf": [
        {
          "type": "string",
          "format": "date-time"
        },
        {
          "type": "null"
        }
      ]
    },
    "auto_upgrade": {
      "type": "boolean"
    },
    "discount": {
      "anyOf": [
        {
          "type": "object",
          "properties": {
            "program": {
              "type": "string",
              "description": "nonprofit, education, open_source, open_source_free eller agency"
            },
            "status": {
              "type": "string",
              "description": "pending, approved (ännu inte på prenumerationen), active, rejected eller revoked"
            },
            "percent": {
              "anyOf": [
                {
                  "type": "integer",
                  "description": "Procent rabatt på Pro och Business (null för det kostnadsfria programmet för öppen källkod)"
                },
                {
                  "type": "null"
                }
              ]
            },
            "comp_events": {
              "anyOf": [
                {
                  "type": "integer",
                  "description": "Kostnadsfria händelser per månad (endast det kostnadsfria programmet för öppen källkod)"
                },
                {
                  "type": "null"
                }
              ]
            },
            "organization_name": {
              "type": "string",
              "description": "Namn på organisation, skola, projekt eller byrå"
            },
            "website": {
              "anyOf": [
                {
                  "type": "string",
                  "description": "Webbplats"
                },
                {
                  "type": "null"
                }
              ]
            },
            "proof_url": {
              "anyOf": [
                {
                  "type": "string",
                  "description": "Länk till intyg eller URL till kodförråd"
                },
                {
                  "type": "null"
                }
              ]
            },
            "license": {
              "anyOf": [
                {
                  "type": "string",
                  "description": "OSI-licens (öppen källkod)"
                },
                {
                  "type": "null"
                }
              ]
            },
            "note": {
              "anyOf": [
                {
                  "type": "string",
                  "description": "Anteckning till granskningen"
                },
                {
                  "type": "null"
                }
              ]
            },
            "rejection_reason": {
              "anyOf": [
                {
                  "type": "string",
                  "description": "Varför ansökan inte godkändes"
                },
                {
                  "type": "null"
                }
              ]
            },
            "created_at": {
              "type": "string",
              "format": "date-time",
              "description": "Ansökt"
            },
            "reviewed_at": {
              "anyOf": [
                {
                  "type": "string",
                  "format": "date-time",
                  "description": "Granskad"
                },
                {
                  "type": "null"
                }
              ]
            },
            "applied_at": {
              "anyOf": [
                {
                  "type": "string",
                  "format": "date-time",
                  "description": "Rabatten aktiv sedan"
                },
                {
                  "type": "null"
                }
              ]
            },
            "revoked_at": {
              "anyOf": [
                {
                  "type": "string",
                  "format": "date-time",
                  "description": "Programmet avslutat"
                },
                {
                  "type": "null"
                }
              ]
            }
          },
          "description": "Den senaste ansökan till ett rabattprogram, eller null"
        },
        {
          "type": "null"
        }
      ]
    },
    "discount_percent": {
      "anyOf": [
        {
          "type": "integer",
          "description": "Procent rabatt på Pro och Business från ett godkänt program, eller null"
        },
        {
          "type": "null"
        }
      ]
    },
    "billing_emails": {
      "type": "array",
      "items": {
        "type": "string"
      }
    },
    "tax_id": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ]
    },
    "badge": {
      "type": "object",
      "description": "Märkesbonus (gratisplanen)"
    },
    "usage": {
      "type": "object",
      "properties": {
        "month": {
          "type": "string",
          "format": "date",
          "description": "Första dagen i den rapporterade månaden"
        },
        "events": {
          "type": "integer",
          "description": "Debiterbara händelser (sidvisningar och egna händelser)"
        },
        "bots": {
          "type": "integer",
          "description": "Bottträffar som filtrerats bort (debiteras inte)"
        },
        "allowance": {
          "type": "integer",
          "description": "Händelser som ingår, inklusive eventuell märkesbonus"
        },
        "percent": {
          "type": "number",
          "description": "Händelser i procent av kvoten"
        },
        "forecast": {
          "anyOf": [
            {
              "type": "integer",
              "description": "Beräknat antal händelser vid månadens slut"
            },
            {
              "type": "null"
            }
          ]
        },
        "forecast_percent": {
          "anyOf": [
            {
              "type": "number"
            },
            {
              "type": "null"
            }
          ]
        },
        "days_left": {
          "type": "integer",
          "description": "Dagar kvar av månaden"
        },
        "status": {
          "type": "string",
          "description": "ok, warning (80%+), over (en tidigare månad på eller över kvoten), locked eller paused"
        },
        "sites": {
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "site_id": {
                "type": "string"
              },
              "domain": {
                "type": "string"
              },
              "name": {
                "type": "string"
              },
              "events": {
                "type": "integer",
                "description": "Sidvisningar och egna händelser den här månaden"
              },
              "share": {
                "type": "number",
                "description": "Procent av arbetsytans totala"
              }
            }
          },
          "description": "Händelser per webbplats"
        },
        "history": {
          "type": "array",
          "description": "Tidigare månader, nyast först"
        },
        "access_locked_at": {
          "anyOf": [
            {
              "type": "string",
              "format": "date-time",
              "description": "Instrumentpanelerna låsta av Privatus Analytics personal sedan"
            },
            {
              "type": "null"
            }
          ]
        },
        "collection_paused": {
          "type": "boolean",
          "description": "True medan nya händelser släpps (månadsgränsen är nådd, eller personalen har pausat insamlingen)"
        },
        "pause_reason": {
          "anyOf": [
            {
              "type": "string",
              "description": "Varför insamlingen är pausad: limit (månadskvoten är nådd) eller staff. null när insamling pågår"
            },
            {
              "type": "null"
            }
          ]
        },
        "collection_paused_at": {
          "anyOf": [
            {
              "type": "string",
              "format": "date-time",
              "description": "När personalen pausade insamlingen"
            },
            {
              "type": "null"
            }
          ]
        },
        "resumes_at": {
          "anyOf": [
            {
              "type": "string",
              "format": "date-time",
              "description": "När en gränspaus hävs: början av nästa månad (UTC), eller tidigare vid en uppgradering. Annars null"
            },
            {
              "type": "null"
            }
          ]
        }
      },
      "description": "Den här månaden hittills"
    }
  }
}
POST /workspaces/:workspace_id/billing/checkout.json Starta en Paddle-kassa för en betald plan billing_checkout

Behörighet: billing.manage

Exempel
curl -X POST https://privatusanalytics.com/workspaces/:workspace_id/billing/checkout.json \
  -H "Authorization: Bearer $PRIVATUS_TOKEN" \
  -H "Content-Type: application/json" -d '{…}'
Indata
{
  "type": "object",
  "properties": {
    "plan": {
      "type": "string",
      "description": "Plan att byta till: pro eller business",
      "enum": [
        "pro",
        "business"
      ]
    },
    "events": {
      "type": "integer",
      "description": "Händelser per månad för nivån, från GET /plans",
      "examples": [
        1000000
      ]
    },
    "interval": {
      "type": "string",
      "description": "Faktureringsintervall. Årsbetalning ger 2 månader gratis",
      "enum": [
        "month",
        "year"
      ],
      "default": "month"
    },
    "workspace_id": {
      "type": "string",
      "description": "Arbetsyte-id, t.ex. ws_7Q2K9XH3AB"
    }
  },
  "required": [
    "plan",
    "events",
    "workspace_id"
  ]
}
Svarsdata
{
  "type": "object",
  "properties": {
    "transaction_id": {
      "type": "string",
      "description": "Paddle-transaktions-id (txn_...)"
    },
    "url": {
      "anyOf": [
        {
          "type": "string",
          "description": "URL till värdbaserad kassa"
        },
        {
          "type": "null"
        }
      ]
    },
    "price_id": {
      "type": "string"
    },
    "plan": {
      "type": "string"
    },
    "events": {
      "type": "integer"
    },
    "interval": {
      "type": "string"
    },
    "amount": {
      "type": "integer",
      "description": "USD per intervall"
    },
    "client_token": {
      "anyOf": [
        {
          "type": "string",
          "description": "Klientsidetoken för Paddle.js"
        },
        {
          "type": "null"
        }
      ]
    },
    "environment": {
      "type": "string",
      "description": "sandbox eller production"
    },
    "custom_data": {
      "type": "object",
      "description": "Skickas till Paddle för att koppla prenumerationen"
    },
    "discount_id": {
      "anyOf": [
        {
          "type": "string",
          "description": "Paddle-rabatt-id för ett godkänt program, som tillämpas i den här kassan"
        },
        {
          "type": "null"
        }
      ]
    }
  }
}
POST /workspaces/:workspace_id/billing/discount.json Ansök om rabatt för ideella organisationer, utbildning eller öppen källkod billing_discount

Behörighet: billing.manage

Exempel
curl -X POST https://privatusanalytics.com/workspaces/:workspace_id/billing/discount.json \
  -H "Authorization: Bearer $PRIVATUS_TOKEN" \
  -H "Content-Type: application/json" -d '{…}'
Indata
{
  "type": "object",
  "properties": {
    "program": {
      "type": "string",
      "description": "nonprofit, education, open_source (50% rabatt), open_source_free (Pro gratis upp till 1M händelser per månad) eller agency (20% rabatt på varje arbetsyta du äger)",
      "enum": [
        "nonprofit",
        "education",
        "open_source",
        "open_source_free",
        "agency"
      ]
    },
    "organization_name": {
      "type": "string",
      "description": "Namn på organisationen, skolan, projektet eller byrån"
    },
    "website": {
      "type": "string",
      "description": "Dess webbplats"
    },
    "proof_url": {
      "type": "string",
      "description": "Länk till intyg. För öppen källkod, URL:en till kodförrådet"
    },
    "license": {
      "type": "string",
      "description": "Projektets OSI-licens (endast öppen källkod)"
    },
    "note": {
      "type": "string",
      "description": "Allt som underlättar granskningen, upp till 1 000 tecken"
    },
    "workspace_id": {
      "type": "string",
      "description": "Arbetsyte-id, t.ex. ws_7Q2K9XH3AB"
    }
  },
  "required": [
    "program",
    "organization_name",
    "workspace_id"
  ]
}
Svarsdata
{
  "type": "object",
  "properties": {
    "program": {
      "type": "string",
      "description": "nonprofit, education, open_source, open_source_free eller agency"
    },
    "status": {
      "type": "string",
      "description": "pending, approved (ännu inte på prenumerationen), active, rejected eller revoked"
    },
    "percent": {
      "anyOf": [
        {
          "type": "integer",
          "description": "Procent rabatt på Pro och Business (null för det kostnadsfria programmet för öppen källkod)"
        },
        {
          "type": "null"
        }
      ]
    },
    "comp_events": {
      "anyOf": [
        {
          "type": "integer",
          "description": "Kostnadsfria händelser per månad (endast det kostnadsfria programmet för öppen källkod)"
        },
        {
          "type": "null"
        }
      ]
    },
    "organization_name": {
      "type": "string",
      "description": "Namn på organisation, skola, projekt eller byrå"
    },
    "website": {
      "anyOf": [
        {
          "type": "string",
          "description": "Webbplats"
        },
        {
          "type": "null"
        }
      ]
    },
    "proof_url": {
      "anyOf": [
        {
          "type": "string",
          "description": "Länk till intyg eller URL till kodförråd"
        },
        {
          "type": "null"
        }
      ]
    },
    "license": {
      "anyOf": [
        {
          "type": "string",
          "description": "OSI-licens (öppen källkod)"
        },
        {
          "type": "null"
        }
      ]
    },
    "note": {
      "anyOf": [
        {
          "type": "string",
          "description": "Anteckning till granskningen"
        },
        {
          "type": "null"
        }
      ]
    },
    "rejection_reason": {
      "anyOf": [
        {
          "type": "string",
          "description": "Varför ansökan inte godkändes"
        },
        {
          "type": "null"
        }
      ]
    },
    "created_at": {
      "type": "string",
      "format": "date-time",
      "description": "Ansökt"
    },
    "reviewed_at": {
      "anyOf": [
        {
          "type": "string",
          "format": "date-time",
          "description": "Granskad"
        },
        {
          "type": "null"
        }
      ]
    },
    "applied_at": {
      "anyOf": [
        {
          "type": "string",
          "format": "date-time",
          "description": "Rabatten aktiv sedan"
        },
        {
          "type": "null"
        }
      ]
    },
    "revoked_at": {
      "anyOf": [
        {
          "type": "string",
          "format": "date-time",
          "description": "Programmet avslutat"
        },
        {
          "type": "null"
        }
      ]
    }
  }
}
POST /workspaces/:workspace_id/billing/payment_method.json Hämta en länk för att uppdatera betalningsmetoden billing_payment_method

Behörighet: billing.manage

Exempel
curl -X POST https://privatusanalytics.com/workspaces/:workspace_id/billing/payment_method.json \
  -H "Authorization: Bearer $PRIVATUS_TOKEN" \
  -H "Content-Type: application/json" -d '{…}'
Indata
{
  "type": "object",
  "properties": {
    "workspace_id": {
      "type": "string",
      "description": "Arbetsyte-id, t.ex. ws_7Q2K9XH3AB"
    }
  },
  "required": [
    "workspace_id"
  ]
}
Svarsdata
{
  "type": "object",
  "properties": {
    "kind": {
      "type": "string",
      "description": "portal, payment_method eller invoice"
    },
    "url": {
      "anyOf": [
        {
          "type": "string",
          "description": "Kortlivad Paddle-URL"
        },
        {
          "type": "null"
        }
      ]
    }
  }
}
POST /workspaces/:workspace_id/billing/portal.json Hämta en länk till Paddles kundportal billing_portal

Behörighet: billing.manage

Exempel
curl -X POST https://privatusanalytics.com/workspaces/:workspace_id/billing/portal.json \
  -H "Authorization: Bearer $PRIVATUS_TOKEN" \
  -H "Content-Type: application/json" -d '{…}'
Indata
{
  "type": "object",
  "properties": {
    "workspace_id": {
      "type": "string",
      "description": "Arbetsyte-id, t.ex. ws_7Q2K9XH3AB"
    }
  },
  "required": [
    "workspace_id"
  ]
}
Svarsdata
{
  "type": "object",
  "properties": {
    "kind": {
      "type": "string",
      "description": "portal, payment_method eller invoice"
    },
    "url": {
      "anyOf": [
        {
          "type": "string",
          "description": "Kortlivad Paddle-URL"
        },
        {
          "type": "null"
        }
      ]
    }
  }
}
GET /workspaces/:workspace_id/billing/preview.json Förhandsgranska ett planbyte med proportionering billing_preview

Behörighet: billing.manage

Exempel
curl https://privatusanalytics.com/workspaces/:workspace_id/billing/preview.json \
  -H "Authorization: Bearer $PRIVATUS_TOKEN"
Indata
{
  "type": "object",
  "properties": {
    "plan": {
      "type": "string",
      "description": "Plan att byta till: pro eller business",
      "enum": [
        "pro",
        "business"
      ]
    },
    "events": {
      "type": "integer",
      "description": "Händelser per månad för nivån, från GET /plans",
      "examples": [
        1000000
      ]
    },
    "interval": {
      "type": "string",
      "description": "Faktureringsintervall. Årsbetalning ger 2 månader gratis",
      "enum": [
        "month",
        "year"
      ],
      "default": "month"
    },
    "workspace_id": {
      "type": "string",
      "description": "Arbetsyte-id, t.ex. ws_7Q2K9XH3AB"
    }
  },
  "required": [
    "plan",
    "events",
    "workspace_id"
  ]
}
Svarsdata
{
  "type": "object",
  "properties": {
    "plan": {
      "type": "string"
    },
    "events": {
      "type": "integer"
    },
    "interval": {
      "type": "string"
    },
    "price_id": {
      "type": "string"
    },
    "amount": {
      "type": "integer",
      "description": "Nytt pris i USD per intervall"
    },
    "currency": {
      "type": "string"
    },
    "charge_minor": {
      "type": "integer",
      "description": "Debiteras nu, i minsta enhet"
    },
    "credit_minor": {
      "type": "integer",
      "description": "Kredit för oanvänd tid, minsta enhet"
    },
    "result_action": {
      "anyOf": [
        {
          "type": "string",
          "description": "charge eller credit"
        },
        {
          "type": "null"
        }
      ]
    },
    "result_minor": {
      "type": "integer",
      "description": "Nettodebitering eller kredit, minsta enhet"
    },
    "next_billed_at": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ]
    },
    "warnings": {
      "type": "array",
      "items": {
        "type": "string"
      },
      "description": "Användning eller gränser som den nya planen inte skulle täcka"
    }
  }
}
POST /workspaces/:workspace_id/billing/resume.json Ångra en schemalagd uppsägning eller återuppta en paus billing_resume

Behörighet: billing.manage

Exempel
curl -X POST https://privatusanalytics.com/workspaces/:workspace_id/billing/resume.json \
  -H "Authorization: Bearer $PRIVATUS_TOKEN" \
  -H "Content-Type: application/json" -d '{…}'
Indata
{
  "type": "object",
  "properties": {
    "workspace_id": {
      "type": "string",
      "description": "Arbetsyte-id, t.ex. ws_7Q2K9XH3AB"
    }
  },
  "required": [
    "workspace_id"
  ]
}
Svarsdata
{
  "type": "object",
  "properties": {
    "workspace_id": {
      "type": "string"
    },
    "plan": {
      "type": "string",
      "description": "free, pro, business eller enterprise"
    },
    "plan_events": {
      "type": "integer",
      "description": "Händelser per månad i den betalda nivån"
    },
    "allowance": {
      "type": "integer",
      "description": "Händelser per månad inklusive eventuell märkesbonus"
    },
    "billing_interval": {
      "anyOf": [
        {
          "type": "string",
          "description": "month eller year"
        },
        {
          "type": "null"
        }
      ]
    },
    "price": {
      "anyOf": [
        {
          "type": "integer",
          "description": "USD per faktureringsintervall"
        },
        {
          "type": "null"
        }
      ]
    },
    "subscription_status": {
      "type": "string",
      "description": "none, trialing, active, past_due, paused eller canceled"
    },
    "current_period_ends_at": {
      "anyOf": [
        {
          "type": "string",
          "format": "date-time",
          "description": "Förnyas eller slutar"
        },
        {
          "type": "null"
        }
      ]
    },
    "cancel_at_period_end": {
      "type": "boolean"
    },
    "canceled_at": {
      "anyOf": [
        {
          "type": "string",
          "format": "date-time"
        },
        {
          "type": "null"
        }
      ]
    },
    "auto_upgrade": {
      "type": "boolean"
    },
    "discount": {
      "anyOf": [
        {
          "type": "object",
          "properties": {
            "program": {
              "type": "string",
              "description": "nonprofit, education, open_source, open_source_free eller agency"
            },
            "status": {
              "type": "string",
              "description": "pending, approved (ännu inte på prenumerationen), active, rejected eller revoked"
            },
            "percent": {
              "anyOf": [
                {
                  "type": "integer",
                  "description": "Procent rabatt på Pro och Business (null för det kostnadsfria programmet för öppen källkod)"
                },
                {
                  "type": "null"
                }
              ]
            },
            "comp_events": {
              "anyOf": [
                {
                  "type": "integer",
                  "description": "Kostnadsfria händelser per månad (endast det kostnadsfria programmet för öppen källkod)"
                },
                {
                  "type": "null"
                }
              ]
            },
            "organization_name": {
              "type": "string",
              "description": "Namn på organisation, skola, projekt eller byrå"
            },
            "website": {
              "anyOf": [
                {
                  "type": "string",
                  "description": "Webbplats"
                },
                {
                  "type": "null"
                }
              ]
            },
            "proof_url": {
              "anyOf": [
                {
                  "type": "string",
                  "description": "Länk till intyg eller URL till kodförråd"
                },
                {
                  "type": "null"
                }
              ]
            },
            "license": {
              "anyOf": [
                {
                  "type": "string",
                  "description": "OSI-licens (öppen källkod)"
                },
                {
                  "type": "null"
                }
              ]
            },
            "note": {
              "anyOf": [
                {
                  "type": "string",
                  "description": "Anteckning till granskningen"
                },
                {
                  "type": "null"
                }
              ]
            },
            "rejection_reason": {
              "anyOf": [
                {
                  "type": "string",
                  "description": "Varför ansökan inte godkändes"
                },
                {
                  "type": "null"
                }
              ]
            },
            "created_at": {
              "type": "string",
              "format": "date-time",
              "description": "Ansökt"
            },
            "reviewed_at": {
              "anyOf": [
                {
                  "type": "string",
                  "format": "date-time",
                  "description": "Granskad"
                },
                {
                  "type": "null"
                }
              ]
            },
            "applied_at": {
              "anyOf": [
                {
                  "type": "string",
                  "format": "date-time",
                  "description": "Rabatten aktiv sedan"
                },
                {
                  "type": "null"
                }
              ]
            },
            "revoked_at": {
              "anyOf": [
                {
                  "type": "string",
                  "format": "date-time",
                  "description": "Programmet avslutat"
                },
                {
                  "type": "null"
                }
              ]
            }
          },
          "description": "Den senaste ansökan till ett rabattprogram, eller null"
        },
        {
          "type": "null"
        }
      ]
    },
    "discount_percent": {
      "anyOf": [
        {
          "type": "integer",
          "description": "Procent rabatt på Pro och Business från ett godkänt program, eller null"
        },
        {
          "type": "null"
        }
      ]
    },
    "billing_emails": {
      "type": "array",
      "items": {
        "type": "string"
      }
    },
    "tax_id": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ]
    },
    "badge": {
      "type": "object",
      "description": "Märkesbonus (gratisplanen)"
    },
    "usage": {
      "type": "object",
      "properties": {
        "month": {
          "type": "string",
          "format": "date",
          "description": "Första dagen i den rapporterade månaden"
        },
        "events": {
          "type": "integer",
          "description": "Debiterbara händelser (sidvisningar och egna händelser)"
        },
        "bots": {
          "type": "integer",
          "description": "Bottträffar som filtrerats bort (debiteras inte)"
        },
        "allowance": {
          "type": "integer",
          "description": "Händelser som ingår, inklusive eventuell märkesbonus"
        },
        "percent": {
          "type": "number",
          "description": "Händelser i procent av kvoten"
        },
        "forecast": {
          "anyOf": [
            {
              "type": "integer",
              "description": "Beräknat antal händelser vid månadens slut"
            },
            {
              "type": "null"
            }
          ]
        },
        "forecast_percent": {
          "anyOf": [
            {
              "type": "number"
            },
            {
              "type": "null"
            }
          ]
        },
        "days_left": {
          "type": "integer",
          "description": "Dagar kvar av månaden"
        },
        "status": {
          "type": "string",
          "description": "ok, warning (80%+), over (en tidigare månad på eller över kvoten), locked eller paused"
        },
        "sites": {
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "site_id": {
                "type": "string"
              },
              "domain": {
                "type": "string"
              },
              "name": {
                "type": "string"
              },
              "events": {
                "type": "integer",
                "description": "Sidvisningar och egna händelser den här månaden"
              },
              "share": {
                "type": "number",
                "description": "Procent av arbetsytans totala"
              }
            }
          },
          "description": "Händelser per webbplats"
        },
        "history": {
          "type": "array",
          "description": "Tidigare månader, nyast först"
        },
        "access_locked_at": {
          "anyOf": [
            {
              "type": "string",
              "format": "date-time",
              "description": "Instrumentpanelerna låsta av Privatus Analytics personal sedan"
            },
            {
              "type": "null"
            }
          ]
        },
        "collection_paused": {
          "type": "boolean",
          "description": "True medan nya händelser släpps (månadsgränsen är nådd, eller personalen har pausat insamlingen)"
        },
        "pause_reason": {
          "anyOf": [
            {
              "type": "string",
              "description": "Varför insamlingen är pausad: limit (månadskvoten är nådd) eller staff. null när insamling pågår"
            },
            {
              "type": "null"
            }
          ]
        },
        "collection_paused_at": {
          "anyOf": [
            {
              "type": "string",
              "format": "date-time",
              "description": "När personalen pausade insamlingen"
            },
            {
              "type": "null"
            }
          ]
        },
        "resumes_at": {
          "anyOf": [
            {
              "type": "string",
              "format": "date-time",
              "description": "När en gränspaus hävs: början av nästa månad (UTC), eller tidigare vid en uppgradering. Annars null"
            },
            {
              "type": "null"
            }
          ]
        }
      },
      "description": "Den här månaden hittills"
    }
  }
}
GET /workspaces/:workspace_id/billing.json Hämta planen, prenumerationen och användningen billing_get

Behörighet: billing.manage

Exempel
curl https://privatusanalytics.com/workspaces/:workspace_id/billing.json \
  -H "Authorization: Bearer $PRIVATUS_TOKEN"
Indata
{
  "type": "object",
  "properties": {
    "workspace_id": {
      "type": "string",
      "description": "Arbetsyte-id, t.ex. ws_7Q2K9XH3AB"
    }
  },
  "required": [
    "workspace_id"
  ]
}
Svarsdata
{
  "type": "object",
  "properties": {
    "workspace_id": {
      "type": "string"
    },
    "plan": {
      "type": "string",
      "description": "free, pro, business eller enterprise"
    },
    "plan_events": {
      "type": "integer",
      "description": "Händelser per månad i den betalda nivån"
    },
    "allowance": {
      "type": "integer",
      "description": "Händelser per månad inklusive eventuell märkesbonus"
    },
    "billing_interval": {
      "anyOf": [
        {
          "type": "string",
          "description": "month eller year"
        },
        {
          "type": "null"
        }
      ]
    },
    "price": {
      "anyOf": [
        {
          "type": "integer",
          "description": "USD per faktureringsintervall"
        },
        {
          "type": "null"
        }
      ]
    },
    "subscription_status": {
      "type": "string",
      "description": "none, trialing, active, past_due, paused eller canceled"
    },
    "current_period_ends_at": {
      "anyOf": [
        {
          "type": "string",
          "format": "date-time",
          "description": "Förnyas eller slutar"
        },
        {
          "type": "null"
        }
      ]
    },
    "cancel_at_period_end": {
      "type": "boolean"
    },
    "canceled_at": {
      "anyOf": [
        {
          "type": "string",
          "format": "date-time"
        },
        {
          "type": "null"
        }
      ]
    },
    "auto_upgrade": {
      "type": "boolean"
    },
    "discount": {
      "anyOf": [
        {
          "type": "object",
          "properties": {
            "program": {
              "type": "string",
              "description": "nonprofit, education, open_source, open_source_free eller agency"
            },
            "status": {
              "type": "string",
              "description": "pending, approved (ännu inte på prenumerationen), active, rejected eller revoked"
            },
            "percent": {
              "anyOf": [
                {
                  "type": "integer",
                  "description": "Procent rabatt på Pro och Business (null för det kostnadsfria programmet för öppen källkod)"
                },
                {
                  "type": "null"
                }
              ]
            },
            "comp_events": {
              "anyOf": [
                {
                  "type": "integer",
                  "description": "Kostnadsfria händelser per månad (endast det kostnadsfria programmet för öppen källkod)"
                },
                {
                  "type": "null"
                }
              ]
            },
            "organization_name": {
              "type": "string",
              "description": "Namn på organisation, skola, projekt eller byrå"
            },
            "website": {
              "anyOf": [
                {
                  "type": "string",
                  "description": "Webbplats"
                },
                {
                  "type": "null"
                }
              ]
            },
            "proof_url": {
              "anyOf": [
                {
                  "type": "string",
                  "description": "Länk till intyg eller URL till kodförråd"
                },
                {
                  "type": "null"
                }
              ]
            },
            "license": {
              "anyOf": [
                {
                  "type": "string",
                  "description": "OSI-licens (öppen källkod)"
                },
                {
                  "type": "null"
                }
              ]
            },
            "note": {
              "anyOf": [
                {
                  "type": "string",
                  "description": "Anteckning till granskningen"
                },
                {
                  "type": "null"
                }
              ]
            },
            "rejection_reason": {
              "anyOf": [
                {
                  "type": "string",
                  "description": "Varför ansökan inte godkändes"
                },
                {
                  "type": "null"
                }
              ]
            },
            "created_at": {
              "type": "string",
              "format": "date-time",
              "description": "Ansökt"
            },
            "reviewed_at": {
              "anyOf": [
                {
                  "type": "string",
                  "format": "date-time",
                  "description": "Granskad"
                },
                {
                  "type": "null"
                }
              ]
            },
            "applied_at": {
              "anyOf": [
                {
                  "type": "string",
                  "format": "date-time",
                  "description": "Rabatten aktiv sedan"
                },
                {
                  "type": "null"
                }
              ]
            },
            "revoked_at": {
              "anyOf": [
                {
                  "type": "string",
                  "format": "date-time",
                  "description": "Programmet avslutat"
                },
                {
                  "type": "null"
                }
              ]
            }
          },
          "description": "Den senaste ansökan till ett rabattprogram, eller null"
        },
        {
          "type": "null"
        }
      ]
    },
    "discount_percent": {
      "anyOf": [
        {
          "type": "integer",
          "description": "Procent rabatt på Pro och Business från ett godkänt program, eller null"
        },
        {
          "type": "null"
        }
      ]
    },
    "billing_emails": {
      "type": "array",
      "items": {
        "type": "string"
      }
    },
    "tax_id": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ]
    },
    "badge": {
      "type": "object",
      "description": "Märkesbonus (gratisplanen)"
    },
    "usage": {
      "type": "object",
      "properties": {
        "month": {
          "type": "string",
          "format": "date",
          "description": "Första dagen i den rapporterade månaden"
        },
        "events": {
          "type": "integer",
          "description": "Debiterbara händelser (sidvisningar och egna händelser)"
        },
        "bots": {
          "type": "integer",
          "description": "Bottträffar som filtrerats bort (debiteras inte)"
        },
        "allowance": {
          "type": "integer",
          "description": "Händelser som ingår, inklusive eventuell märkesbonus"
        },
        "percent": {
          "type": "number",
          "description": "Händelser i procent av kvoten"
        },
        "forecast": {
          "anyOf": [
            {
              "type": "integer",
              "description": "Beräknat antal händelser vid månadens slut"
            },
            {
              "type": "null"
            }
          ]
        },
        "forecast_percent": {
          "anyOf": [
            {
              "type": "number"
            },
            {
              "type": "null"
            }
          ]
        },
        "days_left": {
          "type": "integer",
          "description": "Dagar kvar av månaden"
        },
        "status": {
          "type": "string",
          "description": "ok, warning (80%+), over (en tidigare månad på eller över kvoten), locked eller paused"
        },
        "sites": {
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "site_id": {
                "type": "string"
              },
              "domain": {
                "type": "string"
              },
              "name": {
                "type": "string"
              },
              "events": {
                "type": "integer",
                "description": "Sidvisningar och egna händelser den här månaden"
              },
              "share": {
                "type": "number",
                "description": "Procent av arbetsytans totala"
              }
            }
          },
          "description": "Händelser per webbplats"
        },
        "history": {
          "type": "array",
          "description": "Tidigare månader, nyast först"
        },
        "access_locked_at": {
          "anyOf": [
            {
              "type": "string",
              "format": "date-time",
              "description": "Instrumentpanelerna låsta av Privatus Analytics personal sedan"
            },
            {
              "type": "null"
            }
          ]
        },
        "collection_paused": {
          "type": "boolean",
          "description": "True medan nya händelser släpps (månadsgränsen är nådd, eller personalen har pausat insamlingen)"
        },
        "pause_reason": {
          "anyOf": [
            {
              "type": "string",
              "description": "Varför insamlingen är pausad: limit (månadskvoten är nådd) eller staff. null när insamling pågår"
            },
            {
              "type": "null"
            }
          ]
        },
        "collection_paused_at": {
          "anyOf": [
            {
              "type": "string",
              "format": "date-time",
              "description": "När personalen pausade insamlingen"
            },
            {
              "type": "null"
            }
          ]
        },
        "resumes_at": {
          "anyOf": [
            {
              "type": "string",
              "format": "date-time",
              "description": "När en gränspaus hävs: början av nästa månad (UTC), eller tidigare vid en uppgradering. Annars null"
            },
            {
              "type": "null"
            }
          ]
        }
      },
      "description": "Den här månaden hittills"
    }
  }
}
PATCH /workspaces/:workspace_id/billing.json Uppdatera faktureringsmejl, momsnummer och automatisk uppgradering billing_update

Behörighet: billing.manage

Exempel
curl -X PATCH https://privatusanalytics.com/workspaces/:workspace_id/billing.json \
  -H "Authorization: Bearer $PRIVATUS_TOKEN" \
  -H "Content-Type: application/json" -d '{…}'
Indata
{
  "type": "object",
  "properties": {
    "billing_emails": {
      "type": "array",
      "items": {
        "type": "string"
      },
      "description": "Extra adresser för fakturor och faktureringsmeddelanden (upp till 5)"
    },
    "tax_id": {
      "type": "string",
      "description": "Moms-/skatte-id som visas på fakturor"
    },
    "auto_upgrade": {
      "type": "boolean",
      "description": "true för att gå till nästa nivå och debitera mellanskillnaden när månadsgränsen nås, i stället för att pausa insamlingen. Av som standard"
    },
    "workspace_id": {
      "type": "string",
      "description": "Arbetsyte-id, t.ex. ws_7Q2K9XH3AB"
    }
  },
  "required": [
    "workspace_id"
  ]
}
Svarsdata
{
  "type": "object",
  "properties": {
    "workspace_id": {
      "type": "string"
    },
    "plan": {
      "type": "string",
      "description": "free, pro, business eller enterprise"
    },
    "plan_events": {
      "type": "integer",
      "description": "Händelser per månad i den betalda nivån"
    },
    "allowance": {
      "type": "integer",
      "description": "Händelser per månad inklusive eventuell märkesbonus"
    },
    "billing_interval": {
      "anyOf": [
        {
          "type": "string",
          "description": "month eller year"
        },
        {
          "type": "null"
        }
      ]
    },
    "price": {
      "anyOf": [
        {
          "type": "integer",
          "description": "USD per faktureringsintervall"
        },
        {
          "type": "null"
        }
      ]
    },
    "subscription_status": {
      "type": "string",
      "description": "none, trialing, active, past_due, paused eller canceled"
    },
    "current_period_ends_at": {
      "anyOf": [
        {
          "type": "string",
          "format": "date-time",
          "description": "Förnyas eller slutar"
        },
        {
          "type": "null"
        }
      ]
    },
    "cancel_at_period_end": {
      "type": "boolean"
    },
    "canceled_at": {
      "anyOf": [
        {
          "type": "string",
          "format": "date-time"
        },
        {
          "type": "null"
        }
      ]
    },
    "auto_upgrade": {
      "type": "boolean"
    },
    "discount": {
      "anyOf": [
        {
          "type": "object",
          "properties": {
            "program": {
              "type": "string",
              "description": "nonprofit, education, open_source, open_source_free eller agency"
            },
            "status": {
              "type": "string",
              "description": "pending, approved (ännu inte på prenumerationen), active, rejected eller revoked"
            },
            "percent": {
              "anyOf": [
                {
                  "type": "integer",
                  "description": "Procent rabatt på Pro och Business (null för det kostnadsfria programmet för öppen källkod)"
                },
                {
                  "type": "null"
                }
              ]
            },
            "comp_events": {
              "anyOf": [
                {
                  "type": "integer",
                  "description": "Kostnadsfria händelser per månad (endast det kostnadsfria programmet för öppen källkod)"
                },
                {
                  "type": "null"
                }
              ]
            },
            "organization_name": {
              "type": "string",
              "description": "Namn på organisation, skola, projekt eller byrå"
            },
            "website": {
              "anyOf": [
                {
                  "type": "string",
                  "description": "Webbplats"
                },
                {
                  "type": "null"
                }
              ]
            },
            "proof_url": {
              "anyOf": [
                {
                  "type": "string",
                  "description": "Länk till intyg eller URL till kodförråd"
                },
                {
                  "type": "null"
                }
              ]
            },
            "license": {
              "anyOf": [
                {
                  "type": "string",
                  "description": "OSI-licens (öppen källkod)"
                },
                {
                  "type": "null"
                }
              ]
            },
            "note": {
              "anyOf": [
                {
                  "type": "string",
                  "description": "Anteckning till granskningen"
                },
                {
                  "type": "null"
                }
              ]
            },
            "rejection_reason": {
              "anyOf": [
                {
                  "type": "string",
                  "description": "Varför ansökan inte godkändes"
                },
                {
                  "type": "null"
                }
              ]
            },
            "created_at": {
              "type": "string",
              "format": "date-time",
              "description": "Ansökt"
            },
            "reviewed_at": {
              "anyOf": [
                {
                  "type": "string",
                  "format": "date-time",
                  "description": "Granskad"
                },
                {
                  "type": "null"
                }
              ]
            },
            "applied_at": {
              "anyOf": [
                {
                  "type": "string",
                  "format": "date-time",
                  "description": "Rabatten aktiv sedan"
                },
                {
                  "type": "null"
                }
              ]
            },
            "revoked_at": {
              "anyOf": [
                {
                  "type": "string",
                  "format": "date-time",
                  "description": "Programmet avslutat"
                },
                {
                  "type": "null"
                }
              ]
            }
          },
          "description": "Den senaste ansökan till ett rabattprogram, eller null"
        },
        {
          "type": "null"
        }
      ]
    },
    "discount_percent": {
      "anyOf": [
        {
          "type": "integer",
          "description": "Procent rabatt på Pro och Business från ett godkänt program, eller null"
        },
        {
          "type": "null"
        }
      ]
    },
    "billing_emails": {
      "type": "array",
      "items": {
        "type": "string"
      }
    },
    "tax_id": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ]
    },
    "badge": {
      "type": "object",
      "description": "Märkesbonus (gratisplanen)"
    },
    "usage": {
      "type": "object",
      "properties": {
        "month": {
          "type": "string",
          "format": "date",
          "description": "Första dagen i den rapporterade månaden"
        },
        "events": {
          "type": "integer",
          "description": "Debiterbara händelser (sidvisningar och egna händelser)"
        },
        "bots": {
          "type": "integer",
          "description": "Bottträffar som filtrerats bort (debiteras inte)"
        },
        "allowance": {
          "type": "integer",
          "description": "Händelser som ingår, inklusive eventuell märkesbonus"
        },
        "percent": {
          "type": "number",
          "description": "Händelser i procent av kvoten"
        },
        "forecast": {
          "anyOf": [
            {
              "type": "integer",
              "description": "Beräknat antal händelser vid månadens slut"
            },
            {
              "type": "null"
            }
          ]
        },
        "forecast_percent": {
          "anyOf": [
            {
              "type": "number"
            },
            {
              "type": "null"
            }
          ]
        },
        "days_left": {
          "type": "integer",
          "description": "Dagar kvar av månaden"
        },
        "status": {
          "type": "string",
          "description": "ok, warning (80%+), over (en tidigare månad på eller över kvoten), locked eller paused"
        },
        "sites": {
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "site_id": {
                "type": "string"
              },
              "domain": {
                "type": "string"
              },
              "name": {
                "type": "string"
              },
              "events": {
                "type": "integer",
                "description": "Sidvisningar och egna händelser den här månaden"
              },
              "share": {
                "type": "number",
                "description": "Procent av arbetsytans totala"
              }
            }
          },
          "description": "Händelser per webbplats"
        },
        "history": {
          "type": "array",
          "description": "Tidigare månader, nyast först"
        },
        "access_locked_at": {
          "anyOf": [
            {
              "type": "string",
              "format": "date-time",
              "description": "Instrumentpanelerna låsta av Privatus Analytics personal sedan"
            },
            {
              "type": "null"
            }
          ]
        },
        "collection_paused": {
          "type": "boolean",
          "description": "True medan nya händelser släpps (månadsgränsen är nådd, eller personalen har pausat insamlingen)"
        },
        "pause_reason": {
          "anyOf": [
            {
              "type": "string",
              "description": "Varför insamlingen är pausad: limit (månadskvoten är nådd) eller staff. null när insamling pågår"
            },
            {
              "type": "null"
            }
          ]
        },
        "collection_paused_at": {
          "anyOf": [
            {
              "type": "string",
              "format": "date-time",
              "description": "När personalen pausade insamlingen"
            },
            {
              "type": "null"
            }
          ]
        },
        "resumes_at": {
          "anyOf": [
            {
              "type": "string",
              "format": "date-time",
              "description": "När en gränspaus hävs: början av nästa månad (UTC), eller tidigare vid en uppgradering. Annars null"
            },
            {
              "type": "null"
            }
          ]
        }
      },
      "description": "Den här månaden hittills"
    }
  }
}
GET /workspaces/:workspace_id/billing/usage.json Hämta den här månadens användning, prognos och fördelning per webbplats billing_usage

Behörighet: billing.manage

Exempel
curl https://privatusanalytics.com/workspaces/:workspace_id/billing/usage.json \
  -H "Authorization: Bearer $PRIVATUS_TOKEN"
Indata
{
  "type": "object",
  "properties": {
    "month": {
      "type": "string",
      "format": "date",
      "description": "Valfri dag i månaden som ska rapporteras (standard är den här månaden)",
      "examples": [
        "2026-09-01"
      ]
    },
    "workspace_id": {
      "type": "string",
      "description": "Arbetsyte-id, t.ex. ws_7Q2K9XH3AB"
    }
  },
  "required": [
    "workspace_id"
  ]
}
Svarsdata
{
  "type": "object",
  "properties": {
    "month": {
      "type": "string",
      "format": "date",
      "description": "Första dagen i den rapporterade månaden"
    },
    "events": {
      "type": "integer",
      "description": "Debiterbara händelser (sidvisningar och egna händelser)"
    },
    "bots": {
      "type": "integer",
      "description": "Bottträffar som filtrerats bort (debiteras inte)"
    },
    "allowance": {
      "type": "integer",
      "description": "Händelser som ingår, inklusive eventuell märkesbonus"
    },
    "percent": {
      "type": "number",
      "description": "Händelser i procent av kvoten"
    },
    "forecast": {
      "anyOf": [
        {
          "type": "integer",
          "description": "Beräknat antal händelser vid månadens slut"
        },
        {
          "type": "null"
        }
      ]
    },
    "forecast_percent": {
      "anyOf": [
        {
          "type": "number"
        },
        {
          "type": "null"
        }
      ]
    },
    "days_left": {
      "type": "integer",
      "description": "Dagar kvar av månaden"
    },
    "status": {
      "type": "string",
      "description": "ok, warning (80%+), over (en tidigare månad på eller över kvoten), locked eller paused"
    },
    "sites": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "site_id": {
            "type": "string"
          },
          "domain": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "events": {
            "type": "integer",
            "description": "Sidvisningar och egna händelser den här månaden"
          },
          "share": {
            "type": "number",
            "description": "Procent av arbetsytans totala"
          }
        }
      },
      "description": "Händelser per webbplats"
    },
    "history": {
      "type": "array",
      "description": "Tidigare månader, nyast först"
    },
    "access_locked_at": {
      "anyOf": [
        {
          "type": "string",
          "format": "date-time",
          "description": "Instrumentpanelerna låsta av Privatus Analytics personal sedan"
        },
        {
          "type": "null"
        }
      ]
    },
    "collection_paused": {
      "type": "boolean",
      "description": "True medan nya händelser släpps (månadsgränsen är nådd, eller personalen har pausat insamlingen)"
    },
    "pause_reason": {
      "anyOf": [
        {
          "type": "string",
          "description": "Varför insamlingen är pausad: limit (månadskvoten är nådd) eller staff. null när insamling pågår"
        },
        {
          "type": "null"
        }
      ]
    },
    "collection_paused_at": {
      "anyOf": [
        {
          "type": "string",
          "format": "date-time",
          "description": "När personalen pausade insamlingen"
        },
        {
          "type": "null"
        }
      ]
    },
    "resumes_at": {
      "anyOf": [
        {
          "type": "string",
          "format": "date-time",
          "description": "När en gränspaus hävs: början av nästa månad (UTC), eller tidigare vid en uppgradering. Annars null"
        },
        {
          "type": "null"
        }
      ]
    }
  }
}
GET /workspaces/:workspace_id/billing/invoices.json Lista fakturor billing_invoices_list

Behörighet: billing.manage

Exempel
curl https://privatusanalytics.com/workspaces/:workspace_id/billing/invoices.json \
  -H "Authorization: Bearer $PRIVATUS_TOKEN"
Indata
{
  "type": "object",
  "properties": {
    "workspace_id": {
      "type": "string",
      "description": "Arbetsyte-id, t.ex. ws_7Q2K9XH3AB"
    },
    "page": {
      "type": "integer",
      "description": "Sida (från 1)"
    },
    "per_page": {
      "type": "integer",
      "description": "Resultat per sida (max 100)"
    }
  },
  "required": [
    "workspace_id"
  ]
}
Svarsdata
{
  "type": "array",
  "items": {
    "type": "object",
    "properties": {
      "id": {
        "type": "string",
        "description": "Paddle-transaktions-id"
      },
      "invoice_number": {
        "anyOf": [
          {
            "type": "string"
          },
          {
            "type": "null"
          }
        ]
      },
      "status": {
        "type": "string",
        "description": "paid, completed, payment_failed, ..."
      },
      "amount_minor": {
        "type": "integer",
        "description": "Totalt i minsta enhet (cent)"
      },
      "currency": {
        "type": "string"
      },
      "billed_at": {
        "anyOf": [
          {
            "type": "string",
            "format": "date-time"
          },
          {
            "type": "null"
          }
        ]
      }
    }
  }
}
GET /workspaces/:workspace_id/billing/invoices/:id.json Hämta PDF-länken för en faktura billing_invoices_get

Behörighet: billing.manage

Exempel
curl https://privatusanalytics.com/workspaces/:workspace_id/billing/invoices/:id.json \
  -H "Authorization: Bearer $PRIVATUS_TOKEN"
Indata
{
  "type": "object",
  "properties": {
    "workspace_id": {
      "type": "string",
      "description": "Arbetsyte-id, t.ex. ws_7Q2K9XH3AB"
    },
    "id": {
      "type": "string",
      "description": "Id för resursen"
    }
  },
  "required": [
    "workspace_id",
    "id"
  ]
}
Svarsdata
{
  "type": "object",
  "properties": {
    "kind": {
      "type": "string",
      "description": "portal, payment_method eller invoice"
    },
    "url": {
      "anyOf": [
        {
          "type": "string",
          "description": "Kortlivad Paddle-URL"
        },
        {
          "type": "null"
        }
      ]
    }
  }
}

Granskningslogg

GET /workspaces/:workspace_id/audit_log.json Lista poster i granskningsloggen (lägg till .csv för att exportera) audit_logs_get

Behörighet: workspace.manage

Exempel
curl https://privatusanalytics.com/workspaces/:workspace_id/audit_log.json \
  -H "Authorization: Bearer $PRIVATUS_TOKEN"
Indata
{
  "type": "object",
  "properties": {
    "actor": {
      "type": "string",
      "description": "Endast ändringar av den här medlemmen (e-post)"
    },
    "item_type": {
      "type": "string",
      "description": "Endast den här typen av post, t.ex. Site"
    },
    "event": {
      "type": "string",
      "description": "Endast den här åtgärden",
      "enum": [
        "create",
        "update",
        "destroy"
      ]
    },
    "from": {
      "type": "string",
      "format": "date",
      "description": "Från datum (inklusive)"
    },
    "to": {
      "type": "string",
      "format": "date",
      "description": "Till datum (inklusive)"
    },
    "workspace_id": {
      "type": "string",
      "description": "Arbetsyte-id, t.ex. ws_7Q2K9XH3AB"
    },
    "page": {
      "type": "integer",
      "description": "Sida (från 1)"
    },
    "per_page": {
      "type": "integer",
      "description": "Resultat per sida (max 100)"
    }
  },
  "required": [
    "workspace_id"
  ]
}
Svarsdata
{
  "type": "array",
  "items": {
    "type": "object",
    "properties": {
      "id": {
        "type": "string",
        "format": "uuid"
      },
      "created_at": {
        "type": "string",
        "format": "date-time",
        "description": "När"
      },
      "event": {
        "type": "string",
        "description": "create, update eller destroy"
      },
      "item_type": {
        "type": "string",
        "description": "Typ av post, t.ex. Site"
      },
      "item_id": {
        "type": "string",
        "format": "uuid"
      },
      "target": {
        "type": "string",
        "description": "Posten, med namn där det är känt"
      },
      "actor_email": {
        "anyOf": [
          {
            "type": "string",
            "description": "Medlem som gjorde ändringen"
          },
          {
            "type": "null"
          }
        ]
      },
      "actor_name": {
        "type": "string"
      },
      "token_name": {
        "anyOf": [
          {
            "type": "string",
            "description": "API-token som användes, om någon"
          },
          {
            "type": "null"
          }
        ]
      },
      "changes": {
        "type": "object",
        "description": "Ändrade fält: { field: [before, after] }"
      },
      "ip": {
        "anyOf": [
          {
            "type": "string",
            "description": "Medlemmens IP-adress"
          },
          {
            "type": "null"
          }
        ]
      }
    }
  }
}

Hjälp och feedback

POST /help.json Skicka en fråga eller feedback till teamet på Privatus Analytics support_message_send

Meddelandet mejlas till teamet med uppgifter om ditt konto, din arbetsyta och din plan bifogade. Svaret och ett kvitto skickas till ditt kontos e-postadress. Högst 10 meddelanden per dag.

Behörighet: member

Exempel
curl -X POST https://privatusanalytics.com/help.json \
  -H "Authorization: Bearer $PRIVATUS_TOKEN" \
  -H "Content-Type: application/json" -d '{…}'
Indata
{
  "type": "object",
  "properties": {
    "subject": {
      "type": "string",
      "description": "Vad meddelandet gäller (högst 150 tecken)",
      "examples": [
        "Funnel shows no data"
      ]
    },
    "message": {
      "type": "string",
      "description": "Din fråga eller feedback (10 till 5 000 tecken)"
    }
  },
  "required": [
    "subject",
    "message"
  ]
}
Svarsdata
{
  "type": "object",
  "properties": {
    "received": {
      "type": "boolean",
      "description": "Alltid true när inlämningen accepterades"
    },
    "message": {
      "type": "string",
      "description": "Vad som händer härnäst"
    }
  }
}

Händelser

GET /sites/:site_id/events/properties.json Lista nycklar för händelseegenskaper som setts de senaste 30 dagarna event_properties_list

Behörighet: analytics.read

Exempel
curl https://privatusanalytics.com/sites/:site_id/events/properties.json \
  -H "Authorization: Bearer $PRIVATUS_TOKEN"
Indata
{
  "type": "object",
  "properties": {
    "event": {
      "type": "string",
      "description": "Endast nycklar som setts på det här råa händelsenamnet"
    },
    "site_id": {
      "type": "string",
      "description": "Webbplats-id, t.ex. pa_7Q2K9XH3AB"
    }
  },
  "required": [
    "site_id"
  ]
}
Svarsdata
{
  "type": "object"
}
PATCH /sites/:site_id/events/properties.json Byt namn på eller dölj en nyckel för en händelseegenskap event_properties_update

Behörighet: sites.manage

Exempel
curl -X PATCH https://privatusanalytics.com/sites/:site_id/events/properties.json \
  -H "Authorization: Bearer $PRIVATUS_TOKEN" \
  -H "Content-Type: application/json" -d '{…}'
Indata
{
  "type": "object",
  "properties": {
    "key": {
      "type": "string",
      "description": "Egenskapsnyckel som den är lagrad, t.ex. plan"
    },
    "display_name": {
      "type": "string",
      "description": "Etikett att visa istället (tomt tar bort den)"
    },
    "hidden": {
      "type": "boolean",
      "description": "Dölj den här nyckeln i rapporter"
    },
    "export_safe": {
      "type": "boolean",
      "description": "Nyckeln innehåller inga personuppgifter, så den ingår i råexporter och datalagersynkningar"
    },
    "site_id": {
      "type": "string",
      "description": "Webbplats-id, t.ex. pa_7Q2K9XH3AB"
    }
  },
  "required": [
    "key",
    "site_id"
  ]
}
Svarsdata
{
  "type": "object"
}
DELETE /sites/:site_id/events.json Ta bort en händelse och dess historik (körs i bakgrunden, bekräfta genom att skriva namnet) events_delete

Behörighet: sites.manage

Exempel
curl -X DELETE https://privatusanalytics.com/sites/:site_id/events.json \
  -H "Authorization: Bearer $PRIVATUS_TOKEN" \
  -H "Content-Type: application/json" -d '{…}'
Indata
{
  "type": "object",
  "properties": {
    "name": {
      "type": "string",
      "description": "Råa händelsenamnet att ta bort"
    },
    "confirm": {
      "type": "string",
      "description": "Skriv händelsenamnet igen för att bekräfta"
    },
    "site_id": {
      "type": "string",
      "description": "Webbplats-id, t.ex. pa_7Q2K9XH3AB"
    }
  },
  "required": [
    "name",
    "confirm",
    "site_id"
  ]
}
Svarsdata
{
  "type": "object"
}
GET /sites/:site_id/events.json Lista händelser med slutföranden, besök, konverteringsgrad och första/sista gången de sågs events_list

Behörighet: analytics.read

Exempel
curl https://privatusanalytics.com/sites/:site_id/events.json \
  -H "Authorization: Bearer $PRIVATUS_TOKEN"
Indata
{
  "type": "object",
  "properties": {
    "period": {
      "type": "string",
      "description": "Förinställt datumintervall. Använd custom med from/to",
      "enum": [
        "today",
        "yesterday",
        "24h",
        "7d",
        "14d",
        "28d",
        "30d",
        "90d",
        "mtd",
        "last_month",
        "qtd",
        "last_quarter",
        "ytd",
        "12mo",
        "last_year",
        "all",
        "custom"
      ],
      "default": "30d"
    },
    "from": {
      "type": "string",
      "format": "date",
      "description": "Start för eget intervall (webbplatsens tidszon)"
    },
    "to": {
      "type": "string",
      "format": "date",
      "description": "Slut för eget intervall, inklusive"
    },
    "compare": {
      "type": "string",
      "description": "Jämförelseperiod",
      "enum": [
        "none",
        "previous_period",
        "previous_year",
        "custom"
      ],
      "default": "none"
    },
    "compare_from": {
      "type": "string",
      "format": "date",
      "description": "Start för egen jämförelse"
    },
    "compare_to": {
      "type": "string",
      "format": "date",
      "description": "Slut för egen jämförelse"
    },
    "match_weekday": {
      "type": "boolean",
      "description": "Justera jämförelsedagarna efter veckodag",
      "default": false
    },
    "filters": {
      "type": "array",
      "items": {},
      "description": "Filter: [[\"dimension\",\"operator\",\"value\"], …]. Operatorer: is, is_not, any_of, none_of, contains, not_contains, starts_with, regex, not_regex, gt, lt, between. Omslut villkor med {\"any\": [...]} för ELLER.",
      "default": []
    },
    "segment_id": {
      "type": "string",
      "description": "Tillämpa ett sparat segment (seg_…)"
    },
    "include_imported": {
      "type": "boolean",
      "description": "Lägg till importerade historiska data (datum före den första inbyggda händelsen, ignoreras när filter eller ett segment tillämpas)",
      "default": false
    },
    "search": {
      "type": "string",
      "description": "Endast händelser vars namn innehåller detta"
    },
    "site_id": {
      "type": "string",
      "description": "Webbplats-id, t.ex. pa_7Q2K9XH3AB"
    }
  },
  "required": [
    "site_id"
  ]
}
Svarsdata
{
  "type": "object"
}
POST /sites/:site_id/events/merge.json Slå ihop flera händelser under ett visningsnamn events_merge

Behörighet: sites.manage

Exempel
curl -X POST https://privatusanalytics.com/sites/:site_id/events/merge.json \
  -H "Authorization: Bearer $PRIVATUS_TOKEN" \
  -H "Content-Type: application/json" -d '{…}'
Indata
{
  "type": "object",
  "properties": {
    "names": {
      "type": "array",
      "items": {
        "type": "string"
      },
      "description": "Råa händelsenamn att slå ihop"
    },
    "into": {
      "type": "string",
      "description": "Visningsnamn för den sammanslagna händelsen",
      "examples": [
        "Signup"
      ]
    },
    "site_id": {
      "type": "string",
      "description": "Webbplats-id, t.ex. pa_7Q2K9XH3AB"
    }
  },
  "required": [
    "names",
    "into",
    "site_id"
  ]
}
Svarsdata
{
  "type": "object",
  "properties": {
    "name": {
      "type": "string",
      "description": "Råa händelsenamnet som trackern skickade"
    },
    "display_name": {
      "anyOf": [
        {
          "type": "string",
          "description": "Namn som visas i rapporter"
        },
        {
          "type": "null"
        }
      ]
    },
    "hidden": {
      "type": "boolean",
      "description": "Dold i rapporter"
    },
    "currency": {
      "anyOf": [
        {
          "type": "string",
          "description": "Intäktsvaluta"
        },
        {
          "type": "null"
        }
      ]
    },
    "updated_at": {
      "type": "string",
      "format": "date-time"
    }
  }
}
GET /sites/:site_id/events/detail.json En händelse: diagram, egenskapspivot, aggregat för numeriska egenskaper, sidor och källor events_get

Behörighet: analytics.read

Exempel
curl https://privatusanalytics.com/sites/:site_id/events/detail.json \
  -H "Authorization: Bearer $PRIVATUS_TOKEN"
Indata
{
  "type": "object",
  "properties": {
    "period": {
      "type": "string",
      "description": "Förinställt datumintervall. Använd custom med from/to",
      "enum": [
        "today",
        "yesterday",
        "24h",
        "7d",
        "14d",
        "28d",
        "30d",
        "90d",
        "mtd",
        "last_month",
        "qtd",
        "last_quarter",
        "ytd",
        "12mo",
        "last_year",
        "all",
        "custom"
      ],
      "default": "30d"
    },
    "from": {
      "type": "string",
      "format": "date",
      "description": "Start för eget intervall (webbplatsens tidszon)"
    },
    "to": {
      "type": "string",
      "format": "date",
      "description": "Slut för eget intervall, inklusive"
    },
    "compare": {
      "type": "string",
      "description": "Jämförelseperiod",
      "enum": [
        "none",
        "previous_period",
        "previous_year",
        "custom"
      ],
      "default": "none"
    },
    "compare_from": {
      "type": "string",
      "format": "date",
      "description": "Start för egen jämförelse"
    },
    "compare_to": {
      "type": "string",
      "format": "date",
      "description": "Slut för egen jämförelse"
    },
    "match_weekday": {
      "type": "boolean",
      "description": "Justera jämförelsedagarna efter veckodag",
      "default": false
    },
    "filters": {
      "type": "array",
      "items": {},
      "description": "Filter: [[\"dimension\",\"operator\",\"value\"], …]. Operatorer: is, is_not, any_of, none_of, contains, not_contains, starts_with, regex, not_regex, gt, lt, between. Omslut villkor med {\"any\": [...]} för ELLER.",
      "default": []
    },
    "segment_id": {
      "type": "string",
      "description": "Tillämpa ett sparat segment (seg_…)"
    },
    "include_imported": {
      "type": "boolean",
      "description": "Lägg till importerade historiska data (datum före den första inbyggda händelsen, ignoreras när filter eller ett segment tillämpas)",
      "default": false
    },
    "name": {
      "type": "string",
      "description": "Händelsenamn som det visas (efter namnbyten)",
      "examples": [
        "Signup"
      ]
    },
    "properties": {
      "type": "array",
      "items": {
        "type": "string"
      },
      "description": "Upp till 3 egenskapsnycklar att pivotera efter",
      "default": []
    },
    "interval": {
      "type": "string",
      "description": "Intervallstorlek för diagrammet",
      "enum": [
        "auto",
        "minute",
        "hour",
        "day",
        "week",
        "month",
        "quarter",
        "year"
      ],
      "default": "auto"
    },
    "site_id": {
      "type": "string",
      "description": "Webbplats-id, t.ex. pa_7Q2K9XH3AB"
    }
  },
  "required": [
    "name",
    "site_id"
  ]
}
Svarsdata
{
  "type": "object"
}
PATCH /sites/:site_id/events/settings.json Byt namn på, dölj eller visa en händelse, eller ange dess valuta events_update

Behörighet: sites.manage

Exempel
curl -X PATCH https://privatusanalytics.com/sites/:site_id/events/settings.json \
  -H "Authorization: Bearer $PRIVATUS_TOKEN" \
  -H "Content-Type: application/json" -d '{…}'
Indata
{
  "type": "object",
  "properties": {
    "name": {
      "type": "string",
      "description": "Råa händelsenamnet som trackern skickade",
      "examples": [
        "signup_click"
      ]
    },
    "display_name": {
      "type": "string",
      "description": "Namn att visa istället (tomt tar bort namnbytet)"
    },
    "hidden": {
      "type": "boolean",
      "description": "Dölj i rapporter (data behålls)"
    },
    "currency": {
      "type": "string",
      "description": "Valuta för intäkter på den här händelsen (ISO 4217)"
    },
    "site_id": {
      "type": "string",
      "description": "Webbplats-id, t.ex. pa_7Q2K9XH3AB"
    }
  },
  "required": [
    "name",
    "site_id"
  ]
}
Svarsdata
{
  "type": "object",
  "properties": {
    "name": {
      "type": "string",
      "description": "Råa händelsenamnet som trackern skickade"
    },
    "display_name": {
      "anyOf": [
        {
          "type": "string",
          "description": "Namn som visas i rapporter"
        },
        {
          "type": "null"
        }
      ]
    },
    "hidden": {
      "type": "boolean",
      "description": "Dold i rapporter"
    },
    "currency": {
      "anyOf": [
        {
          "type": "string",
          "description": "Intäktsvaluta"
        },
        {
          "type": "null"
        }
      ]
    },
    "updated_at": {
      "type": "string",
      "format": "date-time"
    }
  }
}

Importer

GET /sites/:site_id/imports/google/properties.json Lista Google Analytics 4-egenskaper att importera imports_google_properties

Behörighet: sites.manage

Exempel
curl https://privatusanalytics.com/sites/:site_id/imports/google/properties.json \
  -H "Authorization: Bearer $PRIVATUS_TOKEN"
Indata
{
  "type": "object",
  "properties": {
    "site_id": {
      "type": "string",
      "description": "Webbplats-id, t.ex. pa_7Q2K9XH3AB"
    }
  },
  "required": [
    "site_id"
  ]
}
Svarsdata
{
  "type": "object"
}
POST /sites/:site_id/imports.json Starta en import (GA4-egenskap eller CSV-uppladdning) imports_create

Behörighet: sites.manage

Exempel
curl -X POST https://privatusanalytics.com/sites/:site_id/imports.json \
  -H "Authorization: Bearer $PRIVATUS_TOKEN" \
  -H "Content-Type: application/json" -d '{…}'
Indata
{
  "type": "object",
  "properties": {
    "source": {
      "type": "string",
      "description": "ga4 (Google Analytics 4 API) eller verktyget vars CSV-export du laddar upp",
      "enum": [
        "ga4",
        "universal_analytics",
        "fathom",
        "simple_analytics",
        "plausible",
        "matomo",
        "umami",
        "clicky"
      ]
    },
    "property_id": {
      "type": "string",
      "description": "GA4-egenskap, t.ex. properties/123 (se imports_google_properties). Krävs för ga4",
      "examples": [
        "properties/123456789"
      ]
    },
    "date_from": {
      "type": "string",
      "format": "date",
      "description": "Första dagen att importera. Krävs för ga4. För CSV-filer utan datumkolumn får varje rad det här datumet"
    },
    "date_to": {
      "type": "string",
      "format": "date",
      "description": "Sista dagen att importera (ga4 använder som standard dagen före din första spårade händelse, eller igår)"
    },
    "file": {
      "type": "string",
      "format": "binary",
      "description": "CSV-export (multipart-uppladdning, max 50 MB). Krävs för CSV-källor"
    },
    "dimension": {
      "type": "string",
      "description": "Vad CSV-raderna delar upp (åsidosätter identifieringen, behövs för Matomo-exporter med \"Label\")",
      "enum": [
        "total",
        "page",
        "source",
        "country",
        "device",
        "browser",
        "os"
      ]
    },
    "site_id": {
      "type": "string",
      "description": "Webbplats-id, t.ex. pa_7Q2K9XH3AB"
    }
  },
  "required": [
    "source",
    "site_id"
  ]
}
Svarsdata
{
  "type": "object",
  "properties": {
    "id": {
      "type": "string",
      "description": "Import-id"
    },
    "site_id": {
      "type": "string"
    },
    "source": {
      "type": "string",
      "description": "ga4, universal_analytics, fathom, simple_analytics, plausible, matomo, umami eller clicky"
    },
    "status": {
      "type": "string",
      "description": "queued, running, complete eller failed"
    },
    "date_from": {
      "anyOf": [
        {
          "type": "string",
          "format": "date",
          "description": "Första importerade dagen"
        },
        {
          "type": "null"
        }
      ]
    },
    "date_to": {
      "anyOf": [
        {
          "type": "string",
          "format": "date",
          "description": "Sista importerade dagen"
        },
        {
          "type": "null"
        }
      ]
    },
    "rows_imported": {
      "type": "integer",
      "description": "Lagrade dagsrader"
    },
    "error": {
      "anyOf": [
        {
          "type": "string",
          "description": "Varför importen misslyckades"
        },
        {
          "type": "null"
        }
      ]
    },
    "completed_at": {
      "anyOf": [
        {
          "type": "string",
          "format": "date-time"
        },
        {
          "type": "null"
        }
      ]
    },
    "created_at": {
      "type": "string",
      "format": "date-time"
    }
  }
}
DELETE /sites/:site_id/imports/:id.json Ta bort en import och alla dess importerade data imports_delete

Behörighet: sites.manage

Exempel
curl -X DELETE https://privatusanalytics.com/sites/:site_id/imports/:id.json \
  -H "Authorization: Bearer $PRIVATUS_TOKEN" \
  -H "Content-Type: application/json" -d '{…}'
Indata
{
  "type": "object",
  "properties": {
    "site_id": {
      "type": "string",
      "description": "Webbplats-id, t.ex. pa_7Q2K9XH3AB"
    },
    "id": {
      "type": "string",
      "description": "Id för resursen"
    }
  },
  "required": [
    "site_id",
    "id"
  ]
}
Svarsdata
{
  "type": "object",
  "properties": {
    "id": {
      "type": "string",
      "description": "Import-id"
    },
    "site_id": {
      "type": "string"
    },
    "source": {
      "type": "string",
      "description": "ga4, universal_analytics, fathom, simple_analytics, plausible, matomo, umami eller clicky"
    },
    "status": {
      "type": "string",
      "description": "queued, running, complete eller failed"
    },
    "date_from": {
      "anyOf": [
        {
          "type": "string",
          "format": "date",
          "description": "Första importerade dagen"
        },
        {
          "type": "null"
        }
      ]
    },
    "date_to": {
      "anyOf": [
        {
          "type": "string",
          "format": "date",
          "description": "Sista importerade dagen"
        },
        {
          "type": "null"
        }
      ]
    },
    "rows_imported": {
      "type": "integer",
      "description": "Lagrade dagsrader"
    },
    "error": {
      "anyOf": [
        {
          "type": "string",
          "description": "Varför importen misslyckades"
        },
        {
          "type": "null"
        }
      ]
    },
    "completed_at": {
      "anyOf": [
        {
          "type": "string",
          "format": "date-time"
        },
        {
          "type": "null"
        }
      ]
    },
    "created_at": {
      "type": "string",
      "format": "date-time"
    }
  }
}
GET /sites/:site_id/imports.json Lista importer för en webbplats imports_list

Behörighet: analytics.read

Exempel
curl https://privatusanalytics.com/sites/:site_id/imports.json \
  -H "Authorization: Bearer $PRIVATUS_TOKEN"
Indata
{
  "type": "object",
  "properties": {
    "status": {
      "type": "string",
      "description": "Endast importer med den här statusen",
      "enum": [
        "queued",
        "running",
        "complete",
        "failed"
      ]
    },
    "site_id": {
      "type": "string",
      "description": "Webbplats-id, t.ex. pa_7Q2K9XH3AB"
    },
    "page": {
      "type": "integer",
      "description": "Sida (från 1)"
    },
    "per_page": {
      "type": "integer",
      "description": "Resultat per sida (max 100)"
    }
  },
  "required": [
    "site_id"
  ]
}
Svarsdata
{
  "type": "array",
  "items": {
    "type": "object",
    "properties": {
      "id": {
        "type": "string",
        "description": "Import-id"
      },
      "site_id": {
        "type": "string"
      },
      "source": {
        "type": "string",
        "description": "ga4, universal_analytics, fathom, simple_analytics, plausible, matomo, umami eller clicky"
      },
      "status": {
        "type": "string",
        "description": "queued, running, complete eller failed"
      },
      "date_from": {
        "anyOf": [
          {
            "type": "string",
            "format": "date",
            "description": "Första importerade dagen"
          },
          {
            "type": "null"
          }
        ]
      },
      "date_to": {
        "anyOf": [
          {
            "type": "string",
            "format": "date",
            "description": "Sista importerade dagen"
          },
          {
            "type": "null"
          }
        ]
      },
      "rows_imported": {
        "type": "integer",
        "description": "Lagrade dagsrader"
      },
      "error": {
        "anyOf": [
          {
            "type": "string",
            "description": "Varför importen misslyckades"
          },
          {
            "type": "null"
          }
        ]
      },
      "completed_at": {
        "anyOf": [
          {
            "type": "string",
            "format": "date-time"
          },
          {
            "type": "null"
          }
        ]
      },
      "created_at": {
        "type": "string",
        "format": "date-time"
      }
    }
  }
}
GET /sites/:site_id/imports/:id.json Hämta en import och dess status imports_get

Behörighet: analytics.read

Exempel
curl https://privatusanalytics.com/sites/:site_id/imports/:id.json \
  -H "Authorization: Bearer $PRIVATUS_TOKEN"
Indata
{
  "type": "object",
  "properties": {
    "site_id": {
      "type": "string",
      "description": "Webbplats-id, t.ex. pa_7Q2K9XH3AB"
    },
    "id": {
      "type": "string",
      "description": "Id för resursen"
    }
  },
  "required": [
    "site_id",
    "id"
  ]
}
Svarsdata
{
  "type": "object",
  "properties": {
    "id": {
      "type": "string",
      "description": "Import-id"
    },
    "site_id": {
      "type": "string"
    },
    "source": {
      "type": "string",
      "description": "ga4, universal_analytics, fathom, simple_analytics, plausible, matomo, umami eller clicky"
    },
    "status": {
      "type": "string",
      "description": "queued, running, complete eller failed"
    },
    "date_from": {
      "anyOf": [
        {
          "type": "string",
          "format": "date",
          "description": "Första importerade dagen"
        },
        {
          "type": "null"
        }
      ]
    },
    "date_to": {
      "anyOf": [
        {
          "type": "string",
          "format": "date",
          "description": "Sista importerade dagen"
        },
        {
          "type": "null"
        }
      ]
    },
    "rows_imported": {
      "type": "integer",
      "description": "Lagrade dagsrader"
    },
    "error": {
      "anyOf": [
        {
          "type": "string",
          "description": "Varför importen misslyckades"
        },
        {
          "type": "null"
        }
      ]
    },
    "completed_at": {
      "anyOf": [
        {
          "type": "string",
          "format": "date-time"
        },
        {
          "type": "null"
        }
      ]
    },
    "created_at": {
      "type": "string",
      "format": "date-time"
    }
  }
}

Insamling

POST /api/logs.json Skicka serverns åtkomstloggar för rapportering om AI-crawlers (JSON {lines: [...]} eller loggtext i combined-format, med webbplatsens inmatningsnyckel som Bearer-token) crawler_logs_create

Behörighet: public · Endast HTTP (inte ett MCP-verktyg)

Exempel
curl -X POST https://privatusanalytics.com/api/logs.json \
  -H "Content-Type: application/json" -d '{…}'
Indata
{
  "type": "object",
  "properties": {
    "lines": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "ts": {
            "type": "string"
          },
          "path": {
            "type": "string",
            "default": "/"
          },
          "status": {
            "type": "integer"
          },
          "user_agent": {
            "type": "string",
            "default": ""
          }
        }
      },
      "description": "Loggrader: [{ts, path, status, user_agent}] (max 1000)"
    }
  },
  "required": [
    "lines"
  ]
}
Svarsdata
{
  "type": "object"
}
POST /api/event.json Samla in ett webbläsartreff (används av /js/pa.js) ingest_event

Behörighet: public · Endast HTTP (inte ett MCP-verktyg)

Exempel
curl -X POST https://privatusanalytics.com/api/event.json \
  -H "Content-Type: application/json" -d '{…}'
Indata
{
  "type": "object",
  "properties": {
    "site": {
      "type": "string",
      "description": "Webbplats-id (pa_…)"
    },
    "type": {
      "type": "string",
      "description": "Typ av träff",
      "enum": [
        "pageview",
        "event",
        "engagement",
        "vital",
        "click"
      ]
    },
    "url": {
      "type": "string",
      "description": "Fullständig sid-URL"
    },
    "referrer": {
      "type": "string",
      "description": "document.referrer"
    },
    "name": {
      "type": "string",
      "description": "Händelsenamn (type=event) eller vital-namn"
    },
    "props": {
      "type": "object",
      "additionalProperties": true,
      "description": "Händelseegenskaper: upp till 30 sträng-/tal-/booleanvärden",
      "default": {}
    },
    "screen_width": {
      "type": "integer",
      "description": "Skärmbredd i pixlar"
    },
    "language": {
      "type": "string",
      "description": "navigator.language"
    },
    "engaged_ms": {
      "type": "integer",
      "description": "Synlig tid på sidan (engagemang)"
    },
    "scroll_depth": {
      "type": "integer",
      "description": "Max scrolldjup i % (engagemang)"
    },
    "value": {
      "type": "number",
      "description": "Värde för Web Vital (type=vital)"
    },
    "selector": {
      "type": "string",
      "description": "Selektor för klickat element (type=click)"
    },
    "hash_mode": {
      "type": "boolean",
      "description": "Behåll #fragmentet (webbplatser med hash-routing)",
      "default": false
    },
    "dnt": {
      "type": "boolean",
      "description": "Do Not Track är på",
      "default": false
    },
    "gpc": {
      "type": "boolean",
      "description": "Global Privacy Control är på",
      "default": false
    },
    "interacted": {
      "type": "boolean",
      "description": "1 när en betrodd inmatning (pekare, tangent, touch eller hjul) har setts på sidan, 0 innan dess. Inga koordinater eller tider"
    },
    "revenue": {
      "type": "number",
      "description": "Intäkt i huvudenheter, t.ex. 49.99"
    },
    "currency": {
      "type": "string",
      "description": "ISO 4217-valuta för intäkten"
    }
  },
  "required": [
    "site",
    "type",
    "url"
  ]
}
Svarsdata
{
  "type": "object"
}
POST /api/events.json Samla in händelser från servern med en inmatningsnyckel för webbplatsen ingest_events

Behörighet: public · Endast HTTP (inte ett MCP-verktyg)

Exempel
curl -X POST https://privatusanalytics.com/api/events.json \
  -H "Content-Type: application/json" -d '{…}'
Indata
{
  "type": "object",
  "properties": {
    "events": {
      "type": "array",
      "items": {
        "type": "object",
        "additionalProperties": true
      },
      "description": "Upp till 100 händelser"
    }
  },
  "required": [
    "events"
  ]
}
Svarsdata
{
  "type": "object"
}
GET /api/pixel.json Samla in en sidvisning utan JavaScript (1×1 GIF) ingest_pixel

Behörighet: public · Endast HTTP (inte ett MCP-verktyg)

Exempel
curl https://privatusanalytics.com/api/pixel.json
Indata
{
  "type": "object",
  "properties": {},
  "required": []
}
Svarsdata
{
  "type": "object"
}

Instrumentpaneler

GET /workspaces/:workspace_id/dashboards/:id/cards/:index.json Data för ett kort i en egen instrumentpanel dashboards_card

Behörighet: analytics.read

Exempel
curl https://privatusanalytics.com/workspaces/:workspace_id/dashboards/:id/cards/:index.json \
  -H "Authorization: Bearer $PRIVATUS_TOKEN"
Indata
{
  "type": "object",
  "properties": {
    "workspace_id": {
      "type": "string",
      "description": "Arbetsyte-id, t.ex. ws_7Q2K9XH3AB"
    },
    "id": {
      "type": "string",
      "description": "Id för resursen"
    },
    "index": {
      "type": "string",
      "description": "Index för resursen"
    }
  },
  "required": [
    "workspace_id",
    "id",
    "index"
  ]
}
Svarsdata
{
  "type": "object"
}
POST /workspaces/:workspace_id/dashboards.json Skapa en egen instrumentpanel dashboards_create

Behörighet: content.write

Exempel
curl -X POST https://privatusanalytics.com/workspaces/:workspace_id/dashboards.json \
  -H "Authorization: Bearer $PRIVATUS_TOKEN" \
  -H "Content-Type: application/json" -d '{…}'
Indata
{
  "type": "object",
  "properties": {
    "name": {
      "type": "string",
      "description": "Instrumentpanelens namn",
      "examples": [
        "Client: Acme"
      ]
    },
    "cards": {
      "type": "array",
      "items": {},
      "description": "Kort i ordning (max 40): [{\"type\": \"metric|chart|breakdown|goal|live|funnel|uptime|vitals\", \"site_id\": \"pa_…\", \"title\": \"optional\", \"params\": {\"period\": \"30d\", \"metric\": \"visitors\", \"dimension\": \"page\", \"funnel_id\": \"fun_…\"}}]. Parametrar som en typ inte använder ignoreras",
      "default": []
    },
    "workspace_id": {
      "type": "string",
      "description": "Arbetsyte-id, t.ex. ws_7Q2K9XH3AB"
    }
  },
  "required": [
    "name",
    "workspace_id"
  ]
}
Svarsdata
{
  "type": "object",
  "properties": {
    "id": {
      "type": "string",
      "description": "Instrumentpanels-id, t.ex. dash_7Q2K9XH3AB"
    },
    "name": {
      "type": "string"
    },
    "cards": {
      "type": "array",
      "items": {
        "type": "object"
      },
      "description": "Kort i ordning: [{type, site_id, title, params}]"
    },
    "created_at": {
      "type": "string",
      "format": "date-time"
    },
    "updated_at": {
      "type": "string",
      "format": "date-time"
    }
  }
}
DELETE /workspaces/:workspace_id/dashboards/:id.json Ta bort en egen instrumentpanel dashboards_delete

Behörighet: content.write

Exempel
curl -X DELETE https://privatusanalytics.com/workspaces/:workspace_id/dashboards/:id.json \
  -H "Authorization: Bearer $PRIVATUS_TOKEN" \
  -H "Content-Type: application/json" -d '{…}'
Indata
{
  "type": "object",
  "properties": {
    "workspace_id": {
      "type": "string",
      "description": "Arbetsyte-id, t.ex. ws_7Q2K9XH3AB"
    },
    "id": {
      "type": "string",
      "description": "Id för resursen"
    }
  },
  "required": [
    "workspace_id",
    "id"
  ]
}
Svarsdata
{
  "type": "object",
  "properties": {
    "id": {
      "type": "string",
      "description": "Instrumentpanels-id, t.ex. dash_7Q2K9XH3AB"
    },
    "name": {
      "type": "string"
    },
    "cards": {
      "type": "array",
      "items": {
        "type": "object"
      },
      "description": "Kort i ordning: [{type, site_id, title, params}]"
    },
    "created_at": {
      "type": "string",
      "format": "date-time"
    },
    "updated_at": {
      "type": "string",
      "format": "date-time"
    }
  }
}
GET /workspaces/:workspace_id/dashboards.json Lista egna instrumentpaneler dashboards_list

Behörighet: analytics.read

Exempel
curl https://privatusanalytics.com/workspaces/:workspace_id/dashboards.json \
  -H "Authorization: Bearer $PRIVATUS_TOKEN"
Indata
{
  "type": "object",
  "properties": {
    "workspace_id": {
      "type": "string",
      "description": "Arbetsyte-id, t.ex. ws_7Q2K9XH3AB"
    },
    "page": {
      "type": "integer",
      "description": "Sida (från 1)"
    },
    "per_page": {
      "type": "integer",
      "description": "Resultat per sida (max 100)"
    }
  },
  "required": [
    "workspace_id"
  ]
}
Svarsdata
{
  "type": "array",
  "items": {
    "type": "object",
    "properties": {
      "id": {
        "type": "string",
        "description": "Instrumentpanels-id, t.ex. dash_7Q2K9XH3AB"
      },
      "name": {
        "type": "string"
      },
      "cards": {
        "type": "array",
        "items": {
          "type": "object"
        },
        "description": "Kort i ordning: [{type, site_id, title, params}]"
      },
      "created_at": {
        "type": "string",
        "format": "date-time"
      },
      "updated_at": {
        "type": "string",
        "format": "date-time"
      }
    }
  }
}
GET /workspaces/:workspace_id/dashboards/:id.json Hämta en egen instrumentpanel och dess kort dashboards_get

Behörighet: analytics.read

Exempel
curl https://privatusanalytics.com/workspaces/:workspace_id/dashboards/:id.json \
  -H "Authorization: Bearer $PRIVATUS_TOKEN"
Indata
{
  "type": "object",
  "properties": {
    "workspace_id": {
      "type": "string",
      "description": "Arbetsyte-id, t.ex. ws_7Q2K9XH3AB"
    },
    "id": {
      "type": "string",
      "description": "Id för resursen"
    }
  },
  "required": [
    "workspace_id",
    "id"
  ]
}
Svarsdata
{
  "type": "object",
  "properties": {
    "id": {
      "type": "string",
      "description": "Instrumentpanels-id, t.ex. dash_7Q2K9XH3AB"
    },
    "name": {
      "type": "string"
    },
    "cards": {
      "type": "array",
      "items": {
        "type": "object"
      },
      "description": "Kort i ordning: [{type, site_id, title, params}]"
    },
    "created_at": {
      "type": "string",
      "format": "date-time"
    },
    "updated_at": {
      "type": "string",
      "format": "date-time"
    }
  }
}
PATCH /workspaces/:workspace_id/dashboards/:id.json Byt namn på en egen instrumentpanel eller ersätt dess kort dashboards_update

Behörighet: content.write

Exempel
curl -X PATCH https://privatusanalytics.com/workspaces/:workspace_id/dashboards/:id.json \
  -H "Authorization: Bearer $PRIVATUS_TOKEN" \
  -H "Content-Type: application/json" -d '{…}'
Indata
{
  "type": "object",
  "properties": {
    "name": {
      "type": "string",
      "description": "Nytt namn (oförändrat när tomt)"
    },
    "cards": {
      "type": "array",
      "items": {},
      "description": "Ersätter alla kort. Kort i ordning (max 40): [{\"type\": \"metric|chart|breakdown|goal|live|funnel|uptime|vitals\", \"site_id\": \"pa_…\", \"title\": \"optional\", \"params\": {\"period\": \"30d\", \"metric\": \"visitors\", \"dimension\": \"page\", \"funnel_id\": \"fun_…\"}}]. Parametrar som en typ inte använder ignoreras"
    },
    "workspace_id": {
      "type": "string",
      "description": "Arbetsyte-id, t.ex. ws_7Q2K9XH3AB"
    },
    "id": {
      "type": "string",
      "description": "Id för resursen"
    }
  },
  "required": [
    "workspace_id",
    "id"
  ]
}
Svarsdata
{
  "type": "object",
  "properties": {
    "id": {
      "type": "string",
      "description": "Instrumentpanels-id, t.ex. dash_7Q2K9XH3AB"
    },
    "name": {
      "type": "string"
    },
    "cards": {
      "type": "array",
      "items": {
        "type": "object"
      },
      "description": "Kort i ordning: [{type, site_id, title, params}]"
    },
    "created_at": {
      "type": "string",
      "format": "date-time"
    },
    "updated_at": {
      "type": "string",
      "format": "date-time"
    }
  }
}

Kampanjer

POST /sites/:site_id/campaigns/costs.json Ange kostnaden för en kampanj under en månad campaign_costs_create

Behörighet: content.write

Exempel
curl -X POST https://privatusanalytics.com/sites/:site_id/campaigns/costs.json \
  -H "Authorization: Bearer $PRIVATUS_TOKEN" \
  -H "Content-Type: application/json" -d '{…}'
Indata
{
  "type": "object",
  "properties": {
    "campaign": {
      "type": "string",
      "description": "utm_campaign-värdet som kostnaden hör till",
      "examples": [
        "spring_sale"
      ]
    },
    "month": {
      "type": "string",
      "description": "Månad, ÅÅÅÅ-MM",
      "examples": [
        "2026-09"
      ]
    },
    "amount": {
      "type": "number",
      "description": "Kostnad i huvudenheter, t.ex. 1250.50"
    },
    "currency": {
      "type": "string",
      "description": "ISO 4217-valuta (standard är webbplatsens valuta)"
    },
    "site_id": {
      "type": "string",
      "description": "Webbplats-id, t.ex. pa_7Q2K9XH3AB"
    }
  },
  "required": [
    "campaign",
    "month",
    "amount",
    "site_id"
  ]
}
Svarsdata
{
  "type": "object",
  "properties": {
    "id": {
      "type": "string",
      "format": "uuid",
      "description": "Id för kostnadspost"
    },
    "campaign": {
      "type": "string",
      "description": "utm_campaign-värde"
    },
    "month": {
      "type": "string",
      "description": "Månad, ÅÅÅÅ-MM"
    },
    "amount_minor": {
      "type": "integer",
      "description": "Kostnad i minsta enhet"
    },
    "currency": {
      "type": "string",
      "description": "ISO 4217-valuta för beloppet"
    },
    "created_at": {
      "type": "string",
      "format": "date-time"
    },
    "updated_at": {
      "type": "string",
      "format": "date-time"
    }
  }
}
DELETE /sites/:site_id/campaigns/costs/:id.json Ta bort en kampanjkostnad campaign_costs_delete

Behörighet: content.write

Exempel
curl -X DELETE https://privatusanalytics.com/sites/:site_id/campaigns/costs/:id.json \
  -H "Authorization: Bearer $PRIVATUS_TOKEN" \
  -H "Content-Type: application/json" -d '{…}'
Indata
{
  "type": "object",
  "properties": {
    "site_id": {
      "type": "string",
      "description": "Webbplats-id, t.ex. pa_7Q2K9XH3AB"
    },
    "id": {
      "type": "string",
      "description": "Id för resursen"
    }
  },
  "required": [
    "site_id",
    "id"
  ]
}
Svarsdata
{
  "type": "object",
  "properties": {
    "id": {
      "type": "string",
      "format": "uuid",
      "description": "Id för kostnadspost"
    },
    "campaign": {
      "type": "string",
      "description": "utm_campaign-värde"
    },
    "month": {
      "type": "string",
      "description": "Månad, ÅÅÅÅ-MM"
    },
    "amount_minor": {
      "type": "integer",
      "description": "Kostnad i minsta enhet"
    },
    "currency": {
      "type": "string",
      "description": "ISO 4217-valuta för beloppet"
    },
    "created_at": {
      "type": "string",
      "format": "date-time"
    },
    "updated_at": {
      "type": "string",
      "format": "date-time"
    }
  }
}
POST /sites/:site_id/campaigns/costs/import.json Importera kampanjkostnader från CSV (campaign,month,amount[,currency]) campaign_costs_import

Behörighet: content.write

Exempel
curl -X POST https://privatusanalytics.com/sites/:site_id/campaigns/costs/import.json \
  -H "Authorization: Bearer $PRIVATUS_TOKEN" \
  -H "Content-Type: application/json" -d '{…}'
Indata
{
  "type": "object",
  "properties": {
    "file": {
      "type": "string",
      "format": "binary",
      "description": "Uppladdning av CSV-fil (multipart-formulär)"
    },
    "csv": {
      "type": "string",
      "description": "CSV-text: campaign,month,amount[,currency]"
    },
    "site_id": {
      "type": "string",
      "description": "Webbplats-id, t.ex. pa_7Q2K9XH3AB"
    }
  },
  "required": [
    "site_id"
  ]
}
Svarsdata
{
  "type": "object",
  "properties": {
    "imported": {
      "type": "integer",
      "description": "Sparade rader"
    },
    "failed": {
      "type": "integer",
      "description": "Överhoppade rader"
    },
    "errors": {
      "type": "array",
      "items": {
        "type": "string"
      },
      "description": "Varför rader hoppades över (de första 50)"
    }
  }
}
GET /sites/:site_id/campaigns/costs.json Lista kampanjkostnader campaign_costs_list

Behörighet: analytics.read

Exempel
curl https://privatusanalytics.com/sites/:site_id/campaigns/costs.json \
  -H "Authorization: Bearer $PRIVATUS_TOKEN"
Indata
{
  "type": "object",
  "properties": {
    "campaign": {
      "type": "string",
      "description": "Endast den här kampanjen"
    },
    "site_id": {
      "type": "string",
      "description": "Webbplats-id, t.ex. pa_7Q2K9XH3AB"
    },
    "page": {
      "type": "integer",
      "description": "Sida (från 1)"
    },
    "per_page": {
      "type": "integer",
      "description": "Resultat per sida (max 100)"
    }
  },
  "required": [
    "site_id"
  ]
}
Svarsdata
{
  "type": "array",
  "items": {
    "type": "object",
    "properties": {
      "id": {
        "type": "string",
        "format": "uuid",
        "description": "Id för kostnadspost"
      },
      "campaign": {
        "type": "string",
        "description": "utm_campaign-värde"
      },
      "month": {
        "type": "string",
        "description": "Månad, ÅÅÅÅ-MM"
      },
      "amount_minor": {
        "type": "integer",
        "description": "Kostnad i minsta enhet"
      },
      "currency": {
        "type": "string",
        "description": "ISO 4217-valuta för beloppet"
      },
      "created_at": {
        "type": "string",
        "format": "date-time"
      },
      "updated_at": {
        "type": "string",
        "format": "date-time"
      }
    }
  }
}
PATCH /sites/:site_id/campaigns/costs/:id.json Ändra en kampanjkostnad campaign_costs_update

Behörighet: content.write

Exempel
curl -X PATCH https://privatusanalytics.com/sites/:site_id/campaigns/costs/:id.json \
  -H "Authorization: Bearer $PRIVATUS_TOKEN" \
  -H "Content-Type: application/json" -d '{…}'
Indata
{
  "type": "object",
  "properties": {
    "campaign": {
      "type": "string",
      "description": "utm_campaign-värde"
    },
    "month": {
      "type": "string",
      "description": "Månad, ÅÅÅÅ-MM"
    },
    "amount": {
      "type": "number",
      "description": "Kostnad i huvudenheter"
    },
    "currency": {
      "type": "string",
      "description": "ISO 4217-valuta"
    },
    "site_id": {
      "type": "string",
      "description": "Webbplats-id, t.ex. pa_7Q2K9XH3AB"
    },
    "id": {
      "type": "string",
      "description": "Id för resursen"
    }
  },
  "required": [
    "site_id",
    "id"
  ]
}
Svarsdata
{
  "type": "object",
  "properties": {
    "id": {
      "type": "string",
      "format": "uuid",
      "description": "Id för kostnadspost"
    },
    "campaign": {
      "type": "string",
      "description": "utm_campaign-värde"
    },
    "month": {
      "type": "string",
      "description": "Månad, ÅÅÅÅ-MM"
    },
    "amount_minor": {
      "type": "integer",
      "description": "Kostnad i minsta enhet"
    },
    "currency": {
      "type": "string",
      "description": "ISO 4217-valuta för beloppet"
    },
    "created_at": {
      "type": "string",
      "format": "date-time"
    },
    "updated_at": {
      "type": "string",
      "format": "date-time"
    }
  }
}
GET /sites/:site_id/campaigns/builder.json Bygg och validera en UTM-taggad URL campaigns_builder

Behörighet: analytics.read

Exempel
curl https://privatusanalytics.com/sites/:site_id/campaigns/builder.json \
  -H "Authorization: Bearer $PRIVATUS_TOKEN"
Indata
{
  "type": "object",
  "properties": {
    "destination": {
      "type": "string",
      "description": "URL till landningssidan (https://…)",
      "examples": [
        "https://example.com/pricing"
      ]
    },
    "preset": {
      "type": "string",
      "description": "Fyll i utm_source/utm_medium för en kanal när de är tomma",
      "enum": [
        "newsletter",
        "social",
        "paid_search",
        "paid_social",
        "print",
        "partner"
      ]
    },
    "utm_source": {
      "type": "string",
      "description": "Varifrån trafiken kommer"
    },
    "utm_medium": {
      "type": "string",
      "description": "Marknadsföringsmedium, t.ex. email, cpc"
    },
    "utm_campaign": {
      "type": "string",
      "description": "Kampanjnamn, t.ex. spring_sale"
    },
    "utm_content": {
      "type": "string",
      "description": "Variant, t.ex. header_button"
    },
    "utm_term": {
      "type": "string",
      "description": "Sökord för betald sökning"
    },
    "site_id": {
      "type": "string",
      "description": "Webbplats-id, t.ex. pa_7Q2K9XH3AB"
    }
  },
  "required": [
    "site_id"
  ]
}
Svarsdata
{
  "type": "object",
  "properties": {
    "url": {
      "anyOf": [
        {
          "type": "string",
          "description": "Taggad URL (null så länge det finns fel)"
        },
        {
          "type": "null"
        }
      ]
    },
    "valid": {
      "type": "boolean",
      "description": "True när det inte finns några fel"
    },
    "destination": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ]
    },
    "preset": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ]
    },
    "utm_source": {
      "anyOf": [
        {
          "type": "string",
          "description": "Normaliserad utm_source"
        },
        {
          "type": "null"
        }
      ]
    },
    "utm_medium": {
      "anyOf": [
        {
          "type": "string",
          "description": "Normaliserad utm_medium"
        },
        {
          "type": "null"
        }
      ]
    },
    "utm_campaign": {
      "anyOf": [
        {
          "type": "string",
          "description": "Normaliserad utm_campaign"
        },
        {
          "type": "null"
        }
      ]
    },
    "utm_content": {
      "anyOf": [
        {
          "type": "string",
          "description": "Normaliserad utm_content"
        },
        {
          "type": "null"
        }
      ]
    },
    "utm_term": {
      "anyOf": [
        {
          "type": "string",
          "description": "Normaliserad utm_term"
        },
        {
          "type": "null"
        }
      ]
    },
    "issues": {
      "type": "array",
      "items": {
        "type": "object"
      },
      "description": "fält, nivå (error eller warning) och meddelande"
    },
    "presets": {
      "type": "object",
      "description": "Kanalförval: utm_source/utm_medium per förval"
    }
  }
}
GET /sites/:site_id/campaigns/hygiene.json UTM-hygien: nästan dubbla värden, stilproblem och okända källor campaigns_hygiene

Behörighet: analytics.read

Exempel
curl https://privatusanalytics.com/sites/:site_id/campaigns/hygiene.json \
  -H "Authorization: Bearer $PRIVATUS_TOKEN"
Indata
{
  "type": "object",
  "properties": {
    "period": {
      "type": "string",
      "description": "Förinställt datumintervall. Använd custom med from/to",
      "enum": [
        "today",
        "yesterday",
        "24h",
        "7d",
        "14d",
        "28d",
        "30d",
        "90d",
        "mtd",
        "last_month",
        "qtd",
        "last_quarter",
        "ytd",
        "12mo",
        "last_year",
        "all",
        "custom"
      ],
      "default": "30d"
    },
    "from": {
      "type": "string",
      "format": "date",
      "description": "Start för eget intervall (webbplatsens tidszon)"
    },
    "to": {
      "type": "string",
      "format": "date",
      "description": "Slut för eget intervall, inklusive"
    },
    "compare": {
      "type": "string",
      "description": "Jämförelseperiod",
      "enum": [
        "none",
        "previous_period",
        "previous_year",
        "custom"
      ],
      "default": "none"
    },
    "compare_from": {
      "type": "string",
      "format": "date",
      "description": "Start för egen jämförelse"
    },
    "compare_to": {
      "type": "string",
      "format": "date",
      "description": "Slut för egen jämförelse"
    },
    "match_weekday": {
      "type": "boolean",
      "description": "Justera jämförelsedagarna efter veckodag",
      "default": false
    },
    "filters": {
      "type": "array",
      "items": {},
      "description": "Filter: [[\"dimension\",\"operator\",\"value\"], …]. Operatorer: is, is_not, any_of, none_of, contains, not_contains, starts_with, regex, not_regex, gt, lt, between. Omslut villkor med {\"any\": [...]} för ELLER.",
      "default": []
    },
    "segment_id": {
      "type": "string",
      "description": "Tillämpa ett sparat segment (seg_…)"
    },
    "include_imported": {
      "type": "boolean",
      "description": "Lägg till importerade historiska data (datum före den första inbyggda händelsen, ignoreras när filter eller ett segment tillämpas)",
      "default": false
    },
    "site_id": {
      "type": "string",
      "description": "Webbplats-id, t.ex. pa_7Q2K9XH3AB"
    }
  },
  "required": [
    "site_id"
  ]
}
Svarsdata
{
  "type": "object",
  "properties": {
    "period": {
      "type": "object",
      "description": "from/to för perioden (UTC)"
    },
    "duplicates": {
      "type": "array",
      "items": {
        "type": "object"
      },
      "description": "Nästan dubbla värden: fält, förslag och varianter [{value, visits}]"
    },
    "style_issues": {
      "type": "array",
      "items": {
        "type": "object"
      },
      "description": "Värden som inte är gemener med understreck: fält, värde, besök, förslag"
    },
    "unknown_sources": {
      "type": "array",
      "items": {
        "type": "object"
      },
      "description": "utm_source-värden vi inte känner igen: värde, besök"
    }
  }
}
GET /sites/:site_id/campaigns.json Kampanjsammanställning med konverteringar, intäkter, kostnad, CPA och ROAS campaigns_list

Behörighet: analytics.read

Exempel
curl https://privatusanalytics.com/sites/:site_id/campaigns.json \
  -H "Authorization: Bearer $PRIVATUS_TOKEN"
Indata
{
  "type": "object",
  "properties": {
    "period": {
      "type": "string",
      "description": "Förinställt datumintervall. Använd custom med from/to",
      "enum": [
        "today",
        "yesterday",
        "24h",
        "7d",
        "14d",
        "28d",
        "30d",
        "90d",
        "mtd",
        "last_month",
        "qtd",
        "last_quarter",
        "ytd",
        "12mo",
        "last_year",
        "all",
        "custom"
      ],
      "default": "30d"
    },
    "from": {
      "type": "string",
      "format": "date",
      "description": "Start för eget intervall (webbplatsens tidszon)"
    },
    "to": {
      "type": "string",
      "format": "date",
      "description": "Slut för eget intervall, inklusive"
    },
    "compare": {
      "type": "string",
      "description": "Jämförelseperiod",
      "enum": [
        "none",
        "previous_period",
        "previous_year",
        "custom"
      ],
      "default": "none"
    },
    "compare_from": {
      "type": "string",
      "format": "date",
      "description": "Start för egen jämförelse"
    },
    "compare_to": {
      "type": "string",
      "format": "date",
      "description": "Slut för egen jämförelse"
    },
    "match_weekday": {
      "type": "boolean",
      "description": "Justera jämförelsedagarna efter veckodag",
      "default": false
    },
    "filters": {
      "type": "array",
      "items": {},
      "description": "Filter: [[\"dimension\",\"operator\",\"value\"], …]. Operatorer: is, is_not, any_of, none_of, contains, not_contains, starts_with, regex, not_regex, gt, lt, between. Omslut villkor med {\"any\": [...]} för ELLER.",
      "default": []
    },
    "segment_id": {
      "type": "string",
      "description": "Tillämpa ett sparat segment (seg_…)"
    },
    "include_imported": {
      "type": "boolean",
      "description": "Lägg till importerade historiska data (datum före den första inbyggda händelsen, ignoreras när filter eller ett segment tillämpas)",
      "default": false
    },
    "goal_id": {
      "type": "string",
      "description": "Mål (goal_…) vars konverteringar ska räknas. Standard är det första aktiva målet"
    },
    "site_id": {
      "type": "string",
      "description": "Webbplats-id, t.ex. pa_7Q2K9XH3AB"
    }
  },
  "required": [
    "site_id"
  ]
}
Svarsdata
{
  "type": "object",
  "properties": {
    "period": {
      "type": "object",
      "description": "from/to för perioden (UTC)"
    },
    "currency": {
      "type": "string",
      "description": "Webbplatsens valuta för intäkter och kostnad"
    },
    "goal_id": {
      "anyOf": [
        {
          "type": "string",
          "description": "Mål som räknas som en konvertering"
        },
        {
          "type": "null"
        }
      ]
    },
    "goal_name": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ]
    },
    "campaigns": {
      "type": "array",
      "items": {
        "type": "object"
      },
      "description": "Per utm_campaign: visitors, visits, conversions, conversion_rate, revenue, cost, cpa (minsta enhet), roas (intäkt ÷ kostnad) och sources [{source, medium, visitors, visits, conversions, conversion_rate, revenue}]"
    },
    "totals": {
      "type": "object",
      "description": "Summor över alla listade kampanjer"
    }
  }
}

Kanalregler

POST /sites/:site_id/channel_rules.json Lägg till en kanalregel channel_rules_create

Behörighet: sites.manage

Exempel
curl -X POST https://privatusanalytics.com/sites/:site_id/channel_rules.json \
  -H "Authorization: Bearer $PRIVATUS_TOKEN" \
  -H "Content-Type: application/json" -d '{…}'
Indata
{
  "type": "object",
  "properties": {
    "channel": {
      "type": "string",
      "description": "Kanalnamn att tilldela, t.ex. Partners"
    },
    "conditions": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "field": {
            "type": "string"
          },
          "operator": {
            "type": "string"
          },
          "value": {
            "type": "string"
          }
        }
      },
      "description": "Villkor som alla måste matcha: [{\"field\": \"utm_source\", \"operator\": \"is\", \"value\": \"newsletter\"}]. Fält: referrer_host, utm_source, utm_medium, utm_campaign, ref, path. Operatorer: is, contains, starts_with, regex."
    },
    "site_id": {
      "type": "string",
      "description": "Webbplats-id, t.ex. pa_7Q2K9XH3AB"
    }
  },
  "required": [
    "channel",
    "conditions",
    "site_id"
  ]
}
Svarsdata
{
  "type": "object",
  "properties": {
    "id": {
      "type": "string",
      "format": "uuid",
      "description": "Regel-id"
    },
    "channel": {
      "type": "string",
      "description": "Kanal som tilldelas när alla villkor matchar"
    },
    "position": {
      "type": "integer",
      "description": "Utvärderingsordning (första träffen vinner)"
    },
    "conditions": {
      "type": "array",
      "description": "Villkor: fält, operator, värde"
    },
    "created_at": {
      "type": "string",
      "format": "date-time"
    }
  }
}
DELETE /sites/:site_id/channel_rules/:id.json Ta bort en kanalregel channel_rules_delete

Behörighet: sites.manage

Exempel
curl -X DELETE https://privatusanalytics.com/sites/:site_id/channel_rules/:id.json \
  -H "Authorization: Bearer $PRIVATUS_TOKEN" \
  -H "Content-Type: application/json" -d '{…}'
Indata
{
  "type": "object",
  "properties": {
    "site_id": {
      "type": "string",
      "description": "Webbplats-id, t.ex. pa_7Q2K9XH3AB"
    },
    "id": {
      "type": "string",
      "description": "Id för resursen"
    }
  },
  "required": [
    "site_id",
    "id"
  ]
}
Svarsdata
{
  "type": "object",
  "properties": {
    "id": {
      "type": "string",
      "format": "uuid",
      "description": "Regel-id"
    },
    "channel": {
      "type": "string",
      "description": "Kanal som tilldelas när alla villkor matchar"
    },
    "position": {
      "type": "integer",
      "description": "Utvärderingsordning (första träffen vinner)"
    },
    "conditions": {
      "type": "array",
      "description": "Villkor: fält, operator, värde"
    },
    "created_at": {
      "type": "string",
      "format": "date-time"
    }
  }
}
GET /sites/:site_id/channel_rules.json Lista kanalregler i ordning channel_rules_list

Behörighet: analytics.read

Exempel
curl https://privatusanalytics.com/sites/:site_id/channel_rules.json \
  -H "Authorization: Bearer $PRIVATUS_TOKEN"
Indata
{
  "type": "object",
  "properties": {
    "site_id": {
      "type": "string",
      "description": "Webbplats-id, t.ex. pa_7Q2K9XH3AB"
    }
  },
  "required": [
    "site_id"
  ]
}
Svarsdata
{
  "type": "object",
  "properties": {
    "id": {
      "type": "string",
      "format": "uuid",
      "description": "Regel-id"
    },
    "channel": {
      "type": "string",
      "description": "Kanal som tilldelas när alla villkor matchar"
    },
    "position": {
      "type": "integer",
      "description": "Utvärderingsordning (första träffen vinner)"
    },
    "conditions": {
      "type": "array",
      "description": "Villkor: fält, operator, värde"
    },
    "created_at": {
      "type": "string",
      "format": "date-time"
    }
  }
}
PATCH /sites/:site_id/channel_rules/:id/move.json Flytta en kanalregel upp eller ned channel_rules_move

Behörighet: sites.manage

Exempel
curl -X PATCH https://privatusanalytics.com/sites/:site_id/channel_rules/:id/move.json \
  -H "Authorization: Bearer $PRIVATUS_TOKEN" \
  -H "Content-Type: application/json" -d '{…}'
Indata
{
  "type": "object",
  "properties": {
    "direction": {
      "type": "string",
      "description": "Vart regeln ska flyttas",
      "enum": [
        "up",
        "down",
        "top",
        "bottom"
      ]
    },
    "site_id": {
      "type": "string",
      "description": "Webbplats-id, t.ex. pa_7Q2K9XH3AB"
    },
    "id": {
      "type": "string",
      "description": "Id för resursen"
    }
  },
  "required": [
    "direction",
    "site_id",
    "id"
  ]
}
Svarsdata
{
  "type": "object",
  "properties": {
    "id": {
      "type": "string",
      "format": "uuid",
      "description": "Regel-id"
    },
    "channel": {
      "type": "string",
      "description": "Kanal som tilldelas när alla villkor matchar"
    },
    "position": {
      "type": "integer",
      "description": "Utvärderingsordning (första träffen vinner)"
    },
    "conditions": {
      "type": "array",
      "description": "Villkor: fält, operator, värde"
    },
    "created_at": {
      "type": "string",
      "format": "date-time"
    }
  }
}
POST /sites/:site_id/channel_rules/preview.json Förhandsgranska kanalen för en exempelhänvisare och UTM-taggar channel_rules_preview

Behörighet: analytics.read

Exempel
curl -X POST https://privatusanalytics.com/sites/:site_id/channel_rules/preview.json \
  -H "Authorization: Bearer $PRIVATUS_TOKEN" \
  -H "Content-Type: application/json" -d '{…}'
Indata
{
  "type": "object",
  "properties": {
    "referrer": {
      "type": "string",
      "description": "Hänvisar-URL eller värdnamn"
    },
    "utm_source": {
      "type": "string",
      "description": "utm_source-värde"
    },
    "utm_medium": {
      "type": "string",
      "description": "utm_medium-värde"
    },
    "utm_campaign": {
      "type": "string",
      "description": "utm_campaign-värde"
    },
    "ref": {
      "type": "string",
      "description": "ref-/via-/source-parameter"
    },
    "path": {
      "type": "string",
      "description": "Landningssidans sökväg, t.ex. /pricing"
    },
    "paid_click": {
      "type": "boolean",
      "description": "URL:en hade ett klick-id som gclid",
      "default": false
    },
    "site_id": {
      "type": "string",
      "description": "Webbplats-id, t.ex. pa_7Q2K9XH3AB"
    }
  },
  "required": [
    "site_id"
  ]
}
Svarsdata
{
  "type": "object"
}
PATCH /sites/:site_id/channel_rules/:id.json Ändra en kanalregel channel_rules_update

Behörighet: sites.manage

Exempel
curl -X PATCH https://privatusanalytics.com/sites/:site_id/channel_rules/:id.json \
  -H "Authorization: Bearer $PRIVATUS_TOKEN" \
  -H "Content-Type: application/json" -d '{…}'
Indata
{
  "type": "object",
  "properties": {
    "channel": {
      "type": "string",
      "description": "Kanalnamn att tilldela"
    },
    "conditions": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "field": {
            "type": "string"
          },
          "operator": {
            "type": "string"
          },
          "value": {
            "type": "string"
          }
        }
      },
      "description": "Villkor som alla måste matcha: [{\"field\": \"utm_source\", \"operator\": \"is\", \"value\": \"newsletter\"}]. Fält: referrer_host, utm_source, utm_medium, utm_campaign, ref, path. Operatorer: is, contains, starts_with, regex."
    },
    "site_id": {
      "type": "string",
      "description": "Webbplats-id, t.ex. pa_7Q2K9XH3AB"
    },
    "id": {
      "type": "string",
      "description": "Id för resursen"
    }
  },
  "required": [
    "site_id",
    "id"
  ]
}
Svarsdata
{
  "type": "object",
  "properties": {
    "id": {
      "type": "string",
      "format": "uuid",
      "description": "Regel-id"
    },
    "channel": {
      "type": "string",
      "description": "Kanal som tilldelas när alla villkor matchar"
    },
    "position": {
      "type": "integer",
      "description": "Utvärderingsordning (första träffen vinner)"
    },
    "conditions": {
      "type": "array",
      "description": "Villkor: fält, operator, värde"
    },
    "created_at": {
      "type": "string",
      "format": "date-time"
    }
  }
}

Konto

GET /account.json Hämta din profil och dina inställningar account_get

Behörighet: member

Exempel
curl https://privatusanalytics.com/account.json \
  -H "Authorization: Bearer $PRIVATUS_TOKEN"
Indata
{
  "type": "object",
  "properties": {},
  "required": []
}
Svarsdata
{
  "type": "object",
  "properties": {
    "email": {
      "type": "string"
    },
    "unconfirmed_email": {
      "anyOf": [
        {
          "type": "string",
          "description": "Ny e-postadress som väntar på bekräftelse"
        },
        {
          "type": "null"
        }
      ]
    },
    "name": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ]
    },
    "theme": {
      "type": "string"
    },
    "default_landing": {
      "type": "string"
    },
    "locale": {
      "type": "string",
      "description": "Språkkod för appen för det här kontot (en som standard)"
    },
    "timezone": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ]
    },
    "shortcuts_enabled": {
      "type": "boolean"
    },
    "reduce_motion": {
      "type": "boolean"
    },
    "product_emails": {
      "type": "boolean"
    },
    "marketing_emails": {
      "type": "boolean",
      "description": "Om marknadsföringsmejl (droppkampanjer) får skickas. false efter en avregistrering"
    },
    "newsletter": {
      "type": "boolean"
    },
    "two_factor": {
      "type": "boolean"
    },
    "passkeys": {
      "type": "integer"
    },
    "created_at": {
      "type": "string",
      "format": "date-time"
    }
  }
}
PATCH /account.json Uppdatera din profil och dina inställningar account_update

Behörighet: member

Exempel
curl -X PATCH https://privatusanalytics.com/account.json \
  -H "Authorization: Bearer $PRIVATUS_TOKEN" \
  -H "Content-Type: application/json" -d '{…}'
Indata
{
  "type": "object",
  "properties": {
    "name": {
      "type": "string",
      "description": "Ditt namn"
    },
    "email": {
      "type": "string",
      "description": "Ny e-postadress (bekräftas först via e-post)"
    },
    "theme": {
      "type": "string",
      "description": "Färgtema",
      "enum": [
        "system",
        "light",
        "dark"
      ]
    },
    "default_landing": {
      "type": "string",
      "description": "Sida efter inloggning: sites eller last_site",
      "enum": [
        "sites",
        "last_site"
      ]
    },
    "locale": {
      "type": "string",
      "description": "Appens språk när du är inloggad, som språkkod (en, de, fr och så vidare). Publika sidor och API:et påverkas inte",
      "enum": [
        "en",
        "de",
        "es",
        "fr",
        "it",
        "nl",
        "pt",
        "pl",
        "sv",
        "da",
        "no",
        "fi",
        "ja",
        "ko",
        "zh-CN",
        "zh-TW"
      ]
    },
    "timezone": {
      "type": "string",
      "description": "Din tidszon (IANA-namn)"
    },
    "shortcuts_enabled": {
      "type": "boolean",
      "description": "Kortkommandon"
    },
    "reduce_motion": {
      "type": "boolean",
      "description": "Minska animationer"
    },
    "product_emails": {
      "type": "boolean",
      "description": "Mejl om produktuppdateringar och tips"
    },
    "marketing_emails": {
      "type": "boolean",
      "description": "Marknadsföringsmejl, till exempel introduktionstips. För att slå på dem igen efter en avregistrering krävs en inloggad webbläsare"
    },
    "newsletter": {
      "type": "boolean",
      "description": "Månatligt nyhetsbrev"
    }
  },
  "required": []
}
Svarsdata
{
  "type": "object",
  "properties": {
    "email": {
      "type": "string"
    },
    "unconfirmed_email": {
      "anyOf": [
        {
          "type": "string",
          "description": "Ny e-postadress som väntar på bekräftelse"
        },
        {
          "type": "null"
        }
      ]
    },
    "name": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ]
    },
    "theme": {
      "type": "string"
    },
    "default_landing": {
      "type": "string"
    },
    "locale": {
      "type": "string",
      "description": "Språkkod för appen för det här kontot (en som standard)"
    },
    "timezone": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ]
    },
    "shortcuts_enabled": {
      "type": "boolean"
    },
    "reduce_motion": {
      "type": "boolean"
    },
    "product_emails": {
      "type": "boolean"
    },
    "marketing_emails": {
      "type": "boolean",
      "description": "Om marknadsföringsmejl (droppkampanjer) får skickas. false efter en avregistrering"
    },
    "newsletter": {
      "type": "boolean"
    },
    "two_factor": {
      "type": "boolean"
    },
    "passkeys": {
      "type": "integer"
    },
    "created_at": {
      "type": "string",
      "format": "date-time"
    }
  }
}

Live

GET /sites/:site_id/live.json Live-besökare, aktivitetsström och vad som är populärt just nu (senaste 30 minuterna) live_get

Behörighet: analytics.read

Exempel
curl https://privatusanalytics.com/sites/:site_id/live.json \
  -H "Authorization: Bearer $PRIVATUS_TOKEN"
Indata
{
  "type": "object",
  "properties": {
    "feed": {
      "type": "string",
      "description": "Aktivitetsström: alla träffar, sidvisningar eller egna händelser",
      "enum": [
        "all",
        "pageviews",
        "events"
      ],
      "default": "all"
    },
    "limit": {
      "type": "integer",
      "description": "Poster i aktivitetsströmmen (max 100)",
      "default": 50
    },
    "site_id": {
      "type": "string",
      "description": "Webbplats-id, t.ex. pa_7Q2K9XH3AB"
    }
  },
  "required": [
    "site_id"
  ]
}
Svarsdata
{
  "type": "object"
}
GET /sites/:site_id/live/wallboard.json Wallboard-kort (live och idag) för en eller flera webbplatser live_wallboard

Behörighet: analytics.read

Exempel
curl https://privatusanalytics.com/sites/:site_id/live/wallboard.json \
  -H "Authorization: Bearer $PRIVATUS_TOKEN"
Indata
{
  "type": "object",
  "properties": {
    "site_ids": {
      "type": "array",
      "items": {
        "type": "string"
      },
      "description": "Webbplats-id att rotera mellan (standard är den här webbplatsen)",
      "default": []
    },
    "rotate_seconds": {
      "type": "integer",
      "description": "Sekunder varje webbplats visas på skärmen (5-300)",
      "default": 20
    },
    "site_id": {
      "type": "string",
      "description": "Webbplats-id, t.ex. pa_7Q2K9XH3AB"
    }
  },
  "required": [
    "site_id"
  ]
}
Svarsdata
{
  "type": "object"
}
GET /wallboard/:token.json Wallboard för en wallboard-token (ingen inloggning krävs) live_public_wallboard

Behörighet: public · Endast HTTP (inte ett MCP-verktyg)

Exempel
curl https://privatusanalytics.com/wallboard/:token.json
Indata
{
  "type": "object",
  "properties": {
    "site_ids": {
      "type": "array",
      "items": {
        "type": "string"
      },
      "description": "Webbplats-id att rotera mellan (standard är den här webbplatsen)",
      "default": []
    },
    "rotate_seconds": {
      "type": "integer",
      "description": "Sekunder varje webbplats visas på skärmen (5-300)",
      "default": 20
    },
    "token": {
      "type": "string",
      "description": "Token för resursen"
    }
  },
  "required": [
    "token"
  ]
}
Svarsdata
{
  "type": "object"
}

Medlemmar

POST /workspaces/:workspace_id/invitations.json Bjud in personer via e-post invitations_create

Behörighet: members.manage

Exempel
curl -X POST https://privatusanalytics.com/workspaces/:workspace_id/invitations.json \
  -H "Authorization: Bearer $PRIVATUS_TOKEN" \
  -H "Content-Type: application/json" -d '{…}'
Indata
{
  "type": "object",
  "properties": {
    "emails": {
      "type": "array",
      "items": {
        "type": "string"
      },
      "description": "E-postadresser att bjuda in"
    },
    "role": {
      "type": "string",
      "description": "Roll för de nya medlemmarna (custom kräver custom_role_id)",
      "enum": [
        "admin",
        "editor",
        "analyst",
        "viewer",
        "billing",
        "custom"
      ],
      "default": "viewer"
    },
    "custom_role_id": {
      "type": "string",
      "description": "Id för egen roll (Business)"
    },
    "all_sites": {
      "type": "boolean",
      "description": "Åtkomst till alla webbplatser, även framtida",
      "default": true
    },
    "site_ids": {
      "type": "array",
      "items": {
        "type": "string"
      },
      "description": "Webbplats-id (pa_…) när all_sites är false",
      "default": []
    },
    "workspace_id": {
      "type": "string",
      "description": "Arbetsyte-id, t.ex. ws_7Q2K9XH3AB"
    }
  },
  "required": [
    "emails",
    "workspace_id"
  ]
}
Svarsdata
{
  "type": "object",
  "properties": {
    "id": {
      "type": "string",
      "format": "uuid"
    },
    "email": {
      "type": "string"
    },
    "role": {
      "type": "string"
    },
    "custom_role": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ]
    },
    "all_sites": {
      "type": "boolean"
    },
    "site_ids": {
      "type": "array",
      "items": {
        "type": "string"
      }
    },
    "invited_by": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ]
    },
    "expires_at": {
      "type": "string",
      "format": "date-time"
    },
    "created_at": {
      "type": "string",
      "format": "date-time"
    }
  }
}
DELETE /workspaces/:workspace_id/invitations/:id.json Återkalla en väntande inbjudan invitations_delete

Behörighet: members.manage

Exempel
curl -X DELETE https://privatusanalytics.com/workspaces/:workspace_id/invitations/:id.json \
  -H "Authorization: Bearer $PRIVATUS_TOKEN" \
  -H "Content-Type: application/json" -d '{…}'
Indata
{
  "type": "object",
  "properties": {
    "workspace_id": {
      "type": "string",
      "description": "Arbetsyte-id, t.ex. ws_7Q2K9XH3AB"
    },
    "id": {
      "type": "string",
      "description": "Id för resursen"
    }
  },
  "required": [
    "workspace_id",
    "id"
  ]
}
Svarsdata
{
  "type": "object",
  "properties": {
    "id": {
      "type": "string",
      "format": "uuid"
    },
    "email": {
      "type": "string"
    },
    "role": {
      "type": "string"
    },
    "custom_role": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ]
    },
    "all_sites": {
      "type": "boolean"
    },
    "site_ids": {
      "type": "array",
      "items": {
        "type": "string"
      }
    },
    "invited_by": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ]
    },
    "expires_at": {
      "type": "string",
      "format": "date-time"
    },
    "created_at": {
      "type": "string",
      "format": "date-time"
    }
  }
}
GET /workspaces/:workspace_id/invitations.json Lista väntande inbjudningar invitations_list

Behörighet: members.manage

Exempel
curl https://privatusanalytics.com/workspaces/:workspace_id/invitations.json \
  -H "Authorization: Bearer $PRIVATUS_TOKEN"
Indata
{
  "type": "object",
  "properties": {
    "workspace_id": {
      "type": "string",
      "description": "Arbetsyte-id, t.ex. ws_7Q2K9XH3AB"
    },
    "page": {
      "type": "integer",
      "description": "Sida (från 1)"
    },
    "per_page": {
      "type": "integer",
      "description": "Resultat per sida (max 100)"
    }
  },
  "required": [
    "workspace_id"
  ]
}
Svarsdata
{
  "type": "array",
  "items": {
    "type": "object",
    "properties": {
      "id": {
        "type": "string",
        "format": "uuid"
      },
      "email": {
        "type": "string"
      },
      "role": {
        "type": "string"
      },
      "custom_role": {
        "anyOf": [
          {
            "type": "string"
          },
          {
            "type": "null"
          }
        ]
      },
      "all_sites": {
        "type": "boolean"
      },
      "site_ids": {
        "type": "array",
        "items": {
          "type": "string"
        }
      },
      "invited_by": {
        "anyOf": [
          {
            "type": "string"
          },
          {
            "type": "null"
          }
        ]
      },
      "expires_at": {
        "type": "string",
        "format": "date-time"
      },
      "created_at": {
        "type": "string",
        "format": "date-time"
      }
    }
  }
}
DELETE /workspaces/:workspace_id/members/:id.json Ta bort en medlem (eller lämna arbetsytan) members_delete

Behörighet: member

Exempel
curl -X DELETE https://privatusanalytics.com/workspaces/:workspace_id/members/:id.json \
  -H "Authorization: Bearer $PRIVATUS_TOKEN" \
  -H "Content-Type: application/json" -d '{…}'
Indata
{
  "type": "object",
  "properties": {
    "workspace_id": {
      "type": "string",
      "description": "Arbetsyte-id, t.ex. ws_7Q2K9XH3AB"
    },
    "id": {
      "type": "string",
      "description": "Id för resursen"
    }
  },
  "required": [
    "workspace_id",
    "id"
  ]
}
Svarsdata
{
  "type": "object",
  "properties": {
    "id": {
      "type": "string",
      "format": "uuid",
      "description": "Medlems-id (använd det för att uppdatera eller ta bort medlemmen)"
    },
    "email": {
      "type": "string"
    },
    "name": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ]
    },
    "role": {
      "type": "string",
      "description": "owner, admin, editor, analyst, viewer, billing eller custom"
    },
    "custom_role": {
      "anyOf": [
        {
          "type": "string",
          "description": "Namn på egen roll"
        },
        {
          "type": "null"
        }
      ]
    },
    "custom_role_id": {
      "anyOf": [
        {
          "type": "string",
          "format": "uuid"
        },
        {
          "type": "null"
        }
      ]
    },
    "all_sites": {
      "type": "boolean",
      "description": "Åtkomst till alla webbplatser"
    },
    "include_future_sites": {
      "type": "boolean"
    },
    "site_ids": {
      "type": "array",
      "items": {
        "type": "string"
      },
      "description": "Webbplats-id när all_sites är false"
    },
    "two_factor": {
      "type": "boolean",
      "description": "Har 2FA eller en passkey"
    },
    "last_active_at": {
      "anyOf": [
        {
          "type": "string",
          "format": "date-time"
        },
        {
          "type": "null"
        }
      ]
    },
    "created_at": {
      "type": "string",
      "format": "date-time",
      "description": "Gick med"
    }
  }
}
GET /workspaces/:workspace_id/members.json Lista arbetsytans medlemmar members_list

Behörighet: member

Exempel
curl https://privatusanalytics.com/workspaces/:workspace_id/members.json \
  -H "Authorization: Bearer $PRIVATUS_TOKEN"
Indata
{
  "type": "object",
  "properties": {
    "query": {
      "type": "string",
      "description": "Filtrera efter namn eller e-post"
    },
    "role": {
      "type": "string",
      "description": "Endast medlemmar med den här rollen",
      "enum": [
        "owner",
        "admin",
        "editor",
        "analyst",
        "viewer",
        "billing",
        "custom"
      ]
    },
    "workspace_id": {
      "type": "string",
      "description": "Arbetsyte-id, t.ex. ws_7Q2K9XH3AB"
    },
    "page": {
      "type": "integer",
      "description": "Sida (från 1)"
    },
    "per_page": {
      "type": "integer",
      "description": "Resultat per sida (max 100)"
    }
  },
  "required": [
    "workspace_id"
  ]
}
Svarsdata
{
  "type": "array",
  "items": {
    "type": "object",
    "properties": {
      "id": {
        "type": "string",
        "format": "uuid",
        "description": "Medlems-id (använd det för att uppdatera eller ta bort medlemmen)"
      },
      "email": {
        "type": "string"
      },
      "name": {
        "anyOf": [
          {
            "type": "string"
          },
          {
            "type": "null"
          }
        ]
      },
      "role": {
        "type": "string",
        "description": "owner, admin, editor, analyst, viewer, billing eller custom"
      },
      "custom_role": {
        "anyOf": [
          {
            "type": "string",
            "description": "Namn på egen roll"
          },
          {
            "type": "null"
          }
        ]
      },
      "custom_role_id": {
        "anyOf": [
          {
            "type": "string",
            "format": "uuid"
          },
          {
            "type": "null"
          }
        ]
      },
      "all_sites": {
        "type": "boolean",
        "description": "Åtkomst till alla webbplatser"
      },
      "include_future_sites": {
        "type": "boolean"
      },
      "site_ids": {
        "type": "array",
        "items": {
          "type": "string"
        },
        "description": "Webbplats-id när all_sites är false"
      },
      "two_factor": {
        "type": "boolean",
        "description": "Har 2FA eller en passkey"
      },
      "last_active_at": {
        "anyOf": [
          {
            "type": "string",
            "format": "date-time"
          },
          {
            "type": "null"
          }
        ]
      },
      "created_at": {
        "type": "string",
        "format": "date-time",
        "description": "Gick med"
      }
    }
  }
}
PATCH /workspaces/:workspace_id/members/:id.json Ändra en medlems roll eller webbplatsåtkomst members_update

Behörighet: members.manage

Exempel
curl -X PATCH https://privatusanalytics.com/workspaces/:workspace_id/members/:id.json \
  -H "Authorization: Bearer $PRIVATUS_TOKEN" \
  -H "Content-Type: application/json" -d '{…}'
Indata
{
  "type": "object",
  "properties": {
    "role": {
      "type": "string",
      "description": "Ny roll (custom kräver custom_role_id)",
      "enum": [
        "admin",
        "editor",
        "analyst",
        "viewer",
        "billing",
        "custom"
      ]
    },
    "custom_role_id": {
      "type": "string",
      "description": "Id för egen roll (Business)"
    },
    "all_sites": {
      "type": "boolean",
      "description": "Åtkomst till alla webbplatser, även framtida"
    },
    "site_ids": {
      "type": "array",
      "items": {
        "type": "string"
      },
      "description": "Webbplats-id (pa_…) när all_sites är false"
    },
    "include_future_sites": {
      "type": "boolean",
      "description": "Ge även åtkomst till webbplatser som läggs till senare"
    },
    "workspace_id": {
      "type": "string",
      "description": "Arbetsyte-id, t.ex. ws_7Q2K9XH3AB"
    },
    "id": {
      "type": "string",
      "description": "Id för resursen"
    }
  },
  "required": [
    "workspace_id",
    "id"
  ]
}
Svarsdata
{
  "type": "object",
  "properties": {
    "id": {
      "type": "string",
      "format": "uuid",
      "description": "Medlems-id (använd det för att uppdatera eller ta bort medlemmen)"
    },
    "email": {
      "type": "string"
    },
    "name": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ]
    },
    "role": {
      "type": "string",
      "description": "owner, admin, editor, analyst, viewer, billing eller custom"
    },
    "custom_role": {
      "anyOf": [
        {
          "type": "string",
          "description": "Namn på egen roll"
        },
        {
          "type": "null"
        }
      ]
    },
    "custom_role_id": {
      "anyOf": [
        {
          "type": "string",
          "format": "uuid"
        },
        {
          "type": "null"
        }
      ]
    },
    "all_sites": {
      "type": "boolean",
      "description": "Åtkomst till alla webbplatser"
    },
    "include_future_sites": {
      "type": "boolean"
    },
    "site_ids": {
      "type": "array",
      "items": {
        "type": "string"
      },
      "description": "Webbplats-id när all_sites är false"
    },
    "two_factor": {
      "type": "boolean",
      "description": "Har 2FA eller en passkey"
    },
    "last_active_at": {
      "anyOf": [
        {
          "type": "string",
          "format": "date-time"
        },
        {
          "type": "null"
        }
      ]
    },
    "created_at": {
      "type": "string",
      "format": "date-time",
      "description": "Gick med"
    }
  }
}
POST /workspaces/:workspace_id/ownership_transfer.json Överför ägandet av arbetsytan till en annan medlem (endast ägaren, du blir administratör) ownership_transfers_create

Behörighet: member

Exempel
curl -X POST https://privatusanalytics.com/workspaces/:workspace_id/ownership_transfer.json \
  -H "Authorization: Bearer $PRIVATUS_TOKEN" \
  -H "Content-Type: application/json" -d '{…}'
Indata
{
  "type": "object",
  "properties": {
    "membership_id": {
      "type": "string",
      "description": "Medlems-id för den nya ägaren"
    },
    "workspace_id": {
      "type": "string",
      "description": "Arbetsyte-id, t.ex. ws_7Q2K9XH3AB"
    }
  },
  "required": [
    "membership_id",
    "workspace_id"
  ]
}
Svarsdata
{
  "type": "object",
  "properties": {
    "id": {
      "type": "string",
      "format": "uuid",
      "description": "Medlems-id (använd det för att uppdatera eller ta bort medlemmen)"
    },
    "email": {
      "type": "string"
    },
    "name": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ]
    },
    "role": {
      "type": "string",
      "description": "owner, admin, editor, analyst, viewer, billing eller custom"
    },
    "custom_role": {
      "anyOf": [
        {
          "type": "string",
          "description": "Namn på egen roll"
        },
        {
          "type": "null"
        }
      ]
    },
    "custom_role_id": {
      "anyOf": [
        {
          "type": "string",
          "format": "uuid"
        },
        {
          "type": "null"
        }
      ]
    },
    "all_sites": {
      "type": "boolean",
      "description": "Åtkomst till alla webbplatser"
    },
    "include_future_sites": {
      "type": "boolean"
    },
    "site_ids": {
      "type": "array",
      "items": {
        "type": "string"
      },
      "description": "Webbplats-id när all_sites är false"
    },
    "two_factor": {
      "type": "boolean",
      "description": "Har 2FA eller en passkey"
    },
    "last_active_at": {
      "anyOf": [
        {
          "type": "string",
          "format": "date-time"
        },
        {
          "type": "null"
        }
      ]
    },
    "created_at": {
      "type": "string",
      "format": "date-time",
      "description": "Gick med"
    }
  }
}

Mål

POST /sites/:site_id/goals/:id/archive.json Arkivera ett mål (dolt i rapporter) goals_archive

Behörighet: content.write

Exempel
curl -X POST https://privatusanalytics.com/sites/:site_id/goals/:id/archive.json \
  -H "Authorization: Bearer $PRIVATUS_TOKEN" \
  -H "Content-Type: application/json" -d '{…}'
Indata
{
  "type": "object",
  "properties": {
    "site_id": {
      "type": "string",
      "description": "Webbplats-id, t.ex. pa_7Q2K9XH3AB"
    },
    "id": {
      "type": "string",
      "description": "Id för resursen"
    }
  },
  "required": [
    "site_id",
    "id"
  ]
}
Svarsdata
{
  "type": "object",
  "properties": {
    "id": {
      "type": "string",
      "description": "Mål-id, t.ex. goal_7Q2K9XH3AB"
    },
    "name": {
      "type": "string"
    },
    "kind": {
      "type": "string",
      "description": "page, event, engagement, outbound eller download"
    },
    "match_type": {
      "type": "string",
      "description": "exact, prefix, glob eller regex"
    },
    "pattern": {
      "anyOf": [
        {
          "type": "string",
          "description": "Sökväg, domän eller filmönster"
        },
        {
          "type": "null"
        }
      ]
    },
    "hostname": {
      "anyOf": [
        {
          "type": "string",
          "description": "Begränsning till värdnamn (sidmål)"
        },
        {
          "type": "null"
        }
      ]
    },
    "event_name": {
      "anyOf": [
        {
          "type": "string",
          "description": "Namn på egen händelse (händelsemål)"
        },
        {
          "type": "null"
        }
      ]
    },
    "conditions": {
      "type": "array",
      "items": {
        "type": "object"
      },
      "description": "Villkor för händelseegenskaper"
    },
    "scroll_threshold": {
      "anyOf": [
        {
          "type": "integer",
          "description": "Engagemang: scroll %"
        },
        {
          "type": "null"
        }
      ]
    },
    "time_threshold_seconds": {
      "anyOf": [
        {
          "type": "integer",
          "description": "Engagemang: sekunder på sidan"
        },
        {
          "type": "null"
        }
      ]
    },
    "value_mode": {
      "type": "string",
      "description": "none, fixed eller revenue"
    },
    "fixed_value_minor": {
      "anyOf": [
        {
          "type": "integer",
          "description": "Fast värde i minsta enhet"
        },
        {
          "type": "null"
        }
      ]
    },
    "count_mode": {
      "type": "string",
      "description": "once_per_visit eller every"
    },
    "archived": {
      "type": "boolean"
    },
    "archived_at": {
      "anyOf": [
        {
          "type": "string",
          "format": "date-time"
        },
        {
          "type": "null"
        }
      ]
    },
    "stats": {
      "anyOf": [
        {
          "type": "object",
          "properties": {
            "completions": {
              "type": "integer",
              "description": "Matchande händelser, upprepningar inräknade"
            },
            "conversions": {
              "type": "integer",
              "description": "Besök med minst ett slutförande"
            },
            "conversion_rate": {
              "type": "number",
              "description": "Konverteringar ÷ besök (eller ÷ besökare, enligt webbplatsinställningen), %"
            },
            "value": {
              "type": "integer",
              "description": "Målvärde i webbplatsens valutas minsta enhet"
            },
            "change": {
              "anyOf": [
                {
                  "type": "number",
                  "description": "Förändring av konverteringar mot föregående period, %"
                },
                {
                  "type": "null"
                }
              ]
            }
          },
          "description": "Periodstatistik (endast lista)"
        },
        {
          "type": "null"
        }
      ]
    },
    "created_at": {
      "type": "string",
      "format": "date-time"
    },
    "updated_at": {
      "type": "string",
      "format": "date-time"
    }
  }
}
POST /sites/:site_id/goals.json Skapa ett mål goals_create

Behörighet: content.write

Exempel
curl -X POST https://privatusanalytics.com/sites/:site_id/goals.json \
  -H "Authorization: Bearer $PRIVATUS_TOKEN" \
  -H "Content-Type: application/json" -d '{…}'
Indata
{
  "type": "object",
  "properties": {
    "name": {
      "type": "string",
      "description": "Målets namn",
      "examples": [
        "Signed up"
      ]
    },
    "kind": {
      "type": "string",
      "description": "page (besök på en sida), event (egen händelse), engagement (scroll eller tid på sidan), outbound (klick på utgående länk) eller download (filnedladdning)",
      "enum": [
        "page",
        "event",
        "engagement",
        "outbound",
        "download"
      ]
    },
    "match_type": {
      "type": "string",
      "description": "Hur pattern matchar sökvägen (page, engagement), länkdomänen (outbound) eller filen (download): exact, prefix, glob (*) eller regex",
      "enum": [
        "exact",
        "prefix",
        "glob",
        "regex"
      ],
      "default": "exact"
    },
    "pattern": {
      "type": "string",
      "description": "Sökväg, domän eller filmönster, t.ex. /pricing, /blog/*, stripe.com eller *.pdf"
    },
    "hostname": {
      "type": "string",
      "description": "Räkna bara sidor på det här värdnamnet (sidmål)"
    },
    "event_name": {
      "type": "string",
      "description": "Namn på egen händelse (händelsemål)"
    },
    "conditions": {
      "type": "array",
      "items": {
        "type": "object",
        "additionalProperties": true
      },
      "description": "Villkor för händelseegenskaper: [{\"key\": \"plan\", \"operator\": \"is|is_not|contains|gt|lt\", \"value\": \"pro\"}]",
      "default": []
    },
    "scroll_threshold": {
      "type": "integer",
      "description": "Engagemang: scrolldjup i % att nå"
    },
    "time_threshold_seconds": {
      "type": "integer",
      "description": "Engagemang: sekunder på sidan"
    },
    "value_mode": {
      "type": "string",
      "description": "none, fixed (fixed_value per konvertering) eller revenue (händelsens intäkt)",
      "enum": [
        "none",
        "fixed",
        "revenue"
      ],
      "default": "none"
    },
    "fixed_value": {
      "type": "number",
      "description": "Fast värde per konvertering i webbplatsens valuta, t.ex. 50.0"
    },
    "count_mode": {
      "type": "string",
      "description": "Värdet räknas once_per_visit eller varje slutförande",
      "enum": [
        "once_per_visit",
        "every"
      ],
      "default": "once_per_visit"
    },
    "site_id": {
      "type": "string",
      "description": "Webbplats-id, t.ex. pa_7Q2K9XH3AB"
    }
  },
  "required": [
    "name",
    "kind",
    "site_id"
  ]
}
Svarsdata
{
  "type": "object",
  "properties": {
    "id": {
      "type": "string",
      "description": "Mål-id, t.ex. goal_7Q2K9XH3AB"
    },
    "name": {
      "type": "string"
    },
    "kind": {
      "type": "string",
      "description": "page, event, engagement, outbound eller download"
    },
    "match_type": {
      "type": "string",
      "description": "exact, prefix, glob eller regex"
    },
    "pattern": {
      "anyOf": [
        {
          "type": "string",
          "description": "Sökväg, domän eller filmönster"
        },
        {
          "type": "null"
        }
      ]
    },
    "hostname": {
      "anyOf": [
        {
          "type": "string",
          "description": "Begränsning till värdnamn (sidmål)"
        },
        {
          "type": "null"
        }
      ]
    },
    "event_name": {
      "anyOf": [
        {
          "type": "string",
          "description": "Namn på egen händelse (händelsemål)"
        },
        {
          "type": "null"
        }
      ]
    },
    "conditions": {
      "type": "array",
      "items": {
        "type": "object"
      },
      "description": "Villkor för händelseegenskaper"
    },
    "scroll_threshold": {
      "anyOf": [
        {
          "type": "integer",
          "description": "Engagemang: scroll %"
        },
        {
          "type": "null"
        }
      ]
    },
    "time_threshold_seconds": {
      "anyOf": [
        {
          "type": "integer",
          "description": "Engagemang: sekunder på sidan"
        },
        {
          "type": "null"
        }
      ]
    },
    "value_mode": {
      "type": "string",
      "description": "none, fixed eller revenue"
    },
    "fixed_value_minor": {
      "anyOf": [
        {
          "type": "integer",
          "description": "Fast värde i minsta enhet"
        },
        {
          "type": "null"
        }
      ]
    },
    "count_mode": {
      "type": "string",
      "description": "once_per_visit eller every"
    },
    "archived": {
      "type": "boolean"
    },
    "archived_at": {
      "anyOf": [
        {
          "type": "string",
          "format": "date-time"
        },
        {
          "type": "null"
        }
      ]
    },
    "stats": {
      "anyOf": [
        {
          "type": "object",
          "properties": {
            "completions": {
              "type": "integer",
              "description": "Matchande händelser, upprepningar inräknade"
            },
            "conversions": {
              "type": "integer",
              "description": "Besök med minst ett slutförande"
            },
            "conversion_rate": {
              "type": "number",
              "description": "Konverteringar ÷ besök (eller ÷ besökare, enligt webbplatsinställningen), %"
            },
            "value": {
              "type": "integer",
              "description": "Målvärde i webbplatsens valutas minsta enhet"
            },
            "change": {
              "anyOf": [
                {
                  "type": "number",
                  "description": "Förändring av konverteringar mot föregående period, %"
                },
                {
                  "type": "null"
                }
              ]
            }
          },
          "description": "Periodstatistik (endast lista)"
        },
        {
          "type": "null"
        }
      ]
    },
    "created_at": {
      "type": "string",
      "format": "date-time"
    },
    "updated_at": {
      "type": "string",
      "format": "date-time"
    }
  }
}
DELETE /sites/:site_id/goals/:id.json Ta bort ett mål (data behålls) goals_delete

Behörighet: content.write

Exempel
curl -X DELETE https://privatusanalytics.com/sites/:site_id/goals/:id.json \
  -H "Authorization: Bearer $PRIVATUS_TOKEN" \
  -H "Content-Type: application/json" -d '{…}'
Indata
{
  "type": "object",
  "properties": {
    "site_id": {
      "type": "string",
      "description": "Webbplats-id, t.ex. pa_7Q2K9XH3AB"
    },
    "id": {
      "type": "string",
      "description": "Id för resursen"
    }
  },
  "required": [
    "site_id",
    "id"
  ]
}
Svarsdata
{
  "type": "object",
  "properties": {
    "id": {
      "type": "string",
      "description": "Mål-id, t.ex. goal_7Q2K9XH3AB"
    },
    "name": {
      "type": "string"
    },
    "kind": {
      "type": "string",
      "description": "page, event, engagement, outbound eller download"
    },
    "match_type": {
      "type": "string",
      "description": "exact, prefix, glob eller regex"
    },
    "pattern": {
      "anyOf": [
        {
          "type": "string",
          "description": "Sökväg, domän eller filmönster"
        },
        {
          "type": "null"
        }
      ]
    },
    "hostname": {
      "anyOf": [
        {
          "type": "string",
          "description": "Begränsning till värdnamn (sidmål)"
        },
        {
          "type": "null"
        }
      ]
    },
    "event_name": {
      "anyOf": [
        {
          "type": "string",
          "description": "Namn på egen händelse (händelsemål)"
        },
        {
          "type": "null"
        }
      ]
    },
    "conditions": {
      "type": "array",
      "items": {
        "type": "object"
      },
      "description": "Villkor för händelseegenskaper"
    },
    "scroll_threshold": {
      "anyOf": [
        {
          "type": "integer",
          "description": "Engagemang: scroll %"
        },
        {
          "type": "null"
        }
      ]
    },
    "time_threshold_seconds": {
      "anyOf": [
        {
          "type": "integer",
          "description": "Engagemang: sekunder på sidan"
        },
        {
          "type": "null"
        }
      ]
    },
    "value_mode": {
      "type": "string",
      "description": "none, fixed eller revenue"
    },
    "fixed_value_minor": {
      "anyOf": [
        {
          "type": "integer",
          "description": "Fast värde i minsta enhet"
        },
        {
          "type": "null"
        }
      ]
    },
    "count_mode": {
      "type": "string",
      "description": "once_per_visit eller every"
    },
    "archived": {
      "type": "boolean"
    },
    "archived_at": {
      "anyOf": [
        {
          "type": "string",
          "format": "date-time"
        },
        {
          "type": "null"
        }
      ]
    },
    "stats": {
      "anyOf": [
        {
          "type": "object",
          "properties": {
            "completions": {
              "type": "integer",
              "description": "Matchande händelser, upprepningar inräknade"
            },
            "conversions": {
              "type": "integer",
              "description": "Besök med minst ett slutförande"
            },
            "conversion_rate": {
              "type": "number",
              "description": "Konverteringar ÷ besök (eller ÷ besökare, enligt webbplatsinställningen), %"
            },
            "value": {
              "type": "integer",
              "description": "Målvärde i webbplatsens valutas minsta enhet"
            },
            "change": {
              "anyOf": [
                {
                  "type": "number",
                  "description": "Förändring av konverteringar mot föregående period, %"
                },
                {
                  "type": "null"
                }
              ]
            }
          },
          "description": "Periodstatistik (endast lista)"
        },
        {
          "type": "null"
        }
      ]
    },
    "created_at": {
      "type": "string",
      "format": "date-time"
    },
    "updated_at": {
      "type": "string",
      "format": "date-time"
    }
  }
}
POST /sites/:site_id/goals/:id/duplicate.json Kopiera ett mål goals_duplicate

Behörighet: content.write

Exempel
curl -X POST https://privatusanalytics.com/sites/:site_id/goals/:id/duplicate.json \
  -H "Authorization: Bearer $PRIVATUS_TOKEN" \
  -H "Content-Type: application/json" -d '{…}'
Indata
{
  "type": "object",
  "properties": {
    "name": {
      "type": "string",
      "description": "Namn på kopian"
    },
    "site_id": {
      "type": "string",
      "description": "Webbplats-id, t.ex. pa_7Q2K9XH3AB"
    },
    "id": {
      "type": "string",
      "description": "Id för resursen"
    }
  },
  "required": [
    "site_id",
    "id"
  ]
}
Svarsdata
{
  "type": "object",
  "properties": {
    "id": {
      "type": "string",
      "description": "Mål-id, t.ex. goal_7Q2K9XH3AB"
    },
    "name": {
      "type": "string"
    },
    "kind": {
      "type": "string",
      "description": "page, event, engagement, outbound eller download"
    },
    "match_type": {
      "type": "string",
      "description": "exact, prefix, glob eller regex"
    },
    "pattern": {
      "anyOf": [
        {
          "type": "string",
          "description": "Sökväg, domän eller filmönster"
        },
        {
          "type": "null"
        }
      ]
    },
    "hostname": {
      "anyOf": [
        {
          "type": "string",
          "description": "Begränsning till värdnamn (sidmål)"
        },
        {
          "type": "null"
        }
      ]
    },
    "event_name": {
      "anyOf": [
        {
          "type": "string",
          "description": "Namn på egen händelse (händelsemål)"
        },
        {
          "type": "null"
        }
      ]
    },
    "conditions": {
      "type": "array",
      "items": {
        "type": "object"
      },
      "description": "Villkor för händelseegenskaper"
    },
    "scroll_threshold": {
      "anyOf": [
        {
          "type": "integer",
          "description": "Engagemang: scroll %"
        },
        {
          "type": "null"
        }
      ]
    },
    "time_threshold_seconds": {
      "anyOf": [
        {
          "type": "integer",
          "description": "Engagemang: sekunder på sidan"
        },
        {
          "type": "null"
        }
      ]
    },
    "value_mode": {
      "type": "string",
      "description": "none, fixed eller revenue"
    },
    "fixed_value_minor": {
      "anyOf": [
        {
          "type": "integer",
          "description": "Fast värde i minsta enhet"
        },
        {
          "type": "null"
        }
      ]
    },
    "count_mode": {
      "type": "string",
      "description": "once_per_visit eller every"
    },
    "archived": {
      "type": "boolean"
    },
    "archived_at": {
      "anyOf": [
        {
          "type": "string",
          "format": "date-time"
        },
        {
          "type": "null"
        }
      ]
    },
    "stats": {
      "anyOf": [
        {
          "type": "object",
          "properties": {
            "completions": {
              "type": "integer",
              "description": "Matchande händelser, upprepningar inräknade"
            },
            "conversions": {
              "type": "integer",
              "description": "Besök med minst ett slutförande"
            },
            "conversion_rate": {
              "type": "number",
              "description": "Konverteringar ÷ besök (eller ÷ besökare, enligt webbplatsinställningen), %"
            },
            "value": {
              "type": "integer",
              "description": "Målvärde i webbplatsens valutas minsta enhet"
            },
            "change": {
              "anyOf": [
                {
                  "type": "number",
                  "description": "Förändring av konverteringar mot föregående period, %"
                },
                {
                  "type": "null"
                }
              ]
            }
          },
          "description": "Periodstatistik (endast lista)"
        },
        {
          "type": "null"
        }
      ]
    },
    "created_at": {
      "type": "string",
      "format": "date-time"
    },
    "updated_at": {
      "type": "string",
      "format": "date-time"
    }
  }
}
GET /sites/:site_id/goals.json Lista mål med slutföranden, konverteringar, andel och värde för en period goals_list

Behörighet: analytics.read

Exempel
curl https://privatusanalytics.com/sites/:site_id/goals.json \
  -H "Authorization: Bearer $PRIVATUS_TOKEN"
Indata
{
  "type": "object",
  "properties": {
    "period": {
      "type": "string",
      "description": "Förinställt datumintervall. Använd custom med from/to",
      "enum": [
        "today",
        "yesterday",
        "24h",
        "7d",
        "14d",
        "28d",
        "30d",
        "90d",
        "mtd",
        "last_month",
        "qtd",
        "last_quarter",
        "ytd",
        "12mo",
        "last_year",
        "all",
        "custom"
      ],
      "default": "30d"
    },
    "from": {
      "type": "string",
      "format": "date",
      "description": "Start för eget intervall (webbplatsens tidszon)"
    },
    "to": {
      "type": "string",
      "format": "date",
      "description": "Slut för eget intervall, inklusive"
    },
    "compare": {
      "type": "string",
      "description": "Jämförelseperiod",
      "enum": [
        "none",
        "previous_period",
        "previous_year",
        "custom"
      ],
      "default": "none"
    },
    "compare_from": {
      "type": "string",
      "format": "date",
      "description": "Start för egen jämförelse"
    },
    "compare_to": {
      "type": "string",
      "format": "date",
      "description": "Slut för egen jämförelse"
    },
    "match_weekday": {
      "type": "boolean",
      "description": "Justera jämförelsedagarna efter veckodag",
      "default": false
    },
    "filters": {
      "type": "array",
      "items": {},
      "description": "Filter: [[\"dimension\",\"operator\",\"value\"], …]. Operatorer: is, is_not, any_of, none_of, contains, not_contains, starts_with, regex, not_regex, gt, lt, between. Omslut villkor med {\"any\": [...]} för ELLER.",
      "default": []
    },
    "segment_id": {
      "type": "string",
      "description": "Tillämpa ett sparat segment (seg_…)"
    },
    "include_imported": {
      "type": "boolean",
      "description": "Lägg till importerade historiska data (datum före den första inbyggda händelsen, ignoreras när filter eller ett segment tillämpas)",
      "default": false
    },
    "status": {
      "type": "string",
      "description": "active, archived eller all mål",
      "enum": [
        "active",
        "archived",
        "all"
      ],
      "default": "active"
    },
    "page": {
      "type": "integer",
      "description": "Sidnummer",
      "default": 1
    },
    "per_page": {
      "type": "integer",
      "description": "Mål per sida (max 100)",
      "default": 25
    },
    "site_id": {
      "type": "string",
      "description": "Webbplats-id, t.ex. pa_7Q2K9XH3AB"
    }
  },
  "required": [
    "site_id"
  ]
}
Svarsdata
{
  "type": "array",
  "items": {
    "type": "object",
    "properties": {
      "id": {
        "type": "string",
        "description": "Mål-id, t.ex. goal_7Q2K9XH3AB"
      },
      "name": {
        "type": "string"
      },
      "kind": {
        "type": "string",
        "description": "page, event, engagement, outbound eller download"
      },
      "match_type": {
        "type": "string",
        "description": "exact, prefix, glob eller regex"
      },
      "pattern": {
        "anyOf": [
          {
            "type": "string",
            "description": "Sökväg, domän eller filmönster"
          },
          {
            "type": "null"
          }
        ]
      },
      "hostname": {
        "anyOf": [
          {
            "type": "string",
            "description": "Begränsning till värdnamn (sidmål)"
          },
          {
            "type": "null"
          }
        ]
      },
      "event_name": {
        "anyOf": [
          {
            "type": "string",
            "description": "Namn på egen händelse (händelsemål)"
          },
          {
            "type": "null"
          }
        ]
      },
      "conditions": {
        "type": "array",
        "items": {
          "type": "object"
        },
        "description": "Villkor för händelseegenskaper"
      },
      "scroll_threshold": {
        "anyOf": [
          {
            "type": "integer",
            "description": "Engagemang: scroll %"
          },
          {
            "type": "null"
          }
        ]
      },
      "time_threshold_seconds": {
        "anyOf": [
          {
            "type": "integer",
            "description": "Engagemang: sekunder på sidan"
          },
          {
            "type": "null"
          }
        ]
      },
      "value_mode": {
        "type": "string",
        "description": "none, fixed eller revenue"
      },
      "fixed_value_minor": {
        "anyOf": [
          {
            "type": "integer",
            "description": "Fast värde i minsta enhet"
          },
          {
            "type": "null"
          }
        ]
      },
      "count_mode": {
        "type": "string",
        "description": "once_per_visit eller every"
      },
      "archived": {
        "type": "boolean"
      },
      "archived_at": {
        "anyOf": [
          {
            "type": "string",
            "format": "date-time"
          },
          {
            "type": "null"
          }
        ]
      },
      "stats": {
        "anyOf": [
          {
            "type": "object",
            "properties": {
              "completions": {
                "type": "integer",
                "description": "Matchande händelser, upprepningar inräknade"
              },
              "conversions": {
                "type": "integer",
                "description": "Besök med minst ett slutförande"
              },
              "conversion_rate": {
                "type": "number",
                "description": "Konverteringar ÷ besök (eller ÷ besökare, enligt webbplatsinställningen), %"
              },
              "value": {
                "type": "integer",
                "description": "Målvärde i webbplatsens valutas minsta enhet"
              },
              "change": {
                "anyOf": [
                  {
                    "type": "number",
                    "description": "Förändring av konverteringar mot föregående period, %"
                  },
                  {
                    "type": "null"
                  }
                ]
              }
            },
            "description": "Periodstatistik (endast lista)"
          },
          {
            "type": "null"
          }
        ]
      },
      "created_at": {
        "type": "string",
        "format": "date-time"
      },
      "updated_at": {
        "type": "string",
        "format": "date-time"
      }
    }
  }
}
GET /sites/:site_id/goals/:id.json Målrapport: mätvärden, diagram, uppdelningar och vägen till konvertering goals_get

Behörighet: analytics.read

Exempel
curl https://privatusanalytics.com/sites/:site_id/goals/:id.json \
  -H "Authorization: Bearer $PRIVATUS_TOKEN"
Indata
{
  "type": "object",
  "properties": {
    "period": {
      "type": "string",
      "description": "Förinställt datumintervall. Använd custom med from/to",
      "enum": [
        "today",
        "yesterday",
        "24h",
        "7d",
        "14d",
        "28d",
        "30d",
        "90d",
        "mtd",
        "last_month",
        "qtd",
        "last_quarter",
        "ytd",
        "12mo",
        "last_year",
        "all",
        "custom"
      ],
      "default": "30d"
    },
    "from": {
      "type": "string",
      "format": "date",
      "description": "Start för eget intervall (webbplatsens tidszon)"
    },
    "to": {
      "type": "string",
      "format": "date",
      "description": "Slut för eget intervall, inklusive"
    },
    "compare": {
      "type": "string",
      "description": "Jämförelseperiod",
      "enum": [
        "none",
        "previous_period",
        "previous_year",
        "custom"
      ],
      "default": "none"
    },
    "compare_from": {
      "type": "string",
      "format": "date",
      "description": "Start för egen jämförelse"
    },
    "compare_to": {
      "type": "string",
      "format": "date",
      "description": "Slut för egen jämförelse"
    },
    "match_weekday": {
      "type": "boolean",
      "description": "Justera jämförelsedagarna efter veckodag",
      "default": false
    },
    "filters": {
      "type": "array",
      "items": {},
      "description": "Filter: [[\"dimension\",\"operator\",\"value\"], …]. Operatorer: is, is_not, any_of, none_of, contains, not_contains, starts_with, regex, not_regex, gt, lt, between. Omslut villkor med {\"any\": [...]} för ELLER.",
      "default": []
    },
    "segment_id": {
      "type": "string",
      "description": "Tillämpa ett sparat segment (seg_…)"
    },
    "include_imported": {
      "type": "boolean",
      "description": "Lägg till importerade historiska data (datum före den första inbyggda händelsen, ignoreras när filter eller ett segment tillämpas)",
      "default": false
    },
    "interval": {
      "type": "string",
      "description": "Intervallstorlek för diagrammet",
      "enum": [
        "auto",
        "minute",
        "hour",
        "day",
        "week",
        "month",
        "quarter",
        "year"
      ],
      "default": "auto"
    },
    "site_id": {
      "type": "string",
      "description": "Webbplats-id, t.ex. pa_7Q2K9XH3AB"
    },
    "id": {
      "type": "string",
      "description": "Id för resursen"
    }
  },
  "required": [
    "site_id",
    "id"
  ]
}
Svarsdata
{
  "type": "object",
  "properties": {
    "period": {
      "type": "object",
      "description": "from/to för perioden (UTC)"
    },
    "goal": {
      "type": "object",
      "properties": {
        "id": {
          "type": "string",
          "description": "Mål-id, t.ex. goal_7Q2K9XH3AB"
        },
        "name": {
          "type": "string"
        },
        "kind": {
          "type": "string",
          "description": "page, event, engagement, outbound eller download"
        },
        "match_type": {
          "type": "string",
          "description": "exact, prefix, glob eller regex"
        },
        "pattern": {
          "anyOf": [
            {
              "type": "string",
              "description": "Sökväg, domän eller filmönster"
            },
            {
              "type": "null"
            }
          ]
        },
        "hostname": {
          "anyOf": [
            {
              "type": "string",
              "description": "Begränsning till värdnamn (sidmål)"
            },
            {
              "type": "null"
            }
          ]
        },
        "event_name": {
          "anyOf": [
            {
              "type": "string",
              "description": "Namn på egen händelse (händelsemål)"
            },
            {
              "type": "null"
            }
          ]
        },
        "conditions": {
          "type": "array",
          "items": {
            "type": "object"
          },
          "description": "Villkor för händelseegenskaper"
        },
        "scroll_threshold": {
          "anyOf": [
            {
              "type": "integer",
              "description": "Engagemang: scroll %"
            },
            {
              "type": "null"
            }
          ]
        },
        "time_threshold_seconds": {
          "anyOf": [
            {
              "type": "integer",
              "description": "Engagemang: sekunder på sidan"
            },
            {
              "type": "null"
            }
          ]
        },
        "value_mode": {
          "type": "string",
          "description": "none, fixed eller revenue"
        },
        "fixed_value_minor": {
          "anyOf": [
            {
              "type": "integer",
              "description": "Fast värde i minsta enhet"
            },
            {
              "type": "null"
            }
          ]
        },
        "count_mode": {
          "type": "string",
          "description": "once_per_visit eller every"
        },
        "archived": {
          "type": "boolean"
        },
        "archived_at": {
          "anyOf": [
            {
              "type": "string",
              "format": "date-time"
            },
            {
              "type": "null"
            }
          ]
        },
        "stats": {
          "anyOf": [
            {
              "type": "object",
              "properties": {
                "completions": {
                  "type": "integer",
                  "description": "Matchande händelser, upprepningar inräknade"
                },
                "conversions": {
                  "type": "integer",
                  "description": "Besök med minst ett slutförande"
                },
                "conversion_rate": {
                  "type": "number",
                  "description": "Konverteringar ÷ besök (eller ÷ besökare, enligt webbplatsinställningen), %"
                },
                "value": {
                  "type": "integer",
                  "description": "Målvärde i webbplatsens valutas minsta enhet"
                },
                "change": {
                  "anyOf": [
                    {
                      "type": "number",
                      "description": "Förändring av konverteringar mot föregående period, %"
                    },
                    {
                      "type": "null"
                    }
                  ]
                }
              },
              "description": "Periodstatistik (endast lista)"
            },
            {
              "type": "null"
            }
          ]
        },
        "created_at": {
          "type": "string",
          "format": "date-time"
        },
        "updated_at": {
          "type": "string",
          "format": "date-time"
        }
      },
      "description": "Måldefinitionen"
    },
    "metrics": {
      "type": "object",
      "description": "completions, conversions, conversion_rate (%), value (minsta enhet)"
    },
    "comparison_period": {
      "anyOf": [
        {
          "type": "object",
          "description": "Jämförelsens from/to"
        },
        {
          "type": "null"
        }
      ]
    },
    "comparison": {
      "anyOf": [
        {
          "type": "object",
          "description": "Mätvärden för jämförelseperioden"
        },
        {
          "type": "null"
        }
      ]
    },
    "change": {
      "anyOf": [
        {
          "type": "object",
          "description": "Förändring mot jämförelsen, % per mätvärde"
        },
        {
          "type": "null"
        }
      ]
    },
    "interval": {
      "type": "string",
      "description": "Intervallstorlek för diagrammet"
    },
    "series": {
      "type": "array",
      "items": {
        "type": "object"
      },
      "description": "Per intervall: date, completions, conversions, conversion_rate"
    },
    "breakdowns": {
      "type": "object",
      "description": "Toppvärden efter konverteringar för channel, utm_campaign, entry_page, country och device: value, completions, conversions, conversion_rate"
    },
    "journey": {
      "anyOf": [
        {
          "type": "object",
          "description": "converting_visits, median_seconds_to_convert, median_pages_before och pages_before (sidor som visats tidigare i besöket, per konverterande besök)"
        },
        {
          "type": "null"
        }
      ]
    }
  }
}
POST /sites/:site_id/goals/:id/unarchive.json Återställ ett arkiverat mål goals_unarchive

Behörighet: content.write

Exempel
curl -X POST https://privatusanalytics.com/sites/:site_id/goals/:id/unarchive.json \
  -H "Authorization: Bearer $PRIVATUS_TOKEN" \
  -H "Content-Type: application/json" -d '{…}'
Indata
{
  "type": "object",
  "properties": {
    "site_id": {
      "type": "string",
      "description": "Webbplats-id, t.ex. pa_7Q2K9XH3AB"
    },
    "id": {
      "type": "string",
      "description": "Id för resursen"
    }
  },
  "required": [
    "site_id",
    "id"
  ]
}
Svarsdata
{
  "type": "object",
  "properties": {
    "id": {
      "type": "string",
      "description": "Mål-id, t.ex. goal_7Q2K9XH3AB"
    },
    "name": {
      "type": "string"
    },
    "kind": {
      "type": "string",
      "description": "page, event, engagement, outbound eller download"
    },
    "match_type": {
      "type": "string",
      "description": "exact, prefix, glob eller regex"
    },
    "pattern": {
      "anyOf": [
        {
          "type": "string",
          "description": "Sökväg, domän eller filmönster"
        },
        {
          "type": "null"
        }
      ]
    },
    "hostname": {
      "anyOf": [
        {
          "type": "string",
          "description": "Begränsning till värdnamn (sidmål)"
        },
        {
          "type": "null"
        }
      ]
    },
    "event_name": {
      "anyOf": [
        {
          "type": "string",
          "description": "Namn på egen händelse (händelsemål)"
        },
        {
          "type": "null"
        }
      ]
    },
    "conditions": {
      "type": "array",
      "items": {
        "type": "object"
      },
      "description": "Villkor för händelseegenskaper"
    },
    "scroll_threshold": {
      "anyOf": [
        {
          "type": "integer",
          "description": "Engagemang: scroll %"
        },
        {
          "type": "null"
        }
      ]
    },
    "time_threshold_seconds": {
      "anyOf": [
        {
          "type": "integer",
          "description": "Engagemang: sekunder på sidan"
        },
        {
          "type": "null"
        }
      ]
    },
    "value_mode": {
      "type": "string",
      "description": "none, fixed eller revenue"
    },
    "fixed_value_minor": {
      "anyOf": [
        {
          "type": "integer",
          "description": "Fast värde i minsta enhet"
        },
        {
          "type": "null"
        }
      ]
    },
    "count_mode": {
      "type": "string",
      "description": "once_per_visit eller every"
    },
    "archived": {
      "type": "boolean"
    },
    "archived_at": {
      "anyOf": [
        {
          "type": "string",
          "format": "date-time"
        },
        {
          "type": "null"
        }
      ]
    },
    "stats": {
      "anyOf": [
        {
          "type": "object",
          "properties": {
            "completions": {
              "type": "integer",
              "description": "Matchande händelser, upprepningar inräknade"
            },
            "conversions": {
              "type": "integer",
              "description": "Besök med minst ett slutförande"
            },
            "conversion_rate": {
              "type": "number",
              "description": "Konverteringar ÷ besök (eller ÷ besökare, enligt webbplatsinställningen), %"
            },
            "value": {
              "type": "integer",
              "description": "Målvärde i webbplatsens valutas minsta enhet"
            },
            "change": {
              "anyOf": [
                {
                  "type": "number",
                  "description": "Förändring av konverteringar mot föregående period, %"
                },
                {
                  "type": "null"
                }
              ]
            }
          },
          "description": "Periodstatistik (endast lista)"
        },
        {
          "type": "null"
        }
      ]
    },
    "created_at": {
      "type": "string",
      "format": "date-time"
    },
    "updated_at": {
      "type": "string",
      "format": "date-time"
    }
  }
}
PATCH /sites/:site_id/goals/:id.json Uppdatera ett mål goals_update

Behörighet: content.write

Exempel
curl -X PATCH https://privatusanalytics.com/sites/:site_id/goals/:id.json \
  -H "Authorization: Bearer $PRIVATUS_TOKEN" \
  -H "Content-Type: application/json" -d '{…}'
Indata
{
  "type": "object",
  "properties": {
    "name": {
      "type": "string",
      "description": "Målets namn",
      "examples": [
        "Signed up"
      ]
    },
    "kind": {
      "type": "string",
      "description": "page (besök på en sida), event (egen händelse), engagement (scroll eller tid på sidan), outbound (klick på utgående länk) eller download (filnedladdning)",
      "enum": [
        "page",
        "event",
        "engagement",
        "outbound",
        "download"
      ]
    },
    "match_type": {
      "type": "string",
      "description": "Hur pattern matchar sökvägen (page, engagement), länkdomänen (outbound) eller filen (download): exact, prefix, glob (*) eller regex",
      "enum": [
        "exact",
        "prefix",
        "glob",
        "regex"
      ]
    },
    "pattern": {
      "type": "string",
      "description": "Sökväg, domän eller filmönster, t.ex. /pricing, /blog/*, stripe.com eller *.pdf"
    },
    "hostname": {
      "type": "string",
      "description": "Räkna bara sidor på det här värdnamnet (sidmål)"
    },
    "event_name": {
      "type": "string",
      "description": "Namn på egen händelse (händelsemål)"
    },
    "conditions": {
      "type": "array",
      "items": {
        "type": "object",
        "additionalProperties": true
      },
      "description": "Villkor för händelseegenskaper: [{\"key\": \"plan\", \"operator\": \"is|is_not|contains|gt|lt\", \"value\": \"pro\"}]"
    },
    "scroll_threshold": {
      "type": "integer",
      "description": "Engagemang: scrolldjup i % att nå"
    },
    "time_threshold_seconds": {
      "type": "integer",
      "description": "Engagemang: sekunder på sidan"
    },
    "value_mode": {
      "type": "string",
      "description": "none, fixed (fixed_value per konvertering) eller revenue (händelsens intäkt)",
      "enum": [
        "none",
        "fixed",
        "revenue"
      ]
    },
    "fixed_value": {
      "type": "number",
      "description": "Fast värde per konvertering i webbplatsens valuta, t.ex. 50.0"
    },
    "count_mode": {
      "type": "string",
      "description": "Värdet räknas once_per_visit eller varje slutförande",
      "enum": [
        "once_per_visit",
        "every"
      ]
    },
    "site_id": {
      "type": "string",
      "description": "Webbplats-id, t.ex. pa_7Q2K9XH3AB"
    },
    "id": {
      "type": "string",
      "description": "Id för resursen"
    }
  },
  "required": [
    "site_id",
    "id"
  ]
}
Svarsdata
{
  "type": "object",
  "properties": {
    "id": {
      "type": "string",
      "description": "Mål-id, t.ex. goal_7Q2K9XH3AB"
    },
    "name": {
      "type": "string"
    },
    "kind": {
      "type": "string",
      "description": "page, event, engagement, outbound eller download"
    },
    "match_type": {
      "type": "string",
      "description": "exact, prefix, glob eller regex"
    },
    "pattern": {
      "anyOf": [
        {
          "type": "string",
          "description": "Sökväg, domän eller filmönster"
        },
        {
          "type": "null"
        }
      ]
    },
    "hostname": {
      "anyOf": [
        {
          "type": "string",
          "description": "Begränsning till värdnamn (sidmål)"
        },
        {
          "type": "null"
        }
      ]
    },
    "event_name": {
      "anyOf": [
        {
          "type": "string",
          "description": "Namn på egen händelse (händelsemål)"
        },
        {
          "type": "null"
        }
      ]
    },
    "conditions": {
      "type": "array",
      "items": {
        "type": "object"
      },
      "description": "Villkor för händelseegenskaper"
    },
    "scroll_threshold": {
      "anyOf": [
        {
          "type": "integer",
          "description": "Engagemang: scroll %"
        },
        {
          "type": "null"
        }
      ]
    },
    "time_threshold_seconds": {
      "anyOf": [
        {
          "type": "integer",
          "description": "Engagemang: sekunder på sidan"
        },
        {
          "type": "null"
        }
      ]
    },
    "value_mode": {
      "type": "string",
      "description": "none, fixed eller revenue"
    },
    "fixed_value_minor": {
      "anyOf": [
        {
          "type": "integer",
          "description": "Fast värde i minsta enhet"
        },
        {
          "type": "null"
        }
      ]
    },
    "count_mode": {
      "type": "string",
      "description": "once_per_visit eller every"
    },
    "archived": {
      "type": "boolean"
    },
    "archived_at": {
      "anyOf": [
        {
          "type": "string",
          "format": "date-time"
        },
        {
          "type": "null"
        }
      ]
    },
    "stats": {
      "anyOf": [
        {
          "type": "object",
          "properties": {
            "completions": {
              "type": "integer",
              "description": "Matchande händelser, upprepningar inräknade"
            },
            "conversions": {
              "type": "integer",
              "description": "Besök med minst ett slutförande"
            },
            "conversion_rate": {
              "type": "number",
              "description": "Konverteringar ÷ besök (eller ÷ besökare, enligt webbplatsinställningen), %"
            },
            "value": {
              "type": "integer",
              "description": "Målvärde i webbplatsens valutas minsta enhet"
            },
            "change": {
              "anyOf": [
                {
                  "type": "number",
                  "description": "Förändring av konverteringar mot föregående period, %"
                },
                {
                  "type": "null"
                }
              ]
            }
          },
          "description": "Periodstatistik (endast lista)"
        },
        {
          "type": "null"
        }
      ]
    },
    "created_at": {
      "type": "string",
      "format": "date-time"
    },
    "updated_at": {
      "type": "string",
      "format": "date-time"
    }
  }
}

Planer

GET /plans.json Lista planer, priser och gränser plans_list

Behörighet: public

Exempel
curl https://privatusanalytics.com/plans.json
Indata
{
  "type": "object",
  "properties": {
    "page": {
      "type": "integer",
      "description": "Sida (från 1)"
    },
    "per_page": {
      "type": "integer",
      "description": "Resultat per sida (max 100)"
    }
  },
  "required": []
}
Svarsdata
{
  "type": "array",
  "items": {
    "type": "object",
    "properties": {
      "name": {
        "type": "string",
        "description": "free, pro, business eller enterprise"
      },
      "events": {
        "anyOf": [
          {
            "type": "integer",
            "description": "Inkluderade händelser per månad (endast gratisplanen)"
          },
          {
            "type": "null"
          }
        ]
      },
      "badge_bonus": {
        "anyOf": [
          {
            "type": "integer",
            "description": "Extra händelser per månad för att visa märket (gratisplanen)"
          },
          {
            "type": "null"
          }
        ]
      },
      "limits": {
        "type": "object",
        "description": "Plangränser. Null betyder obegränsat"
      },
      "tiers": {
        "type": "array",
        "items": {
          "type": "object",
          "properties": {
            "events": {
              "type": "integer",
              "description": "Inkluderade händelser per månad"
            },
            "monthly": {
              "type": "integer",
              "description": "USD per månad, faktureras månadsvis"
            },
            "yearly": {
              "type": "integer",
              "description": "USD per år, faktureras årsvis (2 månader gratis)"
            },
            "monthly_price_id": {
              "anyOf": [
                {
                  "type": "string",
                  "description": "Paddle-pris-id (månadsvis)"
                },
                {
                  "type": "null"
                }
              ]
            },
            "yearly_price_id": {
              "anyOf": [
                {
                  "type": "string",
                  "description": "Paddle-pris-id (årsvis)"
                },
                {
                  "type": "null"
                }
              ]
            }
          }
        },
        "description": "Prisstege efter händelser per månad"
      },
      "contact_sales": {
        "type": "boolean",
        "description": "Pris per avtal"
      }
    }
  }
}

Prestanda

GET /sites/:site_id/performance.json Web Vitals: p75-resultat, daglig trend och uppdelningar efter sida, enhet, webbläsare och land performance_report

Behörighet: analytics.read

Exempel
curl https://privatusanalytics.com/sites/:site_id/performance.json \
  -H "Authorization: Bearer $PRIVATUS_TOKEN"
Indata
{
  "type": "object",
  "properties": {
    "period": {
      "type": "string",
      "description": "Förinställt datumintervall. Använd custom med from/to",
      "enum": [
        "today",
        "yesterday",
        "24h",
        "7d",
        "14d",
        "28d",
        "30d",
        "90d",
        "mtd",
        "last_month",
        "qtd",
        "last_quarter",
        "ytd",
        "12mo",
        "last_year",
        "all",
        "custom"
      ],
      "default": "30d"
    },
    "from": {
      "type": "string",
      "format": "date",
      "description": "Start för eget intervall (webbplatsens tidszon)"
    },
    "to": {
      "type": "string",
      "format": "date",
      "description": "Slut för eget intervall, inklusive"
    },
    "compare": {
      "type": "string",
      "description": "Jämförelseperiod",
      "enum": [
        "none",
        "previous_period",
        "previous_year",
        "custom"
      ],
      "default": "none"
    },
    "compare_from": {
      "type": "string",
      "format": "date",
      "description": "Start för egen jämförelse"
    },
    "compare_to": {
      "type": "string",
      "format": "date",
      "description": "Slut för egen jämförelse"
    },
    "match_weekday": {
      "type": "boolean",
      "description": "Justera jämförelsedagarna efter veckodag",
      "default": false
    },
    "filters": {
      "type": "array",
      "items": {},
      "description": "Filter: [[\"dimension\",\"operator\",\"value\"], …]. Operatorer: is, is_not, any_of, none_of, contains, not_contains, starts_with, regex, not_regex, gt, lt, between. Omslut villkor med {\"any\": [...]} för ELLER.",
      "default": []
    },
    "segment_id": {
      "type": "string",
      "description": "Tillämpa ett sparat segment (seg_…)"
    },
    "include_imported": {
      "type": "boolean",
      "description": "Lägg till importerade historiska data (datum före den första inbyggda händelsen, ignoreras när filter eller ett segment tillämpas)",
      "default": false
    },
    "metric": {
      "type": "string",
      "description": "Mätvärde för trenden och uppdelningarna",
      "enum": [
        "LCP",
        "INP",
        "CLS",
        "FCP",
        "TTFB"
      ],
      "default": "LCP"
    },
    "limit": {
      "type": "integer",
      "description": "Rader per uppdelning (max 100)",
      "default": 10
    },
    "site_id": {
      "type": "string",
      "description": "Webbplats-id, t.ex. pa_7Q2K9XH3AB"
    }
  },
  "required": [
    "site_id"
  ]
}
Svarsdata
{
  "type": "object"
}

Roller

POST /workspaces/:workspace_id/roles.json Skapa en egen roll roles_create

Behörighet: members.manage

Exempel
curl -X POST https://privatusanalytics.com/workspaces/:workspace_id/roles.json \
  -H "Authorization: Bearer $PRIVATUS_TOKEN" \
  -H "Content-Type: application/json" -d '{…}'
Indata
{
  "type": "object",
  "properties": {
    "name": {
      "type": "string",
      "description": "Rollens namn",
      "examples": [
        "Client reviewer"
      ]
    },
    "permissions": {
      "type": "array",
      "items": {
        "type": "string",
        "enum": [
          "analytics.read",
          "analytics.export",
          "content.write",
          "sites.manage",
          "uptime.manage",
          "members.manage",
          "tokens.manage",
          "billing.manage",
          "workspace.manage"
        ]
      },
      "description": "Behörigheter som rollen ger"
    },
    "workspace_id": {
      "type": "string",
      "description": "Arbetsyte-id, t.ex. ws_7Q2K9XH3AB"
    }
  },
  "required": [
    "name",
    "permissions",
    "workspace_id"
  ]
}
Svarsdata
{
  "type": "object",
  "properties": {
    "id": {
      "type": "string",
      "format": "uuid",
      "description": "Id för egen roll (custom_role_id på medlemmar)"
    },
    "name": {
      "type": "string"
    },
    "permissions": {
      "type": "array",
      "items": {
        "type": "string"
      },
      "description": "Beviljade behörigheter"
    },
    "members": {
      "type": "integer",
      "description": "Medlemmar med den här rollen"
    },
    "created_at": {
      "type": "string",
      "format": "date-time"
    }
  }
}
DELETE /workspaces/:workspace_id/roles/:id.json Ta bort en egen roll (får inte vara i bruk) roles_delete

Behörighet: members.manage

Exempel
curl -X DELETE https://privatusanalytics.com/workspaces/:workspace_id/roles/:id.json \
  -H "Authorization: Bearer $PRIVATUS_TOKEN" \
  -H "Content-Type: application/json" -d '{…}'
Indata
{
  "type": "object",
  "properties": {
    "workspace_id": {
      "type": "string",
      "description": "Arbetsyte-id, t.ex. ws_7Q2K9XH3AB"
    },
    "id": {
      "type": "string",
      "description": "Id för resursen"
    }
  },
  "required": [
    "workspace_id",
    "id"
  ]
}
Svarsdata
{
  "type": "object",
  "properties": {
    "id": {
      "type": "string",
      "format": "uuid",
      "description": "Id för egen roll (custom_role_id på medlemmar)"
    },
    "name": {
      "type": "string"
    },
    "permissions": {
      "type": "array",
      "items": {
        "type": "string"
      },
      "description": "Beviljade behörigheter"
    },
    "members": {
      "type": "integer",
      "description": "Medlemmar med den här rollen"
    },
    "created_at": {
      "type": "string",
      "format": "date-time"
    }
  }
}
GET /workspaces/:workspace_id/roles.json Lista egna roller roles_list

Behörighet: member

Exempel
curl https://privatusanalytics.com/workspaces/:workspace_id/roles.json \
  -H "Authorization: Bearer $PRIVATUS_TOKEN"
Indata
{
  "type": "object",
  "properties": {
    "workspace_id": {
      "type": "string",
      "description": "Arbetsyte-id, t.ex. ws_7Q2K9XH3AB"
    },
    "page": {
      "type": "integer",
      "description": "Sida (från 1)"
    },
    "per_page": {
      "type": "integer",
      "description": "Resultat per sida (max 100)"
    }
  },
  "required": [
    "workspace_id"
  ]
}
Svarsdata
{
  "type": "array",
  "items": {
    "type": "object",
    "properties": {
      "id": {
        "type": "string",
        "format": "uuid",
        "description": "Id för egen roll (custom_role_id på medlemmar)"
      },
      "name": {
        "type": "string"
      },
      "permissions": {
        "type": "array",
        "items": {
          "type": "string"
        },
        "description": "Beviljade behörigheter"
      },
      "members": {
        "type": "integer",
        "description": "Medlemmar med den här rollen"
      },
      "created_at": {
        "type": "string",
        "format": "date-time"
      }
    }
  }
}
PATCH /workspaces/:workspace_id/roles/:id.json Uppdatera en egen roll roles_update

Behörighet: members.manage

Exempel
curl -X PATCH https://privatusanalytics.com/workspaces/:workspace_id/roles/:id.json \
  -H "Authorization: Bearer $PRIVATUS_TOKEN" \
  -H "Content-Type: application/json" -d '{…}'
Indata
{
  "type": "object",
  "properties": {
    "name": {
      "type": "string",
      "description": "Rollens namn"
    },
    "permissions": {
      "type": "array",
      "items": {
        "type": "string",
        "enum": [
          "analytics.read",
          "analytics.export",
          "content.write",
          "sites.manage",
          "uptime.manage",
          "members.manage",
          "tokens.manage",
          "billing.manage",
          "workspace.manage"
        ]
      },
      "description": "Behörigheter som rollen ger"
    },
    "workspace_id": {
      "type": "string",
      "description": "Arbetsyte-id, t.ex. ws_7Q2K9XH3AB"
    },
    "id": {
      "type": "string",
      "description": "Id för resursen"
    }
  },
  "required": [
    "workspace_id",
    "id"
  ]
}
Svarsdata
{
  "type": "object",
  "properties": {
    "id": {
      "type": "string",
      "format": "uuid",
      "description": "Id för egen roll (custom_role_id på medlemmar)"
    },
    "name": {
      "type": "string"
    },
    "permissions": {
      "type": "array",
      "items": {
        "type": "string"
      },
      "description": "Beviljade behörigheter"
    },
    "members": {
      "type": "integer",
      "description": "Medlemmar med den här rollen"
    },
    "created_at": {
      "type": "string",
      "format": "date-time"
    }
  }
}

SCIM

POST /scim/v2/Users.json Etablera en användare scim_users_create

Behörighet: public · Endast HTTP (inte ett MCP-verktyg)

Exempel
curl -X POST https://privatusanalytics.com/scim/v2/Users.json \
  -H "Content-Type: application/json" -d '{…}'
Indata
{
  "type": "object",
  "properties": {
    "userName": {
      "type": "string",
      "description": "E-postadress"
    },
    "name": {
      "type": "object",
      "additionalProperties": true,
      "description": "givenName, familyName, formatted",
      "default": {}
    },
    "active": {
      "type": "boolean",
      "description": "Medlem i arbetsytan",
      "default": true
    }
  },
  "required": [
    "userName"
  ]
}
Svarsdata
{
  "type": "object"
}
DELETE /scim/v2/Users/:id.json Avetablera en användare scim_users_delete

Behörighet: public · Endast HTTP (inte ett MCP-verktyg)

Exempel
curl -X DELETE https://privatusanalytics.com/scim/v2/Users/:id.json \
  -H "Content-Type: application/json" -d '{…}'
Indata
{
  "type": "object",
  "properties": {
    "id": {
      "type": "string",
      "description": "Id för resursen"
    }
  },
  "required": [
    "id"
  ]
}
Svarsdata
{
  "type": "object"
}
GET /scim/v2/Users.json Lista etablerade användare scim_users_list

Behörighet: public · Endast HTTP (inte ett MCP-verktyg)

Exempel
curl https://privatusanalytics.com/scim/v2/Users.json
Indata
{
  "type": "object",
  "properties": {
    "scim_filter": {
      "type": "string",
      "description": "SCIM-filter (frågeparametern `filter`), t.ex. userName eq \"[email protected]\""
    },
    "startIndex": {
      "type": "integer",
      "description": "Ettbaserat index för det första resultatet",
      "default": 1
    },
    "count": {
      "type": "integer",
      "description": "Sidstorlek (max 200)",
      "default": 100
    }
  },
  "required": []
}
Svarsdata
{
  "type": "object"
}
GET /scim/v2/Users/:id.json Hämta en etablerad användare scim_users_get

Behörighet: public · Endast HTTP (inte ett MCP-verktyg)

Exempel
curl https://privatusanalytics.com/scim/v2/Users/:id.json
Indata
{
  "type": "object",
  "properties": {
    "id": {
      "type": "string",
      "description": "Id för resursen"
    }
  },
  "required": [
    "id"
  ]
}
Svarsdata
{
  "type": "object"
}
PATCH /scim/v2/Users/:id.json Uppdatera en användare (PATCH active, name) scim_users_update

Behörighet: public · Endast HTTP (inte ett MCP-verktyg)

Exempel
curl -X PATCH https://privatusanalytics.com/scim/v2/Users/:id.json \
  -H "Content-Type: application/json" -d '{…}'
Indata
{
  "type": "object",
  "properties": {
    "Operations": {
      "type": "array",
      "items": {
        "type": "object",
        "additionalProperties": true
      },
      "description": "SCIM PatchOp-operationer"
    },
    "id": {
      "type": "string",
      "description": "Id för resursen"
    }
  },
  "required": [
    "Operations",
    "id"
  ]
}
Svarsdata
{
  "type": "object"
}

SSO

POST /workspaces/:workspace_id/sso/activate.json Aktivera en testad SSO-konfiguration sso_activate

Behörighet: workspace.manage

Exempel
curl -X POST https://privatusanalytics.com/workspaces/:workspace_id/sso/activate.json \
  -H "Authorization: Bearer $PRIVATUS_TOKEN" \
  -H "Content-Type: application/json" -d '{…}'
Indata
{
  "type": "object",
  "properties": {
    "workspace_id": {
      "type": "string",
      "description": "Arbetsyte-id, t.ex. ws_7Q2K9XH3AB"
    }
  },
  "required": [
    "workspace_id"
  ]
}
Svarsdata
{
  "type": "object",
  "properties": {
    "protocol": {
      "type": "string",
      "description": "saml eller oidc"
    },
    "status": {
      "type": "string",
      "description": "draft, testing, tested eller active"
    },
    "enforced": {
      "type": "boolean",
      "description": "SSO är den enda vägen in (ägaren undantagen)"
    },
    "domains": {
      "type": "array",
      "items": {
        "type": "string"
      },
      "description": "Verifierade e-postdomäner"
    },
    "idp_sso_url": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ]
    },
    "idp_entity_id": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ]
    },
    "idp_cert_present": {
      "type": "boolean"
    },
    "oidc_issuer": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ]
    },
    "oidc_client_id": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ]
    },
    "oidc_client_secret_present": {
      "type": "boolean"
    },
    "default_role": {
      "type": "string"
    },
    "jit_provisioning": {
      "type": "boolean"
    },
    "scim_enabled": {
      "type": "boolean"
    }
  }
}
POST /workspaces/:workspace_id/sso/deactivate.json Stäng av SSO (tillbaka till utkast) sso_deactivate

Behörighet: workspace.manage

Exempel
curl -X POST https://privatusanalytics.com/workspaces/:workspace_id/sso/deactivate.json \
  -H "Authorization: Bearer $PRIVATUS_TOKEN" \
  -H "Content-Type: application/json" -d '{…}'
Indata
{
  "type": "object",
  "properties": {
    "workspace_id": {
      "type": "string",
      "description": "Arbetsyte-id, t.ex. ws_7Q2K9XH3AB"
    }
  },
  "required": [
    "workspace_id"
  ]
}
Svarsdata
{
  "type": "object",
  "properties": {
    "protocol": {
      "type": "string",
      "description": "saml eller oidc"
    },
    "status": {
      "type": "string",
      "description": "draft, testing, tested eller active"
    },
    "enforced": {
      "type": "boolean",
      "description": "SSO är den enda vägen in (ägaren undantagen)"
    },
    "domains": {
      "type": "array",
      "items": {
        "type": "string"
      },
      "description": "Verifierade e-postdomäner"
    },
    "idp_sso_url": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ]
    },
    "idp_entity_id": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ]
    },
    "idp_cert_present": {
      "type": "boolean"
    },
    "oidc_issuer": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ]
    },
    "oidc_client_id": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ]
    },
    "oidc_client_secret_present": {
      "type": "boolean"
    },
    "default_role": {
      "type": "string"
    },
    "jit_provisioning": {
      "type": "boolean"
    },
    "scim_enabled": {
      "type": "boolean"
    }
  }
}
POST /workspaces/:workspace_id/sso/scim_token.json Generera en ny SCIM-token (visas en gång) sso_scim_token

Behörighet: workspace.manage · Endast HTTP (inte ett MCP-verktyg)

Exempel
curl -X POST https://privatusanalytics.com/workspaces/:workspace_id/sso/scim_token.json \
  -H "Authorization: Bearer $PRIVATUS_TOKEN" \
  -H "Content-Type: application/json" -d '{…}'
Indata
{
  "type": "object",
  "properties": {
    "workspace_id": {
      "type": "string",
      "description": "Arbetsyte-id, t.ex. ws_7Q2K9XH3AB"
    }
  },
  "required": [
    "workspace_id"
  ]
}
Svarsdata
{
  "type": "object"
}
GET /workspaces/:workspace_id/sso.json Hämta SSO-inställningar sso_get

Behörighet: workspace.manage

Exempel
curl https://privatusanalytics.com/workspaces/:workspace_id/sso.json \
  -H "Authorization: Bearer $PRIVATUS_TOKEN"
Indata
{
  "type": "object",
  "properties": {
    "workspace_id": {
      "type": "string",
      "description": "Arbetsyte-id, t.ex. ws_7Q2K9XH3AB"
    }
  },
  "required": [
    "workspace_id"
  ]
}
Svarsdata
{
  "type": "object",
  "properties": {
    "protocol": {
      "type": "string",
      "description": "saml eller oidc"
    },
    "status": {
      "type": "string",
      "description": "draft, testing, tested eller active"
    },
    "enforced": {
      "type": "boolean",
      "description": "SSO är den enda vägen in (ägaren undantagen)"
    },
    "domains": {
      "type": "array",
      "items": {
        "type": "string"
      },
      "description": "Verifierade e-postdomäner"
    },
    "idp_sso_url": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ]
    },
    "idp_entity_id": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ]
    },
    "idp_cert_present": {
      "type": "boolean"
    },
    "oidc_issuer": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ]
    },
    "oidc_client_id": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ]
    },
    "oidc_client_secret_present": {
      "type": "boolean"
    },
    "default_role": {
      "type": "string"
    },
    "jit_provisioning": {
      "type": "boolean"
    },
    "scim_enabled": {
      "type": "boolean"
    }
  }
}
PATCH /workspaces/:workspace_id/sso.json Skapa eller uppdatera SSO-inställningar sso_update

Behörighet: workspace.manage

Exempel
curl -X PATCH https://privatusanalytics.com/workspaces/:workspace_id/sso.json \
  -H "Authorization: Bearer $PRIVATUS_TOKEN" \
  -H "Content-Type: application/json" -d '{…}'
Indata
{
  "type": "object",
  "properties": {
    "protocol": {
      "type": "string",
      "description": "saml eller oidc",
      "enum": [
        "saml",
        "oidc"
      ]
    },
    "idp_sso_url": {
      "type": "string",
      "description": "SAML: IdP:ns single sign-on-URL"
    },
    "idp_entity_id": {
      "type": "string",
      "description": "SAML: IdP:ns entity-id (utfärdare)"
    },
    "idp_cert": {
      "type": "string",
      "description": "SAML: IdP:ns X.509-signeringscertifikat (PEM)"
    },
    "oidc_issuer": {
      "type": "string",
      "description": "OIDC: utfärdar-URL (discovery)"
    },
    "oidc_client_id": {
      "type": "string",
      "description": "OIDC: klient-id"
    },
    "oidc_client_secret": {
      "type": "string",
      "description": "OIDC: klienthemlighet (skrivskyddad)"
    },
    "domains": {
      "type": "array",
      "items": {
        "type": "string"
      },
      "description": "Verifierade e-postdomäner som använder den här SSO:n"
    },
    "default_role": {
      "type": "string",
      "description": "Roll för medlemmar som skapas via JIT eller SCIM",
      "enum": [
        "admin",
        "editor",
        "analyst",
        "viewer",
        "billing"
      ]
    },
    "jit_provisioning": {
      "type": "boolean",
      "description": "Skapa medlemmar vid första SSO-inloggningen"
    },
    "enforced": {
      "type": "boolean",
      "description": "Tillåt bara SSO-inloggningar (kräver en aktiv konfiguration)"
    },
    "workspace_id": {
      "type": "string",
      "description": "Arbetsyte-id, t.ex. ws_7Q2K9XH3AB"
    }
  },
  "required": [
    "workspace_id"
  ]
}
Svarsdata
{
  "type": "object",
  "properties": {
    "protocol": {
      "type": "string",
      "description": "saml eller oidc"
    },
    "status": {
      "type": "string",
      "description": "draft, testing, tested eller active"
    },
    "enforced": {
      "type": "boolean",
      "description": "SSO är den enda vägen in (ägaren undantagen)"
    },
    "domains": {
      "type": "array",
      "items": {
        "type": "string"
      },
      "description": "Verifierade e-postdomäner"
    },
    "idp_sso_url": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ]
    },
    "idp_entity_id": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ]
    },
    "idp_cert_present": {
      "type": "boolean"
    },
    "oidc_issuer": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ]
    },
    "oidc_client_id": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ]
    },
    "oidc_client_secret_present": {
      "type": "boolean"
    },
    "default_role": {
      "type": "string"
    },
    "jit_provisioning": {
      "type": "boolean"
    },
    "scim_enabled": {
      "type": "boolean"
    }
  }
}

Segment

POST /sites/:site_id/segments.json Spara filter som ett segment segments_create

Behörighet: content.write

Exempel
curl -X POST https://privatusanalytics.com/sites/:site_id/segments.json \
  -H "Authorization: Bearer $PRIVATUS_TOKEN" \
  -H "Content-Type: application/json" -d '{…}'
Indata
{
  "type": "object",
  "properties": {
    "name": {
      "type": "string",
      "description": "Segmentets namn, t.ex. \"Mobilbesökare från annonser\"",
      "examples": [
        "Mobile visitors from ads"
      ]
    },
    "description": {
      "type": "string",
      "description": "Valfri anteckning om vad segmentet är till för (högst 300 tecken)",
      "examples": [
        "People who might buy the Pro plan"
      ]
    },
    "filters": {
      "type": "array",
      "items": {},
      "description": "Filter som alla måste matcha. Varje post är ett villkor [\"dimension\", \"operator\", \"value\"], eller {\"any\": [villkor]} när något av flera får matcha. Dimensioner: page, entry_page, exit_page, hostname, channel, referrer, referrer_url, ref, utm_source, utm_medium, utm_campaign, utm_content, utm_term, country (ISO-kod, t.ex. US), language, device (desktop, mobile, tablet, tv, other), browser, browser_version, os, os_version, screen, goal (mål-id), event (namn på egen händelse) och prop:<key> (egenskap för egen händelse). Operatorer: is, is_not, contains, not_contains, starts_with, regex, not_regex, any_of och none_of (värdet är en lista), gt och lt (ett tal), between (en lista med två tal). Rader från segmentformuläret accepteras också: {\"dimension\", \"operator\", \"value\", \"property\" (för dimensionen prop), \"join\": \"and\" eller \"or\" (or kombinerar raden med den föregående)}. Exempel: [[\"country\", \"is\", \"US\"], [\"device\", \"is\", \"mobile\"], {\"any\": [[\"page\", \"starts_with\", \"/pricing\"], [\"goal\", \"is\", \"goal_7Q2K9XH3AB\"]]}]",
      "examples": [
        [
          [
            "country",
            "is",
            "US"
          ],
          [
            "device",
            "is",
            "mobile"
          ],
          {
            "any": [
              [
                "page",
                "starts_with",
                "/pricing"
              ],
              [
                "goal",
                "is",
                "goal_7Q2K9XH3AB"
              ]
            ]
          }
        ]
      ]
    },
    "shared": {
      "type": "boolean",
      "description": "Synligt för alla med åtkomst till webbplatsen (false: bara du)",
      "default": true
    },
    "site_id": {
      "type": "string",
      "description": "Webbplats-id, t.ex. pa_7Q2K9XH3AB"
    }
  },
  "required": [
    "name",
    "filters",
    "site_id"
  ]
}
Svarsdata
{
  "type": "object",
  "properties": {
    "id": {
      "type": "string",
      "description": "Segment-id, t.ex. seg_7Q2K9XH3AB"
    },
    "site_id": {
      "type": "string"
    },
    "name": {
      "type": "string"
    },
    "description": {
      "anyOf": [
        {
          "type": "string",
          "description": "Vad segmentet är till för, eller null"
        },
        {
          "type": "null"
        }
      ]
    },
    "filters": {
      "type": "array",
      "description": "Filter i statistikens filterformat: villkor [\"dimension\", \"operator\", \"value\"] som alla måste matcha, och grupper med {\"any\": [villkor]}"
    },
    "summary": {
      "type": "string",
      "description": "Filtren med vanligt språk, t.ex. \"Besökare från USA på mobil som visade /pricing\""
    },
    "shared": {
      "type": "boolean",
      "description": "Synligt för alla med åtkomst till webbplatsen"
    },
    "mine": {
      "type": "boolean",
      "description": "Skapat av dig"
    },
    "created_at": {
      "type": "string",
      "format": "date-time"
    },
    "updated_at": {
      "type": "string",
      "format": "date-time"
    }
  }
}
DELETE /sites/:site_id/segments/:id.json Ta bort ett segment segments_delete

Behörighet: content.write

Exempel
curl -X DELETE https://privatusanalytics.com/sites/:site_id/segments/:id.json \
  -H "Authorization: Bearer $PRIVATUS_TOKEN" \
  -H "Content-Type: application/json" -d '{…}'
Indata
{
  "type": "object",
  "properties": {
    "site_id": {
      "type": "string",
      "description": "Webbplats-id, t.ex. pa_7Q2K9XH3AB"
    },
    "id": {
      "type": "string",
      "description": "Id för resursen"
    }
  },
  "required": [
    "site_id",
    "id"
  ]
}
Svarsdata
{
  "type": "object",
  "properties": {
    "id": {
      "type": "string",
      "description": "Segment-id, t.ex. seg_7Q2K9XH3AB"
    },
    "site_id": {
      "type": "string"
    },
    "name": {
      "type": "string"
    },
    "description": {
      "anyOf": [
        {
          "type": "string",
          "description": "Vad segmentet är till för, eller null"
        },
        {
          "type": "null"
        }
      ]
    },
    "filters": {
      "type": "array",
      "description": "Filter i statistikens filterformat: villkor [\"dimension\", \"operator\", \"value\"] som alla måste matcha, och grupper med {\"any\": [villkor]}"
    },
    "summary": {
      "type": "string",
      "description": "Filtren med vanligt språk, t.ex. \"Besökare från USA på mobil som visade /pricing\""
    },
    "shared": {
      "type": "boolean",
      "description": "Synligt för alla med åtkomst till webbplatsen"
    },
    "mine": {
      "type": "boolean",
      "description": "Skapat av dig"
    },
    "created_at": {
      "type": "string",
      "format": "date-time"
    },
    "updated_at": {
      "type": "string",
      "format": "date-time"
    }
  }
}
GET /sites/:site_id/segments.json Lista segment du kan använda på en webbplats segments_list

Behörighet: analytics.read

Exempel
curl https://privatusanalytics.com/sites/:site_id/segments.json \
  -H "Authorization: Bearer $PRIVATUS_TOKEN"
Indata
{
  "type": "object",
  "properties": {
    "site_id": {
      "type": "string",
      "description": "Webbplats-id, t.ex. pa_7Q2K9XH3AB"
    },
    "page": {
      "type": "integer",
      "description": "Sida (från 1)"
    },
    "per_page": {
      "type": "integer",
      "description": "Resultat per sida (max 100)"
    }
  },
  "required": [
    "site_id"
  ]
}
Svarsdata
{
  "type": "array",
  "items": {
    "type": "object",
    "properties": {
      "id": {
        "type": "string",
        "description": "Segment-id, t.ex. seg_7Q2K9XH3AB"
      },
      "site_id": {
        "type": "string"
      },
      "name": {
        "type": "string"
      },
      "description": {
        "anyOf": [
          {
            "type": "string",
            "description": "Vad segmentet är till för, eller null"
          },
          {
            "type": "null"
          }
        ]
      },
      "filters": {
        "type": "array",
        "description": "Filter i statistikens filterformat: villkor [\"dimension\", \"operator\", \"value\"] som alla måste matcha, och grupper med {\"any\": [villkor]}"
      },
      "summary": {
        "type": "string",
        "description": "Filtren med vanligt språk, t.ex. \"Besökare från USA på mobil som visade /pricing\""
      },
      "shared": {
        "type": "boolean",
        "description": "Synligt för alla med åtkomst till webbplatsen"
      },
      "mine": {
        "type": "boolean",
        "description": "Skapat av dig"
      },
      "created_at": {
        "type": "string",
        "format": "date-time"
      },
      "updated_at": {
        "type": "string",
        "format": "date-time"
      }
    }
  }
}
POST /sites/:site_id/segments/preview.json Beskriv filter med vanligt språk och räkna besökarna de matchade de senaste 30 dagarna segments_preview

Behörighet: analytics.read

Exempel
curl -X POST https://privatusanalytics.com/sites/:site_id/segments/preview.json \
  -H "Authorization: Bearer $PRIVATUS_TOKEN" \
  -H "Content-Type: application/json" -d '{…}'
Indata
{
  "type": "object",
  "properties": {
    "filters": {
      "type": "array",
      "items": {},
      "description": "Filter som alla måste matcha. Varje post är ett villkor [\"dimension\", \"operator\", \"value\"], eller {\"any\": [villkor]} när något av flera får matcha. Dimensioner: page, entry_page, exit_page, hostname, channel, referrer, referrer_url, ref, utm_source, utm_medium, utm_campaign, utm_content, utm_term, country (ISO-kod, t.ex. US), language, device (desktop, mobile, tablet, tv, other), browser, browser_version, os, os_version, screen, goal (mål-id), event (namn på egen händelse) och prop:<key> (egenskap för egen händelse). Operatorer: is, is_not, contains, not_contains, starts_with, regex, not_regex, any_of och none_of (värdet är en lista), gt och lt (ett tal), between (en lista med två tal). Rader från segmentformuläret accepteras också: {\"dimension\", \"operator\", \"value\", \"property\" (för dimensionen prop), \"join\": \"and\" eller \"or\" (or kombinerar raden med den föregående)}. Exempel: [[\"country\", \"is\", \"US\"], [\"device\", \"is\", \"mobile\"], {\"any\": [[\"page\", \"starts_with\", \"/pricing\"], [\"goal\", \"is\", \"goal_7Q2K9XH3AB\"]]}]",
      "examples": [
        [
          [
            "country",
            "is",
            "US"
          ],
          [
            "device",
            "is",
            "mobile"
          ],
          {
            "any": [
              [
                "page",
                "starts_with",
                "/pricing"
              ],
              [
                "goal",
                "is",
                "goal_7Q2K9XH3AB"
              ]
            ]
          }
        ]
      ],
      "default": []
    },
    "site_id": {
      "type": "string",
      "description": "Webbplats-id, t.ex. pa_7Q2K9XH3AB"
    }
  },
  "required": [
    "site_id"
  ]
}
Svarsdata
{
  "type": "object"
}
GET /sites/:site_id/segments/:id.json Hämta ett segment segments_get

Behörighet: analytics.read

Exempel
curl https://privatusanalytics.com/sites/:site_id/segments/:id.json \
  -H "Authorization: Bearer $PRIVATUS_TOKEN"
Indata
{
  "type": "object",
  "properties": {
    "site_id": {
      "type": "string",
      "description": "Webbplats-id, t.ex. pa_7Q2K9XH3AB"
    },
    "id": {
      "type": "string",
      "description": "Id för resursen"
    }
  },
  "required": [
    "site_id",
    "id"
  ]
}
Svarsdata
{
  "type": "object",
  "properties": {
    "id": {
      "type": "string",
      "description": "Segment-id, t.ex. seg_7Q2K9XH3AB"
    },
    "site_id": {
      "type": "string"
    },
    "name": {
      "type": "string"
    },
    "description": {
      "anyOf": [
        {
          "type": "string",
          "description": "Vad segmentet är till för, eller null"
        },
        {
          "type": "null"
        }
      ]
    },
    "filters": {
      "type": "array",
      "description": "Filter i statistikens filterformat: villkor [\"dimension\", \"operator\", \"value\"] som alla måste matcha, och grupper med {\"any\": [villkor]}"
    },
    "summary": {
      "type": "string",
      "description": "Filtren med vanligt språk, t.ex. \"Besökare från USA på mobil som visade /pricing\""
    },
    "shared": {
      "type": "boolean",
      "description": "Synligt för alla med åtkomst till webbplatsen"
    },
    "mine": {
      "type": "boolean",
      "description": "Skapat av dig"
    },
    "created_at": {
      "type": "string",
      "format": "date-time"
    },
    "updated_at": {
      "type": "string",
      "format": "date-time"
    }
  }
}
PATCH /sites/:site_id/segments/:id.json Byt namn på ett segment eller ändra dess filter eller delning segments_update

Behörighet: content.write

Exempel
curl -X PATCH https://privatusanalytics.com/sites/:site_id/segments/:id.json \
  -H "Authorization: Bearer $PRIVATUS_TOKEN" \
  -H "Content-Type: application/json" -d '{…}'
Indata
{
  "type": "object",
  "properties": {
    "name": {
      "type": "string",
      "description": "Segmentets namn"
    },
    "description": {
      "type": "string",
      "description": "Valfri anteckning om vad segmentet är till för (högst 300 tecken, tomt för att rensa)"
    },
    "filters": {
      "type": "array",
      "items": {},
      "description": "Ersättningsfilter, i samma format som vid skapande. Filter som alla måste matcha. Varje post är ett villkor [\"dimension\", \"operator\", \"value\"], eller {\"any\": [villkor]} när något av flera får matcha. Dimensioner: page, entry_page, exit_page, hostname, channel, referrer, referrer_url, ref, utm_source, utm_medium, utm_campaign, utm_content, utm_term, country (ISO-kod, t.ex. US), language, device (desktop, mobile, tablet, tv, other), browser, browser_version, os, os_version, screen, goal (mål-id), event (namn på egen händelse) och prop:<key> (egenskap för egen händelse). Operatorer: is, is_not, contains, not_contains, starts_with, regex, not_regex, any_of och none_of (värdet är en lista), gt och lt (ett tal), between (en lista med två tal). Rader från segmentformuläret accepteras också: {\"dimension\", \"operator\", \"value\", \"property\" (för dimensionen prop), \"join\": \"and\" eller \"or\" (or kombinerar raden med den föregående)}. Exempel: [[\"country\", \"is\", \"US\"], [\"device\", \"is\", \"mobile\"], {\"any\": [[\"page\", \"starts_with\", \"/pricing\"], [\"goal\", \"is\", \"goal_7Q2K9XH3AB\"]]}]",
      "examples": [
        [
          [
            "country",
            "is",
            "US"
          ],
          [
            "device",
            "is",
            "mobile"
          ],
          {
            "any": [
              [
                "page",
                "starts_with",
                "/pricing"
              ],
              [
                "goal",
                "is",
                "goal_7Q2K9XH3AB"
              ]
            ]
          }
        ]
      ]
    },
    "shared": {
      "type": "boolean",
      "description": "Synligt för alla på webbplatsen"
    },
    "site_id": {
      "type": "string",
      "description": "Webbplats-id, t.ex. pa_7Q2K9XH3AB"
    },
    "id": {
      "type": "string",
      "description": "Id för resursen"
    }
  },
  "required": [
    "site_id",
    "id"
  ]
}
Svarsdata
{
  "type": "object",
  "properties": {
    "id": {
      "type": "string",
      "description": "Segment-id, t.ex. seg_7Q2K9XH3AB"
    },
    "site_id": {
      "type": "string"
    },
    "name": {
      "type": "string"
    },
    "description": {
      "anyOf": [
        {
          "type": "string",
          "description": "Vad segmentet är till för, eller null"
        },
        {
          "type": "null"
        }
      ]
    },
    "filters": {
      "type": "array",
      "description": "Filter i statistikens filterformat: villkor [\"dimension\", \"operator\", \"value\"] som alla måste matcha, och grupper med {\"any\": [villkor]}"
    },
    "summary": {
      "type": "string",
      "description": "Filtren med vanligt språk, t.ex. \"Besökare från USA på mobil som visade /pricing\""
    },
    "shared": {
      "type": "boolean",
      "description": "Synligt för alla med åtkomst till webbplatsen"
    },
    "mine": {
      "type": "boolean",
      "description": "Skapat av dig"
    },
    "created_at": {
      "type": "string",
      "format": "date-time"
    },
    "updated_at": {
      "type": "string",
      "format": "date-time"
    }
  }
}

Spårning

POST /sites/:site_id/tracking/ingest_key.json Skapa eller rotera serverns inmatningsnyckel (visas en gång) tracking_ingest_key_rotate

Behörighet: sites.manage

Exempel
curl -X POST https://privatusanalytics.com/sites/:site_id/tracking/ingest_key.json \
  -H "Authorization: Bearer $PRIVATUS_TOKEN" \
  -H "Content-Type: application/json" -d '{…}'
Indata
{
  "type": "object",
  "properties": {
    "site_id": {
      "type": "string",
      "description": "Webbplats-id, t.ex. pa_7Q2K9XH3AB"
    }
  },
  "required": [
    "site_id"
  ]
}
Svarsdata
{
  "type": "object",
  "properties": {
    "site_id": {
      "type": "string",
      "description": "Webbplats-id"
    },
    "key": {
      "type": "string",
      "description": "Inmatningsnyckeln. Visas en gång: spara den nu. Skicka den som Bearer-token till POST /api/events"
    },
    "prefix": {
      "type": "string",
      "description": "Nyckelprefix som visas i inställningarna"
    }
  }
}
DELETE /sites/:site_id/tracking/ingest_key.json Återkalla serverns inmatningsnyckel tracking_ingest_key_revoke

Behörighet: sites.manage

Exempel
curl -X DELETE https://privatusanalytics.com/sites/:site_id/tracking/ingest_key.json \
  -H "Authorization: Bearer $PRIVATUS_TOKEN" \
  -H "Content-Type: application/json" -d '{…}'
Indata
{
  "type": "object",
  "properties": {
    "site_id": {
      "type": "string",
      "description": "Webbplats-id, t.ex. pa_7Q2K9XH3AB"
    }
  },
  "required": [
    "site_id"
  ]
}
Svarsdata
{
  "type": "object",
  "properties": {
    "id": {
      "type": "string",
      "description": "Webbplats-id som används i spårningskoden"
    },
    "workspace_id": {
      "type": "string"
    },
    "domain": {
      "type": "string"
    },
    "name": {
      "type": "string"
    },
    "extra_domains": {
      "type": "array",
      "items": {
        "type": "string"
      }
    },
    "multi_domain_mode": {
      "type": "string"
    },
    "timezone": {
      "type": "string"
    },
    "currency": {
      "type": "string"
    },
    "week_start": {
      "type": "integer"
    },
    "labels": {
      "type": "array",
      "items": {
        "type": "string"
      }
    },
    "honor_dnt": {
      "type": "boolean"
    },
    "honor_gpc": {
      "type": "boolean"
    },
    "pii_scrubber": {
      "type": "boolean"
    },
    "redaction_rules": {
      "type": "array"
    },
    "allowed_params": {
      "type": "array",
      "items": {
        "type": "string"
      }
    },
    "path_masks": {
      "type": "array"
    },
    "retention_months": {
      "anyOf": [
        {
          "type": "integer"
        },
        {
          "type": "null"
        }
      ]
    },
    "bot_filtering": {
      "type": "boolean"
    },
    "traffic_rule_modes": {
      "type": "object"
    },
    "vitals_sample_rate": {
      "type": "integer"
    },
    "conversion_denominator": {
      "type": "string"
    },
    "public_dashboard": {
      "type": "boolean"
    },
    "public_indexable": {
      "type": "boolean"
    },
    "ingest_key_prefix": {
      "anyOf": [
        {
          "type": "string",
          "description": "Början av serverns inmatningsnyckel"
        },
        {
          "type": "null"
        }
      ]
    },
    "verified_at": {
      "anyOf": [
        {
          "type": "string",
          "format": "date-time"
        },
        {
          "type": "null"
        }
      ]
    },
    "first_event_at": {
      "anyOf": [
        {
          "type": "string",
          "format": "date-time"
        },
        {
          "type": "null"
        }
      ]
    },
    "last_event_at": {
      "anyOf": [
        {
          "type": "string",
          "format": "date-time"
        },
        {
          "type": "null"
        }
      ]
    },
    "snippet": {
      "type": "string",
      "description": "HTML-spårningskod"
    },
    "favorite": {
      "type": "boolean",
      "description": "Stjärnmarkerad av dig"
    },
    "created_at": {
      "type": "string",
      "format": "date-time"
    }
  }
}
POST /sites/:site_id/tracking/verify.json Kontrollera att trackern är installerad på webbplatsen (script-tagg, webbplats-id, CSP och referrer policy) tracking_verify

Behörighet: sites.manage

Exempel
curl -X POST https://privatusanalytics.com/sites/:site_id/tracking/verify.json \
  -H "Authorization: Bearer $PRIVATUS_TOKEN" \
  -H "Content-Type: application/json" -d '{…}'
Indata
{
  "type": "object",
  "properties": {
    "url": {
      "type": "string",
      "description": "Sida att kontrollera (standard är https://<domain>/)"
    },
    "site_id": {
      "type": "string",
      "description": "Webbplats-id, t.ex. pa_7Q2K9XH3AB"
    }
  },
  "required": [
    "site_id"
  ]
}
Svarsdata
{
  "type": "object"
}
GET /sites/:site_id/tracking/snippet.json Bygg spårningskoden för valda alternativ tracking_snippet

Behörighet: analytics.read

Exempel
curl https://privatusanalytics.com/sites/:site_id/tracking/snippet.json \
  -H "Authorization: Bearer $PRIVATUS_TOKEN"
Indata
{
  "type": "object",
  "properties": {
    "modules": {
      "type": "array",
      "items": {
        "type": "string"
      },
      "description": "Valfria moduler: auto (utgående länkar, nedladdningar, formulär, 404:or), engage (tid och scroll), vitals (Web Vitals), clicks",
      "default": [
        "engage"
      ]
    },
    "manual": {
      "type": "boolean",
      "description": "Stäng av den automatiska sidvisningen",
      "default": false
    },
    "spa": {
      "type": "string",
      "description": "Spårning av navigering i ensidesappar",
      "enum": [
        "auto",
        "history",
        "hash",
        "off"
      ],
      "default": "auto"
    },
    "domains": {
      "type": "array",
      "items": {
        "type": "string"
      },
      "description": "Spåra bara på dessa värdnamn",
      "default": []
    },
    "exclude": {
      "type": "array",
      "items": {
        "type": "string"
      },
      "description": "Sökvägsmönster som inte ska spåras, t.ex. /admin/*",
      "default": []
    },
    "query_params": {
      "type": "array",
      "items": {
        "type": "string"
      },
      "description": "Extra frågeparametrar att behålla, t.ex. page",
      "default": []
    },
    "mask": {
      "type": "array",
      "items": {
        "type": "string"
      },
      "description": "Sökvägsmasker på klientsidan, t.ex. /u/*->/u/:id",
      "default": []
    },
    "site_id": {
      "type": "string",
      "description": "Webbplats-id, t.ex. pa_7Q2K9XH3AB"
    }
  },
  "required": [
    "site_id"
  ]
}
Svarsdata
{
  "type": "object"
}

Statussidor

GET /status/:slug/confirm/:token.json Bekräfta en prenumeration från den mejlade länken public_status_pages_confirm

Behörighet: public · Endast HTTP (inte ett MCP-verktyg)

Exempel
curl https://privatusanalytics.com/status/:slug/confirm/:token.json
Indata
{
  "type": "object",
  "properties": {
    "token": {
      "type": "string",
      "description": "Token för resursen"
    },
    "slug": {
      "type": "string",
      "description": "Slug för resursen"
    }
  },
  "required": [
    "token",
    "slug"
  ]
}
Svarsdata
{
  "type": "object"
}
GET /status/:slug.json Publik statussida: aktuell status, drifttidsfält för 90 dagar, incidenter och inlägg public_status_pages_get

Behörighet: public · Endast HTTP (inte ett MCP-verktyg)

Exempel
curl https://privatusanalytics.com/status/:slug.json
Indata
{
  "type": "object",
  "properties": {
    "slug": {
      "type": "string",
      "description": "Slug för resursen"
    }
  },
  "required": [
    "slug"
  ]
}
Svarsdata
{
  "type": "object",
  "properties": {
    "name": {
      "type": "string"
    },
    "description": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ]
    },
    "logo_url": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ]
    },
    "brand_color": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ]
    },
    "status": {
      "type": "string",
      "description": "operational, degraded eller outage"
    },
    "checks": {
      "type": "array",
      "description": "Varje: {name, status, uptime_90d, days: [{date, uptime, downtime_seconds}]}"
    },
    "posts": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "description": "Inläggs-id (spp_…)"
          },
          "title": {
            "type": "string"
          },
          "body": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "status": {
            "type": "string",
            "description": "investigating, identified, monitoring eller resolved"
          },
          "posted_at": {
            "type": "string",
            "format": "date-time"
          },
          "updated_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      }
    },
    "incidents": {
      "type": "array",
      "description": "Senaste incidenter: {check, started_at, resolved_at, duration_seconds}"
    }
  }
}
POST /status/:slug/subscribers.json Prenumerera med en e-postadress (dubbel bekräftelse) public_status_pages_subscribe

Webbläsarklienter skickar en Cloudflare Turnstile-token som `cf-turnstile-response`. Förfrågningar med en API-token behöver ingen.

Behörighet: public · Endast HTTP (inte ett MCP-verktyg)

Exempel
curl -X POST https://privatusanalytics.com/status/:slug/subscribers.json \
  -H "Content-Type: application/json" -d '{…}'
Indata
{
  "type": "object",
  "properties": {
    "email": {
      "type": "string",
      "description": "E-postadress att meddela",
      "examples": [
        "[email protected]"
      ]
    },
    "slug": {
      "type": "string",
      "description": "Slug för resursen"
    }
  },
  "required": [
    "email",
    "slug"
  ]
}
Svarsdata
{
  "type": "object"
}
POST /status/:slug/unsubscribe/:token.json Avsluta prenumerationen med den mejlade token public_status_pages_unsubscribe

Behörighet: public · Endast HTTP (inte ett MCP-verktyg)

Exempel
curl -X POST https://privatusanalytics.com/status/:slug/unsubscribe/:token.json \
  -H "Content-Type: application/json" -d '{…}'
Indata
{
  "type": "object",
  "properties": {
    "token": {
      "type": "string",
      "description": "Token för resursen"
    },
    "slug": {
      "type": "string",
      "description": "Slug för resursen"
    }
  },
  "required": [
    "token",
    "slug"
  ]
}
Svarsdata
{
  "type": "object"
}
POST /status_pages/:status_page_id/posts.json Publicera en incidentuppdatering (mejlar prenumeranter) status_page_posts_create

Behörighet: uptime.manage

Exempel
curl -X POST https://privatusanalytics.com/status_pages/:status_page_id/posts.json \
  -H "Authorization: Bearer $PRIVATUS_TOKEN" \
  -H "Content-Type: application/json" -d '{…}'
Indata
{
  "type": "object",
  "properties": {
    "title": {
      "type": "string",
      "description": "Rubrik, t.ex. \"Förhöjd felfrekvens\""
    },
    "body": {
      "type": "string",
      "description": "Uppdateringstext (ren text)"
    },
    "status": {
      "type": "string",
      "description": "investigating, identified, monitoring eller resolved",
      "enum": [
        "investigating",
        "identified",
        "monitoring",
        "resolved"
      ],
      "default": "investigating"
    },
    "posted_at": {
      "type": "string",
      "format": "date-time",
      "description": "När det hände (standard är nu)"
    },
    "notify": {
      "type": "boolean",
      "description": "Mejla bekräftade prenumeranter",
      "default": true
    },
    "status_page_id": {
      "type": "string",
      "description": "Status page för resursen"
    }
  },
  "required": [
    "title",
    "status_page_id"
  ]
}
Svarsdata
{
  "type": "object",
  "properties": {
    "id": {
      "type": "string",
      "description": "Inläggs-id (spp_…)"
    },
    "title": {
      "type": "string"
    },
    "body": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ]
    },
    "status": {
      "type": "string",
      "description": "investigating, identified, monitoring eller resolved"
    },
    "posted_at": {
      "type": "string",
      "format": "date-time"
    },
    "updated_at": {
      "type": "string",
      "format": "date-time"
    }
  }
}
DELETE /status_pages/:status_page_id/posts/:id.json Ta bort ett inlägg på en statussida status_page_posts_delete

Behörighet: uptime.manage

Exempel
curl -X DELETE https://privatusanalytics.com/status_pages/:status_page_id/posts/:id.json \
  -H "Authorization: Bearer $PRIVATUS_TOKEN" \
  -H "Content-Type: application/json" -d '{…}'
Indata
{
  "type": "object",
  "properties": {
    "status_page_id": {
      "type": "string",
      "description": "Status page för resursen"
    },
    "id": {
      "type": "string",
      "description": "Id för resursen"
    }
  },
  "required": [
    "status_page_id",
    "id"
  ]
}
Svarsdata
{
  "type": "object",
  "properties": {
    "id": {
      "type": "string",
      "description": "Inläggs-id (spp_…)"
    },
    "title": {
      "type": "string"
    },
    "body": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ]
    },
    "status": {
      "type": "string",
      "description": "investigating, identified, monitoring eller resolved"
    },
    "posted_at": {
      "type": "string",
      "format": "date-time"
    },
    "updated_at": {
      "type": "string",
      "format": "date-time"
    }
  }
}
GET /status_pages/:status_page_id/posts.json Lista inlägg på en statussida status_page_posts_list

Behörighet: analytics.read

Exempel
curl https://privatusanalytics.com/status_pages/:status_page_id/posts.json \
  -H "Authorization: Bearer $PRIVATUS_TOKEN"
Indata
{
  "type": "object",
  "properties": {
    "status": {
      "type": "string",
      "description": "Endast inlägg med den här statusen",
      "enum": [
        "investigating",
        "identified",
        "monitoring",
        "resolved"
      ]
    },
    "status_page_id": {
      "type": "string",
      "description": "Status page för resursen"
    },
    "page": {
      "type": "integer",
      "description": "Sida (från 1)"
    },
    "per_page": {
      "type": "integer",
      "description": "Resultat per sida (max 100)"
    }
  },
  "required": [
    "status_page_id"
  ]
}
Svarsdata
{
  "type": "array",
  "items": {
    "type": "object",
    "properties": {
      "id": {
        "type": "string",
        "description": "Inläggs-id (spp_…)"
      },
      "title": {
        "type": "string"
      },
      "body": {
        "anyOf": [
          {
            "type": "string"
          },
          {
            "type": "null"
          }
        ]
      },
      "status": {
        "type": "string",
        "description": "investigating, identified, monitoring eller resolved"
      },
      "posted_at": {
        "type": "string",
        "format": "date-time"
      },
      "updated_at": {
        "type": "string",
        "format": "date-time"
      }
    }
  }
}
PATCH /status_pages/:status_page_id/posts/:id.json Redigera ett inlägg på en statussida status_page_posts_update

Behörighet: uptime.manage

Exempel
curl -X PATCH https://privatusanalytics.com/status_pages/:status_page_id/posts/:id.json \
  -H "Authorization: Bearer $PRIVATUS_TOKEN" \
  -H "Content-Type: application/json" -d '{…}'
Indata
{
  "type": "object",
  "properties": {
    "title": {
      "type": "string",
      "description": "Rubrik"
    },
    "body": {
      "type": "string",
      "description": "Uppdateringstext (ren text)"
    },
    "status": {
      "type": "string",
      "description": "investigating, identified, monitoring eller resolved",
      "enum": [
        "investigating",
        "identified",
        "monitoring",
        "resolved"
      ]
    },
    "notify": {
      "type": "boolean",
      "description": "Mejla bekräftade prenumeranter om statusen ändras",
      "default": true
    },
    "status_page_id": {
      "type": "string",
      "description": "Status page för resursen"
    },
    "id": {
      "type": "string",
      "description": "Id för resursen"
    }
  },
  "required": [
    "status_page_id",
    "id"
  ]
}
Svarsdata
{
  "type": "object",
  "properties": {
    "id": {
      "type": "string",
      "description": "Inläggs-id (spp_…)"
    },
    "title": {
      "type": "string"
    },
    "body": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ]
    },
    "status": {
      "type": "string",
      "description": "investigating, identified, monitoring eller resolved"
    },
    "posted_at": {
      "type": "string",
      "format": "date-time"
    },
    "updated_at": {
      "type": "string",
      "format": "date-time"
    }
  }
}
DELETE /status_pages/:status_page_id/subscribers/:id.json Ta bort en prenumerant status_page_subscribers_delete

Behörighet: uptime.manage

Exempel
curl -X DELETE https://privatusanalytics.com/status_pages/:status_page_id/subscribers/:id.json \
  -H "Authorization: Bearer $PRIVATUS_TOKEN" \
  -H "Content-Type: application/json" -d '{…}'
Indata
{
  "type": "object",
  "properties": {
    "status_page_id": {
      "type": "string",
      "description": "Status page för resursen"
    },
    "id": {
      "type": "string",
      "description": "Id för resursen"
    }
  },
  "required": [
    "status_page_id",
    "id"
  ]
}
Svarsdata
{
  "type": "object",
  "properties": {
    "id": {
      "type": "string",
      "format": "uuid"
    },
    "email": {
      "type": "string"
    },
    "confirmed_at": {
      "anyOf": [
        {
          "type": "string",
          "format": "date-time"
        },
        {
          "type": "null"
        }
      ]
    },
    "created_at": {
      "type": "string",
      "format": "date-time"
    }
  }
}
GET /status_pages/:status_page_id/subscribers.json Lista prenumeranter på en statussida status_page_subscribers_list

Behörighet: uptime.manage

Exempel
curl https://privatusanalytics.com/status_pages/:status_page_id/subscribers.json \
  -H "Authorization: Bearer $PRIVATUS_TOKEN"
Indata
{
  "type": "object",
  "properties": {
    "confirmed": {
      "type": "boolean",
      "description": "true: endast bekräftade, false: endast väntande"
    },
    "status_page_id": {
      "type": "string",
      "description": "Status page för resursen"
    },
    "page": {
      "type": "integer",
      "description": "Sida (från 1)"
    },
    "per_page": {
      "type": "integer",
      "description": "Resultat per sida (max 100)"
    }
  },
  "required": [
    "status_page_id"
  ]
}
Svarsdata
{
  "type": "array",
  "items": {
    "type": "object",
    "properties": {
      "id": {
        "type": "string",
        "format": "uuid"
      },
      "email": {
        "type": "string"
      },
      "confirmed_at": {
        "anyOf": [
          {
            "type": "string",
            "format": "date-time"
          },
          {
            "type": "null"
          }
        ]
      },
      "created_at": {
        "type": "string",
        "format": "date-time"
      }
    }
  }
}
POST /workspaces/:workspace_id/status_pages.json Skapa en statussida status_pages_create

Behörighet: uptime.manage

Exempel
curl -X POST https://privatusanalytics.com/workspaces/:workspace_id/status_pages.json \
  -H "Authorization: Bearer $PRIVATUS_TOKEN" \
  -H "Content-Type: application/json" -d '{…}'
Indata
{
  "type": "object",
  "properties": {
    "name": {
      "type": "string",
      "description": "Sidtitel, t.ex. \"Acme status\""
    },
    "slug": {
      "type": "string",
      "description": "Publik URL-slug: /status/<slug> (standard utifrån namnet)"
    },
    "description": {
      "type": "string",
      "description": "Introduktionstext under titeln"
    },
    "logo_url": {
      "type": "string",
      "description": "HTTPS-URL till en logotypbild"
    },
    "brand_color": {
      "type": "string",
      "description": "Accentfärg, t.ex. #06755b"
    },
    "custom_domain": {
      "type": "string",
      "description": "Egen domän (CNAME till vår värd), t.ex. status.example.com. Tomt för att ta bort"
    },
    "check_ids": {
      "type": "array",
      "items": {
        "type": "string"
      },
      "description": "Id för drifttidskontroller (upc_…) att visa"
    },
    "published": {
      "type": "boolean",
      "description": "Synlig för allmänheten",
      "default": true
    },
    "workspace_id": {
      "type": "string",
      "description": "Arbetsyte-id, t.ex. ws_7Q2K9XH3AB"
    }
  },
  "required": [
    "name",
    "workspace_id"
  ]
}
Svarsdata
{
  "type": "object",
  "properties": {
    "id": {
      "type": "string",
      "description": "Statussides-id (sp_…)"
    },
    "workspace_id": {
      "type": "string"
    },
    "name": {
      "type": "string"
    },
    "slug": {
      "type": "string",
      "description": "Publik URL: /status/<slug>"
    },
    "custom_domain": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ]
    },
    "description": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ]
    },
    "logo_url": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ]
    },
    "brand_color": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ]
    },
    "published": {
      "type": "boolean"
    },
    "check_ids": {
      "type": "array",
      "items": {
        "type": "string"
      },
      "description": "Id för visade drifttidskontroller"
    },
    "subscribers": {
      "type": "integer",
      "description": "Bekräftade prenumeranter"
    },
    "created_at": {
      "type": "string",
      "format": "date-time"
    }
  }
}
DELETE /status_pages/:id.json Ta bort en statussida status_pages_delete

Behörighet: uptime.manage

Exempel
curl -X DELETE https://privatusanalytics.com/status_pages/:id.json \
  -H "Authorization: Bearer $PRIVATUS_TOKEN" \
  -H "Content-Type: application/json" -d '{…}'
Indata
{
  "type": "object",
  "properties": {
    "id": {
      "type": "string",
      "description": "Id för resursen"
    }
  },
  "required": [
    "id"
  ]
}
Svarsdata
{
  "type": "object",
  "properties": {
    "id": {
      "type": "string",
      "description": "Statussides-id (sp_…)"
    },
    "workspace_id": {
      "type": "string"
    },
    "name": {
      "type": "string"
    },
    "slug": {
      "type": "string",
      "description": "Publik URL: /status/<slug>"
    },
    "custom_domain": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ]
    },
    "description": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ]
    },
    "logo_url": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ]
    },
    "brand_color": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ]
    },
    "published": {
      "type": "boolean"
    },
    "check_ids": {
      "type": "array",
      "items": {
        "type": "string"
      },
      "description": "Id för visade drifttidskontroller"
    },
    "subscribers": {
      "type": "integer",
      "description": "Bekräftade prenumeranter"
    },
    "created_at": {
      "type": "string",
      "format": "date-time"
    }
  }
}
GET /workspaces/:workspace_id/status_pages.json Lista statussidor status_pages_list

Behörighet: analytics.read

Exempel
curl https://privatusanalytics.com/workspaces/:workspace_id/status_pages.json \
  -H "Authorization: Bearer $PRIVATUS_TOKEN"
Indata
{
  "type": "object",
  "properties": {
    "query": {
      "type": "string",
      "description": "Filtrera efter namn eller slug"
    },
    "workspace_id": {
      "type": "string",
      "description": "Arbetsyte-id, t.ex. ws_7Q2K9XH3AB"
    },
    "page": {
      "type": "integer",
      "description": "Sida (från 1)"
    },
    "per_page": {
      "type": "integer",
      "description": "Resultat per sida (max 100)"
    }
  },
  "required": [
    "workspace_id"
  ]
}
Svarsdata
{
  "type": "array",
  "items": {
    "type": "object",
    "properties": {
      "id": {
        "type": "string",
        "description": "Statussides-id (sp_…)"
      },
      "workspace_id": {
        "type": "string"
      },
      "name": {
        "type": "string"
      },
      "slug": {
        "type": "string",
        "description": "Publik URL: /status/<slug>"
      },
      "custom_domain": {
        "anyOf": [
          {
            "type": "string"
          },
          {
            "type": "null"
          }
        ]
      },
      "description": {
        "anyOf": [
          {
            "type": "string"
          },
          {
            "type": "null"
          }
        ]
      },
      "logo_url": {
        "anyOf": [
          {
            "type": "string"
          },
          {
            "type": "null"
          }
        ]
      },
      "brand_color": {
        "anyOf": [
          {
            "type": "string"
          },
          {
            "type": "null"
          }
        ]
      },
      "published": {
        "type": "boolean"
      },
      "check_ids": {
        "type": "array",
        "items": {
          "type": "string"
        },
        "description": "Id för visade drifttidskontroller"
      },
      "subscribers": {
        "type": "integer",
        "description": "Bekräftade prenumeranter"
      },
      "created_at": {
        "type": "string",
        "format": "date-time"
      }
    }
  }
}
GET /status_pages/:id.json Hämta en statussida status_pages_get

Behörighet: analytics.read

Exempel
curl https://privatusanalytics.com/status_pages/:id.json \
  -H "Authorization: Bearer $PRIVATUS_TOKEN"
Indata
{
  "type": "object",
  "properties": {
    "id": {
      "type": "string",
      "description": "Id för resursen"
    }
  },
  "required": [
    "id"
  ]
}
Svarsdata
{
  "type": "object",
  "properties": {
    "id": {
      "type": "string",
      "description": "Statussides-id (sp_…)"
    },
    "workspace_id": {
      "type": "string"
    },
    "name": {
      "type": "string"
    },
    "slug": {
      "type": "string",
      "description": "Publik URL: /status/<slug>"
    },
    "custom_domain": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ]
    },
    "description": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ]
    },
    "logo_url": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ]
    },
    "brand_color": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ]
    },
    "published": {
      "type": "boolean"
    },
    "check_ids": {
      "type": "array",
      "items": {
        "type": "string"
      },
      "description": "Id för visade drifttidskontroller"
    },
    "subscribers": {
      "type": "integer",
      "description": "Bekräftade prenumeranter"
    },
    "created_at": {
      "type": "string",
      "format": "date-time"
    }
  }
}
PATCH /status_pages/:id.json Ändra en statussida status_pages_update

Behörighet: uptime.manage

Exempel
curl -X PATCH https://privatusanalytics.com/status_pages/:id.json \
  -H "Authorization: Bearer $PRIVATUS_TOKEN" \
  -H "Content-Type: application/json" -d '{…}'
Indata
{
  "type": "object",
  "properties": {
    "name": {
      "type": "string",
      "description": "Sidtitel, t.ex. \"Acme status\""
    },
    "slug": {
      "type": "string",
      "description": "Publik URL-slug: /status/<slug> (standard utifrån namnet)"
    },
    "description": {
      "type": "string",
      "description": "Introduktionstext under titeln"
    },
    "logo_url": {
      "type": "string",
      "description": "HTTPS-URL till en logotypbild"
    },
    "brand_color": {
      "type": "string",
      "description": "Accentfärg, t.ex. #06755b"
    },
    "custom_domain": {
      "type": "string",
      "description": "Egen domän (CNAME till vår värd), t.ex. status.example.com. Tomt för att ta bort"
    },
    "check_ids": {
      "type": "array",
      "items": {
        "type": "string"
      },
      "description": "Id för drifttidskontroller (upc_…) att visa"
    },
    "published": {
      "type": "boolean",
      "description": "Synlig för allmänheten"
    },
    "id": {
      "type": "string",
      "description": "Id för resursen"
    }
  },
  "required": [
    "id"
  ]
}
Svarsdata
{
  "type": "object",
  "properties": {
    "id": {
      "type": "string",
      "description": "Statussides-id (sp_…)"
    },
    "workspace_id": {
      "type": "string"
    },
    "name": {
      "type": "string"
    },
    "slug": {
      "type": "string",
      "description": "Publik URL: /status/<slug>"
    },
    "custom_domain": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ]
    },
    "description": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ]
    },
    "logo_url": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ]
    },
    "brand_color": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ]
    },
    "published": {
      "type": "boolean"
    },
    "check_ids": {
      "type": "array",
      "items": {
        "type": "string"
      },
      "description": "Id för visade drifttidskontroller"
    },
    "subscribers": {
      "type": "integer",
      "description": "Bekräftade prenumeranter"
    },
    "created_at": {
      "type": "string",
      "format": "date-time"
    }
  }
}

Sök

GET /sites/:site_id/search.json Sökrapport: klick, visningar, CTR, position, toppfrågor och toppsidor, landningssidor och möjligheter search_report

Behörighet: analytics.read

Exempel
curl https://privatusanalytics.com/sites/:site_id/search.json \
  -H "Authorization: Bearer $PRIVATUS_TOKEN"
Indata
{
  "type": "object",
  "properties": {
    "period": {
      "type": "string",
      "description": "Förinställt datumintervall. Använd custom med from/to",
      "enum": [
        "today",
        "yesterday",
        "24h",
        "7d",
        "14d",
        "28d",
        "30d",
        "90d",
        "mtd",
        "last_month",
        "qtd",
        "last_quarter",
        "ytd",
        "12mo",
        "last_year",
        "all",
        "custom"
      ],
      "default": "30d"
    },
    "from": {
      "type": "string",
      "format": "date",
      "description": "Start för eget intervall (webbplatsens tidszon)"
    },
    "to": {
      "type": "string",
      "format": "date",
      "description": "Slut för eget intervall, inklusive"
    },
    "compare": {
      "type": "string",
      "description": "Jämförelseperiod",
      "enum": [
        "none",
        "previous_period",
        "previous_year",
        "custom"
      ],
      "default": "none"
    },
    "compare_from": {
      "type": "string",
      "format": "date",
      "description": "Start för egen jämförelse"
    },
    "compare_to": {
      "type": "string",
      "format": "date",
      "description": "Slut för egen jämförelse"
    },
    "match_weekday": {
      "type": "boolean",
      "description": "Justera jämförelsedagarna efter veckodag",
      "default": false
    },
    "filters": {
      "type": "array",
      "items": {},
      "description": "Filter: [[\"dimension\",\"operator\",\"value\"], …]. Operatorer: is, is_not, any_of, none_of, contains, not_contains, starts_with, regex, not_regex, gt, lt, between. Omslut villkor med {\"any\": [...]} för ELLER.",
      "default": []
    },
    "segment_id": {
      "type": "string",
      "description": "Tillämpa ett sparat segment (seg_…)"
    },
    "include_imported": {
      "type": "boolean",
      "description": "Lägg till importerade historiska data (datum före den första inbyggda händelsen, ignoreras när filter eller ett segment tillämpas)",
      "default": false
    },
    "provider": {
      "type": "string",
      "description": "google (Search Console) eller bing",
      "enum": [
        "google",
        "bing"
      ],
      "default": "google"
    },
    "limit": {
      "type": "integer",
      "description": "Rader per tabell (max 100)",
      "default": 25
    },
    "site_id": {
      "type": "string",
      "description": "Webbplats-id, t.ex. pa_7Q2K9XH3AB"
    }
  },
  "required": [
    "site_id"
  ]
}
Svarsdata
{
  "type": "object"
}
POST /sites/:site_id/search/connections.json Anslut en Search Console-egenskap eller en Bing-webbplats search_connect

Behörighet: sites.manage

Exempel
curl -X POST https://privatusanalytics.com/sites/:site_id/search/connections.json \
  -H "Authorization: Bearer $PRIVATUS_TOKEN" \
  -H "Content-Type: application/json" -d '{…}'
Indata
{
  "type": "object",
  "properties": {
    "provider": {
      "type": "string",
      "description": "google eller bing",
      "enum": [
        "google",
        "bing"
      ],
      "default": "google"
    },
    "property": {
      "type": "string",
      "description": "Search Console-egenskap (t.ex. sc-domain:example.com) eller Bing-webbplats-URL",
      "examples": [
        "sc-domain:example.com"
      ]
    },
    "bing_api_key": {
      "type": "string",
      "description": "Din egen API-nyckel för Bing Webmaster Tools (Settings > API access). Krävs när provider är bing. Lagras krypterad och returneras aldrig."
    },
    "site_id": {
      "type": "string",
      "description": "Webbplats-id, t.ex. pa_7Q2K9XH3AB"
    }
  },
  "required": [
    "property",
    "site_id"
  ]
}
Svarsdata
{
  "type": "object",
  "properties": {
    "provider": {
      "type": "string",
      "description": "google eller bing"
    },
    "property": {
      "type": "string",
      "description": "Search Console-egenskap eller Bing-webbplats-URL"
    },
    "status": {
      "type": "string",
      "description": "active eller error"
    },
    "last_synced_at": {
      "anyOf": [
        {
          "type": "string",
          "format": "date-time"
        },
        {
          "type": "null"
        }
      ]
    },
    "created_at": {
      "type": "string",
      "format": "date-time"
    }
  }
}
DELETE /sites/:site_id/search/connections/:provider.json Koppla från Search Console eller Bing och ta bort dess data search_disconnect

Behörighet: sites.manage

Exempel
curl -X DELETE https://privatusanalytics.com/sites/:site_id/search/connections/:provider.json \
  -H "Authorization: Bearer $PRIVATUS_TOKEN" \
  -H "Content-Type: application/json" -d '{…}'
Indata
{
  "type": "object",
  "properties": {
    "site_id": {
      "type": "string",
      "description": "Webbplats-id, t.ex. pa_7Q2K9XH3AB"
    },
    "provider": {
      "type": "string",
      "description": "Provider för resursen"
    }
  },
  "required": [
    "site_id",
    "provider"
  ]
}
Svarsdata
{
  "type": "object",
  "properties": {
    "provider": {
      "type": "string",
      "description": "google eller bing"
    },
    "property": {
      "type": "string",
      "description": "Search Console-egenskap eller Bing-webbplats-URL"
    },
    "status": {
      "type": "string",
      "description": "active eller error"
    },
    "last_synced_at": {
      "anyOf": [
        {
          "type": "string",
          "format": "date-time"
        },
        {
          "type": "null"
        }
      ]
    },
    "created_at": {
      "type": "string",
      "format": "date-time"
    }
  }
}
POST /sites/:site_id/search/properties.json Lista egenskaper du kan ansluta (Search Console kräver ett Google-medgivande från webbläsaren) search_properties

Behörighet: sites.manage

Exempel
curl -X POST https://privatusanalytics.com/sites/:site_id/search/properties.json \
  -H "Authorization: Bearer $PRIVATUS_TOKEN" \
  -H "Content-Type: application/json" -d '{…}'
Indata
{
  "type": "object",
  "properties": {
    "provider": {
      "type": "string",
      "description": "google eller bing",
      "enum": [
        "google",
        "bing"
      ],
      "default": "google"
    },
    "bing_api_key": {
      "type": "string",
      "description": "Din egen API-nyckel för Bing Webmaster Tools (Settings > API access). Krävs när provider är bing. Används bara för att lista de webbplatser den kan se."
    },
    "site_id": {
      "type": "string",
      "description": "Webbplats-id, t.ex. pa_7Q2K9XH3AB"
    }
  },
  "required": [
    "site_id"
  ]
}
Svarsdata
{
  "type": "object"
}
POST /sites/:site_id/search/sync.json Importera sökdata nu search_sync

Behörighet: sites.manage

Exempel
curl -X POST https://privatusanalytics.com/sites/:site_id/search/sync.json \
  -H "Authorization: Bearer $PRIVATUS_TOKEN" \
  -H "Content-Type: application/json" -d '{…}'
Indata
{
  "type": "object",
  "properties": {
    "provider": {
      "type": "string",
      "description": "google eller bing",
      "enum": [
        "google",
        "bing"
      ],
      "default": "google"
    },
    "site_id": {
      "type": "string",
      "description": "Webbplats-id, t.ex. pa_7Q2K9XH3AB"
    }
  },
  "required": [
    "site_id"
  ]
}
Svarsdata
{
  "type": "object",
  "properties": {
    "provider": {
      "type": "string",
      "description": "google eller bing"
    },
    "property": {
      "type": "string",
      "description": "Search Console-egenskap eller Bing-webbplats-URL"
    },
    "status": {
      "type": "string",
      "description": "active eller error"
    },
    "last_synced_at": {
      "anyOf": [
        {
          "type": "string",
          "format": "date-time"
        },
        {
          "type": "null"
        }
      ]
    },
    "created_at": {
      "type": "string",
      "format": "date-time"
    }
  }
}

Trafikregler

POST /sites/:site_id/traffic_rules.json Lägg till en trafikregel traffic_rules_create

Behörighet: sites.manage

Exempel
curl -X POST https://privatusanalytics.com/sites/:site_id/traffic_rules.json \
  -H "Authorization: Bearer $PRIVATUS_TOKEN" \
  -H "Content-Type: application/json" -d '{…}'
Indata
{
  "type": "object",
  "properties": {
    "list": {
      "type": "string",
      "description": "hostnames, paths, referrers, countries, ip_ranges, user_agents eller events",
      "enum": [
        "hostnames",
        "paths",
        "referrers",
        "countries",
        "ip_ranges",
        "user_agents",
        "events"
      ]
    },
    "pattern": {
      "type": "string",
      "description": "Värde att matcha. * är ett jokertecken. ip_ranges tar en IP-adress eller CIDR (v4/v6), countries en ISO-kod",
      "examples": [
        "/admin/*"
      ]
    },
    "label": {
      "type": "string",
      "description": "Valfri anteckning, t.ex. \"Kontoret\""
    },
    "site_id": {
      "type": "string",
      "description": "Webbplats-id, t.ex. pa_7Q2K9XH3AB"
    }
  },
  "required": [
    "list",
    "pattern",
    "site_id"
  ]
}
Svarsdata
{
  "type": "object",
  "properties": {
    "id": {
      "type": "string",
      "format": "uuid",
      "description": "Regel-id"
    },
    "list": {
      "type": "string",
      "description": "hostnames, paths, referrers, countries, ip_ranges, user_agents eller events"
    },
    "pattern": {
      "type": "string",
      "description": "Mönster (* jokertecken, CIDR för ip_ranges)"
    },
    "label": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ]
    },
    "mode": {
      "type": "string",
      "description": "block eller allow (listans läge)"
    },
    "created_at": {
      "type": "string",
      "format": "date-time"
    }
  }
}
DELETE /sites/:site_id/traffic_rules/:id.json Ta bort en trafikregel traffic_rules_delete

Behörighet: sites.manage

Exempel
curl -X DELETE https://privatusanalytics.com/sites/:site_id/traffic_rules/:id.json \
  -H "Authorization: Bearer $PRIVATUS_TOKEN" \
  -H "Content-Type: application/json" -d '{…}'
Indata
{
  "type": "object",
  "properties": {
    "site_id": {
      "type": "string",
      "description": "Webbplats-id, t.ex. pa_7Q2K9XH3AB"
    },
    "id": {
      "type": "string",
      "description": "Id för resursen"
    }
  },
  "required": [
    "site_id",
    "id"
  ]
}
Svarsdata
{
  "type": "object",
  "properties": {
    "id": {
      "type": "string",
      "format": "uuid",
      "description": "Regel-id"
    },
    "list": {
      "type": "string",
      "description": "hostnames, paths, referrers, countries, ip_ranges, user_agents eller events"
    },
    "pattern": {
      "type": "string",
      "description": "Mönster (* jokertecken, CIDR för ip_ranges)"
    },
    "label": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ]
    },
    "mode": {
      "type": "string",
      "description": "block eller allow (listans läge)"
    },
    "created_at": {
      "type": "string",
      "format": "date-time"
    }
  }
}
GET /sites/:site_id/traffic_rules.json Lista trafikregler traffic_rules_list

Behörighet: analytics.read

Exempel
curl https://privatusanalytics.com/sites/:site_id/traffic_rules.json \
  -H "Authorization: Bearer $PRIVATUS_TOKEN"
Indata
{
  "type": "object",
  "properties": {
    "list": {
      "type": "string",
      "description": "Endast regler i den här listan",
      "enum": [
        "hostnames",
        "paths",
        "referrers",
        "countries",
        "ip_ranges",
        "user_agents",
        "events"
      ]
    },
    "site_id": {
      "type": "string",
      "description": "Webbplats-id, t.ex. pa_7Q2K9XH3AB"
    }
  },
  "required": [
    "site_id"
  ]
}
Svarsdata
{
  "type": "object",
  "properties": {
    "id": {
      "type": "string",
      "format": "uuid",
      "description": "Regel-id"
    },
    "list": {
      "type": "string",
      "description": "hostnames, paths, referrers, countries, ip_ranges, user_agents eller events"
    },
    "pattern": {
      "type": "string",
      "description": "Mönster (* jokertecken, CIDR för ip_ranges)"
    },
    "label": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ]
    },
    "mode": {
      "type": "string",
      "description": "block eller allow (listans läge)"
    },
    "created_at": {
      "type": "string",
      "format": "date-time"
    }
  }
}
POST /sites/:site_id/traffic_rules/test.json Testa om ett träff skulle räknas med webbplatsens nuvarande regler traffic_rules_test

Behörighet: analytics.read

Exempel
curl -X POST https://privatusanalytics.com/sites/:site_id/traffic_rules/test.json \
  -H "Authorization: Bearer $PRIVATUS_TOKEN" \
  -H "Content-Type: application/json" -d '{…}'
Indata
{
  "type": "object",
  "properties": {
    "url": {
      "type": "string",
      "description": "Sidans URL, t.ex. https://example.com/a"
    },
    "referrer": {
      "type": "string",
      "description": "Hänvisar-URL eller värdnamn"
    },
    "country": {
      "type": "string",
      "description": "ISO-landskod, t.ex. US"
    },
    "ip": {
      "type": "string",
      "description": "IP-adress att testa mot ip_ranges (lagras inte)"
    },
    "user_agent": {
      "type": "string",
      "description": "User-Agent-sträng (reduceras till webbläsare och huvudversion, som vid inmatning)"
    },
    "event": {
      "type": "string",
      "description": "Namn på egen händelse"
    },
    "site_id": {
      "type": "string",
      "description": "Webbplats-id, t.ex. pa_7Q2K9XH3AB"
    }
  },
  "required": [
    "site_id"
  ]
}
Svarsdata
{
  "type": "object"
}
PATCH /sites/:site_id/traffic_rules/:id.json Ändra en trafikregel traffic_rules_update

Behörighet: sites.manage

Exempel
curl -X PATCH https://privatusanalytics.com/sites/:site_id/traffic_rules/:id.json \
  -H "Authorization: Bearer $PRIVATUS_TOKEN" \
  -H "Content-Type: application/json" -d '{…}'
Indata
{
  "type": "object",
  "properties": {
    "pattern": {
      "type": "string",
      "description": "Nytt mönster"
    },
    "label": {
      "type": "string",
      "description": "Ny etikett"
    },
    "site_id": {
      "type": "string",
      "description": "Webbplats-id, t.ex. pa_7Q2K9XH3AB"
    },
    "id": {
      "type": "string",
      "description": "Id för resursen"
    }
  },
  "required": [
    "site_id",
    "id"
  ]
}
Svarsdata
{
  "type": "object",
  "properties": {
    "id": {
      "type": "string",
      "format": "uuid",
      "description": "Regel-id"
    },
    "list": {
      "type": "string",
      "description": "hostnames, paths, referrers, countries, ip_ranges, user_agents eller events"
    },
    "pattern": {
      "type": "string",
      "description": "Mönster (* jokertecken, CIDR för ip_ranges)"
    },
    "label": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ]
    },
    "mode": {
      "type": "string",
      "description": "block eller allow (listans läge)"
    },
    "created_at": {
      "type": "string",
      "format": "date-time"
    }
  }
}

Trattar

POST /sites/:site_id/funnels.json Skapa en tratt funnels_create

Behörighet: content.write

Exempel
curl -X POST https://privatusanalytics.com/sites/:site_id/funnels.json \
  -H "Authorization: Bearer $PRIVATUS_TOKEN" \
  -H "Content-Type: application/json" -d '{…}'
Indata
{
  "type": "object",
  "properties": {
    "name": {
      "type": "string",
      "description": "Trattens namn",
      "examples": [
        "Signup flow"
      ]
    },
    "steps": {
      "type": "array",
      "items": {
        "type": "object",
        "additionalProperties": true
      },
      "description": "Steg i ordning (2 till din plangräns): [{\"type\": \"page|event|goal\", \"value\": \"/pricing | Signup | goal_…\", \"match\": \"exact|prefix|glob|regex\" (sidsteg), \"name\": \"optional label\"}]"
    },
    "order_mode": {
      "type": "string",
      "description": "strict: steg i den här ordningen, any: i valfri ordning",
      "enum": [
        "strict",
        "any"
      ],
      "default": "strict"
    },
    "window": {
      "type": "string",
      "description": "Konverteringsfönster: visit, eller day (mäts inom ett besök, som aldrig sträcker sig över ett UTC-dygn)",
      "enum": [
        "visit",
        "day"
      ],
      "default": "visit"
    },
    "site_id": {
      "type": "string",
      "description": "Webbplats-id, t.ex. pa_7Q2K9XH3AB"
    }
  },
  "required": [
    "name",
    "steps",
    "site_id"
  ]
}
Svarsdata
{
  "type": "object",
  "properties": {
    "id": {
      "type": "string",
      "description": "Tratt-id, t.ex. fun_7Q2K9XH3AB"
    },
    "name": {
      "type": "string"
    },
    "steps": {
      "type": "array",
      "items": {
        "type": "object"
      },
      "description": "Steg: {type: page|event|goal, value, match, name}"
    },
    "order_mode": {
      "type": "string",
      "description": "strict eller any"
    },
    "window": {
      "type": "string",
      "description": "visit eller day"
    },
    "stats": {
      "anyOf": [
        {
          "type": "object",
          "properties": {
            "entered": {
              "type": "integer",
              "description": "Besök som nådde steg 1"
            },
            "completed": {
              "type": "integer",
              "description": "Besök som nådde sista steget"
            },
            "conversion_rate": {
              "type": "number",
              "description": "Slutförda ÷ ingångar, %"
            }
          },
          "description": "Periodstatistik (endast lista)"
        },
        {
          "type": "null"
        }
      ]
    },
    "created_at": {
      "type": "string",
      "format": "date-time"
    },
    "updated_at": {
      "type": "string",
      "format": "date-time"
    }
  }
}
DELETE /sites/:site_id/funnels/:id.json Ta bort en tratt funnels_delete

Behörighet: content.write

Exempel
curl -X DELETE https://privatusanalytics.com/sites/:site_id/funnels/:id.json \
  -H "Authorization: Bearer $PRIVATUS_TOKEN" \
  -H "Content-Type: application/json" -d '{…}'
Indata
{
  "type": "object",
  "properties": {
    "site_id": {
      "type": "string",
      "description": "Webbplats-id, t.ex. pa_7Q2K9XH3AB"
    },
    "id": {
      "type": "string",
      "description": "Id för resursen"
    }
  },
  "required": [
    "site_id",
    "id"
  ]
}
Svarsdata
{
  "type": "object",
  "properties": {
    "id": {
      "type": "string",
      "description": "Tratt-id, t.ex. fun_7Q2K9XH3AB"
    },
    "name": {
      "type": "string"
    },
    "steps": {
      "type": "array",
      "items": {
        "type": "object"
      },
      "description": "Steg: {type: page|event|goal, value, match, name}"
    },
    "order_mode": {
      "type": "string",
      "description": "strict eller any"
    },
    "window": {
      "type": "string",
      "description": "visit eller day"
    },
    "stats": {
      "anyOf": [
        {
          "type": "object",
          "properties": {
            "entered": {
              "type": "integer",
              "description": "Besök som nådde steg 1"
            },
            "completed": {
              "type": "integer",
              "description": "Besök som nådde sista steget"
            },
            "conversion_rate": {
              "type": "number",
              "description": "Slutförda ÷ ingångar, %"
            }
          },
          "description": "Periodstatistik (endast lista)"
        },
        {
          "type": "null"
        }
      ]
    },
    "created_at": {
      "type": "string",
      "format": "date-time"
    },
    "updated_at": {
      "type": "string",
      "format": "date-time"
    }
  }
}
GET /sites/:site_id/funnels.json Lista trattar med ingångar, slutföranden och andel funnels_list

Behörighet: analytics.read

Exempel
curl https://privatusanalytics.com/sites/:site_id/funnels.json \
  -H "Authorization: Bearer $PRIVATUS_TOKEN"
Indata
{
  "type": "object",
  "properties": {
    "period": {
      "type": "string",
      "description": "Förinställt datumintervall. Använd custom med from/to",
      "enum": [
        "today",
        "yesterday",
        "24h",
        "7d",
        "14d",
        "28d",
        "30d",
        "90d",
        "mtd",
        "last_month",
        "qtd",
        "last_quarter",
        "ytd",
        "12mo",
        "last_year",
        "all",
        "custom"
      ],
      "default": "30d"
    },
    "from": {
      "type": "string",
      "format": "date",
      "description": "Start för eget intervall (webbplatsens tidszon)"
    },
    "to": {
      "type": "string",
      "format": "date",
      "description": "Slut för eget intervall, inklusive"
    },
    "compare": {
      "type": "string",
      "description": "Jämförelseperiod",
      "enum": [
        "none",
        "previous_period",
        "previous_year",
        "custom"
      ],
      "default": "none"
    },
    "compare_from": {
      "type": "string",
      "format": "date",
      "description": "Start för egen jämförelse"
    },
    "compare_to": {
      "type": "string",
      "format": "date",
      "description": "Slut för egen jämförelse"
    },
    "match_weekday": {
      "type": "boolean",
      "description": "Justera jämförelsedagarna efter veckodag",
      "default": false
    },
    "filters": {
      "type": "array",
      "items": {},
      "description": "Filter: [[\"dimension\",\"operator\",\"value\"], …]. Operatorer: is, is_not, any_of, none_of, contains, not_contains, starts_with, regex, not_regex, gt, lt, between. Omslut villkor med {\"any\": [...]} för ELLER.",
      "default": []
    },
    "segment_id": {
      "type": "string",
      "description": "Tillämpa ett sparat segment (seg_…)"
    },
    "include_imported": {
      "type": "boolean",
      "description": "Lägg till importerade historiska data (datum före den första inbyggda händelsen, ignoreras när filter eller ett segment tillämpas)",
      "default": false
    },
    "page": {
      "type": "integer",
      "description": "Sidnummer",
      "default": 1
    },
    "per_page": {
      "type": "integer",
      "description": "Trattar per sida (max 100)",
      "default": 25
    },
    "site_id": {
      "type": "string",
      "description": "Webbplats-id, t.ex. pa_7Q2K9XH3AB"
    }
  },
  "required": [
    "site_id"
  ]
}
Svarsdata
{
  "type": "array",
  "items": {
    "type": "object",
    "properties": {
      "id": {
        "type": "string",
        "description": "Tratt-id, t.ex. fun_7Q2K9XH3AB"
      },
      "name": {
        "type": "string"
      },
      "steps": {
        "type": "array",
        "items": {
          "type": "object"
        },
        "description": "Steg: {type: page|event|goal, value, match, name}"
      },
      "order_mode": {
        "type": "string",
        "description": "strict eller any"
      },
      "window": {
        "type": "string",
        "description": "visit eller day"
      },
      "stats": {
        "anyOf": [
          {
            "type": "object",
            "properties": {
              "entered": {
                "type": "integer",
                "description": "Besök som nådde steg 1"
              },
              "completed": {
                "type": "integer",
                "description": "Besök som nådde sista steget"
              },
              "conversion_rate": {
                "type": "number",
                "description": "Slutförda ÷ ingångar, %"
              }
            },
            "description": "Periodstatistik (endast lista)"
          },
          {
            "type": "null"
          }
        ]
      },
      "created_at": {
        "type": "string",
        "format": "date-time"
      },
      "updated_at": {
        "type": "string",
        "format": "date-time"
      }
    }
  }
}
GET /sites/:site_id/funnels/:id.json Trattrapport: antal per steg, konvertering, avhopp, tid mellan steg och vart besöken tog vägen istället funnels_get

Behörighet: analytics.read

Exempel
curl https://privatusanalytics.com/sites/:site_id/funnels/:id.json \
  -H "Authorization: Bearer $PRIVATUS_TOKEN"
Indata
{
  "type": "object",
  "properties": {
    "period": {
      "type": "string",
      "description": "Förinställt datumintervall. Använd custom med from/to",
      "enum": [
        "today",
        "yesterday",
        "24h",
        "7d",
        "14d",
        "28d",
        "30d",
        "90d",
        "mtd",
        "last_month",
        "qtd",
        "last_quarter",
        "ytd",
        "12mo",
        "last_year",
        "all",
        "custom"
      ],
      "default": "30d"
    },
    "from": {
      "type": "string",
      "format": "date",
      "description": "Start för eget intervall (webbplatsens tidszon)"
    },
    "to": {
      "type": "string",
      "format": "date",
      "description": "Slut för eget intervall, inklusive"
    },
    "compare": {
      "type": "string",
      "description": "Jämförelseperiod",
      "enum": [
        "none",
        "previous_period",
        "previous_year",
        "custom"
      ],
      "default": "none"
    },
    "compare_from": {
      "type": "string",
      "format": "date",
      "description": "Start för egen jämförelse"
    },
    "compare_to": {
      "type": "string",
      "format": "date",
      "description": "Slut för egen jämförelse"
    },
    "match_weekday": {
      "type": "boolean",
      "description": "Justera jämförelsedagarna efter veckodag",
      "default": false
    },
    "filters": {
      "type": "array",
      "items": {},
      "description": "Filter: [[\"dimension\",\"operator\",\"value\"], …]. Operatorer: is, is_not, any_of, none_of, contains, not_contains, starts_with, regex, not_regex, gt, lt, between. Omslut villkor med {\"any\": [...]} för ELLER.",
      "default": []
    },
    "segment_id": {
      "type": "string",
      "description": "Tillämpa ett sparat segment (seg_…)"
    },
    "include_imported": {
      "type": "boolean",
      "description": "Lägg till importerade historiska data (datum före den första inbyggda händelsen, ignoreras när filter eller ett segment tillämpas)",
      "default": false
    },
    "breakdown": {
      "type": "string",
      "description": "Dela upp antal per steg efter en besöksdimension",
      "enum": [
        "channel",
        "device",
        "country",
        "utm_campaign",
        "utm_source",
        "browser",
        "os"
      ]
    },
    "site_id": {
      "type": "string",
      "description": "Webbplats-id, t.ex. pa_7Q2K9XH3AB"
    },
    "id": {
      "type": "string",
      "description": "Id för resursen"
    }
  },
  "required": [
    "site_id",
    "id"
  ]
}
Svarsdata
{
  "type": "object",
  "properties": {
    "period": {
      "type": "object",
      "description": "from/to för perioden (UTC)"
    },
    "funnel": {
      "type": "object",
      "properties": {
        "id": {
          "type": "string",
          "description": "Tratt-id, t.ex. fun_7Q2K9XH3AB"
        },
        "name": {
          "type": "string"
        },
        "steps": {
          "type": "array",
          "items": {
            "type": "object"
          },
          "description": "Steg: {type: page|event|goal, value, match, name}"
        },
        "order_mode": {
          "type": "string",
          "description": "strict eller any"
        },
        "window": {
          "type": "string",
          "description": "visit eller day"
        },
        "stats": {
          "anyOf": [
            {
              "type": "object",
              "properties": {
                "entered": {
                  "type": "integer",
                  "description": "Besök som nådde steg 1"
                },
                "completed": {
                  "type": "integer",
                  "description": "Besök som nådde sista steget"
                },
                "conversion_rate": {
                  "type": "number",
                  "description": "Slutförda ÷ ingångar, %"
                }
              },
              "description": "Periodstatistik (endast lista)"
            },
            {
              "type": "null"
            }
          ]
        },
        "created_at": {
          "type": "string",
          "format": "date-time"
        },
        "updated_at": {
          "type": "string",
          "format": "date-time"
        }
      },
      "description": "Trattdefinitionen"
    },
    "order_mode": {
      "type": "string",
      "description": "strict eller any"
    },
    "window": {
      "type": "string",
      "description": "visit eller day (day mäts inom ett besök)"
    },
    "steps": {
      "type": "array",
      "items": {
        "type": "object"
      },
      "description": "Per steg: index, name, type, value, count, step_conversion_rate, overall_conversion_rate, dropoff, dropoff_rate, median_seconds_from_previous, next_pages [{value, count}]"
    },
    "overall_conversion_rate": {
      "type": "number",
      "description": "Sista steget ÷ första steget, %"
    },
    "breakdown": {
      "anyOf": [
        {
          "type": "object",
          "description": "dimension, label och rader [{value, counts, overall_conversion_rate}]"
        },
        {
          "type": "null"
        }
      ]
    },
    "comparison": {
      "anyOf": [
        {
          "type": "object",
          "description": "period, antal per steg, overall_conversion_rate och förändring (%)"
        },
        {
          "type": "null"
        }
      ]
    }
  }
}
PATCH /sites/:site_id/funnels/:id.json Uppdatera en tratt funnels_update

Behörighet: content.write

Exempel
curl -X PATCH https://privatusanalytics.com/sites/:site_id/funnels/:id.json \
  -H "Authorization: Bearer $PRIVATUS_TOKEN" \
  -H "Content-Type: application/json" -d '{…}'
Indata
{
  "type": "object",
  "properties": {
    "name": {
      "type": "string",
      "description": "Trattens namn",
      "examples": [
        "Signup flow"
      ]
    },
    "steps": {
      "type": "array",
      "items": {
        "type": "object",
        "additionalProperties": true
      },
      "description": "Steg i ordning (2 till din plangräns): [{\"type\": \"page|event|goal\", \"value\": \"/pricing | Signup | goal_…\", \"match\": \"exact|prefix|glob|regex\" (sidsteg), \"name\": \"optional label\"}]"
    },
    "order_mode": {
      "type": "string",
      "description": "strict: steg i den här ordningen, any: i valfri ordning",
      "enum": [
        "strict",
        "any"
      ]
    },
    "window": {
      "type": "string",
      "description": "Konverteringsfönster: visit, eller day (mäts inom ett besök, som aldrig sträcker sig över ett UTC-dygn)",
      "enum": [
        "visit",
        "day"
      ]
    },
    "site_id": {
      "type": "string",
      "description": "Webbplats-id, t.ex. pa_7Q2K9XH3AB"
    },
    "id": {
      "type": "string",
      "description": "Id för resursen"
    }
  },
  "required": [
    "site_id",
    "id"
  ]
}
Svarsdata
{
  "type": "object",
  "properties": {
    "id": {
      "type": "string",
      "description": "Tratt-id, t.ex. fun_7Q2K9XH3AB"
    },
    "name": {
      "type": "string"
    },
    "steps": {
      "type": "array",
      "items": {
        "type": "object"
      },
      "description": "Steg: {type: page|event|goal, value, match, name}"
    },
    "order_mode": {
      "type": "string",
      "description": "strict eller any"
    },
    "window": {
      "type": "string",
      "description": "visit eller day"
    },
    "stats": {
      "anyOf": [
        {
          "type": "object",
          "properties": {
            "entered": {
              "type": "integer",
              "description": "Besök som nådde steg 1"
            },
            "completed": {
              "type": "integer",
              "description": "Besök som nådde sista steget"
            },
            "conversion_rate": {
              "type": "number",
              "description": "Slutförda ÷ ingångar, %"
            }
          },
          "description": "Periodstatistik (endast lista)"
        },
        {
          "type": "null"
        }
      ]
    },
    "created_at": {
      "type": "string",
      "format": "date-time"
    },
    "updated_at": {
      "type": "string",
      "format": "date-time"
    }
  }
}

Webbplats

GET /changelog.json Lista poster i ändringsloggen changelog_list

Publicerade produktuppdateringar, nyaste först. Finns också som RSS på /changelog.rss.

Behörighet: public

Exempel
curl https://privatusanalytics.com/changelog.json
Indata
{
  "type": "object",
  "properties": {
    "area": {
      "type": "string",
      "description": "Endast poster för det här produktområdet",
      "enum": [
        "product",
        "dashboard",
        "tracker",
        "privacy",
        "api",
        "integrations",
        "billing",
        "docs"
      ]
    },
    "page": {
      "type": "integer",
      "description": "Sida (från 1)"
    },
    "per_page": {
      "type": "integer",
      "description": "Resultat per sida (max 100)"
    }
  },
  "required": []
}
Svarsdata
{
  "type": "array",
  "items": {
    "type": "object",
    "properties": {
      "id": {
        "type": "string",
        "description": "Post-id, t.ex. chg_7Q2K9XH3AB"
      },
      "title": {
        "type": "string",
        "description": "Rubrik"
      },
      "area": {
        "type": "string",
        "description": "Produktområde, t.ex. dashboard, tracker, api"
      },
      "body": {
        "type": "string",
        "description": "Innehåll i Markdown"
      },
      "published_at": {
        "type": "string",
        "format": "date-time",
        "description": "Publiceringstid"
      },
      "url": {
        "type": "string",
        "description": "Permanent länk"
      }
    }
  }
}
GET /changelog/:id.json Hämta en post i ändringsloggen changelog_get

Behörighet: public

Exempel
curl https://privatusanalytics.com/changelog/:id.json
Indata
{
  "type": "object",
  "properties": {
    "id": {
      "type": "string",
      "description": "Id för resursen"
    }
  },
  "required": [
    "id"
  ]
}
Svarsdata
{
  "type": "object",
  "properties": {
    "id": {
      "type": "string",
      "description": "Post-id, t.ex. chg_7Q2K9XH3AB"
    },
    "title": {
      "type": "string",
      "description": "Rubrik"
    },
    "area": {
      "type": "string",
      "description": "Produktområde, t.ex. dashboard, tracker, api"
    },
    "body": {
      "type": "string",
      "description": "Innehåll i Markdown"
    },
    "published_at": {
      "type": "string",
      "format": "date-time",
      "description": "Publiceringstid"
    },
    "url": {
      "type": "string",
      "description": "Permanent länk"
    }
  }
}
POST /contact.json Skicka ett meddelande till Privatus Analytics-teamet contact_create

Webbläsarklienter skickar en Cloudflare Turnstile-token som `cf-turnstile-response`. Förfrågningar med en API-token behöver ingen.

Behörighet: public · Endast HTTP (inte ett MCP-verktyg)

Exempel
curl -X POST https://privatusanalytics.com/contact.json \
  -H "Content-Type: application/json" -d '{…}'
Indata
{
  "type": "object",
  "properties": {
    "name": {
      "type": "string",
      "description": "Ditt namn",
      "examples": [
        "Ada Lovelace"
      ]
    },
    "email": {
      "type": "string",
      "description": "Dit vi ska svara",
      "examples": [
        "[email protected]"
      ]
    },
    "company": {
      "type": "string",
      "description": "Företag eller organisation (valfritt)"
    },
    "topic": {
      "type": "string",
      "description": "Vad meddelandet handlar om",
      "enum": [
        "general",
        "sales",
        "support",
        "privacy",
        "security",
        "partnerships",
        "press"
      ],
      "default": "general"
    },
    "message": {
      "type": "string",
      "description": "Ditt meddelande (10 till 5 000 tecken)"
    },
    "website": {
      "type": "string",
      "description": "Lämna tomt. Spamfälla för bottar. Ifyllda inlämningar kastas"
    }
  },
  "required": [
    "name",
    "email",
    "message"
  ]
}
Svarsdata
{
  "type": "object",
  "properties": {
    "received": {
      "type": "boolean",
      "description": "Alltid true när inlämningen accepterades"
    },
    "message": {
      "type": "string",
      "description": "Vad som händer härnäst"
    }
  }
}
POST /newsletter/confirm.json Bekräfta en prenumeration på nyhetsbrevet (signerad token) newsletter_confirm

Behörighet: public · Endast HTTP (inte ett MCP-verktyg)

Exempel
curl -X POST https://privatusanalytics.com/newsletter/confirm.json \
  -H "Content-Type: application/json" -d '{…}'
Indata
{
  "type": "object",
  "properties": {
    "token": {
      "type": "string",
      "description": "Signerad token från bekräftelsemejlet"
    }
  },
  "required": [
    "token"
  ]
}
Svarsdata
{
  "type": "object",
  "properties": {
    "received": {
      "type": "boolean",
      "description": "Alltid true när inlämningen accepterades"
    },
    "message": {
      "type": "string",
      "description": "Vad som händer härnäst"
    }
  }
}
POST /newsletter.json Prenumerera på nyhetsbrevet med en e-postadress newsletter_subscribe

Webbläsarklienter skickar en Cloudflare Turnstile-token som `cf-turnstile-response`. Förfrågningar med en API-token behöver ingen.

Behörighet: public · Endast HTTP (inte ett MCP-verktyg)

Exempel
curl -X POST https://privatusanalytics.com/newsletter.json \
  -H "Content-Type: application/json" -d '{…}'
Indata
{
  "type": "object",
  "properties": {
    "email": {
      "type": "string",
      "description": "E-postadress att prenumerera med. En bekräftelselänk mejlas dit",
      "examples": [
        "[email protected]"
      ]
    },
    "website": {
      "type": "string",
      "description": "Lämna tomt. Spamfälla för bottar. Ifyllda inlämningar kastas"
    }
  },
  "required": [
    "email"
  ]
}
Svarsdata
{
  "type": "object",
  "properties": {
    "received": {
      "type": "boolean",
      "description": "Alltid true när inlämningen accepterades"
    },
    "message": {
      "type": "string",
      "description": "Vad som händer härnäst"
    }
  }
}
POST /newsletter/unsubscribe.json Avsluta prenumerationen med en signerad länktoken newsletter_unsubscribe

Behörighet: public · Endast HTTP (inte ett MCP-verktyg)

Exempel
curl -X POST https://privatusanalytics.com/newsletter/unsubscribe.json \
  -H "Content-Type: application/json" -d '{…}'
Indata
{
  "type": "object",
  "properties": {
    "token": {
      "type": "string",
      "description": "Signerad token från avprenumerationslänken"
    },
    "list": {
      "type": "string",
      "description": "newsletter (standard: listan länken gällde) eller marketing (all marknadsföringsmejl)",
      "enum": [
        "newsletter",
        "marketing"
      ]
    }
  },
  "required": [
    "token"
  ]
}
Svarsdata
{
  "type": "object",
  "properties": {
    "received": {
      "type": "boolean",
      "description": "Alltid true när inlämningen accepterades"
    },
    "message": {
      "type": "string",
      "description": "Vad som händer härnäst"
    }
  }
}
GET /pricing.json Hämta planer, priser och plangränser pricing_get

Samma data som prissidan: händelsetrappan, varje plangräns och vad som räknas som en händelse. Skicka events för att få motsvarande nivå.

Behörighet: public

Exempel
curl https://privatusanalytics.com/pricing.json
Indata
{
  "type": "object",
  "properties": {
    "events": {
      "type": "integer",
      "description": "Förväntade sidvisningar plus egna händelser per månad. Returnerar motsvarande nivå som `recommendation`",
      "examples": [
        750000
      ]
    },
    "interval": {
      "type": "string",
      "description": "Faktureringsintervall för de visade priserna: month, eller year (10x månadspriset)",
      "enum": [
        "month",
        "year"
      ],
      "default": "month"
    }
  },
  "required": []
}
Svarsdata
{
  "type": "object",
  "properties": {
    "currency": {
      "type": "string",
      "description": "Valuta för alla priser (USD)"
    },
    "tax_included": {
      "type": "boolean",
      "description": "Alltid true. Priserna inkluderar moms eller försäljningsskatt, så priset som visas är priset som betalas"
    },
    "interval": {
      "type": "string",
      "description": "month eller year. Priserna gäller det här intervallet"
    },
    "annual_multiplier": {
      "type": "integer",
      "description": "Årspris = månadspris x detta (två månader gratis)"
    },
    "free_events": {
      "type": "integer",
      "description": "Händelser per månad som ingår i Free-planen"
    },
    "badge_bonus": {
      "type": "integer",
      "description": "Extra gratis händelser per månad när det valfria märket visas"
    },
    "tiers": {
      "type": "array",
      "items": {
        "type": "object"
      },
      "description": "Händelsetrappa: { events, pro, business } priser för intervallet (pro är null där bara Business erbjuds), plus månadspriserna"
    },
    "plans": {
      "type": "array",
      "items": {
        "type": "object"
      },
      "description": "Planer med { id, name, from_price, limits }. Gränser som är null betyder obegränsat"
    },
    "counted": {
      "type": "array",
      "items": {
        "type": "string"
      },
      "description": "Vad som räknas som en debiterbar händelse"
    },
    "not_counted": {
      "type": "array",
      "items": {
        "type": "string"
      },
      "description": "Vad som aldrig räknas mot användningen"
    },
    "recommendation": {
      "anyOf": [
        {
          "type": "object",
          "description": "{ events, plan, tier_events, price } för indata `events`, eller null när ingen volym angavs"
        },
        {
          "type": "null"
        }
      ]
    }
  }
}
GET /status.json Hämta aktuell systemstatus status_get

Hälsa för databas, Redis och bakgrundsjobb, kontrolleras högst var 15:e sekund.

Behörighet: public

Exempel
curl https://privatusanalytics.com/status.json
Indata
{
  "type": "object",
  "properties": {
    "fresh": {
      "type": "boolean",
      "description": "Hoppa över 15-sekunderscachen och kontrollera igen nu",
      "default": false
    }
  },
  "required": []
}
Svarsdata
{
  "type": "object",
  "properties": {
    "status": {
      "type": "string",
      "description": "Totalt: operational, degraded eller outage"
    },
    "checked_at": {
      "type": "string",
      "format": "date-time",
      "description": "När kontrollerna kördes (cachas upp till 15 s)"
    },
    "components": {
      "type": "array",
      "items": {
        "type": "object"
      },
      "description": "Per komponent: { id, name, status, detail, latency_ms }, plus queue_latency_s och queue_depth för köer"
    }
  }
}
GET /tools/header-checker.json Kontrollera en sidas Referrer-Policy och CSP för analys tools_header_check

Behörighet: public

Exempel
curl https://privatusanalytics.com/tools/header-checker.json
Indata
{
  "type": "object",
  "properties": {
    "url": {
      "type": "string",
      "description": "Publik sida att kontrollera (http eller https)",
      "examples": [
        "https://example.com"
      ]
    }
  },
  "required": [
    "url"
  ]
}
Svarsdata
{
  "type": "object",
  "properties": {
    "url": {
      "type": "string",
      "description": "Slutlig URL efter omdirigeringar"
    },
    "status": {
      "type": "integer",
      "description": "HTTP-status för det slutliga svaret"
    },
    "findings": {
      "type": "array",
      "items": {
        "type": "object"
      },
      "description": "Kontroller: { check, value, level (ok, warn, info), note }"
    }
  }
}
GET /tools/privacy-policy-generator.json Skriv ett utkast till ett stycke i integritetspolicyn för Privatus Analytics tools_privacy_policy

Behörighet: public

Exempel
curl https://privatusanalytics.com/tools/privacy-policy-generator.json
Indata
{
  "type": "object",
  "properties": {
    "site_name": {
      "type": "string",
      "description": "Namnet på din webbplats eller ditt företag",
      "examples": [
        "Example Books"
      ]
    },
    "contact_email": {
      "type": "string",
      "description": "Integritetskontakt att nämna (valfritt)"
    },
    "honors_gpc": {
      "type": "boolean",
      "description": "Om Do Not Track och Global Privacy Control respekteras (standard)",
      "default": true
    }
  },
  "required": [
    "site_name"
  ]
}
Svarsdata
{
  "type": "object",
  "properties": {
    "site_name": {
      "type": "string",
      "description": "Indata: webbplatsens eller företagets namn"
    },
    "paragraphs": {
      "type": "array",
      "items": {
        "type": "string"
      },
      "description": "Policytexten, ett stycke per post"
    },
    "text": {
      "type": "string",
      "description": "Styckena sammanfogade med tomma rader"
    }
  }
}
GET /tools/qr-code.json Generera en QR-kod som SVG tools_qr_code

Behörighet: public

Exempel
curl https://privatusanalytics.com/tools/qr-code.json
Indata
{
  "type": "object",
  "properties": {
    "text": {
      "type": "string",
      "description": "URL eller text att koda (upp till 1 000 tecken)",
      "examples": [
        "https://example.com/?utm_source=poster"
      ]
    },
    "level": {
      "type": "string",
      "description": "Felkorrigering: l (7 %), m (15 %), q (25 %), h (30 %)",
      "enum": [
        "l",
        "m",
        "q",
        "h"
      ],
      "default": "m"
    }
  },
  "required": [
    "text"
  ]
}
Svarsdata
{
  "type": "object",
  "properties": {
    "text": {
      "type": "string",
      "description": "Den kodade texten"
    },
    "level": {
      "type": "string",
      "description": "Nivå för felkorrigering"
    },
    "size": {
      "type": "integer",
      "description": "Moduler per sida"
    },
    "svg": {
      "type": "string",
      "description": "Fristående SVG-dokument"
    }
  }
}
GET /tools/tracker-scanner.json Lista cookies och kända spårare på en sida tools_tracker_scan

Behörighet: public

Exempel
curl https://privatusanalytics.com/tools/tracker-scanner.json
Indata
{
  "type": "object",
  "properties": {
    "url": {
      "type": "string",
      "description": "Publik sida att skanna (http eller https)",
      "examples": [
        "https://example.com"
      ]
    }
  },
  "required": [
    "url"
  ]
}
Svarsdata
{
  "type": "object",
  "properties": {
    "url": {
      "type": "string",
      "description": "Slutlig URL efter omdirigeringar"
    },
    "status": {
      "type": "integer",
      "description": "HTTP-status för det slutliga svaret"
    },
    "truncated": {
      "type": "boolean",
      "description": "True när sidan var över 1 MB och bara de första 1 MB skannades"
    },
    "cookies": {
      "type": "array",
      "items": {
        "type": "object"
      },
      "description": "Cookies som sätts av HTTP-svaret: { name, domain, path, expires, secure, http_only, same_site }. Värden returneras aldrig"
    },
    "trackers": {
      "type": "array",
      "items": {
        "type": "object"
      },
      "description": "Kända verktyg som sidan refererar till: { name, category, match, evidence }"
    },
    "third_party_hosts": {
      "type": "array",
      "items": {
        "type": "string"
      },
      "description": "Andra domäner som sidan laddar resurser från"
    }
  }
}
GET /tools/utm-builder.json Bygg en kampanj-URL med UTM-parametrar tools_utm_builder

Behörighet: public

Exempel
curl https://privatusanalytics.com/tools/utm-builder.json
Indata
{
  "type": "object",
  "properties": {
    "url": {
      "type": "string",
      "description": "URL till landningssidan",
      "examples": [
        "https://example.com/pricing"
      ]
    },
    "source": {
      "type": "string",
      "description": "utm_source: varifrån trafiken kommer",
      "examples": [
        "newsletter"
      ]
    },
    "medium": {
      "type": "string",
      "description": "utm_medium: kanalen, t.ex. email, cpc, social",
      "examples": [
        "email"
      ]
    },
    "campaign": {
      "type": "string",
      "description": "utm_campaign: kampanjens namn",
      "examples": [
        "fall_launch"
      ]
    },
    "term": {
      "type": "string",
      "description": "utm_term: sökord för betald sökning (valfritt)"
    },
    "content": {
      "type": "string",
      "description": "utm_content: vilken länk eller annons (valfritt)"
    }
  },
  "required": [
    "url",
    "source",
    "medium",
    "campaign"
  ]
}
Svarsdata
{
  "type": "object",
  "properties": {
    "url": {
      "type": "string",
      "description": "URL till landningssidan med UTM-parametrar"
    },
    "params": {
      "type": "object",
      "description": "De UTM-parametrar som lades till"
    },
    "warnings": {
      "type": "array",
      "items": {
        "type": "string"
      },
      "description": "Problem värda att åtgärda (gemener/versaler, mellanslag, personuppgifter)"
    }
  }
}
POST /waitlist.json Gå med i en väntelista (EU-hosting) waitlist_join

Webbläsarklienter skickar en Cloudflare Turnstile-token som `cf-turnstile-response`. Förfrågningar med en API-token behöver ingen.

Behörighet: public · Endast HTTP (inte ett MCP-verktyg)

Exempel
curl -X POST https://privatusanalytics.com/waitlist.json \
  -H "Content-Type: application/json" -d '{…}'
Indata
{
  "type": "object",
  "properties": {
    "email": {
      "type": "string",
      "description": "E-postadress att meddela",
      "examples": [
        "[email protected]"
      ]
    },
    "list": {
      "type": "string",
      "description": "Vilken väntelista att gå med i",
      "enum": [
        "eu_hosting"
      ],
      "default": "eu_hosting"
    },
    "website": {
      "type": "string",
      "description": "Lämna tomt. Spamfälla för bottar. Ifyllda inlämningar kastas"
    }
  },
  "required": [
    "email"
  ]
}
Svarsdata
{
  "type": "object",
  "properties": {
    "received": {
      "type": "boolean",
      "description": "Alltid true när inlämningen accepterades"
    },
    "message": {
      "type": "string",
      "description": "Vad som händer härnäst"
    }
  }
}

Webbplatser

POST /sites/:site_id/data_reset.json Ta bort alla händelser och besök i ett datumintervall (körs i bakgrunden, kan inte ångras) sites_reset_data

Behörighet: sites.manage

Exempel
curl -X POST https://privatusanalytics.com/sites/:site_id/data_reset.json \
  -H "Authorization: Bearer $PRIVATUS_TOKEN" \
  -H "Content-Type: application/json" -d '{…}'
Indata
{
  "type": "object",
  "properties": {
    "from": {
      "type": "string",
      "format": "date",
      "description": "Första dagen att ta bort (webbplatsens tidszon)"
    },
    "to": {
      "type": "string",
      "format": "date",
      "description": "Sista dagen att ta bort, inklusive"
    },
    "confirm": {
      "type": "string",
      "description": "Skriv domänen för att bekräfta"
    },
    "site_id": {
      "type": "string",
      "description": "Webbplats-id, t.ex. pa_7Q2K9XH3AB"
    }
  },
  "required": [
    "from",
    "to",
    "confirm",
    "site_id"
  ]
}
Svarsdata
{
  "type": "object"
}
GET /sites/:site_id/filter_stats.json Sammanfattning av filtrerad trafik: bottar, trafikregler eller PII-maskeringar per orsak och land (endast antal) sites_filter_stats

Behörighet: analytics.read

Exempel
curl https://privatusanalytics.com/sites/:site_id/filter_stats.json \
  -H "Authorization: Bearer $PRIVATUS_TOKEN"
Indata
{
  "type": "object",
  "properties": {
    "kind": {
      "type": "string",
      "description": "bot (filtrerade bottar), rule (trafikregler) eller redaction (PII-skrubbern)",
      "enum": [
        "bot",
        "rule",
        "redaction"
      ],
      "default": "bot"
    },
    "days": {
      "type": "integer",
      "description": "Antal dagar bakåt (1-395)",
      "default": 30
    },
    "site_id": {
      "type": "string",
      "description": "Webbplats-id, t.ex. pa_7Q2K9XH3AB"
    }
  },
  "required": [
    "site_id"
  ]
}
Svarsdata
{
  "type": "object"
}
GET /sites/:site_id/access.json Lista medlemmar och om de kan se den här webbplatsen sites_access_list

Behörighet: members.manage

Exempel
curl https://privatusanalytics.com/sites/:site_id/access.json \
  -H "Authorization: Bearer $PRIVATUS_TOKEN"
Indata
{
  "type": "object",
  "properties": {
    "site_id": {
      "type": "string",
      "description": "Webbplats-id, t.ex. pa_7Q2K9XH3AB"
    }
  },
  "required": [
    "site_id"
  ]
}
Svarsdata
{
  "type": "object",
  "properties": {
    "membership_id": {
      "type": "string",
      "format": "uuid",
      "description": "Medlemskaps-id"
    },
    "email": {
      "type": "string"
    },
    "name": {
      "type": "string"
    },
    "role": {
      "type": "string"
    },
    "access": {
      "type": "boolean",
      "description": "Kan se den här webbplatsen"
    },
    "locked": {
      "type": "boolean",
      "description": "Ägare och administratörer har alltid åtkomst"
    }
  }
}
PATCH /sites/:site_id/access.json Ge eller ta bort en medlems åtkomst till den här webbplatsen sites_access_update

Behörighet: members.manage

Exempel
curl -X PATCH https://privatusanalytics.com/sites/:site_id/access.json \
  -H "Authorization: Bearer $PRIVATUS_TOKEN" \
  -H "Content-Type: application/json" -d '{…}'
Indata
{
  "type": "object",
  "properties": {
    "membership_id": {
      "type": "string",
      "description": "Medlemskaps-id från sites_access_list"
    },
    "access": {
      "type": "boolean",
      "description": "true för att ge åtkomst, false för att ta bort den"
    },
    "site_id": {
      "type": "string",
      "description": "Webbplats-id, t.ex. pa_7Q2K9XH3AB"
    }
  },
  "required": [
    "membership_id",
    "access",
    "site_id"
  ]
}
Svarsdata
{
  "type": "object",
  "properties": {
    "membership_id": {
      "type": "string",
      "format": "uuid",
      "description": "Medlemskaps-id"
    },
    "email": {
      "type": "string"
    },
    "name": {
      "type": "string"
    },
    "role": {
      "type": "string"
    },
    "access": {
      "type": "boolean",
      "description": "Kan se den här webbplatsen"
    },
    "locked": {
      "type": "boolean",
      "description": "Ägare och administratörer har alltid åtkomst"
    }
  }
}
POST /sites/:site_id/favorite.json Stjärnmarkera en webbplats (fästs först under Alla webbplatser) sites_favorite

Behörighet: analytics.read

Exempel
curl -X POST https://privatusanalytics.com/sites/:site_id/favorite.json \
  -H "Authorization: Bearer $PRIVATUS_TOKEN" \
  -H "Content-Type: application/json" -d '{…}'
Indata
{
  "type": "object",
  "properties": {
    "site_id": {
      "type": "string",
      "description": "Webbplats-id, t.ex. pa_7Q2K9XH3AB"
    }
  },
  "required": [
    "site_id"
  ]
}
Svarsdata
{
  "type": "object",
  "properties": {
    "id": {
      "type": "string",
      "description": "Webbplats-id som används i spårningskoden"
    },
    "workspace_id": {
      "type": "string"
    },
    "domain": {
      "type": "string"
    },
    "name": {
      "type": "string"
    },
    "extra_domains": {
      "type": "array",
      "items": {
        "type": "string"
      }
    },
    "multi_domain_mode": {
      "type": "string"
    },
    "timezone": {
      "type": "string"
    },
    "currency": {
      "type": "string"
    },
    "week_start": {
      "type": "integer"
    },
    "labels": {
      "type": "array",
      "items": {
        "type": "string"
      }
    },
    "honor_dnt": {
      "type": "boolean"
    },
    "honor_gpc": {
      "type": "boolean"
    },
    "pii_scrubber": {
      "type": "boolean"
    },
    "redaction_rules": {
      "type": "array"
    },
    "allowed_params": {
      "type": "array",
      "items": {
        "type": "string"
      }
    },
    "path_masks": {
      "type": "array"
    },
    "retention_months": {
      "anyOf": [
        {
          "type": "integer"
        },
        {
          "type": "null"
        }
      ]
    },
    "bot_filtering": {
      "type": "boolean"
    },
    "traffic_rule_modes": {
      "type": "object"
    },
    "vitals_sample_rate": {
      "type": "integer"
    },
    "conversion_denominator": {
      "type": "string"
    },
    "public_dashboard": {
      "type": "boolean"
    },
    "public_indexable": {
      "type": "boolean"
    },
    "ingest_key_prefix": {
      "anyOf": [
        {
          "type": "string",
          "description": "Början av serverns inmatningsnyckel"
        },
        {
          "type": "null"
        }
      ]
    },
    "verified_at": {
      "anyOf": [
        {
          "type": "string",
          "format": "date-time"
        },
        {
          "type": "null"
        }
      ]
    },
    "first_event_at": {
      "anyOf": [
        {
          "type": "string",
          "format": "date-time"
        },
        {
          "type": "null"
        }
      ]
    },
    "last_event_at": {
      "anyOf": [
        {
          "type": "string",
          "format": "date-time"
        },
        {
          "type": "null"
        }
      ]
    },
    "snippet": {
      "type": "string",
      "description": "HTML-spårningskod"
    },
    "favorite": {
      "type": "boolean",
      "description": "Stjärnmarkerad av dig"
    },
    "created_at": {
      "type": "string",
      "format": "date-time"
    }
  }
}
DELETE /sites/:site_id/favorite.json Ta bort stjärnmarkeringen från en webbplats sites_unfavorite

Behörighet: analytics.read

Exempel
curl -X DELETE https://privatusanalytics.com/sites/:site_id/favorite.json \
  -H "Authorization: Bearer $PRIVATUS_TOKEN" \
  -H "Content-Type: application/json" -d '{…}'
Indata
{
  "type": "object",
  "properties": {
    "site_id": {
      "type": "string",
      "description": "Webbplats-id, t.ex. pa_7Q2K9XH3AB"
    }
  },
  "required": [
    "site_id"
  ]
}
Svarsdata
{
  "type": "object",
  "properties": {
    "id": {
      "type": "string",
      "description": "Webbplats-id som används i spårningskoden"
    },
    "workspace_id": {
      "type": "string"
    },
    "domain": {
      "type": "string"
    },
    "name": {
      "type": "string"
    },
    "extra_domains": {
      "type": "array",
      "items": {
        "type": "string"
      }
    },
    "multi_domain_mode": {
      "type": "string"
    },
    "timezone": {
      "type": "string"
    },
    "currency": {
      "type": "string"
    },
    "week_start": {
      "type": "integer"
    },
    "labels": {
      "type": "array",
      "items": {
        "type": "string"
      }
    },
    "honor_dnt": {
      "type": "boolean"
    },
    "honor_gpc": {
      "type": "boolean"
    },
    "pii_scrubber": {
      "type": "boolean"
    },
    "redaction_rules": {
      "type": "array"
    },
    "allowed_params": {
      "type": "array",
      "items": {
        "type": "string"
      }
    },
    "path_masks": {
      "type": "array"
    },
    "retention_months": {
      "anyOf": [
        {
          "type": "integer"
        },
        {
          "type": "null"
        }
      ]
    },
    "bot_filtering": {
      "type": "boolean"
    },
    "traffic_rule_modes": {
      "type": "object"
    },
    "vitals_sample_rate": {
      "type": "integer"
    },
    "conversion_denominator": {
      "type": "string"
    },
    "public_dashboard": {
      "type": "boolean"
    },
    "public_indexable": {
      "type": "boolean"
    },
    "ingest_key_prefix": {
      "anyOf": [
        {
          "type": "string",
          "description": "Början av serverns inmatningsnyckel"
        },
        {
          "type": "null"
        }
      ]
    },
    "verified_at": {
      "anyOf": [
        {
          "type": "string",
          "format": "date-time"
        },
        {
          "type": "null"
        }
      ]
    },
    "first_event_at": {
      "anyOf": [
        {
          "type": "string",
          "format": "date-time"
        },
        {
          "type": "null"
        }
      ]
    },
    "last_event_at": {
      "anyOf": [
        {
          "type": "string",
          "format": "date-time"
        },
        {
          "type": "null"
        }
      ]
    },
    "snippet": {
      "type": "string",
      "description": "HTML-spårningskod"
    },
    "favorite": {
      "type": "boolean",
      "description": "Stjärnmarkerad av dig"
    },
    "created_at": {
      "type": "string",
      "format": "date-time"
    }
  }
}
GET /sites/:site_id/setup.json Installationsstatus och kod för en webbplats sites_setup_get

Behörighet: analytics.read

Exempel
curl https://privatusanalytics.com/sites/:site_id/setup.json \
  -H "Authorization: Bearer $PRIVATUS_TOKEN"
Indata
{
  "type": "object",
  "properties": {
    "site_id": {
      "type": "string",
      "description": "Webbplats-id, t.ex. pa_7Q2K9XH3AB"
    }
  },
  "required": [
    "site_id"
  ]
}
Svarsdata
{
  "type": "object"
}
POST /transfers/:token/accept.json Acceptera en webbplatsöverföring till en av dina arbetsytor site_transfers_accept

Behörighet: public

Exempel
curl -X POST https://privatusanalytics.com/transfers/:token/accept.json \
  -H "Content-Type: application/json" -d '{…}'
Indata
{
  "type": "object",
  "properties": {
    "workspace_id": {
      "type": "string",
      "description": "Arbetsyta att flytta webbplatsen till (ws_…)"
    },
    "token": {
      "type": "string",
      "description": "Token för resursen"
    }
  },
  "required": [
    "workspace_id",
    "token"
  ]
}
Svarsdata
{
  "type": "object",
  "properties": {
    "site_id": {
      "type": "string",
      "description": "Webbplats som överförs"
    },
    "site_domain": {
      "type": "string"
    },
    "from_workspace": {
      "type": "string",
      "description": "Nuvarande arbetsytas namn"
    },
    "to_workspace_id": {
      "anyOf": [
        {
          "type": "string",
          "description": "Mottagande arbetsyta"
        },
        {
          "type": "null"
        }
      ]
    },
    "to_email": {
      "type": "string",
      "description": "Mottagarens e-post"
    },
    "status": {
      "type": "string",
      "description": "pending, accepted eller canceled"
    },
    "expires_at": {
      "type": "string",
      "format": "date-time"
    },
    "created_at": {
      "type": "string",
      "format": "date-time"
    }
  }
}
POST /sites/:site_id/transfer.json Börja överföra en webbplats till en annan arbetsyta (mejlar mottagaren) sites_transfer_start

Behörighet: sites.manage

Exempel
curl -X POST https://privatusanalytics.com/sites/:site_id/transfer.json \
  -H "Authorization: Bearer $PRIVATUS_TOKEN" \
  -H "Content-Type: application/json" -d '{…}'
Indata
{
  "type": "object",
  "properties": {
    "email": {
      "type": "string",
      "description": "E-post till personen som ska ta emot webbplatsen (de väljer en av sina arbetsytor)"
    },
    "site_id": {
      "type": "string",
      "description": "Webbplats-id, t.ex. pa_7Q2K9XH3AB"
    }
  },
  "required": [
    "email",
    "site_id"
  ]
}
Svarsdata
{
  "type": "object",
  "properties": {
    "site_id": {
      "type": "string",
      "description": "Webbplats som överförs"
    },
    "site_domain": {
      "type": "string"
    },
    "from_workspace": {
      "type": "string",
      "description": "Nuvarande arbetsytas namn"
    },
    "to_workspace_id": {
      "anyOf": [
        {
          "type": "string",
          "description": "Mottagande arbetsyta"
        },
        {
          "type": "null"
        }
      ]
    },
    "to_email": {
      "type": "string",
      "description": "Mottagarens e-post"
    },
    "status": {
      "type": "string",
      "description": "pending, accepted eller canceled"
    },
    "expires_at": {
      "type": "string",
      "format": "date-time"
    },
    "created_at": {
      "type": "string",
      "format": "date-time"
    }
  }
}
DELETE /sites/:site_id/transfer.json Avbryt en väntande webbplatsöverföring sites_transfer_cancel

Behörighet: sites.manage

Exempel
curl -X DELETE https://privatusanalytics.com/sites/:site_id/transfer.json \
  -H "Authorization: Bearer $PRIVATUS_TOKEN" \
  -H "Content-Type: application/json" -d '{…}'
Indata
{
  "type": "object",
  "properties": {
    "site_id": {
      "type": "string",
      "description": "Webbplats-id, t.ex. pa_7Q2K9XH3AB"
    }
  },
  "required": [
    "site_id"
  ]
}
Svarsdata
{
  "type": "object",
  "properties": {
    "site_id": {
      "type": "string",
      "description": "Webbplats som överförs"
    },
    "site_domain": {
      "type": "string"
    },
    "from_workspace": {
      "type": "string",
      "description": "Nuvarande arbetsytas namn"
    },
    "to_workspace_id": {
      "anyOf": [
        {
          "type": "string",
          "description": "Mottagande arbetsyta"
        },
        {
          "type": "null"
        }
      ]
    },
    "to_email": {
      "type": "string",
      "description": "Mottagarens e-post"
    },
    "status": {
      "type": "string",
      "description": "pending, accepted eller canceled"
    },
    "expires_at": {
      "type": "string",
      "format": "date-time"
    },
    "created_at": {
      "type": "string",
      "format": "date-time"
    }
  }
}
GET /transfers/:token.json Hämta en väntande överföring från dess mejlade token site_transfers_get

Behörighet: public

Exempel
curl https://privatusanalytics.com/transfers/:token.json
Indata
{
  "type": "object",
  "properties": {
    "token": {
      "type": "string",
      "description": "Token för resursen"
    }
  },
  "required": [
    "token"
  ]
}
Svarsdata
{
  "type": "object",
  "properties": {
    "site_id": {
      "type": "string",
      "description": "Webbplats som överförs"
    },
    "site_domain": {
      "type": "string"
    },
    "from_workspace": {
      "type": "string",
      "description": "Nuvarande arbetsytas namn"
    },
    "to_workspace_id": {
      "anyOf": [
        {
          "type": "string",
          "description": "Mottagande arbetsyta"
        },
        {
          "type": "null"
        }
      ]
    },
    "to_email": {
      "type": "string",
      "description": "Mottagarens e-post"
    },
    "status": {
      "type": "string",
      "description": "pending, accepted eller canceled"
    },
    "expires_at": {
      "type": "string",
      "format": "date-time"
    },
    "created_at": {
      "type": "string",
      "format": "date-time"
    }
  }
}
POST /workspaces/:workspace_id/sites.json Lägg till en webbplats sites_create

Behörighet: sites.manage

Exempel
curl -X POST https://privatusanalytics.com/workspaces/:workspace_id/sites.json \
  -H "Authorization: Bearer $PRIVATUS_TOKEN" \
  -H "Content-Type: application/json" -d '{…}'
Indata
{
  "type": "object",
  "properties": {
    "domain": {
      "type": "string",
      "description": "Primär domän, t.ex. example.com",
      "examples": [
        "example.com"
      ]
    },
    "name": {
      "type": "string",
      "description": "Visningsnamn (standard är domänen)"
    },
    "timezone": {
      "type": "string",
      "description": "Tidszon för rapportering"
    },
    "currency": {
      "type": "string",
      "description": "Valuta för intäkter (ISO 4217)"
    },
    "workspace_id": {
      "type": "string",
      "description": "Arbetsyte-id, t.ex. ws_7Q2K9XH3AB"
    }
  },
  "required": [
    "domain",
    "workspace_id"
  ]
}
Svarsdata
{
  "type": "object",
  "properties": {
    "id": {
      "type": "string",
      "description": "Webbplats-id som används i spårningskoden"
    },
    "workspace_id": {
      "type": "string"
    },
    "domain": {
      "type": "string"
    },
    "name": {
      "type": "string"
    },
    "extra_domains": {
      "type": "array",
      "items": {
        "type": "string"
      }
    },
    "multi_domain_mode": {
      "type": "string"
    },
    "timezone": {
      "type": "string"
    },
    "currency": {
      "type": "string"
    },
    "week_start": {
      "type": "integer"
    },
    "labels": {
      "type": "array",
      "items": {
        "type": "string"
      }
    },
    "honor_dnt": {
      "type": "boolean"
    },
    "honor_gpc": {
      "type": "boolean"
    },
    "pii_scrubber": {
      "type": "boolean"
    },
    "redaction_rules": {
      "type": "array"
    },
    "allowed_params": {
      "type": "array",
      "items": {
        "type": "string"
      }
    },
    "path_masks": {
      "type": "array"
    },
    "retention_months": {
      "anyOf": [
        {
          "type": "integer"
        },
        {
          "type": "null"
        }
      ]
    },
    "bot_filtering": {
      "type": "boolean"
    },
    "traffic_rule_modes": {
      "type": "object"
    },
    "vitals_sample_rate": {
      "type": "integer"
    },
    "conversion_denominator": {
      "type": "string"
    },
    "public_dashboard": {
      "type": "boolean"
    },
    "public_indexable": {
      "type": "boolean"
    },
    "ingest_key_prefix": {
      "anyOf": [
        {
          "type": "string",
          "description": "Början av serverns inmatningsnyckel"
        },
        {
          "type": "null"
        }
      ]
    },
    "verified_at": {
      "anyOf": [
        {
          "type": "string",
          "format": "date-time"
        },
        {
          "type": "null"
        }
      ]
    },
    "first_event_at": {
      "anyOf": [
        {
          "type": "string",
          "format": "date-time"
        },
        {
          "type": "null"
        }
      ]
    },
    "last_event_at": {
      "anyOf": [
        {
          "type": "string",
          "format": "date-time"
        },
        {
          "type": "null"
        }
      ]
    },
    "snippet": {
      "type": "string",
      "description": "HTML-spårningskod"
    },
    "favorite": {
      "type": "boolean",
      "description": "Stjärnmarkerad av dig"
    },
    "created_at": {
      "type": "string",
      "format": "date-time"
    }
  }
}
DELETE /sites/:id.json Ta bort en webbplats (rensas efter 7 dagar) sites_delete

Behörighet: sites.manage

Exempel
curl -X DELETE https://privatusanalytics.com/sites/:id.json \
  -H "Authorization: Bearer $PRIVATUS_TOKEN" \
  -H "Content-Type: application/json" -d '{…}'
Indata
{
  "type": "object",
  "properties": {
    "confirm": {
      "type": "string",
      "description": "Skriv domänen för att bekräfta"
    },
    "id": {
      "type": "string",
      "description": "Id för resursen"
    }
  },
  "required": [
    "confirm",
    "id"
  ]
}
Svarsdata
{
  "type": "object",
  "properties": {
    "id": {
      "type": "string",
      "description": "Webbplats-id som används i spårningskoden"
    },
    "workspace_id": {
      "type": "string"
    },
    "domain": {
      "type": "string"
    },
    "name": {
      "type": "string"
    },
    "extra_domains": {
      "type": "array",
      "items": {
        "type": "string"
      }
    },
    "multi_domain_mode": {
      "type": "string"
    },
    "timezone": {
      "type": "string"
    },
    "currency": {
      "type": "string"
    },
    "week_start": {
      "type": "integer"
    },
    "labels": {
      "type": "array",
      "items": {
        "type": "string"
      }
    },
    "honor_dnt": {
      "type": "boolean"
    },
    "honor_gpc": {
      "type": "boolean"
    },
    "pii_scrubber": {
      "type": "boolean"
    },
    "redaction_rules": {
      "type": "array"
    },
    "allowed_params": {
      "type": "array",
      "items": {
        "type": "string"
      }
    },
    "path_masks": {
      "type": "array"
    },
    "retention_months": {
      "anyOf": [
        {
          "type": "integer"
        },
        {
          "type": "null"
        }
      ]
    },
    "bot_filtering": {
      "type": "boolean"
    },
    "traffic_rule_modes": {
      "type": "object"
    },
    "vitals_sample_rate": {
      "type": "integer"
    },
    "conversion_denominator": {
      "type": "string"
    },
    "public_dashboard": {
      "type": "boolean"
    },
    "public_indexable": {
      "type": "boolean"
    },
    "ingest_key_prefix": {
      "anyOf": [
        {
          "type": "string",
          "description": "Början av serverns inmatningsnyckel"
        },
        {
          "type": "null"
        }
      ]
    },
    "verified_at": {
      "anyOf": [
        {
          "type": "string",
          "format": "date-time"
        },
        {
          "type": "null"
        }
      ]
    },
    "first_event_at": {
      "anyOf": [
        {
          "type": "string",
          "format": "date-time"
        },
        {
          "type": "null"
        }
      ]
    },
    "last_event_at": {
      "anyOf": [
        {
          "type": "string",
          "format": "date-time"
        },
        {
          "type": "null"
        }
      ]
    },
    "snippet": {
      "type": "string",
      "description": "HTML-spårningskod"
    },
    "favorite": {
      "type": "boolean",
      "description": "Stjärnmarkerad av dig"
    },
    "created_at": {
      "type": "string",
      "format": "date-time"
    }
  }
}
GET /workspaces/:workspace_id/sites.json Lista webbplatser i en arbetsyta sites_list

Behörighet: analytics.read

Exempel
curl https://privatusanalytics.com/workspaces/:workspace_id/sites.json \
  -H "Authorization: Bearer $PRIVATUS_TOKEN"
Indata
{
  "type": "object",
  "properties": {
    "query": {
      "type": "string",
      "description": "Filtrera efter domän eller namn"
    },
    "label": {
      "type": "string",
      "description": "Endast webbplatser med den här etiketten"
    },
    "sort": {
      "type": "string",
      "description": "position (din ordning), name, eller visitors de senaste 30 dagarna (flest först)",
      "enum": [
        "position",
        "name",
        "visitors"
      ],
      "default": "position"
    },
    "workspace_id": {
      "type": "string",
      "description": "Arbetsyte-id, t.ex. ws_7Q2K9XH3AB"
    },
    "page": {
      "type": "integer",
      "description": "Sida (från 1)"
    },
    "per_page": {
      "type": "integer",
      "description": "Resultat per sida (max 100)"
    }
  },
  "required": [
    "workspace_id"
  ]
}
Svarsdata
{
  "type": "array",
  "items": {
    "type": "object",
    "properties": {
      "id": {
        "type": "string",
        "description": "Webbplats-id som används i spårningskoden"
      },
      "workspace_id": {
        "type": "string"
      },
      "domain": {
        "type": "string"
      },
      "name": {
        "type": "string"
      },
      "extra_domains": {
        "type": "array",
        "items": {
          "type": "string"
        }
      },
      "multi_domain_mode": {
        "type": "string"
      },
      "timezone": {
        "type": "string"
      },
      "currency": {
        "type": "string"
      },
      "week_start": {
        "type": "integer"
      },
      "labels": {
        "type": "array",
        "items": {
          "type": "string"
        }
      },
      "honor_dnt": {
        "type": "boolean"
      },
      "honor_gpc": {
        "type": "boolean"
      },
      "pii_scrubber": {
        "type": "boolean"
      },
      "redaction_rules": {
        "type": "array"
      },
      "allowed_params": {
        "type": "array",
        "items": {
          "type": "string"
        }
      },
      "path_masks": {
        "type": "array"
      },
      "retention_months": {
        "anyOf": [
          {
            "type": "integer"
          },
          {
            "type": "null"
          }
        ]
      },
      "bot_filtering": {
        "type": "boolean"
      },
      "traffic_rule_modes": {
        "type": "object"
      },
      "vitals_sample_rate": {
        "type": "integer"
      },
      "conversion_denominator": {
        "type": "string"
      },
      "public_dashboard": {
        "type": "boolean"
      },
      "public_indexable": {
        "type": "boolean"
      },
      "ingest_key_prefix": {
        "anyOf": [
          {
            "type": "string",
            "description": "Början av serverns inmatningsnyckel"
          },
          {
            "type": "null"
          }
        ]
      },
      "verified_at": {
        "anyOf": [
          {
            "type": "string",
            "format": "date-time"
          },
          {
            "type": "null"
          }
        ]
      },
      "first_event_at": {
        "anyOf": [
          {
            "type": "string",
            "format": "date-time"
          },
          {
            "type": "null"
          }
        ]
      },
      "last_event_at": {
        "anyOf": [
          {
            "type": "string",
            "format": "date-time"
          },
          {
            "type": "null"
          }
        ]
      },
      "snippet": {
        "type": "string",
        "description": "HTML-spårningskod"
      },
      "favorite": {
        "type": "boolean",
        "description": "Stjärnmarkerad av dig"
      },
      "created_at": {
        "type": "string",
        "format": "date-time"
      }
    }
  }
}
GET /sites/:id.json Hämta en webbplats och alla dess inställningar sites_get

Behörighet: analytics.read

Exempel
curl https://privatusanalytics.com/sites/:id.json \
  -H "Authorization: Bearer $PRIVATUS_TOKEN"
Indata
{
  "type": "object",
  "properties": {
    "id": {
      "type": "string",
      "description": "Id för resursen"
    }
  },
  "required": [
    "id"
  ]
}
Svarsdata
{
  "type": "object",
  "properties": {
    "id": {
      "type": "string",
      "description": "Webbplats-id som används i spårningskoden"
    },
    "workspace_id": {
      "type": "string"
    },
    "domain": {
      "type": "string"
    },
    "name": {
      "type": "string"
    },
    "extra_domains": {
      "type": "array",
      "items": {
        "type": "string"
      }
    },
    "multi_domain_mode": {
      "type": "string"
    },
    "timezone": {
      "type": "string"
    },
    "currency": {
      "type": "string"
    },
    "week_start": {
      "type": "integer"
    },
    "labels": {
      "type": "array",
      "items": {
        "type": "string"
      }
    },
    "honor_dnt": {
      "type": "boolean"
    },
    "honor_gpc": {
      "type": "boolean"
    },
    "pii_scrubber": {
      "type": "boolean"
    },
    "redaction_rules": {
      "type": "array"
    },
    "allowed_params": {
      "type": "array",
      "items": {
        "type": "string"
      }
    },
    "path_masks": {
      "type": "array"
    },
    "retention_months": {
      "anyOf": [
        {
          "type": "integer"
        },
        {
          "type": "null"
        }
      ]
    },
    "bot_filtering": {
      "type": "boolean"
    },
    "traffic_rule_modes": {
      "type": "object"
    },
    "vitals_sample_rate": {
      "type": "integer"
    },
    "conversion_denominator": {
      "type": "string"
    },
    "public_dashboard": {
      "type": "boolean"
    },
    "public_indexable": {
      "type": "boolean"
    },
    "ingest_key_prefix": {
      "anyOf": [
        {
          "type": "string",
          "description": "Början av serverns inmatningsnyckel"
        },
        {
          "type": "null"
        }
      ]
    },
    "verified_at": {
      "anyOf": [
        {
          "type": "string",
          "format": "date-time"
        },
        {
          "type": "null"
        }
      ]
    },
    "first_event_at": {
      "anyOf": [
        {
          "type": "string",
          "format": "date-time"
        },
        {
          "type": "null"
        }
      ]
    },
    "last_event_at": {
      "anyOf": [
        {
          "type": "string",
          "format": "date-time"
        },
        {
          "type": "null"
        }
      ]
    },
    "snippet": {
      "type": "string",
      "description": "HTML-spårningskod"
    },
    "favorite": {
      "type": "boolean",
      "description": "Stjärnmarkerad av dig"
    },
    "created_at": {
      "type": "string",
      "format": "date-time"
    }
  }
}
PATCH /sites/:id.json Uppdatera webbplatsinställningar sites_update

Behörighet: sites.manage

Exempel
curl -X PATCH https://privatusanalytics.com/sites/:id.json \
  -H "Authorization: Bearer $PRIVATUS_TOKEN" \
  -H "Content-Type: application/json" -d '{…}'
Indata
{
  "type": "object",
  "properties": {
    "name": {
      "type": "string",
      "description": "Visningsnamn"
    },
    "domain": {
      "type": "string",
      "description": "Primär domän"
    },
    "extra_domains": {
      "type": "array",
      "items": {
        "type": "string"
      },
      "description": "Ytterligare värdnamn"
    },
    "multi_domain_mode": {
      "type": "string",
      "description": "combined: en besökare över flera domäner",
      "enum": [
        "combined",
        "separate"
      ]
    },
    "timezone": {
      "type": "string",
      "description": "Tidszon för rapportering"
    },
    "currency": {
      "type": "string",
      "description": "Intäktsvaluta (ISO 4217)"
    },
    "week_start": {
      "type": "integer",
      "description": "0 = söndag, 1 = måndag"
    },
    "labels": {
      "type": "array",
      "items": {
        "type": "string"
      },
      "description": "Etiketter för att gruppera webbplatser"
    },
    "honor_dnt": {
      "type": "boolean",
      "description": "Hoppa över besökare som skickar DNT"
    },
    "honor_gpc": {
      "type": "boolean",
      "description": "Hoppa över besökare som skickar GPC"
    },
    "pii_scrubber": {
      "type": "boolean",
      "description": "Maskera e-postadresser, token, id"
    },
    "redaction_rules": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string"
          },
          "pattern": {
            "type": "string"
          }
        }
      },
      "description": "Egna reguljära uttryck för maskering"
    },
    "allowed_params": {
      "type": "array",
      "items": {
        "type": "string"
      },
      "description": "Frågeparametrar att behålla på sökvägar"
    },
    "path_masks": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "pattern": {
            "type": "string"
          },
          "replacement": {
            "type": "string"
          }
        }
      },
      "description": "Regler för sökvägsmaskering, t.ex. /u/* -> /u/:id"
    },
    "retention_months": {
      "type": "integer",
      "description": "Ta bort data som är äldre än så här"
    },
    "bot_filtering": {
      "type": "boolean",
      "description": "Filtrera bottrafik"
    },
    "traffic_rule_modes": {
      "type": "object",
      "additionalProperties": true,
      "description": "block eller allow per trafikregellista"
    },
    "vitals_sample_rate": {
      "type": "integer",
      "description": "Sampling för Web Vitals i %"
    },
    "conversion_denominator": {
      "type": "string",
      "description": "Konverteringsgrad över besök eller besökare",
      "enum": [
        "visits",
        "visitors"
      ]
    },
    "public_dashboard": {
      "type": "boolean",
      "description": "Alla med länken kan se statistiken"
    },
    "public_indexable": {
      "type": "boolean",
      "description": "Låt sökmotorer indexera den publika sidan"
    },
    "id": {
      "type": "string",
      "description": "Id för resursen"
    }
  },
  "required": [
    "id"
  ]
}
Svarsdata
{
  "type": "object",
  "properties": {
    "id": {
      "type": "string",
      "description": "Webbplats-id som används i spårningskoden"
    },
    "workspace_id": {
      "type": "string"
    },
    "domain": {
      "type": "string"
    },
    "name": {
      "type": "string"
    },
    "extra_domains": {
      "type": "array",
      "items": {
        "type": "string"
      }
    },
    "multi_domain_mode": {
      "type": "string"
    },
    "timezone": {
      "type": "string"
    },
    "currency": {
      "type": "string"
    },
    "week_start": {
      "type": "integer"
    },
    "labels": {
      "type": "array",
      "items": {
        "type": "string"
      }
    },
    "honor_dnt": {
      "type": "boolean"
    },
    "honor_gpc": {
      "type": "boolean"
    },
    "pii_scrubber": {
      "type": "boolean"
    },
    "redaction_rules": {
      "type": "array"
    },
    "allowed_params": {
      "type": "array",
      "items": {
        "type": "string"
      }
    },
    "path_masks": {
      "type": "array"
    },
    "retention_months": {
      "anyOf": [
        {
          "type": "integer"
        },
        {
          "type": "null"
        }
      ]
    },
    "bot_filtering": {
      "type": "boolean"
    },
    "traffic_rule_modes": {
      "type": "object"
    },
    "vitals_sample_rate": {
      "type": "integer"
    },
    "conversion_denominator": {
      "type": "string"
    },
    "public_dashboard": {
      "type": "boolean"
    },
    "public_indexable": {
      "type": "boolean"
    },
    "ingest_key_prefix": {
      "anyOf": [
        {
          "type": "string",
          "description": "Början av serverns inmatningsnyckel"
        },
        {
          "type": "null"
        }
      ]
    },
    "verified_at": {
      "anyOf": [
        {
          "type": "string",
          "format": "date-time"
        },
        {
          "type": "null"
        }
      ]
    },
    "first_event_at": {
      "anyOf": [
        {
          "type": "string",
          "format": "date-time"
        },
        {
          "type": "null"
        }
      ]
    },
    "last_event_at": {
      "anyOf": [
        {
          "type": "string",
          "format": "date-time"
        },
        {
          "type": "null"
        }
      ]
    },
    "snippet": {
      "type": "string",
      "description": "HTML-spårningskod"
    },
    "favorite": {
      "type": "boolean",
      "description": "Stjärnmarkerad av dig"
    },
    "created_at": {
      "type": "string",
      "format": "date-time"
    }
  }
}

Webhooks

GET /workspaces/:workspace_id/webhooks/:webhook_id/deliveries.json Lista leveranser för en webhook webhook_deliveries_list

Behörighet: workspace.manage

Exempel
curl https://privatusanalytics.com/workspaces/:workspace_id/webhooks/:webhook_id/deliveries.json \
  -H "Authorization: Bearer $PRIVATUS_TOKEN"
Indata
{
  "type": "object",
  "properties": {
    "status": {
      "type": "string",
      "description": "Endast lyckade eller misslyckade leveranser",
      "enum": [
        "succeeded",
        "failed"
      ]
    },
    "workspace_id": {
      "type": "string",
      "description": "Arbetsyte-id, t.ex. ws_7Q2K9XH3AB"
    },
    "webhook_id": {
      "type": "string",
      "description": "Webhook för resursen"
    },
    "page": {
      "type": "integer",
      "description": "Sida (från 1)"
    },
    "per_page": {
      "type": "integer",
      "description": "Resultat per sida (max 100)"
    }
  },
  "required": [
    "workspace_id",
    "webhook_id"
  ]
}
Svarsdata
{
  "type": "array",
  "items": {
    "type": "object",
    "properties": {
      "id": {
        "type": "string",
        "description": "Leverans-id, t.ex. whd_123"
      },
      "event": {
        "type": "string"
      },
      "status": {
        "type": "string",
        "description": "pending, succeeded eller failed"
      },
      "status_code": {
        "anyOf": [
          {
            "type": "integer",
            "description": "HTTP-status för det senaste försöket"
          },
          {
            "type": "null"
          }
        ]
      },
      "error": {
        "anyOf": [
          {
            "type": "string",
            "description": "Anslutningsfel vid det senaste försöket"
          },
          {
            "type": "null"
          }
        ]
      },
      "attempt": {
        "type": "integer"
      },
      "duration_ms": {
        "anyOf": [
          {
            "type": "integer"
          },
          {
            "type": "null"
          }
        ]
      },
      "payload": {
        "type": "object"
      },
      "response_body": {
        "anyOf": [
          {
            "type": "string",
            "description": "De första 2 000 tecknen"
          },
          {
            "type": "null"
          }
        ]
      },
      "delivered_at": {
        "anyOf": [
          {
            "type": "string",
            "format": "date-time"
          },
          {
            "type": "null"
          }
        ]
      },
      "created_at": {
        "type": "string",
        "format": "date-time"
      }
    }
  }
}
POST /workspaces/:workspace_id/webhooks/:webhook_id/deliveries/:id/redeliver.json Skicka en leverans igen webhook_deliveries_redeliver

Behörighet: workspace.manage

Exempel
curl -X POST https://privatusanalytics.com/workspaces/:workspace_id/webhooks/:webhook_id/deliveries/:id/redeliver.json \
  -H "Authorization: Bearer $PRIVATUS_TOKEN" \
  -H "Content-Type: application/json" -d '{…}'
Indata
{
  "type": "object",
  "properties": {
    "workspace_id": {
      "type": "string",
      "description": "Arbetsyte-id, t.ex. ws_7Q2K9XH3AB"
    },
    "webhook_id": {
      "type": "string",
      "description": "Webhook för resursen"
    },
    "id": {
      "type": "string",
      "description": "Id för resursen"
    }
  },
  "required": [
    "workspace_id",
    "webhook_id",
    "id"
  ]
}
Svarsdata
{
  "type": "object",
  "properties": {
    "id": {
      "type": "string",
      "description": "Leverans-id, t.ex. whd_123"
    },
    "event": {
      "type": "string"
    },
    "status": {
      "type": "string",
      "description": "pending, succeeded eller failed"
    },
    "status_code": {
      "anyOf": [
        {
          "type": "integer",
          "description": "HTTP-status för det senaste försöket"
        },
        {
          "type": "null"
        }
      ]
    },
    "error": {
      "anyOf": [
        {
          "type": "string",
          "description": "Anslutningsfel vid det senaste försöket"
        },
        {
          "type": "null"
        }
      ]
    },
    "attempt": {
      "type": "integer"
    },
    "duration_ms": {
      "anyOf": [
        {
          "type": "integer"
        },
        {
          "type": "null"
        }
      ]
    },
    "payload": {
      "type": "object"
    },
    "response_body": {
      "anyOf": [
        {
          "type": "string",
          "description": "De första 2 000 tecknen"
        },
        {
          "type": "null"
        }
      ]
    },
    "delivered_at": {
      "anyOf": [
        {
          "type": "string",
          "format": "date-time"
        },
        {
          "type": "null"
        }
      ]
    },
    "created_at": {
      "type": "string",
      "format": "date-time"
    }
  }
}
POST /workspaces/:workspace_id/webhooks.json Lägg till en webhook-endpoint webhooks_create

Behörighet: workspace.manage

Exempel
curl -X POST https://privatusanalytics.com/workspaces/:workspace_id/webhooks.json \
  -H "Authorization: Bearer $PRIVATUS_TOKEN" \
  -H "Content-Type: application/json" -d '{…}'
Indata
{
  "type": "object",
  "properties": {
    "url": {
      "type": "string",
      "description": "HTTPS-endpoint som tar emot POST-skickad JSON",
      "examples": [
        "https://example.com/hooks/privatus"
      ]
    },
    "events": {
      "type": "array",
      "items": {
        "type": "string",
        "enum": [
          "alert.triggered",
          "alert.resolved",
          "goal.completed_threshold",
          "uptime.down",
          "uptime.up",
          "export.ready",
          "import.completed",
          "import.failed",
          "site.created",
          "site.deleted",
          "member.added",
          "usage.threshold"
        ]
      },
      "description": "Händelser att skicka"
    },
    "enabled": {
      "type": "boolean",
      "description": "Skicka leveranser",
      "default": true
    },
    "workspace_id": {
      "type": "string",
      "description": "Arbetsyte-id, t.ex. ws_7Q2K9XH3AB"
    }
  },
  "required": [
    "url",
    "events",
    "workspace_id"
  ]
}
Svarsdata
{
  "type": "object",
  "properties": {
    "id": {
      "type": "string",
      "description": "Webhook-id, t.ex. wh_7Q2K9XH3AB"
    },
    "url": {
      "type": "string"
    },
    "events": {
      "type": "array",
      "items": {
        "type": "string"
      }
    },
    "enabled": {
      "type": "boolean"
    },
    "status": {
      "type": "string",
      "description": "active, failing eller disabled"
    },
    "secret": {
      "type": "string",
      "description": "Signeringshemlighet för Privatus-Signature"
    },
    "consecutive_failures": {
      "type": "integer"
    },
    "last_success_at": {
      "anyOf": [
        {
          "type": "string",
          "format": "date-time"
        },
        {
          "type": "null"
        }
      ]
    },
    "last_failure_at": {
      "anyOf": [
        {
          "type": "string",
          "format": "date-time"
        },
        {
          "type": "null"
        }
      ]
    },
    "created_at": {
      "type": "string",
      "format": "date-time"
    }
  }
}
DELETE /workspaces/:workspace_id/webhooks/:id.json Ta bort en webhook webhooks_delete

Behörighet: workspace.manage

Exempel
curl -X DELETE https://privatusanalytics.com/workspaces/:workspace_id/webhooks/:id.json \
  -H "Authorization: Bearer $PRIVATUS_TOKEN" \
  -H "Content-Type: application/json" -d '{…}'
Indata
{
  "type": "object",
  "properties": {
    "workspace_id": {
      "type": "string",
      "description": "Arbetsyte-id, t.ex. ws_7Q2K9XH3AB"
    },
    "id": {
      "type": "string",
      "description": "Id för resursen"
    }
  },
  "required": [
    "workspace_id",
    "id"
  ]
}
Svarsdata
{
  "type": "object",
  "properties": {
    "id": {
      "type": "string",
      "description": "Webhook-id, t.ex. wh_7Q2K9XH3AB"
    },
    "url": {
      "type": "string"
    },
    "events": {
      "type": "array",
      "items": {
        "type": "string"
      }
    },
    "enabled": {
      "type": "boolean"
    },
    "status": {
      "type": "string",
      "description": "active, failing eller disabled"
    },
    "secret": {
      "type": "string",
      "description": "Signeringshemlighet för Privatus-Signature"
    },
    "consecutive_failures": {
      "type": "integer"
    },
    "last_success_at": {
      "anyOf": [
        {
          "type": "string",
          "format": "date-time"
        },
        {
          "type": "null"
        }
      ]
    },
    "last_failure_at": {
      "anyOf": [
        {
          "type": "string",
          "format": "date-time"
        },
        {
          "type": "null"
        }
      ]
    },
    "created_at": {
      "type": "string",
      "format": "date-time"
    }
  }
}
GET /workspaces/:workspace_id/webhooks.json Lista webhooks webhooks_list

Behörighet: workspace.manage

Exempel
curl https://privatusanalytics.com/workspaces/:workspace_id/webhooks.json \
  -H "Authorization: Bearer $PRIVATUS_TOKEN"
Indata
{
  "type": "object",
  "properties": {
    "workspace_id": {
      "type": "string",
      "description": "Arbetsyte-id, t.ex. ws_7Q2K9XH3AB"
    },
    "page": {
      "type": "integer",
      "description": "Sida (från 1)"
    },
    "per_page": {
      "type": "integer",
      "description": "Resultat per sida (max 100)"
    }
  },
  "required": [
    "workspace_id"
  ]
}
Svarsdata
{
  "type": "array",
  "items": {
    "type": "object",
    "properties": {
      "id": {
        "type": "string",
        "description": "Webhook-id, t.ex. wh_7Q2K9XH3AB"
      },
      "url": {
        "type": "string"
      },
      "events": {
        "type": "array",
        "items": {
          "type": "string"
        }
      },
      "enabled": {
        "type": "boolean"
      },
      "status": {
        "type": "string",
        "description": "active, failing eller disabled"
      },
      "secret": {
        "type": "string",
        "description": "Signeringshemlighet för Privatus-Signature"
      },
      "consecutive_failures": {
        "type": "integer"
      },
      "last_success_at": {
        "anyOf": [
          {
            "type": "string",
            "format": "date-time"
          },
          {
            "type": "null"
          }
        ]
      },
      "last_failure_at": {
        "anyOf": [
          {
            "type": "string",
            "format": "date-time"
          },
          {
            "type": "null"
          }
        ]
      },
      "created_at": {
        "type": "string",
        "format": "date-time"
      }
    }
  }
}
GET /workspaces/:workspace_id/webhooks/:id.json Hämta en webhook webhooks_get

Behörighet: workspace.manage

Exempel
curl https://privatusanalytics.com/workspaces/:workspace_id/webhooks/:id.json \
  -H "Authorization: Bearer $PRIVATUS_TOKEN"
Indata
{
  "type": "object",
  "properties": {
    "workspace_id": {
      "type": "string",
      "description": "Arbetsyte-id, t.ex. ws_7Q2K9XH3AB"
    },
    "id": {
      "type": "string",
      "description": "Id för resursen"
    }
  },
  "required": [
    "workspace_id",
    "id"
  ]
}
Svarsdata
{
  "type": "object",
  "properties": {
    "id": {
      "type": "string",
      "description": "Webhook-id, t.ex. wh_7Q2K9XH3AB"
    },
    "url": {
      "type": "string"
    },
    "events": {
      "type": "array",
      "items": {
        "type": "string"
      }
    },
    "enabled": {
      "type": "boolean"
    },
    "status": {
      "type": "string",
      "description": "active, failing eller disabled"
    },
    "secret": {
      "type": "string",
      "description": "Signeringshemlighet för Privatus-Signature"
    },
    "consecutive_failures": {
      "type": "integer"
    },
    "last_success_at": {
      "anyOf": [
        {
          "type": "string",
          "format": "date-time"
        },
        {
          "type": "null"
        }
      ]
    },
    "last_failure_at": {
      "anyOf": [
        {
          "type": "string",
          "format": "date-time"
        },
        {
          "type": "null"
        }
      ]
    },
    "created_at": {
      "type": "string",
      "format": "date-time"
    }
  }
}
POST /workspaces/:workspace_id/webhooks/:id/test.json Skicka en testleverans webhooks_test

Behörighet: workspace.manage

Exempel
curl -X POST https://privatusanalytics.com/workspaces/:workspace_id/webhooks/:id/test.json \
  -H "Authorization: Bearer $PRIVATUS_TOKEN" \
  -H "Content-Type: application/json" -d '{…}'
Indata
{
  "type": "object",
  "properties": {
    "workspace_id": {
      "type": "string",
      "description": "Arbetsyte-id, t.ex. ws_7Q2K9XH3AB"
    },
    "id": {
      "type": "string",
      "description": "Id för resursen"
    }
  },
  "required": [
    "workspace_id",
    "id"
  ]
}
Svarsdata
{
  "type": "object",
  "properties": {
    "id": {
      "type": "string",
      "description": "Leverans-id, t.ex. whd_123"
    },
    "event": {
      "type": "string"
    },
    "status": {
      "type": "string",
      "description": "pending, succeeded eller failed"
    },
    "status_code": {
      "anyOf": [
        {
          "type": "integer",
          "description": "HTTP-status för det senaste försöket"
        },
        {
          "type": "null"
        }
      ]
    },
    "error": {
      "anyOf": [
        {
          "type": "string",
          "description": "Anslutningsfel vid det senaste försöket"
        },
        {
          "type": "null"
        }
      ]
    },
    "attempt": {
      "type": "integer"
    },
    "duration_ms": {
      "anyOf": [
        {
          "type": "integer"
        },
        {
          "type": "null"
        }
      ]
    },
    "payload": {
      "type": "object"
    },
    "response_body": {
      "anyOf": [
        {
          "type": "string",
          "description": "De första 2 000 tecknen"
        },
        {
          "type": "null"
        }
      ]
    },
    "delivered_at": {
      "anyOf": [
        {
          "type": "string",
          "format": "date-time"
        },
        {
          "type": "null"
        }
      ]
    },
    "created_at": {
      "type": "string",
      "format": "date-time"
    }
  }
}
PATCH /workspaces/:workspace_id/webhooks/:id.json Uppdatera en webhook (händelser, URL, aktiverad, rotera hemlighet) webhooks_update

Behörighet: workspace.manage

Exempel
curl -X PATCH https://privatusanalytics.com/workspaces/:workspace_id/webhooks/:id.json \
  -H "Authorization: Bearer $PRIVATUS_TOKEN" \
  -H "Content-Type: application/json" -d '{…}'
Indata
{
  "type": "object",
  "properties": {
    "url": {
      "type": "string",
      "description": "HTTPS-endpoint"
    },
    "events": {
      "type": "array",
      "items": {
        "type": "string",
        "enum": [
          "alert.triggered",
          "alert.resolved",
          "goal.completed_threshold",
          "uptime.down",
          "uptime.up",
          "export.ready",
          "import.completed",
          "import.failed",
          "site.created",
          "site.deleted",
          "member.added",
          "usage.threshold"
        ]
      },
      "description": "Händelser att skicka"
    },
    "enabled": {
      "type": "boolean",
      "description": "Skicka leveranser"
    },
    "rotate_secret": {
      "type": "boolean",
      "description": "Byt ut signeringshemligheten",
      "default": false
    },
    "workspace_id": {
      "type": "string",
      "description": "Arbetsyte-id, t.ex. ws_7Q2K9XH3AB"
    },
    "id": {
      "type": "string",
      "description": "Id för resursen"
    }
  },
  "required": [
    "workspace_id",
    "id"
  ]
}
Svarsdata
{
  "type": "object",
  "properties": {
    "id": {
      "type": "string",
      "description": "Webhook-id, t.ex. wh_7Q2K9XH3AB"
    },
    "url": {
      "type": "string"
    },
    "events": {
      "type": "array",
      "items": {
        "type": "string"
      }
    },
    "enabled": {
      "type": "boolean"
    },
    "status": {
      "type": "string",
      "description": "active, failing eller disabled"
    },
    "secret": {
      "type": "string",
      "description": "Signeringshemlighet för Privatus-Signature"
    },
    "consecutive_failures": {
      "type": "integer"
    },
    "last_success_at": {
      "anyOf": [
        {
          "type": "string",
          "format": "date-time"
        },
        {
          "type": "null"
        }
      ]
    },
    "last_failure_at": {
      "anyOf": [
        {
          "type": "string",
          "format": "date-time"
        },
        {
          "type": "null"
        }
      ]
    },
    "created_at": {
      "type": "string",
      "format": "date-time"
    }
  }
}