# wallet_requestAccount

> For the complete documentation index, see [llms.txt](/docs/llms.txt).

POST https://api.g.alchemy.com/v2/{apiKey}

This method is used to get the smart account address and relevant info for a given signer. If an account does not already exist for a given signer, this method will create one before returning the counterfactual address.

Reference: https://www.alchemy.com/docs/wallets/api-reference/smart-wallets/wallet-api-endpoints/wallet-request-account

## Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| params[0] | object | Yes |  |

## Result

**requestAccountResponse** (object)

## Example

### Request

```json
{
  "jsonrpc": "2.0",
  "method": "wallet_requestAccount",
  "params": [
    {
      "signerAddress": "0xa363219d7C0b8673df17529D469Db9eFF0f35D2A"
    }
  ],
  "id": 1
}
```

### Response

```json
{
  "jsonrpc": "2.0",
  "result": {
    "accountAddress": "0xa363219d7C0b8673df17529D469Db9eFF0f35D2A",
    "id": "3061cc5f-1f96-48a9-ab45-41faad2dd23b"
  },
  "id": 1
}
```

## Code Examples

### cURL

```bash
curl --request POST \
  --url https://api.g.alchemy.com/v2/docs-demo \
  --header 'Content-Type: application/json' \
  --data '{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "wallet_requestAccount",
  "params": [
    {
      "signerAddress": "0xa363219d7C0b8673df17529D469Db9eFF0f35D2A"
    }
  ]
}'
```

### JavaScript

```javascript
const options = {
  method: 'POST',
  headers: {'Content-Type': 'application/json'},
  body: JSON.stringify({
    jsonrpc: '2.0',
    id: 1,
    method: 'wallet_requestAccount',
    params: [{signerAddress: '0xa363219d7C0b8673df17529D469Db9eFF0f35D2A'}]
  })
};

fetch('https://api.g.alchemy.com/v2/docs-demo', options)
  .then(res => res.json())
  .then(res => console.log(res))
  .catch(err => console.error(err));
```

### Python

```python
import requests

url = "https://api.g.alchemy.com/v2/docs-demo"

payload = {
    "jsonrpc": "2.0",
    "id": 1,
    "method": "wallet_requestAccount",
    "params": [{ "signerAddress": "0xa363219d7C0b8673df17529D469Db9eFF0f35D2A" }]
}
headers = {"Content-Type": "application/json"}

response = requests.post(url, json=payload, headers=headers)

print(response.text)
```

### Go

```go
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "https://api.g.alchemy.com/v2/docs-demo"

	payload := strings.NewReader("{\n  \"jsonrpc\": \"2.0\",\n  \"id\": 1,\n  \"method\": \"wallet_requestAccount\",\n  \"params\": [\n    {\n      \"signerAddress\": \"0xa363219d7C0b8673df17529D469Db9eFF0f35D2A\"\n    }\n  ]\n}")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("Content-Type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(string(body))

}
```

### Java

```java
HttpResponse<String> response = Unirest.post("https://api.g.alchemy.com/v2/docs-demo")
  .header("Content-Type", "application/json")
  .body("{\n  \"jsonrpc\": \"2.0\",\n  \"id\": 1,\n  \"method\": \"wallet_requestAccount\",\n  \"params\": [\n    {\n      \"signerAddress\": \"0xa363219d7C0b8673df17529D469Db9eFF0f35D2A\"\n    }\n  ]\n}")
  .asString();
```

### C#

```csharp
using RestSharp;


var options = new RestClientOptions("https://api.g.alchemy.com/v2/docs-demo");
var client = new RestClient(options);
var request = new RestRequest("");
request.AddJsonBody("{\n  \"jsonrpc\": \"2.0\",\n  \"id\": 1,\n  \"method\": \"wallet_requestAccount\",\n  \"params\": [\n    {\n      \"signerAddress\": \"0xa363219d7C0b8673df17529D469Db9eFF0f35D2A\"\n    }\n  ]\n}", false);
var response = await client.PostAsync(request);

Console.WriteLine("{0}", response.Content);

```


## OpenRPC Method Specification

```yaml
name: wallet_requestAccount
description: This method is used to get the smart account address and relevant info for a given signer. If an account does not already exist for a given signer, this method will create one before returning the counterfactual address.
params:
  - name: params[0]
    required: true
    schema:
      anyOf:
        - type: object
          required:
            - signerAddress
          properties:
            signerAddress:
              type: string
              pattern: ^0x.*$
              errorMessage: Must be a valid Ethereum address starting with '0x' (e.g., '0xa363219d7C0b8673df17529D469Db9eFF0f35D2A')
            id:
              type: string
              format: uuid
              errorMessage: Must be a valid UUID v4 string (e.g., '3061cc5f-1f96-48a9-ab45-41faad2dd23b')
            creationHint:
              anyOf:
                - description: Smart contract account types
                  type: object
                  anyOf:
                    - type: object
                      properties:
                        accountType:
                          anyOf:
                            - type: string
                              description: Modular Account V2 SMA-B account type
                              enum:
                                - sma-b
                            - type: string
                              description: Light Account V2 account type
                              enum:
                                - la-v2
                            - type: string
                              description: (deprecated - backwards compatibility only - reach out to support@alchemy.com with questions/concerns) Light Account V1.0.1 account type
                              enum:
                                - la-v1.0.1
                            - type: string
                              description: (deprecated - backwards compatibility only - reach out to support@alchemy.com with questions/concerns) Light Account V1.0.2 account type
                              enum:
                                - la-v1.0.2
                            - type: string
                              description: (deprecated - backwards compatibility only - reach out to support@alchemy.com with questions/concerns) Light Account V1.1.0 account type
                              enum:
                                - la-v1.1.0
                          errorMessage: 'accountType must be one of: ''sma-b'', ''la-v2'', ''la-v1.0.1'', ''la-v1.0.2'', ''la-v1.1.0'', ''la-v2-multi-owner'', or ''ma-v1-multi-owner'''
                      description: Single owner account types
                    - type: object
                      required:
                        - accountType
                      properties:
                        accountType:
                          anyOf:
                            - type: string
                              description: Light Account V2 Multi-Owner account type
                              enum:
                                - la-v2-multi-owner
                            - type: string
                              description: (deprecated - backwards compatibility only - reach out to support@alchemy.com with questions/concerns) Modular Account V1 Multi-Owner account type
                              enum:
                                - ma-v1-multi-owner
                          errorMessage: 'accountType must be one of: ''sma-b'', ''la-v2'', ''la-v1.0.1'', ''la-v1.0.2'', ''la-v1.1.0'', ''la-v2-multi-owner'', ''ma-v1-multi-owner'', or ''7702'''
                        initialOwners:
                          type: array
                          description: The initial owners of the account. The signer address will be implicitly added if not specified in this list.
                          items:
                            type: string
                            pattern: ^0x.*$
                            errorMessage: Must be a valid Ethereum address starting with '0x' (e.g., '0xa363219d7C0b8673df17529D469Db9eFF0f35D2A')
                      description: Multi-owner account types
                  properties:
                    createAdditional:
                      type: boolean
                      description: If true, will allow creating more than one smart wallet per signer.
                      errorMessage: createAdditional must be true or omitted
                    salt:
                      type: string
                      pattern: ^0x.*$
                      errorMessage: Must be a valid hex string starting with '0x'
                - type: object
                  required:
                    - accountType
                  properties:
                    accountType:
                      type: string
                      errorMessage: accountType must be '7702' for Smart EOA accounts
                      enum:
                        - '7702'
                  description: Smart EOA account type (EIP-7702)
            includeCounterfactualInfo:
              type: boolean
              default: false
          description: Using signer address
        - type: object
          required:
            - accountAddress
          properties:
            accountAddress:
              type: string
              pattern: ^0x.*$
              errorMessage: Must be a valid Ethereum address starting with '0x' (e.g., '0xa363219d7C0b8673df17529D469Db9eFF0f35D2A')
            includeCounterfactualInfo:
              type: boolean
              default: false
          description: Using smart contract account address
      errorMessage: Must provide either 'signerAddress' (with optional 'id', 'creationHint', 'includeCounterfactualInfo') or 'accountAddress' (with optional 'includeCounterfactualInfo')
result:
  name: requestAccountResponse
  schema:
    type: object
    required:
      - accountAddress
      - id
    properties:
      accountAddress:
        type: string
        pattern: ^0x.*$
        errorMessage: Must be a valid Ethereum address starting with '0x' (e.g., '0xa363219d7C0b8673df17529D469Db9eFF0f35D2A')
      id:
        type: string
        format: uuid
        errorMessage: Must be a valid UUID v4 string (e.g., '3061cc5f-1f96-48a9-ab45-41faad2dd23b')
      counterfactualInfo:
        type: object
        required:
          - factoryType
          - factoryAddress
          - factoryData
        properties:
          factoryType:
            anyOf:
              - type: string
                description: Light Account v1.0.1
                enum:
                  - LightAccountV1.0.1
              - type: string
                description: Light Account v1.0.2
                enum:
                  - LightAccountV1.0.2
              - type: string
                description: Light Account v1.1.0
                enum:
                  - LightAccountV1.1.0
              - type: string
                description: Light Account v2.0.0
                enum:
                  - LightAccountV2.0.0
              - type: string
                description: Light Account v2.0.0 MultiOwner
                enum:
                  - LightAccountV2.0.0-MultiOwner
              - type: string
                description: Modular Account v1.0.0 MultiOwner
                enum:
                  - MAv1.0.0-MultiOwner
              - type: string
                description: Modular Account v1.0.0 MultiSig
                enum:
                  - MAv1.0.0-MultiSig
              - type: string
                description: Modular Account v2.0.0 SMA-B
                enum:
                  - MAv2.0.0-sma-b
              - type: string
                description: Modular Account v2.0.0 SSV
                enum:
                  - MAv2.0.0-ma-ssv
              - type: string
                description: Unknown factory type
                enum:
                  - unknown
          factoryAddress:
            type: string
            pattern: ^0x.*$
            errorMessage: Must be a valid Ethereum address starting with '0x' (e.g., '0xa363219d7C0b8673df17529D469Db9eFF0f35D2A')
          factoryData:
            type: string
            pattern: ^0x.*$
            errorMessage: Must be a valid hex string starting with '0x'
      delegation:
        type: string
        pattern: ^0x.*$
        errorMessage: Must be a valid Ethereum address starting with '0x' (e.g., '0xa363219d7C0b8673df17529D469Db9eFF0f35D2A')
examples:
  - name: wallet_requestAccount example
    params:
      - name: param0
        value:
          signerAddress: '0xa363219d7C0b8673df17529D469Db9eFF0f35D2A'
    result:
      name: Response
      value:
        accountAddress: '0xa363219d7C0b8673df17529D469Db9eFF0f35D2A'
        id: 3061cc5f-1f96-48a9-ab45-41faad2dd23b
```
