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

# Get ledger integrity

> Returns a pass/fail ledger integrity attestation (postings balanced, value conservation, hash chain, unsealed entries) with the current chain head.

Returns a pass/fail attestation that your ledger is internally consistent and tamper-free: postings balance to zero, value is conserved, the hash chain verifies, and no entries are stuck unsealed.

The response includes `verified_at` and the current `chain_head`. Record the head hash externally at each close; any later alteration of history changes it, making tampering detectable. Hash-chain verification is bounded by `window` (default 1000 entries, max 10000).

<Note>
  For how the hash chain works, see [the Ledger guide](/guides/ledger#integrity). For usage patterns, see the [Reporting guide](/guides/reporting).
</Note>


## OpenAPI

````yaml GET /v1/reports/integrity
openapi: 3.0.3
info:
  contact:
    email: support@scrip.dev
    name: Scrip Support
  description: >-
    Scrip is the operating system for rewards programs. Use this REST API to
    define earn and redemption rules, issue and redeem assets, and track every
    movement in a double-entry ledger. Full guides and reference:
    https://docs.scrip.dev


    Core concepts:

    - **Programs**: Containers for incentive logic (e.g., "Q1 Sales Bonus",
    "Customer Loyalty")

    - **Assets**: The currency or points being tracked (e.g., "Bonus Points",
    "Cash Rewards")

    - **Participants**: Users who earn and spend assets (identified by
    external_id)

    - **Groups**: Collections of participants for team-based incentives

    - **Rules**: Automated reward logic triggered by events

    - **Events**: Actions that trigger rule evaluation (e.g., "purchase",
    "referral")


    Response formats:

    - **Collection endpoints** return: {"data": [...], "pagination":
    {"has_more": true, "next_cursor": "..."}}

    - **Single-resource endpoints** return the resource directly

    - **Errors** return: {"code": "...", "message": "...", "details": {...}} —
    `details` is an optional object, present on input errors only
  license:
    name: Proprietary
  termsOfService: https://scrip.dev/terms
  title: Scrip API
  version: '1.0'
servers:
  - url: https://api.scrip.dev
security: []
tags:
  - description: >-
      Manage incentive programs. Programs are the top-level container for all
      incentive logic.
    name: Programs
  - description: >-
      Manage asset types (currencies, points). Assets define what participants
      can earn and spend.
    name: Assets
  - description: >-
      Manage participants and their balances. Participants are identified by
      external_id from your system.
    name: Participants
  - description: Manage participant groups for team-based incentives.
    name: Groups
  - description: >-
      Manage automated reward rules. Rules define conditions and actions
      triggered by events.
    name: Rules
  - description: Ingest events that trigger rule evaluation and reward distribution.
    name: Events
  - description: Transfer assets between participants.
    name: Transfers
  - description: Access ledger summaries and program activity reports.
    name: Reporting
  - description: >-
      Redeem participant balances for rewards. Supports raw amount redemptions
      and catalog item redemptions.
    name: Redemptions
  - description: >-
      Manage the reward catalog. Create and manage redeemable items with
      inventory tracking.
    name: Rewards
  - description: >-
      Schedule and manage automated event dispatching. Automations generate
      events on cron schedules, at specific times, or by evaluating participant
      state.
    name: Automations
  - description: >-
      Manage tier types and levels within programs. Tiers define status
      hierarchies that participants progress through based on qualification
      rules.
    name: Tiers
  - description: Inspect double-entry ledger records for auditing and reconciliation.
    name: Journal Entries
  - description: >-
      Manage webhook endpoints and delivery logs. Webhooks notify your
      application of real-time events via HTTP POST with HMAC-SHA256 signatures.
    name: Webhooks
paths:
  /v1/reports/integrity:
    get:
      tags:
        - Reporting
      summary: Get ledger integrity attestation
      description: >-
        Returns a pass/fail ledger integrity attestation (postings balanced,
        value conservation, hash chain, unsealed entries) with the current chain
        head.
      operationId: getIntegrityReport
      parameters:
        - description: >-
            Number of most recent sealed journal entries to verify in the
            hash-chain check (1 to 10000)
          in: query
          name: window
          schema:
            default: 1000
            maximum: 10000
            minimum: 1
            type: integer
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/handlers.IntegrityReportResponse'
          description: Integrity attestation
        '400':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/handlers.ErrBadRequestResponse'
          description: 'Invalid query parameters (code: bad_request)'
        '401':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/handlers.ErrUnauthorizedResponse'
          description: 'Missing or invalid credentials (code: unauthorized)'
        '500':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/handlers.ErrInternalResponse'
          description: 'Internal server error (code: internal_error)'
      security:
        - ApiKeyAuth: []
        - BearerAuth: []
components:
  schemas:
    handlers.IntegrityReportResponse:
      description: Ledger integrity attestation for your organization
      properties:
        all_passed:
          description: Whether every check below passed
          example: true
          type: boolean
        chain_head:
          allOf:
            - $ref: '#/components/schemas/handlers.IntegrityChainHeadResponse'
          description: >-
            Current chain head; null when the organization has no sealed entries
            yet
        hash_chain:
          allOf:
            - $ref: '#/components/schemas/handlers.IntegrityHashChainCheckResponse'
          description: >-
            Recomputed hashes over the verification window match the stored
            tamper-evident chain
        organization_id:
          description: Organization this attestation covers
          example: 550e8400-e29b-41d4-a716-446655440000
          format: uuid
          type: string
        postings_balanced:
          allOf:
            - $ref: '#/components/schemas/handlers.IntegrityCheckResponse'
          description: Every journal entry's postings sum to zero
        unsealed_entries:
          allOf:
            - $ref: '#/components/schemas/handlers.IntegrityCheckResponse'
          description: >-
            Journal entries past the sealing grace period that have not been
            sealed into the hash chain
        value_conservation:
          allOf:
            - $ref: '#/components/schemas/handlers.IntegrityCheckResponse'
          description: >-
            Every asset's postings sum to zero across all accounts (no value
            created or destroyed)
        verified_at:
          description: When the verification ran (RFC 3339)
          example: '2026-06-10T12:00:00Z'
          format: date-time
          type: string
        window:
          description: >-
            Hash-chain verification window that was applied (number of most
            recent sealed entries)
          example: 1000
          type: integer
      type: object
    handlers.ErrBadRequestResponse:
      additionalProperties: false
      properties:
        code:
          description: Code is the machine-readable error code
          example: bad_request
          type: string
        details:
          allOf:
            - $ref: '#/components/schemas/handlers.ErrorDetails'
          description: >-
            Details provides optional structured error context (field errors,
            etc.)
        message:
          description: Message is the human-readable error description
          example: Invalid request parameters
          type: string
      type: object
    handlers.ErrUnauthorizedResponse:
      properties:
        code:
          description: Code is the machine-readable error code
          example: unauthorized
          type: string
        details:
          allOf:
            - $ref: '#/components/schemas/handlers.ErrorDetails'
          description: Details provides optional structured error context
        message:
          description: Message is the human-readable error description
          example: Missing or invalid credentials
          type: string
      type: object
    handlers.ErrInternalResponse:
      properties:
        code:
          description: Code is the machine-readable error code
          example: internal_error
          type: string
        message:
          description: Message is the human-readable error description
          example: An internal error occurred
          type: string
      type: object
    handlers.IntegrityChainHeadResponse:
      description: The most recent sealed journal entry in the organization's hash chain
      properties:
        created_at:
          description: When the chain head entry was created (RFC 3339)
          example: '2026-06-10T12:00:00Z'
          format: date-time
          type: string
        hash:
          description: >-
            SHA-256 entry hash of the chain head. Pin this value externally to
            make later tampering of sealed history detectable.
          example: b3a1d9f8c2e4a7b6d1e3f5a8c9b2d4e6f7a1b3c5d7e9f2a4b6c8d0e1f3a5b7c9
          type: string
        sequence_number:
          description: Sequence number of the chain head entry
          example: 48211
          type: integer
      type: object
    handlers.IntegrityHashChainCheckResponse:
      description: Outcome of the bounded hash-chain verification
      properties:
        anchored_at_genesis:
          description: >-
            True when the window covered the entire chain (verification started
            from the genesis hash). False when the window was anchored at the
            stored hash of the entry immediately preceding it.
          example: false
          type: boolean
        entries_verified:
          description: Number of sealed entries whose hashes were recomputed and compared
          example: 1000
          type: integer
        pass:
          description: >-
            Whether every verified entry's recomputed hash matched its stored
            hash
          example: true
          type: boolean
        violation_count:
          description: Number of entries in the window whose recomputed hash did not match
          example: 0
          type: integer
      type: object
    handlers.IntegrityCheckResponse:
      description: Pass/fail outcome of a single ledger integrity check
      properties:
        pass:
          description: Whether the check passed (no violations found)
          example: true
          type: boolean
        violation_count:
          description: Number of violations found (reported up to a cap of 100)
          example: 0
          type: integer
      type: object
    handlers.ErrorDetails:
      description: >-
        Optional structured details about the error. Always a JSON object: a
        `fields` array for validation errors, or flat
        field/reason/expected/received properties for other input errors.
      properties:
        expected:
          description: Expected value or format (non-validation input errors)
          example: uuid
          type: string
        field:
          description: Field name that caused the error (non-validation input errors)
          example: asset_id
          type: string
        fields:
          description: >-
            Fields lists each offending input field on validation_error
            responses.
          items:
            $ref: '#/components/schemas/handlers.ErrorFieldDetail'
          type: array
        reason:
          description: Machine-readable reason code (non-validation input errors)
          example: invalid
          type: string
        received:
          description: Value that was received (non-validation input errors)
          example: not-a-uuid
          type: string
      type: object
    handlers.ErrorFieldDetail:
      description: >-
        A single field-level error: which input field failed, why, and (where
        known) the expected and received values.
      properties:
        expected:
          description: >-
            Expected value or format. Usually a string; for "one of" constraints
            it

            is an array of the allowed values.
        field:
          description: Field name that caused the error
          example: amount
          type: string
        message:
          description: Human-readable explanation (validation errors only)
          example: This field is required
          type: string
        reason:
          description: Machine-readable reason code
          example: required
          type: string
        received:
          description: Value that was received
          example: '-10.00'
          type: string
      type: object
  securitySchemes:
    ApiKeyAuth:
      description: API key passed in the X-API-Key header.
      in: header
      name: X-API-Key
      type: apiKey
    BearerAuth:
      description: Bearer token passed in the Authorization header (e.g. "Bearer sk_...").
      in: header
      name: Authorization
      type: apiKey

````