Create or update a contact by its id in your system
const url = 'https://api.motenya.app/v1/products/example/sync/contacts/erp/C-1042';const options = { method: 'PUT', headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'}, body: '{"name":"example","emails":["example"],"phone":"example","language":"example","tags":["example"],"custom":"example","clientExternalIds":["example"]}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request PUT \ --url https://api.motenya.app/v1/products/example/sync/contacts/erp/C-1042 \ --header 'Authorization: Bearer <token>' \ --header 'Content-Type: application/json' \ --data '{ "name": "example", "emails": [ "example" ], "phone": "example", "language": "example", "tags": [ "example" ], "custom": "example", "clientExternalIds": [ "example" ] }'Idempotent: the first call creates it, later calls with the same source and external id update the fields sent. References to other records can use their ids in the same source (…ExternalId). A new external id first matches a contact by any of its emails, so people already in the CRM (from tickets, say) are not duplicated. Emails are added, never removed.
Requires crm:write.
Authorizations
Section titled “Authorizations”Parameters
Section titled “Parameters”Path Parameters
Section titled “Path Parameters”The system the record comes from, named by you: e.g. magento2:casa-verde, stripe, erp.
Example
erpThe system the record comes from, named by you: e.g. magento2:casa-verde, stripe, erp.
The record’s id in that system.
Example
C-1042The record’s id in that system.
Request Bodyrequired
Section titled “Request Bodyrequired”object
Primary first; normalized to lowercase. Unique within the product.
Custom field values keyed by field key; null clears one. See GET /products/{productId}/custom-fields.
Clients (by their ids in the same source) to link the contact to.
Example generated
{ "name": "example", "emails": [ "example" ], "phone": "example", "language": "example", "tags": [ "example" ], "custom": "example", "clientExternalIds": [ "example" ]}Responses
Section titled “Responses”Success
object
False when an existing record was updated (found by external id, or matched).
object
object
object
Example
{ "record": { "clients": [ { "kind": "company" } ] }}Invalid request
object
object
object
Example
{ "error": { "code": "SLUG_TAKEN" }}Missing, invalid, revoked or expired API key
object
object
object
Example
{ "error": { "code": "SLUG_TAKEN" }}Missing scope, API turned off, published article without publish scope, or account suspended
object
object
object
Example
{ "error": { "code": "SLUG_TAKEN" }}Not found, or outside the knowledge bases this key may use
object
object
object
Example
{ "error": { "code": "SLUG_TAKEN" }}Slug or translation already exists
object
object
object
Example
{ "error": { "code": "SLUG_TAKEN" }}Rejected by validation (e.g. unknown language or category)
object
object
object
Example
{ "error": { "code": "SLUG_TAKEN" }}Rate limited; see Retry-After
object
object
object
Example
{ "error": { "code": "SLUG_TAKEN" }}Internal error