Create a comment attachment
POST
/repos/{owner}/{repo}/issues/comments/{id}/assets
const url = 'https://gitea.com/api/v1/repos/example/example/issues/comments/1/assets';const form = new FormData();form.append('attachment', 'file');
const options = {method: 'POST', headers: {Authorization: 'Basic <credentials>'}};
options.body = form;
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request POST \ --url https://gitea.com/api/v1/repos/example/example/issues/comments/1/assets \ --header 'Authorization: Basic <credentials>' \ --header 'Content-Type: multipart/form-data' \ --form attachment=@fileAuthorizations
Section titled “Authorizations”Parameters
Section titled “Parameters”Path Parameters
Section titled “Path Parameters”owner
required
string
Owner of the repo
repo
required
string
Name of the repo
id
required
integer format: int64
Id of the comment
Query Parameters
Section titled “Query Parameters”name
string
Name of the attachment
Request Body
Section titled “Request Body”Media typemultipart/form-data
object
attachment
required
Attachment to upload
string format: binary
Responses
Section titled “Responses”Attachment
Media typeapplication/json
Attachment
A generic attachment
object
browser_download_url
DownloadURL is the URL to download the attachment
string format: uri
created_at
Created is the time when the attachment was uploaded
string format: date-time
download_count
DownloadCount is the number of times the attachment has been downloaded
integer format: int64
id
ID is the unique identifier for the attachment
integer format: int64
name
Name is the filename of the attachment
string
size
Size is the file size in bytes
integer format: int64
uuid
UUID is the unique identifier for the attachment file
string
Example generated
{ "browser_download_url": "https://example.com", "created_at": "2026-04-15T12:00:00Z", "download_count": 1, "id": 1, "name": "example", "size": 1, "uuid": "example"}default
Section titled “default”APIError is error format response
Headers
Section titled “Headers”message
string
url
string