---
title: "Delete your company's repository connection"
url: https://docs.corefinity.com/api/reference/organisation/delete-own-deployment-connection
type: endpoint
last_updated: 2026-11-13
feature: deployment-connections
related:
  - https://docs.corefinity.com/guides/organisation/developers/repository-connections.md
---
# Delete your company's repository connection

Removes a connection of your own company. Only an owner of the company can remove one, and only while no
environment deploys through it. Removing cannot be undone, so send the connection's id as
`confirm_connection`.

```http
DELETE /api/company/deployment-connections/{connection}
```

- Scope: `write`
- Two-factor: required on your account (all)
- Rate limit: 10 a minute
- Try it in the console: off. It deletes data that cannot be brought back. Copy the request and run it yourself when you are sure.

## Path parameters

- `connection` (integer, required): The id of a connection, as the list answers it. Digits only.

## Body

- `confirm_connection` (integer or string, required): The id of the connection being removed, as a number or a string of digits.

## Request

### curl

```bash
curl -X DELETE https://manage.corefinity.com/api/company/deployment-connections/4217 \
  -H "Authorization: Bearer $COREFINITY_TOKEN" \
  -H "Accept: application/json" \
  -H "Content-Type: application/json" \
  -d '{
    "confirm_connection": 4217
  }'
```

### PHP

```php
use Illuminate\Support\Facades\Http;

$response = Http::withToken(env('COREFINITY_TOKEN'))
    ->acceptJson()
    ->delete('https://manage.corefinity.com/api/company/deployment-connections/4217', [
        'confirm_connection' => 4217,
    ]);

$data = $response->json();
```

### Node

```javascript
const res = await fetch('https://manage.corefinity.com/api/company/deployment-connections/4217', {
  method: 'DELETE',
  headers: {
    Authorization: `Bearer ${process.env.COREFINITY_TOKEN}`,
    Accept: 'application/json',
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    confirm_connection: 4217,
  }),
});

// An answer with no body (204) has nothing to parse.
const text = await res.text();
const data = text && JSON.parse(text);
```

### Python

```python
import os
import requests

res = requests.delete(
    "https://manage.corefinity.com/api/company/deployment-connections/4217",
    headers={
        "Authorization": f"Bearer {os.environ['COREFINITY_TOKEN']}",
        "Accept": "application/json",
    },
    json={
        "confirm_connection": 4217,
    },
)

data = res.json() if res.content else None
```

## Responses

### 200 The connection that was removed. Nothing else is deleted.

```json
{
  "removed": {
    "id": 4217,
    "provider": "gitlab",
    "username": "daniel-reyes"
  }
}
```

### 401 No token, or a token that is not valid.

```json
{
  "message": "Unauthenticated."
}
```

### 403 The token lacks the `write` scope (`scope_required`), your company requires two-factor authentication and you have not set it up, or you are not an owner (`forbidden`).

```json
{
  "code": "company_unavailable",
  "message": "Your company is unavailable.",
  "reason": "company_unavailable"
}
```

### 404 The id does not exist, or it is something you cannot see. Both answer the same body.

```json
{
  "message": "Not found."
}
```

### 409 Environments still deploy through the connection (`connection_in_use`). `environments` names the ones you can see and `other_environments` counts the rest. Choose another connection for each of them first.

```json
{
  "code": "connection_in_use",
  "environments": [
    {
      "environment_id": 1311,
      "name": "production",
      "site_id": null,
      "website": "Harbour & Finch trade",
      "website_id": 1310
    }
  ],
  "message": "This connection is still used by 1 environment: Harbour & Finch trade / production (environment 1311). Choose another connection in its deployment settings first; nothing was removed.",
  "other_environments": 0,
  "reason": "connection_in_use"
}
```

### 422 `confirm_connection` is missing or is not the connection's id (`confirm_mismatch`). Nothing was removed.

```json
{
  "code": "confirm_mismatch",
  "errors": {
    "confirm_connection": [
      "Removing the GitLab connection for daniel-reyes cannot be undone. To remove it, send confirm_connection set to its id, 4217. Nothing was removed."
    ]
  },
  "field": "confirm_connection",
  "message": "Removing the GitLab connection for daniel-reyes cannot be undone. To remove it, send confirm_connection set to its id, 4217. Nothing was removed.",
  "reason": "confirm_mismatch"
}
```

### 429 Too many requests (`rate_limited`). Wait for the number of seconds in `Retry-After`, which `retry_after_seconds` repeats.

```json
{
  "code": "rate_limited",
  "message": "Too many requests. Try again in 60 seconds.",
  "reason": "rate_limited",
  "retry_after_seconds": 60
}
```

## If it is refused

| Status | Reason | What to do |
|---|---|---|
| 401 |  | Send a valid token as `Authorization: Bearer <token>`. |
| 403 | `company_unavailable` | Your company is unavailable. |
| 403 | `forbidden` | The person is not allowed to do this. |
| 403 | `scope_required` | Use a token with the scope named in `scope`. |
| 403 | `two_factor_required` | Turn on two-factor on your account, then send again. |
| 404 |  | Check the id. You see only what your account can reach. |
| 409 | `connection_in_use` | This connection is still used by 1 environment: Harbour & Finch trade / production (environment 1311). Choose another connection in its deployment settings first; nothing was removed. |
| 422 | `confirm_mismatch` | Send the confirmation exactly as the field named in `field` asks for it. |
| 429 | `rate_limited` | Wait for the seconds in `Retry-After`. |

## The same task elsewhere

- Guide: [Repository connections](https://docs.corefinity.com/guides/organisation/developers/repository-connections.md)
