---
title: loadModel
slug: viewer-3d/methods/loadModel
docTags: 
createdAt: 2024-03-01T14:17:48.684Z
---

Loads a model from a URL.

## Example

::codepen{url="https://codepen.io/Catenda/embed/eYwPege"}

## Usage

```javascript
const options = {
  modelId: "my-model-id"
};
const url = "https://URL_TO_YOUR_3D_MODEL";

const modelInfoPromise = viewer3d.loadModel(url, options);
```

## Parameters

### url

URL to the model.

| **Type** | **Required** |
| -------- | ------------ |
| String   | Yes          |

### options

Options when loading the model.

| **Type** | **Required** |
| -------- | ------------ |
| Object   | No           |

**Properties**

| **Name**       | **Type**         | **Required** | **Description**                                      |
| -------------- | ---------------- | ------------ | ---------------------------------------------------- |
| `color`        | String or Number | No           | Color used on objects                                |
| `format`       | String           | No           | Valid value is `gltf` and `modelType` must be `mesh` |
| `headers`      | Object           | No           | Map of headers to send with the request              |
| `initialState` | String           | No           | Initial visibility state of the model                |
| `mapObjectId`  | Function         | No           | Function for mapping the object id to a custom id    |
| `modelId`      | String           | No           | Id of the model                                      |
| `modelType`    | String           | No           | Valids values are `bim`, `mesh`or `point-cloud`      |
| `query`        | Object           | No           | Query to send with the request                       |
| `transform`    | Object           | No           | Initial transform of the model                       |

**headers**

Map of headers to send with the request.

| **Type**     |
| ------------ |
| Map\[String] |

**initialState**

Initial visibility state of the model.

Valid values are:

- `hidden`
- `visible`

**mapObjectId**

Function for mapping the object id to a custom id.

| **Type**                                        |
| ----------------------------------------------- |
| `(modelId: String, objectId: String) => String` |

**query**

Query to send with the request.

| **Type**      |
| ------------- |
| `Map[Object]` |

**transform**

The initial transform of the model.

| **Name**   | **Type**                                | **Required** | **Description**     |
| ---------- | --------------------------------------- | ------------ | ------------------- |
| `position` | [Vector3](docId\:kEwRHKTC8Iq2HlT48sRFQ) | No           | Position to move to |
| `rotation` | [Rotation](docId:2oViB7IabUIfxwS58jVDO) | No           | Rotation transform  |
| `scale`    | [Vector3](docId\:kEwRHKTC8Iq2HlT48sRFQ) | No           | Scale transform     |

## Return Value

Promise that resolves to the model info for the loaded models.

| **Type**                       |
| ------------------------------ |
| `Promise => modelInfo: Object` |

**modelInfo**

| **Name**              | **Type**                             | **Description**                         |
| --------------------- | ------------------------------------ | --------------------------------------- |
| `id`                  | String                               | Id of the loaded model                  |
| `boundingBox`         | [Box3](docId\:w-y1d3ZvTa83YjyCEvckw) | Bounding box of the loaded model        |
| `originalBoundingBox` | [Box3](docId\:w-y1d3ZvTa83YjyCEvckw) | Bounding box without applying transform |

