Share links
Share one result, a generation session or a project by a view-only link with the Nodaro API, read what the link shows, and get a preview card for social posts.
A share link is an unguessable, view-only link to one of your results (a job), a generation session or a project. Anyone signed in can make one, and anyone can open it, with no account. The link shows the results, the prompt as it was written, the model and the settings. With allow copy on, it also hands out the reference files the result was made from.
Each item has one link. Turning the link off makes it answer 404. Turning it on again brings back the same token, so a link you handed out before works again.
Endpoints
| Method | Path | What it does |
|---|---|---|
GET | /v1/shares?kind=&targetId= | Your link for one of your items. |
PUT | /v1/shares | Turn the link of one of your items on or off. |
GET | /v1/public/shares/:token | What the link shows. No credential needed. |
GET | /v1/public/shares/:token/items | The results of a shared session or project, a page at a time. No credential needed. |
Turn a link on or off
# Turn the link of one of your jobs on.
TOKEN=$(curl -s -X PUT "https://app.nodaro.ai/v1/shares" \
-H "Authorization: Bearer $NODARO_API_KEY" \
-H "Content-Type: application/json" \
-d '{"kind":"job","targetId":"<job-id>","shared":true}' | jq -r .data.token)
# What the link shows. No credential needed.
curl -s "https://app.nodaro.ai/v1/public/shares/$TOKEN"const share = await client.shares.set({ kind: "job", targetId: jobId, shared: true })
const shown = await client.shares.getPublic(share.token)PUT /v1/shares takes this body:
Prop
Type
The first call makes the link. Later calls keep its token. The answer is { data: Share }. Turning a link off always works. Turning a link on answers 422 share_not_allowed, with a reason, when the item cannot be shared now. See What a link never shows. The route answers 404 when the item is not yours.
GET /v1/shares?kind=&targetId= reads your link for one of your items. It answers { data: Share | null }, with null when the item was never shared. It answers 404 when the item is not yours.
A Share is { token, kind, targetId, shared, allowCopy, createdAt, updatedAt, locale }. locale is null for English, and on a server from before the link kept its language.
What a link shows
GET /v1/public/shares/:token answers { data: { kind, allowCopy, job? | session? | project? } }. Exactly one of job, session or project is there, as kind says.
A shared job is { id, type, mediaKind, outputUrl, outputUrls?, width?, height?, durationSec?, title, songTitle?, toolName, coverUrl, createdAt, prompt, displayPrompt, negativePrompt?, model, settings, references?, trend? }:
toolNameis what a person calls the tool that made the result, for example"Song Mashup","Text to Speech"or"Image to Video". It is never a model's name. It isnullfor a tool with no public name.songTitleis a song's own title, of the take thatoutputUrlnames, when the song has one.coverUrlis the result's picture: the owner's cover, else the art made with the result, elsenull. See Set a job's cover.promptis the prompt as it was written, exactly as sent. When your app sent auserPrompt, the link shows that prompt.displayPromptis the same prompt as a person reads it. Each reference token becomes the name on its pill.@<slug>:<N>, with its role, variant or~lock, becomes the name of the reference it names. When no name is known, the slug is made readable:@image-1:1becomes@Image 1.{video:N:label},{audio:N:label}and{image:N:label}become@label. Only names come from the references, never an address or an id. BothpromptanddisplayPromptarenullfor a trend run.modelis the public model id and its name. It isnullfor a model that the public catalog does not list.settingsis the job's input without the prompt and model fields, and without anything internal: ids of rows, credits and prices, webhooks, tokens, storage keys and error text.settingsnever holds a value that is an address or an id, whatever the field is called. That covers a link, a uuid, a path or storage key, a host or file name, an email, and a long id or hash. A nested object that held one, such as an image and its role, is left out whole.referencesis a list of{ url, kind }, at most 32. It is there only when the link allows copying. It holds https files only, never an address that carries a signature, a token, a key or a password.- A trend run shows as
trend: { slug, name }, withprompt: null, emptysettingsand noreferences. The trend's recipe belongs to the platform.
A shared session is { title, tool, createdAt, itemCount }.
A shared project is { name, sessions: [{ id, title, tool, itemCount, coverUrl }] }. It lists the project's personal, unarchived sessions that show at least one result, most recently active first, at most 200. itemCount counts only what the link shows. coverUrl is the session's cover when the cover is shown, else its newest shown image.
List the results of a session or a project
GET /v1/public/shares/:token/items lists the results of a shared session, newest first. It answers { data: SharedJob[], nextCursor }, where each item has the shape of a shared job.
| Query | Meaning |
|---|---|
sessionId | Required for a shared project: one of the sessions the link lists. A shared project without it answers 400. |
limit | Page size, 1 to 100. The default is 50. |
cursor | The nextCursor of the previous page. |
A page may hold fewer results than limit. Follow nextCursor until it is null.
A result the link may not show is skipped, and the page reads on to fill limit. nextCursor is always the position of the last result shown, never of one left out. Walking the pages therefore reveals nothing about the hidden results.
What a link never shows
A link shows only finished results of its owner that the platform would let anyone see. The cases below are not shown. PUT /v1/shares also refuses to turn a link on for them, with 422 share_not_allowed and this reason:
reason | Why |
|---|---|
not_completed | The job has not finished, or it failed or was cancelled. |
no_media | The job made no image, video or sound. |
private_output | The result is kept private: it was made from private inputs, it is a preview render, or it was made in a workspace. |
content_filtered | Its prompt or name trips the content filter that keeps work out of the public gallery. |
restricted | An administrator restricted it. |
workspace | It is a session or project of a workspace. Work in a workspace is never public. |
sharing_disabled | This deployment does not allow public work, so no link opens there. |
A link also never shows a job in the Trash, an item removed from its session, a step of a larger run, or a deleted session or project. Nothing of a blocked account is shown.
All of this is decided again on every read. A result that is moved to the Trash or restricted after it was shared stops showing at once. Its link answers 404, and a session's link simply stops listing it.
A link to a job you moved to the Trash keeps its state. GET /v1/shares still reads it, and PUT /v1/shares with shared: false turns it off, so the link does not come back on when you restore the job. The link cannot be turned on while the job is in the Trash.
A session that is archived still opens through its own link. A shared project lists only its unarchived sessions.
The share card for link previews
A link pasted on a social network or in a chat shows a preview. The preview is read from the HTML of the link's address, with no script run. The address to share is the share card:
https://nodaro.ai/s/<token>The card answers 200 text/html, a small page. Its tags come in the first bytes of its <head>, right after the charset and the <title>:
og:title,og:description, andog:imagewithog:image:secure_url,og:image:type,og:image:widthandog:image:heightwhen they are known, andog:image:alt.og:type(video.otherfor a video, elsewebsite),og:site_name(Nodaro) andog:locale.og:urland<link rel="canonical">, both the card's own address.twitter:card(summary_large_image),twitter:title,twitter:description,twitter:imageandtwitter:image:alt.- For a video,
og:video, with itssecure_url, itstype, and its width and height when they are known. - For a sound,
og:audio, with itssecure_urland itstype.
The video and sound tags are written only when the file is on Nodaro's own storage.
The card's title and description
The title is the result's own name, then the tool that made it: Lady's on the Loose · Song Mashup. The name is chosen in this order:
- The name its owner gave the result.
- Its trend's name. A trend run is named by its trend, never by a prompt.
- The song's own title (
songTitle). - The start of its prompt as a person reads it (
displayPrompt):@Maya, never@maya:1.
The tool is toolName. A shared session or project is named by its title or name.
The description is one line that says what the item is and that it was made with Nodaro. For example: "A song made with Nodaro", "A video made with Nodaro", "3 results made with Nodaro" or "Made with the Office Dance trend on Nodaro". The line is written in the language the link was shared in (locale). The card speaks English, German, Spanish, Hebrew, Japanese, Korean and Portuguese, and any other language reads as English. The page's lang, dir="rtl" for Hebrew, and og:locale follow the same language.
The card's picture
The picture is always on Nodaro's own storage. It is a 1200×630 JPEG, under 300 KB, made for the link:
| Item | Picture |
|---|---|
| An image | The image whole, over a blurred, darkened fill of itself. |
| A video | Its poster, else its first frame, with a play badge. |
| A song or a voice | Its art, that is the result's cover, else the Nodaro tile, with a play badge and its own name drawn beside it. |
| A session or a project | A grid of the pictures of its first results, up to four. |
The name on a song or voice picture is drawn only when every character can be drawn: Latin, Greek, Cyrillic and Hebrew, which reads right to left. For any other name, the picture has no text.
The picture is made once, when the link is turned on. It is made again only when what it shows changes, for example a renamed result or a new cover. Each version has its own address.
A card read before its picture is ready shows the result's own picture when that picture is on Nodaro's storage, else the Nodaro card. Such a card may be cached for one minute only (Cache-Control: public, max-age=60). A card never hands out the reference files, whatever the link allows.
Where the card sends people
The card sends people on at once to the page that shows the link, https://nodaro.ai/shared/<token>. It does this with a <meta http-equiv="refresh">, a one-line script and a plain link.
Every value on the card is HTML-escaped, and only https addresses are written. The card's Content-Security-Policy allows that one script and nothing else. The card says noindex, in an X-Robots-Tag header and a robots meta tag.
A link that is unknown, turned off, or whose item is gone or may not be shown answers a 404 page. That page says nothing about any content.
On a self-hosted install, the share site serves the card and the page. It is set in the install's configuration. See Configuration.
Rate limits and caching
| Read | Limit per network | Caching |
|---|---|---|
GET /v1/public/shares/:token | 60 a minute | Never cached (Cache-Control: no-store) |
GET /v1/public/shares/:token/items | 120 a minute | Never cached (Cache-Control: no-store) |
The share card, /s/<token> | 120 a minute | Up to 5 minutes (Cache-Control: public, max-age=300), or 1 minute until its picture is ready |
A read over its limit answers 429 rate_limit_exceeded. Because the card may be cached, a link you turn off stops previewing within minutes. The card's 404 page is never cached. See Rate limits.
Scopes for OAuth apps
| Route | Scope |
|---|---|
GET /v1/shares | jobs:read |
PUT /v1/shares | Both assets:write and jobs:read, because the token it hands back reads what the link shows |
GET /v1/public/shares/:token and its items | None |
A personal API token that is limited to some workflows cannot reach GET /v1/shares or PUT /v1/shares. See OAuth.
From the SDK
client.shares has get, set, getPublic and publicItems. getPublic and publicItems work signed out. See Share links in the SDK.
Frequently asked questions
How do I share a Nodaro result by link through the API?
Send PUT /v1/shares with kind job, the job's id as targetId and shared true. The answer holds the link's token. Anyone can then read what the link shows with GET /v1/public/shares/:token, with no credential.
What does a Nodaro share link show?
The finished result or results, the prompt as it was written, the model and the settings. It never shows an address or an id from the settings. With allowCopy on, it also lists the reference files the result was made from.
What happens when I turn a share link off and on again?
Turned off, the link answers 404. Turned on again, the same token comes back, so a link you handed out before works again. Each item has one link.
Why does PUT /v1/shares answer 422 share_not_allowed?
The item cannot be shared now. The reason field says why, for example not_completed for a job that has not finished, or workspace for work in a workspace. No link was made or turned on.
Which address should I post on a social network?
Post the share card, https://nodaro.ai/s/ followed by the token. Its HTML carries the Open Graph and Twitter tags for the preview, and it sends people on to the page that shows the link.
Related
Jobs
Nodes
Share links
OAuth apps
Errors
Last updated on
Webhooks
Get signed job.completed and job.failed events on your server, start workflows from a Webhook Trigger URL, create schedules and send results out.
Characters
Create, update, archive and restore characters over REST, generate portrait candidates, expressions, angles and motion clips, and approve the anchor portrait.