Publications

Manage publications — the configuration that makes an agent embeddable on external sites.

The workspace Publish tab uses these endpoints. After publishing, visitors can chat via the hosted iframe or the Embed API without API keys. Inference runs on your team's account.

Publishing and embedding agents — workspace workflow, origins, themes, and iframe snippets


Authentication

ScopeAccess
apps:readList and get publications
agents:writeCreate, update, and delete publications

Create keys in Settings → API Keys. You must have write permission on the agent being published — the API enforces ownership in the service layer.


Publication object

FieldTypeDescription
idstringPublication ID
resource_typestringResource kind (agent is the only supported value today)
resource_idstringAgent ID
namespacestringAgent namespace (set from the agent on create)
namestringAgent name (set from the agent on create)
allowed_originsstring[]Origins allowed to embed or call the embed API. Empty = all origins.
rate_limit_rpmnumberOptional per-publication rate limit (requests per minute)
themeobjectOptional light / dark color tokens for the embed UI
labelstringOptional display label
enabledbooleanWhether the publication is active

Theme colors (theme.light, optional theme.dark):

FieldDescription
primaryPrimary accent color
secondarySecondary accent color
backgroundChat background
textBody text color
borderBorder color (optional)

List publications for a resource

GET /publications?resource_type=agent&resource_id={agentId}

Returns all publications for the given resource (including disabled). Requires apps:read.

Both query parameters are required.

bash
1curl "https://api.inference.sh/publications?resource_type=agent&resource_id=agent_abc123" \2  -H "Authorization: Bearer inf_your_key" \3  -H "X-API-Version: 2"

Get publication

GET /publications/{id}

Returns a single publication by ID. Requires apps:read.

bash
1curl https://api.inference.sh/publications/pub_abc123 \2  -H "Authorization: Bearer inf_your_key" \3  -H "X-API-Version: 2"

Create publication

POST /publications

Publishes an agent. Requires agents:write and write access to the agent.

Request

FieldTypeRequiredDescription
resource_typestringYesagent
resource_idstringYesAgent ID to publish
allowed_originsstring[]NoOrigin allowlist (default: allow all)
themeobjectNoEmbed UI branding colors
labelstringNoOptional label
rate_limit_rpmnumberNoOptional rate limit

namespace and name are populated from the agent. New publications are created with enabled: true.

bash
1curl -X POST https://api.inference.sh/publications \2  -H "Authorization: Bearer inf_your_key" \3  -H "Content-Type: application/json" \4  -H "X-API-Version: 2" \5  -d '{6    "resource_type": "agent",7    "resource_id": "agent_abc123",8    "allowed_origins": ["https://example.com"]9  }'

Errors

HTTPWhen
400Invalid body, agent not found, or insufficient permission on the agent
403API key lacks agents:write scope

Update publication

PUT /publications/{id}

Update origins, theme, label, rate limit, or other fields. Requires agents:write.

Send the fields you want to persist (the workspace sends the full publication object).

bash
1curl -X PUT https://api.inference.sh/publications/pub_abc123 \2  -H "Authorization: Bearer inf_your_key" \3  -H "Content-Type: application/json" \4  -H "X-API-Version: 2" \5  -d '{6    "allowed_origins": ["https://example.com", "https://app.example.com"],7    "theme": {8      "light": {9        "primary": "#000000",10        "secondary": "#666666",11        "background": "#ffffff",12        "text": "#000000"13      }14    }15  }'

Delete publication

DELETE /publications/{id}

Unpublish an agent (removes the publication record). Requires agents:write.

bash
1curl -X DELETE https://api.inference.sh/publications/pub_abc123 \2  -H "Authorization: Bearer inf_your_key" \3  -H "X-API-Version: 2"

Response

json
1{ "deleted": true }

After publishing

SurfaceURL / path
Hosted iframehttps://app.inference.sh/embed/agents/{namespace}/{name}
Embed APIGET /embed/agents/{namespace}/{name}, POST /embed/agents/run, …

See Embed API for anonymous chat endpoints and Publishing for origin rules and host-page context.


we use cookies

we use cookies to ensure you get the best experience on our website. for more information on how we use cookies, please see our cookie policy.

by clicking "accept", you agree to our use of cookies.
learn more.