How to upload image using WordPress API?

I am trying to upload an image from an image URL using WordPress API but getting an error with the following message: {“code”:“rest_upload_sideload_error”,“message”:“Sorry, you are not allowed > to upload this file type.”,“data”:{“status”:500}}

I am using in key heading:

Content-Disposition: attachment; filename="file.jpg"
Content-type: image/jpeg
Accept:  application/json
Cache-Control: no-cache

Body (JSON object):

“file”: “
“title”: “title of the image”
“caption”: “caption of the image”
“alt_text”: “alt of the image”