Upload a GLB as a model
const url = 'https://api.virtualdisplay.io/v1/models';const form = new FormData();form.append('file', 'file');form.append('overwrite', 'example');
const options = {method: 'POST', headers: {Authorization: 'Bearer <token>'}};
options.body = form;
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request POST \ --url https://api.virtualdisplay.io/v1/models \ --header 'Authorization: Bearer <token>' \ --header 'Content-Type: multipart/form-data' \ --form file=@file \ --form overwrite=exampleAuthorizations
Section titled “Authorizations”Request Bodyrequired
Section titled “Request Bodyrequired”object
The GLB. Its filename becomes the model’s, and must end in .glb.
True to replace the model with the same filename. False or absent answers a conflict instead.
Responses
Section titled “Responses”The file replaced the model with the same filename, under the id it had.
object
The model the upload created or replaced.
object
The file’s name, with its .glb extension.
The model’s id. On a replace it is the id the model already had.
Example
{ "model": { "filename": "eiken-stoel.glb", "id": "0196a1f0-b8d4-7e21-8a6f-3c9d1e5b2f40" }}Created
object
The model the upload created or replaced.
object
The file’s name, with its .glb extension.
The model’s id. On a replace it is the id the model already had.
Example
{ "model": { "filename": "eiken-stoel.glb", "id": "0196a1f0-b8d4-7e21-8a6f-3c9d1e5b2f40" }}Bad Request
object
Null when the answer names no field. Otherwise, each field that is wrong:
file:required(The request has no file part, or it is not multipart.)overwrite:invalid_input(Not true or false.)
object
required: The request has no file part, or it is not multipart.
invalid_input: Not true or false.
validation_error: A field is wrong, or the body is not the JSON the operation takes. details names each wrong field; repair it, do not retry as it is.invalid_file_type: The filename does not end in .glb.file_too_large: The file is larger than the upload limit.glb_invalid_structure: The file is not a GLB this service can read. Re-export it as a GLB.glb_external_references: The file loads something from outside itself. Embed every texture and buffer.glb_unsupported_compression: The file uses a mesh or texture compression this service does not accept.glb_unsupported_extension: The file requires a GLB extension this service does not accept. Contact support.glb_security_violation: The file contains content this service refuses. The reason is not given.
Identifies the request on our side. Send it with a support question about a failure.
Examples
{ "error": "file_too_large", "trace_id": "4bf92f3577b34da6a3ce929d0e0e4736"}{ "error": "glb_external_references", "trace_id": "4bf92f3577b34da6a3ce929d0e0e4736"}{ "error": "glb_invalid_structure", "trace_id": "4bf92f3577b34da6a3ce929d0e0e4736"}{ "error": "glb_security_violation", "trace_id": "4bf92f3577b34da6a3ce929d0e0e4736"}{ "error": "glb_unsupported_compression", "trace_id": "4bf92f3577b34da6a3ce929d0e0e4736"}{ "error": "glb_unsupported_extension", "trace_id": "4bf92f3577b34da6a3ce929d0e0e4736"}{ "error": "invalid_file_type", "trace_id": "4bf92f3577b34da6a3ce929d0e0e4736"}{ "details": { "file": "required", "overwrite": "invalid_input" }, "error": "validation_error", "trace_id": "4bf92f3577b34da6a3ce929d0e0e4736"}{ "details": { "file": "required", "overwrite": "invalid_input" }, "error": "validation_error", "trace_id": "4bf92f3577b34da6a3ce929d0e0e4736"}The answer carries unauthorized or token_invalid. See the errors page.
object
Null: an answer with this status names no field.
unauthorized: No Bearer token was sent, or the token was revoked, or its integration was disabled. Send a valid token, do not retry the same one.token_invalid: The token is malformed, has a bad signature or has expired. Exchange the secret for a new token, then retry once.
Identifies the request on our side. Send it with a support question about a failure.
Examples
{ "error": "token_invalid", "trace_id": "4bf92f3577b34da6a3ce929d0e0e4736"}{ "error": "unauthorized", "trace_id": "4bf92f3577b34da6a3ce929d0e0e4736"}Forbidden
object
Null: an answer with this status names no field.
forbidden: The token is valid, but this integration may not make this call. Do not retry.model_limit_reached: The subscription has no room for another model. Free a slot or raise the plan, then upload.subscription_cancelled: The subscription is cancelled. Renew it before uploading.
Identifies the request on our side. Send it with a support question about a failure.
Examples
{ "error": "forbidden", "trace_id": "4bf92f3577b34da6a3ce929d0e0e4736"}{ "error": "model_limit_reached", "trace_id": "4bf92f3577b34da6a3ce929d0e0e4736"}{ "error": "subscription_cancelled", "trace_id": "4bf92f3577b34da6a3ce929d0e0e4736"}Not Found
object
Null: an answer with this status names no field.
not_found: The Customer no longer exists.
Identifies the request on our side. Send it with a support question about a failure.
Examples
{ "error": "not_found", "trace_id": "4bf92f3577b34da6a3ce929d0e0e4736"}Conflict
object
Null when the answer names no field. Otherwise, each field that is wrong:
filename: free text. The filename that is taken.suggested_filename: free text. The filename to retry with: this one with a short suffix.
object
The filename that is taken.
The filename to retry with: this one with a short suffix.
file_exists: A live model has this filename, and overwrite was not set to true. The details name a suggested_filename to use instead.conflict: The model was deleted while the file was uploaded. Send the upload again.
Identifies the request on our side. Send it with a support question about a failure.
Examples
{ "error": "conflict", "trace_id": "4bf92f3577b34da6a3ce929d0e0e4736"}{ "details": { "filename": "eiken-stoel.glb", "suggested_filename": "eiken-stoel_0196b3f2.glb" }, "error": "file_exists", "trace_id": "4bf92f3577b34da6a3ce929d0e0e4736"}Request Entity Too Large
object
Null: an answer with this status names no field.
body_too_large: The request body is larger than we accept, so nothing was done. Make it smaller, then retry once.
Identifies the request on our side. Send it with a support question about a failure.
Examples
{ "error": "body_too_large", "trace_id": "4bf92f3577b34da6a3ce929d0e0e4736"}The answer carries rate_limited. See the errors page.
object
Null: an answer with this status names no field.
rate_limited: The integration or its Customer is over its budget. Wait for the Retry-After seconds, then retry.
Identifies the request on our side. Send it with a support question about a failure.
Examples
{ "error": "rate_limited", "trace_id": "4bf92f3577b34da6a3ce929d0e0e4736"}The answer carries internal_error. See the errors page.
object
Null: an answer with this status names no field.
internal_error: Our fault. Retry with backoff, then stop; send the trace_id if it persists.
Identifies the request on our side. Send it with a support question about a failure.
Examples
{ "error": "internal_error", "trace_id": "4bf92f3577b34da6a3ce929d0e0e4736"}