Quickstart
Create your first AI-powered phone line that can make and receive calls
Prerequisites
3
Step 3: Purchase a phone number
const response = await fetch('https://api.krosai.com/v1/phone-numbers', {
method: 'POST',
headers: {
'x-api-key': 'kros_live_your_key_here',
'Content-Type': 'application/json',
},
body: JSON.stringify({
inventory_id: 'inv_ng_12345', // From GET /phone-numbers/available
}),
});
const { number, id } = await response.json();
console.log('Purchased:', number); // +2348012345678import requests
response = requests.post(
'https://api.krosai.com/v1/phone-numbers',
headers={
'x-api-key': 'kros_live_your_key_here',
'Content-Type': 'application/json',
},
json={
'inventory_id': 'inv_ng_12345',
}
)
data = response.json()
print(f"Purchased: {data['number']}")
5
Step 4: Create an endpoint
// Create a Vapi endpoint:
const response = await fetch('https://api.krosai.com/v1/endpoints', {
method: 'POST',
headers: {
'x-api-key': 'kros_live_your_key_here',
'Content-Type': 'application/json',
},
body: JSON.stringify({
name: 'My Support Agent',
type: 'agent',
url: 'sip:[email protected]', // Or your provider's SIP URI
provider_config: {
provider: 'vapi',
assistant_id: 'asst_abc123',
},
}),
});
const { id: endpointId } = await response.json();// Create an ElevenLabs endpoint:
const response = await fetch('https://api.krosai.com/v1/endpoints', {
method: 'POST',
headers: {
'x-api-key': 'kros_live_your_key_here',
'Content-Type': 'application/json',
},
body: JSON.stringify({
name: 'ElevenLabs Agent',
type: 'agent',
url: 'sip:[email protected]',
provider_config: {
provider: 'elevenlabs',
agent_id: 'your-agent-id',
},
}),
});
6
Step 5: Attach endpoint to phone number
await fetch(`https://api.krosai.com/v1/phone-numbers/${phoneNumberId}`, {
method: 'PATCH',
headers: {
'x-api-key': 'kros_live_your_key_here',
'Content-Type': 'application/json',
},
body: JSON.stringify({
endpoint_id: endpointId,
allow_inbound: true,
allow_outbound: true,
}),
});
7
Step 6: Make your first call
const response = await fetch('https://api.krosai.com/v1/outbound-calls', {
method: 'POST',
headers: {
'x-api-key': 'kros_live_your_key_here',
'Content-Type': 'application/json',
},
body: JSON.stringify({
from_number: '+2348012345678', // Your KrosAI number
to_number: '+14155551234', // Destination phone
endpoint_id: endpointId, // Your AI agent
}),
});
const { call_id, status } = await response.json();
console.log('Call initiated:', call_id);response = requests.post(
'https://api.krosai.com/v1/outbound-calls',
headers={
'x-api-key': 'kros_live_your_key_here',
'Content-Type': 'application/json',
},
json={
'from_number': '+2348012345678',
'to_number': '+14155551234',
'endpoint_id': endpoint_id,
}
)
data = response.json()
print(f"Call initiated: {data['call_id']}")Using the Playground
🎉 Congratulations!
Next steps
Deep dive into integrations
Last updated



