Contact memory reference
Every Contact memory endpoint with parameters, request and response fields, required scope and a curl example.
Every Contact memory endpoint. Base URL https://api.pingx.ai; send Authorization: Bearer <API key>. Read endpoints need memory:read (or :write), write endpoints need memory:write; the bare memory scope grants both. See Authentication and conventions. Machine-readable: openapi.json.
15 endpoints
| Method | Path | Operation | Scope |
|---|---|---|---|
GET | /memory/v1/contacts | ListContactActivity | read |
POST | /memory/v1/contacts/{contactId}:erase | EraseSubject | write |
GET | /memory/v1/contacts/{contactId}/memory | GetContactMemory | read |
GET | /memory/v1/contacts/{contactId}/messages | ListRecentMessages | read |
POST | /memory/v1/contacts/{contactId}/personas/{agentId}/facts/{factId}:amend | AmendFact | write |
POST | /memory/v1/contacts/{contactId}/personas/{agentId}/facts/{factId}:forget | ForgetFact | write |
POST | /memory/v1/contacts/{contactId}/personas/{agentId}/facts/{factId}:renew | RenewFact | write |
GET | /memory/v1/contacts/{contactId}/personas/{agentId}/facts/{factId}/provenance | GetFactProvenance | read |
POST | /memory/v1/contacts/{contactId}/personas/{agentId}/memory:clear | ClearForPersona | write |
POST | /memory/v1/contacts/{contactId}/personas/{agentId}/memory:forgetAll | ForgetAllForPersona | write |
POST | /memory/v1/contacts/{contactId}/personas/{agentId}/suppressions:lift | LiftSuppression | write |
POST | /memory/v1/contacts/{contactId}/personas/{agentId}/todos/{todoId}:close | CloseTodo | write |
POST | /memory/v1/contacts/{contactId}/personas/{agentId}/todos/{todoId}:reopen | ReopenTodo | write |
GET | /memory/v1/test-contacts | ListTestContacts | read |
POST | /memory/v1/test-contacts | CreateTestContact | write |
#GET /memory/v1/contacts
ListContactActivity · needs memory:read (or write)
Lists the organization's contacts together with their latest interaction and memory counts (active facts and open todos across all personas). Use it to find which contacts the agents hold memory about. Paginated: pass the returned nextPageToken as pageToken to get the next page. Read-only.
Query parameters
| Name | Type | Description |
|---|---|---|
search | string | Case-insensitive substring matched against the contact's name or phone. Empty returns all contacts. |
includeTest | boolean | Include synthetic test contacts (source "test"). They are hidden unless this is true. |
pageSize | integer | Maximum rows per page. <= 0 means 50; maximum 200 (larger values are clamped). |
pageToken | string | Opaque token from a previous response's nextPageToken; empty for the first page. An invalid token is INVALID_ARGUMENT. |
Response ListContactActivityResponse
| Field | Type | Description |
|---|---|---|
contacts | ContactActivityRow[] | The page of contacts, most recently active first. |
contacts[].contactId | string | The contact's UUID. |
contacts[].name | string | Contact display name. |
contacts[].phone | string | Contact phone number as stored; empty for test contacts. |
contacts[].source | string | How the contact was created: "manual", "import", "inbound" or "test". |
contacts[].lastKind | string | Kind of the latest interaction: "call" or "whatsapp"; empty when the contact never interacted. |
contacts[].lastChannel | string | Channel of the latest interaction: "voice" or "whatsapp"; empty if none. |
contacts[].lastAgentId | string (int64) | Id of the AI agent (persona) involved in the latest interaction; 0 if none. |
contacts[].lastAgentName | string | Name of that AI agent. |
contacts[].lastAt | string | When the latest interaction happened (RFC 3339); empty if none. |
contacts[].factCount | integer | Number of active facts across all personas. |
contacts[].openTodoCount | integer | Number of open todos across all personas. |
nextPageToken | string | Token to pass as pageToken to fetch the next page; empty when this is the last page. |
curl "https://api.pingx.ai/memory/v1/contacts" \
-H "Authorization: Bearer $PINGX_API_KEY"#POST /memory/v1/contacts/{contactId}:erase
EraseSubject · needs memory:write
DESTRUCTIVE AND IRREVERSIBLE. Right-to-be-forgotten: erases every fact, todo, suppression and episode held about the contact across ALL personas of the organization, and records an erasure marker so older data is not re-learned. Requires confirm = true. Returns the number of rows erased in "affected". The contact record itself is not deleted.
Path parameters
| Name | Type | Description |
|---|---|---|
contactId | string | UUID of the contact to erase from all personas' memory (path parameter). |
Request body (JSON)
| Field | Type | Description |
|---|---|---|
confirm | boolean | Must be true, acknowledging that this cannot be undone. |
Response WriteResult
| Field | Type | Description |
|---|---|---|
affected | integer | Number of rows the operation changed. 0 means nothing matched (for example the fact was already forgotten, or does not exist for this contact/persona); for the bulk operations it is the count of facts forgotten or rows deleted. |
curl -X POST "https://api.pingx.ai/memory/v1/contacts/CONTACTID:erase" \
-H "Authorization: Bearer $PINGX_API_KEY" \
-H "Content-Type: application/json" \
-d '{"confirm":false}'#GET /memory/v1/contacts/{contactId}/memory
GetContactMemory · needs memory:read (or write)
Returns everything remembered about one contact for one persona: the contact header, every persona that has interacted with (or holds memory about) the contact, and for the selected persona its active facts, todos (open first, then recently closed), suppressions, counts, and whether a call is currently in progress. A contact that exists but has no persona relationship yet returns an empty (but valid) memory; an unknown contactId is NOT_FOUND. Read-only.
Path parameters
| Name | Type | Description |
|---|---|---|
contactId | string | UUID of the contact (path parameter). |
Query parameters
| Name | Type | Description |
|---|---|---|
agentId | string (int64) | Persona whose memory to return. 0 (default) means the persona of the contact's most recent interaction (else the first persona seen). An agent that does not exist in your organization is NOT_FOUND; an existing agent that never spoke to the contact returns empty memory. |
Response GetContactMemoryResponse
| Field | Type | Description |
|---|---|---|
contactId | string | The contact's UUID. |
name | string | Contact display name. |
phone | string | Contact phone number; empty for test contacts. |
source | string | How the contact was created: "manual", "import", "inbound" or "test". |
personas | Persona[] | Every persona that has interacted with the contact or holds memory about them. |
personas[].id | string (int64) | Numeric agent id (usable as agentId in other calls). |
personas[].name | string | Agent display name. |
agentId | string (int64) | The persona this response is scoped to (0 when the contact has no persona relationship yet; then the lists below are empty). |
facts | Fact[] | Active facts only. |
facts[].id | string (int64) | Numeric fact id (use it in factId parameters). |
facts[].category | string | Kind of knowledge: "preference" or "fact". |
facts[].factKey | string | Stable key of what the fact is about, e.g. "preferred_language". |
facts[].factValue | string | The remembered value. |
facts[].evidenceQuote | string | Verbatim quote from the conversation that supports the fact; may be empty. |
facts[].confidence | number | Model confidence from 0 to 1. |
facts[].verification | string | How trustworthy the fact is: "stated" (the contact said it), "inferred", "unverified" or "human" (entered or corrected through this API/the app). |
facts[].observedAt | string | When the fact was last observed (RFC 3339). |
facts[].expiresAt | string | When the fact expires (RFC 3339); empty when open-ended. |
facts[].status | string | Lifecycle: "active", "expired", "superseded" or "forgotten". |
facts[].pinned | boolean | True when the fact is pinned (protected from automatic overwrite). |
facts[].contradictions | integer | How many later observations contradicted this fact. |
facts[].originEpisodeId | string (int64) | Id of the episode the fact was learned in (see GetFactProvenance); 0 if unknown. |
facts[].dataClassification | string | Sensitivity: "general" or "sensitive". |
todos | Todo[] | Open todos first, then recently closed ones. |
todos[].id | string (int64) | Numeric todo id (use it in todoId parameters). |
todos[].title | string | What needs to be done, e.g. "Call back on Friday". |
todos[].status | string | "open", "done" or "cancelled". |
todos[].createdAt | string | When the todo was created (RFC 3339). |
todos[].dueAt | string | Due time (RFC 3339); empty when none. |
todos[].closedAt | string | When it was closed (RFC 3339); empty while open. |
todos[].closedBy | string | Who closed it: "human" or "agent"; empty while open. |
todos[].closingEvidence | string | Evidence recorded when it was closed. |
todos[].closingEpisodeId | string (int64) | Episode (call) in which it was closed; 0 if not closed by a call. |
todos[].reopenedAt | string | When it was last reopened (RFC 3339); empty if never. |
todos[].reopenedBy | string | Who reopened it: "human" or "agent"; empty if never. |
suppressions | Suppression[] | Do-not-learn rules for this contact and persona. |
suppressions[].factKey | string | The suppressed fact key. |
suppressions[].reason | string | Why it was suppressed (e.g. the reason given to ForgetFact). |
suppressions[].createdBy | string | Who created it: "human" or "agent". |
suppressions[].createdAt | string | When it was created (RFC 3339). |
factCount | integer | Number of active facts. |
openTodoCount | integer | Number of open todos. |
callInProgress | boolean | True when a call with this contact and persona is in progress right now (memory may change when it ends). |
curl "https://api.pingx.ai/memory/v1/contacts/CONTACTID/memory" \
-H "Authorization: Bearer $PINGX_API_KEY"#GET /memory/v1/contacts/{contactId}/messages
ListRecentMessages · needs memory:read (or write)
Returns a contact's most recent WhatsApp messages (both directions), newest first. It is not per persona. A contact with no WhatsApp thread returns an empty list. Read-only. Not paginated: pageSize bounds the number of most-recent messages returned.
Path parameters
| Name | Type | Description |
|---|---|---|
contactId | string | UUID of the contact (path parameter). |
Query parameters
| Name | Type | Description |
|---|---|---|
pageSize | integer | Maximum number of most-recent messages to return. <= 0 means 50; maximum 200. |
Response ListRecentMessagesResponse
| Field | Type | Description |
|---|---|---|
messages | WhatsAppMessage[] | Messages, newest first. |
messages[].direction | string | "in" (from the contact) or "out" (to the contact). |
messages[].body | string | Message text. |
messages[].sentAt | string | When it was sent (RFC 3339). |
curl "https://api.pingx.ai/memory/v1/contacts/CONTACTID/messages" \
-H "Authorization: Bearer $PINGX_API_KEY"#POST /memory/v1/contacts/{contactId}/personas/{agentId}/facts/{factId}:amend
AmendFact · needs memory:write
Overwrites a fact's value in place (a human correction), keeping its id and history (a human correction takes precedence over what the agent learned). Idempotent: amending to the same value twice has the same result. affected = 0 when it is not an active fact of this contact+persona.
Path parameters
| Name | Type | Description |
|---|---|---|
contactId | string | UUID of the contact (path parameter). |
agentId | string (int64) | Persona that holds the fact (path parameter); must be > 0. |
factId | string (int64) | Fact id (path parameter); must be > 0. |
Request body (JSON)
| Field | Type | Description |
|---|---|---|
factValue | string | The corrected value. Required. |
Response WriteResult
| Field | Type | Description |
|---|---|---|
affected | integer | Number of rows the operation changed. 0 means nothing matched (for example the fact was already forgotten, or does not exist for this contact/persona); for the bulk operations it is the count of facts forgotten or rows deleted. |
curl -X POST "https://api.pingx.ai/memory/v1/contacts/CONTACTID/personas/AGENTID/facts/FACTID:amend" \
-H "Authorization: Bearer $PINGX_API_KEY" \
-H "Content-Type: application/json" \
-d '{"factValue":"…"}'#POST /memory/v1/contacts/{contactId}/personas/{agentId}/facts/{factId}:forget
ForgetFact · needs memory:write
Soft-deletes one active fact (status becomes "forgotten", the row is kept for audit) AND records a suppression for its factKey so the agent does not learn it again. Reversible only by LiftSuppression (which lets the key be learned afresh; the forgotten value itself is not restored). NOT_FOUND / affected = 0 when it is not an active fact of this contact+persona. Idempotent in effect: forgetting an already-forgotten fact affects nothing.
Path parameters
| Name | Type | Description |
|---|---|---|
contactId | string | UUID of the contact (path parameter). |
agentId | string (int64) | Persona that holds the fact (path parameter); must be > 0. |
factId | string (int64) | Fact id (path parameter); must be > 0. |
Request body (JSON)
| Field | Type | Description |
|---|---|---|
reason | string | Optional reason, stored on the suppression for audit. |
Response WriteResult
| Field | Type | Description |
|---|---|---|
affected | integer | Number of rows the operation changed. 0 means nothing matched (for example the fact was already forgotten, or does not exist for this contact/persona); for the bulk operations it is the count of facts forgotten or rows deleted. |
curl -X POST "https://api.pingx.ai/memory/v1/contacts/CONTACTID/personas/AGENTID/facts/FACTID:forget" \
-H "Authorization: Bearer $PINGX_API_KEY" \
-H "Content-Type: application/json" \
-d '{"reason":"…"}'#POST /memory/v1/contacts/{contactId}/personas/{agentId}/facts/{factId}:renew
RenewFact · needs memory:write
Pushes a fact's expiry out to a new RFC 3339 time without touching its value. expiresAt is required (INVALID_ARGUMENT when missing or not RFC 3339). Idempotent. affected = 0 when the fact is not found.
Path parameters
| Name | Type | Description |
|---|---|---|
contactId | string | UUID of the contact (path parameter). |
agentId | string (int64) | Persona that holds the fact (path parameter); must be > 0. |
factId | string (int64) | Fact id (path parameter); must be > 0. |
Request body (JSON)
| Field | Type | Description |
|---|---|---|
expiresAt | string | New expiry as an RFC 3339 timestamp. Required. |
Response WriteResult
| Field | Type | Description |
|---|---|---|
affected | integer | Number of rows the operation changed. 0 means nothing matched (for example the fact was already forgotten, or does not exist for this contact/persona); for the bulk operations it is the count of facts forgotten or rows deleted. |
curl -X POST "https://api.pingx.ai/memory/v1/contacts/CONTACTID/personas/AGENTID/facts/FACTID:renew" \
-H "Authorization: Bearer $PINGX_API_KEY" \
-H "Content-Type: application/json" \
-d '{"expiresAt":"…"}'#GET /memory/v1/contacts/{contactId}/personas/{agentId}/facts/{factId}/provenance
GetFactProvenance · needs memory:read (or write)
Returns the provenance of one fact: the episode (call) it was learned in and the most recent fact that contradicted it, if any. NOT_FOUND when the fact does not belong to this contact and persona. Read-only.
Path parameters
| Name | Type | Description |
|---|---|---|
contactId | string | UUID of the contact (path parameter). |
agentId | string (int64) | Persona that holds the fact (path parameter); must be > 0. |
factId | string (int64) | Fact id from GetContactMemory (path parameter); must be > 0. |
Response GetFactProvenanceResponse
| Field | Type | Description |
|---|---|---|
origin | Episode | The episode the fact was learned in; unset when it has none. |
origin.id | string (int64) | Numeric episode id. |
origin.sourceKind | string | What the episode came from: "call" or "legacy". |
origin.sourceId | string | Identifier of the source record. |
origin.channel | string | Channel: e.g. "voice". |
origin.occurredAt | string | When the interaction happened (RFC 3339). |
origin.summary | string | Short summary of the interaction. |
origin.callId | string (int64) | The call id when sourceKind is "call"; 0 otherwise. Use the voice API to read the call itself. |
mostRecentContradiction | Fact | The most recent fact that contradicted this one; unset when none did. |
mostRecentContradiction.id | string (int64) | Numeric fact id (use it in factId parameters). |
mostRecentContradiction.category | string | Kind of knowledge: "preference" or "fact". |
mostRecentContradiction.factKey | string | Stable key of what the fact is about, e.g. "preferred_language". |
mostRecentContradiction.factValue | string | The remembered value. |
mostRecentContradiction.evidenceQuote | string | Verbatim quote from the conversation that supports the fact; may be empty. |
mostRecentContradiction.confidence | number | Model confidence from 0 to 1. |
mostRecentContradiction.verification | string | How trustworthy the fact is: "stated" (the contact said it), "inferred", "unverified" or "human" (entered or corrected through this API/the app). |
mostRecentContradiction.observedAt | string | When the fact was last observed (RFC 3339). |
mostRecentContradiction.expiresAt | string | When the fact expires (RFC 3339); empty when open-ended. |
mostRecentContradiction.status | string | Lifecycle: "active", "expired", "superseded" or "forgotten". |
mostRecentContradiction.pinned | boolean | True when the fact is pinned (protected from automatic overwrite). |
mostRecentContradiction.contradictions | integer | How many later observations contradicted this fact. |
mostRecentContradiction.originEpisodeId | string (int64) | Id of the episode the fact was learned in (see GetFactProvenance); 0 if unknown. |
mostRecentContradiction.dataClassification | string | Sensitivity: "general" or "sensitive". |
curl "https://api.pingx.ai/memory/v1/contacts/CONTACTID/personas/AGENTID/facts/FACTID/provenance" \
-H "Authorization: Bearer $PINGX_API_KEY"#POST /memory/v1/contacts/{contactId}/personas/{agentId}/memory:clear
ClearForPersona · needs memory:write
DESTRUCTIVE AND IRREVERSIBLE. HARD-deletes everything ONE persona holds about the contact: facts, todos/obligations, do-not-learn rules and call episodes. Other personas are untouched. Unlike EraseSubject it writes no erasure marker, so the persona simply starts learning afresh on the next interaction (a clean-slate reset, e.g. for testing). Requires confirm = true. Returns the number of rows deleted in "affected".
Path parameters
| Name | Type | Description |
|---|---|---|
contactId | string | UUID of the contact (path parameter). |
agentId | string (int64) | The persona whose memory of the contact is hard-deleted (path parameter); must be > 0. |
Request body (JSON)
| Field | Type | Description |
|---|---|---|
confirm | boolean | Must be true, acknowledging that this cannot be undone. |
Response WriteResult
| Field | Type | Description |
|---|---|---|
affected | integer | Number of rows the operation changed. 0 means nothing matched (for example the fact was already forgotten, or does not exist for this contact/persona); for the bulk operations it is the count of facts forgotten or rows deleted. |
curl -X POST "https://api.pingx.ai/memory/v1/contacts/CONTACTID/personas/AGENTID/memory:clear" \
-H "Authorization: Bearer $PINGX_API_KEY" \
-H "Content-Type: application/json" \
-d '{"confirm":false}'#POST /memory/v1/contacts/{contactId}/personas/{agentId}/memory:forgetAll
ForgetAllForPersona · needs memory:write
DESTRUCTIVE AND IRREVERSIBLE through this API. Soft-deletes EVERY active fact one persona holds about the contact (status "forgotten", rows kept for audit); there is no bulk undo. Requires confirm = true. Returns in "affected" how many facts were forgotten. Other personas' memory of the contact is untouched.
Path parameters
| Name | Type | Description |
|---|---|---|
contactId | string | UUID of the contact (path parameter). |
agentId | string (int64) | The persona whose facts about the contact are forgotten (path parameter); must be > 0. |
Request body (JSON)
| Field | Type | Description |
|---|---|---|
confirm | boolean | Must be true, acknowledging that this cannot be undone through the API. |
Response WriteResult
| Field | Type | Description |
|---|---|---|
affected | integer | Number of rows the operation changed. 0 means nothing matched (for example the fact was already forgotten, or does not exist for this contact/persona); for the bulk operations it is the count of facts forgotten or rows deleted. |
curl -X POST "https://api.pingx.ai/memory/v1/contacts/CONTACTID/personas/AGENTID/memory:forgetAll" \
-H "Authorization: Bearer $PINGX_API_KEY" \
-H "Content-Type: application/json" \
-d '{"confirm":false}'#POST /memory/v1/contacts/{contactId}/personas/{agentId}/suppressions:lift
LiftSuppression · needs memory:write
Lifts a do-not-learn suppression so the given factKey can be learned again (the opposite of what ForgetFact records). Idempotent.
Path parameters
| Name | Type | Description |
|---|---|---|
contactId | string | UUID of the contact (path parameter). |
agentId | string (int64) | Persona the suppression applies to (path parameter); must be > 0. |
Request body (JSON)
| Field | Type | Description |
|---|---|---|
factKey | string | The suppressed fact key to release (see Suppression.factKey). Required. |
Response WriteResult
| Field | Type | Description |
|---|---|---|
affected | integer | Number of rows the operation changed. 0 means nothing matched (for example the fact was already forgotten, or does not exist for this contact/persona); for the bulk operations it is the count of facts forgotten or rows deleted. |
curl -X POST "https://api.pingx.ai/memory/v1/contacts/CONTACTID/personas/AGENTID/suppressions:lift" \
-H "Authorization: Bearer $PINGX_API_KEY" \
-H "Content-Type: application/json" \
-d '{"factKey":"…"}'#POST /memory/v1/contacts/{contactId}/personas/{agentId}/todos/{todoId}:close
CloseTodo · needs memory:write
Marks an open todo as done (closed by a human), recording the evidence (required). Idempotent: closing an already-closed todo affects nothing.
Path parameters
| Name | Type | Description |
|---|---|---|
contactId | string | UUID of the contact (path parameter). |
agentId | string (int64) | Persona that holds the todo (path parameter); must be > 0. |
todoId | string (int64) | Todo id (path parameter); must be > 0. |
Request body (JSON)
| Field | Type | Description |
|---|---|---|
evidence | string | Free-text evidence/reason recorded as the closing evidence. Required (non-empty). |
Response WriteResult
| Field | Type | Description |
|---|---|---|
affected | integer | Number of rows the operation changed. 0 means nothing matched (for example the fact was already forgotten, or does not exist for this contact/persona); for the bulk operations it is the count of facts forgotten or rows deleted. |
curl -X POST "https://api.pingx.ai/memory/v1/contacts/CONTACTID/personas/AGENTID/todos/TODOID:close" \
-H "Authorization: Bearer $PINGX_API_KEY" \
-H "Content-Type: application/json" \
-d '{"evidence":"…"}'#POST /memory/v1/contacts/{contactId}/personas/{agentId}/todos/{todoId}:reopen
ReopenTodo · needs memory:write
Reopens a closed todo (the inverse of CloseTodo). Idempotent.
Path parameters
| Name | Type | Description |
|---|---|---|
contactId | string | UUID of the contact (path parameter). |
agentId | string (int64) | Persona that holds the todo (path parameter); must be > 0. |
todoId | string (int64) | Todo id (path parameter); must be > 0. |
Response WriteResult
| Field | Type | Description |
|---|---|---|
affected | integer | Number of rows the operation changed. 0 means nothing matched (for example the fact was already forgotten, or does not exist for this contact/persona); for the bulk operations it is the count of facts forgotten or rows deleted. |
curl -X POST "https://api.pingx.ai/memory/v1/contacts/CONTACTID/personas/AGENTID/todos/TODOID:reopen" \
-H "Authorization: Bearer $PINGX_API_KEY"#GET /memory/v1/test-contacts
ListTestContacts · needs memory:read (or write)
Lists the organization's test contacts: synthetic contacts (source "test") used to try the agents' memory without touching real customers. Read-only.
Response ListTestContactsResponse
| Field | Type | Description |
|---|---|---|
contacts | TestContact[] | |
contacts[].contactId | string | The contact's UUID. |
contacts[].name | string | Display name. |
contacts[].createdAt | string | When it was created (RFC 3339). |
curl "https://api.pingx.ai/memory/v1/test-contacts" \
-H "Authorization: Bearer $PINGX_API_KEY"#POST /memory/v1/test-contacts
CreateTestContact · needs memory:write
Creates a synthetic test contact (no phone number, hidden from the regular contact list unless includeTest is set). NOT idempotent: every call creates a new contact, even with the same name.
Request body (JSON)
| Field | Type | Description |
|---|---|---|
name | string | Display name for the test contact. Required, at most 120 characters. |
Response CreateTestContactResponse
| Field | Type | Description |
|---|---|---|
contact | TestContact | The created test contact. |
contact.contactId | string | The contact's UUID. |
contact.name | string | Display name. |
contact.createdAt | string | When it was created (RFC 3339). |
curl -X POST "https://api.pingx.ai/memory/v1/test-contacts" \
-H "Authorization: Bearer $PINGX_API_KEY" \
-H "Content-Type: application/json" \
-d '{"name":"…"}'