> ## Documentation Index
> Fetch the complete documentation index at: https://test-8ad8522e-docs-compliance-guide-refine.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# 上传技能

> 上传技能 zip 包并注册为新的账户或团队技能。

## 限制说明

| 项目   | 说明                                     |
| ---- | -------------------------------------- |
| 速率限制 | 每个 `app_key` **1,000 次/分钟**；**50 次/秒** |
| 权限要求 | 无 —— 持有有效的 `app_key` 即可调用              |

## 使用说明

* 请求体为 `multipart/form-data`，包含 `file` 部分（zip 包）与可选的 `team_id` 字段，而非 JSON。
* 技能名称重复时返回 InvalidParameter。
* 每次调用都会记入账户审计日志。


## OpenAPI

````yaml /api-reference/safari.openapi.zh.json post /safari/skill/upload
openapi: 3.1.0
info:
  title: Flashduty 开放 API
  description: >-
    Flashduty AI SRE（safari）模块的公共 HTTP API —— 管理智能体技能、MCP 服务器与 A2A 远程智能体。每个接口都通过
    Flashduty 控制台签发的 `app_key` 查询参数进行鉴权。
  version: 1.0.0
servers:
  - url: https://api.flashcat.cloud
    description: Flashduty 开放 API
security:
  - AppKeyAuth: []
tags:
  - name: AI SRE/技能
    description: AI SRE 智能体技能管理。
  - name: AI SRE/MCP 服务器
    description: MCP（Model Context Protocol）服务器管理。
  - name: AI SRE/A2A 智能体
    description: A2A（智能体到智能体）远程智能体管理。
  - name: AI SRE/会话
    description: AI SRE 智能体会话历史 —— 查询、查看与导出会话记录。
paths:
  /safari/skill/upload:
    post:
      tags:
        - AI SRE/技能
      summary: 上传技能
      description: 上传技能 zip 包并注册为新的账户或团队技能。
      operationId: skill-write-upload
      requestBody:
        required: true
        content:
          multipart/form-data:
            schema:
              type: object
              properties:
                file:
                  type: string
                  format: binary
                  description: Skill zip package to upload.
                team_id:
                  type: integer
                  format: int64
                  description: Owning team for the new skill; 0 for account scope.
              required:
                - file
      responses:
        '200':
          description: Success
          content:
            application/json:
              schema:
                allOf:
                  - $ref: '#/components/schemas/ResponseEnvelope'
                  - type: object
                    properties:
                      data:
                        $ref: '#/components/schemas/SkillItem'
              example:
                request_id: 01HK8XQE3Z7JM2NTFQ5YJ8P9R4
                data:
                  skill_id: skl-7f3a9c21b8e0
                  account_id: 10023
                  team_id: 0
                  skill_name: k8s-triage
                  description: >-
                    Diagnose unhealthy Kubernetes workloads from cluster events
                    and pod logs.
                  version: 1.2.0
                  tags:
                    - kubernetes
                    - triage
                  author: sre-team
                  status: enabled
                  created_by: 80011
                  created_at: 1716960000000
                  updated_at: 1717046400000
                  can_edit: true
                  update_available: false
                  is_modified: false
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '429':
          $ref: '#/components/responses/TooManyRequests'
        '500':
          $ref: '#/components/responses/ServerError'
      security:
        - AppKeyAuth: []
components:
  schemas:
    ResponseEnvelope:
      type: object
      description: >-
        Standard response envelope used by every Flashduty public API. On
        success `data` contains the endpoint-specific payload and `error` is
        absent. On failure `error` is present and `data` is absent. `request_id`
        is always present and is also mirrored in the `Flashcat-Request-Id`
        response header.
      properties:
        request_id:
          type: string
          description: >-
            Unique ID for this request. Mirrored in the Flashcat-Request-Id
            header. Include it when reporting issues.
          example: 01HK8XQE3Z7JM2NTFQ5YJ8P9R4
        error:
          $ref: '#/components/schemas/DutyError'
        data:
          description: Endpoint-specific payload. See each operation's 200 response schema.
      required:
        - request_id
    SkillItem:
      type: object
      description: An AI SRE skill — a packaged capability the agent can load at runtime.
      properties:
        skill_id:
          type: string
          description: Unique identifier of the skill.
        account_id:
          type: integer
          format: int64
          description: Owning account.
        team_id:
          type: integer
          format: int64
          description: Owning team; 0 means account scope.
        skill_name:
          type: string
          description: Name of the skill, parsed from its SKILL.md frontmatter.
        description:
          type: string
          description: What the skill does and when the agent should use it.
        content:
          type: string
          description: Full SKILL.md body; omitted in list responses.
        version:
          type: string
          description: Skill version string from its frontmatter.
        tags:
          type: array
          items:
            type: string
          description: Tags declared in the skill frontmatter.
        author:
          type: string
          description: Author declared in the skill frontmatter.
        license:
          type: string
          description: License declared in the skill frontmatter.
        tools:
          type: array
          items:
            type: string
          description: Tools the skill requires, declared in its frontmatter.
        s3_key:
          type: string
          description: Object-storage key of the skill's zip package.
        checksum:
          type: string
          description: SHA-256 checksum of the skill's zip package.
        status:
          type: string
          enum:
            - enabled
            - disabled
          description: Whether the skill is active and loadable by agents.
        created_by:
          type: integer
          format: int64
          description: Member who created this resource.
        created_at:
          type: integer
          format: int64
          description: Creation time as a Unix timestamp in milliseconds.
        updated_at:
          type: integer
          format: int64
          description: Last-update time as a Unix timestamp in milliseconds.
        can_edit:
          type: boolean
          description: Whether the calling member may edit or delete this resource.
        source_template_name:
          type: string
          description: Marketplace template this skill was installed from, if any.
        source_template_version:
          type: string
          description: Marketplace template version captured at install time.
        update_available:
          type: boolean
          description: A newer marketplace template version exists for this skill.
        is_modified:
          type: boolean
          description: >-
            A marketplace-sourced skill has been edited locally; auto-update
            skips it.
        created:
          type: boolean
          description: >-
            Install response only: true for a fresh install, false for an
            in-place upsert.
      required:
        - skill_id
        - account_id
        - team_id
        - skill_name
        - description
        - status
        - created_by
        - created_at
        - updated_at
        - can_edit
        - update_available
        - is_modified
    DutyError:
      type: object
      description: >-
        Error payload inside the response envelope. Present only on non-2xx
        responses.
      properties:
        code:
          $ref: '#/components/schemas/ErrorCode'
        message:
          type: string
          description: >-
            Human-readable error message, localized by the caller's
            Accept-Language. May contain field names, IDs, or other context from
            the failing request.
      required:
        - code
        - message
    ErrorResponse:
      type: object
      description: Response envelope for errors. `error` is required; `data` is absent.
      properties:
        request_id:
          type: string
          example: 01HK8XQE3Z7JM2NTFQ5YJ8P9R4
        error:
          $ref: '#/components/schemas/DutyError'
      required:
        - request_id
        - error
    ErrorCode:
      type: string
      description: >-
        Flashduty error code enum. Every failed API response sets `error.code`
        to one of these values. The value is a stable wire string — not a
        localized message and not a numeric status. HTTP status is
        informational.
      enum:
        - OK
        - InvalidParameter
        - BadRequest
        - InvalidContentType
        - ResourceNotFound
        - NoLicense
        - ReferenceExist
        - Unauthorized
        - BalanceNotEnough
        - AccessDenied
        - RouteNotFound
        - MethodNotAllowed
        - UndonedOrderExist
        - RequestLocked
        - EntityTooLarge
        - RequestTooFrequently
        - RequestVerifyRequired
        - DangerousOperation
        - InternalError
        - ServiceUnavailable
  responses:
    BadRequest:
      description: Invalid request — usually a missing or malformed parameter.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
          examples:
            missingParameter:
              summary: Missing required parameter
              value:
                request_id: 01HK8XQE3Z7JM2NTFQ5YJ8P9R4
                error:
                  code: InvalidParameter
                  message: The specified parameter skill_id is not valid.
    Unauthorized:
      description: Missing or invalid app_key.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
          examples:
            missingAppKey:
              value:
                request_id: 01HK8XQE3Z7JM2NTFQ5YJ8P9R4
                error:
                  code: Unauthorized
                  message: You are unauthorized.
    TooManyRequests:
      description: >-
        Rate limit hit. Either the global API limit, a per-account limit, or a
        per-integration limit.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
          examples:
            rateLimited:
              value:
                request_id: 01HK8XQE3Z7JM2NTFQ5YJ8P9R4
                error:
                  code: RequestTooFrequently
                  message: Request too frequently.
    ServerError:
      description: Unexpected server-side error. Include the request_id when reporting.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
          examples:
            internal:
              value:
                request_id: 01HK8XQE3Z7JM2NTFQ5YJ8P9R4
                error:
                  code: InternalError
                  message: >-
                    We encountered an internal error, and it has been reported.
                    Please try again later.
  securitySchemes:
    AppKeyAuth:
      type: apiKey
      in: query
      name: app_key
      description: Flashduty 控制台「账户 → APP Keys」中签发的 app_key。调用任何公共 API 都需要它。

````