@dynamic-labs/sdk-api

中文文档
0.173.0发布于 2026/11/13Apache-2.0TypeScriptESM + CJS零依赖近 30 天下载 8.8万

API SDK for app.dynamic.xyz

原始使用文档

sdk-api

This library contains a generated TypeScript client using openapi. It can be used with any Javascript/Typescript project.

Documentation on the current set of REST APIs can be found at: https://dynamic.xyz/docs/api-reference/overview

APIs

  • SdkApi
    • These are endpoints used exclusively by the Dynamic React SDK. Several endpoints in these APIs require a JWT created by the verify or signin endpoints, and are specific to a user in the SDK's environment. These APIs are typically used on a client site or frontend to enhance their customers' experience.
  • Dashboard APIs
    • These endpoints are used by admins of an organization to update site settings and manage users of the environment. These APIs require an API token scoped for a specific environment. These APIs are typically used on a client backend, to manage all their users' data and make corresponding settings changes that affect all users of a site.
    • The most commonly used API among the dashboard APIs is UsersApi
    • You can read about all the other available APIs here

Examples

This section provides an example of how to use SDKApi. This would be similar to using the other available generated APIs, like UsersApi or ExportsApi, etc.

SdkApi

Initialize a new instance of the SDKApi class:

import { Configuration, SDKApi } from '@dynamic-labs/sdk-api';

const sdkApi = (jwt: string) => {
  const settings = {
    basePath: ApiEndpoint.getBaseUrl(),
    headers: {
      'Content-Type': 'application/json',
    },
  };
  settings.headers.Authorization = `Bearer ${jwt}`;
  return new SDKApi(new Configuration(settings));
};

Then you would be able to use it like this:

const response = await sdkApi(jwt).updateSelf({
  environmentId,
  userFields: fields, // { alias, firstName, lastName, username, ... }
});
// do something with the response

版本与发布记录

@dynamic-labs/sdk-api 共发布 1,279 个版本,首次发布于 2022/05/07;过去 12 个月发布了 467 个版本。

版本发布日期距今
0.173.0latest2026/11/13今天
0.172.02026/11/13今天
0.171.02026/11/13今天
0.170.02026/11/13今天
0.169.02026/11/121 天前
0.168.02026/11/112 天前

关于 @dynamic-labs/sdk-api 的常见问题

@dynamic-labs/sdk-api 是什么?

API SDK for app.dynamic.xyz

如何安装 @dynamic-labs/sdk-api?

在项目目录运行 npm install @dynamic-labs/sdk-api,或使用 pnpm add / yarn add / bun add。

@dynamic-labs/sdk-api 支持 TypeScript 吗?

支持。包内自带 TypeScript 类型声明(package.json 声明了 types 入口),安装后即可获得类型提示,无需再安装 @types 包。

@dynamic-labs/sdk-api 支持 ESM 还是 CommonJS?

同时提供 ES Module 与 CommonJS 入口,import 和 require() 都可以使用,打包工具会自动选择合适的版本。

@dynamic-labs/sdk-api 可以商用吗?

@dynamic-labs/sdk-api 使用 Apache-2.0 许可。宽松许可:允许商业使用、修改和再分发,并附带明确的专利授权;分发时需保留许可与 NOTICE 文件,修改过的文件要注明改动。以上为概括,不构成法律意见,请以许可原文为准。

@dynamic-labs/sdk-api 的下载量有多少?

根据 npm 官方下载统计,@dynamic-labs/sdk-api 在 2026/10/13 – 2026/11/11 这 30 天内被下载 87,615 次,日均约 2,921 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@dynamic-labs/sdk-api 还在维护吗?

最新版本 0.173.0 发布于 2026/11/13(今天);至今共发布 1279 个版本,其中过去 12 个月发布了 467 个;首次发布于 2022/05/07。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。