# requestAirdrop

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

POST https://solana-mainnet.g.alchemy.com/v2/{apiKey}

Requests an airdrop of lamports to a Pubkey.

Reference: https://www.alchemy.com/docs/chains/solana/solana-api-endpoints/request-airdrop

## Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| Pubkey | string | Yes | The Pubkey of the account to receive lamports. |
| Lamports | integer | Yes | The number of lamports to airdrop, as a "u64". |
| Configuration | object | No | Optional configuration object. |

## Result

**Transaction signature** (string): Transaction Signature of the airdrop.

## Example

### Request

```json
{
  "jsonrpc": "2.0",
  "method": "requestAirdrop",
  "params": [
    "GwsPP9HHhCvEQeu3HTFzsVL6DEtnnYw4ALEtA3fMBC9Q",
    1000000000000000000
  ],
  "id": 1
}
```

## Code Examples

### cURL

```bash
curl --request POST \
  --url https://solana-mainnet.g.alchemy.com/v2/docs-demo \
  --header 'Content-Type: application/json' \
  --data '{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "requestAirdrop",
  "params": [
    "GwsPP9HHhCvEQeu3HTFzsVL6DEtnnYw4ALEtA3fMBC9Q",
    1000000000000000000,
    {
      "commitment": "processed"
    }
  ]
}'
```

### JavaScript

```javascript
const options = {
  method: 'POST',
  headers: {'Content-Type': 'application/json'},
  body: JSON.stringify({
    jsonrpc: '2.0',
    id: 1,
    method: 'requestAirdrop',
    params: [
      'GwsPP9HHhCvEQeu3HTFzsVL6DEtnnYw4ALEtA3fMBC9Q',
      1000000000000000000,
      {commitment: 'processed'}
    ]
  })
};

fetch('https://solana-mainnet.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://solana-mainnet.g.alchemy.com/v2/docs-demo"

payload = {
    "jsonrpc": "2.0",
    "id": 1,
    "method": "requestAirdrop",
    "params": ["GwsPP9HHhCvEQeu3HTFzsVL6DEtnnYw4ALEtA3fMBC9Q", 1000000000000000000, { "commitment": "processed" }]
}
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://solana-mainnet.g.alchemy.com/v2/docs-demo"

	payload := strings.NewReader("{\n  \"jsonrpc\": \"2.0\",\n  \"id\": 1,\n  \"method\": \"requestAirdrop\",\n  \"params\": [\n    \"GwsPP9HHhCvEQeu3HTFzsVL6DEtnnYw4ALEtA3fMBC9Q\",\n    1000000000000000000,\n    {\n      \"commitment\": \"processed\"\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://solana-mainnet.g.alchemy.com/v2/docs-demo")
  .header("Content-Type", "application/json")
  .body("{\n  \"jsonrpc\": \"2.0\",\n  \"id\": 1,\n  \"method\": \"requestAirdrop\",\n  \"params\": [\n    \"GwsPP9HHhCvEQeu3HTFzsVL6DEtnnYw4ALEtA3fMBC9Q\",\n    1000000000000000000,\n    {\n      \"commitment\": \"processed\"\n    }\n  ]\n}")
  .asString();
```

### C#

```csharp
using RestSharp;


var options = new RestClientOptions("https://solana-mainnet.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\": \"requestAirdrop\",\n  \"params\": [\n    \"GwsPP9HHhCvEQeu3HTFzsVL6DEtnnYw4ALEtA3fMBC9Q\",\n    1000000000000000000,\n    {\n      \"commitment\": \"processed\"\n    }\n  ]\n}", false);
var response = await client.PostAsync(request);

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

```


## OpenRPC Method Specification

```yaml
name: requestAirdrop
description: Requests an airdrop of lamports to a Pubkey.
params:
  - name: Pubkey
    required: true
    description: The Pubkey of the account to receive lamports.
    schema:
      title: Pubkey
      type: string
      description: Base-58 encoded public key.
  - name: Lamports
    required: true
    description: The number of lamports to airdrop, as a "u64".
    schema:
      type: integer
  - name: Configuration
    required: false
    description: Optional configuration object.
    schema:
      title: RequestAirdrop Configuration
      type: object
      properties:
        commitment:
          title: Commitment Level
          type: string
          description: Configures the state commitment for querying.
          enum:
            - processed
            - confirmed
            - finalized
examples:
  - name: requestAirdrop example
    params:
      - name: Pubkey
        value: GwsPP9HHhCvEQeu3HTFzsVL6DEtnnYw4ALEtA3fMBC9Q
      - name: Lamports
        value: 1000000000000000000
result:
  name: Transaction signature
  description: Transaction Signature of the airdrop.
  schema:
    type: string
```
