When you make a request to a WordPress site for a “singular” content (that is, the detailed view of a single post, whatever type it is), you should receive a Link
HTTP header that uses the database ID of the content, something like:
Link: <https://some-site.com/?p={$POST_ID}; rel=shortlink
From then on, you can extract the {$POST_ID}
param from the URL using your favourite technique.
If you do have access to the database, you might want to check this post: How to Get Post and Page IDs in WordPress.