gophish/templates/docs.html

1488 lines
153 KiB
HTML
Raw Blame History

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

{{ define "base" }}
<!DOCTYPE html><html><head><meta charset="utf-8"><title>Gophish API</title><link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.3.0/css/font-awesome.min.css"><style>@import url('https://fonts.googleapis.com/css?family=Roboto:400,700|Inconsolata|Raleway:200');.hljs-comment,.hljs-title{color:#8e908c}.hljs-variable,.hljs-attribute,.hljs-tag,.hljs-regexp,.ruby .hljs-constant,.xml .hljs-tag .hljs-title,.xml .hljs-pi,.xml .hljs-doctype,.html .hljs-doctype,.css .hljs-id,.css .hljs-class,.css .hljs-pseudo{color:#c82829}.hljs-number,.hljs-preprocessor,.hljs-pragma,.hljs-built_in,.hljs-literal,.hljs-params,.hljs-constant{color:#f5871f}.ruby .hljs-class .hljs-title,.css .hljs-rules .hljs-attribute{color:#eab700}.hljs-string,.hljs-value,.hljs-inheritance,.hljs-header,.ruby .hljs-symbol,.xml .hljs-cdata{color:#718c00}.css .hljs-hexcolor{color:#3e999f}.hljs-function,.python .hljs-decorator,.python .hljs-title,.ruby .hljs-function .hljs-title,.ruby .hljs-title .hljs-keyword,.perl .hljs-sub,.javascript .hljs-title,.coffeescript .hljs-title{color:#4271ae}.hljs-keyword,.javascript .hljs-function{color:#8959a8}.hljs{display:block;background:white;color:#4d4d4c;padding:.5em}.coffeescript .javascript,.javascript .xml,.tex .hljs-formula,.xml .javascript,.xml .vbscript,.xml .css,.xml .hljs-cdata{opacity:.5}body{color:black;background:white;font-family:'Roboto',Helvetica,sans-serif;font-size:14px;line-height:1.42}header{border-bottom:1px solid #f2f2f2;margin-bottom:12px}h1,h2,h3,h4,h5{color:black;margin:12px 0}h1 .permalink,h2 .permalink,h3 .permalink,h4 .permalink,h5 .permalink{margin-left:6px;opacity:0;transition:opacity .25s ease}h1:hover .permalink,h2:hover .permalink,h3:hover .permalink,h4:hover .permalink,h5:hover .permalink{opacity:1}h1{font-family:'Raleway',Helvetica,sans-serif;font-size:36px;font-weight:500}h2{font-family:'Raleway',Helvetica,sans-serif;font-size:30px;font-weight:500}h3{font-size:100%;text-transform:uppercase}h5{font-size:100%;font-weight:normal}p{margin:0 0 10px}p.choices{line-height:1.6}a{color:#428bca;text-decoration:none}li p{margin:0}dl dt{float:left;width:160px;clear:left;text-align:right;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-weight:700}dl dd{margin-left:180px}blockquote{color:rgba(0,0,0,0.5);font-size:15.5px;padding:10px 20px;margin:12px 0;border-left:5px solid #e8e8e8}blockquote p:last-child{margin-bottom:0}pre{background-color:#f5f5f5;padding:12px;border:1px solid #cfcfcf;border-radius:6px;overflow:auto}pre code{background-color:transparent;padding:0;border:none}code{color:#444;background-color:#f5f5f5;font-family:'Inconsolata',monospace;padding:1px 4px;border:1px solid #cfcfcf;border-radius:3px}ul,ol{padding-left:2em}table{border-collapse:collapse;border-spacing:0;margin-bottom:12px}table tr:nth-child(2n){background-color:#fafafa}table th,table td{padding:6px 12px;border:1px solid #d9d9d9}.note,.warning{padding:.3em 1em;margin:1em 0;border-radius:2px;font-size:90%}.note h1,.warning h1,.note h2,.warning h2,.note h3,.warning h3,.note h4,.warning h4,.note h5,.warning h5,.note h6,.warning h6{font-family:'Raleway',Helvetica,sans-serif;font-size:135%;font-weight:500}.note p,.warning p{margin:.5em 0}.note{color:black;background-color:#f0f6fb;border-left:4px solid #428bca}.note h1,.note h2,.note h3,.note h4,.note h5,.note h6{color:#428bca}.warning{color:black;background-color:#fbf1f0;border-left:4px solid #c9302c}.warning h1,.warning h2,.warning h3,.warning h4,.warning h5,.warning h6{color:#c9302c}nav{position:fixed;top:24px;bottom:0;overflow-y:auto}nav .resource-group{padding:0}nav .resource-group .heading{position:relative}nav .resource-group .heading .chevron{position:absolute;top:12px;right:12px;opacity:.5}nav .resource-group .heading a{display:block;color:black;opacity:.7;border-left:2px solid transparent;margin:0}nav .resource-group .heading a:hover{border-left:2px solid black}nav ul{list-style-type:none;padding-left:0}nav ul a{display:block;font-size:13px;color:rgba(0,0,0,0.7);padding:8px 12px;border-top:1px solid #d9d9d9;border-left:2px solid transparent;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}nav ul a:hover{border-left:2px solid black}nav ul>li{margin:0}nav ul>li:first-child{margin-top:-12px}nav ul>li:last-child{margin-bottom:-12px}nav ul ul a{padding-left:24px}nav ul ul li{margin:0}nav ul ul li:first-child{margin-top:0}nav ul ul li:last-child{margin-bottom:0}nav>div>div>ul>li:first-child>a{border-top:none}.preload *{transition:none !important}.pull-left{float:left}.pull-right{float:right}.badge{display:inline-block;float:right;min-width:10px;min-height:14px;padding:3px 7px;font-size:12px;color:#000;background-color:#f2f2f2;border-radius:10px;margin-top:-2px;margin-bottom:-2px}.badge.get{color:#70bbe1;background-color:#d9edf7}.badge.head{color:#70bbe1;background-color:#d9edf7}.badge.options{color:#70bbe1;background-color:#d9edf7}.badge.put{color:#f0db70;background-color:#fcf8e3}.badge.patch{color:#f0db70;background-color:#fcf8e3}.badge.post{color:#93cd7c;background-color:#dff0d8}.badge.delete{color:#ce8383;background-color:#f2dede}.collapse-button{float:right}.collapse-button .close{display:none;color:#428bca;cursor:pointer}.collapse-button .open{color:#428bca;cursor:pointer}.collapse-button.show .close{display:inline}.collapse-button.show .open{display:none}.collapse-content{max-height:0;overflow:hidden;transition:max-height .3s ease-in-out}nav{width:220px}.container{max-width:940px;margin-left:auto;margin-right:auto}.container .row .content{margin-left:244px;width:696px}.container .row:after{content:'';display:block;clear:both}.container-fluid nav{width:22%}.container-fluid .row .content{margin-left:24%;width:76%}@media (max-width:1200px){nav{width:200px}.container{max-width:840px}.container .row .content{margin-left:224px;width:606px}}@media (max-width:992px){nav{width:170px}.container{max-width:720px}.container .row .content{margin-left:194px;width:526px}}@media (max-width:768px){nav{display:none}.container{width:95%;max-width:none}.container .row .content,.container-fluid .row .content{margin-left:auto;margin-right:auto;width:95%}}.back-to-top{position:fixed;z-index:1;bottom:0;right:24px;padding:4px 8px;color:rgba(0,0,0,0.5);background-color:#f2f2f2;text-decoration:none !important;border-top:1px solid #d9d9d9;border-left:1px solid #d9d9d9;border-right:1px solid #d9d9d9;border-top-left-radius:3px;border-top-right-radius:3px}.resource-group{padding:12px;margin-bottom:12px;background-color:white;border:1px solid #d9d9d9;border-radius:6px}.resource-group h2.group-heading,.resource-group .heading a{padding:12px;margin:-12px -12px 12px -12px;background-color:#f2f2f2;border-bottom:1px solid #d9d9d9;border-top-left-radius:6px;border-top-right-radius:6px;white-space:nowrap;text-overflow:ellipsis;overflow:hidden}nav .resource-group .heading a{margin-bottom:0}nav .resource-group .collapse-content{padding:0}.action{margin-bottom:12px;padding:12px 12px 0 12px;overflow:hidden;border:1px solid transparent;border-radius:6px}.action h4.action-heading{padding:12px;margin:-12px -12px 12px -12px;border-bottom:1px solid transparent;border-top-left-radius:6px;border-top-right-radius:6px;white-space:nowrap;text-overflow:ellipsis;overflow:hidden}.action h4.action-heading .name{float:right;font-weight:normal}.action h4.action-heading .method{padding:6px 12px;margin-right:12px;border-radius:3px}.action h4.action-heading .method.get{color:#fff;background-color:#337ab7}.action h4.action-heading .method.head{color:#fff;background-color:#337ab7}.action h4.action-heading .method.options{color:#fff;background-color:#337ab7}.action h4.action-heading .method.put{color:#fff;background-color:#ed9c28}.action h4.action-heading .method.patch{color:#fff;background-color:#ed9c28}.action h4.action-heading .method.post{color:#fff;background-color:#5cb85c}.action h4.action-heading .method.delete{color:#fff;background-color:#d9534f}.action h4.action-heading code{color:#444;background-color:#f5f5f5;border-color:#cfcfcf;font-weight:normal}.action dl.inner{padding-bottom:2px}.action .title{border-bottom:1px solid white;margin:0 -12px -1px -12px;padding:12px}.action.get{border-color:#bce8f1}.action.get h4.action-heading{color:#337ab7;background:#d9edf7;border-bottom-color:#bce8f1}.action.head{border-color:#bce8f1}.action.head h4.action-heading{color:#337ab7;background:#d9edf7;border-bottom-color:#bce8f1}.action.options{border-color:#bce8f1}.action.options h4.action-heading{color:#337ab7;background:#d9edf7;border-bottom-color:#bce8f1}.action.post{border-color:#d6e9c6}.action.post h4.action-heading{color:#5cb85c;background:#dff0d8;border-bottom-color:#d6e9c6}.action.put{border-color:#faebcc}.action.put h4.action-heading{color:#ed9c28;background:#fcf8e3;border-bottom-color:#faebcc}.action.patch{border-color:#faebcc}.action.patch h4.action-heading{color:#ed9c28;background:#fcf8e3;border-bottom-color:#faebcc}.action.delete{border-color:#ebccd1}.action.delete h4.action-heading{color:#d9534f;background:#f2dede;border-bottom-color:#ebccd1}</style></head><body class="preload"><a href="#top" class="text-muted back-to-top"><i class="fa fa-toggle-up"></i>&nbsp;Back to top</a><div class="container"><div class="row"><nav><div class="resource-group"><div class="heading"><div class="chevron"><i class="open fa fa-angle-down"></i></div><a href="#top">Overview</a></div><div class="collapse-content"><ul><li><a href="#header-authorization">Authorization</a></li></ul></div></div><div class="resource-group"><div class="heading"><div class="chevron"><i class="open fa fa-angle-down"></i></div><a href="#campaigns">Campaigns</a></div><div class="collapse-content"><ul><li><a href="#campaigns-campaigns">Campaigns</a><ul><li><a href="#campaigns-campaigns-get"><span class="badge get"><i class="fa fa-arrow-down"></i></span>Get Campaigns</a></li><li><a href="#campaigns-campaigns-post"><span class="badge post"><i class="fa fa-plus"></i></span>Create New Campaign</a></li></ul></li><li><a href="#campaigns-campaign">Campaign</a><ul><li><a href="#campaigns-campaign-get"><span class="badge get"><i class="fa fa-arrow-down"></i></span>Get Campaign</a></li><li><a href="#campaigns-campaign-delete"><span class="badge delete"><i class="fa fa-times"></i></span>Delete a Campaign</a></li></ul></li></ul></div></div><div class="resource-group"><div class="heading"><div class="chevron"><i class="open fa fa-angle-down"></i></div><a href="#templates">Templates</a></div><div class="collapse-content"><ul><li><a href="#templates-templates">Templates</a><ul><li><a href="#templates-templates-get"><span class="badge get"><i class="fa fa-arrow-down"></i></span>Get Templates</a></li><li><a href="#templates-templates-post"><span class="badge post"><i class="fa fa-plus"></i></span>Create New Template</a></li></ul></li><li><a href="#templates-template">Template</a><ul><li><a href="#templates-template-get"><span class="badge get"><i class="fa fa-arrow-down"></i></span>Get Template</a></li><li><a href="#templates-template-delete"><span class="badge delete"><i class="fa fa-times"></i></span>Delete a Template</a></li></ul></li></ul></div></div><div class="resource-group"><div class="heading"><div class="chevron"><i class="open fa fa-angle-down"></i></div><a href="#groups">Groups</a></div><div class="collapse-content"><ul><li><a href="#header-have-a-lot-of-users-to-import?">Have A Lot of Users to Import?</a></li><li><a href="#groups-groups">Groups</a><ul><li><a href="#groups-groups-get"><span class="badge get"><i class="fa fa-arrow-down"></i></span>Get Groups</a></li><li><a href="#groups-groups-post"><span class="badge post"><i class="fa fa-plus"></i></span>Create New Group</a></li></ul></li><li><a href="#groups-group">Group</a><ul><li><a href="#groups-group-get"><span class="badge get"><i class="fa fa-arrow-down"></i></span>Get Group</a></li><li><a href="#groups-group-delete"><span class="badge delete"><i class="fa fa-times"></i></span>Delete a Group</a></li></ul></li></ul></div></div><div class="resource-group"><div class="heading"><div class="chevron"><i class="open fa fa-angle-down"></i></div><a href="#pages">Pages</a></div><div class="collapse-content"><ul><li><a href="#header-importing-a-site">Importing a Site</a></li><li><a href="#pages-pages">Pages</a><ul><li><a href="#pages-pages-get"><span class="badge get"><i class="fa fa-arrow-down"></i></span>Get Pages</a></li><li><a href="#pages-pages-post"><span class="badge post"><i class="fa fa-plus"></i></span>Create New Page</a></li></ul></li><li><a href="#pages-page">Page</a><ul><li><a href="#pages-page-get"><span class="badge get"><i class="fa fa-arrow-down"></i></span>Get Page</a></li><li><a href="#pages-page-put"><span class="badge put"><i class="fa fa-pencil"></i></span>Put Page</a></li><li><a href="#pages-page-delete"><span class="badge delete"><i class="fa fa-times"></i></span>Delete a Page</a></li></ul></li></ul></div></div><div class="resource-group"><div class="heading"><div class="chevron"><i class="open fa fa-angle-down"></i></div><a href="#import">Import</a></div><div class="collapse-content"><ul><li><a href="#import-group-post"><span class="badge post"><i class="fa fa-plus"></i></span>Import a Group</a></li><li><a href="#import-email-post"><span class="badge post"><i class="fa fa-plus"></i></span>Import an Email</a></li><li><a href="#import-site-post"><span class="badge post"><i class="fa fa-plus"></i></span>Import a Site</a></li></ul></div></div><p style="text-align: center; word-wrap: break-word;"><a href="http://localhost:3333/api/">http://localhost:3333/api/</a></p></nav><div class="content"><header><h1 id="top">Gophish API</h1></header><p>Gophish was built from the ground-up with a JSON API that makes it easy for developers and sysadmins to automate simulated phishing campaigns.</p>
<p>These docs describe how to use the <a href="https://github.com/jordan-wright/gophish">gophish</a> API.</p>
<div class="note">
<h2 id="header-authorization">Authorization <a class="permalink" href="#header-authorization" aria-hidden="true"></a></h2>
<p>All API requests require the use of a generated API key. You can find your API key, or generate a new one, by navigating to the /settings endpoint, or clicking the “Settings” sidebar item.</p>
<p>When making requests, simply append the <code>api_key=[API_KEY]</code> as a GET parameter to authorize yourself to the API.</p>
<pre><code class="language-http">GET /api/campaigns/?api_key=12345678901234567890123456789012</code></pre>
<p>If no API key is provided, youll receive the following response when attempting to make requests to API endpoints:</p>
<pre><code class="language-json">{
"<span class="hljs-attribute">message</span>": <span class="hljs-value"><span class="hljs-string">"API Key not set"</span></span>,
"<span class="hljs-attribute">success</span>": <span class="hljs-value"><span class="hljs-literal">false</span></span>,
"<span class="hljs-attribute">data</span>": <span class="hljs-value"><span class="hljs-literal">null</span>
</span>}</code></pre>
</div>
<section id="campaigns" class="resource-group"><h2 class="group-heading">Campaigns<a href="#campaigns" class="permalink">&para;</a></h2><p>Campaigns object contain the resources needed for gophish to launch and track a simulated phishing campaign.</p>
<p>Campaigns have the following attributes:</p>
<ul>
<li>
<p><code>id</code> : 1 (required, number) - Unique identifier</p>
</li>
<li>
<p><code>name</code> : Example Campaign (required) - Title of Campaign</p>
</li>
<li>
<p><code>created_date</code> : 2015-1-1T01:02:03.000000Z (datetime) - Date the Campaign was created</p>
</li>
<li>
<p><code>completed_date</code> : 2015-1-1T01:02:03.000000Z (datetime) - Date the Campaign was completed</p>
</li>
<li>
<p><code>template</code> : <a href="#templates">Template</a></p>
</li>
<li>
<p><code>page</code> : <a href="#pages">Page</a> (required) - Landing page for users who click the phishing link</p>
</li>
<li>
<p><code>status</code> : Emails Sent (required, string) - The current status of the campaign</p>
</li>
<li>
<p><code>results</code> : Attributes (ResultsList)</p>
</li>
<li>
<p><code>timeline</code> : Attributes (EventList)</p>
</li>
<li>
<p><code>smtp</code> : Attributes (SMTP)</p>
</li>
<li>
<p><code>url</code> : <a href="http://foo.bar">http://foo.bar</a> (required, string) - The URL used in the Template sent to us
ers</p>
</li>
</ul>
<div id="campaigns-campaigns" class="resource"><h3 class="resource-heading">Campaigns<a href="#campaigns-campaigns" class="permalink">&para;</a></h3><div id="campaigns-campaigns-get" class="action get"><h4 class="action-heading"><div class="name">Get Campaigns</div><a href="#campaigns-campaigns-get" class="method get">GET</a><code class="uri">/campaigns</code></h4><p>Get a list of campaigns.</p>
<div class="title"><strong>Response&nbsp;&nbsp;<code>200</code></strong><div class="collapse-button"><span class="close">Hide</span><span class="open">Show</span></div></div><div class="collapse-content"><div class="inner"><h5>Headers</h5><pre><code><span class="hljs-attribute">Content-Type</span>: <span class="hljs-string">application/json</span></code></pre><div style="height: 1px;"></div><h5>Body</h5><pre><code>[
{
"<span class="hljs-attribute">id</span>": <span class="hljs-value"><span class="hljs-number">1</span></span>,
"<span class="hljs-attribute">name</span>": <span class="hljs-value"><span class="hljs-string">"Example Campaign"</span></span>,
"<span class="hljs-attribute">created_date</span>": <span class="hljs-value"><span class="hljs-string">"2015-01-01T01:02:03.000000Z"</span></span>,
"<span class="hljs-attribute">completed_date</span>": <span class="hljs-value"><span class="hljs-string">"2015-01-01T01:02:03.000000Z"</span></span>,
"<span class="hljs-attribute">template</span>": <span class="hljs-value">{
"<span class="hljs-attribute">id</span>": <span class="hljs-value"><span class="hljs-number">1</span></span>,
"<span class="hljs-attribute">name</span>": <span class="hljs-value"><span class="hljs-string">"Example Template"</span></span>,
"<span class="hljs-attribute">subject</span>": <span class="hljs-value"><span class="hljs-string">"Example email template subject"</span></span>,
"<span class="hljs-attribute">text</span>": <span class="hljs-value"><span class="hljs-string">"This is a test message!"</span></span>,
"<span class="hljs-attribute">html</span>": <span class="hljs-value"><span class="hljs-string">"&lt;html&gt;&lt;head&gt;&lt;/head&gt;&lt;body&gt;This is a test message!&lt;/body&gt;&lt;/html&gt;"</span></span>,
"<span class="hljs-attribute">attachments</span>": <span class="hljs-value">[]</span>,
"<span class="hljs-attribute">modified_date</span>": <span class="hljs-value"><span class="hljs-string">"2015-01-01T01:02:03.000000Z"</span>
</span>}</span>,
"<span class="hljs-attribute">page</span>": <span class="hljs-value">{
"<span class="hljs-attribute">id</span>": <span class="hljs-value"><span class="hljs-number">1</span></span>,
"<span class="hljs-attribute">name</span>": <span class="hljs-value"><span class="hljs-string">"Example Page"</span></span>,
"<span class="hljs-attribute">html</span>": <span class="hljs-value"><span class="hljs-string">"&lt;html&gt;&lt;head&gt;&lt;/head&gt;&lt;body&gt;This is a test message!&lt;/body&gt;&lt;/html&gt;"</span></span>,
"<span class="hljs-attribute">modified_date</span>": <span class="hljs-value"><span class="hljs-string">"2015-01-01T01:02:03.000000Z"</span>
</span>}</span>,
"<span class="hljs-attribute">status</span>": <span class="hljs-value"><span class="hljs-string">"Emails Sent"</span></span>,
"<span class="hljs-attribute">results</span>": <span class="hljs-value">[]</span>,
"<span class="hljs-attribute">timeline</span>": <span class="hljs-value">[]</span>,
"<span class="hljs-attribute">smtp</span>": <span class="hljs-value">{
"<span class="hljs-attribute">id</span>": <span class="hljs-value"><span class="hljs-number">1</span>
</span>}</span>,
"<span class="hljs-attribute">url</span>": <span class="hljs-value"><span class="hljs-string">"http://foo.bar"</span>
</span>}
]</code></pre><div style="height: 1px;"></div><h5>Schema</h5><pre><code>{
"<span class="hljs-attribute">type</span>": <span class="hljs-value"><span class="hljs-string">"array"</span></span>,
"<span class="hljs-attribute">$schema</span>": <span class="hljs-value"><span class="hljs-string">"http://json-schema.org/draft-04/schema#"</span>
</span>}</code></pre><div style="height: 1px;"></div></div></div></div><div id="campaigns-campaigns-post" class="action post"><h4 class="action-heading"><div class="name">Create New Campaign</div><a href="#campaigns-campaigns-post" class="method post">POST</a><code class="uri">/campaigns</code></h4><p>Create a new campaign</p>
<div class="title"><strong>Request</strong><div class="collapse-button"><span class="close">Hide</span><span class="open">Show</span></div></div><div class="collapse-content"><div class="inner"><h5>Headers</h5><pre><code><span class="hljs-attribute">Content-Type</span>: <span class="hljs-string">application/json</span></code></pre><div style="height: 1px;"></div><h5>Body</h5><pre><code>{
"<span class="hljs-attribute">id</span>": <span class="hljs-value"><span class="hljs-number">1</span></span>,
"<span class="hljs-attribute">name</span>": <span class="hljs-value"><span class="hljs-string">"Example Campaign"</span></span>,
"<span class="hljs-attribute">created_date</span>": <span class="hljs-value"><span class="hljs-string">"2015-01-01T01:02:03.000000Z"</span></span>,
"<span class="hljs-attribute">completed_date</span>": <span class="hljs-value"><span class="hljs-string">"2015-01-01T01:02:03.000000Z"</span></span>,
"<span class="hljs-attribute">template</span>": <span class="hljs-value">{
"<span class="hljs-attribute">id</span>": <span class="hljs-value"><span class="hljs-number">1</span></span>,
"<span class="hljs-attribute">name</span>": <span class="hljs-value"><span class="hljs-string">"Example Template"</span></span>,
"<span class="hljs-attribute">subject</span>": <span class="hljs-value"><span class="hljs-string">"Example email template subject"</span></span>,
"<span class="hljs-attribute">text</span>": <span class="hljs-value"><span class="hljs-string">"This is a test message!"</span></span>,
"<span class="hljs-attribute">html</span>": <span class="hljs-value"><span class="hljs-string">"&lt;html&gt;&lt;head&gt;&lt;/head&gt;&lt;body&gt;This is a test message!&lt;/body&gt;&lt;/html&gt;"</span></span>,
"<span class="hljs-attribute">attachments</span>": <span class="hljs-value">[]</span>,
"<span class="hljs-attribute">modified_date</span>": <span class="hljs-value"><span class="hljs-string">"2015-01-01T01:02:03.000000Z"</span>
</span>}</span>,
"<span class="hljs-attribute">page</span>": <span class="hljs-value">{
"<span class="hljs-attribute">id</span>": <span class="hljs-value"><span class="hljs-number">1</span></span>,
"<span class="hljs-attribute">name</span>": <span class="hljs-value"><span class="hljs-string">"Example Page"</span></span>,
"<span class="hljs-attribute">html</span>": <span class="hljs-value"><span class="hljs-string">"&lt;html&gt;&lt;head&gt;&lt;/head&gt;&lt;body&gt;This is a test message!&lt;/body&gt;&lt;/html&gt;"</span></span>,
"<span class="hljs-attribute">modified_date</span>": <span class="hljs-value"><span class="hljs-string">"2015-01-01T01:02:03.000000Z"</span>
</span>}</span>,
"<span class="hljs-attribute">status</span>": <span class="hljs-value"><span class="hljs-string">"Emails Sent"</span></span>,
"<span class="hljs-attribute">results</span>": <span class="hljs-value">[]</span>,
"<span class="hljs-attribute">timeline</span>": <span class="hljs-value">[]</span>,
"<span class="hljs-attribute">smtp</span>": <span class="hljs-value">{
"<span class="hljs-attribute">id</span>": <span class="hljs-value"><span class="hljs-number">1</span>
</span>}</span>,
"<span class="hljs-attribute">url</span>": <span class="hljs-value"><span class="hljs-string">"http://foo.bar"</span>
</span>}</code></pre><div style="height: 1px;"></div><h5>Schema</h5><pre><code>{
"<span class="hljs-attribute">type</span>": <span class="hljs-value"><span class="hljs-string">"object"</span></span>,
"<span class="hljs-attribute">properties</span>": <span class="hljs-value">{
"<span class="hljs-attribute">id</span>": <span class="hljs-value">{
"<span class="hljs-attribute">type</span>": <span class="hljs-value"><span class="hljs-string">"number"</span></span>,
"<span class="hljs-attribute">description</span>": <span class="hljs-value"><span class="hljs-string">"Unique identifier"</span>
</span>}</span>,
"<span class="hljs-attribute">name</span>": <span class="hljs-value">{
"<span class="hljs-attribute">type</span>": <span class="hljs-value"><span class="hljs-string">"string"</span></span>,
"<span class="hljs-attribute">description</span>": <span class="hljs-value"><span class="hljs-string">"Title of Campaign"</span>
</span>}</span>,
"<span class="hljs-attribute">created_date</span>": <span class="hljs-value">{
"<span class="hljs-attribute">type</span>": <span class="hljs-value"><span class="hljs-string">"string"</span></span>,
"<span class="hljs-attribute">description</span>": <span class="hljs-value"><span class="hljs-string">"Date the Campaign was created"</span>
</span>}</span>,
"<span class="hljs-attribute">completed_date</span>": <span class="hljs-value">{
"<span class="hljs-attribute">type</span>": <span class="hljs-value"><span class="hljs-string">"string"</span></span>,
"<span class="hljs-attribute">description</span>": <span class="hljs-value"><span class="hljs-string">"Date the Campaign was completed"</span>
</span>}</span>,
"<span class="hljs-attribute">template</span>": <span class="hljs-value">{
"<span class="hljs-attribute">type</span>": <span class="hljs-value"><span class="hljs-string">"object"</span></span>,
"<span class="hljs-attribute">properties</span>": <span class="hljs-value">{
"<span class="hljs-attribute">id</span>": <span class="hljs-value">{
"<span class="hljs-attribute">type</span>": <span class="hljs-value"><span class="hljs-string">"number"</span></span>,
"<span class="hljs-attribute">description</span>": <span class="hljs-value"><span class="hljs-string">"Unique identifier"</span>
</span>}</span>,
"<span class="hljs-attribute">name</span>": <span class="hljs-value">{
"<span class="hljs-attribute">type</span>": <span class="hljs-value"><span class="hljs-string">"string"</span></span>,
"<span class="hljs-attribute">description</span>": <span class="hljs-value"><span class="hljs-string">"Name of template"</span>
</span>}</span>,
"<span class="hljs-attribute">subject</span>": <span class="hljs-value">{
"<span class="hljs-attribute">type</span>": <span class="hljs-value"><span class="hljs-string">"string"</span></span>,
"<span class="hljs-attribute">description</span>": <span class="hljs-value"><span class="hljs-string">"Subject of email sent to users"</span>
</span>}</span>,
"<span class="hljs-attribute">text</span>": <span class="hljs-value">{
"<span class="hljs-attribute">type</span>": <span class="hljs-value"><span class="hljs-string">"string"</span></span>,
"<span class="hljs-attribute">description</span>": <span class="hljs-value"><span class="hljs-string">"Raw text of email sent to users"</span>
</span>}</span>,
"<span class="hljs-attribute">html</span>": <span class="hljs-value">{
"<span class="hljs-attribute">type</span>": <span class="hljs-value"><span class="hljs-string">"string"</span></span>,
"<span class="hljs-attribute">description</span>": <span class="hljs-value"><span class="hljs-string">"HTML of email sent to users"</span>
</span>}</span>,
"<span class="hljs-attribute">attachments</span>": <span class="hljs-value">{
"<span class="hljs-attribute">type</span>": <span class="hljs-value"><span class="hljs-string">"array"</span></span>,
"<span class="hljs-attribute">description</span>": <span class="hljs-value"><span class="hljs-string">"The attachments sent with the email template"</span>
</span>}</span>,
"<span class="hljs-attribute">modified_date</span>": <span class="hljs-value">{
"<span class="hljs-attribute">type</span>": <span class="hljs-value"><span class="hljs-string">"string"</span></span>,
"<span class="hljs-attribute">description</span>": <span class="hljs-value"><span class="hljs-string">"Date the Template was last modified"</span>
</span>}
</span>}</span>,
"<span class="hljs-attribute">required</span>": <span class="hljs-value">[
<span class="hljs-string">"id"</span>,
<span class="hljs-string">"name"</span>
]
</span>}</span>,
"<span class="hljs-attribute">page</span>": <span class="hljs-value">{
"<span class="hljs-attribute">type</span>": <span class="hljs-value"><span class="hljs-string">"object"</span></span>,
"<span class="hljs-attribute">properties</span>": <span class="hljs-value">{
"<span class="hljs-attribute">id</span>": <span class="hljs-value">{
"<span class="hljs-attribute">type</span>": <span class="hljs-value"><span class="hljs-string">"number"</span></span>,
"<span class="hljs-attribute">description</span>": <span class="hljs-value"><span class="hljs-string">"Unique identifier"</span>
</span>}</span>,
"<span class="hljs-attribute">name</span>": <span class="hljs-value">{
"<span class="hljs-attribute">type</span>": <span class="hljs-value"><span class="hljs-string">"string"</span></span>,
"<span class="hljs-attribute">description</span>": <span class="hljs-value"><span class="hljs-string">"Name of Page"</span>
</span>}</span>,
"<span class="hljs-attribute">html</span>": <span class="hljs-value">{
"<span class="hljs-attribute">type</span>": <span class="hljs-value"><span class="hljs-string">"string"</span></span>,
"<span class="hljs-attribute">description</span>": <span class="hljs-value"><span class="hljs-string">"HTML of the landing page users hit when clicking links in the email template"</span>
</span>}</span>,
"<span class="hljs-attribute">modified_date</span>": <span class="hljs-value">{
"<span class="hljs-attribute">type</span>": <span class="hljs-value"><span class="hljs-string">"string"</span></span>,
"<span class="hljs-attribute">description</span>": <span class="hljs-value"><span class="hljs-string">"Date the Page was last modified"</span>
</span>}
</span>}</span>,
"<span class="hljs-attribute">required</span>": <span class="hljs-value">[
<span class="hljs-string">"id"</span>,
<span class="hljs-string">"name"</span>,
<span class="hljs-string">"html"</span>
]
</span>}</span>,
"<span class="hljs-attribute">status</span>": <span class="hljs-value">{
"<span class="hljs-attribute">type</span>": <span class="hljs-value"><span class="hljs-string">"string"</span></span>,
"<span class="hljs-attribute">description</span>": <span class="hljs-value"><span class="hljs-string">"The current status of the campaign"</span>
</span>}</span>,
"<span class="hljs-attribute">results</span>": <span class="hljs-value">{
"<span class="hljs-attribute">type</span>": <span class="hljs-value"><span class="hljs-string">"array"</span>
</span>}</span>,
"<span class="hljs-attribute">timeline</span>": <span class="hljs-value">{
"<span class="hljs-attribute">type</span>": <span class="hljs-value"><span class="hljs-string">"array"</span>
</span>}</span>,
"<span class="hljs-attribute">smtp</span>": <span class="hljs-value">{
"<span class="hljs-attribute">type</span>": <span class="hljs-value"><span class="hljs-string">"object"</span></span>,
"<span class="hljs-attribute">properties</span>": <span class="hljs-value">{
"<span class="hljs-attribute">id</span>": <span class="hljs-value">{
"<span class="hljs-attribute">type</span>": <span class="hljs-value"><span class="hljs-string">"number"</span></span>,
"<span class="hljs-attribute">description</span>": <span class="hljs-value"><span class="hljs-string">"Unique identifier"</span>
</span>}
</span>}</span>,
"<span class="hljs-attribute">required</span>": <span class="hljs-value">[
<span class="hljs-string">"id"</span>
]
</span>}</span>,
"<span class="hljs-attribute">url</span>": <span class="hljs-value">{
"<span class="hljs-attribute">type</span>": <span class="hljs-value"><span class="hljs-string">"string"</span></span>,
"<span class="hljs-attribute">description</span>": <span class="hljs-value"><span class="hljs-string">"The URL used in the Template sent to users"</span>
</span>}
</span>}</span>,
"<span class="hljs-attribute">required</span>": <span class="hljs-value">[
<span class="hljs-string">"id"</span>,
<span class="hljs-string">"name"</span>,
<span class="hljs-string">"status"</span>,
<span class="hljs-string">"url"</span>
]</span>,
"<span class="hljs-attribute">$schema</span>": <span class="hljs-value"><span class="hljs-string">"http://json-schema.org/draft-04/schema#"</span>
</span>}</code></pre><div style="height: 1px;"></div></div></div><div class="title"><strong>Response&nbsp;&nbsp;<code>201</code></strong><div class="collapse-button"><span class="close">Hide</span><span class="open">Show</span></div></div><div class="collapse-content"><div class="inner"><h5>Headers</h5><pre><code><span class="hljs-attribute">Content-Type</span>: <span class="hljs-string">application/json</span></code></pre><div style="height: 1px;"></div><h5>Body</h5><pre><code>{
"<span class="hljs-attribute">id</span>": <span class="hljs-value"><span class="hljs-number">1</span></span>,
"<span class="hljs-attribute">name</span>": <span class="hljs-value"><span class="hljs-string">"Example Campaign"</span></span>,
"<span class="hljs-attribute">created_date</span>": <span class="hljs-value"><span class="hljs-string">"2015-01-01T01:02:03.000000Z"</span></span>,
"<span class="hljs-attribute">completed_date</span>": <span class="hljs-value"><span class="hljs-string">"2015-01-01T01:02:03.000000Z"</span></span>,
"<span class="hljs-attribute">template</span>": <span class="hljs-value">{
"<span class="hljs-attribute">id</span>": <span class="hljs-value"><span class="hljs-number">1</span></span>,
"<span class="hljs-attribute">name</span>": <span class="hljs-value"><span class="hljs-string">"Example Template"</span></span>,
"<span class="hljs-attribute">subject</span>": <span class="hljs-value"><span class="hljs-string">"Example email template subject"</span></span>,
"<span class="hljs-attribute">text</span>": <span class="hljs-value"><span class="hljs-string">"This is a test message!"</span></span>,
"<span class="hljs-attribute">html</span>": <span class="hljs-value"><span class="hljs-string">"&lt;html&gt;&lt;head&gt;&lt;/head&gt;&lt;body&gt;This is a test message!&lt;/body&gt;&lt;/html&gt;"</span></span>,
"<span class="hljs-attribute">attachments</span>": <span class="hljs-value">[]</span>,
"<span class="hljs-attribute">modified_date</span>": <span class="hljs-value"><span class="hljs-string">"2015-01-01T01:02:03.000000Z"</span>
</span>}</span>,
"<span class="hljs-attribute">page</span>": <span class="hljs-value">{
"<span class="hljs-attribute">id</span>": <span class="hljs-value"><span class="hljs-number">1</span></span>,
"<span class="hljs-attribute">name</span>": <span class="hljs-value"><span class="hljs-string">"Example Page"</span></span>,
"<span class="hljs-attribute">html</span>": <span class="hljs-value"><span class="hljs-string">"&lt;html&gt;&lt;head&gt;&lt;/head&gt;&lt;body&gt;This is a test message!&lt;/body&gt;&lt;/html&gt;"</span></span>,
"<span class="hljs-attribute">modified_date</span>": <span class="hljs-value"><span class="hljs-string">"2015-01-01T01:02:03.000000Z"</span>
</span>}</span>,
"<span class="hljs-attribute">status</span>": <span class="hljs-value"><span class="hljs-string">"Emails Sent"</span></span>,
"<span class="hljs-attribute">results</span>": <span class="hljs-value">[]</span>,
"<span class="hljs-attribute">timeline</span>": <span class="hljs-value">[]</span>,
"<span class="hljs-attribute">smtp</span>": <span class="hljs-value">{
"<span class="hljs-attribute">id</span>": <span class="hljs-value"><span class="hljs-number">1</span>
</span>}</span>,
"<span class="hljs-attribute">url</span>": <span class="hljs-value"><span class="hljs-string">"http://foo.bar"</span>
</span>}</code></pre><div style="height: 1px;"></div><h5>Schema</h5><pre><code>{
"<span class="hljs-attribute">type</span>": <span class="hljs-value"><span class="hljs-string">"object"</span></span>,
"<span class="hljs-attribute">properties</span>": <span class="hljs-value">{
"<span class="hljs-attribute">id</span>": <span class="hljs-value">{
"<span class="hljs-attribute">type</span>": <span class="hljs-value"><span class="hljs-string">"number"</span></span>,
"<span class="hljs-attribute">description</span>": <span class="hljs-value"><span class="hljs-string">"Unique identifier"</span>
</span>}</span>,
"<span class="hljs-attribute">name</span>": <span class="hljs-value">{
"<span class="hljs-attribute">type</span>": <span class="hljs-value"><span class="hljs-string">"string"</span></span>,
"<span class="hljs-attribute">description</span>": <span class="hljs-value"><span class="hljs-string">"Title of Campaign"</span>
</span>}</span>,
"<span class="hljs-attribute">created_date</span>": <span class="hljs-value">{
"<span class="hljs-attribute">type</span>": <span class="hljs-value"><span class="hljs-string">"string"</span></span>,
"<span class="hljs-attribute">description</span>": <span class="hljs-value"><span class="hljs-string">"Date the Campaign was created"</span>
</span>}</span>,
"<span class="hljs-attribute">completed_date</span>": <span class="hljs-value">{
"<span class="hljs-attribute">type</span>": <span class="hljs-value"><span class="hljs-string">"string"</span></span>,
"<span class="hljs-attribute">description</span>": <span class="hljs-value"><span class="hljs-string">"Date the Campaign was completed"</span>
</span>}</span>,
"<span class="hljs-attribute">template</span>": <span class="hljs-value">{
"<span class="hljs-attribute">type</span>": <span class="hljs-value"><span class="hljs-string">"object"</span></span>,
"<span class="hljs-attribute">properties</span>": <span class="hljs-value">{
"<span class="hljs-attribute">id</span>": <span class="hljs-value">{
"<span class="hljs-attribute">type</span>": <span class="hljs-value"><span class="hljs-string">"number"</span></span>,
"<span class="hljs-attribute">description</span>": <span class="hljs-value"><span class="hljs-string">"Unique identifier"</span>
</span>}</span>,
"<span class="hljs-attribute">name</span>": <span class="hljs-value">{
"<span class="hljs-attribute">type</span>": <span class="hljs-value"><span class="hljs-string">"string"</span></span>,
"<span class="hljs-attribute">description</span>": <span class="hljs-value"><span class="hljs-string">"Name of template"</span>
</span>}</span>,
"<span class="hljs-attribute">subject</span>": <span class="hljs-value">{
"<span class="hljs-attribute">type</span>": <span class="hljs-value"><span class="hljs-string">"string"</span></span>,
"<span class="hljs-attribute">description</span>": <span class="hljs-value"><span class="hljs-string">"Subject of email sent to users"</span>
</span>}</span>,
"<span class="hljs-attribute">text</span>": <span class="hljs-value">{
"<span class="hljs-attribute">type</span>": <span class="hljs-value"><span class="hljs-string">"string"</span></span>,
"<span class="hljs-attribute">description</span>": <span class="hljs-value"><span class="hljs-string">"Raw text of email sent to users"</span>
</span>}</span>,
"<span class="hljs-attribute">html</span>": <span class="hljs-value">{
"<span class="hljs-attribute">type</span>": <span class="hljs-value"><span class="hljs-string">"string"</span></span>,
"<span class="hljs-attribute">description</span>": <span class="hljs-value"><span class="hljs-string">"HTML of email sent to users"</span>
</span>}</span>,
"<span class="hljs-attribute">attachments</span>": <span class="hljs-value">{
"<span class="hljs-attribute">type</span>": <span class="hljs-value"><span class="hljs-string">"array"</span></span>,
"<span class="hljs-attribute">description</span>": <span class="hljs-value"><span class="hljs-string">"The attachments sent with the email template"</span>
</span>}</span>,
"<span class="hljs-attribute">modified_date</span>": <span class="hljs-value">{
"<span class="hljs-attribute">type</span>": <span class="hljs-value"><span class="hljs-string">"string"</span></span>,
"<span class="hljs-attribute">description</span>": <span class="hljs-value"><span class="hljs-string">"Date the Template was last modified"</span>
</span>}
</span>}</span>,
"<span class="hljs-attribute">required</span>": <span class="hljs-value">[
<span class="hljs-string">"id"</span>,
<span class="hljs-string">"name"</span>
]
</span>}</span>,
"<span class="hljs-attribute">page</span>": <span class="hljs-value">{
"<span class="hljs-attribute">type</span>": <span class="hljs-value"><span class="hljs-string">"object"</span></span>,
"<span class="hljs-attribute">properties</span>": <span class="hljs-value">{
"<span class="hljs-attribute">id</span>": <span class="hljs-value">{
"<span class="hljs-attribute">type</span>": <span class="hljs-value"><span class="hljs-string">"number"</span></span>,
"<span class="hljs-attribute">description</span>": <span class="hljs-value"><span class="hljs-string">"Unique identifier"</span>
</span>}</span>,
"<span class="hljs-attribute">name</span>": <span class="hljs-value">{
"<span class="hljs-attribute">type</span>": <span class="hljs-value"><span class="hljs-string">"string"</span></span>,
"<span class="hljs-attribute">description</span>": <span class="hljs-value"><span class="hljs-string">"Name of Page"</span>
</span>}</span>,
"<span class="hljs-attribute">html</span>": <span class="hljs-value">{
"<span class="hljs-attribute">type</span>": <span class="hljs-value"><span class="hljs-string">"string"</span></span>,
"<span class="hljs-attribute">description</span>": <span class="hljs-value"><span class="hljs-string">"HTML of the landing page users hit when clicking links in the email template"</span>
</span>}</span>,
"<span class="hljs-attribute">modified_date</span>": <span class="hljs-value">{
"<span class="hljs-attribute">type</span>": <span class="hljs-value"><span class="hljs-string">"string"</span></span>,
"<span class="hljs-attribute">description</span>": <span class="hljs-value"><span class="hljs-string">"Date the Page was last modified"</span>
</span>}
</span>}</span>,
"<span class="hljs-attribute">required</span>": <span class="hljs-value">[
<span class="hljs-string">"id"</span>,
<span class="hljs-string">"name"</span>,
<span class="hljs-string">"html"</span>
]
</span>}</span>,
"<span class="hljs-attribute">status</span>": <span class="hljs-value">{
"<span class="hljs-attribute">type</span>": <span class="hljs-value"><span class="hljs-string">"string"</span></span>,
"<span class="hljs-attribute">description</span>": <span class="hljs-value"><span class="hljs-string">"The current status of the campaign"</span>
</span>}</span>,
"<span class="hljs-attribute">results</span>": <span class="hljs-value">{
"<span class="hljs-attribute">type</span>": <span class="hljs-value"><span class="hljs-string">"array"</span>
</span>}</span>,
"<span class="hljs-attribute">timeline</span>": <span class="hljs-value">{
"<span class="hljs-attribute">type</span>": <span class="hljs-value"><span class="hljs-string">"array"</span>
</span>}</span>,
"<span class="hljs-attribute">smtp</span>": <span class="hljs-value">{
"<span class="hljs-attribute">type</span>": <span class="hljs-value"><span class="hljs-string">"object"</span></span>,
"<span class="hljs-attribute">properties</span>": <span class="hljs-value">{
"<span class="hljs-attribute">id</span>": <span class="hljs-value">{
"<span class="hljs-attribute">type</span>": <span class="hljs-value"><span class="hljs-string">"number"</span></span>,
"<span class="hljs-attribute">description</span>": <span class="hljs-value"><span class="hljs-string">"Unique identifier"</span>
</span>}
</span>}</span>,
"<span class="hljs-attribute">required</span>": <span class="hljs-value">[
<span class="hljs-string">"id"</span>
]
</span>}</span>,
"<span class="hljs-attribute">url</span>": <span class="hljs-value">{
"<span class="hljs-attribute">type</span>": <span class="hljs-value"><span class="hljs-string">"string"</span></span>,
"<span class="hljs-attribute">description</span>": <span class="hljs-value"><span class="hljs-string">"The URL used in the Template sent to users"</span>
</span>}
</span>}</span>,
"<span class="hljs-attribute">required</span>": <span class="hljs-value">[
<span class="hljs-string">"id"</span>,
<span class="hljs-string">"name"</span>,
<span class="hljs-string">"status"</span>,
<span class="hljs-string">"url"</span>
]</span>,
"<span class="hljs-attribute">$schema</span>": <span class="hljs-value"><span class="hljs-string">"http://json-schema.org/draft-04/schema#"</span>
</span>}</code></pre><div style="height: 1px;"></div></div></div><div class="title"><strong>Response&nbsp;&nbsp;<code>400</code></strong><div class="collapse-button"><span class="close">Hide</span><span class="open">Show</span></div></div><div class="collapse-content"><div class="inner"><h5>Headers</h5><pre><code><span class="hljs-attribute">Content-Type</span>: <span class="hljs-string">application/json</span></code></pre><div style="height: 1px;"></div><h5>Body</h5><pre><code>{
"<span class="hljs-attribute">message</span>": <span class="hljs-value"><span class="hljs-string">"\"Error message\""</span></span>,
"<span class="hljs-attribute">success</span>": <span class="hljs-value"><span class="hljs-string">"false"</span></span>,
"<span class="hljs-attribute">data</span>": <span class="hljs-value"><span class="hljs-string">"Any associated data"</span>
</span>}</code></pre><div style="height: 1px;"></div><h5>Schema</h5><pre><code>{
"<span class="hljs-attribute">type</span>": <span class="hljs-value"><span class="hljs-string">"object"</span></span>,
"<span class="hljs-attribute">properties</span>": <span class="hljs-value">{
"<span class="hljs-attribute">message</span>": <span class="hljs-value">{
"<span class="hljs-attribute">type</span>": <span class="hljs-value"><span class="hljs-string">"string"</span></span>,
"<span class="hljs-attribute">description</span>": <span class="hljs-value"><span class="hljs-string">"The detailed error message"</span>
</span>}</span>,
"<span class="hljs-attribute">success</span>": <span class="hljs-value">{
"<span class="hljs-attribute">type</span>": <span class="hljs-value"><span class="hljs-string">"string"</span></span>,
"<span class="hljs-attribute">description</span>": <span class="hljs-value"><span class="hljs-string">"The success status of the request"</span>
</span>}</span>,
"<span class="hljs-attribute">data</span>": <span class="hljs-value">{
"<span class="hljs-attribute">type</span>": <span class="hljs-value"><span class="hljs-string">"string"</span>
</span>}
</span>}</span>,
"<span class="hljs-attribute">$schema</span>": <span class="hljs-value"><span class="hljs-string">"http://json-schema.org/draft-04/schema#"</span>
</span>}</code></pre><div style="height: 1px;"></div></div></div></div></div><div id="campaigns-campaign" class="resource"><h3 class="resource-heading">Campaign<a href="#campaigns-campaign" class="permalink">&para;</a></h3><div id="campaigns-campaign-get" class="action get"><h4 class="action-heading"><div class="name">Get Campaign</div><a href="#campaigns-campaign-get" class="method get">GET</a><code class="uri">/campaigns/{id}</code></h4><p>Get a campaign by its ID.</p>
<div class="title"><strong>Parameters</strong><div class="collapse-button show"><span class="close">Hide</span><span class="open">Show</span></div></div><div class="collapse-content"><dl class="inner"><dt>id</dt><dd><code>number</code>&nbsp;<span class="required">(required)</span>&nbsp;<span class="text-muted example"><strong>Example:&nbsp;</strong><span>1</span></span><p>The Campaign ID</p>
</dd></dl></div><div class="title"><strong>Response&nbsp;&nbsp;<code>200</code></strong><div class="collapse-button"><span class="close">Hide</span><span class="open">Show</span></div></div><div class="collapse-content"><div class="inner"><h5>Headers</h5><pre><code><span class="hljs-attribute">Content-Type</span>: <span class="hljs-string">application/json</span></code></pre><div style="height: 1px;"></div><h5>Body</h5><pre><code>{
"<span class="hljs-attribute">id</span>": <span class="hljs-value"><span class="hljs-number">1</span></span>,
"<span class="hljs-attribute">name</span>": <span class="hljs-value"><span class="hljs-string">"Example Campaign"</span></span>,
"<span class="hljs-attribute">created_date</span>": <span class="hljs-value"><span class="hljs-string">"2015-01-01T01:02:03.000000Z"</span></span>,
"<span class="hljs-attribute">completed_date</span>": <span class="hljs-value"><span class="hljs-string">"2015-01-01T01:02:03.000000Z"</span></span>,
"<span class="hljs-attribute">template</span>": <span class="hljs-value">{
"<span class="hljs-attribute">id</span>": <span class="hljs-value"><span class="hljs-number">1</span></span>,
"<span class="hljs-attribute">name</span>": <span class="hljs-value"><span class="hljs-string">"Example Template"</span></span>,
"<span class="hljs-attribute">subject</span>": <span class="hljs-value"><span class="hljs-string">"Example email template subject"</span></span>,
"<span class="hljs-attribute">text</span>": <span class="hljs-value"><span class="hljs-string">"This is a test message!"</span></span>,
"<span class="hljs-attribute">html</span>": <span class="hljs-value"><span class="hljs-string">"&lt;html&gt;&lt;head&gt;&lt;/head&gt;&lt;body&gt;This is a test message!&lt;/body&gt;&lt;/html&gt;"</span></span>,
"<span class="hljs-attribute">attachments</span>": <span class="hljs-value">[]</span>,
"<span class="hljs-attribute">modified_date</span>": <span class="hljs-value"><span class="hljs-string">"2015-01-01T01:02:03.000000Z"</span>
</span>}</span>,
"<span class="hljs-attribute">page</span>": <span class="hljs-value">{
"<span class="hljs-attribute">id</span>": <span class="hljs-value"><span class="hljs-number">1</span></span>,
"<span class="hljs-attribute">name</span>": <span class="hljs-value"><span class="hljs-string">"Example Page"</span></span>,
"<span class="hljs-attribute">html</span>": <span class="hljs-value"><span class="hljs-string">"&lt;html&gt;&lt;head&gt;&lt;/head&gt;&lt;body&gt;This is a test message!&lt;/body&gt;&lt;/html&gt;"</span></span>,
"<span class="hljs-attribute">modified_date</span>": <span class="hljs-value"><span class="hljs-string">"2015-01-01T01:02:03.000000Z"</span>
</span>}</span>,
"<span class="hljs-attribute">status</span>": <span class="hljs-value"><span class="hljs-string">"Emails Sent"</span></span>,
"<span class="hljs-attribute">results</span>": <span class="hljs-value">[]</span>,
"<span class="hljs-attribute">timeline</span>": <span class="hljs-value">[]</span>,
"<span class="hljs-attribute">smtp</span>": <span class="hljs-value">{
"<span class="hljs-attribute">id</span>": <span class="hljs-value"><span class="hljs-number">1</span>
</span>}</span>,
"<span class="hljs-attribute">url</span>": <span class="hljs-value"><span class="hljs-string">"http://foo.bar"</span>
</span>}</code></pre><div style="height: 1px;"></div><h5>Schema</h5><pre><code>{
"<span class="hljs-attribute">type</span>": <span class="hljs-value"><span class="hljs-string">"object"</span></span>,
"<span class="hljs-attribute">properties</span>": <span class="hljs-value">{
"<span class="hljs-attribute">id</span>": <span class="hljs-value">{
"<span class="hljs-attribute">type</span>": <span class="hljs-value"><span class="hljs-string">"number"</span></span>,
"<span class="hljs-attribute">description</span>": <span class="hljs-value"><span class="hljs-string">"Unique identifier"</span>
</span>}</span>,
"<span class="hljs-attribute">name</span>": <span class="hljs-value">{
"<span class="hljs-attribute">type</span>": <span class="hljs-value"><span class="hljs-string">"string"</span></span>,
"<span class="hljs-attribute">description</span>": <span class="hljs-value"><span class="hljs-string">"Title of Campaign"</span>
</span>}</span>,
"<span class="hljs-attribute">created_date</span>": <span class="hljs-value">{
"<span class="hljs-attribute">type</span>": <span class="hljs-value"><span class="hljs-string">"string"</span></span>,
"<span class="hljs-attribute">description</span>": <span class="hljs-value"><span class="hljs-string">"Date the Campaign was created"</span>
</span>}</span>,
"<span class="hljs-attribute">completed_date</span>": <span class="hljs-value">{
"<span class="hljs-attribute">type</span>": <span class="hljs-value"><span class="hljs-string">"string"</span></span>,
"<span class="hljs-attribute">description</span>": <span class="hljs-value"><span class="hljs-string">"Date the Campaign was completed"</span>
</span>}</span>,
"<span class="hljs-attribute">template</span>": <span class="hljs-value">{
"<span class="hljs-attribute">type</span>": <span class="hljs-value"><span class="hljs-string">"object"</span></span>,
"<span class="hljs-attribute">properties</span>": <span class="hljs-value">{
"<span class="hljs-attribute">id</span>": <span class="hljs-value">{
"<span class="hljs-attribute">type</span>": <span class="hljs-value"><span class="hljs-string">"number"</span></span>,
"<span class="hljs-attribute">description</span>": <span class="hljs-value"><span class="hljs-string">"Unique identifier"</span>
</span>}</span>,
"<span class="hljs-attribute">name</span>": <span class="hljs-value">{
"<span class="hljs-attribute">type</span>": <span class="hljs-value"><span class="hljs-string">"string"</span></span>,
"<span class="hljs-attribute">description</span>": <span class="hljs-value"><span class="hljs-string">"Name of template"</span>
</span>}</span>,
"<span class="hljs-attribute">subject</span>": <span class="hljs-value">{
"<span class="hljs-attribute">type</span>": <span class="hljs-value"><span class="hljs-string">"string"</span></span>,
"<span class="hljs-attribute">description</span>": <span class="hljs-value"><span class="hljs-string">"Subject of email sent to users"</span>
</span>}</span>,
"<span class="hljs-attribute">text</span>": <span class="hljs-value">{
"<span class="hljs-attribute">type</span>": <span class="hljs-value"><span class="hljs-string">"string"</span></span>,
"<span class="hljs-attribute">description</span>": <span class="hljs-value"><span class="hljs-string">"Raw text of email sent to users"</span>
</span>}</span>,
"<span class="hljs-attribute">html</span>": <span class="hljs-value">{
"<span class="hljs-attribute">type</span>": <span class="hljs-value"><span class="hljs-string">"string"</span></span>,
"<span class="hljs-attribute">description</span>": <span class="hljs-value"><span class="hljs-string">"HTML of email sent to users"</span>
</span>}</span>,
"<span class="hljs-attribute">attachments</span>": <span class="hljs-value">{
"<span class="hljs-attribute">type</span>": <span class="hljs-value"><span class="hljs-string">"array"</span></span>,
"<span class="hljs-attribute">description</span>": <span class="hljs-value"><span class="hljs-string">"The attachments sent with the email template"</span>
</span>}</span>,
"<span class="hljs-attribute">modified_date</span>": <span class="hljs-value">{
"<span class="hljs-attribute">type</span>": <span class="hljs-value"><span class="hljs-string">"string"</span></span>,
"<span class="hljs-attribute">description</span>": <span class="hljs-value"><span class="hljs-string">"Date the Template was last modified"</span>
</span>}
</span>}</span>,
"<span class="hljs-attribute">required</span>": <span class="hljs-value">[
<span class="hljs-string">"id"</span>,
<span class="hljs-string">"name"</span>
]
</span>}</span>,
"<span class="hljs-attribute">page</span>": <span class="hljs-value">{
"<span class="hljs-attribute">type</span>": <span class="hljs-value"><span class="hljs-string">"object"</span></span>,
"<span class="hljs-attribute">properties</span>": <span class="hljs-value">{
"<span class="hljs-attribute">id</span>": <span class="hljs-value">{
"<span class="hljs-attribute">type</span>": <span class="hljs-value"><span class="hljs-string">"number"</span></span>,
"<span class="hljs-attribute">description</span>": <span class="hljs-value"><span class="hljs-string">"Unique identifier"</span>
</span>}</span>,
"<span class="hljs-attribute">name</span>": <span class="hljs-value">{
"<span class="hljs-attribute">type</span>": <span class="hljs-value"><span class="hljs-string">"string"</span></span>,
"<span class="hljs-attribute">description</span>": <span class="hljs-value"><span class="hljs-string">"Name of Page"</span>
</span>}</span>,
"<span class="hljs-attribute">html</span>": <span class="hljs-value">{
"<span class="hljs-attribute">type</span>": <span class="hljs-value"><span class="hljs-string">"string"</span></span>,
"<span class="hljs-attribute">description</span>": <span class="hljs-value"><span class="hljs-string">"HTML of the landing page users hit when clicking links in the email template"</span>
</span>}</span>,
"<span class="hljs-attribute">modified_date</span>": <span class="hljs-value">{
"<span class="hljs-attribute">type</span>": <span class="hljs-value"><span class="hljs-string">"string"</span></span>,
"<span class="hljs-attribute">description</span>": <span class="hljs-value"><span class="hljs-string">"Date the Page was last modified"</span>
</span>}
</span>}</span>,
"<span class="hljs-attribute">required</span>": <span class="hljs-value">[
<span class="hljs-string">"id"</span>,
<span class="hljs-string">"name"</span>,
<span class="hljs-string">"html"</span>
]
</span>}</span>,
"<span class="hljs-attribute">status</span>": <span class="hljs-value">{
"<span class="hljs-attribute">type</span>": <span class="hljs-value"><span class="hljs-string">"string"</span></span>,
"<span class="hljs-attribute">description</span>": <span class="hljs-value"><span class="hljs-string">"The current status of the campaign"</span>
</span>}</span>,
"<span class="hljs-attribute">results</span>": <span class="hljs-value">{
"<span class="hljs-attribute">type</span>": <span class="hljs-value"><span class="hljs-string">"array"</span>
</span>}</span>,
"<span class="hljs-attribute">timeline</span>": <span class="hljs-value">{
"<span class="hljs-attribute">type</span>": <span class="hljs-value"><span class="hljs-string">"array"</span>
</span>}</span>,
"<span class="hljs-attribute">smtp</span>": <span class="hljs-value">{
"<span class="hljs-attribute">type</span>": <span class="hljs-value"><span class="hljs-string">"object"</span></span>,
"<span class="hljs-attribute">properties</span>": <span class="hljs-value">{
"<span class="hljs-attribute">id</span>": <span class="hljs-value">{
"<span class="hljs-attribute">type</span>": <span class="hljs-value"><span class="hljs-string">"number"</span></span>,
"<span class="hljs-attribute">description</span>": <span class="hljs-value"><span class="hljs-string">"Unique identifier"</span>
</span>}
</span>}</span>,
"<span class="hljs-attribute">required</span>": <span class="hljs-value">[
<span class="hljs-string">"id"</span>
]
</span>}</span>,
"<span class="hljs-attribute">url</span>": <span class="hljs-value">{
"<span class="hljs-attribute">type</span>": <span class="hljs-value"><span class="hljs-string">"string"</span></span>,
"<span class="hljs-attribute">description</span>": <span class="hljs-value"><span class="hljs-string">"The URL used in the Template sent to users"</span>
</span>}
</span>}</span>,
"<span class="hljs-attribute">required</span>": <span class="hljs-value">[
<span class="hljs-string">"id"</span>,
<span class="hljs-string">"name"</span>,
<span class="hljs-string">"status"</span>,
<span class="hljs-string">"url"</span>
]</span>,
"<span class="hljs-attribute">$schema</span>": <span class="hljs-value"><span class="hljs-string">"http://json-schema.org/draft-04/schema#"</span>
</span>}</code></pre><div style="height: 1px;"></div></div></div><div class="title"><strong>Response&nbsp;&nbsp;<code>404</code></strong><div class="collapse-button"><span class="close">Hide</span><span class="open">Show</span></div></div><div class="collapse-content"><div class="inner"><h5>Headers</h5><pre><code><span class="hljs-attribute">Content-Type</span>: <span class="hljs-string">application/json</span></code></pre><div style="height: 1px;"></div><h5>Body</h5><pre><code>{
"<span class="hljs-attribute">message</span>": <span class="hljs-value"><span class="hljs-string">"Campaign not found"</span></span>,
"<span class="hljs-attribute">success</span>": <span class="hljs-value"><span class="hljs-literal">false</span></span>,
"<span class="hljs-attribute">data</span>": <span class="hljs-value"><span class="hljs-literal">null</span>
</span>}</code></pre><div style="height: 1px;"></div></div></div></div><div id="campaigns-campaign-delete" class="action delete"><h4 class="action-heading"><div class="name">Delete a Campaign</div><a href="#campaigns-campaign-delete" class="method delete">DELETE</a><code class="uri">/campaigns/{id}</code></h4><p>Delete a campaign by its ID.</p>
<div class="title"><strong>Parameters</strong><div class="collapse-button show"><span class="close">Hide</span><span class="open">Show</span></div></div><div class="collapse-content"><dl class="inner"><dt>id</dt><dd><code>number</code>&nbsp;<span class="required">(required)</span>&nbsp;<span class="text-muted example"><strong>Example:&nbsp;</strong><span>1</span></span><p>The Campaign ID</p>
</dd></dl></div><div class="title"><strong>Response&nbsp;&nbsp;<code>200</code></strong><div class="collapse-button"><span class="close">Hide</span><span class="open">Show</span></div></div><div class="collapse-content"><div class="inner"><h5>Headers</h5><pre><code><span class="hljs-attribute">Content-Type</span>: <span class="hljs-string">application/json</span></code></pre><div style="height: 1px;"></div><h5>Body</h5><pre><code>{
"<span class="hljs-attribute">message</span>": <span class="hljs-value"><span class="hljs-string">"Page deleted successfully!"</span></span>,
"<span class="hljs-attribute">success</span>": <span class="hljs-value"><span class="hljs-literal">true</span></span>,
"<span class="hljs-attribute">data</span>": <span class="hljs-value"><span class="hljs-literal">null</span>
</span>}</code></pre><div style="height: 1px;"></div></div></div><div class="title"><strong>Response&nbsp;&nbsp;<code>404</code></strong><div class="collapse-button"><span class="close">Hide</span><span class="open">Show</span></div></div><div class="collapse-content"><div class="inner"><h5>Headers</h5><pre><code><span class="hljs-attribute">Content-Type</span>: <span class="hljs-string">application/json</span></code></pre><div style="height: 1px;"></div><h5>Body</h5><pre><code>{
"<span class="hljs-attribute">message</span>": <span class="hljs-value"><span class="hljs-string">"Campaign not found"</span></span>,
"<span class="hljs-attribute">success</span>": <span class="hljs-value"><span class="hljs-literal">false</span></span>,
"<span class="hljs-attribute">data</span>": <span class="hljs-value"><span class="hljs-literal">null</span>
</span>}</code></pre><div style="height: 1px;"></div></div></div></div></div></section><section id="templates" class="resource-group"><h2 class="group-heading">Templates<a href="#templates" class="permalink">&para;</a></h2><p>Templates define what email content is sent to targets during campaigns. It contains the subject of the email as well as the HTML and text content of the email.</p>
<ul>
<li>
<p><code>id</code>: 1 (required, number) - Unique identifier</p>
</li>
<li>
<p><code>name</code>: Example Template (required) - Name of template</p>
</li>
<li>
<p><code>subject</code>: Example email template subject - Subject of email sent to users</p>
</li>
<li>
<p><code>text</code>: <code>This is a test message!</code> - Raw text of email sent to users</p>
</li>
<li>
<p><code>html</code>: <code>&lt;html&gt;&lt;head&gt;&lt;/head&gt;&lt;body&gt;This is a test message!&lt;/body&gt;&lt;/html&gt;</code> - HTML of email sent to users</p>
</li>
<li>
<p><code>attachments</code>: Attributes (AttachmentList) - The attachments sent with the email template</p>
</li>
<li>
<p><code>modified_date</code>: <code>2015-01-01T01:02:03.000000Z</code> (string) - Date the Template was last modified</p>
</li>
</ul>
<p>You can also attach files or payloads to the emails that you send. These are attached as a list of Attachment objects.</p>
<p>Attachments have the following attributes:</p>
<ul>
<li>
<p><code>id</code>: 1 (required, number) - Unique identifier</p>
</li>
<li>
<p><code>name</code>: Example Attachment (required) - Filename of Attachment</p>
</li>
<li>
<p><code>content</code>: Base64 encoded attachment content</p>
</li>
<li>
<p><code>type</code>: <code>text/plain</code> - MIME type of the Attachment</p>
</li>
</ul>
<div id="templates-templates" class="resource"><h3 class="resource-heading">Templates<a href="#templates-templates" class="permalink">&para;</a></h3><div id="templates-templates-get" class="action get"><h4 class="action-heading"><div class="name">Get Templates</div><a href="#templates-templates-get" class="method get">GET</a><code class="uri">/templates</code></h4><p>Get a list of templates.</p>
<div class="title"><strong>Response&nbsp;&nbsp;<code>200</code></strong><div class="collapse-button"><span class="close">Hide</span><span class="open">Show</span></div></div><div class="collapse-content"><div class="inner"><h5>Headers</h5><pre><code><span class="hljs-attribute">Content-Type</span>: <span class="hljs-string">application/json</span></code></pre><div style="height: 1px;"></div><h5>Body</h5><pre><code>[
{
"<span class="hljs-attribute">id</span>": <span class="hljs-value"><span class="hljs-number">1</span></span>,
"<span class="hljs-attribute">name</span>": <span class="hljs-value"><span class="hljs-string">"Example Template"</span></span>,
"<span class="hljs-attribute">subject</span>": <span class="hljs-value"><span class="hljs-string">"Example email template subject"</span></span>,
"<span class="hljs-attribute">text</span>": <span class="hljs-value"><span class="hljs-string">"This is a test message!"</span></span>,
"<span class="hljs-attribute">html</span>": <span class="hljs-value"><span class="hljs-string">"&lt;html&gt;&lt;head&gt;&lt;/head&gt;&lt;body&gt;This is a test message!&lt;/body&gt;&lt;/html&gt;"</span></span>,
"<span class="hljs-attribute">attachments</span>": <span class="hljs-value">[]</span>,
"<span class="hljs-attribute">modified_date</span>": <span class="hljs-value"><span class="hljs-string">"2015-01-01T01:02:03.000000Z"</span>
</span>}
]</code></pre><div style="height: 1px;"></div><h5>Schema</h5><pre><code>{
"<span class="hljs-attribute">type</span>": <span class="hljs-value"><span class="hljs-string">"array"</span></span>,
"<span class="hljs-attribute">$schema</span>": <span class="hljs-value"><span class="hljs-string">"http://json-schema.org/draft-04/schema#"</span>
</span>}</code></pre><div style="height: 1px;"></div></div></div></div><div id="templates-templates-post" class="action post"><h4 class="action-heading"><div class="name">Create New Template</div><a href="#templates-templates-post" class="method post">POST</a><code class="uri">/templates</code></h4><p>Create a new template</p>
<div class="note">
<h2 id="header-importing-an-existing-email">Importing an Existing Email <a class="permalink" href="#header-importing-an-existing-email" aria-hidden="true"></a></h2>
<p>What better way to make pixel-perfect emails than by importing an existing email you already have sitting in your inbox?</p>
<p>Using the <a href="#import-email">Import Email</a> endpoint, you can take a raw email and import it as a template into gophish.</p>
</div>
<div class="title"><strong>Request</strong><div class="collapse-button"><span class="close">Hide</span><span class="open">Show</span></div></div><div class="collapse-content"><div class="inner"><h5>Headers</h5><pre><code><span class="hljs-attribute">Content-Type</span>: <span class="hljs-string">application/json</span></code></pre><div style="height: 1px;"></div><h5>Body</h5><pre><code>{
"<span class="hljs-attribute">id</span>": <span class="hljs-value"><span class="hljs-number">1</span></span>,
"<span class="hljs-attribute">name</span>": <span class="hljs-value"><span class="hljs-string">"Example Template"</span></span>,
"<span class="hljs-attribute">subject</span>": <span class="hljs-value"><span class="hljs-string">"Example email template subject"</span></span>,
"<span class="hljs-attribute">text</span>": <span class="hljs-value"><span class="hljs-string">"This is a test message!"</span></span>,
"<span class="hljs-attribute">html</span>": <span class="hljs-value"><span class="hljs-string">"&lt;html&gt;&lt;head&gt;&lt;/head&gt;&lt;body&gt;This is a test message!&lt;/body&gt;&lt;/html&gt;"</span></span>,
"<span class="hljs-attribute">attachments</span>": <span class="hljs-value">[]</span>,
"<span class="hljs-attribute">modified_date</span>": <span class="hljs-value"><span class="hljs-string">"2015-01-01T01:02:03.000000Z"</span>
</span>}</code></pre><div style="height: 1px;"></div><h5>Schema</h5><pre><code>{
"<span class="hljs-attribute">type</span>": <span class="hljs-value"><span class="hljs-string">"object"</span></span>,
"<span class="hljs-attribute">properties</span>": <span class="hljs-value">{
"<span class="hljs-attribute">id</span>": <span class="hljs-value">{
"<span class="hljs-attribute">type</span>": <span class="hljs-value"><span class="hljs-string">"number"</span></span>,
"<span class="hljs-attribute">description</span>": <span class="hljs-value"><span class="hljs-string">"Unique identifier"</span>
</span>}</span>,
"<span class="hljs-attribute">name</span>": <span class="hljs-value">{
"<span class="hljs-attribute">type</span>": <span class="hljs-value"><span class="hljs-string">"string"</span></span>,
"<span class="hljs-attribute">description</span>": <span class="hljs-value"><span class="hljs-string">"Name of template"</span>
</span>}</span>,
"<span class="hljs-attribute">subject</span>": <span class="hljs-value">{
"<span class="hljs-attribute">type</span>": <span class="hljs-value"><span class="hljs-string">"string"</span></span>,
"<span class="hljs-attribute">description</span>": <span class="hljs-value"><span class="hljs-string">"Subject of email sent to users"</span>
</span>}</span>,
"<span class="hljs-attribute">text</span>": <span class="hljs-value">{
"<span class="hljs-attribute">type</span>": <span class="hljs-value"><span class="hljs-string">"string"</span></span>,
"<span class="hljs-attribute">description</span>": <span class="hljs-value"><span class="hljs-string">"Raw text of email sent to users"</span>
</span>}</span>,
"<span class="hljs-attribute">html</span>": <span class="hljs-value">{
"<span class="hljs-attribute">type</span>": <span class="hljs-value"><span class="hljs-string">"string"</span></span>,
"<span class="hljs-attribute">description</span>": <span class="hljs-value"><span class="hljs-string">"HTML of email sent to users"</span>
</span>}</span>,
"<span class="hljs-attribute">attachments</span>": <span class="hljs-value">{
"<span class="hljs-attribute">type</span>": <span class="hljs-value"><span class="hljs-string">"array"</span></span>,
"<span class="hljs-attribute">description</span>": <span class="hljs-value"><span class="hljs-string">"The attachments sent with the email template"</span>
</span>}</span>,
"<span class="hljs-attribute">modified_date</span>": <span class="hljs-value">{
"<span class="hljs-attribute">type</span>": <span class="hljs-value"><span class="hljs-string">"string"</span></span>,
"<span class="hljs-attribute">description</span>": <span class="hljs-value"><span class="hljs-string">"Date the Template was last modified"</span>
</span>}
</span>}</span>,
"<span class="hljs-attribute">required</span>": <span class="hljs-value">[
<span class="hljs-string">"id"</span>,
<span class="hljs-string">"name"</span>
]</span>,
"<span class="hljs-attribute">$schema</span>": <span class="hljs-value"><span class="hljs-string">"http://json-schema.org/draft-04/schema#"</span>
</span>}</code></pre><div style="height: 1px;"></div></div></div><div class="title"><strong>Response&nbsp;&nbsp;<code>201</code></strong><div class="collapse-button"><span class="close">Hide</span><span class="open">Show</span></div></div><div class="collapse-content"><div class="inner"><h5>Headers</h5><pre><code><span class="hljs-attribute">Content-Type</span>: <span class="hljs-string">application/json</span></code></pre><div style="height: 1px;"></div><h5>Body</h5><pre><code>{
"<span class="hljs-attribute">id</span>": <span class="hljs-value"><span class="hljs-number">1</span></span>,
"<span class="hljs-attribute">name</span>": <span class="hljs-value"><span class="hljs-string">"Example Template"</span></span>,
"<span class="hljs-attribute">subject</span>": <span class="hljs-value"><span class="hljs-string">"Example email template subject"</span></span>,
"<span class="hljs-attribute">text</span>": <span class="hljs-value"><span class="hljs-string">"This is a test message!"</span></span>,
"<span class="hljs-attribute">html</span>": <span class="hljs-value"><span class="hljs-string">"&lt;html&gt;&lt;head&gt;&lt;/head&gt;&lt;body&gt;This is a test message!&lt;/body&gt;&lt;/html&gt;"</span></span>,
"<span class="hljs-attribute">attachments</span>": <span class="hljs-value">[]</span>,
"<span class="hljs-attribute">modified_date</span>": <span class="hljs-value"><span class="hljs-string">"2015-01-01T01:02:03.000000Z"</span>
</span>}</code></pre><div style="height: 1px;"></div><h5>Schema</h5><pre><code>{
"<span class="hljs-attribute">type</span>": <span class="hljs-value"><span class="hljs-string">"object"</span></span>,
"<span class="hljs-attribute">properties</span>": <span class="hljs-value">{
"<span class="hljs-attribute">id</span>": <span class="hljs-value">{
"<span class="hljs-attribute">type</span>": <span class="hljs-value"><span class="hljs-string">"number"</span></span>,
"<span class="hljs-attribute">description</span>": <span class="hljs-value"><span class="hljs-string">"Unique identifier"</span>
</span>}</span>,
"<span class="hljs-attribute">name</span>": <span class="hljs-value">{
"<span class="hljs-attribute">type</span>": <span class="hljs-value"><span class="hljs-string">"string"</span></span>,
"<span class="hljs-attribute">description</span>": <span class="hljs-value"><span class="hljs-string">"Name of template"</span>
</span>}</span>,
"<span class="hljs-attribute">subject</span>": <span class="hljs-value">{
"<span class="hljs-attribute">type</span>": <span class="hljs-value"><span class="hljs-string">"string"</span></span>,
"<span class="hljs-attribute">description</span>": <span class="hljs-value"><span class="hljs-string">"Subject of email sent to users"</span>
</span>}</span>,
"<span class="hljs-attribute">text</span>": <span class="hljs-value">{
"<span class="hljs-attribute">type</span>": <span class="hljs-value"><span class="hljs-string">"string"</span></span>,
"<span class="hljs-attribute">description</span>": <span class="hljs-value"><span class="hljs-string">"Raw text of email sent to users"</span>
</span>}</span>,
"<span class="hljs-attribute">html</span>": <span class="hljs-value">{
"<span class="hljs-attribute">type</span>": <span class="hljs-value"><span class="hljs-string">"string"</span></span>,
"<span class="hljs-attribute">description</span>": <span class="hljs-value"><span class="hljs-string">"HTML of email sent to users"</span>
</span>}</span>,
"<span class="hljs-attribute">attachments</span>": <span class="hljs-value">{
"<span class="hljs-attribute">type</span>": <span class="hljs-value"><span class="hljs-string">"array"</span></span>,
"<span class="hljs-attribute">description</span>": <span class="hljs-value"><span class="hljs-string">"The attachments sent with the email template"</span>
</span>}</span>,
"<span class="hljs-attribute">modified_date</span>": <span class="hljs-value">{
"<span class="hljs-attribute">type</span>": <span class="hljs-value"><span class="hljs-string">"string"</span></span>,
"<span class="hljs-attribute">description</span>": <span class="hljs-value"><span class="hljs-string">"Date the Template was last modified"</span>
</span>}
</span>}</span>,
"<span class="hljs-attribute">required</span>": <span class="hljs-value">[
<span class="hljs-string">"id"</span>,
<span class="hljs-string">"name"</span>
]</span>,
"<span class="hljs-attribute">$schema</span>": <span class="hljs-value"><span class="hljs-string">"http://json-schema.org/draft-04/schema#"</span>
</span>}</code></pre><div style="height: 1px;"></div></div></div><div class="title"><strong>Response&nbsp;&nbsp;<code>400</code></strong><div class="collapse-button"><span class="close">Hide</span><span class="open">Show</span></div></div><div class="collapse-content"><div class="inner"><h5>Headers</h5><pre><code><span class="hljs-attribute">Content-Type</span>: <span class="hljs-string">application/json</span></code></pre><div style="height: 1px;"></div><h5>Body</h5><pre><code>{
"<span class="hljs-attribute">message</span>": <span class="hljs-value"><span class="hljs-string">"\"Error message\""</span></span>,
"<span class="hljs-attribute">success</span>": <span class="hljs-value"><span class="hljs-string">"false"</span></span>,
"<span class="hljs-attribute">data</span>": <span class="hljs-value"><span class="hljs-string">"Any associated data"</span>
</span>}</code></pre><div style="height: 1px;"></div><h5>Schema</h5><pre><code>{
"<span class="hljs-attribute">type</span>": <span class="hljs-value"><span class="hljs-string">"object"</span></span>,
"<span class="hljs-attribute">properties</span>": <span class="hljs-value">{
"<span class="hljs-attribute">message</span>": <span class="hljs-value">{
"<span class="hljs-attribute">type</span>": <span class="hljs-value"><span class="hljs-string">"string"</span></span>,
"<span class="hljs-attribute">description</span>": <span class="hljs-value"><span class="hljs-string">"The detailed error message"</span>
</span>}</span>,
"<span class="hljs-attribute">success</span>": <span class="hljs-value">{
"<span class="hljs-attribute">type</span>": <span class="hljs-value"><span class="hljs-string">"string"</span></span>,
"<span class="hljs-attribute">description</span>": <span class="hljs-value"><span class="hljs-string">"The success status of the request"</span>
</span>}</span>,
"<span class="hljs-attribute">data</span>": <span class="hljs-value">{
"<span class="hljs-attribute">type</span>": <span class="hljs-value"><span class="hljs-string">"string"</span>
</span>}
</span>}</span>,
"<span class="hljs-attribute">$schema</span>": <span class="hljs-value"><span class="hljs-string">"http://json-schema.org/draft-04/schema#"</span>
</span>}</code></pre><div style="height: 1px;"></div></div></div></div></div><div id="templates-template" class="resource"><h3 class="resource-heading">Template<a href="#templates-template" class="permalink">&para;</a></h3><div id="templates-template-get" class="action get"><h4 class="action-heading"><div class="name">Get Template</div><a href="#templates-template-get" class="method get">GET</a><code class="uri">/templates/{id}</code></h4><p>Get a template by its ID.</p>
<div class="title"><strong>Parameters</strong><div class="collapse-button show"><span class="close">Hide</span><span class="open">Show</span></div></div><div class="collapse-content"><dl class="inner"><dt>id</dt><dd><code>number</code>&nbsp;<span class="required">(required)</span>&nbsp;<span class="text-muted example"><strong>Example:&nbsp;</strong><span>1</span></span><p>The Template ID</p>
</dd></dl></div><div class="title"><strong>Response&nbsp;&nbsp;<code>200</code></strong><div class="collapse-button"><span class="close">Hide</span><span class="open">Show</span></div></div><div class="collapse-content"><div class="inner"><h5>Headers</h5><pre><code><span class="hljs-attribute">Content-Type</span>: <span class="hljs-string">application/json</span></code></pre><div style="height: 1px;"></div><h5>Body</h5><pre><code>{
"<span class="hljs-attribute">id</span>": <span class="hljs-value"><span class="hljs-number">1</span></span>,
"<span class="hljs-attribute">name</span>": <span class="hljs-value"><span class="hljs-string">"Example Template"</span></span>,
"<span class="hljs-attribute">subject</span>": <span class="hljs-value"><span class="hljs-string">"Example email template subject"</span></span>,
"<span class="hljs-attribute">text</span>": <span class="hljs-value"><span class="hljs-string">"This is a test message!"</span></span>,
"<span class="hljs-attribute">html</span>": <span class="hljs-value"><span class="hljs-string">"&lt;html&gt;&lt;head&gt;&lt;/head&gt;&lt;body&gt;This is a test message!&lt;/body&gt;&lt;/html&gt;"</span></span>,
"<span class="hljs-attribute">attachments</span>": <span class="hljs-value">[]</span>,
"<span class="hljs-attribute">modified_date</span>": <span class="hljs-value"><span class="hljs-string">"2015-01-01T01:02:03.000000Z"</span>
</span>}</code></pre><div style="height: 1px;"></div><h5>Schema</h5><pre><code>{
"<span class="hljs-attribute">type</span>": <span class="hljs-value"><span class="hljs-string">"object"</span></span>,
"<span class="hljs-attribute">properties</span>": <span class="hljs-value">{
"<span class="hljs-attribute">id</span>": <span class="hljs-value">{
"<span class="hljs-attribute">type</span>": <span class="hljs-value"><span class="hljs-string">"number"</span></span>,
"<span class="hljs-attribute">description</span>": <span class="hljs-value"><span class="hljs-string">"Unique identifier"</span>
</span>}</span>,
"<span class="hljs-attribute">name</span>": <span class="hljs-value">{
"<span class="hljs-attribute">type</span>": <span class="hljs-value"><span class="hljs-string">"string"</span></span>,
"<span class="hljs-attribute">description</span>": <span class="hljs-value"><span class="hljs-string">"Name of template"</span>
</span>}</span>,
"<span class="hljs-attribute">subject</span>": <span class="hljs-value">{
"<span class="hljs-attribute">type</span>": <span class="hljs-value"><span class="hljs-string">"string"</span></span>,
"<span class="hljs-attribute">description</span>": <span class="hljs-value"><span class="hljs-string">"Subject of email sent to users"</span>
</span>}</span>,
"<span class="hljs-attribute">text</span>": <span class="hljs-value">{
"<span class="hljs-attribute">type</span>": <span class="hljs-value"><span class="hljs-string">"string"</span></span>,
"<span class="hljs-attribute">description</span>": <span class="hljs-value"><span class="hljs-string">"Raw text of email sent to users"</span>
</span>}</span>,
"<span class="hljs-attribute">html</span>": <span class="hljs-value">{
"<span class="hljs-attribute">type</span>": <span class="hljs-value"><span class="hljs-string">"string"</span></span>,
"<span class="hljs-attribute">description</span>": <span class="hljs-value"><span class="hljs-string">"HTML of email sent to users"</span>
</span>}</span>,
"<span class="hljs-attribute">attachments</span>": <span class="hljs-value">{
"<span class="hljs-attribute">type</span>": <span class="hljs-value"><span class="hljs-string">"array"</span></span>,
"<span class="hljs-attribute">description</span>": <span class="hljs-value"><span class="hljs-string">"The attachments sent with the email template"</span>
</span>}</span>,
"<span class="hljs-attribute">modified_date</span>": <span class="hljs-value">{
"<span class="hljs-attribute">type</span>": <span class="hljs-value"><span class="hljs-string">"string"</span></span>,
"<span class="hljs-attribute">description</span>": <span class="hljs-value"><span class="hljs-string">"Date the Template was last modified"</span>
</span>}
</span>}</span>,
"<span class="hljs-attribute">required</span>": <span class="hljs-value">[
<span class="hljs-string">"id"</span>,
<span class="hljs-string">"name"</span>
]</span>,
"<span class="hljs-attribute">$schema</span>": <span class="hljs-value"><span class="hljs-string">"http://json-schema.org/draft-04/schema#"</span>
</span>}</code></pre><div style="height: 1px;"></div></div></div><div class="title"><strong>Response&nbsp;&nbsp;<code>404</code></strong><div class="collapse-button"><span class="close">Hide</span><span class="open">Show</span></div></div><div class="collapse-content"><div class="inner"><h5>Headers</h5><pre><code><span class="hljs-attribute">Content-Type</span>: <span class="hljs-string">application/json</span></code></pre><div style="height: 1px;"></div><h5>Body</h5><pre><code>{
"<span class="hljs-attribute">message</span>": <span class="hljs-value"><span class="hljs-string">"Template not found"</span></span>,
"<span class="hljs-attribute">success</span>": <span class="hljs-value"><span class="hljs-literal">false</span></span>,
"<span class="hljs-attribute">data</span>": <span class="hljs-value"><span class="hljs-literal">null</span>
</span>}</code></pre><div style="height: 1px;"></div></div></div></div><div id="templates-template-delete" class="action delete"><h4 class="action-heading"><div class="name">Delete a Template</div><a href="#templates-template-delete" class="method delete">DELETE</a><code class="uri">/templates/{id}</code></h4><p>Delete a template by its ID.</p>
<div class="title"><strong>Parameters</strong><div class="collapse-button show"><span class="close">Hide</span><span class="open">Show</span></div></div><div class="collapse-content"><dl class="inner"><dt>id</dt><dd><code>number</code>&nbsp;<span class="required">(required)</span>&nbsp;<span class="text-muted example"><strong>Example:&nbsp;</strong><span>1</span></span><p>The Template ID</p>
</dd></dl></div><div class="title"><strong>Response&nbsp;&nbsp;<code>200</code></strong><div class="collapse-button"><span class="close">Hide</span><span class="open">Show</span></div></div><div class="collapse-content"><div class="inner"><h5>Headers</h5><pre><code><span class="hljs-attribute">Content-Type</span>: <span class="hljs-string">application/json</span></code></pre><div style="height: 1px;"></div><h5>Body</h5><pre><code>{
"<span class="hljs-attribute">message</span>": <span class="hljs-value"><span class="hljs-string">"Template deleted successfully!"</span></span>,
"<span class="hljs-attribute">success</span>": <span class="hljs-value"><span class="hljs-literal">true</span></span>,
"<span class="hljs-attribute">data</span>": <span class="hljs-value"><span class="hljs-literal">null</span>
</span>}</code></pre><div style="height: 1px;"></div></div></div><div class="title"><strong>Response&nbsp;&nbsp;<code>404</code></strong><div class="collapse-button"><span class="close">Hide</span><span class="open">Show</span></div></div><div class="collapse-content"><div class="inner"><h5>Headers</h5><pre><code><span class="hljs-attribute">Content-Type</span>: <span class="hljs-string">application/json</span></code></pre><div style="height: 1px;"></div><h5>Body</h5><pre><code>{
"<span class="hljs-attribute">message</span>": <span class="hljs-value"><span class="hljs-string">"Template not found"</span></span>,
"<span class="hljs-attribute">success</span>": <span class="hljs-value"><span class="hljs-literal">false</span></span>,
"<span class="hljs-attribute">data</span>": <span class="hljs-value"><span class="hljs-literal">null</span>
</span>}</code></pre><div style="height: 1px;"></div></div></div></div></div></section><section id="groups" class="resource-group"><h2 class="group-heading">Groups<a href="#groups" class="permalink">&para;</a></h2><p>Groups contain the details for one or more users targeted in the simulated phishing campaign. Groups contain the following attributes:</p>
<ul>
<li>
<p><code>id</code>: 1 (required, number) - Unique identifier</p>
</li>
<li>
<p><code>name</code>: Example Group (required) - Name of the Group</p>
</li>
<li>
<p><code>modified_date</code>: <code>2015-01-01T01:02:03.000000Z</code> (string) - Date the Group was last modified</p>
</li>
<li>
<p><code>targets</code>: Attributes (TargetList) (required) - The targets in the group</p>
</li>
</ul>
<p>Each target contains the following attributes:</p>
<ul>
<li>
<p><code>id</code>: 1 (required, number) - Unique identifier</p>
</li>
<li>
<p><code>first_name</code>: John - First name of Target</p>
</li>
<li>
<p><code>last_name</code>: Doe - Last name of Target</p>
</li>
<li>
<p><code>email</code>: <a href="mailto:john.doe@example.com">john.doe@example.com</a> - Email address of Target</p>
</li>
<li>
<p><code>position</code>: System Administrator - Company position of the Target</p>
</li>
</ul>
<div class="note">
<h2 id="header-have-a-lot-of-users-to-import?">Have A Lot of Users to Import? <a class="permalink" href="#header-have-a-lot-of-users-to-import?" aria-hidden="true"></a></h2>
<p>If you have all your targets in a CSV file, you can bulk import them into a group using the <a href="#import-group">Import CSV</a> endpoint.</p>
<p>In the future, we plan to add other importation methods to make setting up groups a breeze.</p>
</div>
<div id="groups-groups" class="resource"><h3 class="resource-heading">Groups<a href="#groups-groups" class="permalink">&para;</a></h3><div id="groups-groups-get" class="action get"><h4 class="action-heading"><div class="name">Get Groups</div><a href="#groups-groups-get" class="method get">GET</a><code class="uri">/groups</code></h4><p>Get a list of groups.</p>
<div class="title"><strong>Response&nbsp;&nbsp;<code>200</code></strong><div class="collapse-button"><span class="close">Hide</span><span class="open">Show</span></div></div><div class="collapse-content"><div class="inner"><h5>Headers</h5><pre><code><span class="hljs-attribute">Content-Type</span>: <span class="hljs-string">application/json</span></code></pre><div style="height: 1px;"></div><h5>Body</h5><pre><code>[
{
"<span class="hljs-attribute">id</span>": <span class="hljs-value"><span class="hljs-number">1</span></span>,
"<span class="hljs-attribute">name</span>": <span class="hljs-value"><span class="hljs-string">"Example Group"</span></span>,
"<span class="hljs-attribute">modified_date</span>": <span class="hljs-value"><span class="hljs-string">"2015-01-01T01:02:03.000000Z"</span></span>,
"<span class="hljs-attribute">targets</span>": <span class="hljs-value">[]
</span>}
]</code></pre><div style="height: 1px;"></div><h5>Schema</h5><pre><code>{
"<span class="hljs-attribute">type</span>": <span class="hljs-value"><span class="hljs-string">"array"</span></span>,
"<span class="hljs-attribute">$schema</span>": <span class="hljs-value"><span class="hljs-string">"http://json-schema.org/draft-04/schema#"</span>
</span>}</code></pre><div style="height: 1px;"></div></div></div></div><div id="groups-groups-post" class="action post"><h4 class="action-heading"><div class="name">Create New Group</div><a href="#groups-groups-post" class="method post">POST</a><code class="uri">/groups</code></h4><p>Create a new group</p>
<div class="title"><strong>Request</strong><div class="collapse-button"><span class="close">Hide</span><span class="open">Show</span></div></div><div class="collapse-content"><div class="inner"><h5>Headers</h5><pre><code><span class="hljs-attribute">Content-Type</span>: <span class="hljs-string">application/json</span></code></pre><div style="height: 1px;"></div><h5>Body</h5><pre><code>{
"<span class="hljs-attribute">id</span>": <span class="hljs-value"><span class="hljs-number">1</span></span>,
"<span class="hljs-attribute">name</span>": <span class="hljs-value"><span class="hljs-string">"Example Group"</span></span>,
"<span class="hljs-attribute">modified_date</span>": <span class="hljs-value"><span class="hljs-string">"2015-01-01T01:02:03.000000Z"</span></span>,
"<span class="hljs-attribute">targets</span>": <span class="hljs-value">[]
</span>}</code></pre><div style="height: 1px;"></div><h5>Schema</h5><pre><code>{
"<span class="hljs-attribute">type</span>": <span class="hljs-value"><span class="hljs-string">"object"</span></span>,
"<span class="hljs-attribute">properties</span>": <span class="hljs-value">{
"<span class="hljs-attribute">id</span>": <span class="hljs-value">{
"<span class="hljs-attribute">type</span>": <span class="hljs-value"><span class="hljs-string">"number"</span></span>,
"<span class="hljs-attribute">description</span>": <span class="hljs-value"><span class="hljs-string">"Unique identifier"</span>
</span>}</span>,
"<span class="hljs-attribute">name</span>": <span class="hljs-value">{
"<span class="hljs-attribute">type</span>": <span class="hljs-value"><span class="hljs-string">"string"</span></span>,
"<span class="hljs-attribute">description</span>": <span class="hljs-value"><span class="hljs-string">"Name of the Group"</span>
</span>}</span>,
"<span class="hljs-attribute">modified_date</span>": <span class="hljs-value">{
"<span class="hljs-attribute">type</span>": <span class="hljs-value"><span class="hljs-string">"string"</span></span>,
"<span class="hljs-attribute">description</span>": <span class="hljs-value"><span class="hljs-string">"Date the Group was last modified"</span>
</span>}</span>,
"<span class="hljs-attribute">targets</span>": <span class="hljs-value">{
"<span class="hljs-attribute">type</span>": <span class="hljs-value"><span class="hljs-string">"array"</span>
</span>}
</span>}</span>,
"<span class="hljs-attribute">required</span>": <span class="hljs-value">[
<span class="hljs-string">"id"</span>,
<span class="hljs-string">"name"</span>
]</span>,
"<span class="hljs-attribute">$schema</span>": <span class="hljs-value"><span class="hljs-string">"http://json-schema.org/draft-04/schema#"</span>
</span>}</code></pre><div style="height: 1px;"></div></div></div><div class="title"><strong>Response&nbsp;&nbsp;<code>201</code></strong><div class="collapse-button"><span class="close">Hide</span><span class="open">Show</span></div></div><div class="collapse-content"><div class="inner"><h5>Headers</h5><pre><code><span class="hljs-attribute">Content-Type</span>: <span class="hljs-string">application/json</span></code></pre><div style="height: 1px;"></div><h5>Body</h5><pre><code>{
"<span class="hljs-attribute">id</span>": <span class="hljs-value"><span class="hljs-number">1</span></span>,
"<span class="hljs-attribute">name</span>": <span class="hljs-value"><span class="hljs-string">"Example Group"</span></span>,
"<span class="hljs-attribute">modified_date</span>": <span class="hljs-value"><span class="hljs-string">"2015-01-01T01:02:03.000000Z"</span></span>,
"<span class="hljs-attribute">targets</span>": <span class="hljs-value">[]
</span>}</code></pre><div style="height: 1px;"></div><h5>Schema</h5><pre><code>{
"<span class="hljs-attribute">type</span>": <span class="hljs-value"><span class="hljs-string">"object"</span></span>,
"<span class="hljs-attribute">properties</span>": <span class="hljs-value">{
"<span class="hljs-attribute">id</span>": <span class="hljs-value">{
"<span class="hljs-attribute">type</span>": <span class="hljs-value"><span class="hljs-string">"number"</span></span>,
"<span class="hljs-attribute">description</span>": <span class="hljs-value"><span class="hljs-string">"Unique identifier"</span>
</span>}</span>,
"<span class="hljs-attribute">name</span>": <span class="hljs-value">{
"<span class="hljs-attribute">type</span>": <span class="hljs-value"><span class="hljs-string">"string"</span></span>,
"<span class="hljs-attribute">description</span>": <span class="hljs-value"><span class="hljs-string">"Name of the Group"</span>
</span>}</span>,
"<span class="hljs-attribute">modified_date</span>": <span class="hljs-value">{
"<span class="hljs-attribute">type</span>": <span class="hljs-value"><span class="hljs-string">"string"</span></span>,
"<span class="hljs-attribute">description</span>": <span class="hljs-value"><span class="hljs-string">"Date the Group was last modified"</span>
</span>}</span>,
"<span class="hljs-attribute">targets</span>": <span class="hljs-value">{
"<span class="hljs-attribute">type</span>": <span class="hljs-value"><span class="hljs-string">"array"</span>
</span>}
</span>}</span>,
"<span class="hljs-attribute">required</span>": <span class="hljs-value">[
<span class="hljs-string">"id"</span>,
<span class="hljs-string">"name"</span>
]</span>,
"<span class="hljs-attribute">$schema</span>": <span class="hljs-value"><span class="hljs-string">"http://json-schema.org/draft-04/schema#"</span>
</span>}</code></pre><div style="height: 1px;"></div></div></div><div class="title"><strong>Response&nbsp;&nbsp;<code>400</code></strong><div class="collapse-button"><span class="close">Hide</span><span class="open">Show</span></div></div><div class="collapse-content"><div class="inner"><h5>Headers</h5><pre><code><span class="hljs-attribute">Content-Type</span>: <span class="hljs-string">application/json</span></code></pre><div style="height: 1px;"></div><h5>Body</h5><pre><code>{
"<span class="hljs-attribute">message</span>": <span class="hljs-value"><span class="hljs-string">"\"Error message\""</span></span>,
"<span class="hljs-attribute">success</span>": <span class="hljs-value"><span class="hljs-string">"false"</span></span>,
"<span class="hljs-attribute">data</span>": <span class="hljs-value"><span class="hljs-string">"Any associated data"</span>
</span>}</code></pre><div style="height: 1px;"></div><h5>Schema</h5><pre><code>{
"<span class="hljs-attribute">type</span>": <span class="hljs-value"><span class="hljs-string">"object"</span></span>,
"<span class="hljs-attribute">properties</span>": <span class="hljs-value">{
"<span class="hljs-attribute">message</span>": <span class="hljs-value">{
"<span class="hljs-attribute">type</span>": <span class="hljs-value"><span class="hljs-string">"string"</span></span>,
"<span class="hljs-attribute">description</span>": <span class="hljs-value"><span class="hljs-string">"The detailed error message"</span>
</span>}</span>,
"<span class="hljs-attribute">success</span>": <span class="hljs-value">{
"<span class="hljs-attribute">type</span>": <span class="hljs-value"><span class="hljs-string">"string"</span></span>,
"<span class="hljs-attribute">description</span>": <span class="hljs-value"><span class="hljs-string">"The success status of the request"</span>
</span>}</span>,
"<span class="hljs-attribute">data</span>": <span class="hljs-value">{
"<span class="hljs-attribute">type</span>": <span class="hljs-value"><span class="hljs-string">"string"</span>
</span>}
</span>}</span>,
"<span class="hljs-attribute">$schema</span>": <span class="hljs-value"><span class="hljs-string">"http://json-schema.org/draft-04/schema#"</span>
</span>}</code></pre><div style="height: 1px;"></div></div></div></div></div><div id="groups-group" class="resource"><h3 class="resource-heading">Group<a href="#groups-group" class="permalink">&para;</a></h3><div id="groups-group-get" class="action get"><h4 class="action-heading"><div class="name">Get Group</div><a href="#groups-group-get" class="method get">GET</a><code class="uri">/groups/{id}</code></h4><p>Get a group by its ID.</p>
<div class="title"><strong>Parameters</strong><div class="collapse-button show"><span class="close">Hide</span><span class="open">Show</span></div></div><div class="collapse-content"><dl class="inner"><dt>id</dt><dd><code>number</code>&nbsp;<span class="required">(required)</span>&nbsp;<span class="text-muted example"><strong>Example:&nbsp;</strong><span>1</span></span><p>The Group ID</p>
</dd></dl></div><div class="title"><strong>Response&nbsp;&nbsp;<code>200</code></strong><div class="collapse-button"><span class="close">Hide</span><span class="open">Show</span></div></div><div class="collapse-content"><div class="inner"><h5>Headers</h5><pre><code><span class="hljs-attribute">Content-Type</span>: <span class="hljs-string">application/json</span></code></pre><div style="height: 1px;"></div><h5>Body</h5><pre><code>{
"<span class="hljs-attribute">id</span>": <span class="hljs-value"><span class="hljs-number">1</span></span>,
"<span class="hljs-attribute">name</span>": <span class="hljs-value"><span class="hljs-string">"Example Group"</span></span>,
"<span class="hljs-attribute">modified_date</span>": <span class="hljs-value"><span class="hljs-string">"2015-01-01T01:02:03.000000Z"</span></span>,
"<span class="hljs-attribute">targets</span>": <span class="hljs-value">[]
</span>}</code></pre><div style="height: 1px;"></div><h5>Schema</h5><pre><code>{
"<span class="hljs-attribute">type</span>": <span class="hljs-value"><span class="hljs-string">"object"</span></span>,
"<span class="hljs-attribute">properties</span>": <span class="hljs-value">{
"<span class="hljs-attribute">id</span>": <span class="hljs-value">{
"<span class="hljs-attribute">type</span>": <span class="hljs-value"><span class="hljs-string">"number"</span></span>,
"<span class="hljs-attribute">description</span>": <span class="hljs-value"><span class="hljs-string">"Unique identifier"</span>
</span>}</span>,
"<span class="hljs-attribute">name</span>": <span class="hljs-value">{
"<span class="hljs-attribute">type</span>": <span class="hljs-value"><span class="hljs-string">"string"</span></span>,
"<span class="hljs-attribute">description</span>": <span class="hljs-value"><span class="hljs-string">"Name of the Group"</span>
</span>}</span>,
"<span class="hljs-attribute">modified_date</span>": <span class="hljs-value">{
"<span class="hljs-attribute">type</span>": <span class="hljs-value"><span class="hljs-string">"string"</span></span>,
"<span class="hljs-attribute">description</span>": <span class="hljs-value"><span class="hljs-string">"Date the Group was last modified"</span>
</span>}</span>,
"<span class="hljs-attribute">targets</span>": <span class="hljs-value">{
"<span class="hljs-attribute">type</span>": <span class="hljs-value"><span class="hljs-string">"array"</span>
</span>}
</span>}</span>,
"<span class="hljs-attribute">required</span>": <span class="hljs-value">[
<span class="hljs-string">"id"</span>,
<span class="hljs-string">"name"</span>
]</span>,
"<span class="hljs-attribute">$schema</span>": <span class="hljs-value"><span class="hljs-string">"http://json-schema.org/draft-04/schema#"</span>
</span>}</code></pre><div style="height: 1px;"></div></div></div><div class="title"><strong>Response&nbsp;&nbsp;<code>404</code></strong><div class="collapse-button"><span class="close">Hide</span><span class="open">Show</span></div></div><div class="collapse-content"><div class="inner"><h5>Headers</h5><pre><code><span class="hljs-attribute">Content-Type</span>: <span class="hljs-string">application/json</span></code></pre><div style="height: 1px;"></div><h5>Body</h5><pre><code>{
"<span class="hljs-attribute">message</span>": <span class="hljs-value"><span class="hljs-string">"Group not found"</span></span>,
"<span class="hljs-attribute">success</span>": <span class="hljs-value"><span class="hljs-literal">false</span></span>,
"<span class="hljs-attribute">data</span>": <span class="hljs-value"><span class="hljs-literal">null</span>
</span>}</code></pre><div style="height: 1px;"></div></div></div></div><div id="groups-group-delete" class="action delete"><h4 class="action-heading"><div class="name">Delete a Group</div><a href="#groups-group-delete" class="method delete">DELETE</a><code class="uri">/groups/{id}</code></h4><p>Delete a Group by its ID.</p>
<div class="title"><strong>Parameters</strong><div class="collapse-button show"><span class="close">Hide</span><span class="open">Show</span></div></div><div class="collapse-content"><dl class="inner"><dt>id</dt><dd><code>number</code>&nbsp;<span class="required">(required)</span>&nbsp;<span class="text-muted example"><strong>Example:&nbsp;</strong><span>1</span></span><p>The Template ID</p>
</dd></dl></div><div class="title"><strong>Response&nbsp;&nbsp;<code>200</code></strong><div class="collapse-button"><span class="close">Hide</span><span class="open">Show</span></div></div><div class="collapse-content"><div class="inner"><h5>Headers</h5><pre><code><span class="hljs-attribute">Content-Type</span>: <span class="hljs-string">application/json</span></code></pre><div style="height: 1px;"></div><h5>Body</h5><pre><code>{
"<span class="hljs-attribute">message</span>": <span class="hljs-value"><span class="hljs-string">"Group deleted successfully!"</span></span>,
"<span class="hljs-attribute">success</span>": <span class="hljs-value"><span class="hljs-literal">true</span></span>,
"<span class="hljs-attribute">data</span>": <span class="hljs-value"><span class="hljs-literal">null</span>
</span>}</code></pre><div style="height: 1px;"></div></div></div><div class="title"><strong>Response&nbsp;&nbsp;<code>404</code></strong><div class="collapse-button"><span class="close">Hide</span><span class="open">Show</span></div></div><div class="collapse-content"><div class="inner"><h5>Headers</h5><pre><code><span class="hljs-attribute">Content-Type</span>: <span class="hljs-string">application/json</span></code></pre><div style="height: 1px;"></div><h5>Body</h5><pre><code>{
"<span class="hljs-attribute">message</span>": <span class="hljs-value"><span class="hljs-string">"Group not found"</span></span>,
"<span class="hljs-attribute">success</span>": <span class="hljs-value"><span class="hljs-literal">false</span></span>,
"<span class="hljs-attribute">data</span>": <span class="hljs-value"><span class="hljs-literal">null</span>
</span>}</code></pre><div style="height: 1px;"></div></div></div></div></div></section><section id="pages" class="resource-group"><h2 class="group-heading">Pages<a href="#pages" class="permalink">&para;</a></h2><p>Pages are the HTML page that a user lands on after clicking on a phishing link.</p>
<ul>
<li>
<p><code>id</code>: 1 (required, number) - Unique identifier</p>
</li>
<li>
<p><code>name</code>: Example Page (required, string) - Name of Page</p>
</li>
<li>
<p><code>html</code>: <code>&lt;html&gt;&lt;head&gt;&lt;/head&gt;&lt;body&gt;This is a test message!&lt;/body&gt;&lt;/html&gt;</code> (required, string) - HTML of the landing page users hit when clicking links in the email template</p>
</li>
<li>
<p><code>modified_date</code>: <code>2015-01-01T01:02:03.000000Z</code> (string) - Date the Page was last modified</p>
</li>
</ul>
<div class="note">
<h2 id="header-importing-a-site">Importing a Site <a class="permalink" href="#header-importing-a-site" aria-hidden="true"></a></h2>
<p>Let gophish do the hard work for you in importing a site. By using the <a href="#import-site">Import Site</a> endpoint, you can simply give gophish a URL and have the site imported for you.</p>
</div>
<div id="pages-pages" class="resource"><h3 class="resource-heading">Pages<a href="#pages-pages" class="permalink">&para;</a></h3><div id="pages-pages-get" class="action get"><h4 class="action-heading"><div class="name">Get Pages</div><a href="#pages-pages-get" class="method get">GET</a><code class="uri">/pages</code></h4><p>Get a list of pages.</p>
<div class="title"><strong>Response&nbsp;&nbsp;<code>200</code></strong><div class="collapse-button"><span class="close">Hide</span><span class="open">Show</span></div></div><div class="collapse-content"><div class="inner"><h5>Headers</h5><pre><code><span class="hljs-attribute">Content-Type</span>: <span class="hljs-string">application/json</span></code></pre><div style="height: 1px;"></div><h5>Body</h5><pre><code>[
{
"<span class="hljs-attribute">id</span>": <span class="hljs-value"><span class="hljs-number">1</span></span>,
"<span class="hljs-attribute">name</span>": <span class="hljs-value"><span class="hljs-string">"Example Page"</span></span>,
"<span class="hljs-attribute">html</span>": <span class="hljs-value"><span class="hljs-string">"&lt;html&gt;&lt;head&gt;&lt;/head&gt;&lt;body&gt;This is a test message!&lt;/body&gt;&lt;/html&gt;"</span></span>,
"<span class="hljs-attribute">modified_date</span>": <span class="hljs-value"><span class="hljs-string">"2015-01-01T01:02:03.000000Z"</span>
</span>}
]</code></pre><div style="height: 1px;"></div><h5>Schema</h5><pre><code>{
"<span class="hljs-attribute">type</span>": <span class="hljs-value"><span class="hljs-string">"array"</span></span>,
"<span class="hljs-attribute">$schema</span>": <span class="hljs-value"><span class="hljs-string">"http://json-schema.org/draft-04/schema#"</span>
</span>}</code></pre><div style="height: 1px;"></div></div></div></div><div id="pages-pages-post" class="action post"><h4 class="action-heading"><div class="name">Create New Page</div><a href="#pages-pages-post" class="method post">POST</a><code class="uri">/pages</code></h4><p>Create a new page</p>
<div class="title"><strong>Request</strong><div class="collapse-button"><span class="close">Hide</span><span class="open">Show</span></div></div><div class="collapse-content"><div class="inner"><h5>Headers</h5><pre><code><span class="hljs-attribute">Content-Type</span>: <span class="hljs-string">application/json</span></code></pre><div style="height: 1px;"></div><h5>Body</h5><pre><code>{
"<span class="hljs-attribute">id</span>": <span class="hljs-value"><span class="hljs-number">1</span></span>,
"<span class="hljs-attribute">name</span>": <span class="hljs-value"><span class="hljs-string">"Example Page"</span></span>,
"<span class="hljs-attribute">html</span>": <span class="hljs-value"><span class="hljs-string">"&lt;html&gt;&lt;head&gt;&lt;/head&gt;&lt;body&gt;This is a test message!&lt;/body&gt;&lt;/html&gt;"</span></span>,
"<span class="hljs-attribute">modified_date</span>": <span class="hljs-value"><span class="hljs-string">"2015-01-01T01:02:03.000000Z"</span>
</span>}</code></pre><div style="height: 1px;"></div><h5>Schema</h5><pre><code>{
"<span class="hljs-attribute">type</span>": <span class="hljs-value"><span class="hljs-string">"object"</span></span>,
"<span class="hljs-attribute">properties</span>": <span class="hljs-value">{
"<span class="hljs-attribute">id</span>": <span class="hljs-value">{
"<span class="hljs-attribute">type</span>": <span class="hljs-value"><span class="hljs-string">"number"</span></span>,
"<span class="hljs-attribute">description</span>": <span class="hljs-value"><span class="hljs-string">"Unique identifier"</span>
</span>}</span>,
"<span class="hljs-attribute">name</span>": <span class="hljs-value">{
"<span class="hljs-attribute">type</span>": <span class="hljs-value"><span class="hljs-string">"string"</span></span>,
"<span class="hljs-attribute">description</span>": <span class="hljs-value"><span class="hljs-string">"Name of Page"</span>
</span>}</span>,
"<span class="hljs-attribute">html</span>": <span class="hljs-value">{
"<span class="hljs-attribute">type</span>": <span class="hljs-value"><span class="hljs-string">"string"</span></span>,
"<span class="hljs-attribute">description</span>": <span class="hljs-value"><span class="hljs-string">"HTML of the landing page users hit when clicking links in the email template"</span>
</span>}</span>,
"<span class="hljs-attribute">modified_date</span>": <span class="hljs-value">{
"<span class="hljs-attribute">type</span>": <span class="hljs-value"><span class="hljs-string">"string"</span></span>,
"<span class="hljs-attribute">description</span>": <span class="hljs-value"><span class="hljs-string">"Date the Page was last modified"</span>
</span>}
</span>}</span>,
"<span class="hljs-attribute">required</span>": <span class="hljs-value">[
<span class="hljs-string">"id"</span>,
<span class="hljs-string">"name"</span>,
<span class="hljs-string">"html"</span>
]</span>,
"<span class="hljs-attribute">$schema</span>": <span class="hljs-value"><span class="hljs-string">"http://json-schema.org/draft-04/schema#"</span>
</span>}</code></pre><div style="height: 1px;"></div></div></div><div class="title"><strong>Response&nbsp;&nbsp;<code>201</code></strong><div class="collapse-button"><span class="close">Hide</span><span class="open">Show</span></div></div><div class="collapse-content"><div class="inner"><h5>Headers</h5><pre><code><span class="hljs-attribute">Content-Type</span>: <span class="hljs-string">application/json</span></code></pre><div style="height: 1px;"></div><h5>Body</h5><pre><code>{
"<span class="hljs-attribute">id</span>": <span class="hljs-value"><span class="hljs-number">1</span></span>,
"<span class="hljs-attribute">name</span>": <span class="hljs-value"><span class="hljs-string">"Example Page"</span></span>,
"<span class="hljs-attribute">html</span>": <span class="hljs-value"><span class="hljs-string">"&lt;html&gt;&lt;head&gt;&lt;/head&gt;&lt;body&gt;This is a test message!&lt;/body&gt;&lt;/html&gt;"</span></span>,
"<span class="hljs-attribute">modified_date</span>": <span class="hljs-value"><span class="hljs-string">"2015-01-01T01:02:03.000000Z"</span>
</span>}</code></pre><div style="height: 1px;"></div><h5>Schema</h5><pre><code>{
"<span class="hljs-attribute">type</span>": <span class="hljs-value"><span class="hljs-string">"object"</span></span>,
"<span class="hljs-attribute">properties</span>": <span class="hljs-value">{
"<span class="hljs-attribute">id</span>": <span class="hljs-value">{
"<span class="hljs-attribute">type</span>": <span class="hljs-value"><span class="hljs-string">"number"</span></span>,
"<span class="hljs-attribute">description</span>": <span class="hljs-value"><span class="hljs-string">"Unique identifier"</span>
</span>}</span>,
"<span class="hljs-attribute">name</span>": <span class="hljs-value">{
"<span class="hljs-attribute">type</span>": <span class="hljs-value"><span class="hljs-string">"string"</span></span>,
"<span class="hljs-attribute">description</span>": <span class="hljs-value"><span class="hljs-string">"Name of Page"</span>
</span>}</span>,
"<span class="hljs-attribute">html</span>": <span class="hljs-value">{
"<span class="hljs-attribute">type</span>": <span class="hljs-value"><span class="hljs-string">"string"</span></span>,
"<span class="hljs-attribute">description</span>": <span class="hljs-value"><span class="hljs-string">"HTML of the landing page users hit when clicking links in the email template"</span>
</span>}</span>,
"<span class="hljs-attribute">modified_date</span>": <span class="hljs-value">{
"<span class="hljs-attribute">type</span>": <span class="hljs-value"><span class="hljs-string">"string"</span></span>,
"<span class="hljs-attribute">description</span>": <span class="hljs-value"><span class="hljs-string">"Date the Page was last modified"</span>
</span>}
</span>}</span>,
"<span class="hljs-attribute">required</span>": <span class="hljs-value">[
<span class="hljs-string">"id"</span>,
<span class="hljs-string">"name"</span>,
<span class="hljs-string">"html"</span>
]</span>,
"<span class="hljs-attribute">$schema</span>": <span class="hljs-value"><span class="hljs-string">"http://json-schema.org/draft-04/schema#"</span>
</span>}</code></pre><div style="height: 1px;"></div></div></div><div class="title"><strong>Response&nbsp;&nbsp;<code>400</code></strong><div class="collapse-button"><span class="close">Hide</span><span class="open">Show</span></div></div><div class="collapse-content"><div class="inner"><h5>Headers</h5><pre><code><span class="hljs-attribute">Content-Type</span>: <span class="hljs-string">application/json</span></code></pre><div style="height: 1px;"></div><h5>Body</h5><pre><code>{
"<span class="hljs-attribute">message</span>": <span class="hljs-value"><span class="hljs-string">"\"Error message\""</span></span>,
"<span class="hljs-attribute">success</span>": <span class="hljs-value"><span class="hljs-string">"false"</span></span>,
"<span class="hljs-attribute">data</span>": <span class="hljs-value"><span class="hljs-string">"Any associated data"</span>
</span>}</code></pre><div style="height: 1px;"></div><h5>Schema</h5><pre><code>{
"<span class="hljs-attribute">type</span>": <span class="hljs-value"><span class="hljs-string">"object"</span></span>,
"<span class="hljs-attribute">properties</span>": <span class="hljs-value">{
"<span class="hljs-attribute">message</span>": <span class="hljs-value">{
"<span class="hljs-attribute">type</span>": <span class="hljs-value"><span class="hljs-string">"string"</span></span>,
"<span class="hljs-attribute">description</span>": <span class="hljs-value"><span class="hljs-string">"The detailed error message"</span>
</span>}</span>,
"<span class="hljs-attribute">success</span>": <span class="hljs-value">{
"<span class="hljs-attribute">type</span>": <span class="hljs-value"><span class="hljs-string">"string"</span></span>,
"<span class="hljs-attribute">description</span>": <span class="hljs-value"><span class="hljs-string">"The success status of the request"</span>
</span>}</span>,
"<span class="hljs-attribute">data</span>": <span class="hljs-value">{
"<span class="hljs-attribute">type</span>": <span class="hljs-value"><span class="hljs-string">"string"</span>
</span>}
</span>}</span>,
"<span class="hljs-attribute">$schema</span>": <span class="hljs-value"><span class="hljs-string">"http://json-schema.org/draft-04/schema#"</span>
</span>}</code></pre><div style="height: 1px;"></div></div></div></div></div><div id="pages-page" class="resource"><h3 class="resource-heading">Page<a href="#pages-page" class="permalink">&para;</a></h3><div id="pages-page-get" class="action get"><h4 class="action-heading"><div class="name">Get Page</div><a href="#pages-page-get" class="method get">GET</a><code class="uri">/pages/{id}</code></h4><p>Get a page by its ID.</p>
<div class="title"><strong>Parameters</strong><div class="collapse-button show"><span class="close">Hide</span><span class="open">Show</span></div></div><div class="collapse-content"><dl class="inner"><dt>id</dt><dd><code>number</code>&nbsp;<span class="required">(required)</span>&nbsp;<span class="text-muted example"><strong>Example:&nbsp;</strong><span>1</span></span><p>The Page ID</p>
</dd></dl></div><div class="title"><strong>Response&nbsp;&nbsp;<code>200</code></strong><div class="collapse-button"><span class="close">Hide</span><span class="open">Show</span></div></div><div class="collapse-content"><div class="inner"><h5>Headers</h5><pre><code><span class="hljs-attribute">Content-Type</span>: <span class="hljs-string">application/json</span></code></pre><div style="height: 1px;"></div><h5>Body</h5><pre><code>{
"<span class="hljs-attribute">id</span>": <span class="hljs-value"><span class="hljs-number">1</span></span>,
"<span class="hljs-attribute">name</span>": <span class="hljs-value"><span class="hljs-string">"Example Page"</span></span>,
"<span class="hljs-attribute">html</span>": <span class="hljs-value"><span class="hljs-string">"&lt;html&gt;&lt;head&gt;&lt;/head&gt;&lt;body&gt;This is a test message!&lt;/body&gt;&lt;/html&gt;"</span></span>,
"<span class="hljs-attribute">modified_date</span>": <span class="hljs-value"><span class="hljs-string">"2015-01-01T01:02:03.000000Z"</span>
</span>}</code></pre><div style="height: 1px;"></div><h5>Schema</h5><pre><code>{
"<span class="hljs-attribute">type</span>": <span class="hljs-value"><span class="hljs-string">"object"</span></span>,
"<span class="hljs-attribute">properties</span>": <span class="hljs-value">{
"<span class="hljs-attribute">id</span>": <span class="hljs-value">{
"<span class="hljs-attribute">type</span>": <span class="hljs-value"><span class="hljs-string">"number"</span></span>,
"<span class="hljs-attribute">description</span>": <span class="hljs-value"><span class="hljs-string">"Unique identifier"</span>
</span>}</span>,
"<span class="hljs-attribute">name</span>": <span class="hljs-value">{
"<span class="hljs-attribute">type</span>": <span class="hljs-value"><span class="hljs-string">"string"</span></span>,
"<span class="hljs-attribute">description</span>": <span class="hljs-value"><span class="hljs-string">"Name of Page"</span>
</span>}</span>,
"<span class="hljs-attribute">html</span>": <span class="hljs-value">{
"<span class="hljs-attribute">type</span>": <span class="hljs-value"><span class="hljs-string">"string"</span></span>,
"<span class="hljs-attribute">description</span>": <span class="hljs-value"><span class="hljs-string">"HTML of the landing page users hit when clicking links in the email template"</span>
</span>}</span>,
"<span class="hljs-attribute">modified_date</span>": <span class="hljs-value">{
"<span class="hljs-attribute">type</span>": <span class="hljs-value"><span class="hljs-string">"string"</span></span>,
"<span class="hljs-attribute">description</span>": <span class="hljs-value"><span class="hljs-string">"Date the Page was last modified"</span>
</span>}
</span>}</span>,
"<span class="hljs-attribute">required</span>": <span class="hljs-value">[
<span class="hljs-string">"id"</span>,
<span class="hljs-string">"name"</span>,
<span class="hljs-string">"html"</span>
]</span>,
"<span class="hljs-attribute">$schema</span>": <span class="hljs-value"><span class="hljs-string">"http://json-schema.org/draft-04/schema#"</span>
</span>}</code></pre><div style="height: 1px;"></div></div></div><div class="title"><strong>Response&nbsp;&nbsp;<code>404</code></strong><div class="collapse-button"><span class="close">Hide</span><span class="open">Show</span></div></div><div class="collapse-content"><div class="inner"><h5>Headers</h5><pre><code><span class="hljs-attribute">Content-Type</span>: <span class="hljs-string">application/json</span></code></pre><div style="height: 1px;"></div><h5>Body</h5><pre><code>{
"<span class="hljs-attribute">message</span>": <span class="hljs-value"><span class="hljs-string">"Page not found"</span></span>,
"<span class="hljs-attribute">success</span>": <span class="hljs-value"><span class="hljs-literal">false</span></span>,
"<span class="hljs-attribute">data</span>": <span class="hljs-value"><span class="hljs-literal">null</span>
</span>}</code></pre><div style="height: 1px;"></div></div></div></div><div id="pages-page-put" class="action put"><h4 class="action-heading"><div class="name">Put Page</div><a href="#pages-page-put" class="method put">PUT</a><code class="uri">/pages</code></h4><p>Modify a page by its ID.</p>
<div class="title"><strong>Request</strong></div><div class="title"><strong>Response&nbsp;&nbsp;<code>200</code></strong><div class="collapse-button"><span class="close">Hide</span><span class="open">Show</span></div></div><div class="collapse-content"><div class="inner"><h5>Headers</h5><pre><code><span class="hljs-attribute">Content-Type</span>: <span class="hljs-string">application/json</span></code></pre><div style="height: 1px;"></div><h5>Body</h5><pre><code>{
"<span class="hljs-attribute">id</span>": <span class="hljs-value"><span class="hljs-number">1</span></span>,
"<span class="hljs-attribute">name</span>": <span class="hljs-value"><span class="hljs-string">"Example Page"</span></span>,
"<span class="hljs-attribute">html</span>": <span class="hljs-value"><span class="hljs-string">"&lt;html&gt;&lt;head&gt;&lt;/head&gt;&lt;body&gt;This is a test message!&lt;/body&gt;&lt;/html&gt;"</span></span>,
"<span class="hljs-attribute">modified_date</span>": <span class="hljs-value"><span class="hljs-string">"2015-01-01T01:02:03.000000Z"</span>
</span>}</code></pre><div style="height: 1px;"></div><h5>Schema</h5><pre><code>{
"<span class="hljs-attribute">type</span>": <span class="hljs-value"><span class="hljs-string">"object"</span></span>,
"<span class="hljs-attribute">properties</span>": <span class="hljs-value">{
"<span class="hljs-attribute">id</span>": <span class="hljs-value">{
"<span class="hljs-attribute">type</span>": <span class="hljs-value"><span class="hljs-string">"number"</span></span>,
"<span class="hljs-attribute">description</span>": <span class="hljs-value"><span class="hljs-string">"Unique identifier"</span>
</span>}</span>,
"<span class="hljs-attribute">name</span>": <span class="hljs-value">{
"<span class="hljs-attribute">type</span>": <span class="hljs-value"><span class="hljs-string">"string"</span></span>,
"<span class="hljs-attribute">description</span>": <span class="hljs-value"><span class="hljs-string">"Name of Page"</span>
</span>}</span>,
"<span class="hljs-attribute">html</span>": <span class="hljs-value">{
"<span class="hljs-attribute">type</span>": <span class="hljs-value"><span class="hljs-string">"string"</span></span>,
"<span class="hljs-attribute">description</span>": <span class="hljs-value"><span class="hljs-string">"HTML of the landing page users hit when clicking links in the email template"</span>
</span>}</span>,
"<span class="hljs-attribute">modified_date</span>": <span class="hljs-value">{
"<span class="hljs-attribute">type</span>": <span class="hljs-value"><span class="hljs-string">"string"</span></span>,
"<span class="hljs-attribute">description</span>": <span class="hljs-value"><span class="hljs-string">"Date the Page was last modified"</span>
</span>}
</span>}</span>,
"<span class="hljs-attribute">required</span>": <span class="hljs-value">[
<span class="hljs-string">"id"</span>,
<span class="hljs-string">"name"</span>,
<span class="hljs-string">"html"</span>
]</span>,
"<span class="hljs-attribute">$schema</span>": <span class="hljs-value"><span class="hljs-string">"http://json-schema.org/draft-04/schema#"</span>
</span>}</code></pre><div style="height: 1px;"></div></div></div><div class="title"><strong>Response&nbsp;&nbsp;<code>404</code></strong><div class="collapse-button"><span class="close">Hide</span><span class="open">Show</span></div></div><div class="collapse-content"><div class="inner"><h5>Headers</h5><pre><code><span class="hljs-attribute">Content-Type</span>: <span class="hljs-string">application/json</span></code></pre><div style="height: 1px;"></div><h5>Body</h5><pre><code>{
"<span class="hljs-attribute">message</span>": <span class="hljs-value"><span class="hljs-string">"Page not found"</span></span>,
"<span class="hljs-attribute">success</span>": <span class="hljs-value"><span class="hljs-literal">false</span></span>,
"<span class="hljs-attribute">data</span>": <span class="hljs-value"><span class="hljs-literal">null</span>
</span>}</code></pre><div style="height: 1px;"></div></div></div></div><div id="pages-page-delete" class="action delete"><h4 class="action-heading"><div class="name">Delete a Page</div><a href="#pages-page-delete" class="method delete">DELETE</a><code class="uri">/pages/{id}</code></h4><p>Delete a page by its ID.</p>
<div class="title"><strong>Parameters</strong><div class="collapse-button show"><span class="close">Hide</span><span class="open">Show</span></div></div><div class="collapse-content"><dl class="inner"><dt>id</dt><dd><code>number</code>&nbsp;<span class="required">(required)</span>&nbsp;<span class="text-muted example"><strong>Example:&nbsp;</strong><span>1</span></span><p>The Page ID</p>
</dd></dl></div><div class="title"><strong>Response&nbsp;&nbsp;<code>200</code></strong><div class="collapse-button"><span class="close">Hide</span><span class="open">Show</span></div></div><div class="collapse-content"><div class="inner"><h5>Headers</h5><pre><code><span class="hljs-attribute">Content-Type</span>: <span class="hljs-string">application/json</span></code></pre><div style="height: 1px;"></div><h5>Body</h5><pre><code>{
"<span class="hljs-attribute">message</span>": <span class="hljs-value"><span class="hljs-string">"Page deleted successfully!"</span></span>,
"<span class="hljs-attribute">success</span>": <span class="hljs-value"><span class="hljs-literal">true</span></span>,
"<span class="hljs-attribute">data</span>": <span class="hljs-value"><span class="hljs-literal">null</span>
</span>}</code></pre><div style="height: 1px;"></div></div></div><div class="title"><strong>Response&nbsp;&nbsp;<code>404</code></strong><div class="collapse-button"><span class="close">Hide</span><span class="open">Show</span></div></div><div class="collapse-content"><div class="inner"><h5>Headers</h5><pre><code><span class="hljs-attribute">Content-Type</span>: <span class="hljs-string">application/json</span></code></pre><div style="height: 1px;"></div><h5>Body</h5><pre><code>{
"<span class="hljs-attribute">message</span>": <span class="hljs-value"><span class="hljs-string">"Page not found"</span></span>,
"<span class="hljs-attribute">success</span>": <span class="hljs-value"><span class="hljs-literal">false</span></span>,
"<span class="hljs-attribute">data</span>": <span class="hljs-value"><span class="hljs-literal">null</span>
</span>}</code></pre><div style="height: 1px;"></div></div></div></div></div></section><section id="import" class="resource-group"><h2 class="group-heading">Import<a href="#import" class="permalink">&para;</a></h2><p>Import functions facilitate the ability to import emails, groups and more using simple interfaces.</p>
<div id="import-group" class="resource"><h3 class="resource-heading">Group<a href="#import-group" class="permalink">&para;</a></h3><div id="import-group-post" class="action post"><h4 class="action-heading"><div class="name">Import a Group</div><a href="#import-group-post" class="method post">POST</a><code class="uri">/import/group</code></h4><p>This endpoint allows you to import a group from a CSV.</p>
<p>The fields expected in the CSV are as follows:</p>
<ul>
<li>
<p>First Name</p>
</li>
<li>
<p>Last Name</p>
</li>
<li>
<p>Position</p>
</li>
<li>
<p>Email</p>
</li>
<li>
<p>Company</p>
</li>
</ul>
<div class="title"><strong>Request</strong><div class="collapse-button"><span class="close">Hide</span><span class="open">Show</span></div></div><div class="collapse-content"><div class="inner"><h5>Headers</h5><pre><code><span class="hljs-attribute">Content-Type</span>: <span class="hljs-string">multipart/form-data; boundary=----BOUNDARY</span></code></pre><div style="height: 1px;"></div><h5>Body</h5><pre><code>------BOUNDARY
Content-Disposition: form-data; name=<span class="hljs-string">"files[]"</span>; filename=<span class="hljs-string">"filename.csv"</span>
Content-Type: application/vnd.ms-excel
[File Content]
------BOUNDARY</code></pre><div style="height: 1px;"></div></div></div><div class="title"><strong>Response&nbsp;&nbsp;<code>201</code></strong><div class="collapse-button"><span class="close">Hide</span><span class="open">Show</span></div></div><div class="collapse-content"><div class="inner"><h5>Headers</h5><pre><code><span class="hljs-attribute">Content-Type</span>: <span class="hljs-string">application/json</span></code></pre><div style="height: 1px;"></div><h5>Body</h5><pre><code>[
{
"<span class="hljs-attribute">id</span>": <span class="hljs-value"><span class="hljs-number">1</span></span>,
"<span class="hljs-attribute">first_name</span>": <span class="hljs-value"><span class="hljs-string">"John"</span></span>,
"<span class="hljs-attribute">last_name</span>": <span class="hljs-value"><span class="hljs-string">"Doe"</span></span>,
"<span class="hljs-attribute">email</span>": <span class="hljs-value"><span class="hljs-string">"john.doe@example.com"</span></span>,
"<span class="hljs-attribute">position</span>": <span class="hljs-value"><span class="hljs-string">"System Administrator"</span>
</span>}
]</code></pre><div style="height: 1px;"></div><h5>Schema</h5><pre><code>{
"<span class="hljs-attribute">type</span>": <span class="hljs-value"><span class="hljs-string">"array"</span></span>,
"<span class="hljs-attribute">$schema</span>": <span class="hljs-value"><span class="hljs-string">"http://json-schema.org/draft-04/schema#"</span>
</span>}</code></pre><div style="height: 1px;"></div></div></div><div class="title"><strong>Response&nbsp;&nbsp;<code>400</code></strong><div class="collapse-button"><span class="close">Hide</span><span class="open">Show</span></div></div><div class="collapse-content"><div class="inner"><h5>Headers</h5><pre><code><span class="hljs-attribute">Content-Type</span>: <span class="hljs-string">application/json</span></code></pre><div style="height: 1px;"></div><h5>Body</h5><pre><code>{
"<span class="hljs-attribute">message</span>": <span class="hljs-value"><span class="hljs-string">"\"Error message\""</span></span>,
"<span class="hljs-attribute">success</span>": <span class="hljs-value"><span class="hljs-string">"false"</span></span>,
"<span class="hljs-attribute">data</span>": <span class="hljs-value"><span class="hljs-string">"Any associated data"</span>
</span>}</code></pre><div style="height: 1px;"></div><h5>Schema</h5><pre><code>{
"<span class="hljs-attribute">type</span>": <span class="hljs-value"><span class="hljs-string">"object"</span></span>,
"<span class="hljs-attribute">properties</span>": <span class="hljs-value">{
"<span class="hljs-attribute">message</span>": <span class="hljs-value">{
"<span class="hljs-attribute">type</span>": <span class="hljs-value"><span class="hljs-string">"string"</span></span>,
"<span class="hljs-attribute">description</span>": <span class="hljs-value"><span class="hljs-string">"The detailed error message"</span>
</span>}</span>,
"<span class="hljs-attribute">success</span>": <span class="hljs-value">{
"<span class="hljs-attribute">type</span>": <span class="hljs-value"><span class="hljs-string">"string"</span></span>,
"<span class="hljs-attribute">description</span>": <span class="hljs-value"><span class="hljs-string">"The success status of the request"</span>
</span>}</span>,
"<span class="hljs-attribute">data</span>": <span class="hljs-value">{
"<span class="hljs-attribute">type</span>": <span class="hljs-value"><span class="hljs-string">"string"</span>
</span>}
</span>}</span>,
"<span class="hljs-attribute">$schema</span>": <span class="hljs-value"><span class="hljs-string">"http://json-schema.org/draft-04/schema#"</span>
</span>}</code></pre><div style="height: 1px;"></div></div></div></div></div><div id="import-email" class="resource"><h3 class="resource-heading">Email<a href="#import-email" class="permalink">&para;</a></h3><div id="import-email-post" class="action post"><h4 class="action-heading"><div class="name">Import an Email</div><a href="#import-email-post" class="method post">POST</a><code class="uri">/import/email</code></h4><p>This endpoint allows you to parse and import an email in RFC 5322 format.</p>
<p>You can use this endpoint to easily import an email that you have received legitimately to re-use it for simulated phishing.</p>
<div class="title"><strong>Request</strong><div class="collapse-button"><span class="close">Hide</span><span class="open">Show</span></div></div><div class="collapse-content"><div class="inner"><h5>Headers</h5><pre><code><span class="hljs-attribute">Content-Type</span>: <span class="hljs-string">text/plain</span></code></pre><div style="height: 1px;"></div><h5>Body</h5><pre><code>MIME-Version: 1.0
Date: Fri, 25 Dec 2015 21:22:28 -0600
Subject: Foo Bar
From: John Doe <span class="hljs-tag">&lt;<span class="hljs-title">john.doe@example.com</span>&gt;</span>
To: Jane Doe <span class="hljs-tag">&lt;<span class="hljs-title">jane.doe@example.com</span>&gt;</span>
Content-Type: multipart/alternative; boundary=14dae9473639dc6b2a0527c4945f
--14dae9473639dc6b2a0527c4945f
Content-Type: text/plain; charset=UTF-8
Foo bar
--14dae9473639dc6b2a0527c4945f
Content-Type: text/html; charset=UTF-8
<span class="hljs-tag">&lt;<span class="hljs-title">div</span> <span class="hljs-attribute">dir</span>=<span class="hljs-value">"ltr"</span>&gt;</span>Foo bar<span class="hljs-tag">&lt;/<span class="hljs-title">div</span>&gt;</span>
--14dae9473639dc6b2a0527c4945f--</code></pre><div style="height: 1px;"></div></div></div><div class="title"><strong>Response&nbsp;&nbsp;<code>201</code></strong><div class="collapse-button"><span class="close">Hide</span><span class="open">Show</span></div></div><div class="collapse-content"><div class="inner"><h5>Headers</h5><pre><code><span class="hljs-attribute">Content-Type</span>: <span class="hljs-string">application/json</span></code></pre><div style="height: 1px;"></div><h5>Body</h5><pre><code>{
"<span class="hljs-attribute">text</span>": <span class="hljs-value"><span class="hljs-string">"Foo bar"</span></span>,
"<span class="hljs-attribute">html</span>": <span class="hljs-value"><span class="hljs-string">"\"\\u003cdiv\\u003eFoo bar\\u003c/div\\u003e\""</span></span>,
"<span class="hljs-attribute">subject</span>": <span class="hljs-value"><span class="hljs-string">"Foo Bar"</span>
</span>}</code></pre><div style="height: 1px;"></div><h5>Schema</h5><pre><code>{
"<span class="hljs-attribute">type</span>": <span class="hljs-value"><span class="hljs-string">"object"</span></span>,
"<span class="hljs-attribute">properties</span>": <span class="hljs-value">{
"<span class="hljs-attribute">text</span>": <span class="hljs-value">{
"<span class="hljs-attribute">type</span>": <span class="hljs-value"><span class="hljs-string">"string"</span></span>,
"<span class="hljs-attribute">description</span>": <span class="hljs-value"><span class="hljs-string">"The email text part"</span>
</span>}</span>,
"<span class="hljs-attribute">html</span>": <span class="hljs-value">{
"<span class="hljs-attribute">type</span>": <span class="hljs-value"><span class="hljs-string">"string"</span></span>,
"<span class="hljs-attribute">description</span>": <span class="hljs-value"><span class="hljs-string">"The email HTML part"</span>
</span>}</span>,
"<span class="hljs-attribute">subject</span>": <span class="hljs-value">{
"<span class="hljs-attribute">type</span>": <span class="hljs-value"><span class="hljs-string">"string"</span></span>,
"<span class="hljs-attribute">description</span>": <span class="hljs-value"><span class="hljs-string">"The email subject"</span>
</span>}
</span>}</span>,
"<span class="hljs-attribute">$schema</span>": <span class="hljs-value"><span class="hljs-string">"http://json-schema.org/draft-04/schema#"</span>
</span>}</code></pre><div style="height: 1px;"></div></div></div><div class="title"><strong>Response&nbsp;&nbsp;<code>400</code></strong><div class="collapse-button"><span class="close">Hide</span><span class="open">Show</span></div></div><div class="collapse-content"><div class="inner"><h5>Headers</h5><pre><code><span class="hljs-attribute">Content-Type</span>: <span class="hljs-string">application/json</span></code></pre><div style="height: 1px;"></div><h5>Body</h5><pre><code>{
"<span class="hljs-attribute">message</span>": <span class="hljs-value"><span class="hljs-string">"\"Error message\""</span></span>,
"<span class="hljs-attribute">success</span>": <span class="hljs-value"><span class="hljs-string">"false"</span></span>,
"<span class="hljs-attribute">data</span>": <span class="hljs-value"><span class="hljs-string">"Any associated data"</span>
</span>}</code></pre><div style="height: 1px;"></div><h5>Schema</h5><pre><code>{
"<span class="hljs-attribute">type</span>": <span class="hljs-value"><span class="hljs-string">"object"</span></span>,
"<span class="hljs-attribute">properties</span>": <span class="hljs-value">{
"<span class="hljs-attribute">message</span>": <span class="hljs-value">{
"<span class="hljs-attribute">type</span>": <span class="hljs-value"><span class="hljs-string">"string"</span></span>,
"<span class="hljs-attribute">description</span>": <span class="hljs-value"><span class="hljs-string">"The detailed error message"</span>
</span>}</span>,
"<span class="hljs-attribute">success</span>": <span class="hljs-value">{
"<span class="hljs-attribute">type</span>": <span class="hljs-value"><span class="hljs-string">"string"</span></span>,
"<span class="hljs-attribute">description</span>": <span class="hljs-value"><span class="hljs-string">"The success status of the request"</span>
</span>}</span>,
"<span class="hljs-attribute">data</span>": <span class="hljs-value">{
"<span class="hljs-attribute">type</span>": <span class="hljs-value"><span class="hljs-string">"string"</span>
</span>}
</span>}</span>,
"<span class="hljs-attribute">$schema</span>": <span class="hljs-value"><span class="hljs-string">"http://json-schema.org/draft-04/schema#"</span>
</span>}</code></pre><div style="height: 1px;"></div></div></div></div></div><div id="import-site" class="resource"><h3 class="resource-heading">Site<a href="#import-site" class="permalink">&para;</a></h3><div id="import-site-post" class="action post"><h4 class="action-heading"><div class="name">Import a Site</div><a href="#import-site-post" class="method post">POST</a><code class="uri">/import/site</code></h4><p>Imports a site via the URL. This causes gophish to reach out to the site and pull down the HTML of the URL given.</p>
<p>To keep styles, images, and Javascript setup and working, gophish adds a <code>base</code> tag to the returned HTML pointing to the original site.</p>
<div class="title"><strong>Request</strong><div class="collapse-button"><span class="close">Hide</span><span class="open">Show</span></div></div><div class="collapse-content"><div class="inner"><h5>Headers</h5><pre><code><span class="hljs-attribute">Content-Type</span>: <span class="hljs-string">application/json</span></code></pre><div style="height: 1px;"></div><h5>Body</h5><pre><code>{
"<span class="hljs-attribute">url</span>": <span class="hljs-value"><span class="hljs-string">"http://foo.bar"</span>
</span>}</code></pre><div style="height: 1px;"></div><h5>Schema</h5><pre><code>{
"<span class="hljs-attribute">type</span>": <span class="hljs-value"><span class="hljs-string">"object"</span></span>,
"<span class="hljs-attribute">properties</span>": <span class="hljs-value">{
"<span class="hljs-attribute">url</span>": <span class="hljs-value">{
"<span class="hljs-attribute">type</span>": <span class="hljs-value"><span class="hljs-string">"string"</span></span>,
"<span class="hljs-attribute">description</span>": <span class="hljs-value"><span class="hljs-string">"The URL to be retrieved"</span>
</span>}
</span>}</span>,
"<span class="hljs-attribute">required</span>": <span class="hljs-value">[
<span class="hljs-string">"url"</span>
]</span>,
"<span class="hljs-attribute">$schema</span>": <span class="hljs-value"><span class="hljs-string">"http://json-schema.org/draft-04/schema#"</span>
</span>}</code></pre><div style="height: 1px;"></div></div></div><div class="title"><strong>Response&nbsp;&nbsp;<code>201</code></strong><div class="collapse-button"><span class="close">Hide</span><span class="open">Show</span></div></div><div class="collapse-content"><div class="inner"><h5>Headers</h5><pre><code><span class="hljs-attribute">Content-Type</span>: <span class="hljs-string">application/json</span></code></pre><div style="height: 1px;"></div><h5>Body</h5><pre><code>{
"html": "<span class="hljs-tag">&lt;<span class="hljs-title">html</span>&gt;</span><span class="hljs-tag">&lt;<span class="hljs-title">head</span>&gt;</span><span class="hljs-tag">&lt;/<span class="hljs-title">head</span>&gt;</span><span class="hljs-tag">&lt;<span class="hljs-title">body</span>&gt;</span>This is a test message!<span class="hljs-tag">&lt;/<span class="hljs-title">body</span>&gt;</span><span class="hljs-tag">&lt;/<span class="hljs-title">html</span>&gt;</span>"
}</code></pre><div style="height: 1px;"></div><h5>Schema</h5><pre><code>{
"<span class="hljs-attribute">type</span>": <span class="hljs-value"><span class="hljs-string">"object"</span></span>,
"<span class="hljs-attribute">properties</span>": <span class="hljs-value">{
"<span class="hljs-attribute">html</span>": <span class="hljs-value">{
"<span class="hljs-attribute">type</span>": <span class="hljs-value"><span class="hljs-string">"string"</span></span>,
"<span class="hljs-attribute">description</span>": <span class="hljs-value"><span class="hljs-string">"HTML of the requested URL."</span>
</span>}
</span>}</span>,
"<span class="hljs-attribute">required</span>": <span class="hljs-value">[
<span class="hljs-string">"html"</span>
]</span>,
"<span class="hljs-attribute">$schema</span>": <span class="hljs-value"><span class="hljs-string">"http://json-schema.org/draft-04/schema#"</span>
</span>}</code></pre><div style="height: 1px;"></div></div></div><div class="title"><strong>Response&nbsp;&nbsp;<code>400</code></strong><div class="collapse-button"><span class="close">Hide</span><span class="open">Show</span></div></div><div class="collapse-content"><div class="inner"><h5>Headers</h5><pre><code><span class="hljs-attribute">Content-Type</span>: <span class="hljs-string">application/json</span></code></pre><div style="height: 1px;"></div><h5>Body</h5><pre><code>{
"<span class="hljs-attribute">message</span>": <span class="hljs-value"><span class="hljs-string">"\"Error message\""</span></span>,
"<span class="hljs-attribute">success</span>": <span class="hljs-value"><span class="hljs-string">"false"</span></span>,
"<span class="hljs-attribute">data</span>": <span class="hljs-value"><span class="hljs-string">"Any associated data"</span>
</span>}</code></pre><div style="height: 1px;"></div><h5>Schema</h5><pre><code>{
"<span class="hljs-attribute">type</span>": <span class="hljs-value"><span class="hljs-string">"object"</span></span>,
"<span class="hljs-attribute">properties</span>": <span class="hljs-value">{
"<span class="hljs-attribute">message</span>": <span class="hljs-value">{
"<span class="hljs-attribute">type</span>": <span class="hljs-value"><span class="hljs-string">"string"</span></span>,
"<span class="hljs-attribute">description</span>": <span class="hljs-value"><span class="hljs-string">"The detailed error message"</span>
</span>}</span>,
"<span class="hljs-attribute">success</span>": <span class="hljs-value">{
"<span class="hljs-attribute">type</span>": <span class="hljs-value"><span class="hljs-string">"string"</span></span>,
"<span class="hljs-attribute">description</span>": <span class="hljs-value"><span class="hljs-string">"The success status of the request"</span>
</span>}</span>,
"<span class="hljs-attribute">data</span>": <span class="hljs-value">{
"<span class="hljs-attribute">type</span>": <span class="hljs-value"><span class="hljs-string">"string"</span>
</span>}
</span>}</span>,
"<span class="hljs-attribute">$schema</span>": <span class="hljs-value"><span class="hljs-string">"http://json-schema.org/draft-04/schema#"</span>
</span>}</code></pre><div style="height: 1px;"></div></div></div></div></div></section></div></div></div><p style="text-align: center;" class="text-muted">Generated by&nbsp;<a href="https://github.com/danielgtaylor/aglio" class="aglio">aglio</a>&nbsp;on 27 Dec 2015</p><script>/* eslint-env browser */
/* eslint quotes: [2, "single"] */
'use strict';
/*
Determine if a string ends with another string.
*/
function endsWith(str, suffix) {
return str.indexOf(suffix, str.length - suffix.length) !== -1;
}
/*
Get an array [width, height] of the window.
*/
function getWindowDimensions() {
var w = window,
d = document,
e = d.documentElement,
g = d.body,
x = w.innerWidth || e.clientWidth || g.clientWidth,
y = w.innerHeight || e.clientHeight || g.clientHeight;
return [x, y];
}
/*
Collapse or show a request/response example.
*/
function toggleCollapseButton(event) {
var button = event.target.parentNode;
var content = button.parentNode.nextSibling;
var inner = content.children[0];
if (button.className.indexOf('collapse-button') === -1) {
// Clicked without hitting the right element?
return;
}
if (content.style.maxHeight && content.style.maxHeight !== '0px') {
// Currently showing, so let's hide it
button.className = 'collapse-button';
content.style.maxHeight = '0px';
} else {
// Currently hidden, so let's show it
button.className = 'collapse-button show';
content.style.maxHeight = inner.offsetHeight + 12 + 'px';
}
}
/*
Collapse or show a navigation menu. It will not be hidden unless it
is currently selected or `force` has been passed.
*/
function toggleCollapseNav(event, force) {
var heading = event.target.parentNode;
var content = heading.nextSibling;
var inner = content.children[0];
if (heading.className.indexOf('heading') === -1) {
// Clicked without hitting the right element?
return;
}
if (content.style.maxHeight && content.style.maxHeight !== '0px') {
// Currently showing, so let's hide it, but only if this nav item
// is already selected. This prevents newly selected items from
// collapsing in an annoying fashion.
if (force || window.location.hash && endsWith(event.target.href, window.location.hash)) {
content.style.maxHeight = '0px';
}
} else {
// Currently hidden, so let's show it
content.style.maxHeight = inner.offsetHeight + 12 + 'px';
}
}
/*
Refresh the page after a live update from the server. This only
works in live preview mode (using the `--server` parameter).
*/
function refresh(body) {
document.querySelector('body').className = 'preload';
document.body.innerHTML = body;
// Re-initialize the page
init();
autoCollapse();
document.querySelector('body').className = '';
}
/*
Determine which navigation items should be auto-collapsed to show as many
as possible on the screen, based on the current window height. This also
collapses them.
*/
function autoCollapse() {
var windowHeight = getWindowDimensions()[1];
var itemsHeight = 64; /* Account for some padding */
var itemsArray = Array.prototype.slice.call(
document.querySelectorAll('nav .resource-group .heading'));
// Get the total height of the navigation items
itemsArray.forEach(function (item) {
itemsHeight += item.parentNode.offsetHeight;
});
// Should we auto-collapse any nav items? Try to find the smallest item
// that can be collapsed to show all items on the screen. If not possible,
// then collapse the largest item and do it again. First, sort the items
// by height from smallest to largest.
var sortedItems = itemsArray.sort(function (a, b) {
return a.parentNode.offsetHeight - b.parentNode.offsetHeight;
});
while (sortedItems.length && itemsHeight > windowHeight) {
for (var i = 0; i < sortedItems.length; i++) {
// Will collapsing this item help?
var itemHeight = sortedItems[i].nextSibling.offsetHeight;
if ((itemsHeight - itemHeight <= windowHeight) || i === sortedItems.length - 1) {
// It will, so let's collapse it, remove its content height from
// our total and then remove it from our list of candidates
// that can be collapsed.
itemsHeight -= itemHeight;
toggleCollapseNav({target: sortedItems[i].children[0]}, true);
sortedItems.splice(i, 1);
break;
}
}
}
}
/*
Initialize the interactive functionality of the page.
*/
function init() {
var i;
// Make collapse buttons clickable
var buttons = document.querySelectorAll('.collapse-button');
for (i = 0; i < buttons.length; i++) {
buttons[i].onclick = toggleCollapseButton;
// Show by default? Then toggle now.
if (buttons[i].className.indexOf('show') !== -1) {
toggleCollapseButton({target: buttons[i].children[0]});
}
}
// Make nav items clickable to collapse/expand their content.
var navItems = document.querySelectorAll('nav .resource-group .heading');
for (i = 0; i < navItems.length; i++) {
navItems[i].onclick = toggleCollapseNav;
// Show all by default
toggleCollapseNav({target: navItems[i].children[0]});
}
}
// Initial call to set up buttons
init();
window.onload = function () {
autoCollapse();
// Remove the `preload` class to enable animations
document.querySelector('body').className = '';
};
</script></body></html>
{{ end }}