Overview
Update or add custom metadata fields to a contact. Metadata allows you to store any additional information about a contact beyond the standard fields (name, email, phone). This endpoint is intelligent - it processes unstructured data and automatically fills custom field definitions if they exist in your account. Field keys are automatically converted to snake_case for consistency.Use Cases
- E-commerce Data: Store order history, lifetime value, preferred products
- Customer Segmentation: Add custom attributes for targeting and personalization
- CRM Integration: Sync custom fields from external CRM systems
- Lead Scoring: Store qualification scores, lead source, conversion probability
- Business Context: Add company info, industry, decision maker status
- Behavioral Data: Track user actions, preferences, interaction history
- Support Information: Store account tier, support plan, SLA requirements
Authentication
This endpoint requires authentication using an API key. Include your API key in the request header:Path Parameters
Parameter | Type | Required | Description |
---|---|---|---|
aiContactId | string (UUID) | Yes | Unique identifier of the contact |
Request Body
The request body is a flexible object where you can include any key-value pairs:Field | Type | Required | Description |
---|---|---|---|
{any} | any | No | Any custom field as key-value pair |
Response Structure
The endpoint returns an array of updated custom field values:Field | Type | Description |
---|---|---|
Array | array | Array of custom field value objects that were updated |
Example Request
Example Response
Common Use Cases
1. Update E-commerce Customer Data
2. Lead Qualification Data
3. Sync from External CRM
4. Add Support Plan Information
5. Update Form Submission Data
6. Bulk Update Multiple Contacts
Key Behavior & Features
Automatic Snake Case Conversion
Field keys are automatically converted to snake_case: You send:{ "companyName": "Acme Corp" }
Stored as: { "company_name": "Acme Corp" }
You send: { "LeadScore": "95" }
Stored as: { "lead_score": "95" }
Intelligent Field Processing
The endpoint uses AI to process unstructured data and match it to your custom field definitions:- If a custom field definition exists for a key, it will be used
- Data types are automatically formatted based on field definitions
- Missing fields are created as needed
- All fields are updated (not merged)
Update Behavior
- Additive: New metadata fields are added to existing ones
- Overwrite: If a field already exists, its value is updated
- Flexible Types: Values can be strings, numbers, booleans, or objects (converted to strings)
- No Validation: You can send any fields - they don’t need to be pre-defined
Data Type Handling
Metadata values should generally be sent as strings for consistency:Data Type You Send | How It’s Stored | Example |
---|---|---|
String | As is | "Acme Corp" |
Number | Converted to string | 95 → "95" |
Boolean | Converted to string | true → "true" |
Object | JSON string | Converted to JSON |
Array | Joined string | ["a","b"] → "a, b" |
Error Responses
Status Code | Description |
---|---|
400 | Bad Request - Invalid metadata format |
401 | Unauthorized - Invalid or missing API key |
404 | Not Found - Contact not found |
500 | Internal Server Error - Something went wrong |
Important Notes
- No Field Limit: You can send as many metadata fields as needed
- Size Limit: Very large metadata objects may be rejected (keep under 1MB)
- Field Names: Use descriptive, consistent naming (prefer snake_case or camelCase)
- Retrieve Metadata: Use GET
/api/public/contact/{aiContactId}/info
to see all metadata - Type Coercion: All values are ultimately stored as strings in custom fields
- Activity Logging: Metadata updates are logged in contact activity
Best Practices
1. Use Consistent Field Names
2. Include Timestamps
3. Validate Before Sending
4. Handle Errors Gracefully
Related Endpoints
- GET /api/public/contact//info - Get contact info including metadata
- POST /api/public/ticket/open/web-whatsapp/ - Create ticket with metadata
- PATCH /api/public/contact/tags/ - Update contact tags
Complete Workflow Example
Metadata vs Tags
Feature | Metadata (This Endpoint) | Tags |
---|---|---|
Purpose | Store detailed data | Categorize/label contacts |
Format | Key-value pairs | Simple labels |
Quantity | Unlimited fields | Multiple tags |
Search | By field name and value | By tag name |
Use Case | Customer details, scores, history | Segments, categories, flags |
Headers
API key required to authorize the request
Path Parameters
ID of the AI contact
Body
application/json
Response
Metadata added successfully.