Skip to main content

Enterprise: Update S3 Details Endpoint

Overview

This endpoint is used to update the S3 details on your dedicated server. It is important you add s3 details for each of your server. The available server includes text_to_image, image_editing, voice_cloning,text_to_3d,face_gen, deepfake, realtime, flux and interior.

Request

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

Send a POST request to https://modelslab.com/api/v1/enterprise/update_s3 endpoint. You have to pass the below listed request body parameters to update the S3 details.

info

You can use any S3 compatible service like Cloudflare R2, Digital Ocean Spaces, AWS S3, Google Cloud Storage, Alibaba OSS, Backblaze, etc.

danger

You need to give PutObjectAcl on S3 bucket. Else you won't be able to upload images to S3 bucket. Here is link to stackoverflow on how to do it: https://stackoverflow.com/questions/36272286/getting-access-denied-when-calling-the-putobject-operation-with-bucket-level-per

Attributes

ParameterDescription
keyYour enterprise API Key of the particular server deploy type you want to add s3 details for.
deploy_typeThis is the server type you want to add the s3 details for. It includes text_to_image, image_editing, voice_cloning,text_to_3d, video, face_gen, deepfake, realtime,super_resolution, flux and interior. If nothing is passed text_to_image will be the default
public_urlA public URL on which images can be accessible. Make sure to make your bucket publicly accessible, so you can access the links.
region_nameS3 region name.
endpoint_urlS3 endpoint URL.
aws_access_key_idBucket's access key.
aws_secret_access_keyBucket's secret key.
image_directoryThe image directory inside the S3 bucket, where images will be stored. For instance, create a directory named "generations" inside the bucket and make sure it is public, so you can access the images using their links.

Example

Body

Body Raw
{
"key": "enterprise_api_key",
"deploy_type": "text_to_image",
"public_url": "https://cdn2.stablediffusionapi.com/generations/",
"region_name": "us-east-1",
"endpoint_url": "https://stable-diffusion-api.s3.amazonaws.com",
"aws_access_key_id": "access-key",
"aws_secret_access_key": "secret-key",
"image_directory": "generations"
}

Google Cloud Example

Body Raw
{
"key": "enterprise_api_key",
"deploy_type": "text_to_image",
"public_url": "https://cdn2.stablediffusionapi.com/generations/",
"region_name": "US-CENTRAL1",
"endpoint_url": "https://storage.googleapis.com",
"aws_access_key_id": "access-key",
"aws_secret_access_key": "secret-key",
"image_directory": "generations"
}

Request

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

var raw = JSON.stringify({
"key": "",
"public_url": "https://cdn2.stablediffusionapi.com/generations/",
"region_name": "us-east-1",
"endpoint_url": "https://stable-diffusion-api.s3.amazonaws.com",
"aws_access_key_id": "access-key",
"aws_secret_access_key": "secret-key",
"image_directory": "generations"
});

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

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

Response

Make sure to give below permissions to your IAM user to upload images on S3 bucket.

{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "VisualEditor0",
"Effect": "Allow",
"Action": [
"s3:ListBucket",
"s3:PutObject",
"s3:GetObject",
"s3:PutObjectAcl"
],
"Resource": [
"arn:aws:s3:::stable-diffusion-api",
"arn:aws:s3:::stable-diffusion-api/*"
]
}
]
}