Skip to content

API Documentation

Integrate Notch counters into your site with a few lines of code.

All public endpoints are rate limited to prevent abuse. A public_key is the public key generated with your counter, which you can copy in the dashboard.

Fetch current count

Retrieve the current count for a counter. Use this for read-only displays.

GET https://api.trynotch.cc/api/counters/public/:public_key

Request example

fetch("https://api.trynotch.cc/api/counters/public/notch_pub_b6sUE5TnWYTKMJJnt4cQRtZYXk4NjQtW")
  .then(res => res.json())

Expected response

{
  "count": 120328
}

Increment count

Trigger a count increase. This endpoint returns the new updated total.

POST https://api.trynotch.cc/api/counters/public/:public_key

Request example

fetch("https://api.trynotch.cc/api/counters/public/notch_pub_b6sUE5TnWYTKMJJnt4cQRtZYXk4NjQtW", {
  method: "POST"
})

Expected response

{
  "message": "Success",
  "count": 120327
}

Quick integration tip

Using React? Here is a simple way to fetch and display your live count. This example usesuseEffect to load the data when your component mounts.

React component example

import { useEffect, useState } from "react";

const CounterDisplay = () => {
    const [count, setCount] = useState(0);

    useEffect(() => {
        fetch("https://api.trynotch.cc/api/counters/public/notch_pub_b6sUE5TnWYTKMJJnt4cQRtZYXk4NjQtW")
            .then((res) => res.json())
            .then((data) => {

                if (data && typeof data.count === 'number') {
                    setCount(data.count);
                }
            })
            .catch((err) => console.error("Error fetching data:", err));
    }, []);

    return (
        <span>
            {count}
        </span>
    );
};

export default CounterDisplay