Git Blobs

A Git blob (binary large object) is the object type used to store the contents of each file in a repository. The file's SHA-1 hash is computed and stored in the blob object. These endpoints allow you to read and write blob objects to your Git database on GitHub. See the Git Database API for more details. Blobs leverage these custom media types. You can read more about the use of media types in the API here.

Note: To help with migrating from our REST API v3 to GraphQL API v4, we're introducing a preview period to include the GraphQL node_id in the response for many REST API v3 resources. See the blog post for full details. To access node_id during the preview period, you must provide a custom media type in the Accept header:


Warning: The API may change without advance notice during the preview period. Preview features are not supported for production use. If you experience any issues, contact GitHub support.

Get a blob

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

The content in the response will always be Base64 encoded.

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


Status: 200 OK
  "content": "Q29udGVudCBvZiB0aGUgYmxvYg==\n",
  "encoding": "base64",
  "url": "",
  "sha": "3a0f86fb8db8eea7ccbb9a95f325ddbedfb25e15",
  "size": 19

Create a blob

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


Name Type Description
content string Required. The new blob's content.
encoding string The encoding used for content. Currently, "utf-8" and "base64" are supported. Default: "utf-8".

Example input

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


Status: 201 Created
  "url": "",
  "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.