Answering my own question: this is called Attestation.
On iOS, in Swift and Objective C it's called DCAppAttestService:
https://developer.apple.com/documentation/devicecheck/establishing-your-app-s-integrity
Google has SafetyNet attestation API, but they're deprecating it:
https://developer.android.com/privacy-and-security/safetynet/deprecation-timeline
On the Web, you also have webauth attestation sometimes available, but they are for authenticators, which may or may not be the phone itself. Regardless, it does sort of guarantee scarcity:
https://developer.mozilla.org/en-US/docs/Web/API/Web_Authentication_API/Attestation_and_Assertion