View Categories

Contacts API

2 min read

Contacts API #

Create, update, and manage contacts in your VoxPria database.

Create Contact #

Endpoint: POST /api/v1/contacts

curl -X POST "https://app.voxpria.com/api/v1/contacts" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "phone": "+14155551234",
    "firstName": "John",
    "lastName": "Doe",
    "email": "john@example.com",
    "metadata": {
      "customerId": "12345",
      "accountType": "premium"
    }
  }'

Response #

{
  "success": true,
  "data": {
    "contactId": "contact_abc123",
    "phone": "+14155551234",
    "firstName": "John",
    "lastName": "Doe",
    "createdAt": "2025-02-09T12:00:00Z"
  }
}

Bulk Import Contacts #

Endpoint: POST /api/v1/contacts/bulk

Import up to 10,000 contacts at once:

curl -X POST "https://app.voxpria.com/api/v1/contacts/bulk" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "contacts": [
      {
        "phone": "+14155551234",
        "firstName": "John",
        "lastName": "Doe"
      },
      {
        "phone": "+14155555678",
        "firstName": "Jane",
        "lastName": "Smith"
      }
    ]
  }'

Response #

{
  "success": true,
  "data": {
    "imported": 2,
    "skipped": 0,
    "errors": []
  }
}

List Contacts #

Endpoint: GET /api/v1/contacts

curl -X GET "https://app.voxpria.com/api/v1/contacts?page=1&limit=50" \
  -H "Authorization: Bearer YOUR_API_KEY"

Update Contact #

Endpoint: PUT /api/v1/contacts/:id

curl -X PUT "https://app.voxpria.com/api/v1/contacts/contact_abc123" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "email": "newemail@example.com",
    "metadata": {
      "accountType": "enterprise"
    }
  }'

Delete Contact #

Endpoint: DELETE /api/v1/contacts/:id

curl -X DELETE "https://app.voxpria.com/api/v1/contacts/contact_abc123" \
  -H "Authorization: Bearer YOUR_API_KEY"

Code Example – Bulk Import #

JavaScript #

async function bulkImportContacts(contacts) {
  const response = await axios.post(
    'https://app.voxpria.com/api/v1/contacts/bulk',
    { contacts },
    {
      headers: {
        'Authorization': `Bearer ${process.env.VOXPRIA_API_KEY}`
      }
    }
  );
  return response.data;
}

// Usage
const contacts = [
  { phone: '+14155551234', firstName: 'John', lastName: 'Doe' },
  { phone: '+14155555678', firstName: 'Jane', lastName: 'Smith' }
];

const result = await bulkImportContacts(contacts);
console.log(`Imported: ${result.data.imported}`);

Python #

def bulk_import_contacts(contacts):
    response = requests.post(
        'https://app.voxpria.com/api/v1/contacts/bulk',
        json={'contacts': contacts},
        headers={
            'Authorization': f'Bearer {os.getenv("VOXPRIA_API_KEY")}'
        }
    )
    return response.json()

# Usage
contacts = [
    {'phone': '+14155551234', 'firstName': 'John', 'lastName': 'Doe'},
    {'phone': '+14155555678', 'firstName': 'Jane', 'lastName': 'Smith'}
]

result = bulk_import_contacts(contacts)
print(f"Imported: {result['data']['imported']}")
⚠️ Important: Phone numbers must be in E.164 format (+1234567890). Invalid numbers will be skipped during bulk import.

Leave A Comment

Go to Top