For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://modelgates.ai/docs/_mcp/server.

Delete a workspace

DELETE https://modelgates.ai/api/v1/workspaces/

Delete an existing workspace. The default workspace cannot be deleted. Workspaces with active API keys cannot be deleted. Management key required.

Reference: https://modelgates.ai/docs/api/api-reference/workspaces/delete-workspace

OpenAPI Specification

yaml
openapi: 3.1.0info:  title: ModelGates API  version: 1.0.0paths:  /workspaces/:    delete:      operationId: delete-workspace      summary: Delete a workspace      description: >-        Delete an existing workspace. The default workspace cannot be deleted.        Workspaces with active API keys cannot be deleted. [Management        key](/docs/guides/overview/auth/management-api-keys) required.      tags:        - subpackage_workspaces      parameters:        - name: id          in: path          description: The workspace ID (UUID) or slug          required: true          schema:            type: string        - name: Authorization          in: header          description: API key as bearer token in Authorization header          required: true          schema:            type: string      responses:        '200':          description: Workspace deleted successfully          content:            application/json:              schema:                $ref: '#/components/schemas/DeleteWorkspaceResponse'        '400':          description: Bad Request - Invalid request parameters or malformed input          content:            application/json:              schema:                $ref: '#/components/schemas/BadRequestResponse'        '401':          description: Unauthorized - Authentication required or invalid credentials          content:            application/json:              schema:                $ref: '#/components/schemas/UnauthorizedResponse'        '403':          description: Forbidden - Authentication successful but insufficient permissions          content:            application/json:              schema:                $ref: '#/components/schemas/ForbiddenResponse'        '404':          description: Not Found - Resource does not exist          content:            application/json:              schema:                $ref: '#/components/schemas/NotFoundResponse'        '500':          description: Internal Server Error - Unexpected server error          content:            application/json:              schema:                $ref: '#/components/schemas/InternalServerResponse'servers:  - url: https://modelgates.ai/api/v1components:  schemas:    DeleteWorkspaceResponse:      type: object      properties:        deleted:          type: boolean          enum:            - true          description: Confirmation that the workspace was deleted      required:        - deleted      title: DeleteWorkspaceResponse    BadRequestResponseErrorData:      type: object      properties:        code:          type: integer        message:          type: string        metadata:          type:            - object            - 'null'          additionalProperties:            description: Any type      required:        - code        - message      description: Error data for BadRequestResponse      title: BadRequestResponseErrorData    BadRequestResponse:      type: object      properties:        error:          $ref: '#/components/schemas/BadRequestResponseErrorData'        modelgates_metadata:          type:            - object            - 'null'          additionalProperties:            description: Any type        user_id:          type:            - string            - 'null'      required:        - error      description: Bad Request - Invalid request parameters or malformed input      title: BadRequestResponse    UnauthorizedResponseErrorData:      type: object      properties:        code:          type: integer        message:          type: string        metadata:          type:            - object            - 'null'          additionalProperties:            description: Any type      required:        - code        - message      description: Error data for UnauthorizedResponse      title: UnauthorizedResponseErrorData    UnauthorizedResponse:      type: object      properties:        error:          $ref: '#/components/schemas/UnauthorizedResponseErrorData'        modelgates_metadata:          type:            - object            - 'null'          additionalProperties:            description: Any type        user_id:          type:            - string            - 'null'      required:        - error      description: Unauthorized - Authentication required or invalid credentials      title: UnauthorizedResponse    ForbiddenResponseErrorData:      type: object      properties:        code:          type: integer        message:          type: string        metadata:          type:            - object            - 'null'          additionalProperties:            description: Any type      required:        - code        - message      description: Error data for ForbiddenResponse      title: ForbiddenResponseErrorData    ForbiddenResponse:      type: object      properties:        error:          $ref: '#/components/schemas/ForbiddenResponseErrorData'        modelgates_metadata:          type:            - object            - 'null'          additionalProperties:            description: Any type        user_id:          type:            - string            - 'null'      required:        - error      description: Forbidden - Authentication successful but insufficient permissions      title: ForbiddenResponse    NotFoundResponseErrorData:      type: object      properties:        code:          type: integer        message:          type: string        metadata:          type:            - object            - 'null'          additionalProperties:            description: Any type      required:        - code        - message      description: Error data for NotFoundResponse      title: NotFoundResponseErrorData    NotFoundResponse:      type: object      properties:        error:          $ref: '#/components/schemas/NotFoundResponseErrorData'        modelgates_metadata:          type:            - object            - 'null'          additionalProperties:            description: Any type        user_id:          type:            - string            - 'null'      required:        - error      description: Not Found - Resource does not exist      title: NotFoundResponse    InternalServerResponseErrorData:      type: object      properties:        code:          type: integer        message:          type: string        metadata:          type:            - object            - 'null'          additionalProperties:            description: Any type      required:        - code        - message      description: Error data for InternalServerResponse      title: InternalServerResponseErrorData    InternalServerResponse:      type: object      properties:        error:          $ref: '#/components/schemas/InternalServerResponseErrorData'        modelgates_metadata:          type:            - object            - 'null'          additionalProperties:            description: Any type        user_id:          type:            - string            - 'null'      required:        - error      description: Internal Server Error - Unexpected server error      title: InternalServerResponse  securitySchemes:    apiKey:      type: http      scheme: bearer      description: API key as bearer token in Authorization header

SDK Code Examples

python
import requests url = "https://modelgates.ai/api/v1/workspaces/production" payload = {}headers = {    "Authorization": "Bearer <token>",    "Content-Type": "application/json"} response = requests.delete(url, json=payload, headers=headers) print(response.json())
javascript
const url = 'https://modelgates.ai/api/v1/workspaces/production';const options = {  method: 'DELETE',  headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},  body: '{}'}; try {  const response = await fetch(url, options);  const data = await response.json();  console.log(data);} catch (error) {  console.error(error);}
go
package main import (	"fmt"	"strings"	"net/http"	"io") func main() { 	url := "https://modelgates.ai/api/v1/workspaces/production" 	payload := strings.NewReader("{}") 	req, _ := http.NewRequest("DELETE", url, payload) 	req.Header.Add("Authorization", "Bearer <token>")	req.Header.Add("Content-Type", "application/json") 	res, _ := http.DefaultClient.Do(req) 	defer res.Body.Close()	body, _ := io.ReadAll(res.Body) 	fmt.Println(res)	fmt.Println(string(body)) }
ruby
require 'uri'require 'net/http' url = URI("https://modelgates.ai/api/v1/workspaces/production") http = Net::HTTP.new(url.host, url.port)http.use_ssl = true request = Net::HTTP::Delete.new(url)request["Authorization"] = 'Bearer <token>'request["Content-Type"] = 'application/json'request.body = "{}" response = http.request(request)puts response.read_body
java
import com.mashape.unirest.http.HttpResponse;import com.mashape.unirest.http.Unirest; HttpResponse<String> response = Unirest.delete("https://modelgates.ai/api/v1/workspaces/production")  .header("Authorization", "Bearer <token>")  .header("Content-Type", "application/json")  .body("{}")  .asString();
php
<?phprequire_once('vendor/autoload.php'); $client = new \GuzzleHttp\Client(); $response = $client->request('DELETE', 'https://modelgates.ai/api/v1/workspaces/production', [  'body' => '{}',  'headers' => [    'Authorization' => 'Bearer <token>',    'Content-Type' => 'application/json',  ],]); echo $response->getBody();
csharp
using RestSharp; var client = new RestClient("https://modelgates.ai/api/v1/workspaces/production");var request = new RestRequest(Method.DELETE);request.AddHeader("Authorization", "Bearer <token>");request.AddHeader("Content-Type", "application/json");request.AddParameter("application/json", "{}", ParameterType.RequestBody);IRestResponse response = client.Execute(request);
swift
import Foundation let headers = [  "Authorization": "Bearer <token>",  "Content-Type": "application/json"]let parameters = [] as [String : Any] let postData = JSONSerialization.data(withJSONObject: parameters, options: []) let request = NSMutableURLRequest(url: NSURL(string: "https://modelgates.ai/api/v1/workspaces/production")! as URL,                                        cachePolicy: .useProtocolCachePolicy,                                    timeoutInterval: 10.0)request.httpMethod = "DELETE"request.allHTTPHeaderFields = headersrequest.httpBody = postData as Data let session = URLSession.sharedlet dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in  if (error != nil) {    print(error as Any)  } else {    let httpResponse = response as? HTTPURLResponse    print(httpResponse)  }}) dataTask.resume()