API Limits

Unauthenticated Rate Limit

The Witness API is currently available for use freely but throttles your writes based on IP. This limit is set to 2 requests, resetting every 20 seconds.

API Key

If you're hitting the rate limit, you should request an API key by reaching out (opens in a new tab).

If you're using the Typescript SDK, you can have your client use the API key by setting it as the first constructor parameter:

const witness = new WitnessClient("my-api-key")

If you're calling the API using another method, you'll need to add the API key to the headers of your request. Here's an example using fetch:

const headers = {
    "Authorization": "Bearer my-token",
    "Content-Type": "application/json",
    "accept": "application/json",
};
const body = JSON.stringify({ leafHash: "0x97e78047a64a1bb484d69e3093ec34d9a0d13f682496bffa492626909df5efd3" })
const response = await fetch("https://api.witness.co/postLeafHash", { headers, body, method: "POST" });
 
;