Setenroltokens expiration?

https://electricimp.com/docs/api/imp/setenroltokens/

We’re planning on using this API endpoint and a printed barcode to assist users who are having trouble with their phones. Do the planid/tokenid ever expire? We’re considering that some time (maybe a month or more) could pass before the printed barcodes actually get used on a device. Should there be any problem with that?

As an aside to this, is there a programmatic way to determine the enrolment tokens that are currently in place on a device?

The token is short-lived; once consumed it is discarded (and never used again) so no, you can’t determine what ones are present.

You can however provision in the factory using this API, so the user either only needs to supply SSID/password or (in the case of 005) just plug in ethernet.

If you contact support we can provide some example code to run which does this flow in the factory.

Thanks for the info, Hugo. How long will the token be valid if it is not used immediately? Is it seconds/minutes/days/weeks/…?

Minutes.