Skip to main content
Get your first customer organization up and running with AI phone answering in under 5 minutes!

What You’ll Build

By the end of this guide, you’ll have:
  • ✅ An authenticated API connection
  • ✅ A customer organization created
  • ✅ A phone number provisioned with AI answering
  • ✅ An embed token to display the dashboard

Prerequisites

1

Partner Account

You need a partner account with Answering Agent. If you don’t have one, contact us to get started.
2

API Key

Sign in to your partner dashboard and generate an API key at Settings → API Keys. Copy it somewhere safe!
3

Development Environment

You can use any language or tool that makes HTTP requests. We’ll show examples in cURL, JavaScript, and Python.

Step 1: Test Your API Key

First, let’s verify your API key works by listing your organizations:
# Set your API key
export API_KEY="sk_live_YourApiKeyHere"

# Test the connection
curl -X GET "https://answeringagent.com/api/v1/organizations" \
  -H "X-API-KEY: $API_KEY" \
  -H "Content-Type: application/json"
Expected Response:
[]
An empty array is perfect! It means your API key is working and you have no organizations yet.
If you get a 401 error, double-check that your API key is correct and you’re using the X-API-KEY header (not Authorization).

Step 2: Create Your First Organization

Now let’s create an organization for a customer. We’ll create the organization and its owner user in a single API call:
curl -X POST "https://answeringagent.com/api/v1/organizations" \
  -H "X-API-KEY: $API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Pizza Palace",
    "description": "A local pizzeria serving Denver since 1995",
    "owner": {
      "external_id": "customer_001",
      "email": "[email protected]",
      "name": "Maria Rodriguez"
    }
  }'
Expected Response:
{
  "organization": {
    "id": 123,
    "name": "Pizza Palace",
    "created_at": "2025-01-24T10:30:00Z",
    "updated_at": "2025-01-24T10:30:00Z"
  },
  "owner": {
    "id": 456,
    "external_id": "customer_001",
    "name": "Maria Rodriguez",
    "email": "[email protected]",
    "created_at": "2025-01-24T10:30:00Z",
    "updated_at": "2025-01-24T10:30:00Z"
  }
}
🎉 Great! You’ve created your first organization with an owner user. Note the organization.id - you’ll need it for the next step.
The external_id is your system’s ID for this user. Use it to link this Answering Agent user to your database. All future API calls can use this ID instead of the internal Answering Agent user ID.

Step 3: Add a Phone Number

Now let’s provision a phone number for this organization:
# Replace 123 with your organization ID from step 2
ORG_ID=123

curl -X POST "https://answeringagent.com/api/v1/locations" \
  -H "X-API-KEY: $API_KEY" \
  -H "Content-Type: application/json" \
  -d "{
    \"organization_id\": $ORG_ID,
    \"name\": \"Main Location\",
    \"address\": \"123 Main St, Denver, CO 80202\",
    \"area_code\": \"303\"
  }"
Expected Response:
{
  "location": {
    "id": 789,
    "name": "Main Location",
    "phone_number": "+13035551234",
    "status": "active",
    "address": "123 Main St, Denver, CO 80202",
    "created_at": "2025-01-24T10:35:00Z",
    "updated_at": "2025-01-24T10:35:00Z"
  }
}
📞 Awesome! The phone number is now active and ready to receive calls with AI answering!

Step 4: Get an Embed Token

Finally, let’s get an embed token so your customer can access their dashboard:
# Replace with your user's external_id from step 2
USER_EXTERNAL_ID="customer_001"

curl -X GET "https://answeringagent.com/api/v1/users/$USER_EXTERNAL_ID/embed-token" \
  -H "X-API-KEY: $API_KEY"
Expected Response:
{
  "embed_token": "MTIzNDV8ZDgyZDk3Mzg1OTAxNTkzNA",
  "user_id": "customer_001"
}
🔑 Perfect! You now have an embed token that lets your customer access their Answering Agent dashboard.

Complete Example

Here’s the entire flow in one script:
const API_KEY = 'sk_live_YourApiKeyHere';  // Use env vars in production!
const BASE_URL = 'https://answeringagent.com/api/v1';

async function onboardCustomer() {
  try {
    // 1. Create organization with owner
    console.log('Creating organization...');
    const orgResponse = await fetch(`${BASE_URL}/organizations`, {
      method: 'POST',
      headers: {
        'X-API-KEY': API_KEY,
        'Content-Type': 'application/json'
      },
      body: JSON.stringify({
        name: 'Pizza Palace',
        description: 'A local pizzeria serving Denver since 1995',
        owner: {
          external_id: 'customer_001',
          email: '[email protected]',
          name: 'Maria Rodriguez'
        }
      })
    });
    const { organization, owner } = await orgResponse.json();
    console.log('✓ Organization created:', organization.id);

    // 2. Add phone number
    console.log('Provisioning phone number...');
    const locationResponse = await fetch(`${BASE_URL}/locations`, {
      method: 'POST',
      headers: {
        'X-API-KEY': API_KEY,
        'Content-Type': 'application/json'
      },
      body: JSON.stringify({
        organization_id: organization.id,
        name: 'Main Location',
        address: '123 Main St, Denver, CO 80202',
        area_code: '303'
      })
    });
    const { location } = await locationResponse.json();
    console.log('✓ Phone number provisioned:', location.phone_number);

    // 3. Get embed token
    console.log('Generating embed token...');
    const tokenResponse = await fetch(
      `${BASE_URL}/users/${owner.external_id}/embed-token`,
      { headers: { 'X-API-KEY': API_KEY } }
    );
    const { embed_token } = await tokenResponse.json();
    console.log('✓ Embed token generated');

    // Return data for your system
    return {
      organizationId: organization.id,
      phoneNumber: location.phone_number,
      embedToken: embed_token,
      embedUrl: `https://answeringagent.com/embed?token=${embed_token}`
    };
  } catch (error) {
    console.error('Error:', error);
    throw error;
  }
}

// Run it!
onboardCustomer().then(result => {
  console.log('\n🎉 Success! Customer onboarded:');
  console.log(result);
});

What’s Next?

You’ve successfully onboarded your first customer! Here’s what you can do next:

Troubleshooting

”Invalid credentials” Error

  • Double-check your API key is correct
  • Make sure you’re using the X-API-KEY header (not Authorization: Bearer)
  • Verify your partner account is active

”Organization not found” Error

  • Make sure you’re using the correct organization ID
  • Verify the organization belongs to your partner account
  • Check that the organization wasn’t deleted

Phone Number Not Provisioning

  • Ensure the area_code is valid (3 digits, US/Canada)
  • Some area codes may have limited availability
  • Try a different area code if provisioning fails

Embed Token Not Working

  • Verify the user’s external_id is correct
  • Make sure the user belongs to the organization
  • Ensure the embed token hasn’t been regenerated (which invalidates old tokens)

Need Help?

We’re here to help you succeed:
  • Technical Support: [email protected]
  • Documentation Issues: Report on GitHub or email support
  • Integration Questions: Our team is happy to jump on a call
Happy building! 🚀