Create an Image-To-3D Session
Create a new Image-to-3D session by uploading an image and setting the desired parameters.
Request
POST https://api.csm.ai/image-to-3d-sessions
Parameters
image_url REQUIRED
type: string
in: body
description: URL of the image to be converted into 3D; can also be a base64 string of the image. If Base64, it must be prefixed with the MIME type, like data:<mediatype>
geometry_model OPTIONAL
type: string
in: body
default: "base"
options: base, turbo
description: Chooses the geometry model to use for the session.
texture_model OPTIONAL
type: string
in: body
default: none
options: none, baked, pbr
description: Chooses the texture model to use for the session. Baked textures can include specular highlights and shadows in the albedo map, while PBR textures have better albedo and include a metallic and roughness map.
scaled_bbox OPTIONAL
type: array
in: body
example: [1.0, 1.0, 1.0]
default: [-1, -1, -1]
description: Scaled bounding box describing the target dimensions in meters of the generated asset. This is a list of 3 float numbers: [width, height, depth]
.
- Enter
in a field to automatically determine that dimension.-1
is the default which automatically sets all dimensions[-1, -1, -1]
preserve_aspect_ratio
type: OPTIONAL
boolean
in: body
default: false
description: For use with scaled_bbox
option. If set to true
, the mesh will be scaled to the largest it can be within the specified bounding box without stretching.
topology OPTIONAL
type: string
in: body
default: "tris"
example: "tris"
description: Specifies the topology. Available options: tris, quads
resolution OPTIONAL
type: string
in: body
default: "high_poly"
description: Defines the resolutio. Available resolutions: low_poly, high_poly
Code Snippets
Python
import requests
import json
url = "https://api.csm.ai/image-to-3d-sessions"
payload = json.dumps({
"image_url": "https://via.placeholder.com/300/09f/fff.png",
"geometry_model": "turbo",
"texture_model": "pbr"
})
headers = {
'x-api-key': '<X-API_KEY>',
'Content-Type': 'application/json'
}
response = requests.request("POST", url, headers=headers, data=payload)
print(response.text)
Node.js
var request = require('request');
var options = {
method: 'POST',
url: 'https://api.csm.ai/image-to-3d-sessions',
headers: {
'x-api-key': '<X-API_KEY>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
"image_url": "https://via.placeholder.com/300/09f/fff.png",
"geometry_model": "turbo",
"texture_model": "pbr"
})
};
request(options, function (error, response) {
if (error) throw new Error(error);
console.log(response.body);
});
Curl
curl -k --location 'https://api.csm.ai/image-to-3d-sessions' \
--header 'x-api-key: <X-API_KEY>' \
--header 'Content-Type: application/json' \
--data '{
"image_url": "https://via.placeholder.com/300/09f/fff.png",
"geometry_model": "turbo",
"texture_model": "pbr"
}'
Response
{
"error": "",
"message": "Created",
"statusCode": 201,
"data": {
"session_code": "SESSION_XXXXXXXXXX_XXXXXXX",
"image_url": "https://via.placeholder.com/300/09f/fff.png",
"manual_segmentation": false,
"texture_model": "pbr",
"geometry_model": "turbo",
"topology": "tris",
"resolution": "high_poly",
"symmetry": "auto",
"scaled_bbox": [-1, -1, -1],
"preserve_aspect_ratio": false,
"pivot_point": [0, 0, 0],
"mesh_url": "",
"mesh_url_obj": "",
"mesh_url_zip": "",
"mesh_url_glb": "",
"mesh_url_fbx": "",
"mesh_url_usdz": "",
"mp4_url": "",
"updated_at": "YYYY-MM-DDTHH:MM:SS.SSSZ",
"created_at": "YYYY-MM-DDTHH:MM:SS.SSSZ",
"session_status": "queued",
"percent_done": 0
}
}