Create material
Code Mode: praxis.media.libraries.materials.create
HTTP: POST /media/v1/libraries/{library_id}/materials
Create a reusable element in a library: a character, product, scene or brand that image and video generation can name so the same subject stays consistent. Use library_id from creation or listing. Upload the pictures first (character, product and scene need 1 to 8; a brand needs none), then send material_type, name and body; every asset the body names must be in this same library, or the request is refused before anything is saved. To use the element, put its asset_id in references of POST /media/v1/libraries/{library_id}/images/generations, or of video generations with mode reference: the service replaces it with the element’s pictures (keeping your role and strength) and appends its description to the prompt; a brand adds only text and palette. Expanded pictures count against the model’s limit (10 for images, 9 for videos). Creating an element is free. Example: POST /media/v1/libraries/lib_example/materials with {“material_type”:“brand”,“name”:“Docs brand”,“body”:{“description”:“Calm, plain-spoken tone.”,“colors”:[{“hex”:“#1f6feb”,“name”:“Praxis blue”}]}}.
Signature
praxis.media.libraries.materials.create(args:{path:{library_id:string};body:{/** Kind of element; it decides which body fields are accepted. e.g. "brand" */ material_type:"character"|"product"|"scene"|"brand";/** Display name used in the library and in the guidance appended to prompts, such as 品牌「name」. */ name:string;/** The element body for this material_type. */ body:{/** What the character looks like and wears, in plain words; appended to the prompt of every generation that references the element. */ description:string;/** Pictures of the subject, 1 to 8, each an image or sticker asset of this same library, in the order a generation hands them to the model. */ references:Array<{/** Asset id of an image or sticker in this same library. */ asset_id:string;/** Optional word for what the picture shows, such as 正面 or side view; at most 20 characters. */ view?:string}>;/** fictional for an invented character. */ likeness:"real_person"|"fictional";/** Consent record that authorises a real person’s likeness; required with likeness real_person and refused with fictional. */ consent_id?:string}|{/** What the product is and how it looks; appended to the prompt of every generation that references it. */ description:string;/** Pictures of the subject, 1 to 8, each an image or sticker asset of this same library, in the order a generation hands them to the model. */ references:Array<{/** Asset id of an image or sticker in this same library. */ asset_id:string;/** Optional word for what the picture shows, such as 正面 or side view; at most 20 characters. */ view?:string}>;/** Facts such as material, size or colour as name/value pairs, at most 20; written into the prompt sorted by name. */ attributes?:{[key:string]:string};/** Details the model may not change, such as the logo position or the cap colour; at most 20 entries of up to 200 characters. */ must_keep?:Array<string>}|{/** The place, light and mood to reproduce; appended to the prompt of every generation that references it. */ description:string;/** Pictures of the subject, 1 to 8, each an image or sticker asset of this same library, in the order a generation hands them to the model. */ references:Array<{/** Asset id of an image or sticker in this same library. */ asset_id:string;/** Optional word for what the picture shows, such as 正面 or side view; at most 20 characters. */ view?:string}>}|{/** Brand tone and voice in plain words. */ description:string;/** Optional pictures that show the brand, 0 to 8 image or sticker assets of this library; kept with the brand but never expanded into a generation. */ references?:Array<{/** Asset id of an image or sticker in this same library. */ asset_id:string;/** Optional word for what the picture shows, such as 正面 or side view; at most 20 characters. */ view?:string}>;/** Logo assets of this library (images or stickers), at most 8. */ logos?:Array<string>;/** Brand colours, at most 12, written into the prompt as hex with their names. */ colors?:Array<{/** Colour as #rrggbb; stored in lower case. */ hex:string;/** Optional name of the colour, such as Praxis blue. */ name?:string}>;/** Font assets of this library, at most 8. */ fonts?:Array<string>;/** Words generated text should avoid, at most 100 entries of up to 40 characters. */ banned_words?:Array<string>};/** Folder to file the element in; defaults to the library root. */ asset_folder?:string}}):Promise<{/** Element id. */ asset_id:string;/** Always media.material. */ object:"media.material";/** Library that holds the element. */ library_id:string;/** Kind of element. */ material_type:"character"|"product"|"scene"|"brand";/** Display name of the element. */ name:string;/** Body version; every saved body bumps it, and a generation records the version it used in provenance.elements. */ version:number;/** The element body as stored. */ body:{/** What the character looks like and wears, in plain words; appended to the prompt of every generation that references the element. */ description:string;/** Pictures of the subject, 1 to 8, each an image or sticker asset of this same library, in the order a generation hands them to the model. */ references:Array<{/** Asset id of an image or sticker in this same library. */ asset_id:string;/** Optional word for what the picture shows, such as 正面 or side view; at most 20 characters. */ view?:string}>;/** fictional for an invented character. */ likeness:"real_person"|"fictional";/** Consent record that authorises a real person’s likeness; required with likeness real_person and refused with fictional. */ consent_id?:string}|{/** What the product is and how it looks; appended to the prompt of every generation that references it. */ description:string;/** Pictures of the subject, 1 to 8, each an image or sticker asset of this same library, in the order a generation hands them to the model. */ references:Array<{/** Asset id of an image or sticker in this same library. */ asset_id:string;/** Optional word for what the picture shows, such as 正面 or side view; at most 20 characters. */ view?:string}>;/** Facts such as material, size or colour as name/value pairs, at most 20; written into the prompt sorted by name. */ attributes?:{[key:string]:string};/** Details the model may not change, such as the logo position or the cap colour; at most 20 entries of up to 200 characters. */ must_keep?:Array<string>}|{/** The place, light and mood to reproduce; appended to the prompt of every generation that references it. */ description:string;/** Pictures of the subject, 1 to 8, each an image or sticker asset of this same library, in the order a generation hands them to the model. */ references:Array<{/** Asset id of an image or sticker in this same library. */ asset_id:string;/** Optional word for what the picture shows, such as 正面 or side view; at most 20 characters. */ view?:string}>}|{/** Brand tone and voice in plain words. */ description:string;/** Optional pictures that show the brand, 0 to 8 image or sticker assets of this library; kept with the brand but never expanded into a generation. */ references?:Array<{/** Asset id of an image or sticker in this same library. */ asset_id:string;/** Optional word for what the picture shows, such as 正面 or side view; at most 20 characters. */ view?:string}>;/** Logo assets of this library (images or stickers), at most 8. */ logos?:Array<string>;/** Brand colours, at most 12, written into the prompt as hex with their names. */ colors?:Array<{/** Colour as #rrggbb; stored in lower case. */ hex:string;/** Optional name of the colour, such as Praxis blue. */ name?:string}>;/** Font assets of this library, at most 8. */ fonts?:Array<string>;/** Words generated text should avoid, at most 100 entries of up to 40 characters. */ banned_words?:Array<string>};/** Every asset the body names (pictures, logos, fonts). */ depends_on:Array<string>;/** Folder the element is filed in. */ asset_folder:string;/** Console page that shows the element to a person. */ viewer_url:string;/** When the element was created. */ created_at:string;/** When the element was last saved. */ updated_at:string}>;Parameters
| Name | In | Type | Required | Description |
|---|---|---|---|---|
| library_id | path | string | yes | Library ID returned by creation. |
Request body
| Required | Content types | Description |
|---|---|---|
| yes | application/json |
Responses
| Status | Content types | Description |
|---|---|---|
| 200 | application/json | Successful response. |
| 400 | application/json | A selector, cursor, limit or other parameter is invalid; correct the reported field before retrying. |
| 402 | application/json | Request failed; see the error code reference. |
| 403 | application/json | This credential has read-only access to the library; use a write-capable binding for mutations. |
| 404 | application/json | The library or asset is missing, deleted or belongs to another tenant; verify its identifier and owner. |
| 409 | application/json | Request failed; see the error code reference. |
| 413 | application/json | The file exceeds an input limit; provide a smaller source file. |
| 415 | application/json | This media format is unsupported; provide a supported format. |
| 422 | application/json | Request failed; see the error code reference. |
| 429 | application/json | A rate limit was reached; wait before retrying. |
| 501 | application/json | The requested operation is unsupported; choose a supported method. |
| 502 | application/json | Request failed; see the error code reference. |
| 503 | application/json | Historical projections are still being initialized, or library storage is temporarily unavailable; retry shortly and check failureSummary counts_complete. |