Skip to main content
Probe the memory store for a near-identical entry without committing anything. This is useful when you want to decide whether to store a memory before calling POST /memories — for example, to show a preview in your UI, implement custom deduplication logic, or log duplicate rates for monitoring. The remember() method already runs this check internally; call this endpoint only when you need the result without the write.

Request

Headers

NameRequiredDescription
X-API-KeyYesYour MemLayer API key (ml_live_xxx)

Query Parameters

content
string
required
The candidate memory text to check. MemLayer embeds this text and compares it to existing memories for the given user-agent pair. Max 10,000 characters.
user_id
string
required
Check against memories belonging to this user.
agent_id
string
required
Check against memories associated with this agent.
threshold
float
default:"0.95"
Cosine similarity threshold above which a memory is considered a duplicate. Range: 0.0–1.0. The default 0.95 matches the threshold used internally by POST /memories. Lower this to detect looser paraphrases; raise it to only flag near-identical text.
curl -X POST \
  "https://memlayer.online/memories/duplicate-check?\
content=User+prefers+bullet+points&\
user_id=user_123&\
agent_id=support_bot&\
threshold=0.95" \
  -H "X-API-Key: ml_live_xxx"

Response

Success — 200

is_duplicate
boolean
true if an existing memory scored at or above the threshold for the given content. false if no sufficiently similar memory was found — the content is safe to store.
Duplicate found:
{
  "is_duplicate": true
}
No duplicate:
{
  "is_duplicate": false
}

Errors

CodeMeaning
401Invalid or missing X-API-Key
403Account suspended
422Validation error — check parameter types and constraints

Notes

You do not need to call duplicate-check before every POST /memories. The store endpoint runs the same check automatically at the default threshold of 0.95 and returns a 409 if a duplicate is found. Use this endpoint when you specifically want to:
  • Check without committing (e.g. preview in a UI before storing)
  • Use a different threshold than the default 0.95
  • Track duplicate rates in your own analytics
  • Gate a different code path based on whether the memory is new
There is a small window between a duplicate-check returning false and your subsequent POST /memories call where another process could store the same memory. If you call both endpoints, handle a 409 from the store endpoint gracefully — it means a duplicate appeared in the interim. If strong deduplication guarantees matter, rely solely on the 409 from POST /memories rather than pre-checking.
  • 0.95 (default) — catches near-verbatim duplicates. Paraphrases with different wording pass through.
  • 0.85 — catches semantic paraphrases. "User is in Lagos" and "User lives in Lagos, Nigeria" are likely flagged as duplicates.
  • 0.70 — loose. Catches topically similar content even when phrased very differently. Use with care — may suppress genuinely distinct memories.