Skip to main content
PATCH
/
assistant
/
v1
/
update
curl --request PATCH \
  --url https://api.langdock.com/assistant/v1/update \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "assistantId": "550e8400-e29b-41d4-a716-446655440000",
  "name": "Advanced Document Analyzer",
  "description": "Analyzes documents with enhanced capabilities",
  "creativity": 0.7
}
'
{
  "status": "success",
  "message": "Assistant updated successfully",
  "assistant": {
    "id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
    "name": "<string>",
    "emojiIcon": "<string>",
    "model": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
    "temperature": 0.5,
    "inputType": "PROMPT",
    "webSearchEnabled": true,
    "imageGenerationEnabled": true,
    "codeInterpreterEnabled": true,
    "canvasEnabled": true,
    "createdAt": "2023-11-07T05:31:56Z",
    "updatedAt": "2023-11-07T05:31:56Z",
    "description": "<string>",
    "instruction": "<string>",
    "conversationStarters": [
      "<string>"
    ],
    "actions": [
      {
        "actionId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
        "requiresConfirmation": true
      }
    ],
    "inputFields": [
      {
        "slug": "<string>",
        "type": "TEXT",
        "label": "<string>",
        "required": true,
        "order": 1,
        "description": "<string>",
        "options": [
          "<string>"
        ],
        "fileTypes": [
          "<string>"
        ]
      }
    ],
    "attachments": [
      "3c90c3cc-0d44-4b50-8888-8dd25736052a"
    ]
  }
}
Updates an existing assistant in your workspace. Only the fields you provide will be updated, allowing for partial updates without affecting other configuration.
Requires an API key with the ASSISTANT_API scope and access to the assistant you want to update.

Update Behavior

The update endpoint uses partial update semantics with specific behavior for different field types:
  • Partial updates - Only fields provided in the request are updated; omitted fields remain unchanged
  • Array fields replace - actions, inputFields, conversationStarters, and attachments completely replace existing values when provided
  • Empty arrays - Send [] to remove all actions/fields/attachments
  • Null handling - Send null for emoji, description, or instruction to clear them
  • Unchanged fields - Fields not included in the request retain their current values

Request Parameters

All fields are optional except assistantId:
ParameterTypeRequiredDescription
assistantIdstringYesUUID of the assistant to update
namestringNoUpdated name (1-255 characters)
descriptionstringNoUpdated description (max 256 chars, null to clear)
emojistringNoUpdated emoji icon (null to clear)
instructionstringNoUpdated system prompt (max 16384 chars, null to clear)
modelstringNoUpdated model UUID
creativitynumberNoUpdated temperature between 0-1
conversationStartersstring[]NoUpdated array of suggested prompts (replaces existing)
actionsarrayNoUpdated array of actions (replaces existing)
inputFieldsarrayNoUpdated array of form fields (replaces existing)
attachmentsstring[]NoUpdated array of attachment UUIDs (replaces existing)
webSearchbooleanNoUpdated web search capability setting
imageGenerationbooleanNoUpdated image generation capability setting
dataAnalystbooleanNoUpdated code interpreter capability setting
canvasbooleanNoUpdated canvas capability setting
Array fields (actions, inputFields, conversationStarters, attachments) are replaced entirely, not merged. Always provide the complete desired array, including any existing items you want to keep.

Actions Configuration

Each action in the actions array should contain:
  • actionId (required) - UUID of the action from an enabled integration
  • requiresConfirmation (optional) - Whether to require user confirmation before executing

Input Fields Configuration

For inputFields array structure, see the Create Assistant API documentation.

Examples

Updating Basic Properties

const axios = require("axios");

async function updateAssistantName() {
  const response = await axios.patch(
    "https://api.langdock.com/api/public/assistant/v1/update",
    {
      assistantId: "550e8400-e29b-41d4-a716-446655440000",
      name: "Advanced Document Analyzer",
      description: "Analyzes documents with enhanced capabilities",
      creativity: 0.7
    },
    {
      headers: {
        Authorization: "Bearer YOUR_API_KEY",
        "Content-Type": "application/json"
      }
    }
  );

  console.log("Assistant updated:", response.data.message);
}

Validation Rules

The API enforces several validation rules:
  • Assistant access - Your API key must have access to the assistant
  • Workspace match - Assistant must belong to the same workspace as your API key
  • Model - If provided, must be in your workspace’s active models list
  • Actions - If provided, must belong to integrations enabled in your workspace
  • Attachments - If provided, must exist in your workspace and not be deleted
  • Name - If provided, must be between 1-255 characters
  • Description - If provided, maximum 256 characters
  • Instruction - If provided, maximum 16384 characters
  • Creativity - If provided, must be between 0 and 1

Response Format

Success Response (200 OK)

{
  status: "success";
  message: "Assistant updated successfully";
  assistant: {
    id: string;
    name: string;
    description: string;
    instruction: string;
    emojiIcon: string;
    model: string;
    temperature: number;
    conversationStarters: string[];
    inputType: "PROMPT" | "STRUCTURED";
    webSearchEnabled: boolean;
    imageGenerationEnabled: boolean;
    codeInterpreterEnabled: boolean;
    canvasEnabled: boolean;
    actions: Array<{
      actionId: string;
      requiresConfirmation: boolean;
    }>;
    inputFields: Array<{
      slug: string;
      type: string;
      label: string;
      description: string;
      required: boolean;
      order: number;
      options: string[];
      fileTypes: string[] | null;
    }>;
    attachments: string[];
    createdAt: string;
    updatedAt: string;
  };
}

Error Handling

try {
  const response = await axios.patch('https://api.langdock.com/api/public/assistant/v1/update', ...);
} catch (error) {
  if (error.response) {
    switch (error.response.status) {
      case 400:
        console.error('Invalid parameters:', error.response.data.message);
        break;
      case 401:
        console.error('Invalid or missing API key');
        break;
      case 403:
        console.error('Insufficient permissions - no access to this assistant');
        break;
      case 404:
        console.error('Assistant not found or resource not found (model, action, attachment)');
        break;
      case 500:
        console.error('Server error');
        break;
    }
  }
}

Best Practices

Preserving existing values: When updating array fields like actions or attachments, always include existing items you want to keep, as the entire array is replaced.
  1. Fetch before update - If you need to preserve existing array values, fetch the current assistant configuration first
  2. Incremental updates - Update only the fields that need to change
  3. Validate attachments - Ensure attachment UUIDs are valid before including them
  4. Test actions - Verify actions belong to enabled integrations before updating
  5. Handle errors gracefully - Implement proper error handling for validation failures

Authorizations

Authorization
string
header
required

API key as Bearer token. Format "Bearer YOUR_API_KEY"

Body

application/json
assistantId
string<uuid>
required

UUID of the assistant to update

name
string

Updated name

Required string length: 1 - 255
description
string | null

Updated description (null to clear)

Maximum string length: 256
emoji
string | null

Updated emoji icon (null to clear)

instruction
string | null

Updated system prompt (null to clear)

Maximum string length: 16384
inputType
enum<string>

Updated input type for the assistant

Available options:
PROMPT,
STRUCTURED
model
string<uuid>

Updated model UUID

creativity
number

Updated temperature

Required range: 0 <= x <= 1
conversationStarters
string[]

Updated array of suggested prompts (replaces existing)

actions
object[]

Updated array of actions (replaces existing)

inputFields
object[]

Updated array of form fields (replaces existing)

attachments
string<uuid>[]

Updated array of attachment UUIDs (replaces existing)

Updated web search capability setting

imageGeneration
boolean

Updated image generation capability setting

dataAnalyst
boolean

Updated code interpreter capability setting

canvas
boolean

Updated canvas capability setting

Response

Assistant updated successfully

status
enum<string>
required
Available options:
success
message
string
required
Example:

"Assistant updated successfully"

assistant
object
required