Create or update file contents

PUT {{baseUrl}}/repos/:owner/:repo/contents/:path

Creates a new file or replaces an existing file in a repository.

Request Body

{"message"=>"<string>", "content"=>"<string>", "sha"=>"<string>", "branch"=>"<string>", "committer"=>{"name"=>"<string>", "email"=>"<string>", "date"=>"<string>"}, "author"=>{"name"=>"<string>", "email"=>"<string>", "date"=>"<string>"}}

HEADERS

KeyDatatypeRequiredDescription
Content-Typestring

RESPONSES

status: OK

{&quot;content&quot;:{&quot;name&quot;:&quot;hello.txt&quot;,&quot;path&quot;:&quot;notes/hello.txt&quot;,&quot;sha&quot;:&quot;a56507ed892d05a37c6d6128c260937ea4d287bd&quot;,&quot;size&quot;:9,&quot;url&quot;:&quot;https://api.github.com/repos/octocat/Hello-World/contents/notes/hello.txt&quot;,&quot;html_url&quot;:&quot;https://github.com/octocat/Hello-World/blob/master/notes/hello.txt&quot;,&quot;git_url&quot;:&quot;https://api.github.com/repos/octocat/Hello-World/git/blobs/a56507ed892d05a37c6d6128c260937ea4d287bd&quot;,&quot;download_url&quot;:&quot;https://raw.githubusercontent.com/octocat/HelloWorld/master/notes/hello.txt&quot;,&quot;type&quot;:&quot;file&quot;,&quot;_links&quot;:{&quot;self&quot;:&quot;https://api.github.com/repos/octocat/Hello-World/contents/notes/hello.txt&quot;,&quot;git&quot;:&quot;https://api.github.com/repos/octocat/Hello-World/git/blobs/a56507ed892d05a37c6d6128c260937ea4d287bd&quot;,&quot;html&quot;:&quot;https://github.com/octocat/Hello-World/blob/master/notes/hello.txt&quot;}},&quot;commit&quot;:{&quot;sha&quot;:&quot;18a43cd8e1e3a79c786e3d808a73d23b6d212b16&quot;,&quot;node_id&quot;:&quot;MDY6Q29tbWl0MThhNDNjZDhlMWUzYTc5Yzc4NmUzZDgwOGE3M2QyM2I2ZDIxMmIxNg==&quot;,&quot;url&quot;:&quot;https://api.github.com/repos/octocat/Hello-World/git/commits/18a43cd8e1e3a79c786e3d808a73d23b6d212b16&quot;,&quot;html_url&quot;:&quot;https://github.com/octocat/Hello-World/git/commit/18a43cd8e1e3a79c786e3d808a73d23b6d212b16&quot;,&quot;author&quot;:{&quot;date&quot;:&quot;2014-11-07T22:01:45Z&quot;,&quot;name&quot;:&quot;Monalisa Octocat&quot;,&quot;email&quot;:&quot;octocat@github.com&quot;},&quot;committer&quot;:{&quot;date&quot;:&quot;2014-11-07T22:01:45Z&quot;,&quot;name&quot;:&quot;Monalisa Octocat&quot;,&quot;email&quot;:&quot;octocat@github.com&quot;},&quot;message&quot;:&quot;my commit message&quot;,&quot;tree&quot;:{&quot;url&quot;:&quot;https://api.github.com/repos/octocat/Hello-World/git/trees/9a21f8e2018f42ffcf369b24d2cd20bc25c9e66f&quot;,&quot;sha&quot;:&quot;9a21f8e2018f42ffcf369b24d2cd20bc25c9e66f&quot;},&quot;parents&quot;:[{&quot;url&quot;:&quot;https://api.github.com/repos/octocat/Hello-World/git/commits/da5a433788da5c255edad7979b328b67d79f53f6&quot;,&quot;html_url&quot;:&quot;https://github.com/octocat/Hello-World/git/commit/da5a433788da5c255edad7979b328b67d79f53f6&quot;,&quot;sha&quot;:&quot;da5a433788da5c255edad7979b328b67d79f53f6&quot;}],&quot;verification&quot;:{&quot;verified&quot;:false,&quot;reason&quot;:&quot;unsigned&quot;,&quot;signature&quot;:null,&quot;payload&quot;:null}}}