For AI agents: a documentation index is available at the root level at /llms.txt and /llms-full.txt. Append /llms.txt to any URL for a page-level index, or .md for the markdown version of any page.
HomeGet API key
DocumentationIntegrationsAPI Reference
DocumentationIntegrationsAPI Reference
  • API Reference
      • GETList Voices
      • GETList Agents
      • POSTCreate Agent
      • GETGet Agent
      • DELDelete Agent
      • PATCHUpdate Agent
      • POSTAttach Number To Agent
      • DELDetach Number From Agent
      • GETList Agent Conversations
      • GETList Agent Calls
LogoLogo
HomeGet API key
API Referenceagents

Attach Number To Agent

POST
https://api.agentphone.ai/v1/agents/:agent_id/numbers
POST
/v1/agents/:agent_id/numbers
1const url = 'https://api.agentphone.ai/v1/agents/agent_id/numbers';
2const options = {
3 method: 'POST',
4 headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
5 body: '{"numberId":"string"}'
6};
7
8try {
9 const response = await fetch(url, options);
10 const data = await response.json();
11 console.log(data);
12} catch (error) {
13 console.error(error);
14}
1{
2 "agentId": "string",
3 "number": {
4 "id": "string",
5 "phoneNumber": "string",
6 "status": "string",
7 "type": "sms"
8 }
9}
Attach an existing phone number to an agent. The number must belong to the same account and not be released.
Was this page helpful?
Previous

Detach Number From Agent

Next
Built with

Authentication

AuthorizationBearer

Bearer authentication of the form Bearer <token>, where token is your auth token.

Path parameters

agent_idstringRequired

Request

This endpoint expects an object.
numberIdstringRequired

Response

Successful Response
agentIdstring
numberobject

Errors

422
Unprocessable Entity Error