Rewrite a product’s title or description with AI, right away
const url = 'https://api.crossmart.io/api/v1/workspaces/example/ai/content-drafts';const options = { method: 'POST', headers: {'Content-Type': 'application/json'}, body: '{"productId":"2489E9AD-2EE2-8E00-8EC9-32D5F69181C0","connectionId":"2489E9AD-2EE2-8E00-8EC9-32D5F69181C0","fields":["title"],"instruction":"example","title":"example","descriptionHtml":"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.crossmart.io/api/v1/workspaces/example/ai/content-drafts \ --header 'Content-Type: application/json' \ --data '{ "productId": "2489E9AD-2EE2-8E00-8EC9-32D5F69181C0", "connectionId": "2489E9AD-2EE2-8E00-8EC9-32D5F69181C0", "fields": [ "title" ], "instruction": "example", "title": "example", "descriptionHtml": "example" }'Rewrites the fields asked for, for the catalog or for one store, optionally following an instruction. The answer is a draft for the editor: nothing is stored until the merchant saves it. Uses one AI credit: answers 402 when the plan has none left this month (while plans are enforced), 429 past the rate limit, and 503 while AI is not configured.
Parameters
Section titled “Parameters”Path Parameters
Section titled “Path Parameters”Request Bodyrequired
Section titled “Request Bodyrequired”object
The store the text is for; leave out for the catalog’s own content
The fields to rewrite
What to change, such as “shorter” or “mention it is dishwasher-safe”
The title as edited and not yet saved; the saved one when left out
The description as edited and not yet saved; the saved one when left out
Responses
Section titled “Responses”object
Null when not asked for
Null when not asked for
Example generated
{ "title": "example", "descriptionHtml": "example"}The organization’s plan does not allow this (ENTITLEMENTS_ENFORCED is on). code and feature say why; upgrading the plan resolves it.
object
The code of the organization’s plan
Null is unlimited
How many more the request asked for
Example
{ "statusCode": 402, "error": "Payment Required", "code": "plan_limit_reached", "message": "The Free plan includes 2 connected channels, and 2 are in use. Upgrade the plan to add more.", "feature": "active_listings", "plan": "free"}Too many AI requests from you in this workspace. Wait a minute and try again.