> For the complete documentation index, see [llms.txt](https://docs.multiset.ai/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.multiset.ai/webxr-sdk/api-reference/multisetclient.md).

# MultisetClient

```typescript
import { MultisetClient } from '@multisetai/vps/core';
```

Handles all communication with the Multiset API. Has no rendering or WebXR dependencies.

### Constructor

```typescript
new MultisetClient(config: IMultisetClientConfig)
```

Config is a discriminated union based on `mapType`.

#### VPS Config (`mapType: 'map'` or `'map-set'`)

| Parameter                 | Type                             | Required | Description                                                                   |
| ------------------------- | -------------------------------- | -------- | ----------------------------------------------------------------------------- |
| `clientId`                | `string`                         | Yes      | From the Multiset Developer Portal                                            |
| `clientSecret`            | `string`                         | Yes      | From the Multiset Developer Portal                                            |
| `mapType`                 | `'map' \| 'map-set'`             | Yes      | Single map or map set                                                         |
| `code`                    | `string`                         | Yes      | Map code or map set code                                                      |
| `isRightHanded`           | `boolean`                        | No       | Default `true`. Set `false` if consuming coordinates in a left-handed system. |
| `convertToGeoCoordinates` | `boolean`                        | No       | Return lat/lon/alt in the response. Map must be georeferenced.                |
| `hintPosition`            | `string`                         | No       | Local-space hint as `"x,y,z"`                                                 |
| `hintRadius`              | `number \| string`               | No       | Search radius in metres (1 to 100)                                            |
| `hintMapCodes`            | `string[]`                       | No       | Restrict search to these maps within a map set                                |
| `passGeoPose`             | `boolean`                        | No       | Send device GPS coordinates with each request                                 |
| `use2DFiltering`          | `boolean`                        | No       | Ignore altitude in geo filtering. Requires `passGeoPose: true`.               |
| `endpoints`               | `Partial<IMultisetSdkEndpoints>` | No       | Override default API endpoints                                                |

#### Object Tracking Config (`mapType: 'object-tracking'`)

| Parameter       | Type                             | Required | Description                        |
| --------------- | -------------------------------- | -------- | ---------------------------------- |
| `clientId`      | `string`                         | Yes      | From the Multiset Developer Portal |
| `clientSecret`  | `string`                         | Yes      | From the Multiset Developer Portal |
| `mapType`       | `'object-tracking'`              | Yes      |                                    |
| `code`          | `string[]`                       | Yes      | Array of object codes (1 to 10)    |
| `isRightHanded` | `boolean`                        | No       | Default `true`                     |
| `endpoints`     | `Partial<IMultisetSdkEndpoints>` | No       | Override default API endpoints     |

### Methods

| Method                                           | Returns                                    | Description                                                                       |
| ------------------------------------------------ | ------------------------------------------ | --------------------------------------------------------------------------------- |
| `authorize()`                                    | `Promise<string>`                          | Authenticate and store access token. Must be called before any other method.      |
| `localizeWithFrame(frame, intrinsics, options?)` | `Promise<ILocalizeAndMapDetails \| null>`  | Submit a captured frame for VPS localization. Returns `null` if no pose is found. |
| `trackObject(frame, intrinsics)`                 | `Promise<IObjectTrackingResponse \| null>` | Submit a frame for object detection. Returns `null` if no object is detected.     |
| `downloadObjectMesh(objectCode)`                 | `Promise<string \| null>`                  | Fetch a signed download URL for an object's 3D mesh.                              |
| `fetchMapDetails(mapCode)`                       | `Promise<IGetMapsDetailsResponse \| null>` | Fetch map metadata. Result is cached after the first call.                        |

### Properties

| Property      | Type             | Description                                                              |
| ------------- | ---------------- | ------------------------------------------------------------------------ |
| `token`       | `string \| null` | Access token after `authorize()`. `null` before authorization.           |
| `mapType`     | `string`         | The `mapType` from config                                                |
| `objectCodes` | `string[]`       | Object codes from config. Empty unless `mapType` is `'object-tracking'`. |

### Custom Endpoints

Override individual endpoints for on-premises deployments:

```typescript
const client = new MultisetClient({
  clientId: '...',
  clientSecret: '...',
  mapType: 'map',
  code: '...',
  endpoints: {
    authUrl: 'https://my-server.example.com/v1/m2m/token',
    queryUrl: 'https://my-server.example.com/v1/vps/map/query-form',
  },
});
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.multiset.ai/webxr-sdk/api-reference/multisetclient.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
