Skip to main content

Upload Base64 to Url

Overview

This endpoint allows you to convert base64 strings of image, audio, video and 3d object file to a valid URL. The url expires after 24 hours of creation. Note that the maximum file size for upload is 5MB. Ensure to follow the sample format to get the correct response.

Request

--request POST 'https://modelslab.com/api/v6/base64_to_url' \

Send a POST request to https://modelslab.com/api/v6/base64_to_url endpoint.

note

Make sure you are passing a valid base64 format.

Body Attributes

ParameterTypeDescription
keyStringYour API Key used for request authorization
base64_stringStringImage to be uploaded converted in base64 format

Example

Body

Body Raw
{
"key": "",
"base64_string": "data:image/png;base64,<your_base_64_string>",
}

Request

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

var raw = JSON.stringify({
"key": "",
"base64_string": "data:image/png;base64,<your_base_64_string>",
});

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

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

Response

{
"status": "success",
"id": 1047,
"output": [
"https://pub-3626123a908346a7a8be8d9295f44e26.r2.dev/temp/12198578431733221989.png"
]
}