Connect a shop
const url = 'https://api.motenya.app/v1/products/example/integrations';const options = { method: 'POST', headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'}, body: '{"type":"magento2","name":"example","baseUrl":"example","credentials":{"additionalProperty":"example"},"historyMode":"none","historyMonths":1}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request POST \ --url https://api.motenya.app/v1/products/example/integrations \ --header 'Authorization: Bearer <token>' \ --header 'Content-Type: application/json' \ --data '{ "type": "magento2", "name": "example", "baseUrl": "example", "credentials": { "additionalProperty": "example" }, "historyMode": "none", "historyMonths": 1 }'The shop is checked first. Its websites become stores, and the first sync starts: the catalog, customers and orders changed within the history chosen, then every 15 minutes.
Requires crm:configure.
Authorizations
Section titled “Authorizations”Parameters
Section titled “Parameters”Path Parameters
Section titled “Path Parameters”Request Bodyrequired
Section titled “Request Bodyrequired”object
The shop’s https address.
Magento2: { "accessToken" }. magento1: { "apiUser", "apiKey", "currency" } (the shop’s ISO 4217 currency, which its API cannot tell).
object
How far back the first sync reaches: none (changes from now on), months (the last historyMonths), full.
With months: 1–120, 12 when omitted.
Responses
Section titled “Responses”Success
object
error stops syncing until the address or credentials are fixed.
Which credentials are stored, e.g. “accessToken …a1b2”. They are never returned.
The source its records sync under; look them up with GET /sync/{type}/{source}/{externalId}.
object
object
object
object
Example
{ "type": "magento2", "status": "active", "historyMode": "none", "phase": "history", "runningEntity": "catalog_item", "counts": [ { "entity": "catalog_item" } ], "lastRecordError": { "entity": "catalog_item" }}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