Works
A work is an object of the media library built on top of its assets. It orders references to assets of the same library and adds a title and text. It copies no file and changes no asset. Each work has exactly one kind:
| Kind | kind | Body |
|---|---|---|
| Gallery | gallery | Title, text, topics, cover, and ordered items. An item is a picture or video, or a text segment between pictures |
| Article | article | Title, summary, author, cover, and a Markdown body. Inline images are written  and appear where they are written |
| Product listing | product_listing | Title, selling points, parameters, main images, detail images, and SKU images by spec. Price and stock are not stored |
| General | blocks | A title plus Editor.js blocks {blocks: [{id, type, data}]}. An image block names an asset in data.asset_id; a list block uses the current Editor.js shape, each item {content, meta: {}, items: []} |
A work may only reference live assets of the same library, of the fitting type. Covers, inline images and main images must be pictures or stickers; gallery items may also be videos. If any reference fails these checks, the request is refused, the error names every bad reference, and nothing is saved. Unknown fields such as price are refused too. Price and stock belong to the shop back office; to see a price on the Console shop-page preview, write it into custom.price ({ amount: "899.00", currency: "CNY", original: "1599.00" }): the preview shows amount as the price and original struck through.
To publish one story to several platforms (a Xiaohongshu version, an article version), make one work per platform and give them the same series.
Create a work
const work = await praxis.media.libraries.works.create({ path: { library_id: "default" }, body: { kind: "gallery", series: "ai-diary-01", body: { title: "Day one", text: "Three things.", items: [{ asset_id: "<asset id>" }, { text: "Later that day" }] }, },});Read it to publish
expand=assets returns every referenced asset’s URL, thumbnail and size in the same read. The URLs expire, so read the work again when you use them instead of storing them.
const work = await praxis.media.libraries.works.retrieve({ path: { library_id: "default", work_id: "<work id>" }, query: { expand: ["assets"] },});Write links and numbers back
custom is merged as a JSON Merge Patch (RFC 7396): write only your own keys and you never overwrite keys someone else wrote; send null for a key to remove it. With if_revision, the change applies only if the work is still at the revision you read. If someone changed it since, the answer is 409 REVISION_CONFLICT: read the work again and reapply your change.
await praxis.media.libraries.works.update({ path: { library_id: "default", work_id: "<work id>" }, body: { custom: { published_url: "https://…", stats: { likes: 936 } } },});List, look up and delete
- List works with filters
kindandseries;qmatches the title. - To find the works that use an asset, call
praxis.media.libraries.assets.works.list. - Deleting a work deletes only the work; every asset it named stays.
- Deleting an asset is never blocked by a work. The delete lists the works that use it in
dependents, and from then on those works list the asset inmissing.
Limits
- Galleries: 100 items.
- Articles: 100,000 characters of body.
- Product listings: 1 to 20 main images, at most 100 detail images, at most 200 SKUs.
- General works: 500 blocks.
custom: at most 50 keys and 16 KB as JSON.- Works are free to create.
- Until works are opened for an organization, every work method answers
OPERATION_NOT_SUPPORTED.
View works in the Console · Produce a series of multi-platform works · Concepts · Generate and edit · Limits and errors