David Hu
07/08/2025, 7:22 PMkapa.ai
07/08/2025, 7:22 PMjson { "stateType": "legacy", "connectionId": "01046826-c1b0-4b0e-815e-7b26f9319ebb", "state": { "deals": { "updatedAt": "2020-09-27T16:55:13.217559Z" } } } This example shows a state object for a connection, where the state tracks the most recent value (such as a timestamp) for incremental syncs. The structure and content of the state will depend on the specific source and how it manages incremental replication. The state field is a black box to Airbyte itself and is interpreted only by the source connector. Editing this state allows you to control where the next sync will start from, which is useful for debugging or resuming from a specific point in time. However, changes should be made with caution, as improper edits can disrupt syncs and require a full resync to recover [see example](https://discuss.airbyte.io/t/2698) [modifying state](https://docs.airbyte.com/platform/cloud/managing-airbyte-cloud/manage-connection-state).David Hu
07/08/2025, 8:15 PMDavid Hu
07/08/2025, 8:15 PMkapa.ai
07/08/2025, 8:15 PMkapa.ai
07/08/2025, 8:15 PMjson { "connectionId": "YOUR_CONNECTION_ID", "connectionState": { "stateType": "legacy", "connectionId": "YOUR_CONNECTION_ID", "state": { "deals": { "updatedAt": "2022-01-01T16:55:13.217559Z" } } } } Replace YOUR_CONNECTION_ID with your actual connection ID. The state object can be customized to match the structure expected by your source connector (for example, the stream name and cursor field). This format has been confirmed to work in practice for updating the state via the Airbyte API [see forum example](https://discuss.airbyte.io/t/2698). If your connector uses per-stream state (the newer format), you would use the streamState field instead, but the legacy format above is the most broadly compatible and is directly supported by the API and UI. If you need a per-stream example, let me know!David Hu
07/08/2025, 8:17 PMkapa.ai
07/08/2025, 8:17 PMkapa.ai
07/08/2025, 8:17 PMself.state was set to a dict, not a string, and then resetting the data to clear the invalid state [see discussion](https://discuss.airbyte.io/t/2001). 2. Legacy vs. Per-Stream State: Airbyte supports both legacy (single object) and per-stream state formats. If your connector uses per-stream state, you should use the streamState field instead of state. The legacy format puts all state in a single object, while per-stream allows for more granular control [see explanation](https://discuss.airbyte.io/t/2698). 3. API Usage and Headers: When using the API, ensure you set the correct headers (Content-Type: application/json and Accept: application/json). Also, make sure you are using the correct endpoint and payload structure [see API usage](https://discuss.airbyte.io/t/2698). 4. Resetting Invalid State: If the state was previously set incorrectly, you may need to reset or clear it before setting a new one. This can be done via the API or, in some cases, through the UI if your Airbyte version supports it [see UI editing](https://docs.airbyte.com/platform/cloud/managing-airbyte-cloud/manage-connection-state). If you continue to get errors, please double-check the exact structure of the state your connector expects and ensure your payload matches it. If you can share the error message or the connector type, I can help further troubleshoot based on the documentation and examples.David Hu
07/08/2025, 8:17 PMkapa.ai
07/08/2025, 8:17 PMkapa.ai
07/08/2025, 8:18 PMstateType = stream (per-stream state), based on the Airbyte protocol documentation and examples from the knowledge sources: json { "connectionId": "YOUR_CONNECTION_ID", "connectionState": { "stateType": "stream", "connectionId": "YOUR_CONNECTION_ID", "streamState": [ { "streamDescriptor": { "name": "orders", "namespace": "public" }, "streamState": { "cursor": "2024-06-07T11:53:55+05:30" } }, { "streamDescriptor": { "name": "customers", "namespace": "public" }, "streamState": { "cursor": "2024-06-07T10:13:32+05:30" } } ] } } - Replace YOUR_CONNECTION_ID with your actual connection ID. - The streamState array contains an object for each stream, with its own cursor or state information. This format matches the per-stream state structure described in the Airbyte protocol documentation and seen in real-world examples [see Airbyte Protocol: AirbyteStateMessage](https://docs.airbyte.com/platform/1.6/understanding-airbyte/airbyte-protocol#airbytestatemessage) and [example state messages](https://github.com/airbytehq/airbyte/issues/48403). If your connector expects additional fields in streamState, adjust accordingly. If you encounter errors, ensure the structure matches what your source/destination expects.