HTTP/2 301
server: GitHub.com
content-type: text/html
location: https://docs.github.com/v3/git/blobs/
x-github-request-id: CF29:1BDAE7:84915:A547C:687BA653
accept-ranges: bytes
date: Sat, 19 Jul 2025 14:06:11 GMT
via: 1.1 varnish
age: 0
x-served-by: cache-bom4733-BOM
x-cache: MISS
x-cache-hits: 0
x-timer: S1752933972.798113,VS0,VE190
vary: Accept-Encoding
x-fastly-request-id: 1e20863a7e66a4f9c65ee3d869deeac40efacfb7
content-length: 162
HTTP/2 301
access-control-allow-origin: *
content-security-policy: default-src 'none';prefetch-src 'self';connect-src 'self';font-src 'self' data:;img-src 'self' github.com *.github.com *.githubusercontent.com *.githubassets.com data: placehold.it;object-src 'self';script-src 'self' github.com *.github.com *.githubusercontent.com *.githubassets.com 'self' data:;script-src-attr 'self';frame-src 'self' github.com *.github.com *.githubusercontent.com *.githubassets.com https://support.github.com https://www.youtube-nocookie.com;frame-ancestors 'self' github.com *.github.com *.githubusercontent.com *.githubassets.com;style-src 'self' github.com *.github.com *.githubusercontent.com *.githubassets.com 'self' 'unsafe-inline' data:;child-src 'self';manifest-src 'self';upgrade-insecure-requests;base-uri 'self';form-action 'self'
cross-origin-opener-policy: same-origin
cross-origin-resource-policy: same-origin
origin-agent-cluster: ?1
referrer-policy: no-referrer-when-downgrade
x-content-type-options: nosniff
x-dns-prefetch-control: off
x-download-options: noopen
x-frame-options: SAMEORIGIN
x-permitted-cross-domain-policies: none
x-xss-protection: 0
cache-control: public, max-age=60
location: /v3/git/blobs
content-type: text/plain; charset=utf-8
x-github-backend: Kubernetes
x-github-request-id: F4E6:2E44EA:C7D5F8:13C2D0D:687BA647
accept-ranges: bytes
age: 0
date: Sat, 19 Jul 2025 14:06:12 GMT
via: 1.1 varnish
x-served-by: cache-bom4747-BOM
x-cache: MISS
x-cache-hits: 0
x-timer: S1752933972.049924,VS0,VE252
vary: Accept
strict-transport-security: max-age=31557600
content-length: 47
HTTP/2 302
access-control-allow-origin: *
content-security-policy: default-src 'none';prefetch-src 'self';connect-src 'self';font-src 'self' data:;img-src 'self' github.com *.github.com *.githubusercontent.com *.githubassets.com data: placehold.it;object-src 'self';script-src 'self' github.com *.github.com *.githubusercontent.com *.githubassets.com 'self' data:;script-src-attr 'self';frame-src 'self' github.com *.github.com *.githubusercontent.com *.githubassets.com https://support.github.com https://www.youtube-nocookie.com;frame-ancestors 'self' github.com *.github.com *.githubusercontent.com *.githubassets.com;style-src 'self' github.com *.github.com *.githubusercontent.com *.githubassets.com 'self' 'unsafe-inline' data:;child-src 'self';manifest-src 'self';upgrade-insecure-requests;base-uri 'self';form-action 'self'
cross-origin-opener-policy: same-origin
cross-origin-resource-policy: same-origin
origin-agent-cluster: ?1
referrer-policy: no-referrer-when-downgrade
x-content-type-options: nosniff
x-dns-prefetch-control: off
x-download-options: noopen
x-frame-options: SAMEORIGIN
x-permitted-cross-domain-policies: none
x-xss-protection: 0
cache-control: public, max-age=60
location: /en/rest/git/blobs
content-type: text/plain; charset=utf-8
x-github-backend: Kubernetes
x-github-request-id: 22CB:32CD29:D97DDB:14DD702:687BA654
accept-ranges: bytes
age: 0
date: Sat, 19 Jul 2025 14:06:13 GMT
via: 1.1 varnish
x-served-by: cache-bom4747-BOM
x-cache: MISS
x-cache-hits: 0
x-timer: S1752933972.316071,VS0,VE1347
vary: accept-language, x-user-language, Accept
strict-transport-security: max-age=31557600
content-length: 40
HTTP/2 200
access-control-allow-origin: *
content-security-policy: default-src 'none';prefetch-src 'self';connect-src 'self';font-src 'self' data:;img-src 'self' github.com *.github.com *.githubusercontent.com *.githubassets.com data: placehold.it;object-src 'self';script-src 'self' github.com *.github.com *.githubusercontent.com *.githubassets.com 'self' data:;script-src-attr 'self';frame-src 'self' github.com *.github.com *.githubusercontent.com *.githubassets.com https://support.github.com https://www.youtube-nocookie.com;frame-ancestors 'self' github.com *.github.com *.githubusercontent.com *.githubassets.com;style-src 'self' github.com *.github.com *.githubusercontent.com *.githubassets.com 'self' 'unsafe-inline' data:;child-src 'self';manifest-src 'self';upgrade-insecure-requests;base-uri 'self';form-action 'self'
cross-origin-opener-policy: same-origin
cross-origin-resource-policy: same-origin
origin-agent-cluster: ?1
referrer-policy: no-referrer-when-downgrade
x-content-type-options: nosniff
x-dns-prefetch-control: off
x-download-options: noopen
x-frame-options: SAMEORIGIN
x-permitted-cross-domain-policies: none
x-xss-protection: 0
cache-control: public, max-age=60
x-powered-by: Next.js
content-type: text/html; charset=utf-8
x-github-backend: Kubernetes
x-github-request-id: 6BD9:1CE061:D04C4B:144A56B:687BA643
content-encoding: gzip
accept-ranges: bytes
age: 1
date: Sat, 19 Jul 2025 14:06:15 GMT
via: 1.1 varnish
x-served-by: cache-bom4747-BOM
x-cache: MISS
x-cache-hits: 0
x-timer: S1752933974.677345,VS0,VE1790
vary: Accept-Encoding
strict-transport-security: max-age=31557600
content-length: 33114
REST API endpoints for Git blobs - GitHub Docs Skip to main content API Version: 2022-11-28 (latest) REST API endpoints for Git blobs Use the REST API to interact with a Git blob (binary large object), the object type used to store the contents of each file in a repository.
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. Blobs leverage these custom media types . For more information about the use of media types in the API, see Getting started with the REST API .
This endpoint works with the following fine-grained token types:
The fine-grained token must have the following permission set:
"Contents" repository permissions (write) Headers Name, Type, Description accept
string
Setting to application/vnd.github+json
is recommended.
Path parameters Name, Type, Description owner
string Required
The account owner of the repository. The name is not case sensitive.
repo
string Required
The name of the repository without the .git
extension. The name is not case sensitive.
Body parameters Name, Type, Description encoding
string
The encoding used for content
. Currently, "utf-8"
and "base64"
are supported.
Status code Description 201
403
404
409
422
Request example post /repos /{owner} /{repo} /git /blobs
Copy to clipboard curl request example curl -L \
-X POST \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer <YOUR-TOKEN>" \
-H "X-GitHub-Api-Version: 2022-11-28" \
https://api.github.com/repos/OWNER/REPO/git/blobs \
-d '{"content":"Content of the blob","encoding":"utf-8"}'
Response
Status: 201
{
"url": "https://api.github.com/repos/octocat/example/git/blobs/3a0f86fb8db8eea7ccbb9a95f325ddbedfb25e15",
"sha": "3a0f86fb8db8eea7ccbb9a95f325ddbedfb25e15"
}
The content
in the response will always be Base64 encoded.
This endpoint supports the following custom media types. For more information, see "Media types ."
application/vnd.github.raw+json
: Returns the raw blob data.
application/vnd.github+json
: Returns a JSON representation of the blob with content
as a base64 encoded string. This is the default if no media type is specified.
Note This endpoint supports blobs up to 100 megabytes in size.
This endpoint works with the following fine-grained token types:
The fine-grained token must have the following permission set:
"Contents" repository permissions (read) This endpoint can be used without authentication or the aforementioned permissions if only public resources are requested.
Headers Name, Type, Description accept
string
Setting to application/vnd.github+json
is recommended.
Path parameters Name, Type, Description owner
string Required
The account owner of the repository. The name is not case sensitive.
repo
string Required
The name of the repository without the .git
extension. The name is not case sensitive.
Status code Description 200
403
404
409
422
Validation failed, or the endpoint has been spammed.
Request example get /repos /{owner} /{repo} /git /blobs /{file_ sha}
Copy to clipboard curl request example curl -L \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer <YOUR-TOKEN>" \
-H "X-GitHub-Api-Version: 2022-11-28" \
https://api.github.com/repos/OWNER/REPO/git/blobs/FILE_SHA
Response
Status: 200
{
"content": "Q29udGVudCBvZiB0aGUgYmxvYg==",
"encoding": "base64",
"url": "https://api.github.com/repos/octocat/example/git/blobs/3a0f86fb8db8eea7ccbb9a95f325ddbedfb25e15",
"sha": "3a0f86fb8db8eea7ccbb9a95f325ddbedfb25e15",
"size": 19,
"node_id": "Q29udGVudCBvZiB0aGUgYmxvYg=="
}
Help and support Ask Copilot your question. Ask Copilot