Skip to main content

Quick start

This guide will help you make your first API call with the Cloudflare TypeScript SDK in under 5 minutes.
1

Install the SDK

First, install the Cloudflare SDK using your preferred package manager:
2

Get your API token

You’ll need a Cloudflare API token to authenticate your requests.
  1. Log in to the Cloudflare Dashboard
  2. Go to My Profile > API Tokens
  3. Click Create Token
  4. Use a template or create a custom token with the permissions you need
  5. Copy your token and store it securely
Keep your API token secure! Never commit it to version control or share it publicly.
3

Set up environment variables

Store your API token in an environment variable:
4

Make your first API call

Create a new TypeScript or JavaScript file and import the SDK:
Run your code:

What’s next?

Create a zone

Learn how to create and manage DNS zones

Configure DNS

Add and update DNS records for your zones

Deploy Workers

Deploy serverless functions at the edge

Error handling

Learn how to handle errors gracefully

Complete example

Here’s a more complete example that creates a zone and adds a DNS record:
The SDK provides full TypeScript type definitions. Use your editor’s autocomplete to explore available methods and parameters!

Next steps

Now that you’ve made your first API call, learn more about: