> ## 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.

# Delete memory

> Moves a memory document to trash, or deletes an operational rule.

Requires **write:memory** for documents, or **write:operational-rules** and an API key with an owner for rules.

For a document, `reason` is required. Set `purge=true` to delete an eligible file permanently. Policy, journal and artifact files cannot be purged.

With `kind=rule`, send `rule_id` instead of `path`; `reason` and `purge` do not apply. Deleting a rule does not change earlier classifications or journals.

<RequestExample dropdown>
  ```bash cURL theme={null}
  curl --request DELETE \
    --url 'https://api.entendre.finance/v1/memory/file?path=knowledge/vendors.md&reason=Superseded' \
    --header 'X-API-Key: <api-key>'
  ```

  ```javascript JavaScript theme={null}
  const response = await fetch(
    'https://api.entendre.finance/v1/memory/file?path=knowledge/vendors.md&reason=Superseded',
    {
      method: 'DELETE',
      headers: {
        'X-API-Key': '<api-key>',
      },
    },
  );
  if (!response.ok) throw new Error(`HTTP ${response.status}`);
  console.log(await response.json());
  ```

  ```python Python theme={null}
  import requests

  response = requests.delete(
      "https://api.entendre.finance/v1/memory/file",
      params={
          "path": "knowledge/vendors.md",
          "reason": "Superseded"
      },
      headers={"X-API-Key": "<api-key>"},
      timeout=30,
  )
  response.raise_for_status()
  print(response.json())
  ```
</RequestExample>


## OpenAPI

````yaml openapi-public-preview.json DELETE /v1/memory/file
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/file:
    delete:
      tags:
        - Memory
      summary: Delete memory
      description: >-
        Move a memory document to trash, or delete an operational rule. Use
        `purge=true` to permanently delete an eligible document. 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.


        Documents require path and reason, with optional purge, and retain
        existing soft-delete behavior. Rules require rule_id, optionally domain,
        and the write:operational-rules scope plus an API-key owner. Get the ID
        from List memory with `kind=rule`. Rule deletion returns the existing
        rule deletion envelope; unknown IDs return 404. It affects subsequent
        runs and does not reverse prior classifications or journal entries.
      operationId: deleteMemory
      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: path
          in: query
          required: false
          schema:
            type: string
            minLength: 1
          description: >-
            Document only, and required for documents. Relative file path, such
            as `knowledge/vendors.md`.
        - name: reason
          in: query
          required: false
          schema:
            type: string
            minLength: 1
          description: >-
            Document only, and required for documents. Why the document is
            deleted.
        - name: purge
          in: query
          schema:
            type: boolean
            default: false
          description: >-
            Document only. Delete permanently instead of moving to .trash/.
            Refused for policy/, journal/ and artifacts/.
        - name: domain
          in: query
          required: false
          description: Rule only. Limits the lookup to one rule domain.
          schema:
            type: string
            enum:
              - classification
              - cash_application
        - name: rule_id
          in: query
          required: false
          description: >-
            Rule only, and required for rules. Get it from List memory with
            `kind=rule`.
          schema:
            type: string
            minLength: 1
            maxLength: 128
      responses:
        '200':
          description: The document was deleted.
          content:
            application/json:
              schema:
                oneOf:
                  - $ref: '#/components/schemas/MemoryDeleteResult'
                  - type: object
                    required:
                      - data
                    properties:
                      data:
                        type: object
                        required:
                          - deleted_rule_id
                          - domain
                          - deleted_rule_summary
                          - version
                          - remaining_count
                        properties:
                          deleted_rule_id:
                            type: string
                            description: ID of the deleted rule.
                          domain:
                            type: string
                            enum:
                              - classification
                              - cash_application
                            description: Rule domain.
                          deleted_rule_summary:
                            type: string
                            description: Human-readable summary of the deleted rule.
                          version:
                            type: string
                            description: Version stamp of the rules file after the write.
                          remaining_count:
                            type: integer
                            description: >-
                              Rules remaining in the affected domain after the
                              delete.
                        description: The result.
              example:
                deleted: true
                path: knowledge/vendors.md
                purged: false
                trash_path: .trash/vendors-example.md
        '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
        '404':
          description: The file to delete was not found.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/MemoryErrorResponse'
              example:
                error:
                  code: RESOURCE_NOT_FOUND
                  message: The file to delete was not found.
                  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:
    MemoryDeleteResult:
      type: object
      required:
        - deleted
        - path
        - purged
      properties:
        deleted:
          type: boolean
          description: '`true` when the file was deleted.'
        path:
          type: string
          description: Relative file path.
        purged:
          type: boolean
          description: >-
            True when the file was removed permanently rather than moved to
            .trash/.
        trash_path:
          type: string
          description: Where a soft-deleted file now lives. Absent on a purge.
    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.
  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.

````