How Rasen works
From an API key to a finished call, with the operations and objects of each step.
Summary
This page shows each step from an API key to a finished call, with its operations and objects. It also gives the states of an agent. It does not give the requests of each step; each step links the guide that does.
Facts
The flow
- Get a workspace and an API key. A member of the workspace creates the key in the Rasen app,
on the Developers page under API keys. The API has no operation that creates a
workspace or a key. Check the key with
getContext. See Authentication and Quickstart. - Create an agent.
createAgentcreates the agent in statedraft, with its first draft. Edit the draft withupdateAgentDraft, pick a voice withlistVoicesand set variables withsetAgentVariable. See Build and publish an agent. - Add knowledge, tools and credentials. Add sources with
createKnowledgeSource,uploadKnowledgeSourceorcreateAgentKnowledgeSource, and link them withaddAgentKnowledgeSource. Add webhook tools withcreateAgentTool, and MCP servers withcreateMcpServeranddiscoverMcpTools. Store tool credentials withcreateSecret. See Add knowledge to an agent, Add tools and MCP servers, Store and rotate tool credentials and Add a before-call tool. - Validate and publish.
validateAgentDraftchecks the draft, with an optional patch, and saves nothing.publishAgentfreezes the complete draft into a version and makes it live in one step. The agent is thenlive.rollbackAgentmakes an earlier version live again. See Build and publish an agent. - Test in the browser.
setAgentShareLinkissues a link that runs the live version in a browser, with no phone number and no carrier.rotateAgentShareLinkreplaces it. See Share a test-call link. - Connect a carrier account or a SIP trunk.
createTelephonyConnectionstores the credentials of a carrier account.connectSipTrunk,createSipInboundConnectionandcreateSipOutboundTrunkset up a SIP trunk. See Connect a carrier account and Connect a SIP trunk. - Import a number.
listAvailablePhoneNumbersandimportPhoneNumbersimport numbers of a carrier account.importSipNumberimports a number of a SIP trunk. See Connect a carrier account and Connect a SIP trunk. - Route the number to the agent.
setPhoneNumberInboundAgentmakes the agent answer the number.addPhoneNumberOutboundAgentlets the agent call from it.provisionPhoneNumberretries the carrier setup of an inbound number. See Route phone numbers to agents and Configure call transfers. - Calls happen. An inbound call to a routed number needs no operation.
createCallplaces an outbound call.createAgentSessionruns the agent on a call leg that you own. Campaigns call a list:createCampaignoruploadCampaign, thenplanCampaign,admitCampaignandstartCampaign. See Place calls and read results, Run an outbound campaign, Call lifecycle and Campaign lifecycle. - Read the results.
getCallgives the call’s state and the readiness of each result. Read the results withgetCallTranscript,getCallSummary,getCallExtraction,downloadCallRecordingandlistCallToolOutcomes. Follow a live call withstreamLiveCallTranscript. See Place calls and read results, Follow a call’s transcript live and Read tool call logs. - Receive webhooks.
createWebhookEndpointsubscribes an HTTPS endpoint tocall.completed,call.failed,call.analyzedandtool.failed. See Receive call events with webhooks and Webhook events. - Measure usage.
listUsageandqueryUsagegive the quantities of each component, for each agent or call. See Measure usage.
Objects
Each ID is opaque: never parse it or build one. The prefix of the contract examples helps you read logs.
Agent lifecycle
Rules
- MUST publish an agent before it takes calls. A draft edit never changes a call.
- MUST NOT parse an ID or build one from a prefix.
- MUST send a new
Idempotency-Keywith each write, and the currentETaginIf-Matchwith each edit. - MUST keep an unknown
statevalue of any object, and never read it as success. - MUST unarchive an agent before its
archive_deadlineto keep it.