Skip to main content
POST
/
v1
/
agent
/
endpoint
JavaScript
import Roark from '@roarkanalytics/sdk';

const client = new Roark({
  bearerToken: process.env['ROARK_API_BEARER_TOKEN'], // This is the default and can be omitted
});

const agentEndpoint = await client.agentEndpoint.create({
  agentId: '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
  direction: 'INCOMING',
  value: 'value',
});

console.log(agentEndpoint.data);
{
  "data": {
    "id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
    "agentId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
    "type": "PHONE",
    "value": "<string>",
    "environment": "<string>",
    "direction": "INCOMING",
    "outboundDialType": "NONE",
    "outboundDialHttpRequestDefinitionId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
    "createdAt": "<string>",
    "updatedAt": "<string>"
  }
}

Authorizations

Authorization
string
header
required

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

Body

application/json

Input for creating an agent endpoint

agentId
string<uuid>
required

Agent ID to associate this endpoint with

value
string
required

Phone number in E.164 format (e.g., +12345678900)

direction
enum<string>
required

Call direction: INCOMING, OUTGOING, or INCOMING_AND_OUTGOING

Available options:
INCOMING,
OUTGOING,
INCOMING_AND_OUTGOING
environment
string
default:production

Environment name (default: production)

outboundDialType
enum<string>
default:NONE

Outbound dial type: NONE or HTTP_REQUEST (default: NONE)

Available options:
NONE,
HTTP_REQUEST
outboundDialHttpRequestDefinitionId
string<uuid> | null

ID of the HTTP request definition for outbound dialing (required when outboundDialType is HTTP_REQUEST)

Response

The created agent endpoint

data
object
required

Detailed agent endpoint response