curl --request POST \
--url https://{your-subdomain}.neetoform.com/api/external/v2/image_uploads \
--header 'Content-Type: application/json' \
--header 'X-Api-Key: <x-api-key>' \
--data '
{
"filename": "banner.png",
"byte_size": 153,
"checksum": "1B2M2Y8AsgTpgAmY7PhCfg==",
"content_type": "image/png"
}
'const options = {
method: 'POST',
headers: {'X-Api-Key': '<x-api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
filename: 'banner.png',
byte_size: 153,
checksum: '1B2M2Y8AsgTpgAmY7PhCfg==',
content_type: 'image/png'
})
};
fetch('https://{your-subdomain}.neetoform.com/api/external/v2/image_uploads', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://{your-subdomain}.neetoform.com/api/external/v2/image_uploads"
payload = {
"filename": "banner.png",
"byte_size": 153,
"checksum": "1B2M2Y8AsgTpgAmY7PhCfg==",
"content_type": "image/png"
}
headers = {
"X-Api-Key": "<x-api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)Reserve an image upload
Reserve storage for an image on your machine. The response has a signed_id and the upload_url to send the bytes to. Then send the image bytes with an HTTP PUT to upload_url, with every header in upload_headers unchanged. Pass the signed_id as background_image when you create or update a theme.
The signed_id works only after the bytes are uploaded, and only in the workspace that created it. Using it before the upload returns a 422 error. The upload_url is a short-lived credential. Do not share or log it.
The image must be a PNG, JPEG, GIF or SVG of 1 MB or smaller. checksum is the base64-encoded MD5 digest of the file, which is what the Content-MD5 header expects. It is not the hex digest.
To upload an image that is already on the web, use Upload an image from a URL. See Upload a theme background image for the full flow.
curl --request POST \
--url https://{your-subdomain}.neetoform.com/api/external/v2/image_uploads \
--header 'Content-Type: application/json' \
--header 'X-Api-Key: <x-api-key>' \
--data '
{
"filename": "banner.png",
"byte_size": 153,
"checksum": "1B2M2Y8AsgTpgAmY7PhCfg==",
"content_type": "image/png"
}
'const options = {
method: 'POST',
headers: {'X-Api-Key': '<x-api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
filename: 'banner.png',
byte_size: 153,
checksum: '1B2M2Y8AsgTpgAmY7PhCfg==',
content_type: 'image/png'
})
};
fetch('https://{your-subdomain}.neetoform.com/api/external/v2/image_uploads', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://{your-subdomain}.neetoform.com/api/external/v2/image_uploads"
payload = {
"filename": "banner.png",
"byte_size": 153,
"checksum": "1B2M2Y8AsgTpgAmY7PhCfg==",
"content_type": "image/png"
}
headers = {
"X-Api-Key": "<x-api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text){your-subdomain} with your workspace’s subdomain. Learn how to find your subdomain in Workspace subdomain.
Headers
Use the X-Api-Key header to provide your workspace API key. Refer to Authentication for more information.
Body
Name the image carries, such as banner.png.
"banner.png"
Size of the image in bytes.
153
Base64-encoded MD5 digest of the image. Not the hex digest.
"1B2M2Y8AsgTpgAmY7PhCfg=="
Media type of the image. Inferred from the filename when omitted.
image/png, image/jpeg, image/gif, image/svg+xml "image/png"
Response
Created - Upload reserved. Send the bytes to upload_url next.
Identifier of the stored image. Pass it as background_image when you create or update a theme.
"eyJfcmFpbHMiOnsiZGF0YSI6MTIzfX0--abc123"
"banner.png"
"image/png"
Size of the image in bytes.
153
Base64-encoded MD5 digest the upload was reserved with.
"1B2M2Y8AsgTpgAmY7PhCfg=="
Short-lived URL to send the image bytes to with an HTTP PUT. Treat it as a credential and do not share or log it.
"https://acme.neetoform.com/rails/active_storage/disk/eyJfcmFpbHMi--abc123/banner.png"