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: Created

{&quot;content&quot;:{&quot;name&quot;:&quot;hello.txt&quot;,&quot;path&quot;:&quot;notes/hello.txt&quot;,&quot;sha&quot;:&quot;95b966ae1c166bd92f8ae7d1c313e738c731dfc3&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/95b966ae1c166bd92f8ae7d1c313e738c731dfc3&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/95b966ae1c166bd92f8ae7d1c313e738c731dfc3&quot;,&quot;html&quot;:&quot;https://github.com/octocat/Hello-World/blob/master/notes/hello.txt&quot;}},&quot;commit&quot;:{&quot;sha&quot;:&quot;7638417db6d59f3c431d3e1f261cc637155684cd&quot;,&quot;node_id&quot;:&quot;MDY6Q29tbWl0NzYzODQxN2RiNmQ1OWYzYzQzMWQzZTFmMjYxY2M2MzcxNTU2ODRjZA==&quot;,&quot;url&quot;:&quot;https://api.github.com/repos/octocat/Hello-World/git/commits/7638417db6d59f3c431d3e1f261cc637155684cd&quot;,&quot;html_url&quot;:&quot;https://github.com/octocat/Hello-World/git/commit/7638417db6d59f3c431d3e1f261cc637155684cd&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/691272480426f78a0138979dd3ce63b77f706feb&quot;,&quot;sha&quot;:&quot;691272480426f78a0138979dd3ce63b77f706feb&quot;},&quot;parents&quot;:[{&quot;url&quot;:&quot;https://api.github.com/repos/octocat/Hello-World/git/commits/1acc419d4d6a9ce985db7be48c6349a0475975b5&quot;,&quot;html_url&quot;:&quot;https://github.com/octocat/Hello-World/git/commit/1acc419d4d6a9ce985db7be48c6349a0475975b5&quot;,&quot;sha&quot;:&quot;1acc419d4d6a9ce985db7be48c6349a0475975b5&quot;}],&quot;verification&quot;:{&quot;verified&quot;:false,&quot;reason&quot;:&quot;unsigned&quot;,&quot;signature&quot;:null,&quot;payload&quot;:null}}}