pingx.aiAPI docs Markdown

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

MethodPathOperationScope
GET/memory/v1/contactsListContactActivityread
POST/memory/v1/contacts/{contactId}:eraseEraseSubjectwrite
GET/memory/v1/contacts/{contactId}/memoryGetContactMemoryread
GET/memory/v1/contacts/{contactId}/messagesListRecentMessagesread
POST/memory/v1/contacts/{contactId}/personas/{agentId}/facts/{factId}:amendAmendFactwrite
POST/memory/v1/contacts/{contactId}/personas/{agentId}/facts/{factId}:forgetForgetFactwrite
POST/memory/v1/contacts/{contactId}/personas/{agentId}/facts/{factId}:renewRenewFactwrite
GET/memory/v1/contacts/{contactId}/personas/{agentId}/facts/{factId}/provenanceGetFactProvenanceread
POST/memory/v1/contacts/{contactId}/personas/{agentId}/memory:clearClearForPersonawrite
POST/memory/v1/contacts/{contactId}/personas/{agentId}/memory:forgetAllForgetAllForPersonawrite
POST/memory/v1/contacts/{contactId}/personas/{agentId}/suppressions:liftLiftSuppressionwrite
POST/memory/v1/contacts/{contactId}/personas/{agentId}/todos/{todoId}:closeCloseTodowrite
POST/memory/v1/contacts/{contactId}/personas/{agentId}/todos/{todoId}:reopenReopenTodowrite
GET/memory/v1/test-contactsListTestContactsread
POST/memory/v1/test-contactsCreateTestContactwrite

#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

NameTypeDescription
searchstringCase-insensitive substring matched against the contact's name or phone. Empty returns all contacts.
includeTestbooleanInclude synthetic test contacts (source "test"). They are hidden unless this is true.
pageSizeintegerMaximum rows per page. <= 0 means 50; maximum 200 (larger values are clamped).
pageTokenstringOpaque token from a previous response's nextPageToken; empty for the first page. An invalid token is INVALID_ARGUMENT.

Response ListContactActivityResponse

FieldTypeDescription
contactsContactActivityRow[]The page of contacts, most recently active first.
contacts[].contactIdstringThe contact's UUID.
contacts[].namestringContact display name.
contacts[].phonestringContact phone number as stored; empty for test contacts.
contacts[].sourcestringHow the contact was created: "manual", "import", "inbound" or "test".
contacts[].lastKindstringKind of the latest interaction: "call" or "whatsapp"; empty when the contact never interacted.
contacts[].lastChannelstringChannel of the latest interaction: "voice" or "whatsapp"; empty if none.
contacts[].lastAgentIdstring (int64)Id of the AI agent (persona) involved in the latest interaction; 0 if none.
contacts[].lastAgentNamestringName of that AI agent.
contacts[].lastAtstringWhen the latest interaction happened (RFC 3339); empty if none.
contacts[].factCountintegerNumber of active facts across all personas.
contacts[].openTodoCountintegerNumber of open todos across all personas.
nextPageTokenstringToken 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

NameTypeDescription
contactIdstringUUID of the contact to erase from all personas' memory (path parameter).

Request body (JSON)

FieldTypeDescription
confirmbooleanMust be true, acknowledging that this cannot be undone.

Response WriteResult

FieldTypeDescription
affectedintegerNumber 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

NameTypeDescription
contactIdstringUUID of the contact (path parameter).

Query parameters

NameTypeDescription
agentIdstring (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

FieldTypeDescription
contactIdstringThe contact's UUID.
namestringContact display name.
phonestringContact phone number; empty for test contacts.
sourcestringHow the contact was created: "manual", "import", "inbound" or "test".
personasPersona[]Every persona that has interacted with the contact or holds memory about them.
personas[].idstring (int64)Numeric agent id (usable as agentId in other calls).
personas[].namestringAgent display name.
agentIdstring (int64)The persona this response is scoped to (0 when the contact has no persona relationship yet; then the lists below are empty).
factsFact[]Active facts only.
facts[].idstring (int64)Numeric fact id (use it in factId parameters).
facts[].categorystringKind of knowledge: "preference" or "fact".
facts[].factKeystringStable key of what the fact is about, e.g. "preferred_language".
facts[].factValuestringThe remembered value.
facts[].evidenceQuotestringVerbatim quote from the conversation that supports the fact; may be empty.
facts[].confidencenumberModel confidence from 0 to 1.
facts[].verificationstringHow trustworthy the fact is: "stated" (the contact said it), "inferred", "unverified" or "human" (entered or corrected through this API/the app).
facts[].observedAtstringWhen the fact was last observed (RFC 3339).
facts[].expiresAtstringWhen the fact expires (RFC 3339); empty when open-ended.
facts[].statusstringLifecycle: "active", "expired", "superseded" or "forgotten".
facts[].pinnedbooleanTrue when the fact is pinned (protected from automatic overwrite).
facts[].contradictionsintegerHow many later observations contradicted this fact.
facts[].originEpisodeIdstring (int64)Id of the episode the fact was learned in (see GetFactProvenance); 0 if unknown.
facts[].dataClassificationstringSensitivity: "general" or "sensitive".
todosTodo[]Open todos first, then recently closed ones.
todos[].idstring (int64)Numeric todo id (use it in todoId parameters).
todos[].titlestringWhat needs to be done, e.g. "Call back on Friday".
todos[].statusstring"open", "done" or "cancelled".
todos[].createdAtstringWhen the todo was created (RFC 3339).
todos[].dueAtstringDue time (RFC 3339); empty when none.
todos[].closedAtstringWhen it was closed (RFC 3339); empty while open.
todos[].closedBystringWho closed it: "human" or "agent"; empty while open.
todos[].closingEvidencestringEvidence recorded when it was closed.
todos[].closingEpisodeIdstring (int64)Episode (call) in which it was closed; 0 if not closed by a call.
todos[].reopenedAtstringWhen it was last reopened (RFC 3339); empty if never.
todos[].reopenedBystringWho reopened it: "human" or "agent"; empty if never.
suppressionsSuppression[]Do-not-learn rules for this contact and persona.
suppressions[].factKeystringThe suppressed fact key.
suppressions[].reasonstringWhy it was suppressed (e.g. the reason given to ForgetFact).
suppressions[].createdBystringWho created it: "human" or "agent".
suppressions[].createdAtstringWhen it was created (RFC 3339).
factCountintegerNumber of active facts.
openTodoCountintegerNumber of open todos.
callInProgressbooleanTrue 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

NameTypeDescription
contactIdstringUUID of the contact (path parameter).

Query parameters

NameTypeDescription
pageSizeintegerMaximum number of most-recent messages to return. <= 0 means 50; maximum 200.

Response ListRecentMessagesResponse

FieldTypeDescription
messagesWhatsAppMessage[]Messages, newest first.
messages[].directionstring"in" (from the contact) or "out" (to the contact).
messages[].bodystringMessage text.
messages[].sentAtstringWhen 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

NameTypeDescription
contactIdstringUUID of the contact (path parameter).
agentIdstring (int64)Persona that holds the fact (path parameter); must be > 0.
factIdstring (int64)Fact id (path parameter); must be > 0.

Request body (JSON)

FieldTypeDescription
factValuestringThe corrected value. Required.

Response WriteResult

FieldTypeDescription
affectedintegerNumber 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

NameTypeDescription
contactIdstringUUID of the contact (path parameter).
agentIdstring (int64)Persona that holds the fact (path parameter); must be > 0.
factIdstring (int64)Fact id (path parameter); must be > 0.

Request body (JSON)

FieldTypeDescription
reasonstringOptional reason, stored on the suppression for audit.

Response WriteResult

FieldTypeDescription
affectedintegerNumber 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

NameTypeDescription
contactIdstringUUID of the contact (path parameter).
agentIdstring (int64)Persona that holds the fact (path parameter); must be > 0.
factIdstring (int64)Fact id (path parameter); must be > 0.

Request body (JSON)

FieldTypeDescription
expiresAtstringNew expiry as an RFC 3339 timestamp. Required.

Response WriteResult

FieldTypeDescription
affectedintegerNumber 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

NameTypeDescription
contactIdstringUUID of the contact (path parameter).
agentIdstring (int64)Persona that holds the fact (path parameter); must be > 0.
factIdstring (int64)Fact id from GetContactMemory (path parameter); must be > 0.

Response GetFactProvenanceResponse

FieldTypeDescription
originEpisodeThe episode the fact was learned in; unset when it has none.
origin.idstring (int64)Numeric episode id.
origin.sourceKindstringWhat the episode came from: "call" or "legacy".
origin.sourceIdstringIdentifier of the source record.
origin.channelstringChannel: e.g. "voice".
origin.occurredAtstringWhen the interaction happened (RFC 3339).
origin.summarystringShort summary of the interaction.
origin.callIdstring (int64)The call id when sourceKind is "call"; 0 otherwise. Use the voice API to read the call itself.
mostRecentContradictionFactThe most recent fact that contradicted this one; unset when none did.
mostRecentContradiction.idstring (int64)Numeric fact id (use it in factId parameters).
mostRecentContradiction.categorystringKind of knowledge: "preference" or "fact".
mostRecentContradiction.factKeystringStable key of what the fact is about, e.g. "preferred_language".
mostRecentContradiction.factValuestringThe remembered value.
mostRecentContradiction.evidenceQuotestringVerbatim quote from the conversation that supports the fact; may be empty.
mostRecentContradiction.confidencenumberModel confidence from 0 to 1.
mostRecentContradiction.verificationstringHow trustworthy the fact is: "stated" (the contact said it), "inferred", "unverified" or "human" (entered or corrected through this API/the app).
mostRecentContradiction.observedAtstringWhen the fact was last observed (RFC 3339).
mostRecentContradiction.expiresAtstringWhen the fact expires (RFC 3339); empty when open-ended.
mostRecentContradiction.statusstringLifecycle: "active", "expired", "superseded" or "forgotten".
mostRecentContradiction.pinnedbooleanTrue when the fact is pinned (protected from automatic overwrite).
mostRecentContradiction.contradictionsintegerHow many later observations contradicted this fact.
mostRecentContradiction.originEpisodeIdstring (int64)Id of the episode the fact was learned in (see GetFactProvenance); 0 if unknown.
mostRecentContradiction.dataClassificationstringSensitivity: "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

NameTypeDescription
contactIdstringUUID of the contact (path parameter).
agentIdstring (int64)The persona whose memory of the contact is hard-deleted (path parameter); must be > 0.

Request body (JSON)

FieldTypeDescription
confirmbooleanMust be true, acknowledging that this cannot be undone.

Response WriteResult

FieldTypeDescription
affectedintegerNumber 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

NameTypeDescription
contactIdstringUUID of the contact (path parameter).
agentIdstring (int64)The persona whose facts about the contact are forgotten (path parameter); must be > 0.

Request body (JSON)

FieldTypeDescription
confirmbooleanMust be true, acknowledging that this cannot be undone through the API.

Response WriteResult

FieldTypeDescription
affectedintegerNumber 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

NameTypeDescription
contactIdstringUUID of the contact (path parameter).
agentIdstring (int64)Persona the suppression applies to (path parameter); must be > 0.

Request body (JSON)

FieldTypeDescription
factKeystringThe suppressed fact key to release (see Suppression.factKey). Required.

Response WriteResult

FieldTypeDescription
affectedintegerNumber 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

NameTypeDescription
contactIdstringUUID of the contact (path parameter).
agentIdstring (int64)Persona that holds the todo (path parameter); must be > 0.
todoIdstring (int64)Todo id (path parameter); must be > 0.

Request body (JSON)

FieldTypeDescription
evidencestringFree-text evidence/reason recorded as the closing evidence. Required (non-empty).

Response WriteResult

FieldTypeDescription
affectedintegerNumber 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

NameTypeDescription
contactIdstringUUID of the contact (path parameter).
agentIdstring (int64)Persona that holds the todo (path parameter); must be > 0.
todoIdstring (int64)Todo id (path parameter); must be > 0.

Response WriteResult

FieldTypeDescription
affectedintegerNumber 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

FieldTypeDescription
contactsTestContact[]
contacts[].contactIdstringThe contact's UUID.
contacts[].namestringDisplay name.
contacts[].createdAtstringWhen 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)

FieldTypeDescription
namestringDisplay name for the test contact. Required, at most 120 characters.

Response CreateTestContactResponse

FieldTypeDescription
contactTestContactThe created test contact.
contact.contactIdstringThe contact's UUID.
contact.namestringDisplay name.
contact.createdAtstringWhen 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":"…"}'