The plain DELETE endpoint returns 405 for stopped workspaces. Use
POST /workspaces/:id/builds with {"transition":"delete"} instead,
which is the correct Coder API for workspace deletion.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.6
parent
66649022ca
commit
0812a9be37
@@ -109,12 +109,14 @@ export class CoderClient {
|
||||
|
||||
async deleteWorkspace(workspaceId: string): Promise<void> {
|
||||
const res = await fetch(
|
||||
`${this.baseUrl}/api/v2/workspaces/${workspaceId}`,
|
||||
`${this.baseUrl}/api/v2/workspaces/${workspaceId}/builds`,
|
||||
{
|
||||
method: "DELETE",
|
||||
method: "POST",
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
"Coder-Session-Token": this.token,
|
||||
},
|
||||
body: JSON.stringify({ transition: "delete" }),
|
||||
},
|
||||
);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user