Download single artifact by jobID

Trying curl request to download single artifact file from artifact archive using gitlab api but throws an error “curl: (18) transfer closed with 2 bytes remaining to read”
Any help would be appreciated?

Thanks for taking the time to be thorough in your request, it really helps! :blush:

Please share the full command line leading to this error.

Quick guess: When the transfer was closed intermittently, check your network for disconnects. Maybe the artifact took a long time to download because of slow download speeds, too, resulting in the server to close the connection.

So file is very small under 10KB and connection was also fine. I use below curl command
curl --location --output artifacts.zip --header "PRIVATE-TOKEN: <token>" "https://gitlab.com/api/v4/projects/<id>/jobs/<jobID>/artifacts/<artifactpath>

What would be artifactpath here?

Not sure about this question, but from the docs Job Artifacts API | GitLab

Path to a file inside the artifacts archive.

Suggest showing the CI/CD configuration that generates the artifact, and the files that are expected in the artifacts archive. That can help build the URL path.