Skip to main content
POST
/
agent
/
v1
/
publish
Publishes a draft agent as a new version
curl --request POST \
  --url https://api.langdock.com/agent/v1/publish \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "agentId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
  "description": "<string>"
}
'
{
  "status": "<string>",
  "message": "<string>",
  "version": {
    "id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
    "version": 123,
    "createdAt": "2023-11-07T05:31:56Z"
  }
}

Documentation Index

Fetch the complete documentation index at: https://docs.langdock.com/llms.txt

Use this file to discover all available pages before exploring further.

⚠️ Using our API via a dedicated deployment? Just replace api.langdock.com with your deployment’s base URL: <deployment-url>/api/public
This is the new Agents API with native Vercel AI SDK compatibility. If you’re using the legacy Assistants API, see the migration guide.
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. 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

Request Parameters

ParameterTypeRequiredDescription
agentIdstringYesUUID of the agent to publish
descriptionstringNoShort change description shown in version history (max 100 characters)

Example

const axios = require("axios");

async function publishAgent(agentId, description) {
  const response = await axios.post(
    "https://api.langdock.com/agent/v1/publish",
    {
      agentId: agentId,
      description: description,
    },
    {
      headers: {
        Authorization: "Bearer YOUR_API_KEY",
        "Content-Type": "application/json",
      },
    },
  );

  console.log("Published version:", response.data.version);
}

publishAgent(
  "550e8400-e29b-41d4-a716-446655440000",
  "Tightened the system prompt",
);

Response Format

Success Response (200 OK)

{
  status: "success";
  message: "Agent published successfully";
  version: {
    id: string;          // UUID of the new version
    version: number;     // Monotonically increasing version number
    createdAt: string;   // ISO 8601 timestamp
  };
}

Validation Rules

  • Agent access — The API key must have owner or editor access 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 return 403.
  • 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

Status CodeDescription
400Invalid request body (missing or malformed agentId / description too long)
401Invalid or missing API key
403API key does not have edit access, the agent is in a different workspace, or the resource is a project
409No draft changes to publish
429Rate limit exceeded
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

Authorization
string
header
required

API key as Bearer token. Format "Bearer YOUR_API_KEY"

Body

application/json
agentId
string<uuid>
required

UUID of the agent to publish

description
string

Optional change description shown in version history

Maximum string length: 100

Response

Agent published successfully

status
string
message
string
version
object