Before You Start
- API key scope: Requires an API key with the Agent API scope and edit access to the agent you want to update.
- 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.
- Draft settings: Configuration changes apply to the agent’s draft. Access changes take effect immediately and do not require publishing.
Base URL
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,attachments,knowledgeFolderIds,skillIds,subAgents, andworkflowIdscompletely replace existing values when provided - Empty arrays - Send
[]to remove all actions, fields, or attachments. ForskillIds,[]detaches every Skill and leaves file template attachments in place. ForsubAgentsandworkflowIds,[]detaches every subagent or workflow - Null handling - Send
nullforemojito clear it, andnullforiconto remove the uploaded image. Omiticonto keep the current image. Settingicondoes not clearemoji. Fordescriptionandinstruction, send an empty string""to clear them - Unchanged fields - Fields not included in the request retain their current values
Parameters
Set any of the parameters below to overwrite the agent’s current settings. Fields you omit stay unchanged. OnlyagentId is required.
Access Configuration
Use the access fields to add, change, or revoke individual grants. Omitted targets and empty arrays leave existing access unchanged. Revoking a direct grant does not remove access inherited through a group or the workspace; grants to inactive or former users can also be revoked. Access changes require an explicit editor or owner grant on the API key. A personal key owner’s edit access does not count for these changes. The key owner’s workspace sharing permissions also apply. Access changes are rejected whensharingManagedByAdmin is true.
Actions Configuration
Each action in theactions array should contain:
actionId(required) - UUID of the actionrequiresConfirmation(optional) - Whether to require user confirmation before executing (default: true)
Input Fields Configuration
ForinputFields array structure, see the Create Agent API documentation.
Examples
Updating Basic Properties
Validation Rules
The API enforces several validation rules:- Agent access - A personal key can update configuration when its owner can edit the agent, including through a group or the workspace, or when the key has an editor or owner grant. A workspace key needs that grant on the key. The User role and workspace admin status do not grant configuration updates.
- Workspace match - Agent 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, the array replaces the draft list. Omit an id to remove it.
- Draft action ids - Missing or soft-deleted ids already on the draft are dropped. Unavailable ids already on the draft stay.
- New action ids - Must exist and belong to integrations enabled in your workspace. Otherwise the request returns 400 with
missingActionIdsorunavailableActionIds. - Attachments - If provided, must exist in your workspace and not be deleted
- Folders - If provided, must exist in your workspace and not be deleted
- Skills - If provided, each ID must be a Skill the key owner can attach. File templates are rejected. A missing Skill returns 400 with
missingSkillIds. A Skill the owner cannot attach returns 400 withinaccessibleSkillIds - Draft subagent and workflow ids - Ids already on the draft are kept without a new check. Workflows does not need to be enabled for those ids.
- New subagents - Each new
agentIdmust be an agent in your workspace that the key owner can use. Direct only, attaching the agent to itself, and cycles are rejected. A missing agent returns 400 withmissingSubAgentIds. An agent the owner cannot use, or one set to Direct only, returns 400 withinaccessibleSubAgentIds. A cycle or attaching the agent to itself returns 400 withcyclicSubAgentIds - New workflows - Each new ID must be an active workflow the key owner can use. The key owner needs Workflows enabled. When it is not, new ids return 400 with
inaccessibleWorkflowIds. Otherwise a missing workflow, including a template, returns 400 withmissingWorkflowIds, and an inactive workflow returns 400 withinactiveWorkflowIds. A workflow the owner cannot use returns 400 withinaccessibleWorkflowIds - Sharing - Sharing permissions and targets are validated before any changes are saved
- Name - If provided, must be between 1-80 characters
- Description - If provided, maximum 800 characters
- Instruction - If provided, maximum 50000 characters
- Creativity - If provided, must be between 0 and 1
Response Format
agent.access is included only when the API key has an explicit editor or owner grant on the agent. It lists direct user, group, and workspace grants, excluding owner and API-key grants. sharingManagedByAdmin is read-only; when true, sharing cannot be changed through this API.
Success Response (200 OK)
preservedUnavailableActionIds is included only when the request kept unavailable ids that were already on the draft.
Error Handling
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.- Fetch before update - If you need to preserve existing array values, fetch the editable draft first with
version=draft. Default GET returns the published version when one exists, otherwise the draft. - Incremental updates - Update only the fields that need to change
- Validate attachments - Ensure attachment UUIDs are valid before including them
- Keep draft actions - Resubmit every action id you want to keep. Missing ids already on the draft are dropped. Unavailable ids already on the draft stay.
- Handle errors gracefully - Implement proper error handling for validation failures
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.