Update metadata to an AI contact
Contact Management
Update metadata to an AI contact
POST
Update metadata to an AI contact
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
Request Body
The request body is a flexible object where you can include any key-value pairs:
You can send any metadata fields as a JSON object. Common examples:
Response Structure
The endpoint returns an array of updated custom field values:
Each item in the response array contains information about the updated field.
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:
Best Practice: Send everything as strings for predictable behavior.
Error Responses
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}/infoto 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
Use metadata for detailed information and tags for simple categorization.
