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

# Audit progress stream

> Free. Newline-delimited JSON of one audit's events: everything recorded so far, then live until the run ends with {"type":"end"}. Connect with the auditId you generated before calling requestAudit; the stream waits up to 60 seconds for the paid request to start and then ends with reason "unknown audit". Finished audits stay readable for one hour.



## OpenAPI

````yaml /openapi.yaml get /v1/audits/{auditId}/events
openapi: 3.1.0
info:
  title: Agora402 seller API
  version: 1.0.0
  description: >-
    HTTP API served by every Agora402 seller: free discovery documents, a free
    quote endpoint, and paid endpoints gated by x402 and settled on Hedera
    through the Blocky402 facilitator. Typical agent flow: getManifest (what is
    sold, at what price, paid to which account) -> requestQuote (lock a signed
    price, counter below list if you like) -> call the paid endpoint with the
    quoteId. The first call answers 402 with a PAYMENT-REQUIRED header; the
    retry carries PAYMENT-SIGNATURE; the response carries PAYMENT-RESPONSE with
    the Hedera transaction id. Then read listReceipts or the seller's HCS
    receipts topic to audit what was charged. All amounts are decimal strings in
    atomic units of the asset (tinybars for HBAR, 8 decimals); timestamps are
    ISO 8601 unless stated; quote expiry is unix seconds.
servers:
  - url: http://localhost:4402
    description: Local services seller (npm run dev)
  - url: http://localhost:4404
    description: Local auditor (npm run dev)
security: []
tags:
  - name: Discovery
    description: Free documents that describe the seller. Read these before paying anyone.
  - name: Negotiation
    description: Free, signed, time-limited price quotes.
  - name: Paid services
    description: x402-gated endpoints. Every call is a Hedera micropayment.
  - name: Trust
    description: Paid audits of other sellers, attested on the HCS audit topic.
  - name: Receipts
    description: What this seller has been paid for.
paths:
  /v1/audits/{auditId}/events:
    get:
      tags:
        - Trust
      summary: Audit progress stream
      description: >-
        Free. Newline-delimited JSON of one audit's events: everything recorded
        so far, then live until the run ends with {"type":"end"}. Connect with
        the auditId you generated before calling requestAudit; the stream waits
        up to 60 seconds for the paid request to start and then ends with reason
        "unknown audit". Finished audits stay readable for one hour.
      operationId: streamAuditEvents
      parameters:
        - name: auditId
          in: path
          required: true
          schema:
            type: string
            pattern: ^a_[0-9a-f]{16}$
          description: Audit id, a_ followed by 16 hex characters
          example: a_3c9f1e7b2d5a8c04
      responses:
        '200':
          description: NDJSON stream, one AuditEvent per line
          content:
            application/x-ndjson:
              schema:
                $ref: '#/components/schemas/AuditEvent'
              example:
                type: stage
                stage: probes
                index: 2
                total: 3
                status: running
        '400':
          description: auditId does not match a_<16 hex>
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              example:
                error: bad auditId
components:
  schemas:
    AuditEvent:
      description: One line of the audit progress stream
      oneOf:
        - title: started
          type: object
          required:
            - type
            - message
          properties:
            type:
              type: string
              enum:
                - started
            message:
              type: object
              additionalProperties: true
              description: The audit_started message
        - title: stage running
          type: object
          required:
            - type
            - stage
            - index
            - total
            - status
          properties:
            type:
              type: string
              enum:
                - stage
            stage:
              type: string
            index:
              type: integer
            total:
              type: integer
            status:
              type: string
              enum:
                - running
        - title: stage done
          type: object
          required:
            - type
            - stage
            - index
            - total
            - status
            - message
            - evidence
          properties:
            type:
              type: string
              enum:
                - stage
            stage:
              type: string
            index:
              type: integer
            total:
              type: integer
            status:
              type: string
              enum:
                - done
            message:
              $ref: '#/components/schemas/AuditStage'
            evidence:
              type: object
              additionalProperties: true
        - title: attestation
          type: object
          required:
            - type
            - message
          properties:
            type:
              type: string
              enum:
                - attestation
            message:
              $ref: '#/components/schemas/Attestation'
        - title: recorded
          type: object
          required:
            - type
            - what
            - transactionId
            - sequenceNumber
          properties:
            type:
              type: string
              enum:
                - recorded
            what:
              type: string
              enum:
                - audit_started
                - audit_stage
                - attestation
            stage:
              type: string
            transactionId:
              type: string
            sequenceNumber:
              type: integer
        - title: record failed
          type: object
          required:
            - type
            - what
            - error
          properties:
            type:
              type: string
              enum:
                - record_failed
            what:
              type: string
              enum:
                - audit_started
                - audit_stage
                - attestation
            stage:
              type: string
            error:
              type: string
        - title: end
          type: object
          required:
            - type
          properties:
            type:
              type: string
              enum:
                - end
            reason:
              type: string
              description: unknown audit when no run appeared within 60 seconds
    Error:
      type: object
      required:
        - error
      properties:
        error:
          type: string
          description: Human-readable reason
        detail:
          type: string
    AuditStage:
      type: object
      description: One completed stage, as written to the audit topic
      required:
        - v
        - type
        - auditId
        - subject
        - contentHash
        - auditor
        - auditorAccount
        - stage
        - index
        - total
        - summary
        - findings
        - model
        - completedAt
      properties:
        v:
          type: integer
          enum:
            - 1
        type:
          type: string
          enum:
            - audit_stage
        auditId:
          type: string
        subject:
          $ref: '#/components/schemas/Uaid'
        contentHash:
          type: string
          pattern: ^[0-9a-f]{64}$
          description: >-
            sha256 of the audited listing content (payTo, baseUrl, quotePath,
            facilitator, endpoints)
        auditor:
          $ref: '#/components/schemas/Uaid'
        auditorAccount:
          $ref: '#/components/schemas/HederaEntityId'
        stage:
          type: string
        index:
          type: integer
          minimum: 1
        total:
          type: integer
          minimum: 1
        summary:
          type: string
        findings:
          type: array
          items:
            $ref: '#/components/schemas/AuditFinding'
        model:
          type: string
          description: LLM that produced the stage, or deterministic
        completedAt:
          type: string
          format: date-time
        evidence:
          type: object
          additionalProperties: true
          description: >-
            Raw observations behind the stage (response only, not written to
            HCS)
    Attestation:
      type: object
      description: The verdict, written last to the audit topic by the auditor account
      required:
        - v
        - type
        - auditId
        - subject
        - contentHash
        - auditor
        - auditorAccount
        - verdict
        - trustScore
        - risk
        - summary
        - capabilities
        - findings
        - model
        - issuedAt
      properties:
        v:
          type: integer
          enum:
            - 1
        type:
          type: string
          enum:
            - attestation
        auditId:
          type: string
        subject:
          $ref: '#/components/schemas/Uaid'
        contentHash:
          type: string
          pattern: ^[0-9a-f]{64}$
        auditor:
          $ref: '#/components/schemas/Uaid'
        auditorAccount:
          $ref: '#/components/schemas/HederaEntityId'
          description: Must equal the HCS payer of the message for a buyer to accept it
        verdict:
          type: string
          enum:
            - safe
            - dangerous
          description: dangerous when any finding is high or critical
        trustScore:
          type: integer
          minimum: 0
          maximum: 100
          description: >-
            100 minus penalties: low 4, medium 12, high 30, critical 60. Buyers
            default to a minimum of 70.
        risk:
          $ref: '#/components/schemas/Severity'
          description: Highest severity across stages
        summary:
          type: string
        capabilities:
          type: array
          items:
            type: string
        findings:
          type: array
          items:
            $ref: '#/components/schemas/AuditFinding'
        model:
          type: string
        issuedAt:
          type: string
          format: date-time
    Uaid:
      type: string
      pattern: '^uaid:'
      description: HCS-14 universal agent id
      example: >-
        uaid:aid:2NEpo7TZRRrLZSi2U;uid=agora-demo-seller;registry=agora402;proto=a2a;nativeId=hedera:testnet:0.0.5001234;domain=localhost:4402
    HederaEntityId:
      type: string
      pattern: ^\d+\.\d+\.\d+$
      description: Hedera entity id, shard.realm.num
      example: 0.0.5001234
    AuditFinding:
      type: object
      required:
        - severity
        - title
      properties:
        severity:
          $ref: '#/components/schemas/Severity'
        title:
          type: string
        detail:
          type: string
    Severity:
      type: string
      enum:
        - none
        - low
        - medium
        - high
        - critical

````