{"id":16116,"date":"2021-03-23T08:28:07","date_gmt":"2021-03-23T08:28:07","guid":{"rendered":"https:\/\/www.gmass.co\/blog\/?p=16116"},"modified":"2023-02-06T23:12:31","modified_gmt":"2023-02-06T23:12:31","slug":"gmass-api","status":"publish","type":"post","link":"https:\/\/www.gmass.co\/blog\/gmass-api\/","title":{"rendered":"How to use the GMass API"},"content":{"rendered":"<p>We&#8217;ve launched a beta version of the <a href=\"https:\/\/api.gmass.co\">GMass API<\/a> that can handle basic GMass functionality around creating lists and sending campaigns. Over time, we&#8217;ll be adding more functionality, like accessing reporting data.<\/p>\n<div class=\"alert alert-info\">Our API is the only API we know of that allows you to completely create and send a cold email campaign all from within the API, without ever having to do anything in the user interface.<\/div>\n<h2>Getting Started<\/h2>\n<p>All endpoints begin with <strong>https:\/\/api.gmass.co\/api\/<\/strong>. The API is mostly RESTful and conforms to OpenAPI standards. To get started with the API:<\/p>\n<ol>\n<li>Create an API Key in your <a href=\"http:\/\/gmass.co\/dashboard\">Dashboard<\/a>. Go to the &#8220;API Keys&#8221; section.<\/li>\n<li>Visit the <a href=\"https:\/\/api.gmass.co\">API homepage<\/a>, which serves as a <strong>reference for all API methods<\/strong>.<\/li>\n<li>You can perform a test API call to retrieve all the Google Sheet titles in your account with this URL: <strong>https:\/\/api.gmass.co\/api\/sheets?apikey=your-api-key<\/strong><\/li>\n<li>You can access <strong>test forms<\/strong> for all methods using our <a href=\"https:\/\/api.gmass.co\/apihelp\/index#\/\">Swagger-generated site here<\/a>. Note that the Swagger site does include descriptions of methods, but the more comprehensive documentation is at <a href=\"https:\/\/api.gmass.co\/docs\">https:\/\/api.gmass.co\/docs<\/a>.<\/li>\n<\/ol>\n<h2>Authentication<\/h2>\n<p>You can authenticate into the API using your API key and passing it either:<\/p>\n<ol>\n<li>Via the query string as &#8220;apikey&#8221;<\/li>\n<li>Via an HTTP header using X-apikey<\/li>\n<\/ol>\n<p>Note that it must be passed as &#8220;apikey&#8221; and not any other variation of that. api-key and api_key will not work.<\/p>\n<h2>How to send a campaign<\/h2>\n<p>The basic steps of sending a campaign through the API are similar to the steps you would take in the Gmail interface with the Chrome extension.<\/p>\n<ol>\n<li>Determine the Google Sheet and the corresponding Worksheet that your email list is in using the <strong>\/api\/sheets<\/strong> and <strong>api\/sheets\/{sheetid}\/worksheets<\/strong> endpoints.<\/li>\n<li>Create a GMass list address (for example: 10-recipients-akejflaek3@gmass.co) using the <strong>\/api\/lists<\/strong> endpoint, in which you&#8217;ll use the <strong>spreadsheetId<\/strong> and <strong>worksheetId<\/strong> from step 1.<\/li>\n<li>Create a campaign DRAFT using the <strong>\/api\/campaigndrafts<\/strong> endpoint. You can add CC and BCC addresses here, as well as file attachments. This will return a Gmail DRAFT Id, which you can then use to send a campaign.<\/li>\n<li>Send the campaign with the <strong>\/api\/campaigns<\/strong> endpoint and pass in the Gmail DRAFT Id from step 3, plus other campaign settings.<\/li>\n<\/ol>\n<p>You can store the GMass alias addresses and reuse them in campaigns, and thereby skip steps 1 and 2 most of the time.<\/p>\n<p>We&#8217;ll be adding endpoints, functionality, and better documentation with time.<\/p>\n<h2>What else can you do?<\/h2>\n<p>Retrieve a list of all your campaigns using the <a href=\"https:\/\/api.gmass.co\/docs#operation\/Campaigns_Index\">campaigns<\/a> method.<\/p>\n<p>Retrieve the lists of <a href=\"https:\/\/api.gmass.co\/docs#operation\/Reports_Recipients\">recipients<\/a>, <a href=\"https:\/\/api.gmass.co\/docs#operation\/Reports_Opens\">opens<\/a>, <a href=\"https:\/\/api.gmass.co\/docs#operation\/Reports_Clicks\">clicks<\/a>, <a href=\"https:\/\/api.gmass.co\/docs#operation\/Reports_Replies\">replies<\/a>, <a href=\"https:\/\/api.gmass.co\/docs#operation\/Reports_Unsubscribes\">unsubscribes<\/a>, and <a href=\"https:\/\/api.gmass.co\/docs#operation\/Reports_Bounces\">bounces<\/a> for a particular campaign.<\/p>\n<p>Send a <a href=\"https:\/\/api.gmass.co\/docs#operation\/Transactional_Index\">transactional email<\/a> through your Google account. You can view a log of your transactional emails inside your <a href=\"http:\/\/gmass.co\/dashboard\">dashboard<\/a>.<\/p>\n<h2>Error handling<\/h2>\n<p>All calls to the API will return an <strong>HTTP 200 OK<\/strong> status code <strong>if the method call is successful<\/strong>.<\/p>\n<p>If you don&#8217;t get an HTTP 200 OK status code, your code can assume there has been an error. Error codes include:<\/p>\n<ul>\n<li><strong>HTTP 401 Unauthorized:<\/strong> Passing in an invalid API key<\/li>\n<li><strong>HTTP 400 Bad Request:<\/strong> Passing in an invalid spreadsheet ID or invalid campaign ID<\/li>\n<li><strong>HTTP 404 Not Found:<\/strong> Calling a method that doesn&#8217;t exist. For example, <a href=\"https:\/\/api.gmass.co\/api\/invalidmethodname\">https:\/\/api.gmass.co\/api\/invalidmethodname<\/a>\u00a0will return a 404<\/li>\n<li><strong>HTTP 500 Internal Server Error:<\/strong> Calling a method where the result is an error that is unexpected<\/li>\n<\/ul>\n<p>Al API errors are logged and reported to our sysadmins. If we see a lot of errors from your account, you&#8217;ll likely be hearing from our support team.<\/p>\n<h2>Webhooks<\/h2>\n<p>The API described above allows you to poll GMass for information related to your campaigns and account. You might also be interested in our <a href=\"https:\/\/www.gmass.co\/blog\/webhooks-guide\/\">webhooks API<\/a> which can &#8220;push&#8221; notifications to your server upon events like sends, opens, clicks, replies, unsubscribes, and bounces.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>We&#8217;ve launched a beta version of the GMass API that can handle basic GMass functionality around creating lists and sending campaigns. Over time, we&#8217;ll be adding more functionality,\u2026<\/p>\n","protected":false},"author":2,"featured_media":22172,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[9152],"tags":[],"class_list":["post-16116","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-api"],"acf":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v28.3 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\r\n<title>How to use the GMass API<\/title>\r\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\r\n<link rel=\"canonical\" href=\"https:\/\/www.gmass.co\/blog\/gmass-api\/\" \/>\r\n<meta property=\"og:locale\" content=\"en_US\" \/>\r\n<meta property=\"og:type\" content=\"article\" \/>\r\n<meta property=\"og:title\" content=\"How to use the GMass API\" \/>\r\n<meta property=\"og:description\" content=\"We&#8217;ve launched a beta version of the GMass API that can handle basic GMass functionality around creating lists and sending campaigns. Over time, we&#8217;ll be adding more functionality,\u2026\" \/>\r\n<meta property=\"og:url\" content=\"https:\/\/www.gmass.co\/blog\/gmass-api\/\" \/>\r\n<meta property=\"og:site_name\" content=\"GMass Blog\" \/>\r\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/GmailMailMerge\/\" \/>\r\n<meta property=\"article:published_time\" content=\"2021-03-23T08:28:07+00:00\" \/>\r\n<meta property=\"article:modified_time\" content=\"2023-02-06T23:12:31+00:00\" \/>\r\n<meta property=\"og:image\" content=\"https:\/\/www.gmass.co\/blog\/wp-content\/uploads\/2021\/03\/How-to-use-the-GMass-API-01-1-tinified.png\" \/>\r\n\t<meta property=\"og:image:width\" content=\"2000\" \/>\r\n\t<meta property=\"og:image:height\" content=\"938\" \/>\r\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\r\n<meta name=\"author\" content=\"Ajay Goel\" \/>\r\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\r\n<meta name=\"twitter:creator\" content=\"@PartTimeSnob\" \/>\r\n<meta name=\"twitter:site\" content=\"@GMassForGmail\" \/>\r\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Ajay Goel\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"3 minutes\" \/>\r\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/www.gmass.co\\\/blog\\\/gmass-api\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.gmass.co\\\/blog\\\/gmass-api\\\/\"},\"author\":{\"name\":\"Ajay Goel\",\"@id\":\"https:\\\/\\\/www.gmass.co\\\/blog\\\/#\\\/schema\\\/person\\\/b5fa74f8765b860701158fd77162fff8\"},\"headline\":\"How to use the GMass API\",\"datePublished\":\"2021-03-23T08:28:07+00:00\",\"dateModified\":\"2023-02-06T23:12:31+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.gmass.co\\\/blog\\\/gmass-api\\\/\"},\"wordCount\":637,\"commentCount\":14,\"image\":{\"@id\":\"https:\\\/\\\/www.gmass.co\\\/blog\\\/gmass-api\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.gmass.co\\\/blog\\\/wp-content\\\/uploads\\\/2021\\\/03\\\/How-to-use-the-GMass-API-01-1-tinified.png\",\"articleSection\":[\"API\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/www.gmass.co\\\/blog\\\/gmass-api\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.gmass.co\\\/blog\\\/gmass-api\\\/\",\"url\":\"https:\\\/\\\/www.gmass.co\\\/blog\\\/gmass-api\\\/\",\"name\":\"How to use the GMass API\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.gmass.co\\\/blog\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/www.gmass.co\\\/blog\\\/gmass-api\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/www.gmass.co\\\/blog\\\/gmass-api\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.gmass.co\\\/blog\\\/wp-content\\\/uploads\\\/2021\\\/03\\\/How-to-use-the-GMass-API-01-1-tinified.png\",\"datePublished\":\"2021-03-23T08:28:07+00:00\",\"dateModified\":\"2023-02-06T23:12:31+00:00\",\"author\":{\"@id\":\"https:\\\/\\\/www.gmass.co\\\/blog\\\/#\\\/schema\\\/person\\\/b5fa74f8765b860701158fd77162fff8\"},\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.gmass.co\\\/blog\\\/gmass-api\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.gmass.co\\\/blog\\\/gmass-api\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.gmass.co\\\/blog\\\/gmass-api\\\/#primaryimage\",\"url\":\"https:\\\/\\\/www.gmass.co\\\/blog\\\/wp-content\\\/uploads\\\/2021\\\/03\\\/How-to-use-the-GMass-API-01-1-tinified.png\",\"contentUrl\":\"https:\\\/\\\/www.gmass.co\\\/blog\\\/wp-content\\\/uploads\\\/2021\\\/03\\\/How-to-use-the-GMass-API-01-1-tinified.png\",\"width\":2000,\"height\":938},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.gmass.co\\\/blog\\\/gmass-api\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.gmass.co\\\/blog\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"How to use the GMass API\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.gmass.co\\\/blog\\\/#website\",\"url\":\"https:\\\/\\\/www.gmass.co\\\/blog\\\/\",\"name\":\"GMass Blog\",\"description\":\"Tips and tricks for sending mail merge and mass email campaigns directly from Gmail\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.gmass.co\\\/blog\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/www.gmass.co\\\/blog\\\/#\\\/schema\\\/person\\\/b5fa74f8765b860701158fd77162fff8\",\"name\":\"Ajay Goel\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/f3a70af05bbabe47925150d5a1320540e801b78055a74da20658fc97cd0706a2?s=96&d=mm&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/f3a70af05bbabe47925150d5a1320540e801b78055a74da20658fc97cd0706a2?s=96&d=mm&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/f3a70af05bbabe47925150d5a1320540e801b78055a74da20658fc97cd0706a2?s=96&d=mm&r=g\",\"caption\":\"Ajay Goel\"},\"description\":\"Ajay is the founder of GMass and has been developing email sending software for 20 years.\",\"sameAs\":[\"https:\\\/\\\/twitter.com\\\/PartTimeSnob\",\"https:\\\/\\\/x.com\\\/PartTimeSnob\"],\"url\":\"https:\\\/\\\/www.gmass.co\\\/blog\\\/author\\\/ajay-goel\\\/\"}]}<\/script>\r\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"How to use the GMass API","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.gmass.co\/blog\/gmass-api\/","og_locale":"en_US","og_type":"article","og_title":"How to use the GMass API","og_description":"We&#8217;ve launched a beta version of the GMass API that can handle basic GMass functionality around creating lists and sending campaigns. Over time, we&#8217;ll be adding more functionality,\u2026","og_url":"https:\/\/www.gmass.co\/blog\/gmass-api\/","og_site_name":"GMass Blog","article_publisher":"https:\/\/www.facebook.com\/GmailMailMerge\/","article_published_time":"2021-03-23T08:28:07+00:00","article_modified_time":"2023-02-06T23:12:31+00:00","og_image":[{"width":2000,"height":938,"url":"https:\/\/www.gmass.co\/blog\/wp-content\/uploads\/2021\/03\/How-to-use-the-GMass-API-01-1-tinified.png","type":"image\/png"}],"author":"Ajay Goel","twitter_card":"summary_large_image","twitter_creator":"@PartTimeSnob","twitter_site":"@GMassForGmail","twitter_misc":{"Written by":"Ajay Goel","Est. reading time":"3 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.gmass.co\/blog\/gmass-api\/#article","isPartOf":{"@id":"https:\/\/www.gmass.co\/blog\/gmass-api\/"},"author":{"name":"Ajay Goel","@id":"https:\/\/www.gmass.co\/blog\/#\/schema\/person\/b5fa74f8765b860701158fd77162fff8"},"headline":"How to use the GMass API","datePublished":"2021-03-23T08:28:07+00:00","dateModified":"2023-02-06T23:12:31+00:00","mainEntityOfPage":{"@id":"https:\/\/www.gmass.co\/blog\/gmass-api\/"},"wordCount":637,"commentCount":14,"image":{"@id":"https:\/\/www.gmass.co\/blog\/gmass-api\/#primaryimage"},"thumbnailUrl":"https:\/\/www.gmass.co\/blog\/wp-content\/uploads\/2021\/03\/How-to-use-the-GMass-API-01-1-tinified.png","articleSection":["API"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.gmass.co\/blog\/gmass-api\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.gmass.co\/blog\/gmass-api\/","url":"https:\/\/www.gmass.co\/blog\/gmass-api\/","name":"How to use the GMass API","isPartOf":{"@id":"https:\/\/www.gmass.co\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.gmass.co\/blog\/gmass-api\/#primaryimage"},"image":{"@id":"https:\/\/www.gmass.co\/blog\/gmass-api\/#primaryimage"},"thumbnailUrl":"https:\/\/www.gmass.co\/blog\/wp-content\/uploads\/2021\/03\/How-to-use-the-GMass-API-01-1-tinified.png","datePublished":"2021-03-23T08:28:07+00:00","dateModified":"2023-02-06T23:12:31+00:00","author":{"@id":"https:\/\/www.gmass.co\/blog\/#\/schema\/person\/b5fa74f8765b860701158fd77162fff8"},"breadcrumb":{"@id":"https:\/\/www.gmass.co\/blog\/gmass-api\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.gmass.co\/blog\/gmass-api\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.gmass.co\/blog\/gmass-api\/#primaryimage","url":"https:\/\/www.gmass.co\/blog\/wp-content\/uploads\/2021\/03\/How-to-use-the-GMass-API-01-1-tinified.png","contentUrl":"https:\/\/www.gmass.co\/blog\/wp-content\/uploads\/2021\/03\/How-to-use-the-GMass-API-01-1-tinified.png","width":2000,"height":938},{"@type":"BreadcrumbList","@id":"https:\/\/www.gmass.co\/blog\/gmass-api\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.gmass.co\/blog\/"},{"@type":"ListItem","position":2,"name":"How to use the GMass API"}]},{"@type":"WebSite","@id":"https:\/\/www.gmass.co\/blog\/#website","url":"https:\/\/www.gmass.co\/blog\/","name":"GMass Blog","description":"Tips and tricks for sending mail merge and mass email campaigns directly from Gmail","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.gmass.co\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/www.gmass.co\/blog\/#\/schema\/person\/b5fa74f8765b860701158fd77162fff8","name":"Ajay Goel","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/f3a70af05bbabe47925150d5a1320540e801b78055a74da20658fc97cd0706a2?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/f3a70af05bbabe47925150d5a1320540e801b78055a74da20658fc97cd0706a2?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/f3a70af05bbabe47925150d5a1320540e801b78055a74da20658fc97cd0706a2?s=96&d=mm&r=g","caption":"Ajay Goel"},"description":"Ajay is the founder of GMass and has been developing email sending software for 20 years.","sameAs":["https:\/\/twitter.com\/PartTimeSnob","https:\/\/x.com\/PartTimeSnob"],"url":"https:\/\/www.gmass.co\/blog\/author\/ajay-goel\/"}]}},"_links":{"self":[{"href":"https:\/\/www.gmass.co\/blog\/wp-json\/wp\/v2\/posts\/16116","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.gmass.co\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.gmass.co\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.gmass.co\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.gmass.co\/blog\/wp-json\/wp\/v2\/comments?post=16116"}],"version-history":[{"count":13,"href":"https:\/\/www.gmass.co\/blog\/wp-json\/wp\/v2\/posts\/16116\/revisions"}],"predecessor-version":[{"id":22635,"href":"https:\/\/www.gmass.co\/blog\/wp-json\/wp\/v2\/posts\/16116\/revisions\/22635"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.gmass.co\/blog\/wp-json\/wp\/v2\/media\/22172"}],"wp:attachment":[{"href":"https:\/\/www.gmass.co\/blog\/wp-json\/wp\/v2\/media?parent=16116"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.gmass.co\/blog\/wp-json\/wp\/v2\/categories?post=16116"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.gmass.co\/blog\/wp-json\/wp\/v2\/tags?post=16116"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}