API ReferenceAnnouncementsCommunity Discussion
API ReferenceCommunity DiscussionAnnouncementsSubscribeLog In
API Reference

Upload Image From Local Device

Upload an image from your local device to the Taboola CDN.

Sample request and response:

curl --location --request POST 'https://backstage.taboola.com/backstage/api/1.0/operations/upload-image' \
--header 'Authorization: Bearer CUIPAAAAAAAAES1SAgAAAAAAGAEgACl0SwB3cAEAADooNzY2NDIxMTFkZGY0NThmZWZmYzQ1Y2RjNzBhODA4MDM5YmIxNjIyMEAC::949497::1ccd66' \
--header 'Content-Type: multipart/form-data; boundary=--------------------------028602095720144278277778' \
--form 'file=@/Users/john.doe/downloads/images/sample-image.jpg'
#  Install `requests` module on your system:
#
#  $ python -m pip install requests

import requests

url = "https://backstage.taboola.com/backstage/api/1.0/operations/upload-image"

payload={}
files=[
  ('file',('cat2.jpeg',open('/Users/john.doe/downloads/images/sample-image.jpg','rb'),'image/jpeg'))
]
headers = {
  'Authorization': 'Bearer CUIPAAAAAAAAES1SAgAAAAAAGAEgACl0SwB3cAEAADooNzY2NDIxMTFkZGY0NThmZWZmYzQ1Y2RjNzBhODA4MDM5YmIxNjIyMEAC::949497::1ccd66'
}

response = requests.request("POST", url, headers=headers, data=payload, files=files)

print(response.text)
{
    "name": "image_url",
    "value": "http://cdn.taboola.com/libtrc/static/thumbnails/920fe389d79d1e44eed86b34b9a56b2c.jpeg"
}