Create a blob
POST
/repos/{owner}/{repo}/git/blobs
Parameters
Section titled “Parameters”Path Parameters
Section titled “Path Parameters”owner
required
string
The account owner of the repository. The name is not case sensitive.
repo
required
string
The name of the repository without the .git extension. The name is not case sensitive.
Request Bodyrequired
Section titled “Request Bodyrequired”Media typeapplication/json
object
content
required
The new blob’s content.
string
encoding
The encoding used for content. Currently, "utf-8" and "base64" are supported.
string
Examples
Exampledefault
{ "content": "Content of the blob", "encoding": "utf-8"}Responses
Section titled “Responses”Response
Media typeapplication/json
Short Blob
Short Blob
object
url
required
string
sha
required
string
Examples
Exampledefault
{ "url": "https://api.github.com/repos/octocat/example/git/blobs/3a0f86fb8db8eea7ccbb9a95f325ddbedfb25e15", "sha": "3a0f86fb8db8eea7ccbb9a95f325ddbedfb25e15"}Headers
Section titled “Headers”Location
string
Example
https://api.github.com/repos/octocat/example/git/blobs/3a0f86fb8db8eea7ccbb9a95f325ddbedfb25e15Forbidden
Media typeapplication/json
Basic Error
Basic Error
object
message
string
documentation_url
string
url
string
status
string
Examplegenerated
{ "message": "example", "documentation_url": "example", "url": "example", "status": "example"}Resource not found
Media typeapplication/json
Basic Error
Basic Error
object
message
string
documentation_url
string
url
string
status
string
Examplegenerated
{ "message": "example", "documentation_url": "example", "url": "example", "status": "example"}Conflict
Media typeapplication/json
Basic Error
Basic Error
object
message
string
documentation_url
string
url
string
status
string
Examplegenerated
{ "message": "example", "documentation_url": "example", "url": "example", "status": "example"}Validation failed
Media typeapplication/json
One of:
Validation Error
Validation Error
object
message
required
string
documentation_url
required
string
errors
Array<object>
object
resource
string
field
string
message
string
code
required
string
index
integer
value
One of:
string
integer
Array<string>
Repository rule violation was detected
object
message
string
documentation_url
string
status
string
metadata
object
secret_scanning
object
bypass_placeholders
Array<object>
object
placeholder_id
The ID of the push protection bypass placeholder. This value is returned on any push protected routes.
string
token_type
string
Examplegenerated
{ "message": "example", "documentation_url": "example", "errors": [ { "resource": "example", "field": "example", "message": "example", "code": "example", "index": 1, "value": [ "example" ] } ]}