Table of contents
iModels
Download API definition:
POST https://dev-api.bentley.com/imodels/

Creates an iModel. There are three different ways to create an iModel.

Create an empty iModel

To create an empty iModel do not provide template and baselineFile properties.

Create an iModel from an existing iModel

To create an iModel from another iModel provide template property. The server will apply changesets up to the one specified by changesetId property to the source iModel file and use it as a Baseline File for the newly created iModel. User must have imodels_read permissions to the source iModel. Source and target iTwins must be in the same data center.

Create an iModel using a Baseline File.

Creating an iModel using a Baseline File allows to upload a custom iModel file that will become the base file of the created iModel. There are three steps in creating an iModel from a Baseline File:

  1. Create a new iModel and provide baselineFile property. It is important to provide correct file size or the iModel creation will fail in the later steps.

  2. Upload Baseline File to blob storage using upload property link from the response of iModel creation.

Request syntax:
    PUT upload HTTP/1.1
Request headers:
    x-ms-blob-type: BlockBlob
  1. Complete the iModel creation by confirming that Baseline File was uploaded successfully. See Complete iModel Baseline Upload operation for the documentation.

iModel initialization

When creating an empty iModel it will be initialized immediately. When creating an iModel using template or baselineFile properties initialization will be scheduled and it's state is reflected in the state property. For a more detailed information about initialization state see Get iModel Baseline File operation.

Authentication

Requires Authorization header with valid Bearer token for scope itwin-platform.

For more documentation on authorization and how to get access token visit OAUTH2 Authorization page.

Authorization

User must have the imodels_manage permission assigned at the iTwin level or be an Organization Administrator for the Organization that owns a given iTwin.

For more information please refer to Account Administrator documentation section on Access Control API documentation page.

Rate limits

This operation has a lower rate limit than the rest of iModels API operations. If an application exceeds the rate limit it will receive an HTTP error code 429 "Too Many Requests". The error response includes a Retry-After header that indicates how long clients should wait before retrying.

Tier
Rate limit
Trial
5 calls per minute
Basic, Premium, Enterprise
50 calls per minute

---

Request headers

Name
Required?
Description
Authorization
Yes

OAuth access token with itwin-platform scope

Accept
Yes

Setting to application/vnd.bentley.itwin-platform.v2+json is recommended.

Content-Type
No

Indicates request body content type. Supported media type is application/json.

Request body

iModelCreate (EmptyiModel)

Name
Type
Required?
Description
iTwinId
String
Yes

Id of the iTwin that created iModel should belong to.

name
String
Yes

Name of the iModel.

description
String, null
No

Description of the iModel.

extent
No

The maximum rectangular area on the Earth which encloses the iModel. The maximum extent is used to help keep your iModel clean. When new elements are imported, those outside the extent will be flagged for further processing. This extent will also help to zoom to the area of interest in web viewers.

template
No

When specified creates the iModel using another iModel as a template.

baselineFile
No

When specified creates the iModel using a custom Baseline File.

Example

json
{
    "iTwinId": "ad0ba809-9241-48ad-9eb0-c8038c1a1d51",
    "name": "Sun City Renewable-energy Plant",
    "description": "Overall model of wind and solar farms in Sun City",
    "extent": {
        "southWest": {
            "latitude": 46.13267702834806,
            "longitude": 7.672120009938448
        },
        "northEast": {
            "latitude": 46.302763954781234,
            "longitude": 7.835541640797823
        }
    },
    "template": null,
    "baselineFile": null
}

iModelCreate (FromTemplate)

Name
Type
Required?
Description
iTwinId
String
Yes

Id of the iTwin that created iModel should belong to.

name
String
Yes

Name of the iModel.

description
String, null
No

Description of the iModel.

extent
No

The maximum rectangular area on the Earth which encloses the iModel. The maximum extent is used to help keep your iModel clean. When new elements are imported, those outside the extent will be flagged for further processing. This extent will also help to zoom to the area of interest in web viewers.

template
No

When specified creates the iModel using another iModel as a template.

baselineFile
No

When specified creates the iModel using a custom Baseline File.

Example

json
{
    "iTwinId": "ad0ba809-9241-48ad-9eb0-c8038c1a1d51",
    "name": "Sun City Renewable-energy Plant",
    "description": "Overall model of wind and solar farms in Sun City",
    "extent": {
        "southWest": {
            "latitude": 46.13267702834806,
            "longitude": 7.672120009938448
        },
        "northEast": {
            "latitude": 46.302763954781234,
            "longitude": 7.835541640797823
        }
    },
    "template": {
        "iModelId": "5e19bee0-3aea-4355-a9f0-c6df9989ee7d",
        "changesetId": "1f2e04b666edce395e37a795e2231e995cbf8349"
    },
    "baselineFile": null
}

iModelCreate (FromBaselineFile)

Name
Type
Required?
Description
iTwinId
String
Yes

Id of the iTwin that created iModel should belong to.

name
String
Yes

Name of the iModel.

description
String, null
No

Description of the iModel.

extent
No

The maximum rectangular area on the Earth which encloses the iModel. The maximum extent is used to help keep your iModel clean. When new elements are imported, those outside the extent will be flagged for further processing. This extent will also help to zoom to the area of interest in web viewers.

template
No

When specified creates the iModel using another iModel as a template.

baselineFile
No

When specified creates the iModel using a custom Baseline File.

Example

json
{
    "iTwinId": "ad0ba809-9241-48ad-9eb0-c8038c1a1d51",
    "name": "Sun City Renewable-energy Plant",
    "description": "Overall model of wind and solar farms in Sun City",
    "extent": {
        "southWest": {
            "latitude": 46.13267702834806,
            "longitude": 7.672120009938448
        },
        "northEast": {
            "latitude": 46.302763954781234,
            "longitude": 7.835541640797823
        }
    },
    "template": null,
    "baselineFile": {
        "size": 12003548
    }
}

Response 201 Created

Created

json
{
    "iModel": {
        "id": "5e19bee0-3aea-4355-a9f0-c6df9989ee7d",
        "displayName": "Sun City Renewable-energy Plant",
        "dataCenterLocation": "East US",
        "name": "Sun City Renewable-energy Plant",
        "description": "Overall model of wind and solar farms in Sun City",
        "state": "initialized",
        "createdDateTime": "2020-10-20T10:51:33.1700000Z",
        "iTwinId": "ad0ba809-9241-48ad-9eb0-c8038c1a1d51",
        "isSecured": false,
        "extent": {
            "southWest": {
                "latitude": 46.13267702834806,
                "longitude": 7.672120009938448
            },
            "northEast": {
                "latitude": 46.302763954781234,
                "longitude": 7.835541640797823
            }
        },
        "_links": {
            "creator": {
                "href": "https://api.bentley.com/imodels/5e19bee0-3aea-4355-a9f0-c6df9989ee7d/users/42101fba-847a-4f4e-85a8-a4bed89065e4"
            },
            "changesets": {
                "href": "https://api.bentley.com/imodels/5e19bee0-3aea-4355-a9f0-c6df9989ee7d/changesets"
            },
            "namedVersions": {
                "href": "https://api.bentley.com/imodels/5e19bee0-3aea-4355-a9f0-c6df9989ee7d/namedversions"
            },
            "upload": null,
            "complete": null
        }
    }
}

Response 401 Unauthorized

This response indicates that request lacks valid authentication credentials. Access token might not been provided, issued by the wrong issuer, does not have required scopes or request headers were malformed.

json
{
    "error": {
        "code": "HeaderNotFound",
        "message": "Header Authorization was not found in the request. Access denied."
    }
}

Response 403 Forbidden

User is not authorized to create an iModel.

json
{
    "error": {
        "code": "InsufficientPermissions",
        "message": "The user has insufficient permissions for the requested operation."
    }
}

Response 404 Not Found

Specified iTwin was not found.

json
{
    "error": {
        "code": "iTwinNotFound",
        "message": "Requested iTwin is not available."
    }
}

Response 409 Conflict

iModel with the same name already exists within the iTwin.

json
{
    "error": {
        "code": "iModelExists",
        "message": "iModel with the same name already exists within the iTwin."
    }
}

Response 415 Unsupported Media Type

This response indicates that the user has specified not supported media type in the request.

json
{
    "error": {
        "code": "UnsupportedMediaType",
        "message": "Media Type is not supported."
    }
}

Response 422 Unprocessable Entity

The 422 (Unprocessable Entity) status code indicates that the request cannot be processed by the server due to a client error (e.g. malformed request syntax)

json
{
    "error": {
        "code": "InvalidiModelsRequest",
        "message": "Cannot create iModel.",
        "details": [{
                "code": "InvalidValue",
                "message": "Provided 'extent' value is not valid. Valid 'latitude' value range is -90 to 90.",
                "target": "extent"
            },
            {
                "code": "MissingRequiredProperty",
                "message": "Required property is missing.",
                "target": "name"
            },
            {
                "code": "InvalidRequestBody",
                "message": "Failed to parse request body. Make sure it is a valid JSON."
            }
        ]
    }
}

Response 429 Too many requests

This response indicates that the user has sent too many requests in a given amount of time.

json
{
    "error": {
        "code": "TooManyRequests",
        "message": "More requests were received than the subscription rate-limit allows."
    }
}

Response headers

Name
Description
retry-after

The number of requests exceeds the rate-limit for the client subscription.

Created iModel Response

Container for iModel object.

Name
Type
Description
iModel

iModel properties.

CreatediModel state

Indicates the state of the iModel. Possible values: 'initialized', 'notInitialized'.

Name
Type
Description
initialized
String
notInitialized
String

CreatediModel

Full representation of the iModel.

Name
Type
Description
id
String

Id of the iModel

displayName
String

Display name of the iModel. Corresponds to Name property.

dataCenterLocation
String

The data center where the data for this iModel is persisted. It will be the same as the iTwin data center, unless that data center is not supported or was not supported when the first iTwin iModel was created. All iTwin iModels are in the same region. Default is East US. Possible Values: Australia East, Canada Central, East US, Japan East, North Europe, South Africa North, Southeast Asia, UK South.

name
String

Name of the iModel.

description
String, null

Description of the iModel.

createdDateTime
Date-time

Date when the iModel was created.

iTwinId
String

Id of the iTwin that iModel belongs to.

isSecured
Boolean

Indicates if permissions at the iModel level are configured. true - iModel level permissions are configured. Permissions at iModel level override the iTwin level permissions. false - iModel permissions are not configured and the iTwin level permissions are applied.

extent

The maximum rectangular area on the Earth which encloses the iModel. The maximum extent is used to help keep your iModel clean. When new elements are imported, those outside the extent will be flagged for further processing. This extent will also help to zoom to the area of interest in web viewers.

CreatediModel state

Indicates the state of the iModel. Possible values: 'initialized', 'notInitialized'.

containersEnabled
Integer

Technology Preview property. Reserved for internal use only.

_links

Contains the hyperlinks to the related data of the iModel.

iModel (create)

Properties of the iModel to be created.

Name
Type
Description
iTwinId
String

Id of the iTwin that created iModel should belong to.

name
String

Name of the iModel.

description
String, null

Description of the iModel.

extent

The maximum rectangular area on the Earth which encloses the iModel. The maximum extent is used to help keep your iModel clean. When new elements are imported, those outside the extent will be flagged for further processing. This extent will also help to zoom to the area of interest in web viewers.

template

When specified creates the iModel using another iModel as a template.

baselineFile

When specified creates the iModel using a custom Baseline File.

iModel Template

Used for specifying the iModel template during iModel creation.

Name
Type
Description
iModelId
String

Id of the iModel which to use as a template.

changesetId
String, null

iModel timeline point to use as a template identified by the Changeset. When Changeset is not provided baseline is used.

Baseline File

Used for describing Baseline File during iModel creation.

Name
Type
Description
size
Int64

Size of the Baseline File in bytes. It is important to set accurate file size or the iModel creation will fail later.

Created iModel Links

Hyperlinks to related data which complements this entity.

Name
Type
Description
creator

Information about the creator of the entity.

changesets

Link to retrieve Changesets of the iModel.

namedVersions

Link to retrieve Named Versions of the iModel.

upload

Hyperlink to upload Baseline File to Azure Blob storage.

complete

Hyperlink to confirm that Baseline File was uploaded. See Complete Baseline File upload operation.

Link

Hyperlink container.

Name
Type
Description
href
String

Hyperlink to the specific entity.

Extent

A rectangular area on the Earth. A rectangular area is defined by two latitudes and two longitudes that represent the four sides of a rectangular area on the Earth.

Name
Type
Description
southWest

South Latitude, West Longitude.

northEast

North Latitude, East Longitude.

Point

A point on the Earth specified by a latitude and longitude.

Name
Type
Description
latitude
Double

Latitude. Latitude ranges between -90 and 90 degrees, inclusive.

longitude
Double

Longitude. Longitude ranges between -180 and 180 degrees, inclusive.

Error

Contains error information.

Name
Type
Description
code
String

One of a server-defined set of error codes.

message
String

A human-readable representation of the error.

target
String, null

The target of the error.

Error Response

Gives details for an error that occurred while handling the request. Note that clients MUST NOT assume that every failed request will produce an object of this schema, or that all of the properties in the response will be non-null, as the error may have prevented this response from being constructed.

Name
Type
Description
error

Error information.

Was this page helpful?