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

# PixKeysApi

The player's PIX keys, to choose the destination of withdrawals. All methods require login.

## Methods

### add()

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

Registers a PIX key. The response carries only the masked value.

#### Parameters

##### input

###### keyType

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

###### keyValue

`string`

##### options?

[`CallOptions`](CallOptions.md)

#### Returns

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

#### Example

```ts
const key = await enginex.pixKeys.add({ keyType: 'email', keyValue: 'ana@exemplo.com' })
```

#### Throws

`INVALID_ARGUMENT` (400) without a type or value, or with an invalid key; an error from the
payment service for a duplicate key; `UNAUTHENTICATED` without a session.

***

### list()

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

Registered PIX keys.

#### Parameters

##### params?

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

##### options?

[`CallOptions`](CallOptions.md)

#### Returns

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

#### Example

```ts
const keys = await enginex.pixKeys.list()
const preferred = keys.find((k) => k.isDefault)
```

#### Throws

`UNAUTHENTICATED` without a session.

***

### remove()

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

Removes a PIX key.

#### Parameters

##### input

###### keyId

`string`

##### options?

[`CallOptions`](CallOptions.md)

#### Returns

`Promise`<`void`>

#### Example

```ts
await enginex.pixKeys.remove({ keyId: key.id })
```

#### Throws

`NOT_FOUND` if the id does not exist (or belongs to another player);
`UNAUTHENTICATED` without a session.

***

### setDefault()

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

Marks a key as the default for withdrawals.

#### Parameters

##### input

###### keyId

`string`

##### options?

[`CallOptions`](CallOptions.md)

#### Returns

`Promise`<`void`>

#### Example

```ts
await enginex.pixKeys.setDefault({ keyId: key.id })
```

#### Throws

`NOT_FOUND` if the id does not exist (or belongs to another player);
`UNAUTHENTICATED` without a session.
