Create a gist
POST
/gists
gists
Request Request Example
Shell
JavaScript
Java
Swift
curl --location --request POST 'https://api.github.com/gists' \
--header 'Content-Type: application/json' \
--data-raw '{
"description": "Example of a gist",
"files": {
"README.md": {
"content": "Hello World"
}
},
"public": false
}'
Response Response Example
201 - Example 1
{
"comments": 0,
"comments_url": "string",
"commits_url": "string",
"created_at": "string",
"description": "string",
"files": {
"property1": {
"content": "string",
"filename": "string",
"language": "string",
"raw_url": "string",
"size": 0,
"truncated": true,
"type": "string"
},
"property2": {
"content": "string",
"filename": "string",
"language": "string",
"raw_url": "string",
"size": 0,
"truncated": true,
"type": "string"
}
},
"fork_of": {
"comments": 0,
"comments_url": "http://example.com",
"commits_url": "http://example.com",
"created_at": "2019-08-24T14:15:22Z",
"description": "string",
"files": {
"property1": {
"filename": "string",
"language": "string",
"raw_url": "string",
"size": 0,
"type": "string"
},
"property2": {
"filename": "string",
"language": "string",
"raw_url": "string",
"size": 0,
"type": "string"
}
},
"forks": [
null
],
"forks_url": "http://example.com",
"git_pull_url": "http://example.com",
"git_push_url": "http://example.com",
"history": [
null
],
"html_url": "http://example.com",
"id": "string",
"node_id": "string",
"owner": {
"avatar_url": "https://github.com/images/error/octocat_happy.gif",
"email": "string",
"events_url": "https://api.github.com/users/octocat/events{/privacy}",
"followers_url": "https://api.github.com/users/octocat/followers",
"following_url": "https://api.github.com/users/octocat/following{/other_user}",
"gists_url": "https://api.github.com/users/octocat/gists{/gist_id}",
"gravatar_id": "41d064eb2195891e12d0413f63227ea7",
"html_url": "https://github.com/octocat",
"id": 1,
"login": "octocat",
"name": "string",
"node_id": "MDQ6VXNlcjE=",
"organizations_url": "https://api.github.com/users/octocat/orgs",
"received_events_url": "https://api.github.com/users/octocat/received_events",
"repos_url": "https://api.github.com/users/octocat/repos",
"site_admin": true,
"starred_at": "\"2020-07-09T00:17:55Z\"",
"starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}",
"subscriptions_url": "https://api.github.com/users/octocat/subscriptions",
"type": "User",
"url": "https://api.github.com/users/octocat"
},
"public": true,
"truncated": true,
"updated_at": "2019-08-24T14:15:22Z",
"url": "http://example.com",
"user": {
"avatar_url": "https://github.com/images/error/octocat_happy.gif",
"email": "string",
"events_url": "https://api.github.com/users/octocat/events{/privacy}",
"followers_url": "https://api.github.com/users/octocat/followers",
"following_url": "https://api.github.com/users/octocat/following{/other_user}",
"gists_url": "https://api.github.com/users/octocat/gists{/gist_id}",
"gravatar_id": "41d064eb2195891e12d0413f63227ea7",
"html_url": "https://github.com/octocat",
"id": 1,
"login": "octocat",
"name": "string",
"node_id": "MDQ6VXNlcjE=",
"organizations_url": "https://api.github.com/users/octocat/orgs",
"received_events_url": "https://api.github.com/users/octocat/received_events",
"repos_url": "https://api.github.com/users/octocat/repos",
"site_admin": true,
"starred_at": "\"2020-07-09T00:17:55Z\"",
"starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}",
"subscriptions_url": "https://api.github.com/users/octocat/subscriptions",
"type": "User",
"url": "https://api.github.com/users/octocat"
}
},
"forks": [
{
"created_at": "2019-08-24T14:15:22Z",
"id": "string",
"updated_at": "2019-08-24T14:15:22Z",
"url": "http://example.com",
"user": {
"avatar_url": "http://example.com",
"bio": "string",
"blog": "string",
"collaborators": 3,
"company": "string",
"created_at": "2019-08-24T14:15:22Z",
"disk_usage": 1,
"email": "user@example.com",
"events_url": "string",
"followers": 0,
"followers_url": "http://example.com",
"following": 0,
"following_url": "string",
"gists_url": "string",
"gravatar_id": "string",
"hireable": true,
"html_url": "http://example.com",
"id": 0,
"location": "string",
"login": "string",
"name": "string",
"node_id": "string",
"organizations_url": "http://example.com",
"owned_private_repos": 2,
"plan": {
"collaborators": 0,
"name": "string",
"private_repos": 0,
"space": 0
},
"private_gists": 1,
"public_gists": 0,
"public_repos": 0,
"received_events_url": "http://example.com",
"repos_url": "http://example.com",
"site_admin": true,
"starred_url": "string",
"subscriptions_url": "http://example.com",
"suspended_at": "2019-08-24T14:15:22Z",
"total_private_repos": 2,
"twitter_username": "string",
"type": "string",
"updated_at": "2019-08-24T14:15:22Z",
"url": "http://example.com"
}
}
],
"forks_url": "string",
"git_pull_url": "string",
"git_push_url": "string",
"history": [
{
"change_status": {
"additions": 0,
"deletions": 0,
"total": 0
},
"committed_at": "2019-08-24T14:15:22Z",
"url": "http://example.com",
"user": {
"avatar_url": "https://github.com/images/error/octocat_happy.gif",
"email": "string",
"events_url": "https://api.github.com/users/octocat/events{/privacy}",
"followers_url": "https://api.github.com/users/octocat/followers",
"following_url": "https://api.github.com/users/octocat/following{/other_user}",
"gists_url": "https://api.github.com/users/octocat/gists{/gist_id}",
"gravatar_id": "41d064eb2195891e12d0413f63227ea7",
"html_url": "https://github.com/octocat",
"id": 1,
"login": "octocat",
"name": "string",
"node_id": "MDQ6VXNlcjE=",
"organizations_url": "https://api.github.com/users/octocat/orgs",
"received_events_url": "https://api.github.com/users/octocat/received_events",
"repos_url": "https://api.github.com/users/octocat/repos",
"site_admin": true,
"starred_at": "\"2020-07-09T00:17:55Z\"",
"starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}",
"subscriptions_url": "https://api.github.com/users/octocat/subscriptions",
"type": "User",
"url": "https://api.github.com/users/octocat"
},
"version": "string"
}
],
"html_url": "string",
"id": "string",
"node_id": "string",
"owner": {
"avatar_url": "https://github.com/images/error/octocat_happy.gif",
"email": "string",
"events_url": "https://api.github.com/users/octocat/events{/privacy}",
"followers_url": "https://api.github.com/users/octocat/followers",
"following_url": "https://api.github.com/users/octocat/following{/other_user}",
"gists_url": "https://api.github.com/users/octocat/gists{/gist_id}",
"gravatar_id": "41d064eb2195891e12d0413f63227ea7",
"html_url": "https://github.com/octocat",
"id": 1,
"login": "octocat",
"name": "string",
"node_id": "MDQ6VXNlcjE=",
"organizations_url": "https://api.github.com/users/octocat/orgs",
"received_events_url": "https://api.github.com/users/octocat/received_events",
"repos_url": "https://api.github.com/users/octocat/repos",
"site_admin": true,
"starred_at": "\"2020-07-09T00:17:55Z\"",
"starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}",
"subscriptions_url": "https://api.github.com/users/octocat/subscriptions",
"type": "User",
"url": "https://api.github.com/users/octocat"
},
"public": true,
"truncated": true,
"updated_at": "string",
"url": "string",
"user": "string"
}
Request
Body Params application/json
Responses
Modified at 2023-08-15 02:59:27