Share API: set expiry date for new share vi curl

I’m using Nextcloud 18.

I have a bash shell script where I create a new share link and send it via email:

curl \
-u "myuser:somepassword" \
-H "OCS-APIRequest: true" \
-X POST https://domain.tld/ocs/v2.php/apps/files_sharing/api/v1/shares \
-d path="path/to/" \
-d shareType=4 \
-d shareWith=john.doe@domain.tld \
-d permissions=1;

This works fine so far, but there is no possibility to create the new share link directly with an expiry date.

Thus I’m searching for an alternative way to create a share link with expiry date and send it via mail.

Currently I see the only possibility to parse the XML output of the API call above and get the share id from the response, but I have no clue how to do that.
Or did I miss another possibility to accomplish what I want?

Maybe to give some more context of my shell script:
I move a new file to the data directory of my user and then do a ./occ files:scan --path="/myuser/files/foo/bar". After that I want to create that share link.

All ideas are welcome!