Comparing LaunchDarkly's SDKs and REST API
Read time: 3 minutes
Last edited: Oct 13, 2022
This guide explains the differences between LaunchDarkly's SDKs and REST API, and when you should use each.
As a LaunchDarkly customer, you must set up an SDK to integrate LaunchDarkly with your code.
When your application starts up, your code should initialize the LaunchDarkly SDK you're working with. When a customer encounters a feature flag in your application, your code should use the SDK to evaluate the feature flag and retrieve the appropriate flag variation for that customer. We provide both client-side and server-side SDKs, in a variety of languages, to support your use case and tech stack.
The SDKs are specialized for the tasks of evaluating feature flags in your application and generating analytics events based on those evaluations. Constraining the SDKs to these use cases lets us keep them relatively small and easy to embed in your application.
To get started, read Setting up an SDK. To determine which type of SDK to use, read Client-side and server-side SDKs. When you're ready to begin your implementation, read Implementation guidelines for LaunchDarkly SDKs.
To configure a LaunchDarkly SDK, you need either an SDK key, a mobile key, or client-side ID for your SDK. These keys are specific to each project and environment. They are listed on the Account settings page, under the Environments tab for each project. They provide access to get the flag data needed for evaluations, and to send analytics events. Which type of SDK you use in your application determines which key you need when you configure the SDK.
LaunchDarkly SDKs are updated periodically. To learn more, read Versioning policy.
To learn more about a particular LaunchDarkly SDK, read the SDK reference guides at Client-side SDKs and Server-side SDKs. Each reference guide documents how to get started with the SDK, and links to information on the supported features, the SDK API documentation, the SDK's GitHub repository, and sample applications that use the SDK.
As a LaunchDarkly customer, you're never required to use the REST API. If you want to, you can perform all of the functions available in the REST API through the LaunchDarkly user interface (UI).
However, you may find it convenient to perform your feature management programmatically, rather than through the UI. For example, with the LaunchDarkly REST API you can perform the following:
- Create, update, and search for account members, teams, projects, environments, and feature flags
- Toggle feature flags
- Query data about users that have evaluated feature flags in your application
- Build custom integrations
- Export raw data to destinations outside of LaunchDarkly
You cannot use the REST API to evaluate a feature flag on behalf of an end user of your application. For that, you must use the LaunchDarkly SDK embedded in your application.
To get started, read The LaunchDarkly API.
To use the REST API, you need an API access token. You can generate an access token in LaunchDarkly's Account settings menu. Depending on your use case, you may prefer a personal access token or a service token. To authenticate to the LaunchDarkly API, add an
Authorization header with your access token to your requests. To learn more, read API access tokens.
The LaunchDarkly REST API is updated frequently, to support the latest features in the LaunchDarkly product. If breaking changes to the API are required, we release a new version. To set the API version for each request, add an
LD-API-Version header to the request. To learn more, read Versioning.
Periodically, we auto-generate client libraries in several common languages based on the OpenAPI specification of our REST API. To learn more, read OpenAPI and client libraries.
Outside of the official LaunchDarkly REST API, we occasionally provide supplemental API endpoints. These API endpoints:
- are still in beta
- are not yet incorporated into our REST API framework or client libraries, although they may be in the future
- correspond to features that are not yet available through the LaunchDarkly user interface
To learn more about the currently available supplemental public APIs, read:
This guide discussed several ways you can interact with LaunchDarkly, including through the LaunchDarkly SDK, the LaunchDarkly REST API, and other publicly available APIs. Understanding which of these options to use when helps you streamline the implementation of your application.
Your 14-day trial begins as soon as you sign up. Learn to use LaunchDarkly with the app's built-in tutorial. You'll discover how easy it is to manage the whole feature lifecycle from concept to launch to control.
Want to try it out? Start a trial.