---
title: 'API reference'
url: 'https://docs.geens.com/geens-partners/geens-sdk/browser-sdk/api-reference'
markdown: 'https://docs.geens.com/geens-partners/geens-sdk/browser-sdk/api-reference.md'
date: '2026-12-03'
description: 'Reference for the GeensSdk class, the default export of @geens_npo/browser-sdk 0.1.7. It is generated from the TypeScript declarations included in the package. See the guide pages for usage examples, and Callbacks and errors for the callback conventions used by most methods. Constructors Construct…'
---

# API reference

[](#)# API reference

Reference for the `GeensSdk` class, the default export of `@geens_npo/browser-sdk` 0.1.7. It is generated from the TypeScript declarations included in the package. See the [guide pages](https://docs.geens.com/geens-partners/geens-sdk/browser-sdk) for usage examples, and [Callbacks and errors](https://docs.geens.com/geens-partners/geens-sdk/browser-sdk/callbacks-and-errors) for the callback conventions used by most methods.

## Constructors

### Constructor

```ts
new GeensSdk(
   client_id, 
   redirect_uri, 
   geens_server_uri, 
   logout_uri?
): GeensSdk;
```

#### Parameters

| Parameter | Type |
|---|---|
| `client_id` | `string` |
| `redirect_uri` | `string` |
| `geens_server_uri` | `string` |
| `logout_uri?` | `string` |

#### Returns

`GeensSdk`

## Properties

### code

```ts
code: string = '';
```

### geensGroupUserPermissionsList

```ts
geensGroupUserPermissionsList: any = PermissionsList;
```

### itemApiService

```ts
itemApiService: ItemApiService;
```

### loggedIn

```ts
loggedIn: boolean = false;
```

### opener

```ts
opener: any = null;
```

### popup

```ts
popup: any = null;
```

### rolesService

```ts
rolesService: RolesService;
```

## Methods

### checkGeensIds()

```ts
checkGeensIds(
   geensIds, 
   on_success, 
   on_error
): void;
```

Check if geens ids exists

#### Parameters

| Parameter | Type |
|---|---|
| `geensIds` | `string`\[\] |
| `on_success` | `any` |
| `on_error` | `any` |

#### Returns

`void`

### checkIfUserHasPermission()

```ts
checkIfUserHasPermission(permission): boolean;
```

#### Parameters

| Parameter | Type |
|---|---|
| `permission` | `PermissionsList`\[\] |

#### Returns

`boolean`

### clearLocalStorage()

```ts
clearLocalStorage(redirectUrl?, reloadWindow?): void;
```

Clear local storage

#### Parameters

| Parameter | Type | Default value |
|---|---|---|
| `redirectUrl?` | `string` \| `null` | `null` |
| `reloadWindow?` | `boolean` | `true` |

#### Returns

`void`

### copyItems()

```ts
copyItems(
   parent_id, 
   items_ids, 
   options, 
   on_success, 
   on_error
): void;
```

Copy items

#### Parameters

| Parameter | Type |
|---|---|
| `parent_id` | `number` \| `null` |
| `items_ids` | `number`\[\] |
| `options` | { `external_access_token?`: `string`\[\] \| `null`; `password?`: `string`; `url_token?`: `string`; } |
| `options.external_access_token?` | `string`\[\] \| `null` |
| `options.password?` | `string` |
| `options.url_token?` | `string` |
| `on_success` | `any` |
| `on_error` | `any` |

#### Returns

`void`

### createDirectory()

```ts
createDirectory(
   parent_id?, 
   title, 
   is_private_directory?, 
   options, 
   on_success, 
   on_error
): void;
```

Create directory in geens

#### Parameters

| Parameter | Type | Default value |
|---|---|---|
| `parent_id?` | `number` \| `null` | `null` |
| `title` | `string` | `undefined` |
| `is_private_directory?` | `boolean` | `false` |
| `options` | { `external_access_token?`: `string`; `external_access_token_for_parent_item?`: `string`; `password?`: `string`; `url_token?`: `string`; } | `undefined` |
| `options.external_access_token?` | `string` | `undefined` |
| `options.external_access_token_for_parent_item?` | `string` | `undefined` |
| `options.password?` | `string` | `undefined` |
| `options.url_token?` | `string` | `undefined` |
| `on_success` | `any` | `undefined` |
| `on_error` | `any` | `undefined` |

#### Returns

`void`

### createFile()

```ts
createFile(
   parent_id?, 
   title?, 
   extension?, 
   mime_type?, 
   file, 
   is_private, 
   options, 
   on_success, 
   on_error
): void;
```

Create file in Geens

#### Parameters

| Parameter | Type | Default value |
|---|---|---|
| `parent_id?` | `number` \| `null` | `null` |
| `title?` | `string` \| `null` | `null` |
| `extension?` | `string` \| `null` | `null` |
| `mime_type?` | `string` \| `null` | `null` |
| `file` | `any` | `undefined` |
| `is_private` | `boolean` | `undefined` |
| `options` | { `external_access_token?`: `string`; `external_access_token_for_parent_item?`: `string`; `password?`: `string`; `url_token?`: `string`; } | `undefined` |
| `options.external_access_token?` | `string` | `undefined` |
| `options.external_access_token_for_parent_item?` | `string` | `undefined` |
| `options.password?` | `string` | `undefined` |
| `options.url_token?` | `string` | `undefined` |
| `on_success` | `any` | `undefined` |
| `on_error` | `any` | `undefined` |

#### Returns

`void`

### createItemShareForUsers()

```ts
createItemShareForUsers(
   itemId, 
   geensIds, 
   permission, 
   on_success, 
   on_error
): void;
```

Create item share for users

#### Parameters

| Parameter | Type |
|---|---|
| `itemId` | `number` |
| `geensIds` | `string`\[\] |
| `permission` | `number` |
| `on_success` | `any` |
| `on_error` | `any` |

#### Returns

`void`

### createItemVersion()

```ts
createItemVersion(
   item_id, 
   file, 
   options, 
   on_success, 
   on_error
): void;
```

Create item version

#### Parameters

| Parameter | Type |
|---|---|
| `item_id` | `number` |
| `file` | `any` |
| `options` | { `external_access_token?`: `string`; `password?`: `string`; `url_token?`: `string`; } |
| `options.external_access_token?` | `string` |
| `options.password?` | `string` |
| `options.url_token?` | `string` |
| `on_success` | `any` |
| `on_error` | `any` |

#### Returns

`void`

### decryptText()

```ts
decryptText(
   encrypted_text, 
   password, 
   on_success, 
   on_error
): void;
```

#### Parameters

| Parameter | Type |
|---|---|
| `encrypted_text` | `string` |
| `password` | `string` |
| `on_success` | `any` |
| `on_error` | `any` |

#### Returns

`void`

### deleteItemVersion()

```ts
deleteItemVersion(
   item, 
   options, 
   on_success, 
   on_error
): void;
```

Delete item version

#### Parameters

| Parameter | Type |
|---|---|
| `item` | { `id`: `number`; `version`: { `id`: `number`; }; } |
| `item.id` | `number` |
| `item.version` | { `id`: `number`; } |
| `item.version.id` | `number` |
| `options` | { `external_access_token?`: `string`; `password?`: `string`; `url_token?`: `string`; } |
| `options.external_access_token?` | `string` |
| `options.password?` | `string` |
| `options.url_token?` | `string` |
| `on_success` | `any` |
| `on_error` | `any` |

#### Returns

`void`

### downloadItem()

```ts
downloadItem(
   items, 
   options, 
   on_success, 
   on_error
): void;
```

Download item

#### Parameters

| Parameter | Type |
|---|---|
| `items` | \[{ `itemId`: `number`; `versionId?`: `number`; }\] |
| `options` | { `external_access_token?`: `string`; `password?`: `string`; `url_token?`: `string`; } |
| `options.external_access_token?` | `string` |
| `options.password?` | `string` |
| `options.url_token?` | `string` |
| `on_success` | `any` |
| `on_error` | `any` |

#### Returns

`void`

### editNote()

```ts
editNote(
   item_id, 
   newContent, 
   options, 
   on_success, 
   on_error
): void;
```

Update note

#### Parameters

| Parameter | Type |
|---|---|
| `item_id` | `number` |
| `newContent` | `string` |
| `options` | { `external_access_token?`: `string`; `password?`: `string`; `url_token?`: `string`; } |
| `options.external_access_token?` | `string` |
| `options.password?` | `string` |
| `options.url_token?` | `string` |
| `on_success` | `any` |
| `on_error` | `any` |

#### Returns

`void`

### encryptText()

```ts
encryptText(
   text, 
   password, 
   on_success, 
   on_error
): void;
```

#### Parameters

| Parameter | Type |
|---|---|
| `text` | `string` |
| `password` | `string` |
| `on_success` | `any` |
| `on_error` | `any` |

#### Returns

`void`

### finalizeLogin()

```ts
finalizeLogin(
   access_token_data, 
   redirectUrl?, 
   reloadWindow?, 
   on_success?, 
   on_error?
): void;
```

Finalize login by setting access token and user data

#### Parameters

| Parameter | Type | Default value |
|---|---|---|
| `access_token_data` | { `access_token`: `string`; `expires_in`: `number`; `token_type`: `string`; } | `undefined` |
| `access_token_data.access_token` | `string` | `undefined` |
| `access_token_data.expires_in` | `number` | `undefined` |
| `access_token_data.token_type` | `string` | `undefined` |
| `redirectUrl?` | `string` | `undefined` |
| `reloadWindow?` | `boolean` | `true` |
| `on_success?` | `any` | `undefined` |
| `on_error?` | `any` | `undefined` |

#### Returns

`void`

### finalizeLogout()

```ts
finalizeLogout(redirectUrl?, reloadWindow?): void;
```

Finalize log out by clearing local storage and reloading the window

#### Parameters

| Parameter | Type | Default value |
|---|---|---|
| `redirectUrl?` | `string` | `undefined` |
| `reloadWindow?` | `boolean` | `true` |

#### Returns

`void`

### generateCryptographicallySafeRandomToken()

```ts
generateCryptographicallySafeRandomToken(
   excludedChars?, 
   onlyNumbersAndLetters?, 
   on_success, 
   on_error
): void;
```

#### Parameters

| Parameter | Type | Default value |
|---|---|---|
| `excludedChars?` | `string`\[\] | `[]` |
| `onlyNumbersAndLetters?` | `boolean` | `false` |
| `on_success` | `any` | `undefined` |
| `on_error` | `any` | `undefined` |

#### Returns

`void`

### generateSharableUrlLinks()

```ts
generateSharableUrlLinks(
   itemsIds, 
   password, 
   permission, 
   sharedIdentityType, 
   urlToken?, 
   on_success, 
   on_error
): void;
```

Generate sharable url link

#### Parameters

| Parameter | Type | Default value |
|---|---|---|
| `itemsIds` | `number`\[\] | `undefined` |
| `password` | `string` | `undefined` |
| `permission` | `number` | `undefined` |
| `sharedIdentityType` | `number` | `undefined` |
| `urlToken?` | `any` | `null` |
| `on_success` | `any` | `undefined` |
| `on_error` | `any` | `undefined` |

#### Returns

`void`

### getAllItems()

```ts
getAllItems(
   is_deleted, 
   on_success, 
   on_error
): void;
```

Get all user items

#### Parameters

| Parameter | Type |
|---|---|
| `is_deleted` | `boolean` |
| `on_success` | `any` |
| `on_error` | `any` |

#### Returns

`void`

### getAvatar()

```ts
getAvatar(keyId): void;
```

#### Parameters

| Parameter | Type |
|---|---|
| `keyId` | `string` |

#### Returns

`void`

### getItem()

```ts
getItem(
   item_ids, 
   options, 
   on_success, 
   on_error
): void;
```

Get user item

#### Parameters

| Parameter | Type |
|---|---|
| `item_ids` | `number`\[\] |
| `options` | { `external_access_token?`: `string`; `password?`: `string`; `url_token?`: `string`; } |
| `options.external_access_token?` | `string` |
| `options.password?` | `string` |
| `options.url_token?` | `string` |
| `on_success` | `any` |
| `on_error` | `any` |

#### Returns

`void`

### getItemsDescendants()

```ts
getItemsDescendants(
   item_ids, 
   options, 
   on_success, 
   on_error
): void;
```

Get all descendants of a specific item id

#### Parameters

| Parameter | Type |
|---|---|
| `item_ids` | `number`\[\] |
| `options` | { `external_access_token?`: `string`; `password?`: `any`; `url_token?`: `any`; } |
| `options.external_access_token?` | `string` |
| `options.password?` | `any` |
| `options.url_token?` | `any` |
| `on_success` | `any` |
| `on_error` | `any` |

#### Returns

`void`

### getNotificationBeforeAccessTokenExpires()

```ts
getNotificationBeforeAccessTokenExpires(minutes_before_expiration?, on_session_end_callback): void;
```

Invoke a callback when the stored access token is near expiry.

#### Parameters

| Parameter | Type | Default value |
|---|---|---|
| `minutes_before_expiration?` | `number` | `1` |
| `on_session_end_callback` | `any` | `undefined` |

#### Returns

`void`

### getSharedUrl()

```ts
getSharedUrl(
   item_id, 
   options, 
   on_success, 
   on_error
): void;
```

#### Parameters

| Parameter | Type |
|---|---|
| `item_id` | `number` |
| `options` | { `external_access_token?`: `string`\[\] \| `null`; `password?`: `any`; `url_token?`: `any`; } |
| `options.external_access_token?` | `string`\[\] \| `null` |
| `options.password?` | `any` |
| `options.url_token?` | `any` |
| `on_success` | `any` |
| `on_error` | `any` |

#### Returns

`void`

### getUserData()

```ts
getUserData(on_success, on_error): void;
```

Get user data from geens api

#### Parameters

| Parameter | Type |
|---|---|
| `on_success` | `any` |
| `on_error` | `any` |

#### Returns

`void`

### getUsersByUids()

```ts
getUsersByUids(
   UIds, 
   on_success, 
   on_error
): void;
```

Get users by UIDs

#### Parameters

| Parameter | Type |
|---|---|
| `UIds` | `string`\[\] |
| `on_success` | `any` |
| `on_error` | `any` |

#### Returns

`void`

### listAllItems()

```ts
listAllItems(
   parent_id, 
   options, 
   on_success, 
   on_error
): void;
```

List items all items with a specific parent

#### Parameters

| Parameter | Type |
|---|---|
| `parent_id` | `number` |
| `options` | { `type`: `string`; } |
| `options.type` | `string` |
| `on_success` | `any` |
| `on_error` | `any` |

#### Returns

`void`

### moveItems()

```ts
moveItems(
   parent_id, 
   items_ids, 
   options, 
   on_success, 
   on_error
): void;
```

Move a items

#### Parameters

| Parameter | Type |
|---|---|
| `parent_id` | `number` \| `null` |
| `items_ids` | `number`\[\] |
| `options` | { `external_access_token?`: `string`\[\] \| `null`; `password?`: `string`; `url_token?`: `string`; } |
| `options.external_access_token?` | `string`\[\] \| `null` |
| `options.password?` | `string` |
| `options.url_token?` | `string` |
| `on_success` | `any` |
| `on_error` | `any` |

#### Returns

`void`

### onLogin()

```ts
onLogin(callback): void;
```

Event with the callback from third party application that makes request to receive access token

#### Parameters

| Parameter | Type |
|---|---|
| `callback` | `any` |

#### Returns

`void`

### openLogin()

```ts
openLogin(): void;
```

Open login window

#### Returns

`void`

### openLogout()

```ts
openLogout(): void;
```

Open logout window ///TODO If geens access token is revoked client app logout should clear the local storage and refresh the page

#### Returns

`void`

### permanentlyDeleteItems()

```ts
permanentlyDeleteItems(
   items_ids, 
   options, 
   on_success, 
   on_error
): void;
```

Delete items using the soft-delete state. The method name is retained for compatibility; it does not perform hard deletion.

#### Parameters

| Parameter | Type |
|---|---|
| `items_ids` | `number`\[\] |
| `options` | { `external_access_token?`: `string`; `password?`: `string`; `url_token?`: `string`; } |
| `options.external_access_token?` | `string` |
| `options.password?` | `string` |
| `options.url_token?` | `string` |
| `on_success` | `any` |
| `on_error` | `any` |

#### Returns

`void`

### revokeSharedItemAccess()

```ts
revokeSharedItemAccess(
   accessId, 
   on_success, 
   on_error
): void;
```

Revoke item access

#### Parameters

| Parameter | Type |
|---|---|
| `accessId` | `number` |
| `on_success` | `any` |
| `on_error` | `any` |

#### Returns

`void`

### revokeUrlShare()

```ts
revokeUrlShare(
   url_token, 
   on_success, 
   on_error
): void;
```

Revoke url shared access

#### Parameters

| Parameter | Type |
|---|---|
| `url_token` | `string` |
| `on_success` | `any` |
| `on_error` | `any` |

#### Returns

`void`

### rsaDecryptText()

```ts
rsaDecryptText(
   encrypted_text, 
   on_success, 
   on_error
): void;
```

#### Parameters

| Parameter | Type |
|---|---|
| `encrypted_text` | `string` |
| `on_success` | `any` |
| `on_error` | `any` |

#### Returns

`void`

### rsaEncryptText()

```ts
rsaEncryptText(
   text, 
   publicKey?, 
   on_success, 
   on_error
): void;
```

#### Parameters

| Parameter | Type | Default value |
|---|---|---|
| `text` | `string` | `undefined` |
| `publicKey?` | `any` | `null` |
| `on_success` | `any` | `undefined` |
| `on_error` | `any` | `undefined` |

#### Returns

`void`

### setAccessToken()

```ts
setAccessToken(access_token_data): void;
```

Setting access token in variable and local storage

#### Parameters

| Parameter | Type |
|---|---|
| `access_token_data` | { `access_token`: `string`; `expires_in`: `number`; `token_type`: `string`; } |
| `access_token_data.access_token` | `string` |
| `access_token_data.expires_in` | `number` |
| `access_token_data.token_type` | `string` |

#### Returns

`void`

### setCode()

```ts
setCode(code): void;
```

Set code

#### Parameters

| Parameter | Type |
|---|---|
| `code` | `string` |

#### Returns

`void`

### setPrivateKey()

```ts
setPrivateKey(privateKey): void;
```

Setting private key in variable and local storage

#### Parameters

| Parameter | Type |
|---|---|
| `privateKey` | `string` |

#### Returns

`void`

### updateItem()

```ts
updateItem(
   item_id, 
   title?, 
   description?, 
   options, 
   on_success, 
   on_error
): void;
```

Update item

#### Parameters

| Parameter | Type | Default value |
|---|---|---|
| `item_id` | `number` | `undefined` |
| `title?` | `string` \| `null` | `null` |
| `description?` | `string` \| `null` | `null` |
| `options` | { `external_access_token?`: `string` \| `null`; `password?`: `string`; `url_token?`: `string`; } | `undefined` |
| `options.external_access_token?` | `string` \| `null` | `undefined` |
| `options.password?` | `string` | `undefined` |
| `options.url_token?` | `string` | `undefined` |
| `on_success` | `any` | `undefined` |
| `on_error` | `any` | `undefined` |

#### Returns

`void`

### windowLocationUpdateForPopup()

```ts
windowLocationUpdateForPopup(redirectUrl?, reloadWindow?): void;
```

#### Parameters

| Parameter | Type |
|---|---|
| `redirectUrl?` | `string` |
| `reloadWindow?` | `boolean` |

#### Returns

`void`

### windowLocationUpdateForWebSite()

```ts
windowLocationUpdateForWebSite(redirectUrl?, reloadWindow?): void;
```

#### Parameters

| Parameter | Type |
|---|---|
| `redirectUrl?` | `string` \| `null` |
| `reloadWindow?` | `boolean` |

#### Returns

`void`

---

## Navigation

- Parent: [Browser SDK](https://docs.geens.com/geens-partners/geens-sdk/browser-sdk.md)
- Previous: [Text encryption and random tokens](https://docs.geens.com/geens-partners/geens-sdk/browser-sdk/text-encryption-and-random-tokens.md)
- Next: [License](https://docs.geens.com/geens-partners/geens-sdk/browser-sdk/license.md)
