Skip to content
Try Gitea Cloud ☁️ for 30 days → Accelerate your Development & Deploys!
This is the documentation of the next version, still under development. See the latest release.

Modify multiple files in a repository

POST
/repos/{owner}/{repo}/contents
curl --request POST \
--url https://gitea.com/api/v1/repos/example/example/contents \
--header 'Authorization: Basic <credentials>' \
--header 'Content-Type: application/json' \
--data '{ "author": { "email": "hello@example.com", "name": "example" }, "branch": "example", "committer": { "email": "hello@example.com", "name": "example" }, "dates": { "author": "2026-04-15T12:00:00Z", "committer": "2026-04-15T12:00:00Z" }, "files": [ { "content": "example", "from_path": "example", "operation": "create", "path": "example", "sha": "example" } ], "force_push": true, "message": "example", "new_branch": "example", "signoff": true }'
owner
required
string

Owner of the repo

repo
required
string

Name of the repo

Media typeapplication/json

ChangeFilesOptions options for creating, updating or deleting multiple files Note: author and committer are optional (if only one is given, it will be used for the other, otherwise the authenticated user will be used)

object
author

Identity for a person’s identity like an author or committer

object
email

Email is the person’s email address

string format: email
name

Name is the person’s name

string
branch

Branch (optional) is the base branch for the changes. If not supplied, the default branch is used

string
committer

Identity for a person’s identity like an author or committer

object
email

Email is the person’s email address

string format: email
name

Name is the person’s name

string
dates

CommitDateOptions store dates for GIT_AUTHOR_DATE and GIT_COMMITTER_DATE

object
author

Author is the author date for the commit

string format: date-time
committer

Committer is the committer date for the commit

string format: date-time
files
required

List of file operations

Array<object>

ChangeFileOperation for creating, updating or deleting a file

object
content

New or updated file content, it must be base64 encoded

string
from_path

Old path of the file to move

string
operation
required

Indicates what to do with the file: “create” for creating a new file, “update” for updating an existing file, “upload” for creating or updating a file, “rename” for renaming a file, and “delete” for deleting an existing file.

string
Allowed values: create update upload rename delete
path
required

Path to the existing or new file

string
sha

The blob ID (SHA) for the file that already exists, required for changing existing files

string
force_push

Force_push (optional) will do a force-push if the new branch already exists

boolean
message

Message (optional) is the commit message of the changes. If not supplied, a default message will be used

string
new_branch

New_branch (optional) will make a new branch from base branch for the changes. If not supplied, the changes will be committed to the base branch

string
signoff

Add a Signed-off-by trailer by the committer at the end of the commit log message.

boolean

FilesResponse

Media typeapplication/json

FilesResponse contains information about multiple files from a repo

object
commit
FileCommitResponse contains information generated from a Git commit for a repo's file.
object
author
CommitUser contains information of a user in the context of a commit.
object
date

Date is the commit date in string format

string
email

Email is the person’s email address

string format: email
name

Name is the person’s name

string
committer
CommitUser contains information of a user in the context of a commit.
object
date

Date is the commit date in string format

string
email

Email is the person’s email address

string format: email
name

Name is the person’s name

string
created

Created is the time when the commit was created

string format: date-time
html_url

HTMLURL is the web URL for viewing this commit

string format: uri
message

Message is the commit message

string
parents

Parents contains parent commit metadata

Array<object>
CommitMeta contains meta information of a commit in terms of API.
object
created

Created is the time when the commit was created

string format: date-time
sha

SHA is the commit SHA hash

string
url

URL is the API URL for the commit

string format: uri
sha

SHA is the commit SHA hash

string
tree
CommitMeta contains meta information of a commit in terms of API.
object
created

Created is the time when the commit was created

string format: date-time
sha

SHA is the commit SHA hash

string
url

URL is the API URL for the commit

string format: uri
url

URL is the API URL for the commit

string format: uri
files

Files contains the list of file contents and metadata

Array<object>

ContentsResponse contains information about a repo’s entry’s (dir, file, symlink, submodule) metadata and content

object
_links

FileLinksResponse contains the links for a repo’s file

object
git

GitURL is the Git API URL for this file

string
html

HTMLURL is the web URL for this file

string
self

Self is the API URL for this file

string
content

content is populated when type is file, otherwise null

string
download_url

DownloadURL is the direct download URL for this file

string format: uri
encoding

encoding is populated when type is file, otherwise null

string
git_url

GitURL is the Git API URL for this blob or tree

string format: uri
html_url

HTMLURL is the web URL for this file or directory

string format: uri
last_author_date
string format: date-time
last_commit_message

LastCommitMessage is the message of the last commit that affected this file

string
last_commit_sha

LastCommitSHA is the SHA of the last commit that affected this file

string
last_committer_date
string format: date-time
lfs_oid

LfsOid is the Git LFS object ID if this file is stored in LFS

string
lfs_size

LfsSize is the file size if this file is stored in LFS

integer format: int64
mode

mode is the Git file mode as an octal string, e.g. 100644 (regular), 100755 (executable), 120000 (symlink), 160000 (submodule)

string
name

Name is the file or directory name

string
path

Path is the full path to the file or directory

string
sha

SHA is the Git blob or tree SHA

string
size

Size is the file size in bytes

integer format: int64
submodule_git_url

submodule_git_url is populated when type is submodule, otherwise null

string format: uri
target

target is populated when type is symlink, otherwise null

string
type

type will be file, dir, symlink, or submodule

string
url

URL is the API URL for this file or directory

string format: uri
verification

PayloadCommitVerification represents the GPG verification of a commit

object
payload

The signed payload content

string
reason

The reason for the verification status

string
signature

The GPG signature of the commit

string
signer

PayloadUser represents the author or committer of a commit

object
email
string format: email
name

Full name of the commit author

string
username

Username of the user

string
verified

Whether the commit signature is verified

boolean
Examplegenerated
{
"commit": {
"author": {
"date": "example",
"email": "hello@example.com",
"name": "example"
},
"committer": {
"date": "example",
"email": "hello@example.com",
"name": "example"
},
"created": "2026-04-15T12:00:00Z",
"html_url": "https://example.com",
"message": "example",
"parents": [
{
"created": "2026-04-15T12:00:00Z",
"sha": "example",
"url": "https://example.com"
}
],
"sha": "example",
"tree": {
"created": "2026-04-15T12:00:00Z",
"sha": "example",
"url": "https://example.com"
},
"url": "https://example.com"
},
"files": [
{
"_links": {
"git": "example",
"html": "example",
"self": "example"
},
"content": "example",
"download_url": "https://example.com",
"encoding": "example",
"git_url": "https://example.com",
"html_url": "https://example.com",
"last_author_date": "2026-04-15T12:00:00Z",
"last_commit_message": "example",
"last_commit_sha": "example",
"last_committer_date": "2026-04-15T12:00:00Z",
"lfs_oid": "example",
"lfs_size": 1,
"mode": "example",
"name": "example",
"path": "example",
"sha": "example",
"size": 1,
"submodule_git_url": "https://example.com",
"target": "example",
"type": "example",
"url": "https://example.com"
}
],
"verification": {
"payload": "example",
"reason": "example",
"signature": "example",
"signer": {
"email": "hello@example.com",
"name": "example",
"username": "example"
},
"verified": true
}
}

APIError is error format response

message
string
url
string

APINotFound is a not found empty response

APIError is error format response

message
string
url
string

APIRepoArchivedError is an error that is raised when an archived repo should be modified

message
string
url
string