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

# Delete a Connection

> Deletes a connection. It must not be referenced by an active routing rule.

Deletes a connection you previously created. The connection moves to `DELETED` status and stops being available to routing. Returns `204 No Content` on success.

<Warning>
  A connection that is still referenced by an active routing rule cannot be deleted — the request fails with `409 CONNECTION_IN_USE`. Detach it from your routes first, then retry.
</Warning>

### Path Parameters

<ParamField path="connection_id" type="string" required>
  The id returned by [Create a Connection](/reference/organizations/connections/create-connection). Must belong to the account your API key is scoped to.
</ParamField>

### Headers

<ParamField header="X-Account-Code" type="string" required>
  UUID of the account the connection belongs to.
</ParamField>

### Response

Returns `204 No Content` with an empty body.

<CodeGroup>
  ```bash cURL theme={"theme":{"light":"github-dark","dark":"github-dark-dimmed"}}
  curl -X DELETE 'https://api.y.uno/v1/connections/f1a3c4d5-7b8e-4a2c-9d1e-3f4a5b6c7d8e' \
    -H 'public-api-key: <YOUR_PUBLIC_KEY>' \
    -H 'private-secret-key: <YOUR_SECRET_KEY>' \
    -H 'X-Account-Code: a1b2c3d4-e5f6-7890-abcd-ef1234567890'
  ```

  ```json 409 — In Use theme={"theme":{"light":"github-dark","dark":"github-dark-dimmed"}}
  {
    "type": "conflict",
    "code": "CONNECTION_IN_USE",
    "message": "Connection 'f1a3c4d5-7b8e-4a2c-9d1e-3f4a5b6c7d8e' is still referenced by an active routing rule",
    "details": { "connection_id": "f1a3c4d5-7b8e-4a2c-9d1e-3f4a5b6c7d8e" }
  }
  ```

  ```json 404 Not Found theme={"theme":{"light":"github-dark","dark":"github-dark-dimmed"}}
  {
    "type": "not_found",
    "code": "CONNECTION_NOT_FOUND",
    "message": "Connection '...' was not found",
    "details": { "connection_id": "..." }
  }
  ```
</CodeGroup>

### Errors

<div className="code-nowrap-table dense-table">
  | HTTP  | `code`                                                                                         |
  | ----- | ---------------------------------------------------------------------------------------------- |
  | `401` | `NOT_AUTHENTICATED`<br />Missing or invalid API key.                                           |
  | `404` | `CONNECTION_NOT_FOUND`<br />Unknown `connection_id`, or the id belongs to a different account. |
  | `409` | `CONNECTION_IN_USE`<br />The connection is still referenced by an active routing rule.         |
</div>


## OpenAPI

````yaml openapi/organizations/connections/delete-connection.json DELETE /connections/{connection_id}
openapi: 3.1.0
info:
  title: Connections API - Delete
  version: 1.0.0
servers:
  - url: https://api-sandbox.y.uno/v1
  - url: https://api.eu.y.uno/v1
security:
  - sec0: []
    sec1: []
paths:
  /connections/{connection_id}:
    delete:
      summary: Delete a Connection
      description: >-
        Deletes a connection. The connection moves to DELETED status and stops
        being available to routing.
      operationId: delete-connection
      parameters:
        - name: connection_id
          in: path
          required: true
          schema:
            type: string
            format: uuid
        - name: X-Account-Code
          in: header
          required: true
          schema:
            type: string
            format: uuid
      responses:
        '204':
          description: No Content
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                type: object
                properties:
                  type:
                    type: string
                    example: auth_error
                  code:
                    type: string
                    example: NOT_AUTHENTICATED
                  message:
                    type: string
                    example: Not authenticated
        '404':
          description: Not Found
          content:
            application/json:
              schema:
                type: object
                properties:
                  type:
                    type: string
                    example: not_found
                  code:
                    type: string
                    example: CONNECTION_NOT_FOUND
                  message:
                    type: string
                    example: Connection '...' was not found
        '409':
          description: Conflict
          content:
            application/json:
              schema:
                type: object
                properties:
                  type:
                    type: string
                    example: conflict
                  code:
                    type: string
                    example: CONNECTION_IN_USE
                  message:
                    type: string
                    example: >-
                      Connection '...' is still referenced by an active routing
                      rule
components:
  securitySchemes:
    sec0:
      type: apiKey
      in: header
      name: PUBLIC-API-KEY
      x-default: <Your PUBLIC-API-KEY>
    sec1:
      type: apiKey
      in: header
      name: PRIVATE-SECRET-KEY
      x-default: <Your PRIVATE-SECRET-KEY>

````