Skip to content

Rewrite a product’s title or description with AI, right away

POST
/api/v1/workspaces/{workspaceId}/ai/content-drafts
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.

workspaceId
required
string
Media typeapplication/json
object
productId
required
string format: uuid
connectionId

The store the text is for; leave out for the catalog’s own content

string format: uuid
fields
required

The fields to rewrite

Array<string>
>= 1 items
Allowed values: title description
instruction

What to change, such as “shorter” or “mention it is dishwasher-safe”

string
<= 500 characters
title

The title as edited and not yet saved; the saved one when left out

string
<= 100000 characters
descriptionHtml

The description as edited and not yet saved; the saved one when left out

string
<= 100000 characters
Media typeapplication/json
object
title
required

Null when not asked for

string
nullable
descriptionHtml
required

Null when not asked for

string
nullable

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.

Media typeapplication/json
object
statusCode
required
number
error
required
string
code
required
string
Allowed values: plan_limit_reached plan_feature_not_included
message
required
string
feature
required
string
Allowed values: active_listings channel_connections workspaces members api_keys ai_credits autonomous_agents bring_your_own_key
plan
required

The code of the organization’s plan

string
limit
required

Null is unlimited

number
nullable
usage
required
number
requested
required

How many more the request asked for

number

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.