Create or update a client by its id in your system
const url = 'https://api.motenya.app/v1/products/example/sync/clients/erp/C-1042';const options = { method: 'PUT', headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'}, body: '{"name":"example","kind":"company","vatNumber":"example","registrationNumber":"example","addresses":[{"label":"example","line1":"example","line2":"example","city":"example","region":"example","postalCode":"example","country":"example"}],"tags":["example"],"custom":"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/clients/erp/C-1042 \ --header 'Authorization: Bearer <token>' \ --header 'Content-Type: application/json' \ --data '{ "name": "example", "kind": "company", "vatNumber": "example", "registrationNumber": "example", "addresses": [ { "label": "example", "line1": "example", "line2": "example", "city": "example", "region": "example", "postalCode": "example", "country": "example" } ], "tags": [ "example" ], "custom": "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 client by VAT number.
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
object
ISO 3166-1 alpha-2, e.g. RO.
Custom field values keyed by field key; null clears one. See GET /products/{productId}/custom-fields.
Responses
Section titled “Responses”Success
object
False when an existing record was updated (found by external id, or matched).
object
object
object
object
Example
{ "record": { "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