session: cleanup use of api_client_index