Skip to main content

Delete template

Delete a specific template. If the template still has running or paused instances, the operation returns 409 and refuses to delete it.

Prerequisites

Configure the endpoint and authentication first. See API overview and authentication.

Endpoint

DELETE /templates/{templateCode} Delete a specific template. Deletion is blocked while active instances exist: if the template still has running or paused instances, the operation returns 409 and refuses to delete it. Release those instances first, then delete the template. No response body is returned on success.

Path parameters

ParameterRequiredTypeDescription
templateCodeYesstringUnique template code.

Request example

curl -X DELETE "$BASE_URL/templates/your-template-id" \
  -H "Authorization: Bearer $BAILIAN_API_KEY"
BASE_URL is https://{workspace_id}.cn-beijing.maas.aliyuncs.com/api/v1/agentstudio/sandbox, and BAILIAN_API_KEY is your Alibaba Cloud Model Studio API key.

Response

Returns 204 with no response body on success. If the template still has active instances, the operation returns 409 and you must release the associated instances first. The error response body contains the following fields:
FieldTypeDescription
codeintegerError code.
messagestringError message, which retains sandboxId and sandboxInstanceId, for example template has running or paused sandbox instance, sandboxId=xxx, sandboxInstanceId=sbx-xxx.
requestIDstringRequest ID.
Managed Agent API
Flow Agent API
RAG API
Long-term Memory
ParseX API
Security API
Framework Integration