> ## Documentation Index
> Fetch the complete documentation index at: https://docs.legitmark.com/llms.txt
> Use this file to discover all available pages before exploring further.

# 入门指南

> Legitmark 认证平台的集成工作流程。

## 概述

Legitmark 为希望在工作流程中以编程方式使用 Legitmark 的合作伙伴提供认证 API。该集成可访问 Legitmark 高度成熟的工作流程、流程和认证服务，通过结构化的工作流程预先收集需求并提供实时结果。

## 设置

<Steps>
  <Step title="设置组织账户">
    如果您已有 Legitmark 账户但需要设置为组织，请联系 [**accounts@legitmark.com**](mailto:accounts@legitmark.com) 了解详情。如果您还没有账户，他们可以帮助您开始。
  </Step>

  <Step title="创建 API 密钥">
    前往 [**开发者设置**](https://app.legitmark.com/settings/developer) 创建新的 API 密钥。密钥格式为 `leo_xxx`，用于认证所有 API 请求。
  </Step>

  <Step title="添加 Webhook 目标地址（可选）">
    在 [**开发者设置**](https://app.legitmark.com/settings/developer) 中，添加 HTTPS 端点 URL 作为 Webhook 目标地址，以便在鉴定完成、图片被拒绝或请求被取消时接收实时通知。

    还没有端点？使用 [Svix Play](https://play.svix.com/) 生成一个临时 URL 用于测试。
  </Step>

  <Step title="安装 SDK">
    ```bash theme={null}
    npm install legitmark
    ```
  </Step>
</Steps>

## TypeScript SDK

最快的集成方式是使用官方 [TypeScript SDK](https://github.com/legitmark-eng/legitmark-typescript)：

```typescript theme={null}
import { Legitmark } from 'legitmark';

const legitmark = new Legitmark('leo_your_api_key');

// service 可选 - 如果省略将自动解析
const { sr } = await legitmark.sr.create({
  item: { category: 'category-uuid', type: 'type-uuid', brand: 'brand-uuid' },
});

await legitmark.images.uploadForSide(sr.uuid, sideUuid, './photo.jpg');
await legitmark.sr.submit(sr.uuid);
```

SDK 包含完整的 TypeScript 类型、自动重试，并处理完整的认证工作流程 — 包括[类型化的 Webhook 事件处理](/cn/webhook-reference/handling)。详细使用方法请参阅 [SDK 文档](https://github.com/legitmark-eng/legitmark-typescript)。

## 集成指南

<CardGroup cols={2}>
  <Card title="认证" href="/cn/partner/authentication" icon="key">
    API 密钥使用、速率限制和安全最佳实践
  </Card>

  <Card title="分类体系" href="/cn/partner/taxonomy" icon="sitemap">
    了解 Legitmark 的分类系统和映射策略
  </Card>

  <Card title="工作流程" href="/cn/partner/workflow" icon="arrow-down-arrow-up">
    从服务请求创建到图片上传的分步流程
  </Card>

  <Card title="状态" href="/cn/partner/service-request-states" icon="list-check">
    服务请求状态和工作流程转换
  </Card>
</CardGroup>

## 快速参考

<CardGroup cols={2}>
  <Card title="API 参考" href="/api-reference/introduction" icon="code">
    使用实时认证和详细规范测试所有端点
  </Card>

  <Card title="Webhook 参考" href="/cn/webhook-reference/introduction" icon="webhook">
    实时 webhook 通知和状态更新处理
  </Card>
</CardGroup>
