About APIs and Primary Keys

If you expose some of your data to the public via APIs, make sure to use UUIDs or unique-string IDs for your objects. If you use incremental IDs, hackers will be able to enumerate your resources, see approximately how many items you have in the database, and potentially access unauthorized data through predictable ID values. Using non-sequential identifiers helps prevent information disclosure and reduces the risk of enumeration attacks against your system.

Tips and Tricks Security Databases Django 5.2 Django 4.2 Django 3.2 PostgreSQL MySQL Django REST Framework