API Reference

Customers API

Manage customer profiles via the API

The Customers API allows you to create, retrieve, and manage customer profiles. Customer profiles aggregate data across tickets and enable personalized support.

Endpoints

MethodEndpointDescription
GET/api/customersList customers
POST/api/customersCreate or update customer
GET/api/customers/:idGet customer profile
PATCH/api/customers/:idUpdate customer
GET/api/customers/lookupLookup by email

List Customers

Retrieve a paginated list of customer profiles.

GET /api/customers

Query Parameters

ParameterTypeDefaultDescription
limitinteger50Items per page (max: 100)
offsetinteger0Offset for pagination
searchstring-Search by email, name, or company
vipOnlybooleanfalseFilter VIP customers only

Example Request

curl "https://app.keva.support/api/customers?search=acme&limit=20" \
  -H "Authorization: Bearer keva_live_your_api_key"

Example Response

{
  "customers": [
    {
      "id": "cust_abc123",
      "email": "john@acme.com",
      "name": "John Smith",
      "company": "Acme Corp",
      "phone": "+1-555-0100",
      "jobTitle": "CTO",
      "location": "San Francisco, CA",
      "timezone": "America/Los_Angeles",
      "isVip": true,
      "priorityOverride": "high",
      "tags": ["enterprise", "early-adopter"],
      "totalTickets": 12,
      "openTickets": 1,
      "avgResolutionTime": 3600,
      "overallSentiment": "positive",
      "sentimentTrend": "improving",
      "firstTicketAt": "2023-06-15T10:00:00Z",
      "lastTicketAt": "2024-01-14T15:30:00Z",
      "salesforceContactId": "003ABC123",
      "hubspotContactId": "12345",
      "createdAt": "2023-06-15T10:00:00Z",
      "updatedAt": "2024-01-14T15:30:00Z"
    }
  ],
  "total": 156,
  "limit": 20,
  "offset": 0
}

Create or Update Customer

Create a new customer or update an existing one (upsert by email).

POST /api/customers

Request Body

FieldTypeRequiredDescription
emailstringYesCustomer email (unique identifier)
namestringNoFull name
companystringNoCompany name
phonestringNoPhone number
jobTitlestringNoJob title
locationstringNoLocation/address
timezonestringNoIANA timezone
isVipbooleanNoVIP status
priorityOverridestringNolow, medium, high, urgent
tagsarrayNoArray of tag strings
internalNotesstringNoInternal notes (not visible to customer)

Example Request

curl -X POST https://app.keva.support/api/customers \
  -H "Authorization: Bearer keva_live_your_api_key" \
  -H "Content-Type: application/json" \
  -d '{
    "email": "jane@startup.io",
    "name": "Jane Doe",
    "company": "Startup.io",
    "jobTitle": "Head of Support",
    "timezone": "America/New_York",
    "isVip": true,
    "tags": ["beta-tester", "startup"]
  }'

Example Response

{
  "customer": {
    "id": "cust_new456",
    "email": "jane@startup.io",
    "name": "Jane Doe",
    "company": "Startup.io",
    "jobTitle": "Head of Support",
    "timezone": "America/New_York",
    "isVip": true,
    "tags": ["beta-tester", "startup"],
    "totalTickets": 0,
    "openTickets": 0,
    "createdAt": "2024-01-15T18:00:00Z"
  }
}

Get Customer

Retrieve a customer profile by ID.

GET /api/customers/:id

Example Request

curl https://app.keva.support/api/customers/cust_abc123 \
  -H "Authorization: Bearer keva_live_your_api_key"

Update Customer

Update customer profile fields.

PATCH /api/customers/:id

Example Request

curl -X PATCH https://app.keva.support/api/customers/cust_abc123 \
  -H "Authorization: Bearer keva_live_your_api_key" \
  -H "Content-Type: application/json" \
  -d '{
    "isVip": true,
    "priorityOverride": "high",
    "internalNotes": "Enterprise customer, handle with care"
  }'

Lookup by Email

Find a customer by their email address.

GET /api/customers/lookup?email=customer@example.com

Example Request

curl "https://app.keva.support/api/customers/lookup?email=john@acme.com" \
  -H "Authorization: Bearer keva_live_your_api_key"

Auto-Creation

Customer profiles are automatically created when:

  1. A new ticket is received from an unknown email
  2. A widget conversation starts with a new email
  3. You create a ticket via API with a new customer email

CRM Integration

Customer profiles can be synced with external CRMs:

FieldDescription
salesforceContactIdLinked Salesforce Contact ID
hubspotContactIdLinked HubSpot Contact ID
hubspotCompanyIdLinked HubSpot Company ID

Configure CRM sync in Settings > Integrations > CRM.

Computed Fields

These fields are automatically calculated:

FieldDescription
totalTicketsTotal number of tickets
openTicketsCurrently open tickets
avgResolutionTimeAverage time to resolution (seconds)
overallSentimentpositive, neutral, negative
sentimentTrendimproving, stable, declining
firstTicketAtTimestamp of first ticket
lastTicketAtTimestamp of most recent ticket