Update total spent and orders count in a existing customer

We are in the middle of a migration from some system to Shopify.

I’ve transferred by API all existing users (customers) with total spent and orders count.

As I see these values were not created.

Please help me to find a way to update these values for already created customers.