---
title: "Create Attachment (from URL)"
method: POST
path: "/api_v2/projects/{project_id}/tasks/{task_id}/attachments.json"
tags: ["Attachments"]
---

# Create Attachment (from URL)

`POST /api_v2/projects/{project_id}/tasks/{task_id}/attachments.json`

## Request

- Base URL: `https://www.bugherd.com`
- URL: `https://www.bugherd.com/api_v2/projects/{project_id}/tasks/{task_id}/attachments.json`
- Auth: HTTP basic

Attaches a file to a task by providing a publicly accessible URL. BugHerd downloads the file from the URL and stores a copy. For direct file uploads, use the Upload Attachment endpoint instead.

## Path parameters

- `project_id` integer, required
- `task_id` integer, required

## Request body

- object
  - `attachment` object
    - `file_name` string, required
    - `url` string, uri, required

## Response `201`

Created attachment

- object
  - `attachment` Attachment
    - `id` integer
    - `file_name` string
    - `url` string, uri
    - `created_at` string, date-time

---

[API](https://skmtc.dev/bugherd/apis/bugherd-api-v2.md) · [All operations](https://skmtc.dev/bugherd/apis/bugherd-api-v2/llms.txt) · [OpenAPI document](https://skmtc.dev/bugherd/apis/bugherd-api-v2/revisions/bf473cda70d4?raw)
