Skip to content

Instantly share code, notes, and snippets.

@BLamy
Created October 6, 2023 21:31
Show Gist options
  • Save BLamy/362d2f005c2600d3e50ff040b1b030d4 to your computer and use it in GitHub Desktop.
Save BLamy/362d2f005c2600d3e50ff040b1b030d4 to your computer and use it in GitHub Desktop.
gmail-openapi.json
{
"openapi": "3.0.0",
"info": {
"version": "1.0.0",
"title": "Gmail API"
},
"paths": {
"/gmail/v1/users/{userId}/threads": {
"get": {
"summary": "Lists the threads in the user's mailbox.",
"operationId": "users.threads.list",
"parameters": [
{
"name": "userId",
"in": "path",
"description": "The user's email address or 'me' for the authenticated user.",
"required": true,
"schema": {
"type": "string"
}
},
{
"name": "maxResults",
"in": "query",
"description": "Maximum number of threads to return, default is 100, maximum is 500.",
"schema": {
"type": "integer",
"format": "uint32"
}
},
{
"name": "pageToken",
"in": "query",
"description": "Page token to retrieve a specific page of results in the list.",
"schema": {
"type": "string"
}
},
{
"name": "q",
"in": "query",
"description": "Only return threads matching this query. Same format as Gmail search box. Not available with gmail.metadata scope.",
"schema": {
"type": "string"
}
},
{
"name": "labelIds[]",
"in": "query",
"description": "Only return threads with all matching label IDs.",
"schema": {
"type": "array",
"items": {
"type": "string"
}
}
},
{
"name": "includeSpamTrash",
"in": "query",
"description": "Boolean value indicating whether to include threads from SPAM and TRASH in the results.",
"schema": {
"type": "boolean"
}
}
],
"responses": {
"200": {
"description": "Successful response. The response body contains the list of threads, the nextPageToken, and resultSizeEstimate.",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"threads": {
"type": "array",
"items": {
"type": "object",
"description": "Thread objects, refer to https://developers.google.com/gmail/api/reference/rest/v1/users.threads#Thread for more details."
}
},
"nextPageToken": {
"type": "string",
"description": "Page token to retrieve the next page of results in the list."
},
"resultSizeEstimate": {
"type": "integer",
"format": "uint32",
"description": "Estimated total number of results."
}
}
}
}
}
}
},
"security": [
{
"GmailAuth": [
"https://mail.google.com/",
"https://www.googleapis.com/auth/gmail.modify",
"https://www.googleapis.com/auth/gmail.readonly",
"https://www.googleapis.com/auth/gmail.metadata"
]
}
]
}
}
},
"components": {
"securitySchemes": {
"GmailAuth": {
"type": "oauth2",
"flows": {
"authorizationCode": {
"authorizationUrl": "https://accounts.google.com/o/oauth2/auth",
"tokenUrl": "https://accounts.google.com/o/oauth2/token",
"scopes": {
"https://www.googleapis.com/auth/gmail.modify": "Allows modification of Gmail threads.",
"https://www.googleapis.com/auth/gmail.readonly": "Allows read only access to Gmail threads.",
"https://www.googleapis.com/auth/gmail.metadata": "Allows access to Gmail metadata.",
"https://mail.google.com/": "Full mail access"
}
}
}
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment