Skip to content

Webhook.site API

The Webhook.site API is public, free and easy to use. If you have a Webhook.site Account, you should authorize via an Api-Key.

View, fork and modify in Postman:  Run In Postman

General Usage

Base URL: https://webhook.site.

You must set the Accept and Content-Type headers to application/json.

You must set the Api-Key header if you have a Webhook.site account.

Common Uses

Things to Note

  • In this API documentation, URL parameters are prefixed with : (colon) to show which parameters must be changed by the user. You must not include this character in the URL.
  • A Token ID refers to the ID of the Webhook.site URL/e-mail address, i.e., when your Webhook.site URL is https://webhook.site/00000000-0000-0000-0000-000000000000, the Token ID is then 00000000-0000-0000-0000-000000000000.
  • In API URLs, you cannot use Token Aliases in place of the Token ID.
  • Webhook.site API Keys must be specified using the Api-Key HTTP header.
  • Fair use guidelines, rate limits, and other limitations apply as described by the Terms of Service.

Authentication

While many endpoints of the Webhook.site API are public and work without any authentication, some endpoints do require authentication, or will return a 401 Unauthorized status code.

API Key

An API Key can be generated in the Control Panel, and provides access to Tokens that are either a) password protected or b) require login.

API Keys have the same privileges as the user who created them.

API Keys must be specified in the Api-Key HTTP header.

Password

Warning

Password authentication is deprecated and will be removed in 2025. We recommend using API Keys.

If you have set a password on a Webhook.site URL/token, to access the API resources for that token, you can use either of the following methods:

  1. Specify the password using the password query string: ?password=[your password]
  2. Set the password using HTTP Basic Auth, using the Authorization header. More info

Common Usages

Get data sent to URL

To retrieve the data that's sent to a Webhook.site URL or Email, you'll want to use the Get Requests endpoint.

Create new URL/email address

To create a new token programmatically, you can use the API like this:

$ curl -X POST https://webhook.site/token

This will return information about the token in JSON format, including its UUID. Your URL will be available at the endpoint https://webhook.site/[token uuid].

If you are a Webhook.site Pro or Enterprise customer, you should provide an API key in order to associate the created token with your account automatically:

$ curl -X POST -H 'Api-Key: 00000000-0000-0000-0000-000000000000' https://webhook.site/token

More info here.

WebSocket

You can connect to Webhook.site's WebSocket server (wss://ws.webhook.site) and listen for incoming requests, emails and DNSHooks in your own application. If you listen to a token associated with a Webhook.site account, you must specify and API key. Alternatively, you can use Webhook.site CLI.

JavaScript

First, install dependencies: npm install socket.io-client@2

const io = require("socket.io-client");

// Replace these with your actual API key and token ID
let apiKey = "000-000...";
let tokenId = "111-111...";

const socket = io("https://ws.webhook.site");

socket.on("connect_error", (e) => console.log('Connection error', e));
socket.on("error", (e) => console.log('Connection error', e));

socket.on("connect", () => {
    socket.emit("subscribe", {
        channel: `private-token.${tokenId}`,
        auth: {headers: apiKey ? {"Api-Key": apiKey} : {}}
    });
    console.log("Subscribed to channel");
});

socket.on("request.created", (channel, data) => {
    console.log(`Received event on channel ${channel}`);
    console.dir(data, {depth: null});
});

Python

First, install dependencies: pip install "python-socketio[client]"

import socketio
import pprint

api_key = '000-000...'
token_id = '111-111...'

# Create a Socket.IO client
sio = socketio.Client()

@sio.event
def disconnect():
    print("Disconnected from server")

@sio.event
def connect():
    sio.emit("subscribe", {
        "channel": f'private-token.{token_id}',
        "auth": {
            "headers": {
                "Api-Key": api_key
            }
        }
    })
    print(f"Subscribed to channel")

@sio.on("request.created")
def on_message(channel, data):
    print(f"Received event on channel {channel}")
    pprint.pprint(data)

# Connect with headers for authentication
sio.connect(
    'https://ws.webhook.site',
    transports=['websocket']
)

# Keep the script running
sio.wait()

Last update: May 27, 2025 19:55:59