pingx.aiAPI docs Markdown

Agents reference

Every Agents endpoint with parameters, request and response fields, required scope and a curl example.

Every Agents endpoint. Base URL https://api.pingx.ai; send Authorization: Bearer <API key>. Read endpoints need agents:read (or :write), write endpoints need agents:write; the bare agents scope grants both. See Authentication and conventions. Machine-readable: openapi.json.

26 endpoints

MethodPathOperationScope
GET/agents/v1/agentsListAgentsread
POST/agents/v1/agentsCreateAgentwrite
DELETE/agents/v1/agents/{agentId}DeleteAgentwrite
GET/agents/v1/agents/{agentId}GetAgentread
PATCH/agents/v1/agents/{agentId}UpdateAgentwrite
GET/agents/v1/agents/{agentId}/web-chatGetWebChatLinkread
POST/agents/v1/agents/{agentId}/web-chat:disableDisableWebChatwrite
POST/agents/v1/agents/{agentId}/web-chat:enableEnableWebChatwrite
POST/agents/v1/chat/conversationsStartChatConversationwrite
POST/agents/v1/chat/conversations/{conversationId}/messagesSendChatMessagewrite
GET/agents/v1/custom-fieldsListCustomFieldsread
POST/agents/v1/custom-fieldsCreateCustomFieldwrite
DELETE/agents/v1/custom-fields/{customFieldId}DeleteCustomFieldwrite
PATCH/agents/v1/custom-fields/{customFieldId}UpdateCustomFieldwrite
GET/agents/v1/knowledge-basesListKnowledgeBasesread
POST/agents/v1/knowledge-basesCreateKnowledgeBasewrite
DELETE/agents/v1/knowledge-bases/{knowledgeBaseId}DeleteKnowledgeBasewrite
GET/agents/v1/knowledge-bases/{knowledgeBaseId}GetKnowledgeBaseread
PATCH/agents/v1/knowledge-bases/{knowledgeBaseId}UpdateKnowledgeBasewrite
GET/agents/v1/knowledge-bases/{knowledgeBaseId}/sourcesListKnowledgeSourcesread
POST/agents/v1/knowledge-bases/{knowledgeBaseId}/sourcesAddKnowledgeSourcewrite
DELETE/agents/v1/knowledge-sources/{sourceId}DeleteKnowledgeSourcewrite
GET/agents/v1/knowledge-sources/{sourceId}GetKnowledgeSourceread
PATCH/agents/v1/knowledge-sources/{sourceId}UpdateKnowledgeSourcewrite
POST/agents/v1/knowledge-sources/{sourceId}:recrawlRecrawlKnowledgeSourcewrite
POST/agents/v1/system-prompts:generateGenerateSystemPromptwrite

#GET /agents/v1/agents

ListAgents · needs agents:read (or write)

Lists the organization's agents (personas), ordered by id.

Query parameters

NameTypeDescription
pageSizeintegerMaximum agents to return (default 50, max 200).
pageTokenstringnextPageToken from the previous response; empty for the first page.

Response ListAgentsResponse

FieldTypeDescription
agentsAgent[]
agents[].idstring (int64)Agent id, unique within the platform.
agents[].namestringDisplay name.
agents[].systemPromptstringIdentity and context of the agent (who it is, what it represents), shared by chat and calls. Hard compliance rules and retrieved knowledge are added by the platform on top of this and are not part of it.
agents[].knowledgeBaseIdsstring (int64)[]Ids of the knowledge bases attached to this agent, in prompt order.
agents[].chatInstructionsstringBehaviour playbook for the text-chat channel (appended after systemPrompt).
agents[].callInstructionsstringBehaviour playbook for voice calls (appended after systemPrompt). Ignored for calls when script is set.
agents[].scriptstringThe organization's own call script (plain text, up to 20,000 characters), used instead of callInstructions on voice calls. Empty when unset.
agents[].fillerWordsEnabledbooleanVoice calls only: speak with human-like filler words and self-corrections.
agents[].voiceGenderstringVoice for calls: "male" or "female".
agents[].supportEscalationEnabledbooleanWhatsApp only: gives the agent support-escalation tools. Requires JIRA and Google Chat to be connected in the app.
agents[].backgroundAudioEnabledbooleanVoice calls only: play a looped room-ambience bed under the agent's speech.
agents[].backgroundAudioVolumestring (int64)Level of that bed as an integer percent, 0-100.
nextPageTokenstringPass as pageToken to get the next page; empty on the last page.
curl "https://api.pingx.ai/agents/v1/agents" \
  -H "Authorization: Bearer $PINGX_API_KEY"

#POST /agents/v1/agents

CreateAgent · needs agents:write

Creates an agent. Only name, systemPrompt and knowledgeBaseIds can be set at creation; the other settings start at their defaults (generic chat and call playbooks, female voice, filler words and background audio off) and are changed afterwards with UpdateAgent. Not idempotent: each call creates a new agent. INVALID_ARGUMENT if name is empty or a knowledge base id is not in the organization.

Request body (JSON)

FieldTypeDescription
namestringDisplay name (required, non-empty after trimming).
systemPromptstringIdentity and context of the agent; may be empty and set later.
knowledgeBaseIdsstring (int64)[]Knowledge bases to attach, in prompt order; each must exist in the organization.

Response CreateAgentResponse

FieldTypeDescription
agentAgentThe created agent, with defaults filled in.
agent.idstring (int64)Agent id, unique within the platform.
agent.namestringDisplay name.
agent.systemPromptstringIdentity and context of the agent (who it is, what it represents), shared by chat and calls. Hard compliance rules and retrieved knowledge are added by the platform on top of this and are not part of it.
agent.knowledgeBaseIdsstring (int64)[]Ids of the knowledge bases attached to this agent, in prompt order.
agent.chatInstructionsstringBehaviour playbook for the text-chat channel (appended after systemPrompt).
agent.callInstructionsstringBehaviour playbook for voice calls (appended after systemPrompt). Ignored for calls when script is set.
agent.scriptstringThe organization's own call script (plain text, up to 20,000 characters), used instead of callInstructions on voice calls. Empty when unset.
agent.fillerWordsEnabledbooleanVoice calls only: speak with human-like filler words and self-corrections.
agent.voiceGenderstringVoice for calls: "male" or "female".
agent.supportEscalationEnabledbooleanWhatsApp only: gives the agent support-escalation tools. Requires JIRA and Google Chat to be connected in the app.
agent.backgroundAudioEnabledbooleanVoice calls only: play a looped room-ambience bed under the agent's speech.
agent.backgroundAudioVolumestring (int64)Level of that bed as an integer percent, 0-100.
curl -X POST "https://api.pingx.ai/agents/v1/agents" \
  -H "Authorization: Bearer $PINGX_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"name":"…","systemPrompt":"…","knowledgeBaseIds":[]}'

#DELETE /agents/v1/agents/{agentId}

DeleteAgent · needs agents:write

Permanently deletes an agent (any agent, including the organization's last one). Its web-chat link stops working. Not reversible. NOT_FOUND if the agent does not exist (so a repeated delete returns NOT_FOUND).

Path parameters

NameTypeDescription
agentIdstring (int64)Id of the agent to delete.

Response DeleteAgentResponse

curl -X DELETE "https://api.pingx.ai/agents/v1/agents/AGENTID" \
  -H "Authorization: Bearer $PINGX_API_KEY"

#GET /agents/v1/agents/{agentId}

GetAgent · needs agents:read (or write)

Returns one agent with its full configuration. NOT_FOUND if the agent does not exist in the organization.

Path parameters

NameTypeDescription
agentIdstring (int64)Id of the agent to read.

Response GetAgentResponse

FieldTypeDescription
agentAgentAgent is one saved persona.
agent.idstring (int64)Agent id, unique within the platform.
agent.namestringDisplay name.
agent.systemPromptstringIdentity and context of the agent (who it is, what it represents), shared by chat and calls. Hard compliance rules and retrieved knowledge are added by the platform on top of this and are not part of it.
agent.knowledgeBaseIdsstring (int64)[]Ids of the knowledge bases attached to this agent, in prompt order.
agent.chatInstructionsstringBehaviour playbook for the text-chat channel (appended after systemPrompt).
agent.callInstructionsstringBehaviour playbook for voice calls (appended after systemPrompt). Ignored for calls when script is set.
agent.scriptstringThe organization's own call script (plain text, up to 20,000 characters), used instead of callInstructions on voice calls. Empty when unset.
agent.fillerWordsEnabledbooleanVoice calls only: speak with human-like filler words and self-corrections.
agent.voiceGenderstringVoice for calls: "male" or "female".
agent.supportEscalationEnabledbooleanWhatsApp only: gives the agent support-escalation tools. Requires JIRA and Google Chat to be connected in the app.
agent.backgroundAudioEnabledbooleanVoice calls only: play a looped room-ambience bed under the agent's speech.
agent.backgroundAudioVolumestring (int64)Level of that bed as an integer percent, 0-100.
curl "https://api.pingx.ai/agents/v1/agents/AGENTID" \
  -H "Authorization: Bearer $PINGX_API_KEY"

#PATCH /agents/v1/agents/{agentId}

UpdateAgent · needs agents:write

Partially updates an agent: only the fields present in the request change; omitted fields keep their stored value. Idempotent. The script, when changed, is normalized by an AI pass before saving (can take up to a few minutes) and the processed text is what is stored. ABORTED if the script was changed by another save while this one was being processed (re-read and retry). FAILED_PRECONDITION when enabling supportEscalationEnabled without JIRA and Google Chat connected in the app. NOT_FOUND for an unknown agent.

Path parameters

NameTypeDescription
agentIdstring (int64)Id of the agent to update.

Request body (JSON)

FieldTypeDescription
namestringNew display name; must be non-empty when provided.
systemPromptstringNew system prompt.
chatInstructionsstringNew chat playbook.
callInstructionsstringNew call playbook.
scriptstringNew call script, up to 20,000 characters (an empty string clears it). Processed by an AI normalization pass before saving.
fillerWordsEnabledbooleanToggle filler words on voice calls.
voiceGenderstring"male" or "female"; any other value is stored as "female".
supportEscalationEnabledbooleanToggle support escalation (see Agent.supportEscalationEnabled).
backgroundAudioEnabledbooleanToggle the call background-audio bed.
backgroundAudioVolumestring (int64)Background-audio level percent, 0-100 (INVALID_ARGUMENT above 100).
knowledgeBaseIdsKnowledgeBaseIdsWhen provided, REPLACES the attached knowledge bases with this ordered list (an empty list detaches all). Omit to keep the current attachments.
knowledgeBaseIds.idsstring (int64)[]

Response UpdateAgentResponse

FieldTypeDescription
agentAgentThe agent after the update.
agent.idstring (int64)Agent id, unique within the platform.
agent.namestringDisplay name.
agent.systemPromptstringIdentity and context of the agent (who it is, what it represents), shared by chat and calls. Hard compliance rules and retrieved knowledge are added by the platform on top of this and are not part of it.
agent.knowledgeBaseIdsstring (int64)[]Ids of the knowledge bases attached to this agent, in prompt order.
agent.chatInstructionsstringBehaviour playbook for the text-chat channel (appended after systemPrompt).
agent.callInstructionsstringBehaviour playbook for voice calls (appended after systemPrompt). Ignored for calls when script is set.
agent.scriptstringThe organization's own call script (plain text, up to 20,000 characters), used instead of callInstructions on voice calls. Empty when unset.
agent.fillerWordsEnabledbooleanVoice calls only: speak with human-like filler words and self-corrections.
agent.voiceGenderstringVoice for calls: "male" or "female".
agent.supportEscalationEnabledbooleanWhatsApp only: gives the agent support-escalation tools. Requires JIRA and Google Chat to be connected in the app.
agent.backgroundAudioEnabledbooleanVoice calls only: play a looped room-ambience bed under the agent's speech.
agent.backgroundAudioVolumestring (int64)Level of that bed as an integer percent, 0-100.
curl -X PATCH "https://api.pingx.ai/agents/v1/agents/AGENTID" \
  -H "Authorization: Bearer $PINGX_API_KEY" \
  -H "Content-Type: application/json" \
  -d @body.json

#GET /agents/v1/agents/{agentId}/web-chat

GetWebChatLink · needs agents:read (or write)

Returns whether the agent's web-chat link is enabled and its token. The token is a bearer capability to chat with the agent publicly: treat it as sensitive. NOT_FOUND for an unknown agent.

Path parameters

NameTypeDescription
agentIdstring (int64)Id of the agent.

Response GetWebChatLinkResponse

FieldTypeDescription
linkWebChatLinkWebChatLink is the web-chat share-link state of one agent.
link.agentIdstring (int64)The agent the link belongs to.
link.enabledbooleanWhether the public chat page is currently enabled.
link.tokenstringOpaque link token addressing the public chat page; empty when disabled.
curl "https://api.pingx.ai/agents/v1/agents/AGENTID/web-chat" \
  -H "Authorization: Bearer $PINGX_API_KEY"

#POST /agents/v1/agents/{agentId}/web-chat:disable

DisableWebChat · needs agents:write

Revokes the agent's web-chat link immediately; the old token never works again (re-enabling mints a new one). Idempotent: succeeds when no link is active. NOT_FOUND for an unknown agent.

Path parameters

NameTypeDescription
agentIdstring (int64)Id of the agent.

Response DisableWebChatResponse

curl -X POST "https://api.pingx.ai/agents/v1/agents/AGENTID/web-chat:disable" \
  -H "Authorization: Bearer $PINGX_API_KEY"

#POST /agents/v1/agents/{agentId}/web-chat:enable

EnableWebChat · needs agents:write

Enables the agent's public web-chat page and returns its link token. Idempotent: while a link is active the same token is returned; a new token is minted only after DisableWebChat. NOT_FOUND for an unknown agent.

Path parameters

NameTypeDescription
agentIdstring (int64)Id of the agent.

Response EnableWebChatResponse

FieldTypeDescription
linkWebChatLinkWebChatLink is the web-chat share-link state of one agent.
link.agentIdstring (int64)The agent the link belongs to.
link.enabledbooleanWhether the public chat page is currently enabled.
link.tokenstringOpaque link token addressing the public chat page; empty when disabled.
curl -X POST "https://api.pingx.ai/agents/v1/agents/AGENTID/web-chat:enable" \
  -H "Authorization: Bearer $PINGX_API_KEY"

#POST /agents/v1/chat/conversations

StartChatConversation · needs agents:write

Starts a text conversation with an agent and returns its id; send turns with SendChatMessage. The server keeps the history. Not idempotent. NOT_FOUND for an unknown agent.

Request body (JSON)

FieldTypeDescription
agentIdstring (int64)Id of the agent to talk to.

Response StartChatConversationResponse

FieldTypeDescription
conversationIdstring (int64)Id to pass to SendChatMessage.
curl -X POST "https://api.pingx.ai/agents/v1/chat/conversations" \
  -H "Authorization: Bearer $PINGX_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"agentId":"…"}'

#POST /agents/v1/chat/conversations/{conversationId}/messages

SendChatMessage · needs agents:write

Sends one user message and returns the agent's complete reply (the request/response form of the streaming the app chat; the reply is assembled server-side). Can take tens of seconds. Not idempotent: each call appends a turn. NOT_FOUND if the conversation does not belong to the organization; UNAVAILABLE if the assistant is temporarily unavailable.

Path parameters

NameTypeDescription
conversationIdstring (int64)Conversation id from StartChatConversation.

Request body (JSON)

FieldTypeDescription
textstringThe user's message (required, non-empty after trimming).

Response pingxAgentsV1SendChatMessageResponse

FieldTypeDescription
segmentsstring[]The reply as separate chat bubbles in order (a turn that searches the knowledge base mid-answer yields an acknowledgment bubble, then the grounded answer).
textstringAll segments joined with a blank line: the whole reply as one text.
citationsChatCitation[]Knowledge passages that grounded the reply, if any.
citations[].knowledgeBaseNamestringKnowledge base name.
citations[].titlestringSource title.
citations[].urlstringSource URL, when it has one.
messageIdstring (int64)Id of the stored assistant message.
curl -X POST "https://api.pingx.ai/agents/v1/chat/conversations/CONVERSATIONID/messages" \
  -H "Authorization: Bearer $PINGX_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"text":"…"}'

#GET /agents/v1/custom-fields

ListCustomFields · needs agents:read (or write)

Lists custom fields visible for a scope (see ListCustomFieldsRequest), default-scope fields first, then the scope's own, by position.

Query parameters

NameTypeDescription
scopeTypestring"default" returns only the org-wide fields; "agent" (with agentId) returns org-wide plus that agent's own; "human_operators" returns org-wide plus the shared operator set. Required.
agentIdstring (int64)Required when scopeType is "agent".
pageSizeintegerMaximum fields to return (default 50, max 200).
pageTokenstringnextPageToken from the previous response; empty for the first page.

Response ListCustomFieldsResponse

FieldTypeDescription
fieldsCustomField[]Org-wide fields first, then the scope's own, by position.
fields[].idstring (int64)Custom field id.
fields[].scopeTypestring"default" (org-wide), "agent" (one agent, see agentId) or "human_operators" (shared by human operators).
fields[].agentIdstring (int64)The agent, for scopeType "agent"; 0 otherwise.
fields[].keystringStable machine key (immutable), unique across scopes.
fields[].labelstringDisplay label.
fields[].descriptionstringWhat to measure and how to score it; guides the AI extraction.
fields[].minValueintegerLowest score.
fields[].maxValueintegerHighest score (greater than minValue).
fields[].positionintegerDisplay order within its scope.
nextPageTokenstringPass as pageToken to get the next page; empty on the last page.
curl "https://api.pingx.ai/agents/v1/custom-fields" \
  -H "Authorization: Bearer $PINGX_API_KEY"

#POST /agents/v1/custom-fields

CreateCustomField · needs agents:write

Creates a custom field. The key is immutable afterwards and must be unique across scope classes. INVALID_ARGUMENT for a bad scope, empty key/label/description, minValue >= maxValue, or a key already in use; NOT_FOUND for an unknown agentId.

Request body (JSON)

FieldTypeDescription
scopeTypestring"default", "agent" or "human_operators". Required.
agentIdstring (int64)Required (and must belong to the organization) when scopeType is "agent".
keystringMachine key, required, unique across the organization's scopes; immutable.
labelstringDisplay label, required.
descriptionstringWhat to measure and how to score it, required.
minValueintegerLowest score.
maxValueintegerHighest score; must be greater than minValue.
positionintegerDisplay order within the scope.

Response CreateCustomFieldResponse

FieldTypeDescription
fieldCustomFieldCustomField is a business-defined metric scored from each conversation (for example "Sentiment", 1-5).
field.idstring (int64)Custom field id.
field.scopeTypestring"default" (org-wide), "agent" (one agent, see agentId) or "human_operators" (shared by human operators).
field.agentIdstring (int64)The agent, for scopeType "agent"; 0 otherwise.
field.keystringStable machine key (immutable), unique across scopes.
field.labelstringDisplay label.
field.descriptionstringWhat to measure and how to score it; guides the AI extraction.
field.minValueintegerLowest score.
field.maxValueintegerHighest score (greater than minValue).
field.positionintegerDisplay order within its scope.
curl -X POST "https://api.pingx.ai/agents/v1/custom-fields" \
  -H "Authorization: Bearer $PINGX_API_KEY" \
  -H "Content-Type: application/json" \
  -d @body.json

#DELETE /agents/v1/custom-fields/{customFieldId}

DeleteCustomField · needs agents:write

Deletes a custom field (stored historical values are left untouched). NOT_FOUND if unknown.

Path parameters

NameTypeDescription
customFieldIdstring (int64)Id of the custom field to delete.

Response DeleteCustomFieldResponse

curl -X DELETE "https://api.pingx.ai/agents/v1/custom-fields/CUSTOMFIELDID" \
  -H "Authorization: Bearer $PINGX_API_KEY"

#PATCH /agents/v1/custom-fields/{customFieldId}

UpdateCustomField · needs agents:write

Partially updates a custom field's label, description, range or position; omitted fields keep their value. scope, agent and key cannot change. Idempotent. NOT_FOUND if unknown.

Path parameters

NameTypeDescription
customFieldIdstring (int64)Id of the custom field to update.

Request body (JSON)

FieldTypeDescription
labelstringNew label (non-empty).
descriptionstringNew description (non-empty).
minValueintegerNew lowest score.
maxValueintegerNew highest score; the resulting range must satisfy minValue < maxValue.
positionintegerNew display order.

Response UpdateCustomFieldResponse

FieldTypeDescription
fieldCustomFieldCustomField is a business-defined metric scored from each conversation (for example "Sentiment", 1-5).
field.idstring (int64)Custom field id.
field.scopeTypestring"default" (org-wide), "agent" (one agent, see agentId) or "human_operators" (shared by human operators).
field.agentIdstring (int64)The agent, for scopeType "agent"; 0 otherwise.
field.keystringStable machine key (immutable), unique across scopes.
field.labelstringDisplay label.
field.descriptionstringWhat to measure and how to score it; guides the AI extraction.
field.minValueintegerLowest score.
field.maxValueintegerHighest score (greater than minValue).
field.positionintegerDisplay order within its scope.
curl -X PATCH "https://api.pingx.ai/agents/v1/custom-fields/CUSTOMFIELDID" \
  -H "Authorization: Bearer $PINGX_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"label":"…","description":"…","minValue":0,"maxValue":0,"position":0}'

#GET /agents/v1/knowledge-bases

ListKnowledgeBases · needs agents:read (or write)

Lists the organization's knowledge bases (without their sources: use GetKnowledgeBase or ListKnowledgeSources for those), ordered by id.

Query parameters

NameTypeDescription
pageSizeintegerMaximum knowledge bases to return (default 50, max 200).
pageTokenstringnextPageToken from the previous response; empty for the first page.

Response ListKnowledgeBasesResponse

FieldTypeDescription
knowledgeBasesKnowledgeBase[]Knowledge bases without their sources.
knowledgeBases[].idstring (int64)Knowledge base id.
knowledgeBases[].namestringDisplay name.
knowledgeBases[].sourceCountintegerNumber of sources in the knowledge base.
knowledgeBases[].sourcesKnowledgeSource[]The sources. Populated only by GetKnowledgeBase and by the create/update RPCs' responses; empty in ListKnowledgeBases.
nextPageTokenstringPass as pageToken to get the next page; empty on the last page.
curl "https://api.pingx.ai/agents/v1/knowledge-bases" \
  -H "Authorization: Bearer $PINGX_API_KEY"

#POST /agents/v1/knowledge-bases

CreateKnowledgeBase · needs agents:write

Creates an empty knowledge base. Attach it to agents through CreateAgent/UpdateAgent knowledgeBaseIds. Not idempotent.

Request body (JSON)

FieldTypeDescription
namestringDisplay name (required, non-empty after trimming).

Response CreateKnowledgeBaseResponse

FieldTypeDescription
knowledgeBaseKnowledgeBaseKnowledgeBase groups sources that agents search to ground their answers.
knowledgeBase.idstring (int64)Knowledge base id.
knowledgeBase.namestringDisplay name.
knowledgeBase.sourceCountintegerNumber of sources in the knowledge base.
knowledgeBase.sourcesKnowledgeSource[]The sources. Populated only by GetKnowledgeBase and by the create/update RPCs' responses; empty in ListKnowledgeBases.
curl -X POST "https://api.pingx.ai/agents/v1/knowledge-bases" \
  -H "Authorization: Bearer $PINGX_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"name":"…"}'

#DELETE /agents/v1/knowledge-bases/{knowledgeBaseId}

DeleteKnowledgeBase · needs agents:write

Permanently deletes a knowledge base with all its sources and their indexed content; agents lose the attachment. NOT_FOUND if unknown.

Path parameters

NameTypeDescription
knowledgeBaseIdstring (int64)Id of the knowledge base to delete.

Response DeleteKnowledgeBaseResponse

curl -X DELETE "https://api.pingx.ai/agents/v1/knowledge-bases/KNOWLEDGEBASEID" \
  -H "Authorization: Bearer $PINGX_API_KEY"

#GET /agents/v1/knowledge-bases/{knowledgeBaseId}

GetKnowledgeBase · needs agents:read (or write)

Returns one knowledge base including all its sources and their ingestion status. NOT_FOUND if it does not exist in the organization.

Path parameters

NameTypeDescription
knowledgeBaseIdstring (int64)Id of the knowledge base.

Response GetKnowledgeBaseResponse

FieldTypeDescription
knowledgeBaseKnowledgeBaseThe knowledge base with all its sources.
knowledgeBase.idstring (int64)Knowledge base id.
knowledgeBase.namestringDisplay name.
knowledgeBase.sourceCountintegerNumber of sources in the knowledge base.
knowledgeBase.sourcesKnowledgeSource[]The sources. Populated only by GetKnowledgeBase and by the create/update RPCs' responses; empty in ListKnowledgeBases.
curl "https://api.pingx.ai/agents/v1/knowledge-bases/KNOWLEDGEBASEID" \
  -H "Authorization: Bearer $PINGX_API_KEY"

#PATCH /agents/v1/knowledge-bases/{knowledgeBaseId}

UpdateKnowledgeBase · needs agents:write

Renames a knowledge base. Idempotent. NOT_FOUND if unknown.

Path parameters

NameTypeDescription
knowledgeBaseIdstring (int64)Id of the knowledge base to rename.

Request body (JSON)

FieldTypeDescription
namestringNew display name (required, non-empty after trimming).

Response UpdateKnowledgeBaseResponse

FieldTypeDescription
knowledgeBaseKnowledgeBaseKnowledgeBase groups sources that agents search to ground their answers.
knowledgeBase.idstring (int64)Knowledge base id.
knowledgeBase.namestringDisplay name.
knowledgeBase.sourceCountintegerNumber of sources in the knowledge base.
knowledgeBase.sourcesKnowledgeSource[]The sources. Populated only by GetKnowledgeBase and by the create/update RPCs' responses; empty in ListKnowledgeBases.
curl -X PATCH "https://api.pingx.ai/agents/v1/knowledge-bases/KNOWLEDGEBASEID" \
  -H "Authorization: Bearer $PINGX_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"name":"…"}'

#GET /agents/v1/knowledge-bases/{knowledgeBaseId}/sources

ListKnowledgeSources · needs agents:read (or write)

Lists the sources of one knowledge base, ordered by id. Use this (or GetKnowledgeSource) to poll ingestion status.

Path parameters

NameTypeDescription
knowledgeBaseIdstring (int64)Id of the knowledge base whose sources to list.

Query parameters

NameTypeDescription
pageSizeintegerMaximum sources to return (default 50, max 200).
pageTokenstringnextPageToken from the previous response; empty for the first page.

Response ListKnowledgeSourcesResponse

FieldTypeDescription
sourcesKnowledgeSource[]
sources[].idstring (int64)Source id.
sources[].knowledgeBaseIdstring (int64)Id of the knowledge base it belongs to.
sources[].sourceTypestring"text" (a note), "url" (one page), "file" (uploaded document) or "site" (whole-site crawl).
sources[].titlestringDisplay title (defaults to the URL or file name).
sources[].sourceUristringThe URL for url/site sources, the original file name for files, empty for text.
sources[].statusstringIngestion status: "pending" (queued), "crawling" (site crawl running), "ready" (fully ingested), "partial" (site crawl finished with some pages failed) or "failed" (see error).
sources[].errorstringWhy ingestion failed; empty unless status is "failed".
sources[].contentstringThe note text, for "text" sources only (empty for the other types).
sources[].pagesDiscoveredintegerSite crawls only: pages found so far.
sources[].pagesIngestedintegerSite crawls only: pages successfully ingested so far.
sources[].pagesFailedintegerSite crawls only: pages that failed.
sources[].ingestionFinishedbooleanTrue once ingestion has reached a final state (status ready, partial or failed): stop polling.
nextPageTokenstringPass as pageToken to get the next page; empty on the last page.
curl "https://api.pingx.ai/agents/v1/knowledge-bases/KNOWLEDGEBASEID/sources" \
  -H "Authorization: Bearer $PINGX_API_KEY"

#POST /agents/v1/knowledge-bases/{knowledgeBaseId}/sources

AddKnowledgeSource · needs agents:write

Adds a source to a knowledge base and starts ingesting it (extract, chunk, embed) in the background. Returns immediately with status "pending"; poll GetKnowledgeSource until ingestionFinished. Exactly one payload (text, url, file or site) must be set. Not idempotent: each call adds a source. INVALID_ARGUMENT for a missing payload/url/filename or a file over 10 MB; NOT_FOUND if the knowledge base is unknown.

Path parameters

NameTypeDescription
knowledgeBaseIdstring (int64)Id of the knowledge base to add the source to.

Request body (JSON)

FieldTypeDescription
titlestringOptional display title; defaults to "Note", the URL or the file name.
textstringA text note (chunked and embedded like any source).
urlstringA single web page, fetched and extracted by the platform.
fileFileSourceAn uploaded .txt, .md or .pdf file.
file.filenamestringFile name; its extension picks the parser: .txt, .md or .pdf.
file.datastring (base64)The raw file bytes (base64 in JSON), at most 10 MB.
siteSiteSourceA whole-site crawl.
site.urlstringStart URL of the crawl (required).
site.maxPagesintegerMaximum pages to crawl; 0 uses the server default.

Response AddKnowledgeSourceResponse

FieldTypeDescription
sourceKnowledgeSourceThe new source, status "pending". Poll GetKnowledgeSource.
source.idstring (int64)Source id.
source.knowledgeBaseIdstring (int64)Id of the knowledge base it belongs to.
source.sourceTypestring"text" (a note), "url" (one page), "file" (uploaded document) or "site" (whole-site crawl).
source.titlestringDisplay title (defaults to the URL or file name).
source.sourceUristringThe URL for url/site sources, the original file name for files, empty for text.
source.statusstringIngestion status: "pending" (queued), "crawling" (site crawl running), "ready" (fully ingested), "partial" (site crawl finished with some pages failed) or "failed" (see error).
source.errorstringWhy ingestion failed; empty unless status is "failed".
source.contentstringThe note text, for "text" sources only (empty for the other types).
source.pagesDiscoveredintegerSite crawls only: pages found so far.
source.pagesIngestedintegerSite crawls only: pages successfully ingested so far.
source.pagesFailedintegerSite crawls only: pages that failed.
source.ingestionFinishedbooleanTrue once ingestion has reached a final state (status ready, partial or failed): stop polling.
curl -X POST "https://api.pingx.ai/agents/v1/knowledge-bases/KNOWLEDGEBASEID/sources" \
  -H "Authorization: Bearer $PINGX_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"title":"…","text":"…","url":"…","file":{},"site":{}}'

#DELETE /agents/v1/knowledge-sources/{sourceId}

DeleteKnowledgeSource · needs agents:write

Deletes one source and its indexed content. NOT_FOUND if unknown.

Path parameters

NameTypeDescription
sourceIdstring (int64)Id of the source to delete.

Response DeleteKnowledgeSourceResponse

curl -X DELETE "https://api.pingx.ai/agents/v1/knowledge-sources/SOURCEID" \
  -H "Authorization: Bearer $PINGX_API_KEY"

#GET /agents/v1/knowledge-sources/{sourceId}

GetKnowledgeSource · needs agents:read (or write)

Returns one source. This is the call to poll after AddKnowledgeSource, UpdateKnowledgeSource or RecrawlKnowledgeSource: repeat it every few seconds until ingestionFinished is true (status ready, partial or failed). Sites can take minutes; check the pages_* counters for progress.

Path parameters

NameTypeDescription
sourceIdstring (int64)Id of the source to read (and poll).

Response GetKnowledgeSourceResponse

FieldTypeDescription
sourceKnowledgeSourceKnowledgeSource is one piece of knowledge inside a knowledge base. Its content is extracted, chunked and embedded asynchronously after it is added.
source.idstring (int64)Source id.
source.knowledgeBaseIdstring (int64)Id of the knowledge base it belongs to.
source.sourceTypestring"text" (a note), "url" (one page), "file" (uploaded document) or "site" (whole-site crawl).
source.titlestringDisplay title (defaults to the URL or file name).
source.sourceUristringThe URL for url/site sources, the original file name for files, empty for text.
source.statusstringIngestion status: "pending" (queued), "crawling" (site crawl running), "ready" (fully ingested), "partial" (site crawl finished with some pages failed) or "failed" (see error).
source.errorstringWhy ingestion failed; empty unless status is "failed".
source.contentstringThe note text, for "text" sources only (empty for the other types).
source.pagesDiscoveredintegerSite crawls only: pages found so far.
source.pagesIngestedintegerSite crawls only: pages successfully ingested so far.
source.pagesFailedintegerSite crawls only: pages that failed.
source.ingestionFinishedbooleanTrue once ingestion has reached a final state (status ready, partial or failed): stop polling.
curl "https://api.pingx.ai/agents/v1/knowledge-sources/SOURCEID" \
  -H "Authorization: Bearer $PINGX_API_KEY"

#PATCH /agents/v1/knowledge-sources/{sourceId}

UpdateKnowledgeSource · needs agents:write

Edits the title and content of a "text" source and re-ingests it (status goes back to "pending"; poll GetKnowledgeSource). INVALID_ARGUMENT if the source is not a text source; NOT_FOUND if unknown. Idempotent.

Path parameters

NameTypeDescription
sourceIdstring (int64)Id of the text source to edit.

Request body (JSON)

FieldTypeDescription
titlestringNew title.
contentstringNew note text.

Response UpdateKnowledgeSourceResponse

FieldTypeDescription
sourceKnowledgeSourceThe source, status back to "pending". Poll GetKnowledgeSource.
source.idstring (int64)Source id.
source.knowledgeBaseIdstring (int64)Id of the knowledge base it belongs to.
source.sourceTypestring"text" (a note), "url" (one page), "file" (uploaded document) or "site" (whole-site crawl).
source.titlestringDisplay title (defaults to the URL or file name).
source.sourceUristringThe URL for url/site sources, the original file name for files, empty for text.
source.statusstringIngestion status: "pending" (queued), "crawling" (site crawl running), "ready" (fully ingested), "partial" (site crawl finished with some pages failed) or "failed" (see error).
source.errorstringWhy ingestion failed; empty unless status is "failed".
source.contentstringThe note text, for "text" sources only (empty for the other types).
source.pagesDiscoveredintegerSite crawls only: pages found so far.
source.pagesIngestedintegerSite crawls only: pages successfully ingested so far.
source.pagesFailedintegerSite crawls only: pages that failed.
source.ingestionFinishedbooleanTrue once ingestion has reached a final state (status ready, partial or failed): stop polling.
curl -X PATCH "https://api.pingx.ai/agents/v1/knowledge-sources/SOURCEID" \
  -H "Authorization: Bearer $PINGX_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"title":"…","content":"…"}'

#POST /agents/v1/knowledge-sources/{sourceId}:recrawl

RecrawlKnowledgeSource · needs agents:write

Re-crawls an existing "site" source from scratch (status back to "pending", counters reset; poll GetKnowledgeSource). INVALID_ARGUMENT if the source is not a site; FAILED_PRECONDITION if a crawl is already in progress; NOT_FOUND if unknown.

Path parameters

NameTypeDescription
sourceIdstring (int64)Id of the site source to re-crawl.

Response RecrawlKnowledgeSourceResponse

FieldTypeDescription
sourceKnowledgeSourceThe source, status back to "pending". Poll GetKnowledgeSource.
source.idstring (int64)Source id.
source.knowledgeBaseIdstring (int64)Id of the knowledge base it belongs to.
source.sourceTypestring"text" (a note), "url" (one page), "file" (uploaded document) or "site" (whole-site crawl).
source.titlestringDisplay title (defaults to the URL or file name).
source.sourceUristringThe URL for url/site sources, the original file name for files, empty for text.
source.statusstringIngestion status: "pending" (queued), "crawling" (site crawl running), "ready" (fully ingested), "partial" (site crawl finished with some pages failed) or "failed" (see error).
source.errorstringWhy ingestion failed; empty unless status is "failed".
source.contentstringThe note text, for "text" sources only (empty for the other types).
source.pagesDiscoveredintegerSite crawls only: pages found so far.
source.pagesIngestedintegerSite crawls only: pages successfully ingested so far.
source.pagesFailedintegerSite crawls only: pages that failed.
source.ingestionFinishedbooleanTrue once ingestion has reached a final state (status ready, partial or failed): stop polling.
curl -X POST "https://api.pingx.ai/agents/v1/knowledge-sources/SOURCEID:recrawl" \
  -H "Authorization: Bearer $PINGX_API_KEY"

#POST /agents/v1/system-prompts:generate

GenerateSystemPrompt · needs agents:write

Drafts an agent system prompt from a free-form brief, using Claude. Does not create or modify any agent: copy the returned text into CreateAgent / UpdateAgent. Can take up to a few minutes and is billed as AI usage; it is named as a write RPC so read-only keys cannot trigger it. Not idempotent (the wording differs between calls).

Request body (JSON)

FieldTypeDescription
briefstringFree-form description of the agent to build: domain, audience, purpose, tone, anything relevant. Required.

Response GenerateSystemPromptResponse

FieldTypeDescription
systemPromptstringThe complete generated system prompt text.
curl -X POST "https://api.pingx.ai/agents/v1/system-prompts:generate" \
  -H "Authorization: Bearer $PINGX_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"brief":"…"}'