When to use a Web Services API Primary Key

I want to store data from a web services application in a local sqlite database. I read that it’s not a good idea to use an id field returned in data from a web services api as a primary key in the local copy of data.

For example, a web service server returns a bunch of widgets and their unique integer ids, I’ll call, id_from_server. My app creates an invoice record that uses some widgets as line items and stores the widgets on the invoice using id_from_server. I then need to submit this invoice to the web service at some time in the future, but before I do, one of the widget’s id_from_server id changes. So my invoice record is broken.

Ok, so I add my own primary key field on the widget table, called widget_pk_id along with id_from_server field.

But if I make the app check for updated data every now and then, and I use INSERT OR IGNORE and then UPDATE when storing widget data, can’t I just use id_from_server as my primary key field?

Thank you

Is there any data that doesn’t change? How can you identify the widget apart from it’s ID?

Well, it’s name, but that could possibly change too.