# Disconnect a cloud account

Removes your organization's stored account for one bring-your-own offering. The stored details are deleted, not kept disabled. Refused while servers created with this account may still hold something in it — [delete them](/docs/api-reference/forge-compute/delete-host) first. When the provider has refused the stored account (its `status` is `credential_invalid`), servers already on their way out (being deleted, revoked or failed) cannot be cleaned up through it. When every server still using it is on its way out, a disconnect without `forget_hosts` is refused with `details.reason` `forget_available`; while any of them is still live, the refusal carries no reason and that server must be deleted first. [Connecting](/docs/api-reference/forge-compute/put-credential) working details for that same account and [deleting](/docs/api-reference/forge-compute/delete-host) those servers again removes what they left. Where that is not possible (the account was closed or its project deleted), `forget_hosts=true` disconnects anyway and Forge forgets them. Their entries stay in [List servers](/docs/api-reference/forge-compute/list-hosts) until they are [deleted](/docs/api-reference/forge-compute/delete-host); that delete finishes without asking the provider. What they left in the account stays there, and shows up as `orphans` in [List servers](/docs/api-reference/forge-compute/list-hosts) once a working account for it is [connected](/docs/api-reference/forge-compute/put-credential) again, and can be [deleted](/docs/api-reference/forge-compute/delete-orphan) there. Disconnecting an offering that has no stored account succeeds with nothing to do. Requires a bearer token (or API key) whose principal holds the `manage_forge` capability in the acting organization; it works while Forge cloud compute is switched off, so switching the feature off never strands a stored secret.

#### Path Parameters

**`offering_id`** string required

The bring-your-own offering to disconnect, e.g. `hetzner`. A stored account is removed even when its offering has since left the catalog.

#### Query Parameters

**`forget_hosts`** boolean optional · Defaults to `false`

Disconnect even though servers still use this account, forgetting them. Only allowed when the provider has refused the stored account and every one of those servers is being deleted, revoked or failed ([delete](/docs/api-reference/forge-compute/delete-host) the others first: that works whatever the account answers); otherwise refused with `FORGE_COMPUTE_HOSTS_EXIST` and `details.reason`. A disconnect without it that this would get past is refused with `details.reason` `forget_available`; prefer [connecting](/docs/api-reference/forge-compute/put-credential) working details for that same account and deleting the servers again, which removes what they left. Whatever forgotten servers may have left in the account stays there and may still be charged: check the account at the provider. Once a working account for it is connected again, those leftovers are listed as `orphans` and can be deleted.

**`organization_id`** string optional

The organization to act in. Defaults to your current organization. You must be an active member of it, or the request is refused with `403 ORGANIZATION_ACCESS_DENIED`.

#### Headers

**`X-Organization-Id`** string optional

The same as `organization_id`, as a header. When both are sent, the query parameter wins.

## Returns

No body — `204 No Content` on success, whether an account was removed or none was stored.

## Errors

| Status | Code | When |
|  --- | --- | --- |
| 401 | `AUTHENTICATION_REQUIRED` | No valid credential. |
| 403 | `ORGANIZATION_ACCESS_DENIED` | `organization_id` or `X-Organization-Id` names an organization you are not an active member of. |
| 403 | `INSUFFICIENT_PERMISSIONS` | The caller does not hold `manage_forge` in the acting organization. |
| 404 | `FORGE_COMPUTE_OFFERING_NOT_FOUND` | The id is neither an offering nor a stored account. |
| 409 | `FORGE_COMPUTE_HOSTS_EXIST` | Servers created with this account may still hold a resource. `details.live_hosts` is the count. Without `forget_hosts`, `details.reason` is `forget_available` when the same request with `forget_hosts=true` would be accepted (deleting those servers again changes nothing while the provider refuses the stored account: connect working details for that same account first, then delete them, or forget them), and absent otherwise. With `forget_hosts=true`, `details.reason` says why the servers cannot be forgotten: `account_works` (the provider still accepts the stored account, so delete the servers instead) or `hosts_hold_resources` (a server is not being deleted, revoked or failed: delete it first, then disconnect again). |



```bash cURL
curl -X DELETE "https://api.aitronos.com/v1/forge/compute/credentials/hetzner" \
  -H "Authorization: Bearer $ACCESS_TOKEN"
```


```python Python SDK
# pip install aitronos-sdk
#
# The Python SDK does not expose a typed `forge_compute` namespace yet, so call
# the endpoint directly with the same credential you would pass to `Aitronos(...)`
# — an API key or a bearer token, both sent as `Authorization: Bearer <value>`.
import httpx

API_KEY = "your-api-key"

response = httpx.delete(
    "https://api.aitronos.com/v1/forge/compute/credentials/hetzner",
    headers={"Authorization": f"Bearer {API_KEY}"},
)
assert response.status_code == 204
```


```python Python
import os
import requests

token = os.environ["AITRONOS_TOKEN"]
url = "https://api.aitronos.com/v1/forge/compute/credentials/hetzner"
headers = {"Authorization": f"Bearer {token}"}

response = requests.delete(url, headers=headers)
if response.status_code == 409:
    error = response.json()["error"]
    print(error["message"])
    if error["details"].get("reason") == "forget_available":
        # Best: PUT working details for that same account to this URL, then
        # delete the servers again; that removes what they left. Forget them
        # only when that account is gone, and ask the person first: whatever
        # those servers left stays in the account.
        if input("Account gone for good? Forget those servers and disconnect? [y/N] ") == "y":
            response = requests.delete(url, params={"forget_hosts": "true"}, headers=headers)
            print(response.status_code)  # 204
```


```javascript JavaScript
const response = await fetch(
  "https://api.aitronos.com/v1/forge/compute/credentials/hetzner",
  {
    method: "DELETE",
    headers: { Authorization: `Bearer ${process.env.AITRONOS_TOKEN}` },
  },
);
console.log(response.status); // 204
```

**Response:**

204 No Content

```text
(empty body)
```

409 Conflict

```json
{
  "success": false,
  "error": {
    "code": "FORGE_COMPUTE_HOSTS_EXIST",
    "message": "Servers are still using this account. Delete them before disconnecting it.",
    "system_message": "1 live Forge compute host(s) still use this credential",
    "type": "client_error",
    "status": 409,
    "details": {"live_hosts": 1},
    "trace_id": "3f1c9a52-7d4e-4b8a-9c21-6e0d5f7a8b34",
    "timestamp": "2026-09-28T09:00:00Z"
  }
}
```

409 Conflict (forget available)

```json
{
  "success": false,
  "error": {
    "code": "FORGE_COMPUTE_HOSTS_EXIST",
    "message": "Servers still use this account, but the provider no longer accepts its stored details, so those servers cannot be cleaned up for now. Enter working details for this same account, then delete the servers again to remove what they left. If that is not possible, you can disconnect it anyway and forget those servers; anything they left in the account stays there until you remove it.",
    "system_message": "1 live Forge compute host(s) still use this credential; the provider refuses it and every one is being torn down, so forget_hosts=true would be accepted",
    "type": "client_error",
    "status": 409,
    "details": {"live_hosts": 1, "reason": "forget_available"},
    "trace_id": "3f1c9a52-7d4e-4b8a-9c21-6e0d5f7a8b34",
    "timestamp": "2026-09-28T09:00:00Z"
  }
}
```

403 Forbidden

```json
{
  "success": false,
  "error": {
    "code": "INSUFFICIENT_PERMISSIONS",
    "message": "You don't have permission to perform this action.",
    "system_message": "Missing required capability: manage_forge",
    "type": "authorization_error",
    "status": 403,
    "details": {"required_capability": "manage_forge"},
    "trace_id": "3f1c9a52-7d4e-4b8a-9c21-6e0d5f7a8b34",
    "timestamp": "2026-09-28T09:00:00Z"
  }
}
```

## Related Resources

- [Forge cloud compute overview](/docs/api-reference/forge-compute/introduction)
- [List billing organizations](/docs/api-reference/forge-compute/list-billing-organizations)
- [Choose the default billing organization](/docs/api-reference/forge-compute/choose-billing-organization)
- [List project groups](/docs/api-reference/forge-compute/list-project-groups)
- [Register or update a project group](/docs/api-reference/forge-compute/put-project-group)
- [Delete a project group](/docs/api-reference/forge-compute/delete-project-group)
- [List compute offerings](/docs/api-reference/forge-compute/list-offerings)
- [Get offering options](/docs/api-reference/forge-compute/get-offering-options)
- [Resolve a free size](/docs/api-reference/forge-compute/resolve-offering-size)
- [List connected accounts](/docs/api-reference/forge-compute/list-credentials)
- [Connect a cloud account](/docs/api-reference/forge-compute/put-credential)
- [Disconnect a cloud account](/docs/api-reference/forge-compute/delete-credential)
- [Create a server](/docs/api-reference/forge-compute/create-host)
- [List servers](/docs/api-reference/forge-compute/list-hosts)
- [List your servers in every organization](/docs/api-reference/forge-compute/list-my-hosts)
- [Get a server](/docs/api-reference/forge-compute/get-host)
- [Get a server's daily cost and uptime](/docs/api-reference/forge-compute/get-host-usage)
- [List a server's running intervals](/docs/api-reference/forge-compute/list-host-intervals)
- [List a server's event history](/docs/api-reference/forge-compute/list-host-events)
- [Report a setup step](/docs/api-reference/forge-compute/report-progress)
- [Report the server's host key](/docs/api-reference/forge-compute/report-host-key)
- [Mark a server ready](/docs/api-reference/forge-compute/report-ready)
- [Report activity](/docs/api-reference/forge-compute/report-activity)
- [Park a server](/docs/api-reference/forge-compute/park-host)
- [Resume a server](/docs/api-reference/forge-compute/resume-host)
- [Delete a server](/docs/api-reference/forge-compute/delete-host)
- [Revoke a server](/docs/api-reference/forge-compute/revoke-host)
- [Get compute settings](/docs/api-reference/forge-compute/get-settings)
- [Update compute settings](/docs/api-reference/forge-compute/update-settings)
- [Get spend limits](/docs/api-reference/forge-compute/get-limits)
- [Change the organization's limits](/docs/api-reference/forge-compute/update-organization-limits)
- [Set your own limit](/docs/api-reference/forge-compute/update-my-limit)
- [List member limits](/docs/api-reference/forge-compute/list-member-limits)
- [Set a member's limit](/docs/api-reference/forge-compute/update-member-limit)
- [Delete a leftover resource](/docs/api-reference/forge-compute/delete-orphan)