External API Documentation

Overview

This API allows external companies to upload and manage contacts, companies, and engagement data in our system. All endpoints require proper authentication and follow RESTful conventions.

Base URL

https://pub-api.conversion.ai/api/v1

Authentication

All requests must include your API key in the Authorization header:

Authorization: Bearer YOUR_API_KEY

Contacts API

Batch Upsert Contacts

Create or update multiple contacts in a single request.

Endpoint: POST /contacts/batch

Request Body:

Response:

Field Requirements:

  • email (required): Valid email address

  • variables (optional): Key-value pairs for custom contact fields

  • externalContact (optional): Your system's reference data

Get Contact by Email

Retrieve a contact using their email address.

Endpoint: GET /contacts/by-email/{email}

Response:

Delete Contact by Email

Remove a contact from the system using their email address.

Endpoint: DELETE /contacts/by-email/{email}

Response:

Batch Update Subscription Status

Update subscription status for multiple contacts.

Endpoint: POST /contacts/batch-subscription

Request Body:

Subscription Status Values:

  • SUBSCRIBED

  • UNSUBSCRIBED

  • PENDING

Response:

Track Custom Engagement

Record custom engagement activities for contacts.

Endpoint: POST /contacts/engagements

Request Body:

Field Requirements:

  • contactEmail (required): Email of the contact

  • type (required): Must be "ACTIVITY"

  • name (required): Brief name for the engagement

  • description (required): Detailed description of what happened

  • data (optional): Additional JSON data with custom fields

Response:


Companies API

Batch Upsert Companies

Create or update multiple companies in a single request.

Endpoint: POST /companies/batch

Request Body:

Field Requirements:

  • id (required): Your unique identifier for this company

  • baseDomain (recommended): Company's primary domain

  • variables (optional): Key-value pairs for custom company fields

Response:

Get Company by ID

Retrieve a company using your system's ID.

Endpoint: GET /companies/by-external-id/{id}

Response:

Delete Company by ID

Remove a company from the system using your system's ID.

Endpoint: DELETE /companies/by-external-id/{id}

Response:


Response Format

All API responses follow this standard format:

Success Response:

Error Response:

Error Codes

Code
Description

VALIDATION_ERROR

Request data validation failed

NOT_FOUND

Requested resource not found

DUPLICATE_ERROR

Resource already exists

RATE_LIMIT_EXCEEDED

Too many requests

UNAUTHORIZED

Invalid or missing API key

INTERNAL_ERROR

Server error

Data Types and Validation

Contact Variables

Common variable names (use these keys for best integration):

  • first_name: Contact's first name

  • last_name: Contact's last name

  • phone: Phone number

  • company_name: Company name

  • title: Job title

  • linkedin_url: LinkedIn profile URL

Company Variables

Common variable names:

  • company_name: Full company name

  • industry: Industry classification

  • size: Employee count range (e.g., "1-10", "11-50", "51-200")

  • annual_revenue: Annual revenue in USD

  • location: Primary business location

  • website: Company website URL

Custom Engagement Data

The data field in engagement tracking accepts any JSON structure. Common fields:

  • duration_minutes: Length of interaction

  • outcome: Result of the engagement

  • next_steps: Planned follow-up actions

  • priority: Engagement priority level

  • tags: Array of tags for categorization

Best Practices

  1. Batch Operations: Use batch endpoints when uploading multiple records to reduce API calls

  2. Error Handling: Always check the success field before processing response data

  3. Data Consistency: Use consistent external IDs across all API calls

  4. Validation: Validate email formats and required fields before sending requests

  5. Monitoring: Monitor API response times and error rates for optimal performance

Last updated