← Live CT Feed

Live CT Feed API

A one-way WebSocket stream of new Certificate Transparency log entries, sent as JSON text messages. This page is the complete reference for connecting a client. Accounts are issued by enquiry from the service page.

Connecting

wss://stream.nettools.me/v1/stream

Authentication

Send your token in the Authorization header, either as a bearer token:

Authorization: Bearer cts_…

or with HTTP Basic authentication, using the token as the password and any user name. Tokens are never accepted in the URL, because URLs end up in logs. Keep the token secret: anyone holding it can use your account's connections.

Query parameters

All are optional and can be combined.

ParameterMeaning
domainsComma-separated list, up to 500. Only certificates with a name equal to one of these domains, or a subdomain of one, are sent. domains=example.com matches example.com and api.eu.example.com, but not notexample.com. Domains are lowercased and a leading *. or trailing dot is ignored. Internationalised names must be given in their xn-- form.
raw=1Add the certificate itself to each message, in the der field. Only for accounts with raw access; others get HTTP 403.
fromResume after a message id you have already received. See Resuming.
wss://stream.nettools.me/v1/stream?domains=example.com,example.org&from=1795634505123-0

Messages

Every message is a JSON object in a text frame. There are two kinds: entries, which have a log field, and notices, which have a notice field. Ignore fields you don't recognise: new ones may be added.

Entries

{
  "id": "1795634505123-0",
  "log": "Sectigo Tiger2027h1",
  "index": 1113152616,
  "ts": 1795634504871,
  "type": "precert",
  "names": ["example.com", "www.example.com"],
  "cn": "www.example.com",
  "org": "Example Ltd",
  "issuer": "DigiCert Global G2 TLS RSA SHA256 2020 CA1",
  "issuer_org": "DigiCert Inc",
  "serial": "4a1f0c9e2b7d33a8e01c5f6d2a9b8c7e1f0",
  "not_before": "2026-11-25T18:51:39Z",
  "not_after": "2027-02-23T18:51:38Z",
  "sha256": "9f2c4b…e41a",
  "der": "MIIFJzCCBA+gAwIBAgIS…"
}
FieldMeaning
idThe message's position in the feed. Always increasing. Store the latest one: it is what you pass as from to resume.
logThe Certificate Transparency log the entry was read from.
indexThe entry's position in that log. log plus index identifies the entry permanently.
tsThe log's timestamp for the entry, in milliseconds since 1970 (UTC). Usually seconds before you receive it; can be older when a log publishes a delayed batch.
typeprecert for a precertificate (logged before issuance) or cert for a final certificate.
namesThe certificate's DNS names plus its subject common name: lowercased, leading *. removed, duplicates removed. Values that aren't plain hostnames are left out. Can be empty.
cnThe subject common name exactly as written. Omitted when the certificate has none.
orgThe organisation the certificate was issued to (subject O), e.g. "Example Ltd". Only OV and EV certificates carry one; omitted for domain-validated certificates, which are most of the feed.
issuerThe issuing CA's common name.
issuer_orgThe issuing CA's organisation. Omitted when absent.
serialThe serial number in lowercase hex, without leading zeros. The same for a precertificate and its final certificate.
not_before, not_afterThe validity period, RFC 3339 in UTC.
sha256Hex SHA-256 of the certificate bytes (the fingerprint crt.sh shows).
derRaw accounts with raw=1 only. The certificate exactly as submitted to the log, DER-encoded then base64 (standard alphabet, padded). For a precertificate these are the precertificate's bytes, including the poison extension, not the final certificate. The issuing CA's certificates are not included.

Notices

At present there is one notice, gap, sent when you resume from further back than the server still holds. It means entries between your from and oldest were missed; the entries that follow it are the oldest still available.

{"notice": "gap", "oldest": "1795634400000-0", "detail": "from is older than the resume window; entries in between were missed"}

oldest is absent when the server holds nothing at all to resume from.

One certificate, several entries

Before issuing a certificate, a CA logs a precertificate in two or three logs run by different operators. The final certificate is then often submitted to further logs. So a single issuance typically arrives as three to five entries, from different logs, within seconds to an hour.

Resuming

Connections drop: networks blip, Cloudflare restarts edge servers, and we deploy. To continue without losing entries, reconnect with from set to the last id you received. The server replays what you missed, oldest first, then continues live, with no duplicates and nothing skipped.

Close codes

CodeMeaningWhat to do
4000Your client fell too far behind the live feed (a few seconds of messages queued unread).Reconnect with from. If it keeps happening, read faster, enable compression, or narrow the feed with domains.
1001The server is restarting.Reconnect with from after a few seconds.
1008Access was revoked or changed (for example raw access removed), or your client sent a message.Don't retry automatically; contact us if unexpected.
1006The connection was lost without a close frame.Reconnect with from, backing off if it repeats.

Connection errors

These are returned as plain HTTP responses before the WebSocket opens.

StatusCause
400A bad domains entry (including an empty one, as from a trailing comma), more than 500 domains, or a malformed or future from.
401Missing or invalid token.
403raw=1 on an account without raw access.
429Your account's connection limit is reached, the server's total limit is reached, or you resumed within 10 seconds of the last resume.

Limits

Good practice

Client examples

Command line (websocat)

export CT_STREAM_TOKEN=cts_…
websocat -H "Authorization: Bearer $CT_STREAM_TOKEN" \
  "wss://stream.nettools.me/v1/stream?domains=example.com" | jq -c '{log, names, issuer}'

Python (websockets)

# pip install websockets
import asyncio, json, os
import websockets

URL = "wss://stream.nettools.me/v1/stream"
HEADERS = {"Authorization": "Bearer " + os.environ["CT_STREAM_TOKEN"]}
DOMAINS = "example.com,example.org"

def handle(entry):
    print(entry["log"], entry["type"], entry["names"])

async def main():
    last_id, failures = None, 0
    while True:
        query = f"?domains={DOMAINS}" + (f"&from={last_id}" if last_id else "")
        try:
            async with websockets.connect(URL + query, additional_headers=HEADERS) as ws:
                failures = 0
                async for raw in ws:
                    msg = json.loads(raw)
                    if "notice" in msg:
                        print("notice:", msg)
                        continue
                    last_id = msg["id"]
                    handle(msg)
        except websockets.ConnectionClosed as e:
            if e.rcvd and e.rcvd.code == 1008:
                raise SystemExit(f"access revoked: {e.rcvd.reason}")
        except websockets.InvalidStatus as e:
            if e.response.status_code in (401, 403, 400):
                raise SystemExit(f"rejected: HTTP {e.response.status_code}")
        except OSError:
            pass
        failures += 1
        await asyncio.sleep(min(10 * failures, 120))  # resuming is allowed once per 10 s

asyncio.run(main())

Node.js (ws)

// npm install ws
const WebSocket = require("ws");

const URL = "wss://stream.nettools.me/v1/stream";
const TOKEN = process.env.CT_STREAM_TOKEN;
const DOMAINS = "example.com,example.org";
let lastId = null;
let failures = 0;

function connect() {
  const query = `?domains=${DOMAINS}` + (lastId ? `&from=${lastId}` : "");
  const ws = new WebSocket(URL + query, {
    headers: { Authorization: `Bearer ${TOKEN}` },
    perMessageDeflate: true,
  });
  ws.on("open", () => { failures = 0; });
  ws.on("message", (data) => {
    const msg = JSON.parse(data);
    if (msg.notice) { console.warn("notice:", msg); return; }
    lastId = msg.id;
    console.log(msg.log, msg.type, msg.names);
  });
  ws.on("error", (err) => {
    // A rejected connection surfaces here as "Unexpected server response: 401".
    const status = /Unexpected server response: (\d+)/.exec(err.message)?.[1];
    if (["400", "401", "403"].includes(status)) {
      console.error("rejected: HTTP", status);
      process.exit(1);
    }
    // Anything else: "close" follows and handles the retry.
  });
  ws.on("close", (code, reason) => {
    if (code === 1008) { console.error("access revoked:", reason.toString()); process.exit(1); }
    failures += 1;
    setTimeout(connect, Math.min(10000 * failures, 120000)); // resuming is allowed once per 10 s
  });
}

connect();

Go (coder/websocket)

// go get github.com/coder/websocket
package main

import (
	"context"
	"encoding/json"
	"errors"
	"log"
	"net/http"
	"net/url"
	"os"
	"time"

	"github.com/coder/websocket"
)

const streamURL = "wss://stream.nettools.me/v1/stream"

type Entry struct {
	ID     string   `json:"id"`
	Log    string   `json:"log"`
	Index  int64    `json:"index"`
	Type   string   `json:"type"`
	Names  []string `json:"names"`
	Issuer string   `json:"issuer"`
	Serial string   `json:"serial"`
	Notice string   `json:"notice"`
}

// stream reads until the connection ends, updating *lastID as it goes.
func stream(ctx context.Context, token, domains string, lastID *string) error {
	q := url.Values{}
	if domains != "" {
		q.Set("domains", domains)
	}
	if *lastID != "" {
		q.Set("from", *lastID)
	}
	conn, resp, err := websocket.Dial(ctx, streamURL+"?"+q.Encode(), &websocket.DialOptions{
		HTTPHeader:      http.Header{"Authorization": {"Bearer " + token}},
		CompressionMode: websocket.CompressionContextTakeover,
	})
	if err != nil {
		if resp != nil && (resp.StatusCode == 400 || resp.StatusCode == 401 || resp.StatusCode == 403) {
			log.Fatalf("rejected: HTTP %d", resp.StatusCode)
		}
		return err
	}
	defer conn.CloseNow()
	conn.SetReadLimit(4 << 20)
	for {
		_, data, err := conn.Read(ctx)
		if err != nil {
			return err
		}
		var e Entry
		if err := json.Unmarshal(data, &e); err != nil {
			continue
		}
		if e.Notice != "" {
			log.Printf("notice: %s", data)
			continue
		}
		*lastID = e.ID
		log.Println(e.Log, e.Type, e.Names)
	}
}

func main() {
	token := os.Getenv("CT_STREAM_TOKEN")
	domains := "example.com,example.org"
	ctx := context.Background()
	var lastID string
	for failures := 1; ; failures++ {
		err := stream(ctx, token, domains, &lastID)
		if websocket.CloseStatus(err) == websocket.StatusPolicyViolation {
			log.Fatalf("access revoked: %v", err)
		}
		if errors.Is(err, context.Canceled) {
			return
		}
		log.Printf("disconnected: %v", err)
		time.Sleep(min(time.Duration(failures)*10*time.Second, 2*time.Minute)) // resuming is allowed once per 10 s
	}
}

Service status

GET https://stream.nettools.me/healthz needs no token and returns {"ok": true, "subscribers": 3, "last_entry_age_s": 0}. ok is false, with HTTP 503, when no new entry has arrived for two minutes.

Questions or need higher limits? Get in touch.