SDKs designed by language experts

Every SDK respects the idioms of the language, contains strong types, inlined docs, and intuitive error handling.

payment-service
payment-gateway.ts
payment-gateway.tsPaymentGatewaycreatePayment

1

2

3

4

5

6

7

8

9

10

11

12

// src/payment-gateway.ts
export interface PaymentInput {
amount: number;
sourceId: string;
}

export class PaymentGateway {
async createPayment(input: PaymentInput) {
// TODO: implement Square payment
return null;
}
}
Problems0
Output
Debug Console
Terminal
Ports
Spell Checker1
zsh+
Cursor Tab
Ln 8, Col 28Spaces: 4UTF-8LFTypeScript

We used an alternative SDK generator, OpenAPI Generator, for years, and customers constantly complained. Since adopting Fern, customers have migrated rapidly to our new SDKs and have been blown away by the quality.

Gil FeigCTO
Merge

Making it easier to onboard agents and humans

Every SDK ships with onboarding docs by default — readable for new engineers and structured for coding agents.

Square TypeScript Library

Built with Fern npm shield

The Square TypeScript library provides convenient access to the Square APIs from TypeScript.

Table of Contents

Installation

bashnpm i -s square

Reference

A full reference is available here.

Versioning

By default, the SDK is pinned to the latest version. You can override the API version per request:

typescriptawait client.payments.create(request, {
  version: "2024-05-04",
});

Usage

typescriptimport { SquareClient } from "square";

const client = new SquareClient({ token: "YOUR_TOKEN" });

await client.payments.create({
  sourceId: "ccof:GaJGNaZa8x4OgDJn4GB",
  amountMoney: { amount: BigInt("1000"), currency: "USD" },
});

Request and Response Types

typescriptimport { Square } from "square";

const request: Square.RevokeTokenRequest = {
  clientId: "CLIENT_ID",
  accessToken: "ACCESS_TOKEN",
};

Exception Handling

typescriptimport { SquareError } from "square";

try {
  await client.payments.create(request);
} catch (err) {
  if (err instanceof SquareError) {
    console.log(err.statusCode);
  }
}

Pagination

typescriptconst pageableResponse = await client.bankAccounts.list({ limit: 1 });
for await (const item of pageableResponse) {
  console.log(item);
}

Webhook Signature Verification

typescriptimport { WebhooksHelper } from "square";

const isValid = WebhooksHelper.verifySignature({
  requestBody: body,
  signatureHeader: signature,
  signatureKey: process.env.SQUARE_WEBHOOK_SIGNATURE_KEY,
  notificationUrl: "https://example.com/webhook",
});

readme.md

A concise README in the package root: install command, quickstart snippet in the SDK's idiomatic style, links to the full reference.

Reference

OAuth

client.oAuth.revokeToken({ ...params }) -> Square.RevokeTokenResponse
📝 Description

Revokes an access token generated with the OAuth flow.

🔌 Usage
typescriptawait client.oAuth.revokeToken({
  clientId: "CLIENT_ID",
  accessToken: "ACCESS_TOKEN",
});
⚙️ Parameters

request: Square.RevokeTokenRequest

reference.md

A full Markdown reference of every method, parameter, and return type — designed to be dropped straight into a coding agent's context.

Built for every language

One spec, nine SDKs. Every generator carries the same set of ergonomic features so consumers get the same experience regardless of language.

// Switch on the discriminator; TypeScript narrows each branch.import { SquareClient } from "square"; const square = new SquareClient({ token: process.env.SQUARE_TOKEN! }); const event = await square.webhooks.get("evt_42"); switch (event.type) {    case "payment.created":        console.log("Charged", event.payment.amountMoney);        break;    case "refund.updated":        console.log("Refund", event.refund.status);        break;    default:        event satisfies never;}

Just run fern generate

Fern generates and publishes client libraries, so you can focus on building the API.

1

Import your API spec

Start with OpenAPI, AsyncAPI, OpenRPC, gRPC, or our simpler Fern Definition format.

Select a spec

openapi.yml
title: Public API
paths:
/jobs:
post:
summary: Create a new job
x-fern-sdk-group-name: jobs
x-fern-sdk-method-name: create
request:
application/json:
schema:
$ref: 'components/schemas/CreateJobRequest'
response:
'200':
application/json:
2

Select languages to generate

We support TypeScript, Python, Go, Java, Ruby, C#, PHP, Swift & Rust.

typescript-sdkPublic
Fork548
Star2k
main
Code
fern-api[bot]Release 1.0.0
7ddf16d·2 minutes ago877 Commits
.github
Release 1.0.02 minutes ago
src
Release 1.0.02 minutes ago
tests
Release 1.0.02 minutes ago
package.json
Release 1.0.02 minutes ago
README.md
Release 1.0.02 minutes ago
3

Add custom code

Extend the generated client with utility functions and custom logic. Your changes won't be overwritten on re-generation.

Merged

Add helper method: Poll job completion #8211

Changes from all commits

class JobClient extends BaseClient {
const TIMEOUT_IN_MS = 10_000;
public async awaitCompletion(): Promise<void> {
    const poller = new JobPoller(this.jobId);
    return new Promise((resolve, reject) => {
        poller.start(resolve);
4

Publish packages

Fern semantically versions and publishes packages to each registry (e.g. npm, PyPI, Maven).

your-company

TypeScript

7.15.0PublicPublished 24 days ago

Readme
CodeBeta
13Dependencies
55Dependents
83Versions

TypeScript SDK

npmv7.15.0🌿SDK generated by Fern

This library provides access to your company's API from applications written in TypeScript or JavaScript.

Documentation

Documentation and API reference is available here.

Installation
npm i -s your-company
Usage
import { CohereClient } from "cohere-ai";

Built by language experts

Each SDK gives the impression of being hand-written by an expert in the language.

Enterprise-ready by default

Security, deployment, and partnership that scale with your API.