Create a comment attachment
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 of the repo
Name of the repo
Id of the comment
Query Parameters
Section titled “Query Parameters”Name of the attachment
Request Body
Section titled “Request Body”object
Attachment to upload
Responses
Section titled “Responses”Attachment
Attachment a generic attachment
object
DownloadURL is the URL to download the attachment
Created is the time when the attachment was uploaded
DownloadCount is the number of times the attachment has been downloaded
ID is the unique identifier for the attachment
Name is the filename of the attachment
Size is the file size in bytes
UUID is the unique identifier for the attachment file
Examplegenerated
{ "browser_download_url": "https://example.com", "created_at": "2026-04-15T12:00:00Z", "download_count": 1, "id": 1, "name": "example", "size": 1, "uuid": "example"}APIError is error format response
Headers
Section titled “Headers”APIForbiddenError is a forbidden error response
Headers
Section titled “Headers”APIError is error format response
Headers
Section titled “Headers”APIError is error format response
Headers
Section titled “Headers”APIValidationError is error format response related to input validation
Headers
Section titled “Headers”APIRepoArchivedError is an error that is raised when an archived repo should be modified