Upload multiples files to an entry after its creation (and how to add a caption ?)

I am not using Javascript for my client code but here is an example that should be close.

Also, don’t you need the full api name for the ref? Instead of ‘posts’, it would be ‘api::post.post’.
Cool if that works for you.

 let fileInfos = [];
    const bodyFormData = new FormData()
    bodyFormData.append('ref', 'posts')
    bodyFormData.append('refId', postId)
    bodyFormData.append('field', 'images')   
   images.forEach(({ file }) => {
        bodyFormData.append(`files`, file)
        fileInfos.push({"caption": file.caption, "alternativeText": file.alternativeText, "name": file.name})
    })
    bodyFormData.append('fileInfo', JSON.stringify(fileInfos));
    client.post('/upload', bodyFormData)