I'm designing a Django Rest Framework API with PostgreSQL. In the database I'll be recording information about documents which can be requested for download. I want the request to include a unique id, so the server knows which document to retrieve. Every document can only be requested once by the one user who has its id value.
However, I read that using primary key values (in my case would be a UUID generated by Python) outside of the database is insecure.
The question
So, can I use a UUID as primary key in the database and let users request the document by this UUID or should I generate another id for the user to request the document by? Any help is appreciated!