---
title: ViewerApi
summary: TypeScript SDK: the Viewer operations, 1 method, each with its parameters, result and a complete example.
order: 20
languages: [typescript]
sdk-package: TypeScript SDK · @bimworks/sdk
link-terms: true
---

# ViewerApi

[[page:reference/sdk/typescript|TypeScript SDK]] · `@bimworks/sdk` · class · 1 method

What the viewers need to place and load models

Construct it with the client of [[page:reference/sdk/typescript#connect|the connect step]]: `new ViewerApi(client)`. Each method is one operation of the [[page:api|API part]], where it runs on its page.

<table class="dense">
<thead><tr><th>Method</th><th>Operation</th><th>Description</th></tr></thead>
<tbody>
<tr><td><code>[[page:reference/sdk/typescript/viewerapi#getgeometrymetadata|getGeometryMetaData]]</code></td><td>[[openapi:GetGeometryMetaData]]</td><td>What a viewer needs to place and load models</td></tr>
</tbody>
</table>

## `getGeometryMetaData` {#getgeometrymetadata}

```typescript
getGeometryMetaData(requestParameters: { getGeometryMetaDataRequest: GetGeometryMetaDataRequest }): Promise<{ [key: string]: { [key: string]: any; }; }>
```

What a viewer needs to place and load models. Per Version (keyed by its uuid): the metadata of its geometry (bounds, units, the unquantization, the file types and the geometry encoding the viewer should load), and its placement (georeference, anchor point, alignment, grid convergence). The keys follow the indexed-model metadata, which the viewers read as they are.

<table class="dense">
<tbody>
<tr><th>Operation</th><td>[[openapi:GetGeometryMetaData]] · <code>POST /openapi/viewer/GetGeometryMetaData</code></td></tr>
<tr><th>Scope</th><td>[[scope:geometry:read]]</td></tr>
</tbody>
</table>

### Parameters

<table class="dense">
<thead><tr><th>Name</th><th>Type</th><th>Description</th></tr></thead>
<tbody>
<tr><td><code>getGeometryMetaDataRequest</code></td><td><code>[[page:reference/sdk/typescript/models#GetGeometryMetaDataRequest|GetGeometryMetaDataRequest]]</code><span class="req">required</span></td><td>The request: its properties are those of the model, its JSON that of [[openapi:GetGeometryMetaData]]'s request body.</td></tr>
</tbody>
</table>

### Returns

<code>{ [key: string]: { [key: string]: any; }; }</code> — The metadata per Version uuid

### Example

```typescript
import { AuthApi, Configuration, GetGeometryMetaDataRequestFromJSON, ViewerApi } from "@bimworks/sdk";

// 1. Connect to BIM.works and log in with your API token
const basePath = "BIM_WORKS_ADDRESS/openapi";
const auth = await new AuthApi(new Configuration({ basePath }))
  .loginWithApiToken({ loginWithApiTokenRequest: { token: "BIM_WORKS_API_TOKEN" } });
const client = new Configuration({ basePath, accessToken: typeof auth === "string" ? auth : auth.base64 });

// 2. The request
const request = GetGeometryMetaDataRequestFromJSON({
  "models": [
    {
      "type": "UrlModelIdentifier"
    }
  ]
});

// 3. The call
const result = await new ViewerApi(client).getGeometryMetaData({ getGeometryMetaDataRequest: request });

// 4. The result
console.log(JSON.stringify(result, null, 2));
```
