Create a product
const url = 'https://api.motenya.app/v1/products';const options = { method: 'POST', headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'}, body: '{"name":"example","businessType":"ecommerce","modules":{"knowledgeBase":true,"ticketing":true},"knowledgeBase":{"slug":"casa-verde","language":"ro","name":"example"}}'};
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 \ --header 'Authorization: Bearer <token>' \ --header 'Content-Type: application/json' \ --data '{ "name": "example", "businessType": "ecommerce", "modules": { "knowledgeBase": true, "ticketing": true }, "knowledgeBase": { "slug": "casa-verde", "language": "ro", "name": "example" } }'A new product with the modules chosen, each billed per month from now (as when the owner adds one in the admin). With the knowledge base on, give knowledgeBase and its KB is created too. Its slug and language are checked first (SLUG_TAKEN, SLUG_INVALID, LANGUAGE_INVALID: nothing is created). If the KB still can’t be made, the product stays without the knowledge base module and KNOWLEDGE_BASE_NOT_CREATED names it: don’t create it again; switch the module on in the admin. Email channels, domains and the team are set up in the admin. Only the account owner can give a key products:write, and a key limited to some products cannot create one.
Requires products:write.
Authorizations
Section titled “Authorizations”Request Bodyrequired
Section titled “Request Bodyrequired”object
Picks the CRM vocabulary.
Omitted modules are off on a new product and unchanged on an update.
object
Billed per month while on.
Tickets and the CRM; billed per month while on.
Required with modules.knowledgeBase: the KB is created with the product.
object
Its address on the help-center domain: lowercase letters, digits and single hyphens, unique in the account.
Example
casa-verdeIts first (default) language, e.g. ro or en.
Example
roIts name in that language; the product name when omitted.
Responses
Section titled “Responses”Success
object
Picks the CRM vocabulary; changes no data.
object
Tickets and the CRM; their operations fail with TICKETING_DISABLED while off.
Example
{ "businessType": "ecommerce"}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