> ## Documentation Index
> Fetch the complete documentation index at: https://docs.ankra.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Check a log alert against the last 7 days

> Checks a log alert that is not saved against the last 7 days of the environment's lines on Ankra's hosted logs, and answers how many times it would have told someone, when, and the most lines one five-minute stretch held in each hour. Every place the environment runs in is read, in reads of at most 500 stretches on 300-second boundaries plus one read by day, within 30 seconds; one read that fails or is cut, or a cluster whose log history is off, answers 200 with could_not_check and every count null. Only an app_log condition on Ankra's hosted logs can be checked (another condition, or a connected store, is refused 422). Requires what a create requires: alerts.manage, or applications.write on the application, and kubernetes.logs on every cluster the environment runs on (a caller without it on one is refused 403 naming kubernetes.logs and that cluster, before anything is read). Nothing is stored and nothing is audited.



## OpenAPI

````yaml https://platform.ankra.app/openapi.json post /api/v1/org/applications/{application_id}/alerts/preview
openapi: 3.1.0
info:
  title: Ankra Platform API
  version: v1
  description: >-
    The Ankra platform HTTP contract. The /api/v1 surface is the public,
    bearer-authenticated API used by the Ankra CLI, MCP clients and automation;
    send a personal or service API token as `Authorization: Bearer <token>`.
    Browser routes under /org and /chat are served on api.platform.ankra.app
    (each declares that server); they and /oauth/access authenticate with the
    ankra_session cookie, and mutations also require the X-Ankra-CSRF header.
    Every operation declares the credential it accepts. Only the public platform
    status feed (GET /api/v1/status) is served without one. This document is
    published deliberately: it describes the contract only and carries no
    organisation data or credentials. Report security issues to
    security@ankra.ai (see /.well-known/security.txt).
servers:
  - url: https://platform.ankra.app
security:
  - BearerAuth: []
tags:
  - name: Onboarding
    description: >-
      Generate a first website from a prompt and deploy it to a new
      organisation's cluster.
  - name: Access Gate
    description: >-
      Private service sign-in and membership checks for trusted Ankra proxy
      relays.
  - name: Canvas Datasets
    description: >-
      Read the fixed, named datasets canvas dashboards bind their charts, tables
      and stats to.
  - name: Canvases
    description: >-
      Keep dashboards and pages in the organisation's canvas library, with
      revision history, undo and pins.
  - name: Canvas Pages
    description: >-
      Publish a chat canvas artifact at a public pages address and take it down
      again.
  - name: Cloud Delegation
    description: >-
      Platform browser consent and organisation-bound connections for Ankra
      Cloud.
  - name: Organisation IAM
    description: >-
      Custom organisation roles and scoped role assignments for member and
      service-account identities.
  - name: Clusters
    description: Create, inspect and manage clusters, and the stacks deployed on them.
  - name: Managed Clusters
    description: Provider-managed control planes, driven through one common surface.
  - name: Playground
    description: >-
      The organisation's playground cluster: order one, read its provisioning
      status, list the orderable sizes, resize it and destroy it.
  - name: Imported Clusters
    description: Clusters that already existed and were connected to Ankra.
  - name: Cluster Access
    description: Kubeconfigs, service-account tokens and per-cluster access grants.
  - name: Cluster Meshes
    description: >-
      Cilium ClusterMeshes that join an organisation's clusters into one
      network: create a mesh, check whether clusters can join, prepare a running
      cluster, and add or remove members.
  - name: Kubernetes
    description: Read and act on the Kubernetes objects inside a cluster.
  - name: AWS Clusters
    description: >-
      Provision and manage self-managed k3s / kubeadm clusters on AWS EC2 in
      your own VPC.
  - name: Ankra Cloud Clusters
    description: >-
      Provision and manage self-managed kubeadm / k3s clusters on Ankra Cloud
      servers: a private network, a NAT router and a bastion per cluster.
  - name: DigitalOcean Clusters
    description: Provision and manage DigitalOcean Kubernetes clusters.
  - name: Hetzner Clusters
    description: Provision and manage Hetzner Kubernetes clusters.
  - name: OVH Clusters
    description: Provision and manage OVH Kubernetes clusters.
  - name: Scaleway Clusters
    description: Provision and manage Scaleway Kapsule clusters.
  - name: UpCloud Clusters
    description: Provision and manage UpCloud Kubernetes clusters.
  - name: Proxmox Clusters
    description: >-
      Self-managed Kubernetes clusters Ankra builds on Proxmox VE VMs: the node,
      storage, bridge, template and size catalogs, create and teardown, start
      and stop, node groups, nodes, standalone VMs, upgrades and the bastion.
  - name: HPE Morpheus Clusters
    description: >-
      Self-managed Kubernetes clusters Ankra builds on HPE Morpheus VMs: the
      group, cloud, plan, layout and network catalogs, create and teardown,
      start and stop, node groups, nodes, standalone VMs, upgrades and the
      bastion.
  - name: Applications
    description: Deploy, configure and observe applications across the fleet.
  - name: Pipelines
    description: >-
      Pipeline definitions, the approval of the authority they declare, and the
      caches pipelines keep between runs.
  - name: Workspaces
    description: >-
      Personal workspaces on the organisation's CI pool where a repository's
      heavy commands run, and the repository profiles they are built from.
  - name: Deploy Targets
    description: >-
      Environments, the hosts registered to receive deployments, and the
      releases deployed to them.
  - name: Deploy Provenance
    description: >-
      Whether an application's deploys verify signed provenance from the
      organisation's own pipeline, the keys that provenance is signed with, and
      a dry-run that verifies images without deploying.
  - name: Backups
    description: >-
      Backup vaults, restore points, protection posture and captures for stacks
      and application deployments; a completed capture is not a verified
      restore.
  - name: Stack Profiles
    description: Reusable stack definitions, their versions and sharing.
  - name: Services
    description: >-
      Versioned service packages and explicit sharing. Runtime admission is
      separate from publication.
  - name: Charts
    description: Browse the chart catalogue behind stacks and addons.
  - name: Helm
    description: Helm registries, credentials and the charts they expose.
  - name: Executions
    description: Long-running platform executions and their jobs.
  - name: Operations
    description: Cancel in-flight cluster operations and their jobs.
  - name: Chat
    description: Conversational sessions, plans and confirmable actions.
  - name: AI Management
    description: >-
      Customer agent lifecycle, authenticated identity and organisation
      automation controls.
  - name: AI Agent Runs
    description: Autonomous agent runs and their outcomes.
  - name: AI Tickets
    description: The AI ticket board, its sync connections and settings.
  - name: AI Playbooks
    description: Reusable playbooks the AI lanes execute.
  - name: AI Conditions
    description: Conditions that gate AI autonomy.
  - name: AI Remediation
    description: >-
      The organisation's auto-remediation policy: what the AI lanes may fix by
      themselves, and who approves the rest.
  - name: AI Engineering Handoffs
    description: Work the AI lanes escalate to a human engineer.
  - name: AI Environment
    description: The environment and base stacks AI demos deploy into.
  - name: AI Memory
    description: >-
      What the assistant has learned about you: your cross-session memories and
      learned profile.
  - name: MCP Servers
    description: >-
      Register the MCP servers the organisation's AI agents can call, choose
      their tools and grant them to roles.
  - name: Security
    description: Findings, advisories, SBOMs, compliance and posture.
  - name: Cost
    description: Cluster and fleet cost, rate cards and cost settings.
  - name: Decisions
    description: >-
      The decision ledger behind the Security and Cost queues: proposals a
      surface computed, the approve and set-aside decisions people took on them,
      and the receipts of running them.
  - name: Usage
    description: >-
      What your organisation used of Ankra - vCPU-hours, playgrounds, managed
      services, hosted logs and metrics, and AI - per meter and period, with how
      completely it was measured and whether a published rate applies.
  - name: Billing
    description: Subscription and spend caps.
  - name: Organisation
    description: Members, invitations, audit logs and organisation settings.
  - name: Projects
    description: >-
      Projects group an organisation's clusters, applications, credentials and
      other resources beneath it: list, create, rename and delete them, switch
      the current project, see who reaches one, and move resources between them.
  - name: Account
    description: >-
      Your own account: the contact email Ankra mails when it differs from your
      sign-in address, and the AI provider keys your own work runs on.
  - name: Account Tokens
    description: Personal access tokens for the API and CLI.
  - name: Credentials
    description: The shared credential store.
  - name: AWS Credentials
    description: >-
      AWS credentials: access keys or CloudFormation-onboarded STS roles for
      cost, EKS and self-managed provisioning.
  - name: Ankra Cloud Credentials
    description: >-
      Ankra Cloud API tokens, shared by the self-managed and managed Ankra Cloud
      lanes.
  - name: Azure Credentials
    description: Azure credentials and SSH keys.
  - name: DigitalOcean Credentials
    description: DigitalOcean credentials and SSH keys.
  - name: Hetzner Credentials
    description: Hetzner credentials and SSH keys.
  - name: HPE Morpheus Credentials
    description: HPE Morpheus credentials and the capacity and quotas behind them.
  - name: OVH Credentials
    description: OVH credentials and SSH keys.
  - name: Proxmox Credentials
    description: Proxmox VE credentials and the capacity and quotas behind them.
  - name: Scaleway Credentials
    description: Scaleway credentials.
  - name: UpCloud Credentials
    description: UpCloud credentials and SSH keys.
  - name: Data Source Credentials
    description: Credentials for metrics and log sources.
  - name: DNS Credentials
    description: Credentials for DNS providers.
  - name: Object Storage Buckets
    description: >-
      Buckets Ankra creates and manages on an organisation's own provider
      credentials.
  - name: DNS
    description: DNS zones and records, including custom organisation zones.
  - name: Cloudflare
    description: Cloudflare domains and the credentials behind them.
  - name: Avura
    description: >-
      The linked Avura organization, the domains it shares with Ankra Platform,
      and their DNS records.
  - name: Variables
    description: Organisation- and cluster-scoped variables.
  - name: Secret Slots
    description: >-
      Store secrets in Vault and reference them by ${SECRET_SLOT:<slot_id>}
      sentinel instead of by value.
  - name: SOPS
    description: Encrypt and decrypt values with the organisation SOPS config.
  - name: Alerts
    description: Alert integrations and ingest credentials.
  - name: Notifications
    description: Notification routes and their delivery targets.
  - name: Platform Status
    description: >-
      The public status of the Ankra platform: incidents and maintenance Ankra
      staff publish, as shown on ankra.ai/status.
  - name: Support
    description: Support tickets.
  - name: AI Settings
    description: Organisation AI provider, model catalog and per-function model settings
paths:
  /api/v1/org/applications/{application_id}/alerts/preview:
    post:
      tags:
        - Alerts
      summary: Check a log alert against the last 7 days
      description: >-
        Checks a log alert that is not saved against the last 7 days of the
        environment's lines on Ankra's hosted logs, and answers how many times
        it would have told someone, when, and the most lines one five-minute
        stretch held in each hour. Every place the environment runs in is read,
        in reads of at most 500 stretches on 300-second boundaries plus one read
        by day, within 30 seconds; one read that fails or is cut, or a cluster
        whose log history is off, answers 200 with could_not_check and every
        count null. Only an app_log condition on Ankra's hosted logs can be
        checked (another condition, or a connected store, is refused 422).
        Requires what a create requires: alerts.manage, or applications.write on
        the application, and kubernetes.logs on every cluster the environment
        runs on (a caller without it on one is refused 403 naming
        kubernetes.logs and that cluster, before anything is read). Nothing is
        stored and nothing is audited.
      operationId: preview_application_alert_api_v1
      parameters:
        - name: application_id
          in: path
          required: true
          schema:
            type: string
            format: uuid
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ApplicationAlertPreviewRequest'
      responses:
        '200':
          description: The check, or why it could not be given (could_not_check)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApplicationLogAlertPreview'
        '400':
          description: Missing or malformed Authorization header
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/DemoDetailError'
        '401':
          description: Unauthorized
        '403':
          description: >-
            The caller lacks the permission (permission_denied, naming it), or
            the token is MCP-scoped or names an organisation the member does not
            belong to
          content:
            application/json:
              schema:
                oneOf:
                  - $ref: '#/components/schemas/SecurityPermissionDenied'
                  - $ref: '#/components/schemas/DemoDetailError'
        '404':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/DemoDetailError'
          description: Not found ("Application not found")
        '422':
          description: >-
            A field of the body is wrong (detail names it), the condition is not
            app_log on Ankra's hosted logs, the environment is not the
            application's or runs in more than 25 places, or a path parameter is
            not a uuid
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApplicationAlertRefusal'
        '500':
          description: Internal server error
      security:
        - BearerAuth: []
components:
  schemas:
    ApplicationAlertPreviewRequest:
      type: object
      title: ApplicationAlertPreviewRequest
      description: >-
        A log alert that is not saved, to check against the last 7 days: the
        environment_id and the condition of a create. No other key is accepted
        (a create's name, send_to and severity are refused by name).
      additionalProperties: false
      required:
        - environment_id
        - condition
      properties:
        environment_id:
          type: string
          format: uuid
          description: One of the application's environments.
        condition:
          $ref: '#/components/schemas/ApplicationAlertCondition'
    ApplicationLogAlertPreview:
      type: object
      title: ApplicationLogAlertPreview
      description: >-
        How many times a log alert would have told someone in the last 7 days:
        2,016 five-minute stretches ending on the latest 300-second boundary,
        each place the environment runs in counted on Ankra's hosted logs and
        the places added up stretch by stretch. A stretch is over when its lines
        are more than threshold, and a run of stretches over is one time. The
        real check counts a sliding five minutes about once a minute, so a burst
        split across two stretches can stay under in both and still fire for
        real. The check is whole or it is not given: when could_not_check is
        set, counted_from, first_line_day, kept_days, installations.read,
        would_have_told, firings, firings_truncated and series are null, never
        0.
      required:
        - checked_from
        - checked_to
        - stretch_seconds
        - stretches
        - counted_from
        - first_line_day
        - kept_days
        - installations
        - would_have_told
        - firings
        - firings_truncated
        - series
        - could_not_check
      properties:
        checked_from:
          type: string
          format: date-time
          description: The start of the 7 days, in whole seconds, UTC.
        checked_to:
          type: string
          format: date-time
          description: >-
            The end of the 7 days: the latest 300-second boundary at or before
            the check, UTC.
        stretch_seconds:
          type: integer
          description: 'The length of one stretch: 300.'
        stretches:
          type: integer
          description: 'How many stretches the 7 days hold: 2016.'
        counted_from:
          type:
            - string
            - 'null'
          format: date-time
          description: >-
            Where every place's lines are counted from: checked_from, or later
            when log history was turned on for a cluster of the environment
            inside the 7 days (its stretches before then hold none of that
            cluster's lines).
        first_line_day:
          type:
            - string
            - 'null'
          format: date
          description: >-
            The first UTC day, from the day checked_from falls on, on which any
            place holds any line at all, searched or not; null when no place
            holds a line in the 7 days, or when could_not_check is set.
        kept_days:
          type:
            - integer
            - 'null'
          description: >-
            How many days the store keeps a line; null when the store does not
            say.
        installations:
          $ref: '#/components/schemas/ApplicationLogAlertPreviewInstallations'
        would_have_told:
          type:
            - integer
            - 'null'
          description: How many times it would have told.
        firings:
          type:
            - array
            - 'null'
          maxItems: 20
          items:
            $ref: '#/components/schemas/ApplicationLogAlertPreviewFiring'
          description: Those times, newest first, at most 20.
        firings_truncated:
          type:
            - boolean
            - 'null'
          description: Whether there were more than 20 times.
        series:
          type:
            - array
            - 'null'
          minItems: 168
          maxItems: 168
          items:
            $ref: '#/components/schemas/ApplicationLogAlertPreviewHour'
          description: >-
            For each hour of the 7 days, oldest first, the most lines one of its
            stretches held.
        could_not_check:
          oneOf:
            - $ref: '#/components/schemas/ApplicationLogAlertPreviewFailure'
            - type: 'null'
          description: Why the check could not be given; null when it was.
    DemoDetailError:
      description: >-
        The FastAPI-style detail envelope the demo routes use for
        400/403/404/409/502 responses.
      properties:
        detail:
          type: string
      required:
        - detail
      type: object
    SecurityPermissionDenied:
      properties:
        detail:
          enum:
            - permission_denied
          type: string
        permission:
          type: string
        scope_type:
          type: string
      required:
        - detail
        - permission
        - scope_type
      type: object
    ApplicationAlertRefusal:
      type: object
      title: ApplicationAlertRefusal
      description: >-
        A refused application alert request. A field the body got wrong is one
        sentence naming it; a malformed path or query parameter is the
        validation list.
      required:
        - detail
      properties:
        detail:
          oneOf:
            - type: string
            - type: array
              items:
                $ref: '#/components/schemas/ValidationError'
    ApplicationAlertCondition:
      type: object
      title: ApplicationAlertCondition
      description: >-
        The one condition an application alert has. app_metric fires when the
        metric reads above threshold for hold_minutes in a row; the metrics are
        the ones the application's charts draw for the environment. app_log
        fires when more than threshold lines matching search are written in five
        minutes, counted over every place the environment runs in, added up;
        metric is log_lines and hold_minutes 0, and both may be left out on a
        create or change.
      additionalProperties: false
      required:
        - condition_type
        - metric
        - threshold
        - hold_minutes
      properties:
        condition_type:
          type: string
          enum:
            - app_metric
            - app_log
        metric:
          type: string
          enum:
            - failed_share_pct
            - p95_ms
            - restarts
            - log_lines
          description: >-
            failed_share_pct: the share of requests that failed, in percent.
            p95_ms: the 95th percentile response time, in milliseconds.
            restarts: container restarts in the last 15 minutes. log_lines: the
            lines an app_log condition counts, and its only metric.
        route:
          type: 'null'
          description: >-
            Left out or null: an alert on one route is not offered yet, and any
            other value is refused.
        operator:
          type: string
          enum:
            - gt
          default: gt
          description: Left out or null reads as gt.
        threshold:
          type: number
          minimum: 0
          description: >-
            At most 100 for failed_share_pct. For app_log a whole number of
            lines from 0 to 100,000; 0 fires on any line.
        hold_minutes:
          type: integer
          minimum: 0
          maximum: 60
          description: >-
            How many minutes the reading stays above the threshold before the
            alert fires: 1 to 60 for app_metric, 0 for app_log, whose
            five-minute count is already its hold.
        window_minutes:
          type: integer
          enum:
            - 5
          description: >-
            app_log only: the minutes it counts, always 5. Absent on an
            app_metric condition.
        search:
          $ref: '#/components/schemas/ApplicationAlertLogSearch'
    ApplicationLogAlertPreviewInstallations:
      type: object
      title: ApplicationLogAlertPreviewInstallations
      description: How many places the environment runs in, and how many were read.
      required:
        - read
        - total
      properties:
        read:
          type:
            - integer
            - 'null'
          description: >-
            How many places were read: every one, or null when the check could
            not be given.
        total:
          type: integer
          description: How many places the environment runs in.
    ApplicationLogAlertPreviewFiring:
      type: object
      title: ApplicationLogAlertPreviewFiring
      description: 'One time the alert would have told: a run of stretches over the number.'
      required:
        - from
        - to
        - most_lines
      properties:
        from:
          type: string
          format: date-time
          description: The start of the run's first stretch.
        to:
          type: string
          format: date-time
          description: The end of the run's last stretch.
        most_lines:
          type: integer
          description: The most lines one stretch of the run held, the places added up.
    ApplicationLogAlertPreviewHour:
      type: object
      title: ApplicationLogAlertPreviewHour
      description: One point of the series.
      required:
        - hour_start
        - most_lines
      properties:
        hour_start:
          type: string
          format: date-time
          description: 'The start of the hour: checked_from plus a whole number of hours.'
        most_lines:
          type: integer
          description: >-
            The most lines one of the hour's twelve stretches held, the places
            added up.
    ApplicationLogAlertPreviewFailure:
      type: object
      title: ApplicationLogAlertPreviewFailure
      description: >-
        Why a check against the last 7 days could not be given.
        no_installations: the environment runs nowhere yet. log_history_off: a
        cluster it runs on does not ship its lines to Ankra's hosted logs.
        log_store_unavailable: Ankra's hosted logs cannot be read for a cluster
        it runs on. timeout: the reads did not finish within 30 seconds.
        store_error: the store refused or failed a read. unreadable_reply: a
        read answered counts that are not the stretches it asked for.
        count_partial: a read counted only part of the lines.
      required:
        - reason
        - sentence
      properties:
        reason:
          type: string
          enum:
            - count_partial
            - log_history_off
            - log_store_unavailable
            - no_installations
            - store_error
            - timeout
            - unreadable_reply
        sentence:
          type: string
          description: >-
            The reason in plain words, opening "It could not be checked against
            the last 7 days: ".
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          title: Location
          type: array
        msg:
          title: Message
          type: string
        type:
          title: Error Type
          type: string
      required:
        - loc
        - msg
        - type
      title: ValidationError
      type: object
    ApplicationAlertLogSearch:
      type: object
      title: ApplicationAlertLogSearch
      description: >-
        The search an app_log condition counts, copied into the alert as it
        stands. It holds only what a count can apply: words, level classes and
        what to leave out. A copy (pod) filter, kept or left out, a field filter
        (fields, filters, version, route, status, pattern, pattern_kind,
        request, containers, namespaces) and raw_query are refused by name; when
        a body holds several refused keys, a copy filter is refused first, then
        the first other refused key in sorted order.
      additionalProperties: false
      required:
        - source
      properties:
        words:
          type: string
          maxLength: 500
          description: >-
            The words a line must hold, found as the Logs page's search finds
            them. Empty for every line of the levels.
        levels:
          type: array
          maxItems: 100
          items:
            type: string
            enum:
              - error
              - warn
              - info
              - debug
              - other
          description: The level classes to count. Empty for every level.
        exclude:
          type: object
          additionalProperties: false
          properties:
            levels:
              type: array
              maxItems: 100
              items:
                type: string
                enum:
                  - error
                  - warn
                  - info
                  - debug
                  - other
              description: Level classes to leave out.
            words:
              type: array
              maxItems: 100
              items:
                maxLength: 500
                minLength: 1
                type: string
              description: Lines whose message holds one of these words are left out.
        source:
          type: string
          enum:
            - ankra_hosted
          description: >-
            The store the search read. Only ankra_hosted is accepted for now:
            connected is refused 422 (an alert can watch Ankra's hosted logs for
            now), and auto is refused because connecting a store later would
            move the alert to it without anyone saying so.
  securitySchemes:
    BearerAuth:
      bearerFormat: PAT
      scheme: bearer
      type: http

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.