Skip to content

Modify multiple files in a repository

POST
/repos/{owner}/{repo}/contents
owner
required
string

Owner of the repo

repo
required
string

Name of the repo

Media type application/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
string format: email
name
string
branch

Branch (optional) to base this file from. if not given, the default branch is used

string
committer

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

object
email
string format: email
name
string
dates

CommitDateOptions store dates for GIT_AUTHOR_DATE and GIT_COMMITTER_DATE

object
author
string format: date-time
committer
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, must be base64 encoded

string
from_path

Old path of the file to move

string
operation
required

Indicates what to do with the file

string
Allowed values: create update delete
path
required

Path to the existing or new file

string
sha

Sha is the SHA for the file that already exists, required for update or delete

string
force_overwrite_new_branch

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

boolean
message

Message (optional) for the commit of this file. if not supplied, a default message will be used

string
new_branch

New_branch (optional) will make a new branch from branch before creating the file

string
signoff

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

boolean

FilesResponse

Media type application/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
string
email
string format: email
name
string
committer
CommitUser contains information of a user in the context of a commit.
object
date
string
email
string format: email
name
string
created
string format: date-time
html_url
string
message
string
parents
Array<object>
CommitMeta contains meta information of a commit in terms of API.
object
created
string format: date-time
sha
string
url
string
sha
string
tree
CommitMeta contains meta information of a commit in terms of API.
object
created
string format: date-time
sha
string
url
string
url
string
files
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
string
html
string
self
string
content

content is populated when type is file, otherwise null

string
download_url
string
encoding

encoding is populated when type is file, otherwise null

string
git_url
string
html_url
string
last_commit_sha
string
last_commit_when
string format: date-time
name
string
path
string
sha
string
size
integer format: int64
submodule_git_url

submodule_git_url is populated when type is submodule, otherwise null

string
target

target is populated when type is symlink, otherwise null

string
type

type will be file, dir, symlink, or submodule

string
url
string
verification

PayloadCommitVerification represents the GPG verification of a commit

object
payload
string
reason
string
signature
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
string
verified
boolean
Example generated
{
"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": "example",
"message": "example",
"parents": [
{
"created": "2026-04-15T12:00:00Z",
"sha": "example",
"url": "example"
}
],
"sha": "example",
"tree": {
"created": "2026-04-15T12:00:00Z",
"sha": "example",
"url": "example"
},
"url": "example"
},
"files": [
{
"_links": {
"git": "example",
"html": "example",
"self": "example"
},
"content": "example",
"download_url": "example",
"encoding": "example",
"git_url": "example",
"html_url": "example",
"last_commit_sha": "example",
"last_commit_when": "2026-04-15T12:00:00Z",
"name": "example",
"path": "example",
"sha": "example",
"size": 1,
"submodule_git_url": "example",
"target": "example",
"type": "example",
"url": "example"
}
],
"verification": {
"payload": "example",
"reason": "example",
"signature": "example",
"signer": {
"email": "hello@example.com",
"name": "example",
"username": "example"
},
"verified": true
}
}

APIError is error format response

Media type application/json

APIError is an api error with a message

object
message
string
url
string
Example generated
{
"message": "example",
"url": "example"
}

APINotFound is a not found error response

Media type application/json
object
errors
Array<string>
message
string
url
string
Example generated
{
"errors": [
"example"
],
"message": "example",
"url": "example"
}

APIConflict is a conflict empty response

Media type application/json

QuotaExceeded

Media type application/json
message
string
user_id
integer format: int64
username
string

APIError is error format response

Media type application/json

APIError is an api error with a message

object
message
string
url
string
Example generated
{
"message": "example",
"url": "example"
}

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

Media type application/json
object
message
string
url
string
Example generated
{
"message": "example",
"url": "example"
}