Blobs

Since blobs can be any arbitrary binary data, the input and responses for the blob API takes an encoding parameter that can be either utf-8 or base64. If your data cannot be losslessly sent as a UTF-8 string, you can base64 encode it.

Blobs leverage these custom media types. You can read more about the use of media types in the API here.

Get a Blob

GET /repos/:owner/:repo/git/blobs/:sha

Note: This API supports blobs up to 100 megabytes in size.

Response

Status: 200 OK
X-RateLimit-Limit: 5000
X-RateLimit-Remaining: 4999
{
  "content": "Content of the blob",
  "encoding": "utf-8",
  "url": "https://api.github.com/repos/octocat/example/git/blobs/3a0f86fb8db8eea7ccbb9a95f325ddbedfb25e15",
  "sha": "3a0f86fb8db8eea7ccbb9a95f325ddbedfb25e15",
  "size": 100
}

Create a Blob

POST /repos/:owner/:repo/git/blobs

Input

{
  "content": "Content of the blob",
  "encoding": "utf-8"
}

Response

Status: 201 Created
Location: https://api.github.com/repos/octocat/example/git/blobs/3a0f86fb8db8eea7ccbb9a95f325ddbedfb25e15
X-RateLimit-Limit: 5000
X-RateLimit-Remaining: 4999
{
  "url": "https://api.github.com/repos/octocat/example/git/blobs/3a0f86fb8db8eea7ccbb9a95f325ddbedfb25e15",
  "sha": "3a0f86fb8db8eea7ccbb9a95f325ddbedfb25e15"
}

Custom media types

These are the supported media types for blobs. You can read more about the use of media types in the API here.

application/json
application/vnd.github.VERSION.raw