How do I ensure issue creation is idempotent?

To ensure we don’t create duplicate issues in jira, our process is:

  1. Create a record in our database with a unique id
  2. Check if we have already created the associated issue by searching for the unique id from step 1. using the /rest/api/2/search endpoint
  3. If it exists, associate the issue key with the record. If it doesn’t, create a new issue

I see that the search endpoint has been deprecated in favour of this one.
Unfortunately that doesn’t guarantee read-after-write, so the issue may be missing from the results. The request has a reconcileIssues parameter to retrieve the latest state, but we do not know those ids!
Does anyone have any advice?