Animation
Upload Mesh

Upload Mesh

Upload a mesh file from your local system or provide a URL.

Request

POST https://api.csm.ai/mesh-animation/upload

Parameters

file OPTIONAL
type: file
in: form
description: Upload a zip file containing FBX files or an individual FBX file from your local system.


mesh_url OPTIONAL
type: string
in: body
description: Provide the URL to a zip file or an FBX file.


Notes: You can either provide a file path for the local file or a URL for the mesh. Ensure that the uploaded mesh is in the same orientation as this reference mesh (opens in a new tab).

Code Snippets

Python: file upload

import requests
 
url = "https://api.csm.ai/mesh-animation/upload"
 
payload = {}
files = [
  ('file', ('filename', open('/path/to/file', 'rb'), 'application/octet-stream'))
]
headers = {
  'x-api-key': '<X-API_KEY>'
}
 
response = requests.request("POST", url, headers=headers, data=payload, files=files)
 
print(response.text)

Python: mesh URL

import requests
import json
 
url = "https://api.csm.ai/mesh-animation/upload"
 
payload = json.dumps({
  "mesh_url": "https://example.com/file/mesh.fbx"
})
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: file upload

var request = require('request');
var fs = require('fs');
var options = {
  method: 'POST',
  url: 'https://api.csm.ai/mesh-animation/upload',
  headers: {
    'x-api-key': '<X-API_KEY>'
  },
  formData: {
    'file': {
      'value': fs.createReadStream('/path/to/file'),
      'options': {
        'filename': 'filename',
        'contentType': null
      }
    }
  }
};
request(options, function (error, response) {
  if (error) throw new Error(error);
  console.log(response.body);
});

Node.js: mesh URL

var request = require('request');
var options = {
  method: 'POST',
  url: 'https://api.csm.ai/mesh-animation/upload',
  headers: {
    'x-api-key': '<X-API_KEY>',
    'Content-Type': 'application/json'
  },
  body: JSON.stringify({
    "mesh_url": "https://example.com/file/mesh.fbx"
  })
};
request(options, function (error, response) {
  if (error) throw new Error(error);
  console.log(response.body);
});

Curl: file upload

curl --location 'https://api.csm.ai/mesh-animation/upload' \
--header 'x-api-key: <X-API_KEY>' \
--form 'file=@"/path/to/file"'

Curl: mesh URL

curl --location 'https://api.csm.ai/mesh-animation/upload' \
--header 'x-api-key: <X-API_KEY>' \
--header 'Content-Type: application/json' \
--data '{
    "mesh_url": "https://example.com/file/mesh.fbx"
}'

Response

{
    "error": "",
    "message": "Success",
    "statusCode": 200,
    "data": {
        "session_code": "SESSION_17_7620_21332",
        "mesh_url": "https://uploads/SESSION_17_7620_21332/mesh.fbx",
        "status": "init_processing"
    }
}