<@U04S8PLJWMT> is it possible to update the connec...
# ask-ai
s
@kapa.ai is it possible to update the connection state via API?
k
Yes, it is possible to update the connection state via API in Airbyte. According to the knowledge sources, you can use the
/api/v1/state/create_or_update
endpoint to update the connection state. This is mentioned in several [forum discussions](https://discuss.airbyte.io/t/2698) where users successfully updated connection states using this API endpoint. Here's an example of how to use this endpoint based on the knowledge sources:
Copy code
bash curl -X POST "http://localhost:8000/api/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": {         "stream_name": {           "cursor_field": "2022-01-01T16:55:13.217559Z"         }       }     }   }'
However, it's important to note that [updates to connection state should be handled with extreme care](https://docs.airbyte.com/platform/cloud/managing-airbyte-cloud/manage-connection-state), as updates may break your syncs and require a full historical sync of your data to fix. The documentation recommends making changes only as directed by the Airbyte team. The API supports both legacy state format (where all states are saved together) and the newer streamState format (which allows saving state for each stream individually, providing more granularity for reset/refresh operations), as explained in [this forum discussion](https://discuss.airbyte.io/t/2698).