🔐 Required role:
RECD_C📖 Data dictionary: Contact
Upsert up to 100 contacts, each linked to one or more existing clients, in one request
Send a contacts array (1–100). Each entry upserts a contact (contact_info + contact) and its links to existing clients, all by external reference — no Aiwyn internal ids required.
Partial success. Each contact is processed independently in its own transaction, so one failing contact does not roll back the others. The response splits contacts into succeeded and failed (each keyed by request-order index); the HTTP status is 200 whenever the request itself is valid — inspect the lists for individual outcomes.
Per contact:
- Matched by
pmsRef(contact) and the (contact, client) pair (links); re-sending updates, never duplicates. pmsRefoptional: omit to create a native contact (mintsAIWYN_<uuid>, not idempotent).clientsoptional: omit or[]upserts only the contact; unlink viaactive: false(never by absence).clientRefresolves by the client'spmsRef/clientRef/sysRefs; refs must not contain:.- All-or-nothing for that one contact: any unresolved client or stage failure persists nothing for it.
Facade over POST /api/v1/records.
Business Applications:
- Bulk contact synchronization
- Link contacts to existing clients
Partial success — one contact's client cannot be resolved:
{
"contacts": [
{ "pmsRef": "CONTACT-001", "contactInfo": { "firstName": "Jane", "lastName": "Smith" }, "clients": [ { "clientRef": "CLIENT-12345" } ] },
{ "pmsRef": "CONTACT-BAD", "contactInfo": { "firstName": "Ghost", "lastName": "User" }, "clients": [ { "clientRef": "DOES-NOT-EXIST" } ] }
]
}Create native — omit pmsRef to create a new Aiwyn contact (server mints AIWYN_<uuid>):
{
"contacts": [
{ "contactInfo": { "firstName": "Jane", "lastName": "Smith", "email": "jane.smith@example.com" } }
]
}- Sandbox (requires Cloudflare Access headers)https://api.sandbox.aiwyn.app/api/v1/contacts/upsert
- Staging (requires Cloudflare Access headers)https://api.staging.aiwyn.app/api/v1/contacts/upsert
- Production (your live firm data; no Cloudflare Access headers)https://api.aiwyn.ai/api/v1/contacts/upsert
curl -i -X POST \
https://api.sandbox.aiwyn.app/api/v1/contacts/upsert \
-H 'Authorization: Bearer <YOUR_JWT_HERE>' \
-H 'CF-Access-Client-Id: YOUR_API_KEY_HERE' \
-H 'CF-Access-Client-Secret: YOUR_API_KEY_HERE' \
-H 'Content-Type: application/json' \
-d '{
"contacts": [
{
"pmsRef": "CONTACT-001",
"contactInfo": {
"firstName": "Jane",
"lastName": "Smith",
"email": "jane.smith@example.com"
},
"clients": [
{
"clientRef": "CLIENT-12345",
"relationship": "Primary Contact",
"receivesInvoice": true
}
]
},
{
"pmsRef": "CONTACT-002",
"contactInfo": {
"firstName": "John",
"lastName": "Doe"
}
}
]
}'{ "data": { "total": 0, "succeeded": [ … ], "failed": [ … ] }, "error": {}, "meta": { "success": true, "message": "string", "timestamp": "2019-08-24T14:15:22Z", "version": "string" } }