Share Agent
Publish a mosaic behind a shareable link, optionally sharing a copy that includes its assets.
Makes a mosaic viewable by anyone with the link, the same as the Share control in the canvas. Set duplicate: true to share a copy instead: the copy is created with the source mosaic's completed renders and the media they reference, then published, so the original stays private and you can keep editing it.
For a mosaic executed through the API, pass the run_id returned by POST /agent/{agent_id}/run once that run has finished. The shared copy will use the renders from that run, including runs that finished with only some branches producing outputs.
Revoke a link with Unshare Agent, and read the current state with GET /agent/{agent_id}/share.
Request
curl -X POST "https://api.mosaic.so/agent/123e4567-e89b-12d3-a456-789012345678/share" \
-H "Authorization: Bearer mk_your_api_key" \
-H "Content-Type: application/json" \
-d '{
"duplicate": true,
"run_id": "aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee",
"name": "Q3 recap (shared)"
}'All body fields are optional.
Body Parameters
| Field | Type | Required | Description |
|---|---|---|---|
duplicate | boolean | No | Share a copy instead of the mosaic itself. Defaults to false. |
include_assets | boolean | No | When duplicating, copy completed renders and their media. Defaults to true. |
run_id | string (UUID) | No | Finished run whose renders should be copied. Requires duplicate=true and include_assets=true. |
name | string | No | Name for the copy (1-120 chars). Defaults to Copy of <source name>. |
description | string | No | Description for the copy (<=5000 chars). Defaults to the source description. |
Response
Returns 201 when a copy was created, 200 when the mosaic itself was published.
{
"agent_id": "9c2d2aef-58c6-4af2-845f-d7f2d4d0a9c5",
"name": "Q3 recap (shared)",
"visibility": "public",
"share_url": "https://edit.mosaic.so/mosaics/9c2d2aef-58c6-4af2-845f-d7f2d4d0a9c5",
"source_agent_id": "123e4567-e89b-12d3-a456-789012345678",
"source_run_id": "aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee",
"duplicated": true,
"stats": {
"nodes_copied": 6,
"connections_copied": 5,
"renders_copied": 4,
"render_media_refs_copied": 9
}
}