<@U04S8PLJWMT>, how can I disable all enabled conn...
# replication-ask-ai
d
@kapa.ai, how can I disable all enabled connections at once?
k
Thinking completed The knowledge sources do not explicitly mention a single UI button or native bulk-action feature to disable all enabled connections at once in the standard Airbyte web interface. In the UI, connections are typically managed individually by opening a connection's menu or settings [Forum Post: Error connecting Source in Builder to Destination BigQuery; Manage existing connections]. However, depending on your setup and environment, you can disable them simultaneously or programmatically through the following methods: 1. Set the Workspace Status to Inactive (AI Agents / Workspace API) If you are using the Workspace API, updating a workspace's status to
inactive
automatically disables all active connections in that workspace [Manage workspaces; update_workspaces_workspace_id]:
Copy code
curl -X PUT <https://api.airbyte.ai/api/v1/workspaces/<workspace_id>> \     -H 'Authorization: Bearer <application_token>' \     -H 'Content-Type: application/json' \     -d '{       "status": "inactive"     }'
2. Programmatically via the Airbyte API You can write a script to fetch your active connections and update their status to
inactive
using the public API: • Send a
PATCH /connections/{connectionId}
request with the body
{"status": "inactive"}
for each connection [patchConnection]. 3. Programmatically via PyAirbyte (airbyte.cloud) If using the PyAirbyte Python SDK, you can iterate over your connections and disable them using `set_enabled`:
Copy code
connection.set_enabled(enabled=False)
This sets the connection status to
'inactive'
[Methods]. 4. Infrastructure as Code (Terraform) If you manage your connections with Terraform using the
airbyte_connection
resource, you can set
status = "inactive"
across your resource definitions and run
terraform apply
[Schema]. šŸ‘ 0 button šŸ‘Ž 0 button ā„¹ļø Tip: Mention @kapa.ai in the thread for follow-ups or DM the app for 1-to-1 help.
d
@kapa.ai, if go with the 1st method, I initially try ccurl --request GET --url 'airbyte.prod.int/api/public/…/…' --header 'accept: application/json' --header 'authorization: Bearer ...' I get:
Copy code
{
  "workspaceId": "42d4e389-2384-4340-94fe-61c3535c30d9",
  "name": "Default Workspace",
  "dataResidency": "",
  "notifications": {
    "failure": {
      "email": {
        "enabled": true
      },
      "webhook": {
        "enabled": false
      }
    },
    "success": {
      "email": {
        "enabled": false
      },
      "webhook": {
        "enabled": false
      }
    },
    "connectionUpdate": {
      "email": {
        "enabled": true
      },
      "webhook": {
        "enabled": false
      }
    },
    "connectionUpdateActionRequired": {
      "email": {
        "enabled": true
      },
      "webhook": {
        "enabled": false
      }
    },
    "syncDisabled": {
      "email": {
        "enabled": true
      },
      "webhook": {
        "enabled": false
      }
    },
    "syncDisabledWarning": {
      "email": {
        "enabled": true
      },
      "webhook": {
        "enabled": false
      }
    }
  }
}
I cannot see anywhere
status
k
Thinking completed The reason you do not see a
status
field is that you are querying the standard Airbyte Public API endpoint (
/api/public/v1/workspaces/...
), which does not have a
status
attribute on workspaces [Airbyte Public API - Workspaces Methods>]. In the standard Public API schema, a workspace object only contains properties such as
workspaceId
,
name
, and
dataResidency
[Airbyte Public API - Workspaces Methods>]. The workspace
status
property (
"active"
or
"inactive"
) is specific to the Airbyte Agent API endpoint (
https://api.airbyte.ai/api/v1/workspaces/...
) used for Airbyte Agents [Ai-agents Interfaces > Api > Manage workspaces>; Airbyte Agent API - Workspaces Methods > get_workspaces_workspace_id>]. Because you are hosting your own standard Airbyte instance (indicated by your URL
http://airbyte.prod.int/api/public/v1/...
), the 1st method does not apply to your environment. To disable all connections on your standard Airbyte instance, you will need to iterate through your connections programmatically and update each connection's status to
inactive
using the standard Airbyte API or a SDK script: • Fetch your connections. • Send a request to set each connection's status to
inactive
(e.g. via
PATCH /v1/connections/{connectionId}
with
{"status": "inactive"}
) [Methods]. šŸ‘ 0 button šŸ‘Ž 0 button ā„¹ļø Tip: Mention @kapa.ai in the thread for follow-ups or DM the app for 1-to-1 help.
d
@kapa.ai, how can I do this if my connetions are not managed by TF ?
k
Thinking completed Because the knowledge sources do not provide a single built-in API endpoint to bulk-disable connections on standard Airbyte instances, the recommended way to disable them (without Terraform) is to script a two-step process using the standard Airbyte Public API [Airbyte Public API - Connections Methods>]: 1. List all connections to retrieve their IDs. 2. Patch each connection to set its status to
inactive
. Step 1: List connections to retrieve their IDs Call the
GET /connections
endpoint to fetch the connections belonging to your workspace [Airbyte Public API - Connections Methods>]. You can filter by your
workspaceIds
parameter [Airbyte Public API - Connections Methods>]:
Copy code
curl --request GET \
  --url 'http://airbyte.prod.int/api/public/v1/connections?workspaceIds=42d4e389-2384-4340-94fe-61c3535c30d9' \
  --header 'accept: application/json' \
  --header 'authorization: Bearer <YOUR_TOKEN>'
The response includes a
data
array containing each connection's details, including
connectionId
and its current
status
(
active
,
inactive
, or
deprecated
) [Responses]. Step 2: Disable each connection Call
PATCH /connections/{connectionId}
for each connection you want to disable and supply
{"status": "inactive"}
in the request body [Airbyte Public API - Connections Methods>]:
Copy code
curl --request PATCH \
  --url 'http://airbyte.prod.int/api/public/v1/connections/<connectionId>' \
  --header 'accept: application/json' \
  --header 'content-type: application/json' \
  --header 'authorization: Bearer <YOUR_TOKEN>' \
  --data '{
    "status": "inactive"
  }'
Automating with a script You can chain these two steps together using a bash command (with
jq
and
curl
) or a Python script: Using Bash & jq
Copy code
WORKSPACE_ID="42d4e389-2384-4340-94fe-61c3535c30d9"
BASE_URL="http://airbyte.prod.int/api/public/v1"
TOKEN="<YOUR_TOKEN>"

# Get all connection IDs where status is active
CONNECTION_IDS=$(curl -s --request GET \
  --url "${BASE_URL}/connections?workspaceIds=${WORKSPACE_ID}&limit=100" \
  --header "accept: application/json" \
  --header "authorization: Bearer ${TOKEN}" \
  | jq -r '.data[] | select(.status=="active") | .connectionId')

# Patch each active connection to inactive
for ID in $CONNECTION_IDS; do
  echo "Disabling connection: $ID"
  curl -s --request PATCH \
    --url "${BASE_URL}/connections/${ID}" \
    --header "accept: application/json" \
    --header "content-type: application/json" \
    --header "authorization: Bearer ${TOKEN}" \
    --data '{"status": "inactive"}'
done
Using Python
Copy code
import requests

BASE_URL = "http://airbyte.prod.int/api/public/v1"
WORKSPACE_ID = "42d4e389-2384-4340-94fe-61c3535c30d9"
HEADERS = {
    "Authorization": "Bearer <YOUR_TOKEN>",
    "Accept": "application/json",
    "Content-Type": "application/json",
}

# 1. Fetch connections
res = requests.get(
    f"{BASE_URL}/connections",
    headers=HEADERS,
    params={"workspaceIds": [WORKSPACE_ID], "limit": 100},
)
connections = res.json().get("data", [])

# 2. Disable active connections
for conn in connections:
    if conn.get("status") == "active":
        conn_id = conn["connectionId"]
        patch_res = requests.patch(
            f"{BASE_URL}/connections/{conn_id}",
            headers=HEADERS,
            json={"status": "inactive"},
        )
        print(f"Disabled {conn_id}: {patch_res.status_code}")
(Note: If you have more than 100 connections, use the
offset
and
limit
query parameters or follow the
next
link provided in the response to paginate through all connections [Airbyte Public API - Connections Methods>; Responses].)
šŸ‘ 0 button šŸ‘Ž 0 button ā„¹ļø Tip: Mention @kapa.ai in the thread for follow-ups or DM the app for 1-to-1 help.
d
@kapa.ai,If i try to step 2 I get - {"message":"Unauthorized","_links":{"self":{"href":"/api/public/v1/connections/09bb16f7-23e2-4583-9624-8a3cedfc7850","templated":false}},"_embedded":{"errors":[{"message":"Unauthorized","_links":{},"_embedded":{}}]}}
k
Thinking completed The
401 Unauthorized
response indicates that the server rejected the credentials provided in the
Authorization
header [Github Issue (open): šŸ› [Bug Report] Native browser HTTP Basic Auth dialog on login page]. Here are the most common reasons and how to fix this: 1. Your Bearer Access Token Has Expired Airbyte API access tokens generated via
client_id
and
client_secret
expire after 15 minutes (900 seconds) [Step 2: Get an access token]. If 15 minutes have passed since you fetched the token, you must request a new one:
Copy code
curl --request POST \
     --url http://airbyte.prod.int/api/public/v1/applications/token \
     --header 'accept: application/json' \
     --header 'content-type: application/json' \
     --data '
{
  "client_id": "<YOUR_CLIENT_ID>",
  "client_secret": "<YOUR_CLIENT_SECRET>",
  "grant-type": "client_credentials"
}
'
Use the fresh
access_token
from the response in your
PATCH
call [Step 2: Get an access token]:
Copy code
--header 'authorization: Bearer <NEW_ACCESS_TOKEN>'
2. Verify Your Client ID and Client Secret Ensure the
client_id
and
client_secret
used to generate the token match the credentials configured for your Airbyte deployment: • UI: Check under User settings > Applications [Get an API access token]. • CLI (
abctl
)
: Run
abctl local credentials
to view your
Client-Id
and
Client-Secret
[Part 4: Set up authentication; Authentication]. • Kubernetes (Helm): Verify the secrets defined in the
airbyte-auth-secrets
Kubernetes Secret (
instance-admin-client-id
and
instance-admin-client-secret
) [Authentication; Github Issue (open): šŸ› [Bug Report] Native browser HTTP Basic Auth dialog on login page]. Once you refresh the token and re-run the
PATCH /api/public/v1/connections/<connectionId>
request, it should authenticate properly. šŸ‘ 0 button šŸ‘Ž 0 button ā„¹ļø Tip: Mention @kapa.ai in the thread for follow-ups or DM the app for 1-to-1 help.
d
@kapa.ai, why in the python script there's
"limit": 100
? What if I have more than 100 connections?
k
Thinking completed The
"limit": 100
parameter is used because the Airbyte Public API endpoint
GET /connections
enforces a maximum limit of 100 connections returned per request (the default is 20, and the allowed range is 1 to 100) [Airbyte Public API - Connections Methods>]. If you have more than 100 connections, you need to implement pagination to retrieve all of them [Airbyte Public API - Connections Methods>; Airbyte Public API - Connections Methods > listConnections>]. The endpoint supports offset-based pagination using the following query parameters and response fields [Airbyte Public API - Connections Methods>; Airbyte Public API - Connections Methods > listConnections>]: •
offset
: Sets the starting position (default is 0) [Airbyte Public API - Connections Methods>]. •
next
: The API response includes a
next
URL property containing the link with the updated offset for the next page of results (which is omitted or null when you reach the last page) [Airbyte Public API - Connections Methods > listConnections>]. Handling More Than 100 Connections in Python You can loop over multiple pages by incrementing the
offset
until the API returns no more records:
Copy code
import requests

BASE_URL = "http://airbyte.prod.int/api/public/v1"
WORKSPACE_ID = "42d4e389-2384-4340-94fe-61c3535c30d9"
HEADERS = {
    "Authorization": "Bearer <YOUR_TOKEN>",
    "Accept": "application/json",
    "Content-Type": "application/json",
}

limit = 100
offset = 0
all_connections = []

# 1. Paginate through all connections
while True:
    res = requests.get(
        f"{BASE_URL}/connections",
        headers=HEADERS,
        params={
            "workspaceIds": [WORKSPACE_ID],
            "limit": limit,
            "offset": offset,
        },
    )
    res.raise_for_status()
    data = res.json().get("data", [])
    
    if not data:
        break

    all_connections.extend(data)

    # Stop if fewer records than the limit were returned (last page)
    if len(data) < limit:
        break

    offset += limit

print(f"Total connections retrieved: {len(all_connections)}")

# 2. Disable active connections
for conn in all_connections:
    if conn.get("status") == "active":
        conn_id = conn["connectionId"]
        patch_res = requests.patch(
            f"{BASE_URL}/connections/{conn_id}",
            headers=HEADERS,
            json={"status": "inactive"},
        )
        print(f"Disabled {conn_id}: {patch_res.status_code}")
šŸ‘ 0 button šŸ‘Ž 0 button ā„¹ļø Tip: Mention @kapa.ai in the thread for follow-ups or DM the app for 1-to-1 help.
d
@kapa.ai, it is safe to disable a running connection?
k
Thinking completed The provided knowledge sources do not contain enough information to explicitly confirm whether it is completely safe to disable a connection while a sync is actively running, or what the exact internal behavior is for an in-progress sync when its status is patched to
inactive
. However, the knowledge sources do note the following related points: • What disabling does: Disabling or setting a connection to
inactive
(or "Paused") prevents future automatic syncs from running on a schedule [Sync Jobs; Review one connection's status]. • Queued syncs: If a sync job is currently in the
queued
state, modifying the connection will cause the queued job to be cancelled [Sync Jobs]. • Stopping active syncs: If your goal is to immediately stop a running sync, Airbyte provides a separate cancel operation (
DELETE /jobs/{jobId}
) to cancel running jobs [Airbyte Public API - Jobs Methods>]. • Caveats when reenabling: Be aware that community reports indicate that reenabling/resuming previously disabled connections can sometimes encounter issues (such as unexpected stream resets or schema re-evaluations depending on your configuration) [Github Issue (closed): [source-mysql] Data loss when reactivating a connection]. If you want to be completely safe, cancel any active jobs first via the API or UI before setting the connection to
inactive
[Airbyte Public API - Jobs Methods>]. šŸ‘ 0 button šŸ‘Ž 0 button ā„¹ļø Tip: Mention @kapa.ai in the thread for follow-ups or DM the app for 1-to-1 help.
d
@kapa.ai,
Copy code
for conn in all_connections:
    if conn.get("status") == "inactive":
        conn_id = conn["connectionId"]
        patch_res = requests.patch(
            f"{BASE_URL}/connections/{conn_id}",
            headers=HEADERS,
            json={"status": "active"},
this correct to enable the disabled connections, right?
k
Thinking completed It looks like your message was cut off ("this co..."). Could you please provide the full question or code snippet you would like help with regarding your Airbyte connections? šŸ‘ 0 button šŸ‘Ž 0 button ā„¹ļø Tip: Mention @kapa.ai in the thread for follow-ups or DM the app for 1-to-1 help.
d
@kapa.ai,
Copy code
for conn in all_connections:
    if conn.get("status") == "inactive":
        conn_id = conn["connectionId"]
        patch_res = requests.patch(
            f"{BASE_URL}/connections/{conn_id}",
            headers=HEADERS,
            json={"status": "active"},
this correct to enable the disabled connections, right?
k
Thinking completed Yes, that logic is correct. The
PATCH /connections/{connectionId}
endpoint accepts
"status": "active"
in the request body to enable a connection [Airbyte Public API - Connections Methods>]. Here is the complete, closed loop for your script:
Copy code
for conn in all_connections:
    if conn.get("status") == "inactive":
        conn_id = conn["connectionId"]
        patch_res = requests.patch(
            f"{BASE_URL}/connections/{conn_id}",
            headers=HEADERS,
            json={"status": "active"},
        )
        print(f"Enabled {conn_id}: {patch_res.status_code}")
A successful update will return an HTTP
200 OK
response with the updated connection object showing
"status": "active"
[Responses]. Just ensure your authorization token has not expired before running the batch update [Step 2: Get an access token]. šŸ‘ 0 button šŸ‘Ž 0 button ā„¹ļø Tip: Mention @kapa.ai in the thread for follow-ups or DM the app for 1-to-1 help.