pingx.aiAPI docs Markdown

Agents API

Configure AI agents, knowledge bases and sources, web-chat links and custom fields, and chat with an agent over text.

Configure AI agents (personas), their knowledge bases, scored custom fields and web-chat share links, and chat with an agent over text, all with an API key. The same API is also reachable over Connect/gRPC at /pingx.agents.v1.AgentsService/<Method>.

#Auth and scopes

Send Authorization: Bearer pk_live_... (create keys under Settings > API Keys in the app). The organization always comes from the key; there is no organization field in any request, and ids of another organization answer 404 exactly like unknown ids.

Key scopeAllows
agents:readGet* / List* RPCs (all GET endpoints)
agents:writeeverything, including reads
agentssame as agents:write

Classification is by RPC name (Get, List, Search, Count, Export, Download prefixes are reads). GenerateSystemPrompt and SendChatMessage are writes on purpose: they spend AI quota / append conversation turns.

#Conventions

  • JSON field names are camelCase over REST (systemPrompt); int64 ids are JSON strings.
  • Lists take pageSize (default 50, max 200) and pageToken, and return nextPageToken (empty = last page).
  • Errors: 400 invalid argument / failed precondition, 401 bad key, 403 missing scope, 404 unknown id, 409 aborted (script changed concurrently), 503 assistant unavailable.
  • PATCH endpoints are partial: only the fields you send change.

#Endpoints

MethodPathScopePurpose
GET/agents/v1/agentsreadList agents
POST/agents/v1/agentswriteCreate agent (name, systemPrompt, knowledgeBaseIds)
GET/agents/v1/agents/{agentId}readGet agent
PATCH/agents/v1/agents/{agentId}writeUpdate agent (prompt, playbooks, script, voice, toggles, knowledge bases)
DELETE/agents/v1/agents/{agentId}writeDelete agent
POST/agents/v1/system-prompts:generatewriteDraft a system prompt from a brief (AI)
GET/agents/v1/knowledge-basesreadList knowledge bases
POST/agents/v1/knowledge-baseswriteCreate knowledge base
GET/agents/v1/knowledge-bases/{knowledgeBaseId}readGet knowledge base with sources
PATCH/agents/v1/knowledge-bases/{knowledgeBaseId}writeRename
DELETE/agents/v1/knowledge-bases/{knowledgeBaseId}writeDelete with its sources
GET/agents/v1/knowledge-bases/{knowledgeBaseId}/sourcesreadList sources
POST/agents/v1/knowledge-bases/{knowledgeBaseId}/sourceswriteAdd a text / url / file / site source (async ingestion)
GET/agents/v1/knowledge-sources/{sourceId}readGet source: the ingestion poll
PATCH/agents/v1/knowledge-sources/{sourceId}writeEdit a text source (re-ingests)
DELETE/agents/v1/knowledge-sources/{sourceId}writeDelete source
POST/agents/v1/knowledge-sources/{sourceId}:recrawlwriteRe-crawl a site source
POST/agents/v1/agents/{agentId}/web-chat:enablewriteEnable share link (idempotent)
POST/agents/v1/agents/{agentId}/web-chat:disablewriteRevoke share link
GET/agents/v1/agents/{agentId}/web-chatreadShare-link state and token
GET/agents/v1/custom-fieldsreadList custom fields (scopeType, agentId)
POST/agents/v1/custom-fieldswriteCreate custom field
PATCH/agents/v1/custom-fields/{customFieldId}writeUpdate label/description/range/position
DELETE/agents/v1/custom-fields/{customFieldId}writeDelete custom field
POST/agents/v1/chat/conversationswriteStart a text conversation
POST/agents/v1/chat/conversations/{conversationId}/messageswriteSend a message, get the full reply

#Examples

export H='Authorization: Bearer pk_live_xxx'
export API=https://<gateway-host>

# Create a knowledge base, add a site, poll until ingestion finishes
curl -s -H "$H" -H 'Content-Type: application/json' -d '{"name":"Help center"}' $API/agents/v1/knowledge-bases
curl -s -H "$H" -H 'Content-Type: application/json' \
  -d '{"title":"Docs","site":{"url":"https://example.com/docs","maxPages":50}}' \
  $API/agents/v1/knowledge-bases/12/sources
curl -s -H "$H" $API/agents/v1/knowledge-sources/34      # repeat until "ingestionFinished": true
# status: pending | crawling | ready | partial | failed; pagesDiscovered/Ingested/Failed show crawl progress

# Upload a file source (data is base64, max 10 MB, .txt/.md/.pdf)
curl -s -H "$H" -H 'Content-Type: application/json' \
  -d "{\"file\":{\"filename\":\"faq.pdf\",\"data\":\"$(base64 -w0 faq.pdf)\"}}" \
  $API/agents/v1/knowledge-bases/12/sources

# Draft a prompt, create the agent with the knowledge base, tweak it
curl -s -H "$H" -H 'Content-Type: application/json' \
  -d '{"brief":"Friendly support agent for a bike shop"}' $API/agents/v1/system-prompts:generate
curl -s -H "$H" -H 'Content-Type: application/json' \
  -d '{"name":"Bike support","systemPrompt":"You are ...","knowledgeBaseIds":["12"]}' $API/agents/v1/agents
curl -s -X PATCH -H "$H" -H 'Content-Type: application/json' \
  -d '{"voiceGender":"male","fillerWordsEnabled":true,"knowledgeBaseIds":{"ids":["12"]}}' $API/agents/v1/agents/7

# Web chat share link
curl -s -X POST -H "$H" $API/agents/v1/agents/7/web-chat:enable
curl -s -X POST -H "$H" $API/agents/v1/agents/7/web-chat:disable

# Custom field scored per conversation
curl -s -H "$H" -H 'Content-Type: application/json' \
  -d '{"scopeType":"agent","agentId":"7","key":"nps","label":"NPS","description":"0-10 likelihood to recommend","minValue":0,"maxValue":10}' \
  $API/agents/v1/custom-fields

# Text chat: start, then send turns (the reply is returned whole)
curl -s -H "$H" -H 'Content-Type: application/json' -d '{"agentId":"7"}' $API/agents/v1/chat/conversations
curl -s -H "$H" -H 'Content-Type: application/json' -d '{"text":"What are your hours?"}' \
  $API/agents/v1/chat/conversations/99/messages

#Notes and exclusions

  • Updating script runs an AI normalization pass first (up to a few minutes); the processed text is stored. 409 means another save changed the script meanwhile: re-read and retry.
  • supportEscalationEnabled needs JIRA and Google Chat connected in the app; otherwise 400. The integrations themselves (and their tokens) are not exposed.
  • Create only takes name, system prompt and knowledge bases; set everything else with PATCH.
  • Chat replies are assembled server-side. segments are the separate bubbles; text joins them. Conversations are recorded as app ("studio") chats.
  • Web chat token is a bearer capability to chat publicly with the agent; treat it as sensitive. Re-enabling after disabling mints a new token.
  • Not in this API: test calls and browser WebRTC calls (voice API), TranscribeBrief (needs browser-recorded audio upload; use GenerateSystemPrompt with a text brief), JIRA / Google Chat integrations.
  • Agents here have no language or tools/flows setting: those do not exist on the platform's agent model today.