---
title: "Preview detaching a client"
url: https://docs.corefinity.com/api/reference/organisation/preview-company-client-detach
type: endpoint
last_updated: 2026-11-13
feature: agency-links
related:
  - https://docs.corefinity.com/guides/agencies/client-organisations-and-the-switcher.md
---
# Preview detaching a client

What detaching the client from your agency would end, as counts: the names of a client's sites and
environments are the client's. Nothing is changed. Any member of your agency may read it.

```http
GET /api/company/clients/{client}/detach-preview
```

- Scope: `read`
- Rate limit: 60 a minute
- Try it in the console: on

## Path parameters

- `client` (integer, required): The id of one of your agency's clients, as `GET /company/clients` lists it. Digits only.

## Request

### curl

```bash
curl https://manage.corefinity.com/api/company/clients/1204/detach-preview \
  -H "Authorization: Bearer $COREFINITY_TOKEN" \
  -H "Accept: application/json"
```

### PHP

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

$response = Http::withToken(env('COREFINITY_TOKEN'))
    ->acceptJson()
    ->get('https://manage.corefinity.com/api/company/clients/1204/detach-preview');

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

### Node

```javascript
const res = await fetch('https://manage.corefinity.com/api/company/clients/1204/detach-preview', {
  method: 'GET',
  headers: {
    Authorization: `Bearer ${process.env.COREFINITY_TOKEN}`,
    Accept: 'application/json',
  },
});

// 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.get(
    "https://manage.corefinity.com/api/company/clients/1204/detach-preview",
    headers={
        "Authorization": f"Bearer {os.environ['COREFINITY_TOKEN']}",
        "Accept": "application/json",
    },
)

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

## Responses

### 200 What the detach would end.

```json
{
  "client_id": 1204,
  "effects": {
    "firewall": {
      "stay_for_review": 0,
      "stop_applying": 0
    },
    "managed_sites": {
      "count": 0
    },
    "repositories": {
      "count": 1
    },
    "side": "agency",
    "ssh_keys": {
      "count": 0
    },
    "summary": [
      "Your people lose access to this client's sites, tickets and billing at once.",
      "1 environment deploys through the agency's deployment connections. It will need a new deployment connection before its next deployment.",
      "Linking the agency again later does not bring back removed keys, repositories or subscriptions."
    ],
    "ticket_subscriptions": {
      "count": 0
    }
  }
}
```

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

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

### 403 The token lacks the `read` scope (`scope_required`), the link is one only Corefinity support can change (`forbidden`), or your company has been deleted (`company_unavailable`).

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

### 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`. |
| 404 |  | Check the id. You see only what your account can reach. |
| 429 | `rate_limited` | Wait for the seconds in `Retry-After`. |

## The same task elsewhere

- Guide: [Client organisations and the switcher](https://docs.corefinity.com/guides/agencies/client-organisations-and-the-switcher.md)
