Publishes a draft agent as a new version
Agents API
Agent Publish API
Publish a draft agent as a new version
POST
Publishes a draft agent as a new version
Publishes the current draft of an agent as a new version. This mirrors the Update button in the agent editor: a published version is a frozen snapshot of the draft that becomes the active version users see.
Before You Start
- Legacy Assistants API: This is the new Agents API with native Vercel AI SDK compatibility. If you’re using the legacy Assistants API, see the migration guide.
Base URL
Draft vs. Published Version
Edits made via/agent/v1/update only affect the draft. Until you call publish, those changes are not visible to workspace members.
Use Cases
- Promote draft edits made via the Update API into a new active version
- Roll out changes programmatically as part of a CI/CD pipeline
- Release a new revision with an optional change description shown in version history
Parameters
Example
Response Format
Success Response (200 OK)
Validation Rules
- Agent access — The API key must have
owneroreditoraccess to the agent (same as Update). - Workspace match — The agent must belong to the same workspace as the API key.
- Agents only — Projects (
type=PROJECT) are not supported and will return403. - Has draft changes — The draft must differ from the latest published version. Publishing with no pending changes returns
409 Conflict, mirroring the disabled “Update” button in the UI.
Error Handling
Langdock intentionally blocks browser-origin requests to protect your API key and ensure your applications remain secure. For more information, please see our guide on API Key Best Practices.
Authorizations
API key as Bearer token. Format "Bearer YOUR_API_KEY"
Body
application/json