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

# 删除角色

> 从当前账户删除角色。

删除当前账户拥有的角色。角色不存在或属于其他账户时均返回 `404`，接口刻意不区分这两种情况。

## 请求参数

| 参数             | 类型     |  必填 | 说明                                           |
| -------------- | ------ | :-: | -------------------------------------------- |
| `character_id` | string |  是  | 创建或列出角色时返回的完整公开 ID，通常以 `char_` 开头，必须属于当前调用者。 |

## 响应参数

返回 `200 OK`。

| 字段       | 类型     |  必填 | 说明                  |
| -------- | ------ | :-: | ------------------- |
| `status` | string |  是  | 删除成功后固定为 `deleted`。 |

## 示例

<CodeGroup>
  ```go Go theme={null}
  req, _ := http.NewRequest("DELETE", "https://apis.viggle.ai/v1/characters/"+characterID, nil); req.Header.Set("Authorization", "Bearer "+apiKey); resp, err := http.DefaultClient.Do(req)
  ```

  ```javascript JavaScript theme={null}
  const response = await fetch(`https://apis.viggle.ai/v1/characters/${characterId}`, {method:"DELETE", headers:{Authorization:`Bearer ${process.env.VIGGLE_API_KEY}`}});
  ```

  ```python Python theme={null}
  response = requests.delete(f"https://apis.viggle.ai/v1/characters/{character_id}", headers={"Authorization": f"Bearer {os.environ['VIGGLE_API_KEY']}"})
  ```

  ```bash cURL theme={null}
  curl -X DELETE "https://apis.viggle.ai/v1/characters/$CHARACTER_ID" -H "Authorization: Bearer $VIGGLE_API_KEY"
  ```
</CodeGroup>


## OpenAPI

````yaml zh/openapi.yaml DELETE /v1/characters/{character_id}
openapi: 3.0.3
info:
  title: Viggle API
  description: 使用 AI 生成角色动画视频。
  version: 2.0.0
  contact:
    name: Viggle Support
    url: https://viggle.ai
servers:
  - url: https://apis.viggle.ai
    description: 生产服务器
security:
  - bearerAuth: []
tags:
  - name: Renders
    description: 准备输入、创建渲染、观察进度并获取结果。
  - name: Credits
    description: 查询当前调用者可用的积分余额。
  - name: Characters
    description: 创建、列出、查询和删除可复用角色。type 决定是否同时提取 3D vsplat，就绪后通过导出接口获取下载链接。
  - name: Motions
    description: 创建、列出、查询和删除可复用动作，也可从官方模板导入。type 决定是否提取或生成 3D 动画，就绪后通过导出接口获取下载链接。
  - name: Videos
    description: 生成 MiniMax H3 视频（vid_）或角色动画视频（anim_），并统一查询调用者的 H3、角色动画及角色动作渲染（render_）结果。
paths:
  /v1/characters/{character_id}:
    parameters:
      - $ref: '#/components/parameters/CharacterId'
      - $ref: '#/components/parameters/RequestId'
      - $ref: '#/components/parameters/SourceChannel'
    delete:
      tags:
        - Characters
      summary: 删除角色
      operationId: v1DeleteCharacter
      responses:
        '200':
          description: 请求成功。
          headers:
            X-Request-Id:
              $ref: '#/components/headers/RequestId'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/DeletedAcknowledgement'
        '400':
          $ref: '#/components/responses/ResourceBadRequest'
        '401':
          $ref: '#/components/responses/ResourceUnauthorized'
        '404':
          $ref: '#/components/responses/ResourceNotFound'
        '500':
          $ref: '#/components/responses/ResourceInternalServerError'
        '503':
          $ref: '#/components/responses/ResourceServiceUnavailable'
components:
  parameters:
    CharacterId:
      name: character_id
      in: path
      required: true
      description: 创建或列出角色时返回的公开 ID，通常以 char_ 开头，必须属于当前调用者。
      schema:
        type: string
        minLength: 1
      example: char_2f1c4b8e9d7a4f2ab6c3d5e7f9a1b3c5
    RequestId:
      name: X-Request-Id
      in: header
      required: false
      description: 可选的调用者自定义关联 ID，最长 128 字符。服务会在响应头返回实际使用的值，便于追踪和支持排查。
      schema:
        type: string
        minLength: 1
        maxLength: 128
    SourceChannel:
      name: X-Viggle-Source
      in: header
      required: false
      description: 可选来源标签，最长 128 字符，用于识别 SDK、集成、产品入口或内部工作流。
      schema:
        type: string
        minLength: 1
        maxLength: 128
  headers:
    RequestId:
      description: 用于支持排查和追踪的稳定请求 ID。
      schema:
        type: string
  schemas:
    DeletedAcknowledgement:
      type: object
      additionalProperties: false
      required:
        - status
      properties:
        status:
          type: string
          description: 删除确认，唯一成功值为 deleted。
          enum:
            - deleted
    ResourceErrorResponse:
      type: object
      additionalProperties: false
      required:
        - error
      properties:
        error:
          description: 同步资源操作失败的顶层错误对象。
          allOf:
            - $ref: '#/components/schemas/ResourceHttpError'
    ResourceHttpError:
      description: >-
        同步资源请求的错误封装。错误码由 API 服务中的固定映射生成，无公开映射的失败使用 processing_failed。资源的异步 error
        对象采用 ResourceError 中更广泛、可扩展的错误码集合。
      type: object
      additionalProperties: false
      required:
        - code
        - message
        - request_id
      properties:
        code:
          type: string
          description: 同步资源请求的固定小写下划线错误码，用于程序化处理。
          enum:
            - authentication_required
            - invalid_api_key
            - insufficient_credits
            - invalid_request
            - motion_not_ready
            - character_not_found
            - motion_not_found
            - not_found
            - id_already_exists
            - rate_limited
            - service_unavailable
            - task_failed
            - internal_error
            - processing_failed
        message:
          type: string
          description: 供人阅读的同步请求失败说明。
        request_id:
          description: 同步失败时始终为 null，请通过 X-Request-Id 响应头关联请求。
          type: string
          nullable: true
  responses:
    ResourceBadRequest:
      description: 请求失败，详情见错误响应。
      headers:
        X-Request-Id:
          $ref: '#/components/headers/RequestId'
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ResourceErrorResponse'
    ResourceUnauthorized:
      description: 请求失败，详情见错误响应。
      headers:
        X-Request-Id:
          $ref: '#/components/headers/RequestId'
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ResourceErrorResponse'
    ResourceNotFound:
      description: 请求失败，详情见错误响应。
      headers:
        X-Request-Id:
          $ref: '#/components/headers/RequestId'
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ResourceErrorResponse'
    ResourceInternalServerError:
      description: 请求失败，详情见错误响应。
      headers:
        X-Request-Id:
          $ref: '#/components/headers/RequestId'
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ResourceErrorResponse'
    ResourceServiceUnavailable:
      description: 请求失败，详情见错误响应。
      headers:
        Retry-After:
          schema:
            type: integer
            minimum: 0
        X-Request-Id:
          $ref: '#/components/headers/RequestId'
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ResourceErrorResponse'
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: API key or OAuth access token
      description: 服务端 SDK 使用项目 API 密钥，Remote MCP 使用 OAuth 访问令牌。不要在浏览器代码中暴露项目密钥。

````