# Test webhook

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

POST https://dashboard.alchemy.com/api/test-webhook

Sends a test event to a webhook URL. The JSON body takes `webhook_type`,
`app_id`, and `webhook_url`. Types other than `GRAPHQL` also take
`version`, which must be `V2`. To test a stored webhook, send its
`webhook_id`. Otherwise, send `network`. A `GRAPHQL` test always takes
`network`, and takes `graphql_query` when it has no `webhook_id`.

Reference: https://www.alchemy.com/docs/data/webhooks/webhooks-api-endpoints/test-webhook

## Headers

| Name | Type | Required | Description |
|------|------|----------|-------------|
| X-Alchemy-Token | string | Yes | Your team's auth token. Find it on the Webhooks page of the Alchemy dashboard. |

## Code Examples

### cURL

```bash
curl --request POST \
  --url https://dashboard.alchemy.com/api/test-webhook \
  --header 'Content-Type: application/json' \
  --header 'X-Alchemy-Token: string' \
  --data '{
  "webhook_type": "ADDRESS_ACTIVITY",
  "app_id": "string",
  "webhook_url": "string",
  "version": "V2",
  "network": "ABSTRACT_MAINNET",
  "webhook_id": "string",
  "graphql_query": "string"
}'
```

### JavaScript

```javascript
const options = {
  method: 'POST',
  headers: {'Content-Type': 'application/json', 'X-Alchemy-Token': 'string'},
  body: JSON.stringify({
    webhook_type: 'ADDRESS_ACTIVITY',
    app_id: 'string',
    webhook_url: 'string',
    version: 'V2',
    network: 'ABSTRACT_MAINNET',
    webhook_id: 'string',
    graphql_query: 'string'
  })
};

fetch('https://dashboard.alchemy.com/api/test-webhook', options)
  .then(res => res.json())
  .then(res => console.log(res))
  .catch(err => console.error(err));
```

### Python

```python
import requests

url = "https://dashboard.alchemy.com/api/test-webhook"

payload = {
    "webhook_type": "ADDRESS_ACTIVITY",
    "app_id": "string",
    "webhook_url": "string",
    "version": "V2",
    "network": "ABSTRACT_MAINNET",
    "webhook_id": "string",
    "graphql_query": "string"
}
headers = {
    "Content-Type": "application/json",
    "X-Alchemy-Token": "string"
}

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://dashboard.alchemy.com/api/test-webhook"

	payload := strings.NewReader("{\n  \"webhook_type\": \"ADDRESS_ACTIVITY\",\n  \"app_id\": \"string\",\n  \"webhook_url\": \"string\",\n  \"version\": \"V2\",\n  \"network\": \"ABSTRACT_MAINNET\",\n  \"webhook_id\": \"string\",\n  \"graphql_query\": \"string\"\n}")

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

	req.Header.Add("Content-Type", "application/json")
	req.Header.Add("X-Alchemy-Token", "string")

	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://dashboard.alchemy.com/api/test-webhook")
  .header("Content-Type", "application/json")
  .header("X-Alchemy-Token", "string")
  .body("{\n  \"webhook_type\": \"ADDRESS_ACTIVITY\",\n  \"app_id\": \"string\",\n  \"webhook_url\": \"string\",\n  \"version\": \"V2\",\n  \"network\": \"ABSTRACT_MAINNET\",\n  \"webhook_id\": \"string\",\n  \"graphql_query\": \"string\"\n}")
  .asString();
```

### C#

```csharp
using RestSharp;


var options = new RestClientOptions("https://dashboard.alchemy.com/api/test-webhook");
var client = new RestClient(options);
var request = new RestRequest("");
request.AddHeader("X-Alchemy-Token", "string");
request.AddJsonBody("{\n  \"webhook_type\": \"ADDRESS_ACTIVITY\",\n  \"app_id\": \"string\",\n  \"webhook_url\": \"string\",\n  \"version\": \"V2\",\n  \"network\": \"ABSTRACT_MAINNET\",\n  \"webhook_id\": \"string\",\n  \"graphql_query\": \"string\"\n}", false);
var response = await client.PostAsync(request);

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

```


## Operation Specification

```yaml
path: /api/test-webhook
method: POST
operation:
  operationId: TestWebhook
  responses:
    '204':
      description: Sent the test event
    '400':
      description: Invalid input
      content:
        application/json:
          schema:
            description: |-
              The error body. `name` is null for the statuses that have no name, such as
              404 and 429.
            properties:
              message:
                type: string
              name:
                type: string
                nullable: true
            required:
              - message
              - name
            type: object
            additionalProperties: false
          examples:
            Example 1:
              value:
                message: Missing required fields
                name: ValidationError
    '401':
      description: Requires authentication
      content:
        application/json:
          schema:
            description: |-
              The error body. `name` is null for the statuses that have no name, such as
              404 and 429.
            properties:
              message:
                type: string
              name:
                type: string
                nullable: true
            required:
              - message
              - name
            type: object
            additionalProperties: false
          examples:
            Example 1:
              value:
                message: Unauthenticated request.
                name: AuthError
    '404':
      description: Webhook not found
      content:
        application/json:
          schema:
            description: |-
              The error body. `name` is null for the statuses that have no name, such as
              404 and 429.
            properties:
              message:
                type: string
              name:
                type: string
                nullable: true
            required:
              - message
              - name
            type: object
            additionalProperties: false
          examples:
            Example 1:
              value:
                message: Webhook not found
                name: null
    '429':
      description: Rate limited
      content:
        application/json:
          schema:
            description: |-
              The error body. `name` is null for the statuses that have no name, such as
              404 and 429.
            properties:
              message:
                type: string
              name:
                type: string
                nullable: true
            required:
              - message
              - name
            type: object
            additionalProperties: false
          examples:
            Example 1:
              value:
                message: You're sending too many requests, please wait for 0.5 seconds and retry
                name: null
    '503':
      description: Webhooks service unavailable
      content:
        application/json:
          schema:
            description: |-
              The error body. `name` is null for the statuses that have no name, such as
              404 and 429.
            properties:
              message:
                type: string
              name:
                type: string
                nullable: true
            required:
              - message
              - name
            type: object
            additionalProperties: false
          examples:
            Example 1:
              value:
                message: Internal server error
                name: ServerError
  description: |-
    Sends a test event to a webhook URL. The JSON body takes `webhook_type`,
    `app_id`, and `webhook_url`. Types other than `GRAPHQL` also take
    `version`, which must be `V2`. To test a stored webhook, send its
    `webhook_id`. Otherwise, send `network`. A `GRAPHQL` test always takes
    `network`, and takes `graphql_query` when it has no `webhook_id`.
  summary: Test webhook
  tags:
    - Webhooks
  security:
    - team_api_key: []
  parameters: []
  requestBody:
    required: true
    content:
      application/json:
        schema:
          type: object
          required:
            - webhook_type
            - app_id
            - webhook_url
          properties:
            webhook_type:
              type: string
              enum:
                - ADDRESS_ACTIVITY
                - NFT_ACTIVITY
                - GRAPHQL
              description: The type of webhook to send a test event for.
            app_id:
              type: string
              description: The ID of an app on your team.
            webhook_url:
              type: string
              description: The URL that receives the test event. It must be a public http(s) address.
            version:
              type: string
              enum:
                - V2
              description: Required for every type except `GRAPHQL`.
            network:
              type: string
              enum:
                - ABSTRACT_MAINNET
                - ABSTRACT_TESTNET
                - ANIME_MAINNET
                - ANIME_SEPOLIA
                - APECHAIN_CURTIS
                - APECHAIN_MAINNET
                - ARB_MAINNET
                - ARB_SEPOLIA
                - ARC_MAINNET
                - ARC_TESTNET
                - AVAX_FUJI
                - AVAX_MAINNET
                - BASE_MAINNET
                - BASE_SEPOLIA
                - BERACHAIN_BEPOLIA
                - BERACHAIN_MAINNET
                - BLAST_MAINNET
                - BLAST_SEPOLIA
                - BNB_MAINNET
                - BNB_TESTNET
                - CELO_MAINNET
                - CELO_SEPOLIA
                - ETH_MAINNET
                - ETH_SEPOLIA
                - GENSYN_TESTNET
                - GNOSIS_CHIADO
                - GNOSIS_MAINNET
                - HYPERLIQUID_MAINNET
                - INK_MAINNET
                - INK_SEPOLIA
                - LINEA_MAINNET
                - LINEA_SEPOLIA
                - MANTLE_MAINNET
                - MANTLE_SEPOLIA
                - MATIC_AMOY
                - MATIC_MAINNET
                - METIS_MAINNET
                - MONAD_MAINNET
                - MONAD_TESTNET
                - OPT_MAINNET
                - OPT_SEPOLIA
                - PLASMA_MAINNET
                - ROBINHOOD_MAINNET
                - ROBINHOOD_TESTNET
                - RONIN_MAINNET
                - RONIN_SAIGON
                - SCROLL_MAINNET
                - SETTLUS_MAINNET
                - SETTLUS_SEPTESTNET
                - SHAPE_MAINNET
                - SHAPE_SEPOLIA
                - SOLANA_DEVNET
                - SOLANA_MAINNET
                - SONEIUM_MAINNET
                - SONEIUM_MINATO
                - SONIC_MAINNET
                - STARKNET_MAINNET
                - STARKNET_SEPOLIA
                - STELLAR_MAINNET
                - STELLAR_TESTNET
                - UNICHAIN_MAINNET
                - UNICHAIN_SEPOLIA
                - WORLDCHAIN_MAINNET
                - WORLDCHAIN_SEPOLIA
                - ZETACHAIN_MAINNET
                - ZETACHAIN_TESTNET
                - ZKSYNC_MAINNET
                - ZKSYNC_SEPOLIA
                - ZORA_MAINNET
                - ZORA_SEPOLIA
              description: |-
                The network of the webhook. Every network supports `ADDRESS_ACTIVITY`, `NFT_ACTIVITY`, and `GRAPHQL`, except:
                - `SOLANA_DEVNET`, `SOLANA_MAINNET`, `STELLAR_MAINNET`, `STELLAR_TESTNET`: only `ADDRESS_ACTIVITY`.
                - `STARKNET_MAINNET`, `STARKNET_SEPOLIA`: only `GRAPHQL`.
            webhook_id:
              type: string
              description: The ID of a stored webhook to test. If it is not set, `network` is required.
            graphql_query:
              type: string
              description: The query for a `GRAPHQL` test that has no `webhook_id`.
```
