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

> 下载先前上传的附件文件。返回一个重定向到预签名 URL，以安全访问文件。

# 下载附件

此端点允许你从 Devin 会话中下载文件。若要上传资源，请使用[上传端点](/zh/api-reference/v1/attachments/upload-files-for-devin-to-work-with)。

该端点返回一个 307 重定向到预签名 URL，为文件提供临时访问权限。预签名 URL 的有效期为 60 秒。

<div id="example-usage">
  ## 使用示例
</div>

```python theme={null}
import requests

# 下载附件
response = requests.get(
    f"https://api.devin.ai/v1/attachments/{uuid}/{filename}",
    headers={"Authorization": f"Bearer {DEVIN_API_KEY}"},
    allow_redirects=True
)

# 保存文件内容
with open(filename, "wb") as f:
    f.write(response.content)
```


## OpenAPI

````yaml zh/v1-openapi.yaml GET /v1/attachments/{uuid}/{name}
openapi: 3.1.0
info:
  description: Devin v1 API：个人 API key 与服务 API key
  title: Devin API v1
  version: 1.0.0
servers: []
security:
  - bearerAuth: []
paths:
  /v1/attachments/{uuid}/{name}:
    get:
      summary: 下载附件
      description: 使用 API key 进行认证来下载文件附件。返回一个重定向响应，指向预签名 URL。
      operationId: download_attachment_customer_endpoint_v1_attachments__uuid___name__get
      parameters:
        - in: path
          name: uuid
          required: true
          schema:
            title: Uuid
            type: string
        - in: path
          name: name
          required: true
          schema:
            title: Name
            type: string
      responses:
        '200':
          content:
            application/json:
              schema: {}
          description: 成功响应
        '307':
          description: 重定向到预签名下载 URL
        '422':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
          description: 验证错误
components:
  schemas:
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          title: Detail
          type: array
      title: HTTPValidationError
      type: object
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          title: Location
          type: array
        msg:
          title: Message
          type: string
        type:
          title: Error Type
          type: string
      required:
        - loc
        - msg
        - type
      title: ValidationError
      type: object
  securitySchemes:
    bearerAuth:
      description: 个人 API Key（apk_user_\*）或服务 API Key（apk_\*）
      scheme: bearer
      type: http

````