Get metadata in response of /run-sync via API
Hi, I built an actor that runs smooth, but now I am having trouble accessing all relevant data via API calls.
The goal is to start the run via /run-sync and later on access the files that the run stored in the keyValueStore via the API.
My problem is, that when I start the run via /run-sync the run starts and returns the result of the run, but there is no ID or any information that would allow me to know in which keyValueStore the files were stored. So I can't access the files. Best would be, that the file urls are already included in my response but it would also be okay to just get an Id of the store and then make another request to get the files.
So my question would be: How can I get from a new run, that I started via the API, to accessing the files in the storage?
Here is my current response, which does not include any information as far as I can tell:
[
{
"url": "http://handelsregister.de",
"title": "Registerportal | Homepage",
"resultsArray": [
{
"12345": {
"court": "District court Mainz HRB 12345",
"firma": "Example UG (haftungsbeschränkt)",
"sitz": "Mainz",
"downloadedFiles": [
"Registerauszug",
"StrukturierterDatensatz",
"Gesellschaftsvertrag1"
]
}
}
],
"#error": false,
"#debug": {
"requestId": "XXXXXXXXXXXXX",
"url": "http://handelsregister.de",
"loadedUrl": "https://www.handelsregister.de/rp_web/welcome.xhtml",
"method": "GET",
"retryCount": 0,
"errorMessages": [],
"statusCode": 200
}
}
]
2 Replies
Hey, just a quick tip — when you use /run-sync, it only returns the final output, so you won’t get the run or store ID to access saved files. A better way is to use the regular /runs endpoint. That way, you get the run ID and can fetch the files afterward from the key-value store.
Or if you prefer, you can adjust your actor to include file URLs directly in the output. Let me know if you get stuck!
@thenetaji Great thanks! I will give it a try 🙂