---
url: >-
  https://game-engine-io.github.io/enginex-frontend-sdk/reference/api/@getenginex/sdk/interfaces/ProfileApi.md
---
[Reference](../../../index.md) / [@getenginex/sdk](../index.md) / ProfileApi

# ProfileApi

The player's profile and sessions. All methods require login.

## Methods

### get()

> **get**(`params?`, `options?`): `Promise`<[`Profile`](Profile.md)>

The logged-in player's profile.

#### Parameters

##### params?

[`NoParams`](../type-aliases/NoParams.md)

##### options?

[`CallOptions`](CallOptions.md)

#### Returns

`Promise`<[`Profile`](Profile.md)>

#### Example

```ts
const me = await enginex.profile.get()
console.log(me.displayName, me.cpf) // 'Ana S.', '***.456.789-**'
```

#### Throws

`UNAUTHENTICATED` without a session (or if it cannot be renewed).

***

### listSessions()

> **listSessions**(`params?`, `options?`): `Promise`<[`ProfileSession`](ProfileSession.md)\[]>

The player's login sessions.

#### Parameters

##### params?

[`NoParams`](../type-aliases/NoParams.md)

##### options?

[`CallOptions`](CallOptions.md)

#### Returns

`Promise`<[`ProfileSession`](ProfileSession.md)\[]>

#### Example

```ts
const sessions = await enginex.profile.listSessions()
const others = sessions.filter((s) => !s.current)
```

#### Throws

`UNAUTHENTICATED` without a session.

***

### revokeSession()

> **revokeSession**(`input`, `options?`): `Promise`<`void`>

Ends a login session (another device).

#### Parameters

##### input

###### sessionId

`string`

##### options?

[`CallOptions`](CallOptions.md)

#### Returns

`Promise`<`void`>

#### Example

```ts
await enginex.profile.revokeSession({ sessionId: session.id })
```

#### Throws

`UNAUTHENTICATED` without a session; `NOT_FOUND` if the id does not exist.

***

### update()

> **update**(`input`, `options?`): `Promise`<[`Profile`](Profile.md)>

Updates `username` and/or `displayName` and returns the complete, already updated profile.

#### Parameters

##### input

[`UpdateProfileInput`](../type-aliases/UpdateProfileInput.md)

##### options?

[`CallOptions`](CallOptions.md)

#### Returns

`Promise`<[`Profile`](Profile.md)>

#### Example

```ts
const me = await enginex.profile.update({ displayName: 'Ana S.' })
```

#### Throws

`INVALID_ARGUMENT` (400) for an empty field or invalid body; `UNAUTHENTICATED`
without a session; gateway errors for a username already in use.
