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

# 删除项目

> 永久删除翻译项目

# 删除项目

永久删除翻译项目及其关联资产。

此清理操作还会移除为该项目生成的任何已存储的语音克隆预览示例文件。

如果某些内部生成的文件或片段记录在删除完成前已被移除，清理工作将以尽力模式继续进行，并最终完成项目删除。

<Warning>
  此操作不可逆。项目、作品、生成的媒体资产以及存储的语音预览示例文件都将被删除。
</Warning>

## 请求

### 标头

<ParamField header="x-api-key" type="string" required>
  您的 VoiceCheap API 密钥。请从 [app.voicecheap.ai/page-api](https://app.voicecheap.ai/page-api) 获取。
</ParamField>

### 路径参数

<ParamField path="projectId" type="string" required>
  要删除的翻译项目的唯一标识符。
</ParamField>

## 响应

<ResponseField name="success" type="boolean" required>
  表示删除操作已成功完成。
</ResponseField>

<ResponseField name="message" type="string" required>
  人类可读的确认消息。
</ResponseField>

<ResponseField name="projectId" type="string" required>
  已删除项目的 ID。
</ResponseField>

## 示例

<CodeGroup>
  ```bash cURL theme={null}
  curl -X DELETE "https://api.voicecheap.ai/v1/translate/abc123-def456-ghi789" \
    -H "x-api-key: vc_your-api-key"
  ```

  ```typescript TypeScript theme={null}
  interface DeleteProjectResponse {
    success: true;
    message: string;
    projectId: string;
  }

  async function deleteProject(projectId: string): Promise<DeleteProjectResponse> {
    const response = await fetch(
      `https://api.voicecheap.ai/v1/translate/${projectId}`,
      {
        method: 'DELETE',
        headers: {
          'x-api-key': 'vc_your-api-key',
        },
      },
    );

    if (!response.ok) {
      const error = await response.json();
      throw new Error(error.message || 'Failed to delete project');
    }

    return response.json();
  }

  // Usage
  deleteProject('abc123-def456-ghi789')
    .then((result) => console.log('Deleted:', result.projectId))
    .catch((error) => console.error('Error:', error));
  ```

  ```python Python theme={null}
  import requests

  project_id = 'abc123-def456-ghi789'
  headers = {'x-api-key': 'vc_your-api-key'}

  response = requests.delete(
      f'https://api.voicecheap.ai/v1/translate/{project_id}',
      headers=headers
  )

  if not response.ok:
      error = response.json()
      raise Exception(error.get('message', 'Failed to delete project'))

  result = response.json()
  print(f"Deleted: {result['projectId']}")
  ```

  ```php PHP theme={null}
  <?php
  $apiKey = 'vc_your-api-key';
  $projectId = 'abc123-def456-ghi789';

  $curl = curl_init();

  curl_setopt_array($curl, [
      CURLOPT_URL => "https://api.voicecheap.ai/v1/translate/{$projectId}",
      CURLOPT_RETURNTRANSFER => true,
      CURLOPT_CUSTOMREQUEST => 'DELETE',
      CURLOPT_HTTPHEADER => [
          "x-api-key: {$apiKey}"
      ]
  ]);

  $response = curl_exec($curl);
  $result = json_decode($response, true);

  if (!isset($result['success'])) {
      $message = $result['message'] ?? 'Failed to delete project';
      throw new Exception($message);
  }

  echo "Deleted: " . $result['projectId'];
  ```
</CodeGroup>

## 错误

| 状态  | 代码                    | 描述                  |
| --- | --------------------- | ------------------- |
| 401 | `INVALID_API_KEY`     | 提供的 API 密钥无效        |
| 403 | `FORBIDDEN`           | 您没有权限删除此项目          |
| 404 | `PROJECT_NOT_FOUND`   | 指定的项目不存在            |
| 429 | `RATE_LIMIT_EXCEEDED` | 请求过多（限制：每分钟 10 次请求） |
| 500 | `INTERNAL_ERROR`      | 意外的服务器错误            |
