This can be specified with either nm_settings_update2_flag_in_memory, nm_settings_update2_flag_in_memory_detached or nm_settings_update2_flag_in_memory_only.
After making the connection in-memory only, the connection is marked as volatile. That means, if the connection is currently not active it will be deleted right away. Otherwise, it is marked to for deletion once the connection deactivates. A volatile connection cannot autoactivate again (because it's about to be deleted), but a manual activation will clear the volatile flag.