/v1/workspaces/{workspace_slug}/avatar/from-urlAuthSet the workspace image from a website or image address
Resolves the address exactly like `POST …/avatar/from-url/preview`, then stores the result like an upload: re-encoded to webp (at most 512 px) in ProductCraft storage, never hotlinked. The normalised address is kept as the workspace's `avatar_source_url`, so calling this again with it refreshes the image. Uploading a file or clearing the image clears it. Gated by `workspace.settings.update`.
Path parameters
workspace_slug*stringSlug of the workspace. Platform routes name the workspace by slug, positionally in the SDK (`platform.workspaces.retrieve("acme")`); the product APIs bind `workspace_id` instead.
Headers
Idempotency-KeystringOpaque client-generated string (1-256 chars, `[A-Za-z0-9._:-]`) that deduplicates retries for 24 h. A retry with the same key and body returns the first response with `Idempotent-Replay: true` instead of creating a second resource. The SDKs send one on every create.
Request body
url*string · uriA website or an image address. An image is used as is; for a page, its icon is used (apple-touch-icon, then `<link rel="icon">`, then the web app manifest, then `/favicon.ico`). `https://` is assumed when no scheme is given, and `http://` is upgraded to `https://`.
Example: "https://acme.com"
Response · 200 Image set.
avatar_url*string · uriShort-lived (15 min) URL of the stored image. The image is re-hosted by ProductCraft, never linked to the source site.
source_url*string · uriThe address that was given, normalised; stored so the image can be refreshed from it.
Example: "https://acme.com/"
image_url*string · uriThe image that was used.
Example: "https://acme.com/apple-touch-icon.png"
source_kind*objectWhere the image came from. Open enum: new values may be added.
Example: "apple_touch_icon"
site_host*stringHost of the site the image came from (after redirects).
Example: "acme.com"
width*numberStored width in px (at most 512).
Example: 180
height*numberStored height in px (at most 512).
Example: 180
Example
Request
POST https://api.platform-auth.productcraft.co/v1/workspaces/{workspace_slug}/avatar/from-url
Authorization: Bearer YOUR_TOKEN
Content-Type: application/json
{
"url": "https://acme.com"
}Response
{
"avatar_url": "string",
"source_url": "https://acme.com/",
"image_url": "https://acme.com/apple-touch-icon.png",
"source_kind": "apple_touch_icon",
"site_host": "acme.com",
"width": 180,
"height": 180
}