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){
"signed_id": "eyJfcmFpbHMiOnsiZGF0YSI6MTIzfX0--abc123",
"filename": "banner.png",
"content_type": "image/png",
"byte_size": 153,
"checksum": "1B2M2Y8AsgTpgAmY7PhCfg==",
"upload_url": "https://acme.neetoform.com/rails/active_storage/disk/eyJfcmFpbHMi--abc123/banner.png",
"upload_headers": {
"Content-Type": "image/png"
}
}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){
"signed_id": "eyJfcmFpbHMiOnsiZGF0YSI6MTIzfX0--abc123",
"filename": "banner.png",
"content_type": "image/png",
"byte_size": 153,
"checksum": "1B2M2Y8AsgTpgAmY7PhCfg==",
"upload_url": "https://acme.neetoform.com/rails/active_storage/disk/eyJfcmFpbHMi--abc123/banner.png",
"upload_headers": {
"Content-Type": "image/png"
}
}{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
Response
Created - Upload reserved. Send the bytes to upload_url next.