> ## 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.

> ## Agent Instructions
> Test in the sandbox first: base URL https://api-sandbox.y.uno (Test Mode in the Dashboard). Production is https://api.y.uno (Live Mode).
> Every API request needs the public-api-key and private-secret-key headers. Get them in the Dashboard at https://dashboard.y.uno/developers (Developers > Credentials); sandbox and production keys are different.
> Send an X-Idempotency-Key (a UUID) when creating payments, refunds and cancels, so retries do not create duplicates.
> Start with the Quickstart (https://docs.y.uno/docs/quickstart.md) and the agent guide (https://docs.y.uno/agents.md). To search these docs from a coding agent, connect the docs MCP server at https://docs.y.uno/mcp.

# Excluir uma conexão

> Exclui uma conexão. Ela não pode estar referenciada por uma regra de roteamento ativa.

Exclui uma conexão que você criou anteriormente. Retorna `204 No Content` em caso de sucesso.

> [!WARNING]
>
> Problema conhecido: depois do `204`, a conexão continua aparecendo como `ACTIVE` quando você a consulta. A chamada não altera o status que a consulta retorna.

> [!WARNING]
>
> Uma conexão que ainda está referenciada por uma regra de roteamento ativa não pode ser excluída: a requisição falha com `409 CONNECTION_IN_USE`. Desvincule-a das suas rotas primeiro e tente de novo.

### Parâmetros de caminho

**connection\_id** `string` *required*

O id retornado por [Criar uma conexão](https://docs.y.uno/pt-br/reference/organizations/connections/create-connection.md). Deve pertencer à conta à qual a sua chave de API está vinculada.

### Cabeçalhos

**X-Account-Code** `string` *required*

UUID da conta à qual a conexão pertence.

### Resposta

Retorna `204 No Content` com o corpo vazio.

```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": "..." }
}
```

### Erros

| HTTP | `code` |
| - | - |
| `401` | `NOT_AUTHENTICATED` Chave de API ausente ou inválida. |
| `404` | `CONNECTION_NOT_FOUND` `connection_id` desconhecido, ou o id pertence a outra conta. |
| `409` | `CONNECTION_IN_USE` A conexão ainda está referenciada por uma regra de roteamento ativa. |


## OpenAPI

````yaml openapi/pt-br/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
    description: Sandbox
  - url: https://api.y.uno/v1
    description: Production (US)
security:
  - sec0: []
    sec1: []
paths:
  /connections/{connection_id}:
    delete:
      summary: Excluir uma conexão
      description: >-
        Exclui uma conexão. Problema conhecido: a chamada retorna 204, mas
        consultar a conexão depois ainda retorna ACTIVE.
      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: Sem conteúdo
        '401':
          description: Não autorizado
          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: Não encontrado
          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: Conflito
          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>

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.