Kevin Lefevre
08/13/2025, 12:36 PMcurl -x localhost:8888 -X GET http://192.168.1.2/api/public/v1/health
how can I empty a connection state using the Airbyte API ?kapa.ai
08/13/2025, 12:36 PM/state/create_or_update endpoint with a payload that sets the state to null or an empty object, depending on the state type (LEGACY, STREAM, or GLOBAL). For self-hosted Airbyte OSS, you should use the /api/public/v1 path prefix. Here’s how you can do it: ### Example: Resetting State for a Connection bash curl -X POST "http://192.168.1.2/api/public/v1/state/create_or_update" \ -H "Accept: application/json" \ -H "Content-Type: application/json" \ -d '{ "connectionId": "<YOUR_CONNECTION_ID>", "connectionState": { "stateType": "legacy", "connectionId": "<YOUR_CONNECTION_ID>", "state": null } }' - Replace <YOUR_CONNECTION_ID> with your actual connection ID. - Setting "state": null for LEGACY state type will reset the state for that connection. Note: - For STREAM or GLOBAL state types, you would set the relevant fields (stream_state or `shared_state`/`stream_states`) to null to reset them. - Be cautious: resetting the state will cause the next sync to start from scratch, potentially re-syncing all data. This approach is confirmed by community and support responses, which indicate that setting the state to null or an empty value will reset it for the connection. Always ensure your headers are set to accept and send JSON, as required by the API. If you encounter a 404 or 405 error, double-check your endpoint path and payload structure, and ensure you are using the correct API version for your Airbyte instance ([more details here](https://github.com/airbytehq/airbyte/discussions/45182), [API docs](https://docs.airbyte.com/platform/next/api-documentation)). Warning: Resetting or editing connection state should be done with care, as it can lead to a full re-sync and potential data duplication or loss if not managed properly. Only perform this action if you are sure you want to reset the incremental sync state for the connection. References: - [Airbyte API documentation](https://docs.airbyte.com/platform/next/api-documentation) - [Community discussion on state reset](https://discuss.airbyte.io/t/2698) - [Airbyte Protocol: State Message](https://docs.airbyte.com/platform/next/understanding-airbyte/airbyte-protocol#airbytestatemessage)Kevin Lefevre
08/13/2025, 12:40 PMkapa.ai
08/13/2025, 12:40 PMkapa.ai
08/13/2025, 12:40 PMconnectionId. You can find this in the Airbyte UI, usually in the URL when viewing a connection, or by listing connections via the API. 2. API Endpoint and Headers: Ensure you are using the correct API endpoint and that your request includes the necessary headers (Content-Type: application/json and Accept: application/json). For self-hosted Airbyte, the endpoint should be /api/v1/state/create_or_update or /api/public/v1/state/create_or_update depending on your version and setup. 3. Payload Structure: The payload must match the expected structure for the endpoint. For example, for a legacy state: json { "connectionId": "<YOUR_CONNECTION_ID>", "connectionState": { "stateType": "legacy", "connectionId": "<YOUR_CONNECTION_ID>", "state": null } } 4. Version Compatibility: Some issues may arise if your Airbyte version is outdated. Upgrading to the latest version is recommended if you encounter persistent issues. Example from the community: A user encountered a similar "Object not found" (HTTP 404) error when trying to update the state, even though the connection ID worked for the /state/get endpoint. This can happen if the payload structure is incorrect or if the state type does not match the connection's configuration. Double-checking the state type (legacy, stream, or global) and ensuring the payload matches what the connection expects is important. If you continue to have issues, try retrieving the current state with /state/get and use its structure as a template for your update request. [See discussion for details](https://discuss.airbyte.io/t/2698) If after these checks you still get "Object not found," it is likely due to an incorrect or non-existent connection ID, or a mismatch in the expected state structure. The knowledge sources do not provide a more specific solution for this error beyond these troubleshooting steps.