> ## Documentation Index
> Fetch the complete documentation index at: https://docs.cerca.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Delete connection



## OpenAPI

````yaml https://app.stainless.com/api/spec/documented/cerca/openapi.documented.yml delete /connections/{connectionId}
openapi: 3.1.0
info:
  description: API-key accessible routes for Cerca agents.
  title: Cerca API
  version: 0.0.0
servers:
  - url: https://api.cerca.dev
security:
  - bearerAuth: []
paths:
  /connections/{connectionId}:
    delete:
      tags:
        - Connections
      summary: Delete connection
      parameters:
        - schema:
            type: string
            minLength: 1
            format: uuid
            example: 9f063c59-2775-4614-8a68-22e5f90f92f3
          required: true
          in: path
          name: connectionId
        - schema:
            type: string
            enum:
              - organization
              - fleet
            description: Public connection owner type.
            example: fleet
          required: true
          description: Public connection owner type.
          name: ownerType
          in: query
        - schema:
            type: string
            description: Required when ownerType is fleet.
            example: fleet_abc123
          required: false
          description: Required when ownerType is fleet.
          name: fleetId
          in: query
      responses:
        '200':
          description: Reusable connection deleted.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/DeleteConnectionResponse'
        '400':
          description: Invalid request.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '401':
          description: Authentication required.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '403':
          description: Not authorized for this connection owner.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '404':
          description: Requested connection owner or connection was not found.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '415':
          description: Content-Type must be application/json.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        default:
          description: Error response.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
      security:
        - bearerAuth: []
      x-codeSamples:
        - lang: JavaScript
          source: >-
            import Cerca from '@cerca-dev/sdk';


            const client = new Cerca({
              apiKey: process.env['CERCA_API_KEY'], // This is the default and can be omitted
            });


            const connection = await
            client.connections.delete('9f063c59-2775-4614-8a68-22e5f90f92f3', {
              ownerType: 'fleet',
            });


            console.log(connection.success);
        - lang: Python
          source: |-
            import os
            from cerca import Cerca

            client = Cerca(
                api_key=os.environ.get("CERCA_API_KEY"),  # This is the default and can be omitted
            )
            connection = client.connections.delete(
                connection_id="9f063c59-2775-4614-8a68-22e5f90f92f3",
                owner_type="fleet",
            )
            print(connection.success)
        - lang: Go
          source: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/matrices/cerca-go\"\n\t\"github.com/matrices/cerca-go/option\"\n)\n\nfunc main() {\n\tclient := cercago.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tconnection, err := client.Connections.Delete(\n\t\tcontext.TODO(),\n\t\t\"9f063c59-2775-4614-8a68-22e5f90f92f3\",\n\t\tcercago.ConnectionDeleteParams{\n\t\t\tOwnerType: cercago.F(cercago.ConnectionDeleteParamsOwnerTypeFleet),\n\t\t},\n\t)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", connection.Success)\n}\n"
        - lang: Ruby
          source: >-
            require "cerca"


            cerca = Cerca::Client.new(api_key: "My API Key")


            connection =
            cerca.connections.delete("9f063c59-2775-4614-8a68-22e5f90f92f3",
            owner_type: :fleet)


            puts(connection)
        - lang: CLI
          source: |-
            cerca connections delete \
              --api-key 'My API Key' \
              --connection-id 9f063c59-2775-4614-8a68-22e5f90f92f3 \
              --owner-type fleet
components:
  schemas:
    DeleteConnectionResponse:
      type: object
      properties:
        success:
          type: boolean
          enum:
            - true
          x-stainless-const: true
      required:
        - success
    ErrorResponse:
      type: object
      properties:
        error:
          type: string
        code:
          type: string
          description: Stable machine-readable error code when the API can provide one.
          example: MONTHLY_TOKEN_BUDGET_EXCEEDED
      required:
        - error
  securitySchemes:
    bearerAuth:
      bearerFormat: Cerca API key
      scheme: bearer
      type: http

````