# Refresh and clear Rewind cursors to re-sync data or erase destination data for selected streams. ## Refresh connection Rewinds the cursor and re-syncs selected streams. Optionally removes existing records before re-syncing. #### Path Parameters **`connection_id`** string required The connection ID to refresh. #### Request Body **`streams`** array required Stream names to refresh. **`remove_records`** boolean optional · Defaults to `false` Whether to remove existing records before re-syncing. ## Clear connection Erases destination data for selected streams without re-syncing. #### Request Body **`streams`** array required Stream names to clear. ## Returns A status object indicating the refresh or clear operation has been initiated. Request ```bash cURL — Refresh curl -X POST "https://api.aitronos.com/v1/organizations/org_xyz789/knowledge/connectors/connections/conn_abc123/refresh" \ -H "Authorization: Bearer $ACCESS_TOKEN" \ -H "Content-Type: application/json" \ -d '{"streams": ["users", "orders"], "remove_records": false}' ``` ```bash cURL — Clear curl -X POST "https://api.aitronos.com/v1/organizations/org_xyz789/knowledge/connectors/connections/conn_abc123/clear" \ -H "Authorization: Bearer $ACCESS_TOKEN" \ -H "Content-Type: application/json" \ -d '{"streams": ["users"]}' ``` ```python Python SDK from aitronos import Aitronos client = Aitronos(api_key="your-api-key") # Refresh client.knowledge_connectors.refresh_connection( organization_id="org_xyz789", connection_id="conn_abc123", streams=["users", "orders"], remove_records=False, ) # Clear client.knowledge_connectors.clear_connection( organization_id="org_xyz789", connection_id="conn_abc123", streams=["users"], ) ``` ```python Python import requests org_id = "org_xyz789" conn_id = "conn_abc123" headers = {"Authorization": "Bearer YOUR_ACCESS_TOKEN", "Content-Type": "application/json"} # Refresh refresh_url = f"https://api.aitronos.com/v1/organizations/{org_id}/knowledge/connectors/connections/{conn_id}/refresh" requests.post(refresh_url, headers=headers, json={"streams": ["users"], "remove_records": False}) # Clear clear_url = f"https://api.aitronos.com/v1/organizations/{org_id}/knowledge/connectors/connections/{conn_id}/clear" requests.post(clear_url, headers=headers, json={"streams": ["users"]}) ``` ```javascript JavaScript // Refresh await fetch( "https://api.aitronos.com/v1/organizations/org_xyz789/knowledge/connectors/connections/conn_abc123/refresh", { method: "POST", headers: { Authorization: "Bearer YOUR_ACCESS_TOKEN", "Content-Type": "application/json", }, body: JSON.stringify({ streams: ["users"], remove_records: false }), } ); // Clear await fetch( "https://api.aitronos.com/v1/organizations/org_xyz789/knowledge/connectors/connections/conn_abc123/clear", { method: "POST", headers: { Authorization: "Bearer YOUR_ACCESS_TOKEN", "Content-Type": "application/json", }, body: JSON.stringify({ streams: ["users"] }), } ); ``` Response ```json 200 OK { "status": "refreshing" } ``` ```json 4xx Error { "success": false, "error": { "code": "CONNECTOR_CONNECTION_NOT_FOUND", "message": "The requested connection was not found.", "type": "client_error", "status": 404, "details": {}, "trace_id": "abc-123-def", "timestamp": "2025-12-22T15:30:00Z" } } ``` ## Related Resources - [Manage Connections](/docs/api-reference/knowledge-connectors/connections) - [Connection State](/docs/api-reference/knowledge-connectors/connection-state) - [Manage Jobs](/docs/api-reference/knowledge-connectors/jobs)