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

# Search memory

> Searches memory documents or operational rules.

Requires **read:memory** for documents or **read:operational-rules** for rules.

Each match includes the file `path`, the line and the layer: organization, firm or default. An incomplete search cannot show that a rule does not exist; follow `next_cursor` for more results.

With `kind=rule`, `query` is a case-insensitive substring search across the rule text fields, including IDs, names and matchers. The results are complete and not paginated.


## OpenAPI

````yaml openapi-public-preview.json GET /v1/memory/search
openapi: 3.1.0
info:
  title: Entendre API
  version: 1.0.0
  description: Programmatic access to crypto-native accounting and treasury operations.
servers:
  - url: https://api.entendre.finance
    description: Production API.
security:
  - ApiKey: []
tags:
  - name: Organization
    description: Read your organization profile and find members for agent assignments.
  - name: Transactions
    description: Find transactions, inspect their details and create manual records.
  - name: Sources
    description: >-
      Manage wallets, exchange accounts, bank accounts and other transaction
      sources.
  - name: Assets
    description: Inspect asset acquisitions, remaining quantities and cost basis.
  - name: Journals
    description: >-
      Create and post journal entries, correct eligible entries and sync posted
      journals to a connected general ledger.
  - name: Documents
    description: >-
      Upload documents, check processing status and link supporting evidence to
      transactions.
  - name: Legal Entities
    description: Manage the legal entities used in your accounting records.
  - name: Ledger Accounts
    description: Manage your chart of accounts and find accounts for journal entries.
  - name: Tags
    description: Create and manage tags to classify your records.
  - name: Accruals
    description: >-
      Create and post accruals, inspect their status and reverse eligible
      entries.
  - name: Cash Application
    description: Match deposits to invoices and manage the resulting cash applications.
  - name: Classification
    description: >-
      Classify transactions in a batch, post eligible entries and inspect the
      results.
  - name: Revaluation
    description: Run asset revaluations for an accounting period and check their results.
  - name: Accounting Periods
    description: Check whether a period is ready to close, then close or reopen it.
  - name: Income Statement
    description: View revenue, expenses and net income for a reporting period.
  - name: Balance Sheet
    description: View assets, liabilities and equity as of a reporting date.
  - name: Trial Balance
    description: Review ledger account balances and debit and credit totals.
  - name: Closing Positions
    description: View asset positions at the end of a reporting period.
  - name: Treasury Balances
    description: Review treasury balances by asset and source.
  - name: Realized Gains & Losses
    description: Review realized gains and losses from asset dispositions.
  - name: Asset Tax Lots
    description: Inspect asset tax lots, remaining quantities and cost basis.
  - name: Schedule of Dispositions
    description: >-
      Review asset dispositions and their proceeds, cost basis and gains or
      losses.
  - name: Financial Insights
    description: Review financial insights for your selected reporting context.
  - name: Agents
    description: Create agents, schedule their work and inspect their runs.
  - name: Memory
    description: Read, search and maintain the memory files your agents use.
  - name: Connections
    description: Connect providers, manage authorization and disconnect.
  - name: GL Mapping
    description: >-
      Map ledger accounts and legal entities to your ERP. Import legal entities,
      tags and chart of accounts.
  - name: Request
    description: Request information, documents or connections from a client.
  - name: Client
    description: Manage your firm’s client relationships.
  - name: Team
    description: Invite team members and manage their access to your firm.
  - name: Settings
    description: Read and update your firm settings.
paths:
  /v1/memory/search:
    get:
      tags:
        - Memory
      summary: Search memory
      description: >-
        Search memory documents or operational rules. Select `kind=document`
        (default) or `kind=rule` in the query. Documents require memory
        permissions; rules require operational-rules permissions. Rule requests
        reject document-only fields, and document requests reject rule-only
        fields. Rules are organization-scoped and do not inherit firm documents.


        query is required. Document search accepts root, scope, since, actor,
        and cursor and returns matching lines in the existing document envelope.
        Rule search optionally accepts domain and matches a case-insensitive
        substring across returned string fields, including IDs, names, and
        matcher text. It returns a complete data list, total_count of matches,
        has_more=false, and next_cursor=null. Rules reject document search
        filters and pagination.
      operationId: searchMemory
      parameters:
        - name: kind
          in: query
          required: false
          description: >-
            `document` (the default) for a memory document, or `rule` for an
            operational rule.
          schema:
            type: string
            enum:
              - document
              - rule
            default: document
        - name: query
          in: query
          required: true
          schema:
            type: string
            minLength: 1
            maxLength: 500
          description: Text to search for.
        - name: root
          in: query
          required: false
          schema:
            type: string
          description: 'Document only. '
        - name: scope
          in: query
          required: false
          schema:
            type: string
            enum:
              - org
              - firm
          description: 'Document only. '
        - name: since
          in: query
          required: false
          schema:
            type: string
            format: date-time
          description: 'Document only. '
        - name: actor
          in: query
          required: false
          schema:
            type: string
          description: 'Document only. '
        - name: cursor
          in: query
          schema:
            type: string
            maxLength: 256
          description: Document only. The `next_cursor` value from the previous page.
        - name: domain
          in: query
          required: false
          description: Rule only. Limits the lookup to one rule domain.
          schema:
            type: string
            enum:
              - classification
              - cash_application
      responses:
        '200':
          description: Matching lines with their path and source layer.
          content:
            application/json:
              schema:
                oneOf:
                  - $ref: '#/components/schemas/MemorySearchResult'
                  - type: object
                    required:
                      - data
                      - has_more
                      - next_cursor
                    properties:
                      data:
                        type: array
                        items:
                          $ref: '#/components/schemas/OperationalRule'
                        description: The records.
                      has_more:
                        type: boolean
                        description: '`true` if more pages exist.'
                      next_cursor:
                        type:
                          - string
                          - 'null'
                        description: 'Always `null`: the list is complete.'
                      counts_by_domain:
                        type: object
                        properties:
                          classification:
                            type: integer
                            description: Classification rules.
                          cash_application:
                            type: integer
                            description: Cash-application rules.
                        description: >-
                          Total rules for each domain. Omitted when `domain` is
                          set.
              example:
                success: true
                matches:
                  - path: knowledge/vendors.md
                    layer: org
                    line: 1
                    text: Treat approved staking rewards as revenue.
                match_count: 1
                truncated: false
                next_cursor: null
        '400':
          description: Invalid path, query or request body.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/MemoryErrorResponse'
              example:
                error:
                  code: VALIDATION_ERROR
                  message: Invalid path, query or request body.
                  request_id: req_example
        '401':
          description: The API key is missing, invalid or expired.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/MemoryErrorResponse'
              example:
                error:
                  code: UNAUTHORIZED
                  message: Authentication is required.
                  request_id: req_example
        '403':
          description: The API key does not have the required scope.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/MemoryErrorResponse'
              example:
                error:
                  code: FORBIDDEN
                  message: Insufficient access to organization
                  request_id: req_example
        '429':
          description: >-
            Too many requests. If the response has a `Retry-After` header, wait
            that many seconds before you retry. Otherwise, read `error.message`.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/MemoryErrorResponse'
              example:
                error:
                  code: RATE_LIMITED
                  message: Rate limit exceeded. Retry after 30s.
                  request_id: req_example
        '502':
          description: Memory is temporarily unavailable. Retry later.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/MemoryErrorResponse'
              example:
                error:
                  code: PROVIDER_ERROR
                  message: The memory service is temporarily unavailable.
                  request_id: req_example
components:
  schemas:
    MemorySearchResult:
      type: object
      required:
        - success
        - matches
        - match_count
        - truncated
        - next_cursor
      properties:
        success:
          type: boolean
          description: '`true` when the request succeeded.'
        matches:
          type: array
          items:
            $ref: '#/components/schemas/MemorySearchMatch'
          description: Matching lines.
        match_count:
          type: integer
          description: Total matches found, which can exceed the number returned.
        truncated:
          type: boolean
          description: >-
            Some results were left out. Truncation does not show that a match is
            absent.
        other_number:
          type: array
          description: >-
            Present when `match_count` is 0: lines that match the singular or
            plural form of the query.
          items:
            type: object
            required:
              - path
              - layer
              - form
              - line
              - text
            properties:
              path:
                type: string
                description: Relative file path.
              layer:
                type: string
                enum:
                  - org
                  - firm
                  - default
                description: 'Layer of the file: `org`, `firm` or `default`.'
              form:
                type: string
                description: The inflected form that matched.
              line:
                type: integer
                description: Line number, starting at 1.
              text:
                type: string
                description: The matching line.
        unreadable:
          type: array
          items:
            type: string
          description: Paths skipped because their header did not parse.
        next_cursor:
          type:
            - string
            - 'null'
          description: Pass as `cursor` with the same query and filters to continue.
    OperationalRule:
      type: object
      required:
        - rule_id
        - domain
        - title
        - statement
        - created_at
      properties:
        rule_id:
          type: string
          description: >-
            Rule ID (such as `rule_ab12cd34`). Pass it as `rule_id` to Delete
            memory with `kind=rule`.
        domain:
          type: string
          enum:
            - classification
            - cash_application
          description: >-
            Rule type: `classification` (transaction categorization) or
            `cash_application` (invoice/deposit matching).
        title:
          type: string
          description: Short human-readable rule name.
        statement:
          type: string
          description: Human-readable summary of what the rule matches and where it routes.
        created_at:
          type: string
          format: date-time
          description: Time the rule was created (ISO 8601).
        action:
          type: string
          enum:
            - route_to_account
            - require_human_review
          description: >-
            For cash-application rules: what the rule does when its matcher
            fires.
        matcher:
          type: string
          description: >-
            For cash-application rules: the verbatim matcher phrase compared
            against invoice line text.
        match_operator:
          type: string
          enum:
            - exact
            - contains
          description: >-
            For cash-application rules: how `matcher` is compared (`contains`
            fires on any occurrence; `exact` requires the normalized line label
            to equal it).
        normalized_matcher:
          type: string
          description: >-
            For cash-application rules: the matcher as Entendre compares it, in
            lowercase and without punctuation.
        ledger_account_id:
          type: string
          description: >-
            For cash-application rules with route_to_account: target ledger
            account.
        ledger_account_name:
          type: string
          description: Name of the target ledger account.
        ledger_account_archived:
          type: boolean
          description: >-
            Present and `true` only when the target ledger account is archived.
            The rule still routes to it, so change or delete the rule.
        description_contains:
          type: string
          description: >-
            Classification rules: text that matches the memo or payee. Returned
            in lowercase.
        source_category:
          type: string
          description: 'For classification rules: source-platform category matched.'
        merchant_name:
          type: string
          description: 'For classification rules: merchant name matched.'
        blockchain_address:
          type: string
          description: >-
            Classification rules: address that matches the from or to address.
            Returned in lowercase.
        asset_type:
          type: string
          description: 'For classification rules: asset symbol matched.'
        direction:
          type: string
          enum:
            - DEPOSIT
            - WITHDRAWAL
            - ANY
          description: 'For classification rules: transaction direction constraint.'
        category_ledger_account_id:
          type: string
          description: 'For classification rules: prefixed target ledger account id.'
        category_ledger_account_name:
          type: string
          description: 'For classification rules: target ledger account name.'
        category_ledger_account_archived:
          type: boolean
          description: >-
            For classification rules: present and true only when the category
            target ledger account is archived. Change or delete the rule.
        category_ledger_account_sequence:
          type:
            - integer
            - 'null'
          description: 'For classification rules: target ledger account sequence.'
        resolved_payee:
          type: string
          description: 'For classification rules: clean payee applied by the rule.'
        default_tag_id:
          type: string
          description: 'For classification rules: prefixed tag applied by the rule.'
    MemoryErrorResponse:
      type: object
      required:
        - error
      properties:
        error:
          type: object
          required:
            - code
            - message
            - request_id
          properties:
            code:
              type: string
              description: Machine-readable error code.
            message:
              type: string
              description: Technical description for developers.
            fields:
              type: object
              additionalProperties:
                type: string
              description: >-
                Present only on VALIDATION_ERROR. Maps failing field paths to
                reason strings.
            details:
              type: object
              additionalProperties: true
              description: >-
                Extra error details for agent operations. The keys can differ
                from the public field names; use them for diagnosis only.
            suggested_action:
              type: string
              description: A suggested next step.
            documentation_url:
              type: string
              format: uri
              description: Link to documentation about this error.
            request_id:
              type: string
              description: Unique request ID for support escalation.
          description: Error details.
    MemorySearchMatch:
      type: object
      required:
        - path
        - layer
        - line
        - text
      properties:
        path:
          type: string
          description: Relative file path.
        layer:
          type: string
          enum:
            - org
            - firm
            - default
          description: 'Layer of the file: `org`, `firm` or `default`.'
        line:
          type: integer
          description: 1-based line number of the match.
        text:
          type: string
          description: >-
            The matching line. In a `policy/*.json` file, the text is the whole
            record.
        frontmatter:
          $ref: '#/components/schemas/MemoryFrontmatter'
    MemoryFrontmatter:
      type:
        - object
        - 'null'
      additionalProperties: true
      description: Parsed frontmatter of the stored document, or null when it has none.
  securitySchemes:
    ApiKey:
      type: apiKey
      in: header
      name: X-API-Key
      description: >-
        Your organization API key. Some operations also need a key that is
        associated with a user; their pages say so.

````