# Connection state Get and update cursor state for connection streams. ## Get state Returns the cursor state for all streams in a connection. #### Path Parameters **`connection_id`** string required The connection ID. ## Update state Edit cursor state to restart syncing from a specific point. #### Request Body **`state`** object required Updated cursor state for streams. **`state_type`** string optional State type (e.g., `global`, `stream`, `legacy`). ## Returns A state object containing `state` (the cursor data) and `state_type`. Request ```bash cURL curl "https://api.aitronos.com/v1/organizations/org_xyz789/knowledge/connectors/connections/conn_abc123/state" \ -H "Authorization: Bearer $ACCESS_TOKEN" ``` ```python Python SDK from aitronos import Aitronos client = Aitronos(api_key="your-api-key") state = client.knowledge_connectors.get_state( organization_id="org_xyz789", connection_id="conn_abc123", ) print(state) ``` ```python Python import requests org_id = "org_xyz789" conn_id = "conn_abc123" url = f"https://api.aitronos.com/v1/organizations/{org_id}/knowledge/connectors/connections/{conn_id}/state" headers = {"Authorization": "Bearer YOUR_ACCESS_TOKEN"} response = requests.get(url, headers=headers) print(response.json()) ``` ```javascript JavaScript const response = await fetch( "https://api.aitronos.com/v1/organizations/org_xyz789/knowledge/connectors/connections/conn_abc123/state", { headers: { Authorization: "Bearer YOUR_ACCESS_TOKEN" }, } ); const data = await response.json(); console.log(data); ``` Response ```json 200 OK { "state": { "users": { "cursor": "2024-06-15T10:30:00Z" }, "orders": { "cursor": "2024-06-15T09:00:00Z" } }, "state_type": "stream" } ``` ```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) - [Refresh / Clear](/docs/api-reference/knowledge-connectors/refresh-clear)