Skip to main content

Enterprise: Update S3 Details Endpoint

Overview

This endpoint is used to update the S3 details on your dedicated server.

Request

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

Send a POST request to https://stablediffusionapi.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 used for request authorization.
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. 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",
"public_url": "https://d1okzptojspljx.cloudfront.net/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"
}

Request

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

var raw = JSON.stringify({
"key": "",
"public_url": "https://d1okzptojspljx.cloudfront.net/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://stablediffusionapi.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/*"
]
}
]
}