Image-to-3d
1 Create Session

Introduction

Create session from image-to-3d.

Create Session

Request

POST /image-to-3d-sessions

Parameters

image_url REQUIRED
type : string
in : body
description : URL of the image to be converted into the 3d, can also be base64 of the image. If Base64, it has to be prepended by MIME type like data:<mediatype>


creativity OPTIONAL
type : string
in : body
default : "lowest"
example : "lowest"
description : Creativity for session. Available options : highest, moderate, lowest


auto_refine OPTIONAL
type : boolean
in : body
default : false
description : Generates


refine_speed OPTIONAL
type : string
in : body
default : "slow"
example : "slow"
description : Refine speed for session. Available options : fast, slow


topology OPTIONAL
type : string
in : body
default : "tris"
example : "tris"
description : Topology for enterprise user. Available options : tris,quads
Note : This option is available for the enterprise users only.


resolution OPTIONAL
type : string
in : body
default : "high_poly"
description : Resolution for enterprise user. Available resolution : low_poly,high_poly
Note : This option is available for the enterprise users only.


texture_resolution OPTIONAL
type : number
in : body
default : "2048"
example : 2048
description : Resolution for enterprise user. Available texture resolution : 128, 256, 512, 1024, 2048
Note : This option is available for the enterprise users only.


scaled_bbox OPTIONAL
type : array
in : body
example : [1.0, 1.0, 1.0]
description: Scaled bounding box describing the target dimensions of the asset to be generated. Specifically, scaled_bbox is a list of 3 float numbers, where scaled_bbox[0] is width, scaled_bbox[1] is height and scaled_bbox[2] is the depth.
Note : This option is available for the enterprise users only.


pivot_point OPTIONAL
type : array
in : body
example : [0.0, 0.0, 0.0]
description: This parameter allows customizing the pivot point or origin of the exported mesh. Specifically, pivot_point is a list of 3 float numbers corresponding to the x, y, and z pivot point coordinates. The pivot_point values should be in the range [-0.5, 0.5], inclusive, and are normalized to the dimensions of the mesh's bounding box. For the exported mesh to have a pivot point in the center of its bounding box, pass [0, 0, 0] (default). [-0.5, -0.5, -0.5] will result in the pivot point being at the left, bottom, front (-X, -Y, -Z) corner of the bounding box, and [0.5, 0.5, 0.5] will result in a pivot point at the right, top, back (+X, +Y, +Z) corner of the bounding box. For the exported mesh to have a pivot point at the center bottom of the bounding box, pass [0, -0.5, 0].
Note : This option is available for the enterprise users only.

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",
  "refine_speed": "fast",
  "creativity": "lowest",
})
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",
  "refine_speed": "fast",
  "creativity": "lowest",
})

};
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",
  "refine_speed": "fast",
  "creativity": "lowest",
}'

Response

{
    "error": "",
    "message": "Created",
    "statusCode": 201,
    "data": {
        "_id": "669924dCCCCCCCa04a493d12",
        "user_id": "63XXXXXXXXXXXX0551638c",
        "session_code": "SESSION_1721312476_7674068",
        "image_url": "https://via.placeholder.com/300/09f/fff.png",
        "input_image": "",
        "caption": "",
        "discord_user_id": "",
        "user_name": "",
        "email": "",
        "preview_mesh_url": "",
        "mesh_url_usdz": "",
        "mesh_url_glb": "",
        "reactions_count": 0,
        "texture_resolution": 2048,
        "mesh_url": "",
        "polished_mesh_url_usdz": "",
        "polished_mesh_url_glb": "",
        "polished_mesh_url": "",
        "mesh_url_obj": "",
        "mesh_url_zip": "",
        "preview_mesh_url_zip": "",
        "preview_mesh_url_glb": "",
        "preview_mesh_url_usdz": "",
        "preview_mesh_url_fbx": "",
        "mesh_url_fbx": "",
        "mp4_url": "",
        "designer_mesh_url": "",
        "preview_mesh_url_3mf": "",
        "mesh_url_3mf": "",
        "session_gif": "",
        "user_image": "",
        "price": 0,
        "status": "spin_generate_processing",
        "topology": "tris",
        "resolution": "",
        "source": "external",
        "demo": false,
        "user_demo": false,
        "private": true,
        "random_poses": true,
        "inference": [],
        "output_id": "2f016cde-9819-4e84-bd9e-9c98ffcccb9c",
        "animated_walk_url": "",
        "animated_run_url": "",
        "animated_jump_url": "",
        "back_image_url": "",
        "auto_refine": false,
        "model_version": "2.0",
        "selected_spin": "",
        "is_deleted": false,
        "manual_segmentation": false,
        "preview_mesh": "turbo",
        "creativity": "lowest",
        "selected_spin_index": 0,
        "user_id_in_string": "632d3XXXXXXX51638c",
        "asset_code": null,
        "scaled_bbox": [],
        "artist_refine": false,
        "to_be_unlisted": false,
        "preview_removed": false,
        "assignments_image_url": null,
        "refine_speed": "fast",
        "spins": [],
        "created_at": "2024-07-18T14:21:18.050Z",
        "updated_at": "2024-07-18T14:21:20.582Z"
    }
}