# AddAccessKey

[**promise**](/near-sdk-js/promise.md) • **Docs**

***

[near-sdk-js v2.0.0](/near-sdk-js/packages.md) / [promise](/near-sdk-js/promise.md) / AddAccessKey

## Class: AddAccessKey

A add access key promise action.

### Extends

* [`PromiseAction`](/near-sdk-js/promise/classes/promiseaction.md)

### Constructors

#### new AddAccessKey()

> **new AddAccessKey**(`publicKey`, `allowance`, `receiverId`, `functionNames`, `nonce`): [`AddAccessKey`](/near-sdk-js/promise/classes/addaccesskey.md)

**Parameters**

• **publicKey**: [`PublicKey`](/near-sdk-js/types/public_key/classes/publickey.md)

The public key to add as a access key.

• **allowance**: `bigint`

The allowance for the key in yoctoNEAR.

• **receiverId**: `string`

The account ID of the receiver.

• **functionNames**: `string`

The names of functions to authorize.

• **nonce**: `bigint`

The nonce to use.

**Returns**

[`AddAccessKey`](/near-sdk-js/promise/classes/addaccesskey.md)

**Overrides**

[`PromiseAction`](/near-sdk-js/promise/classes/promiseaction.md).[`constructor`](/near-sdk-js/promise/classes/promiseaction.md#constructors)

**Defined in**

[packages/near-sdk-js/src/promise.ts:258](https://github.com/near/near-sdk-js/blob/b58ac04fc6dff2f1120e9098c0cb059493486598/packages/near-sdk-js/src/promise.ts#L258)

### Properties

#### allowance

> **allowance**: `bigint`

The allowance for the key in yoctoNEAR.

**Defined in**

[packages/near-sdk-js/src/promise.ts:260](https://github.com/near/near-sdk-js/blob/b58ac04fc6dff2f1120e9098c0cb059493486598/packages/near-sdk-js/src/promise.ts#L260)

***

#### functionNames

> **functionNames**: `string`

The names of functions to authorize.

**Defined in**

[packages/near-sdk-js/src/promise.ts:262](https://github.com/near/near-sdk-js/blob/b58ac04fc6dff2f1120e9098c0cb059493486598/packages/near-sdk-js/src/promise.ts#L262)

***

#### nonce

> **nonce**: `bigint`

The nonce to use.

**Defined in**

[packages/near-sdk-js/src/promise.ts:263](https://github.com/near/near-sdk-js/blob/b58ac04fc6dff2f1120e9098c0cb059493486598/packages/near-sdk-js/src/promise.ts#L263)

***

#### publicKey

> **publicKey**: [`PublicKey`](/near-sdk-js/types/public_key/classes/publickey.md)

The public key to add as a access key.

**Defined in**

[packages/near-sdk-js/src/promise.ts:259](https://github.com/near/near-sdk-js/blob/b58ac04fc6dff2f1120e9098c0cb059493486598/packages/near-sdk-js/src/promise.ts#L259)

***

#### receiverId

> **receiverId**: `string`

The account ID of the receiver.

**Defined in**

[packages/near-sdk-js/src/promise.ts:261](https://github.com/near/near-sdk-js/blob/b58ac04fc6dff2f1120e9098c0cb059493486598/packages/near-sdk-js/src/promise.ts#L261)

### Methods

#### add()

> **add**(`promiseIndex`): `void`

The method that describes how a promise action adds it's *action* to the promise batch with the provided index.

**Parameters**

• **promiseIndex**: [`PromiseIndex`](/near-sdk-js/utils/type-aliases/promiseindex.md)

The index of the promise batch to attach the action to.

**Returns**

`void`

**Overrides**

[`PromiseAction`](/near-sdk-js/promise/classes/promiseaction.md).[`add`](/near-sdk-js/promise/classes/promiseaction.md#add)

**Defined in**

[packages/near-sdk-js/src/promise.ts:268](https://github.com/near/near-sdk-js/blob/b58ac04fc6dff2f1120e9098c0cb059493486598/packages/near-sdk-js/src/promise.ts#L268)


---

# Agent Instructions: 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:

```
GET https://near-sdk-js.gitbook.io/near-sdk-js/promise/classes/addaccesskey.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
