Solved
Forum Discussion
As no one from the community answered this, I thought it's best to add the official Support answer:
Zephyr Scales REST API uses the JIRA IDs and does not accept the keys.
One can make use of Atlassian's Cloud REST API to obtain the IDs by using Jira keys.
See the following documentation https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-issues/#api-rest-api-3-issue-issueidorkey-get
Then it's possible to use the Create issue links endpoint to create a link between a test case and a Jira issue of any project.
See screenshot for example.
So basically a script is needed if anyone wants to automate this, get IDs out of the issue key, then use the Create Issue Link endpoint to create the link between the test and the issue.