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

# Search journal and chats

> Case-insensitive substring search, performed server-side after decryption. Requires `journal:read` OR `chat:read`; results are limited to the sources the token's scopes allow: `journal:read` searches journal entries and mentor responses, `chat:read` searches mentor chat messages. Each source scans at most its 1,000 most recent items (after the `since` filter). Results from all sources are merged and sorted by time descending. There is no pagination.



## OpenAPI

````yaml /api-reference/openapi.json get /search
openapi: 3.1.0
info:
  title: Life Note Agent API
  version: 1.0.0
  description: >-
    Read-only HTTP API for connecting AI agents and automation tools (such as
    Zapier) to a user's Life Note account. Authenticate with OAuth 2.0
    authorization code + PKCE (S256) and send the access token as
    `Authorization: Bearer <access_token>`. Journal content is decrypted
    server-side and returned only to the authorizing user's own token.
servers:
  - url: https://mylifenote.ai/api/agent/v1
    description: Production
security: []
tags:
  - name: OAuth
    description: Authorization and token exchange
  - name: Account
  - name: Journal
paths:
  /search:
    get:
      tags:
        - Journal
      summary: Search journal and chats
      description: >-
        Case-insensitive substring search, performed server-side after
        decryption. Requires `journal:read` OR `chat:read`; results are limited
        to the sources the token's scopes allow: `journal:read` searches journal
        entries and mentor responses, `chat:read` searches mentor chat messages.
        Each source scans at most its 1,000 most recent items (after the `since`
        filter). Results from all sources are merged and sorted by time
        descending. There is no pagination.
      operationId: search
      parameters:
        - name: q
          in: query
          required: true
          description: Search text, trimmed, at least 2 characters.
          schema:
            type: string
            minLength: 2
          example: walk
        - name: since
          in: query
          required: false
          description: >-
            Lower date bound, inclusive, compared against the entry date at day
            granularity. Accepts a relative form `<N>d` (for example `7d`,
            `30d`, computed from the current UTC date), a date `YYYY-MM-DD`, or
            an ISO 8601 datetime (the time part is discarded). An unparseable
            value is silently ignored (no error, no filter).
          schema:
            type: string
          example: 7d
        - name: limit
          in: query
          required: false
          description: Maximum results. Default 20. Values outside 1-50 are clamped.
          schema:
            type: integer
            default: 20
            minimum: 1
            maximum: 50
      responses:
        '200':
          description: Matches.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SearchResponse'
              example:
                query: walk
                since: null
                results:
                  - source: journal_entry
                    id: 10452
                    date: '2026-10-21'
                    time: '08:14:09'
                    snippet: >-
                      Slow morning. Walked before work and noticed how much
                      lighter I felt.
                  - source: mentor_response
                    id: 88213
                    date: '2026-10-21'
                    time: '08:14:40'
                    mentor: Seneca
                    journal_entry_id: 10452
                    snippet: …a walk is a fine way to return to yourself…
                count: 2
                scanned: 312
                truncated: false
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/InsufficientScope'
        '429':
          $ref: '#/components/responses/RateLimited'
      security:
        - oauth2:
            - journal:read
        - oauth2:
            - chat:read
components:
  schemas:
    SearchResponse:
      type: object
      properties:
        query:
          type: string
        since:
          type:
            - string
            - 'null'
        results:
          type: array
          items:
            $ref: '#/components/schemas/SearchResult'
        count:
          type: integer
        scanned:
          type: integer
          description: Items decrypted and scanned across all sources.
        truncated:
          type: boolean
          description: >-
            True if more matches existed than `limit`. Does not reflect the
            1,000-item scan cap per source.
    SearchResult:
      type: object
      required:
        - source
        - id
        - snippet
      properties:
        source:
          type: string
          enum:
            - journal_entry
            - mentor_response
            - chat_message
        id:
          type: integer
        date:
          type:
            - string
            - 'null'
        time:
          type:
            - string
            - 'null'
        snippet:
          type: string
          description: >-
            About 80 characters either side of the first match, with `…` where
            cut.
        mentor:
          type:
            - string
            - 'null'
          description: mentor_response and chat_message only.
        journal_entry_id:
          type: integer
          description: mentor_response only.
        sender:
          type: string
          description: chat_message only.
        conversation_id:
          type:
            - integer
            - 'null'
          description: chat_message only.
        conversation_title:
          type:
            - string
            - 'null'
          description: chat_message only.
    Error:
      type: object
      required:
        - error
      properties:
        error:
          type: string
          description: Machine-readable code.
        detail:
          type: string
          description: Human-readable detail; not always present.
  responses:
    BadRequest:
      description: Invalid parameter.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            error: invalid_request
            detail: limit/offset must be int
    Unauthorized:
      description: >-
        Missing, malformed, expired or revoked access token. The response
        carries a `WWW-Authenticate: Bearer realm="lifenote",
        resource_metadata="https://mylifenote.ai/.well-known/oauth-protected-resource"`
        header (plus `error="invalid_token"` when a token was sent but
        rejected).
      headers:
        WWW-Authenticate:
          schema:
            type: string
          description: Bearer challenge with a pointer to the protected-resource metadata.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          examples:
            missing:
              summary: No Authorization header
              value:
                error: missing_token
            invalid:
              summary: Bad, expired or revoked token
              value:
                error: invalid_token
    InsufficientScope:
      description: The token is valid but lacks the required scope.
      content:
        application/json:
          schema:
            type: object
            required:
              - error
              - granted
            properties:
              error:
                type: string
                enum:
                  - insufficient_scope
              required:
                type: array
                items:
                  type: string
                description: Scopes that were all required. Not present on `/search`.
              required_any_of:
                type: array
                items:
                  type: string
                description: '`/search` only: at least one of these is required.'
              granted:
                type: array
                items:
                  type: string
          example:
            error: insufficient_scope
            required:
              - journal:read
            granted:
              - chat:read
    RateLimited:
      description: >-
        A rate limit was exceeded. No `Retry-After` header is sent. `reason` is
        one of: `per-token per-minute limit exceeded`, `per-token daily limit
        exceeded`, `per-ip per-minute limit exceeded`, `per-user daily limit
        exceeded`.
      content:
        application/json:
          schema:
            type: object
            required:
              - error
              - reason
            properties:
              error:
                type: string
                enum:
                  - rate_limited
              reason:
                type: string
          example:
            error: rate_limited
            reason: per-token per-minute limit exceeded
  securitySchemes:
    oauth2:
      type: oauth2
      description: >-
        OAuth 2.0 authorization code with mandatory PKCE (S256). Public clients;
        no client secret. Send the access token as `Authorization: Bearer
        <access_token>`.
      flows:
        authorizationCode:
          authorizationUrl: https://mylifenote.ai/api/agent/v1/oauth/authorize
          tokenUrl: https://mylifenote.ai/api/agent/v1/oauth/token
          refreshUrl: https://mylifenote.ai/api/agent/v1/oauth/token
          scopes:
            journal:read: Read journal entries and mentor responses, and search them
            chat:read: Read mentor chat conversations and search chat messages

````

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