Skip to main content

Enterprise: Upload Image Endpoint

Overview

The Enterprise Upload Image endpoint uploads an image to your S3 bucket.

info

You should have your own S3 bucket to use this endpoint.

Update your S3 bucket details using this endpoint.

Request

--request POST 'https://modelslab.com/api/v1/enterprise/upload_image' \

Send a POST request to https://modelslab.com/api/v1/enterprise/upload_image endpoint.

note

Make sure you are passing the image in base64 format.

Body Attributes

ParameterDescription
keyYour enterprise API Key used for request authorization.
base64_imageThe base64 string of the image to be uploaded.
image_typeExtension or type of the image; options: png, jpeg, jpg

Example

Body

Body Raw
{
"key": "enterprise_api_key",
"base64_image": "iVBORw0KGgoAAAANSUhEUgAAADIAAAAyCAYAAAAeP4ixAAAACXBIWXMAAA7DAAAOwwHHb6hkAAAAGXRFWHRTb2Z0d2FyZQB3d3cuaW5rc2NhcGUub3Jnm+48GgAABe1JREFUaIHdms9PVFcUxz/zA2YhFRAUQVjVH1EXVBFIEBxNq2n/BKMB2RgDahCCCxOX/gG17YYfUVmYxh9VlCC1QcFGg4mKdmGi/ZGgLkQYQKogkJnbxZkH782bx7w3zDBtT3Iyc+fec+75zrv33HPOfS4SQx5gO7An/LkJWA9kRIz7APwBvAAeA33AEyCYIDvipjLge2AUUHHyaFhH6TLbDsA3wK92DM3OFrYzFrgH7FsOABuBX6IZUVSEqqlBtbejBgZQ4+MopYw8NiZ9bW2o6mrUunWWgHqADckA4AKagE/6CX0+VG0t6t49VChkNjwWh0Kovj7UoUOo9HQTmE9AQ3juhFAmcEM/ideLOnoU9eaNc+Ot+PVrVH296I4AdB1YuVQQa4FBveLyctSzZ4kDEMlPn6JKS01gHgN5SwHxu6bM5UI1N6NmZ5MHQuPZWVRjo8ypA/MyHjArEf+uAOXxyCZONoBI7uhApaUZwPwGZNkF4QJuasJpaajOzuUHofG1a6Z9cx2bDqAJ3XLq6EgdCI3PnTMtsxOxQGxA52JPnkw9CI0bG02uedNiQOYPu/Ly5dnYdnl21uTNfrYC8bU2yOtNrouNlwcHxfHowEQNZ+Zjp2PHUm+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6qQFy9arpWuIqDe8XPkGN/3te3ti4/iAsXTCAeYX4JISblIddd88usqWl5HMDMjOyJiOX0AqlhxUV5+icDqLIyqYonC8STJybvpD2JuEFotBLdniG8b+rqnEcAi/HQkBx2EdcGCviJOJaTFbmQ6y7DCwPp6VKdvHt38UDRioNBCVGqq6O+MDCNeKekJN8b0B2aes7PlzJmayvqwYPoJdDRUelraUEdOIBau9YyjOlGzrSk017kFaWYcVVWlrCdsUjs9OVyAIikEiSMHrZpaDQeDuswRbFOKFHrz42U9vcgGedG4HPkPRY9vUcKBdqLZ3eAZ0hJakn0DwRcaPWWv+9kAAAAAElFTkSuQmCC",
"image_type": "png"
}

Request

var myHeaders = new Headers();
myHeaders.append("Content-Type", "application/json");

var raw = JSON.stringify({
"key": "",
"base64_image": "iVBORw0KGgoAAAANSUhEUgAAADIAAAAyCAYAAAAeP4ixAAAACXBIWXMAAA7DAAAOwwHHb6hkAAAAGXRFWHRTb2Z0d2FyZQB3d3cuaW5rc2NhcGUub3Jnm+48GgAABe1JREFUaIHdms9PVFcUxz/zA2YhFRAUQVjVH1EXVBFIEBxNq2n/BKMB2RgDahCCCxOX/gG17YYfUVmYxh9VlCC1QcFGg4mKdmGi/ZGgLkQYQKogkJnbxZkH782bx7w3zDBtT3Iyc+fec+75zrv33HPOfS4SQx5gO7An/LkJWA9kRIz7APwBvAAeA33AEyCYIDvipjLge2AUUHHyaFhH6TLbDsA3wK92DM3OFrYzFrgH7FsOABuBX6IZUVSEqqlBtbejBgZQ4+MopYw8NiZ9bW2o6mrUunWWgHqADckA4AKagE/6CX0+VG0t6t49VChkNjwWh0Kovj7UoUOo9HQTmE9AQ3juhFAmcEM/ideLOnoU9eaNc+Ot+PVrVH296I4AdB1YuVQQa4FBveLyctSzZ4kDEMlPn6JKS01gHgN5SwHxu6bM5UI1N6NmZ5MHQuPZWVRjo8ypA/MyHjArEf+uAOXxyCZONoBI7uhApaUZwPwGZNkF4QJuasJpaajOzuUHofG1a6Z9cx2bDqAJ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FBKC2VOcL0FdAbbWwPYbSlpf+uAt3MDGrHDsPT6F4M9HpgWhvc1JR6ABo3NJhKphtjPcEGTcDlkgJyqkG0tZk84/FYIED2zXVNyOuV0n6qQFy9arpWuIqDe8XPkGN/3te3ti4/iAsXTCAeYX4JISblIddd88usqWl5HMDMjOyJiOX0AqlhxUV5+icDqLIyqYonC8STJybvpD2JuEFotBLdniG8b+rqnEcAi/HQkBx2EdcGCviJOJaTFbmQ6y7DCwPp6VKdvHt38UDRioNBCVGqq6O+MDCNeKekJN8b0B2aes7PlzJmayvqwYPoJdDRUelraUEdOIBau9YyjOlGzrSk017kFaWYcVVWlrCdsUjs9OVyAIikEiSMHrZpaDQeDuswRbFOKFHrz42U9vcgGedG4HPkPRY9vUcKBdqLZ3eAZ0hJakn0DwRcaPWWv+9kAAAAAElFTkSuQmCC",
"image_type": "png"
});

var requestOptions = {
method: 'POST',
headers: myHeaders,
body: raw,
redirect: 'follow'
};

fetch("https://modelslab.com/api/v1/enterprise/upload_image", requestOptions)
.then(response => response.text())
.then(result => console.log(result))
.catch(error => console.log('error', error));

Response

{
"status": "success",
"message": "image uploaded",
"image_url": "https://pub-8b49af329fae499aa563997f5d4068a4.r2.dev/generations/2789658481681896990.png"
}