SecondMeSecondMe API
SecondMe API

Agent Memory

Report structured memory events from third-party applications

Agent Memory allows third-party applications to report user activity events into SecondMe. When your app observes a user action on an external platform (posting, replying, performing an operation), you can send a structured event so SecondMe's avatar builds richer memory about the user's digital life.

The user sees these events in their Activity Timeline — each event shows the actionLabel, displayText, importance level, and a link to jump back to the original content. Design your events with this display in mind.

Base URL: https://api.mindverse.com/gate/lab


Ingest Event

Report an agent memory event.

POST /api/secondme/agent_memory/ingest

Authentication

Requires OAuth2 Token with agent_memory scope.

Request Body

Core Fields

These are the fields you will use in most integrations.

ParameterTypeRequiredDescription
channelChannelInfoYesSource channel where the event occurred
actionstringYesAction identifier describing what happened. Open string — use a short, descriptive name like post_created, reply, liked, endorsed, notification_received, etc.
refsRefItem[]YesEvidence references (min 1 item)
display_textstringRecommendedUser-facing summary shown in the Activity Timeline. Strongly recommended — if omitted, the server attempts to auto-generate one
action_labelstringRecommendedHuman-readable action label (e.g., "Replied to thread", "Found a match"). Displayed alongside the event
importancenumberRecommendedImportance score from 0.0 to 1.0. Events with importance >= 0.7 are marked as "important" in the timeline. See Importance Levels
payloadPayloadRecommendedExtension data. See below for required and optional fields
event_timeintegerNoEvent timestamp in milliseconds. Defaults to server time
event_descstringNoDeveloper-facing description (not shown to users)
idempotency_keystringNoCustom idempotency key for deduplication. See Idempotency

ChannelInfo

Describes the source channel where the event occurred.

FieldTypeRequiredDescription
kindstringYesResource type identifier (e.g., thread, post, comment, channel, document)
idstringRecommendedChannel object ID on the source platform (e.g., thread ID, channel ID)
urlstringRecommendedDirect URL to the channel or resource
platformstringNoAuto-populated from your OAuth app's Client ID. Do not set manually
metaobjectNoAdditional channel metadata (freeform JSON)

RefItem

Each ref is an evidence pointer to the source content that triggered the event.

FieldTypeRequiredDescription
object_typestringYesType of the referenced object (e.g., thread_reply, post, comment, message)
object_idstringYesUnique identifier of the referenced object on the source platform
typestringNoReference type. Defaults to "external_action"
platformstringNoInherits from channel.platform if not set
urlstringNoDirect URL to the referenced object
content_previewstringNoShort text preview of the referenced content
snapshotRefSnapshotNoContent snapshot for evidence preservation

RefSnapshot

A captured snapshot of the source content at the time of the event.

FieldTypeRequiredDescription
textstringYesOriginal text content of the evidence
captured_atintegerNoCapture timestamp in milliseconds
hashstringNoContent integrity hash (e.g., sha256:...)

Payload

The payload object carries extension data. The jumpUrl field is especially important — it provides the link users click to navigate back to the original content from the Activity Timeline.

FieldTypeRecommendedDescription
jumpUrlstringYesURL linking back to the source content. Displayed as a clickable link in the user's Activity Timeline
tagsstring[]NoCustom labels for categorization (e.g., ["ai", "discussion"])

You can include any additional fields relevant to your app (e.g., postId, commentId, authorName). These are stored as-is and available for future retrieval.

Request Examples

Example 1: Typical event with recommended fields

curl -X POST "https://api.mindverse.com/gate/lab/api/secondme/agent_memory/ingest" \
  -H "Authorization: Bearer lba_at_your_access_token" \
  -H "Content-Type: application/json" \
  -d '{
    "channel": {
      "kind": "thread",
      "id": "thread_12345",
      "url": "https://community.example.com/threads/12345"
    },
    "action": "reply",
    "action_label": "Replied to thread",
    "display_text": "Replied in AI Trends discussion: transformer architectures will continue to dominate",
    "importance": 0.7,
    "refs": [
      {
        "object_type": "thread_reply",
        "object_id": "reply_67890",
        "url": "https://community.example.com/threads/12345#reply-67890",
        "snapshot": {
          "text": "I think transformer architectures will continue to dominate NLP for the foreseeable future. The efficiency gains from sparse attention mechanisms are particularly promising.",
          "captured_at": 1711900800000
        }
      }
    ],
    "payload": {
      "jumpUrl": "https://community.example.com/threads/12345#reply-67890",
      "tags": ["ai", "discussion"]
    }
  }'

Example 2: Minimal event (required fields only)

curl -X POST "https://api.mindverse.com/gate/lab/api/secondme/agent_memory/ingest" \
  -H "Authorization: Bearer lba_at_your_access_token" \
  -H "Content-Type: application/json" \
  -d '{
    "channel": {
      "kind": "post"
    },
    "action": "post",
    "refs": [
      {
        "object_type": "post",
        "object_id": "post_abc123"
      }
    ]
  }'

Response

Success (200)

{
  "code": 0,
  "data": {
    "eventId": 12345,
    "isDuplicate": false
  }
}
FieldTypeDescription
eventIdnumberCreated event ID. Returns 0 if the event was a duplicate or invalid
isDuplicatebooleanWhether this event was detected as a duplicate

Idempotency

The system automatically deduplicates events. If you don't provide an idempotency_key, the server generates one using:

sha256("external:" + platform + ":" + objectType + ":" + objectId + ":" + userId)

When a duplicate is detected:

  • eventId returns 0
  • isDuplicate returns true
  • The original event is not modified

You can also provide your own idempotency_key to control deduplication behavior. This is useful when the same object_type + object_id combination might legitimately produce multiple events.

Error Codes

Error CodeHTTP StatusDescription
auth.token.invalid401Token is invalid or expired
oauth2.scope.insufficient403Missing required agent_memory scope
agent.memory.write.disabled403Agent memory write is disabled for this user
apikey.permission.denied403API Key lacks required permission
invalid.param400Invalid request parameter (e.g., missing required fields, empty refs)

Importance Levels

The importance field affects how the event is prioritized and displayed:

Score RangeBehaviorUsage
0.0 - 0.3Normal event, may be filtered out in summariesLow-value events (e.g., page views, passive browsing)
0.3 - 0.69Normal event, shown in the timelineRoutine actions (e.g., likes, bookmarks)
0.7 - 1.0Treated as "important", counted in daily important event stats, may be featured or highlightedNotable interactions (e.g., posts, replies, meaningful discoveries)

The threshold importance >= 0.7 is the key cutoff — events at or above this value are classified as important and included in the user's daily summary.

Best Practices

  • Always provide display_text and action_label. These are what users see in their Activity Timeline. If omitted, the server attempts auto-generation, which may not match your intended wording.
  • Set importance >= 0.7 for events you want highlighted as important. Use 0.0 - 0.69 for routine events.
  • Include payload.jumpUrl so users can navigate back to the original content from the timeline.
  • Provide snapshot.text whenever possible — this gives the avatar direct access to the original content for better recall.
  • Do not set channel.platform manually — it is auto-populated from your OAuth app registration.
  • Place custom labels in payload.tags (as a string array). There is no top-level tag field.
  • Handle isDuplicate: true responses gracefully — they are not errors, just confirmations that the event already exists.