Getting job artifacts API always returns 404 when the pipeline is triggered by different upstream pipelines

I have a downstream pipeline in a separate project which stores some data in a job artifact. I use the $CI_API_V4_URL/projects/$CI_PROJECT_ID/jobs/artifacts/main/download?job=job API to get artifacts from the last successful build in the downstream project. But it works ONLY when I trigger the pipeline from within the downstream project. When this pipeline is triggered by an external project, the API always returns 404 while I have a lot of previous successful downstream pipelines with artifacts. But I need to get exactly what documentation says: an artifact from the last successful pipeline in the project. Upstream projects don't have jobs with the same name.

How to fix that?

Edited Oct 20, 2021 by Alex Pravdin
Assignee Loading
Time tracking Loading