Skip to main content

ConnectRPC

ConnectRPC is a set of libraries for building type-safe APIs with Protocol Buffers. It produces small, idiomatic clients that work over HTTP/1.1 and HTTP/2 — no special proxies or gRPC infrastructure required.

The Thirdfort Client API is defined using Protocol Buffers and can be consumed via ConnectRPC as an alternative to the REST/JSON interface described in our OpenAPI specification.

Download Proto Files

Download the proto definitions for the API version you want to use. Each bundle includes:

  • Proto files — the full API definition
  • buf.yaml — dependency configuration for Buf
  • buf.gen.yaml — a ready-to-use code generation config for TypeScript

Download thirdfort-protos-v1.zip

Stable API
v1 is a stable release and suitable for production environments.

Example: Generating a TypeScript Client

tip
ConnectRPC supports many programming languages. Check https://buf.build/plugins/protobuf to see if your preferred language is supported.

The downloaded bundle includes a buf.gen.yaml that generates ConnectRPC TypeScript clients. Follow the steps below to generate and use the client.

Prerequisites

You need Node.js (18+) and the Buf CLI:

# Install Buf CLI
npm install -g @bufbuild/buf

# Install runtime dependencies in your project
npm install @bufbuild/protobuf @connectrpc/connect @connectrpc/connect-web

Generate

Unzip the downloaded bundle and run code generation:

# Unzip the bundle
unzip thirdfort-protos-v1.zip -d thirdfort-protos
cd thirdfort-protos

# Install proto dependencies
buf dep update

# Generate TypeScript client code
npx buf generate

This creates a gen/ directory containing:

  • Message types — TypeScript classes for all request/response types (from @bufbuild/protobuf)
  • Service clients — type-safe client functions for each RPC method (from @connectrpc/connect)

Usage Example

import { createClient } from "@connectrpc/connect";
import { createConnectTransport } from "@connectrpc/connect-web";
import { ClientService } from "./gen/thirdfort/client/v1/service_connect";

// Create a transport configured with your auth token
const transport = createConnectTransport({
baseUrl: "https://api.thirdfort.dev/client/api",
interceptors: [
(next) => async (req) => {
req.header.set("Authorization", `Bearer ${YOUR_ACCESS_TOKEN}`);
return next(req);
},
],
});

// Create a typed client
const client = createClient(ClientService, transport);

// Make API calls with full type safety
const check = await client.createCheck({
parent: "organizations/123/teams/456",
check: {
displayName: "Identity verification for John Doe",
template: "checkTemplates/identity-verification-check-v1-0-0",
params: {
"@type": "type.googleapis.com/thirdfort.client.checks.type.v1.IdentityVerificationCheckParams",
subject: {
givenName: "John",
familyName: "Doe",
},
},
},
});

console.log("Created check:", check.name);
tip
The ConnectRPC transport works in both browser and Node.js environments. For Node.js, use @connectrpc/connect-node instead of @connectrpc/connect-web.

Further Reading