You need to have a unique identifier in each link and store the identifiers on the server side, usually in the database. Then in each request you need:
- check if id has already been used
- if it was, make the "link expired" or do whatever you want.
- if this is the first time you see this request in a request, mark it in your db and return the desired response
It is useful to use a GUID or add an additional parameter with a hash so that users do not guess other identifiers (depending on your use case).
source share