gophish/documentation/api/index.html

1712 lines
176 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.

<!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}.right .hljs-comment{color:#969896}.right .css .hljs-class,.right .css .hljs-id,.right .css .hljs-pseudo,.right .hljs-attribute,.right .hljs-regexp,.right .hljs-tag,.right .hljs-variable,.right .html .hljs-doctype,.right .ruby .hljs-constant,.right .xml .hljs-doctype,.right .xml .hljs-pi,.right .xml .hljs-tag .hljs-title{color:#c66}.right .hljs-built_in,.right .hljs-constant,.right .hljs-literal,.right .hljs-number,.right .hljs-params,.right .hljs-pragma,.right .hljs-preprocessor{color:#de935f}.right .css .hljs-rule .hljs-attribute,.right .ruby .hljs-class .hljs-title{color:#f0c674}.right .hljs-header,.right .hljs-inheritance,.right .hljs-name,.right .hljs-string,.right .hljs-value,.right .ruby .hljs-symbol,.right .xml .hljs-cdata{color:#b5bd68}.right .css .hljs-hexcolor,.right .hljs-title{color:#8abeb7}.right .coffeescript .hljs-title,.right .hljs-function,.right .javascript .hljs-title,.right .perl .hljs-sub,.right .python .hljs-decorator,.right .python .hljs-title,.right .ruby .hljs-function .hljs-title,.right .ruby .hljs-title .hljs-keyword{color:#81a2be}.right .hljs-keyword,.right .javascript .hljs-function{color:#b294bb}.right .hljs{display:block;overflow-x:auto;background:#1d1f21;color:#c5c8c6;padding:.5em;-webkit-text-size-adjust:none}.right .coffeescript .javascript,.right .javascript .xml,.right .tex .hljs-formula,.right .xml .css,.right .xml .hljs-cdata,.right .xml .javascript,.right .xml .vbscript{opacity:.5}body{color:black;background:white;font:400 14px / 1.42 'Roboto',Helvetica,sans-serif}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:0;opacity:0;transition:opacity .25s ease}h1:hover .permalink,h2:hover .permalink,h3:hover .permalink,h4:hover .permalink,h5:hover .permalink{opacity:1}.triple h1 .permalink,.triple h2 .permalink,.triple h3 .permalink,.triple h4 .permalink,.triple h5 .permalink{opacity:.15}.triple h1:hover .permalink,.triple h2:hover .permalink,.triple h3:hover .permalink,.triple h4:hover .permalink,.triple h5:hover .permalink{opacity:.15}h1{font:200 36px 'Raleway',Helvetica,sans-serif;font-size:36px}h2{font:200 36px 'Raleway',Helvetica,sans-serif;font-size:30px}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}hr.split{border:0;height:1px;width:100%;padding-left:6px;margin:12px auto;background-image:linear-gradient(to right, rgba(0,0,0,0) 20%, rgba(0,0,0,0.2) 51.4%, rgba(255,255,255,0.2) 51.4%, rgba(255,255,255,0) 80%)}dl dt{float:left;width:130px;clear:left;text-align:right;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-weight:700}dl dd{margin-left:150px}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{color:black;background-color:transparent;padding:0;border:none}code{color:#444;background-color:#f5f5f5;font:'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 #e6e6e6}.text-muted{opacity:.5}.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:200 36px '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}header{margin-top:24px}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{text-decoration:none;background-color:bad-color;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{text-decoration:none;background-color:bad-color;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:-2px 0}.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%}.container-fluid.triple nav{width:16.5%;padding-right:1px}.container-fluid.triple .row .content{position:relative;margin-left:16.5%;padding-left:24px}.middle:before,.middle:after{content:'';display:table}.middle:after{clear:both}.middle{box-sizing:border-box;width:51.5%;padding-right:12px}.right{box-sizing:border-box;float:right;width:48.5%;padding-left:12px}.right a{color:#428bca}.right h1,.right h2,.right h3,.right h4,.right h5,.right p,.right div{color:white}.right pre{background-color:#1d1f21;border:1px solid #1d1f21}.right pre code{color:#c5c8c6}.right .description{margin-top:12px}.triple .resource-heading{font-size:125%}.definition{margin-top:12px;margin-bottom:12px}.definition .method{font-weight:bold}.definition .method.get{color:#2e8ab8}.definition .method.head{color:#2e8ab8}.definition .method.options{color:#2e8ab8}.definition .method.post{color:#56b82e}.definition .method.put{color:#b8a22e}.definition .method.patch{color:#b8a22e}.definition .method.delete{color:#b82e2e}.definition .uri{word-break:break-all;word-wrap:break-word}.definition .hostname{opacity:.5}.example-names{background-color:#eee;padding:12px;border-radius:6px}.example-names .tab-button{cursor:pointer;color:black;border:1px solid #ddd;padding:6px;margin-left:12px}.example-names .tab-button.active{background-color:#d5d5d5}.right .example-names{background-color:#444}.right .example-names .tab-button{color:white;border:1px solid #666;border-radius:6px}.right .example-names .tab-button.active{background-color:#5e5e5e}#nav-background{position:fixed;left:0;top:0;bottom:0;width:16.5%;padding-right:14.4px;background-color:#fbfbfb;border-right:1px solid #f0f0f0;z-index:-1}#right-panel-background{position:absolute;right:-12px;top:-12px;bottom:-12px;width:48.6%;background-color:#333;z-index:-1}@media (max-width:1200px){nav{width:198px}.container{max-width:840px}.container .row .content{margin-left:224px;width:606px}}@media (max-width:992px){nav{width:169.4px}.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,.container-fluid.triple .row .content{margin-left:auto;margin-right:auto;width:95%}#nav-background{display:none}#right-panel-background{width:48.6%}}.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}.triple .content .resource-group{padding:0;border:none}.triple .content .resource-group h2.group-heading,.triple .content .resource-group .heading a{margin:0 0 12px 0;border:1px solid #d9d9d9}nav .resource-group .heading a{padding:12px;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"><div id="nav-background"></div><div class="container-fluid triple"><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="#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="#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"><div id="right-panel-background"></div><div class="middle"><header><h1 id="top">Gophish API</h1></header></div><div class="right"><h5>API Endpoint</h5><a href="http://localhost:3333/api">http://localhost:3333/api</a></div><div class="middle"><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/gophish/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>
</div><div class="middle"><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 (number, required) - Unique identifier</p>
</li>
<li>
<p><code>name</code> : Example Campaign (string, 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 (string) - The current status of the campaign</p>
</li>
<li>
<p><code>results</code> : array[Result] - List of Results for the campaign</p>
</li>
<li>
<p><code>timeline</code> : array[Event] - List of Events for the campaign</p>
</li>
<li>
<p><code>smtp</code> : <a href="#smtp">SMTP</a></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>
<p>The results of the campaign are stored in the <code>results</code> field. Each result has the following attributes:</p>
<ul>
<li>
<p><code>id</code> : 1 (number, required) - Unique identifier</p>
</li>
<li>
<p><code>email</code> : <a href="mailto:foo@example.com">foo@example.com</a> - Email address of the target</p>
</li>
<li>
<p><code>first_name</code> : John - First name of the target</p>
</li>
<li>
<p><code>last_name</code> : Doe - Last name of the target</p>
</li>
<li>
<p><code>status</code> : Email Sent - The status of the result</p>
</li>
<li>
<p><code>ip</code> : 1.2.3.4 - The IP address that created the event (if any)</p>
</li>
<li>
<p><code>latitude</code> : 0.0000- The latitude of the IP address</p>
</li>
<li>
<p><code>longitude</code> : 0.0000 - The longitude of the IP address</p>
</li>
</ul>
<p>Each campaign also keeps a timeline of events that occur, such as clicking a link, opening an email, etc. These events each have the following attributes:</p>
<ul>
<li>
<p><code>email</code> : <a href="mailto:foo@example.com">foo@example.com</a> - Email address of the target</p>
</li>
<li>
<p><code>time</code> : 2015-1-1T01:02:03.000000Z (datetime) - The timestamp the event was created</p>
</li>
<li>
<p><code>message</code> : Campaign Created (string) - The event message</p>
</li>
</ul>
</section></div><div class="middle"><div id="campaigns-campaigns" class="resource"><h3 class="resource-heading">Campaigns <a href="#campaigns-campaigns" class="permalink">&para;</a></h3></div></div><div class="right"><div class="definition"><span class="method get">GET</span>&nbsp;<span class="uri"><span class="hostname">http://localhost:3333/api</span>/campaigns</span></div><div class="tabs"><div class="tabs"><div class="example-names"><span>Responses</span><span class="tab-button">200</span><span class="tab-button">404</span></div><div class="tab"><div><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 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 Attachment"</span></span>,
"<span class="hljs-attribute">content</span>": <span class="hljs-value"><span class="hljs-string">"Hello, world!"</span></span>,
"<span class="hljs-attribute">type</span>": <span class="hljs-value"><span class="hljs-string">"text/plain"</span>
</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">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 class="hljs-attribute">id</span>": <span class="hljs-value"><span class="hljs-number">1</span></span>,
"<span class="hljs-attribute">email</span>": <span class="hljs-value"><span class="hljs-string">"foo@example.com"</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">status</span>": <span class="hljs-value"><span class="hljs-string">"Email Sent"</span></span>,
"<span class="hljs-attribute">ip</span>": <span class="hljs-value"><span class="hljs-string">"1.2.3.4"</span></span>,
"<span class="hljs-attribute">latitude</span>": <span class="hljs-value"><span class="hljs-number">0</span></span>,
"<span class="hljs-attribute">longitude</span>": <span class="hljs-value"><span class="hljs-number">0</span>
</span>}
]</span>,
"<span class="hljs-attribute">timeline</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">email</span>": <span class="hljs-value"><span class="hljs-string">"foo@example.com"</span></span>,
"<span class="hljs-attribute">time</span>": <span class="hljs-value"><span class="hljs-string">"2015-01-01T01:02:03.000000Z"</span></span>,
"<span class="hljs-attribute">message</span>": <span class="hljs-value"><span class="hljs-string">"Campaign Created"</span>
</span>}
]</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 class="hljs-attribute">host</span>": <span class="hljs-value"><span class="hljs-string">"smtp.example.com:25"</span></span>,
"<span class="hljs-attribute">username</span>": <span class="hljs-value"><span class="hljs-string">"foo"</span></span>,
"<span class="hljs-attribute">password</span>": <span class="hljs-value"><span class="hljs-string">"bar"</span></span>,
"<span class="hljs-attribute">from_address</span>": <span class="hljs-value"><span class="hljs-string">"John Doe &lt;foo@example.com&gt;"</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">$schema</span>": <span class="hljs-value"><span class="hljs-string">"http://json-schema.org/draft-04/schema#"</span></span>,
"<span class="hljs-attribute">type</span>": <span class="hljs-value"><span class="hljs-string">"array"</span>
</span>}</code></pre><div style="height: 1px;"></div></div></div></div><div class="tab"><div><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>[]</code></pre><div style="height: 1px;"></div></div></div></div></div></div></div><div class="middle"><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></div><hr class="split"><div class="right"><div class="definition"><span class="method post">POST</span>&nbsp;<span class="uri"><span class="hostname">http://localhost:3333/api</span>/campaigns</span></div><div class="tabs"><div class="example-names"><span>Requests</span><span class="tab-button">example 1</span></div><div class="tab"><div><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 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 Attachment"</span></span>,
"<span class="hljs-attribute">content</span>": <span class="hljs-value"><span class="hljs-string">""</span></span>,
"<span class="hljs-attribute">type</span>": <span class="hljs-value"><span class="hljs-string">"text/plain"</span>
</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">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 class="hljs-attribute">id</span>": <span class="hljs-value"><span class="hljs-number">1</span></span>,
"<span class="hljs-attribute">email</span>": <span class="hljs-value"><span class="hljs-string">"foo@example.com"</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">status</span>": <span class="hljs-value"><span class="hljs-string">"Email Sent"</span></span>,
"<span class="hljs-attribute">ip</span>": <span class="hljs-value"><span class="hljs-string">"1.2.3.4"</span></span>,
"<span class="hljs-attribute">latitude</span>": <span class="hljs-value"><span class="hljs-number">0</span></span>,
"<span class="hljs-attribute">longitude</span>": <span class="hljs-value"><span class="hljs-number">0</span>
</span>}
]</span>,
"<span class="hljs-attribute">timeline</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">email</span>": <span class="hljs-value"><span class="hljs-string">"foo@example.com"</span></span>,
"<span class="hljs-attribute">time</span>": <span class="hljs-value"><span class="hljs-string">"2015-01-01T01:02:03.000000Z"</span></span>,
"<span class="hljs-attribute">message</span>": <span class="hljs-value"><span class="hljs-string">"Campaign Created"</span>
</span>}
]</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 class="hljs-attribute">host</span>": <span class="hljs-value"><span class="hljs-string">"smtp.example.com:25"</span></span>,
"<span class="hljs-attribute">username</span>": <span class="hljs-value"><span class="hljs-string">"foo"</span></span>,
"<span class="hljs-attribute">password</span>": <span class="hljs-value"><span class="hljs-string">"bar"</span></span>,
"<span class="hljs-attribute">from_address</span>": <span class="hljs-value"><span class="hljs-string">"John Doe &lt;foo@example.com&gt;"</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></div></div><div class="tabs"><div class="example-names"><span>Responses</span><span class="tab-button">201</span><span class="tab-button">400</span></div><div class="tab"><div><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 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 Attachment"</span></span>,
"<span class="hljs-attribute">content</span>": <span class="hljs-value"><span class="hljs-string">"Hello, world!"</span></span>,
"<span class="hljs-attribute">type</span>": <span class="hljs-value"><span class="hljs-string">"text/plain"</span>
</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">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 class="hljs-attribute">id</span>": <span class="hljs-value"><span class="hljs-number">1</span></span>,
"<span class="hljs-attribute">email</span>": <span class="hljs-value"><span class="hljs-string">"foo@example.com"</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">status</span>": <span class="hljs-value"><span class="hljs-string">"Email Sent"</span></span>,
"<span class="hljs-attribute">ip</span>": <span class="hljs-value"><span class="hljs-string">"1.2.3.4"</span></span>,
"<span class="hljs-attribute">latitude</span>": <span class="hljs-value"><span class="hljs-number">0</span></span>,
"<span class="hljs-attribute">longitude</span>": <span class="hljs-value"><span class="hljs-number">0</span>
</span>}
]</span>,
"<span class="hljs-attribute">timeline</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">email</span>": <span class="hljs-value"><span class="hljs-string">"foo@example.com"</span></span>,
"<span class="hljs-attribute">time</span>": <span class="hljs-value"><span class="hljs-string">"2015-01-01T01:02:03.000000Z"</span></span>,
"<span class="hljs-attribute">message</span>": <span class="hljs-value"><span class="hljs-string">"Campaign Created"</span>
</span>}
]</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 class="hljs-attribute">host</span>": <span class="hljs-value"><span class="hljs-string">"smtp.example.com:25"</span></span>,
"<span class="hljs-attribute">username</span>": <span class="hljs-value"><span class="hljs-string">"foo"</span></span>,
"<span class="hljs-attribute">password</span>": <span class="hljs-value"><span class="hljs-string">"bar"</span></span>,
"<span class="hljs-attribute">from_address</span>": <span class="hljs-value"><span class="hljs-string">"John Doe &lt;foo@example.com&gt;"</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">$schema</span>": <span class="hljs-value"><span class="hljs-string">"http://json-schema.org/draft-04/schema#"</span></span>,
"<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 class="hljs-attribute">description</span>": <span class="hljs-value"><span class="hljs-string">"The results of the campaign"</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 class="hljs-attribute">description</span>": <span class="hljs-value"><span class="hljs-string">"The event timeline"</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 class="hljs-attribute">host</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 hostname and port for the SMTP server"</span>
</span>}</span>,
"<span class="hljs-attribute">username</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 username used for SMTP authentication"</span>
</span>}</span>,
"<span class="hljs-attribute">password</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 password used for SMTP authentication"</span>
</span>}</span>,
"<span class="hljs-attribute">from_address</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 \"From\" address to spoof"</span>
</span>}
</span>}</span>,
"<span class="hljs-attribute">required</span>": <span class="hljs-value">[
<span class="hljs-string">"id"</span>,
<span class="hljs-string">"host"</span>,
<span class="hljs-string">"username"</span>,
<span class="hljs-string">"password"</span>,
<span class="hljs-string">"from_address"</span>
]</span>,
"<span class="hljs-attribute">description</span>": <span class="hljs-value"><span class="hljs-string">"The SMTP settings used in the campaign"</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>}</code></pre><div style="height: 1px;"></div></div></div></div><div class="tab"><div><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-literal">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">$schema</span>": <span class="hljs-value"><span class="hljs-string">"http://json-schema.org/draft-04/schema#"</span></span>,
"<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">"boolean"</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>}</code></pre><div style="height: 1px;"></div></div></div></div></div></div></div></div><div class="middle"><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></div><hr class="split"><div class="middle"><div id="campaigns-campaign" class="resource"><h3 class="resource-heading">Campaign <a href="#campaigns-campaign" class="permalink">&para;</a></h3></div></div><div class="right"><div class="definition"><span class="method get">GET</span>&nbsp;<span class="uri"><span class="hostname">http://localhost:3333/api</span>/campaigns/<span class="hljs-attribute" title="id">1</span></span></div><div class="tabs"><div class="tabs"><div class="example-names"><span>Responses</span><span class="tab-button">200</span><span class="tab-button">404</span></div><div class="tab"><div><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 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 Attachment"</span></span>,
"<span class="hljs-attribute">content</span>": <span class="hljs-value"><span class="hljs-string">"Hello, world!"</span></span>,
"<span class="hljs-attribute">type</span>": <span class="hljs-value"><span class="hljs-string">"text/plain"</span>
</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">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 class="hljs-attribute">id</span>": <span class="hljs-value"><span class="hljs-number">1</span></span>,
"<span class="hljs-attribute">email</span>": <span class="hljs-value"><span class="hljs-string">"foo@example.com"</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">status</span>": <span class="hljs-value"><span class="hljs-string">"Email Sent"</span></span>,
"<span class="hljs-attribute">ip</span>": <span class="hljs-value"><span class="hljs-string">"1.2.3.4"</span></span>,
"<span class="hljs-attribute">latitude</span>": <span class="hljs-value"><span class="hljs-number">0</span></span>,
"<span class="hljs-attribute">longitude</span>": <span class="hljs-value"><span class="hljs-number">0</span>
</span>}
]</span>,
"<span class="hljs-attribute">timeline</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">email</span>": <span class="hljs-value"><span class="hljs-string">"foo@example.com"</span></span>,
"<span class="hljs-attribute">time</span>": <span class="hljs-value"><span class="hljs-string">"2015-01-01T01:02:03.000000Z"</span></span>,
"<span class="hljs-attribute">message</span>": <span class="hljs-value"><span class="hljs-string">"Campaign Created"</span>
</span>}
]</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 class="hljs-attribute">host</span>": <span class="hljs-value"><span class="hljs-string">"smtp.example.com:25"</span></span>,
"<span class="hljs-attribute">username</span>": <span class="hljs-value"><span class="hljs-string">"foo"</span></span>,
"<span class="hljs-attribute">password</span>": <span class="hljs-value"><span class="hljs-string">"bar"</span></span>,
"<span class="hljs-attribute">from_address</span>": <span class="hljs-value"><span class="hljs-string">"John Doe &lt;foo@example.com&gt;"</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">$schema</span>": <span class="hljs-value"><span class="hljs-string">"http://json-schema.org/draft-04/schema#"</span></span>,
"<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 class="hljs-attribute">description</span>": <span class="hljs-value"><span class="hljs-string">"The results of the campaign"</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 class="hljs-attribute">description</span>": <span class="hljs-value"><span class="hljs-string">"The event timeline"</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 class="hljs-attribute">host</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 hostname and port for the SMTP server"</span>
</span>}</span>,
"<span class="hljs-attribute">username</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 username used for SMTP authentication"</span>
</span>}</span>,
"<span class="hljs-attribute">password</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 password used for SMTP authentication"</span>
</span>}</span>,
"<span class="hljs-attribute">from_address</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 \"From\" address to spoof"</span>
</span>}
</span>}</span>,
"<span class="hljs-attribute">required</span>": <span class="hljs-value">[
<span class="hljs-string">"id"</span>,
<span class="hljs-string">"host"</span>,
<span class="hljs-string">"username"</span>,
<span class="hljs-string">"password"</span>,
<span class="hljs-string">"from_address"</span>
]</span>,
"<span class="hljs-attribute">description</span>": <span class="hljs-value"><span class="hljs-string">"The SMTP settings used in the campaign"</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>}</code></pre><div style="height: 1px;"></div></div></div></div><div class="tab"><div><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></div></div><div class="middle"><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>URI 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></div><hr class="split"><div class="right"><div class="definition"><span class="method delete">DELETE</span>&nbsp;<span class="uri"><span class="hostname">http://localhost:3333/api</span>/campaigns/<span class="hljs-attribute" title="id">1</span></span></div><div class="tabs"><div class="tabs"><div class="example-names"><span>Responses</span><span class="tab-button">200</span><span class="tab-button">404</span></div><div class="tab"><div><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 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><div class="tab"><div><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></div></div><div class="middle"><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>URI 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></div><hr class="split"><div class="middle"><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 (number, required) - Unique identifier</p>
</li>
<li>
<p><code>name</code>: Example Template (string, required) - Name of template</p>
</li>
<li>
<p><code>subject</code>: Example email template subject (string) - Subject of email sent to users</p>
</li>
<li>
<p><code>text</code>: <code>This is a test message!</code> (string) - 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> (string) - HTML of email sent to users</p>
</li>
<li>
<p><code>attachments</code>: array[Attachment] - 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>
</section></div><div class="middle"><div id="templates-templates" class="resource"><h3 class="resource-heading">Templates <a href="#templates-templates" class="permalink">&para;</a></h3></div></div><div class="right"><div class="definition"><span class="method get">GET</span>&nbsp;<span class="uri"><span class="hostname">http://localhost:3333/api</span>/templates</span></div><div class="tabs"><div class="tabs"><div class="example-names"><span>Responses</span><span class="tab-button">200</span><span class="tab-button">404</span></div><div class="tab"><div><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 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 Attachment"</span></span>,
"<span class="hljs-attribute">content</span>": <span class="hljs-value"><span class="hljs-string">"Hello, world!"</span></span>,
"<span class="hljs-attribute">type</span>": <span class="hljs-value"><span class="hljs-string">"text/plain"</span>
</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">$schema</span>": <span class="hljs-value"><span class="hljs-string">"http://json-schema.org/draft-04/schema#"</span></span>,
"<span class="hljs-attribute">type</span>": <span class="hljs-value"><span class="hljs-string">"array"</span>
</span>}</code></pre><div style="height: 1px;"></div></div></div></div><div class="tab"><div><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>[]</code></pre><div style="height: 1px;"></div></div></div></div></div></div></div><div class="middle"><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></div><hr class="split"><div class="right"><div class="definition"><span class="method post">POST</span>&nbsp;<span class="uri"><span class="hostname">http://localhost:3333/api</span>/templates</span></div><div class="tabs"><div class="example-names"><span>Requests</span><span class="tab-button">example 1</span></div><div class="tab"><div><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 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 Attachment"</span></span>,
"<span class="hljs-attribute">content</span>": <span class="hljs-value"><span class="hljs-string">"Hello, world!"</span></span>,
"<span class="hljs-attribute">type</span>": <span class="hljs-value"><span class="hljs-string">"text/plain"</span>
</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">$schema</span>": <span class="hljs-value"><span class="hljs-string">"http://json-schema.org/draft-04/schema#"</span></span>,
"<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>}</code></pre><div style="height: 1px;"></div></div></div><div class="tabs"><div class="example-names"><span>Responses</span><span class="tab-button">201</span><span class="tab-button">400</span></div><div class="tab"><div><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 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 Attachment"</span></span>,
"<span class="hljs-attribute">content</span>": <span class="hljs-value"><span class="hljs-string">"Hello, world!"</span></span>,
"<span class="hljs-attribute">type</span>": <span class="hljs-value"><span class="hljs-string">"text/plain"</span>
</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">$schema</span>": <span class="hljs-value"><span class="hljs-string">"http://json-schema.org/draft-04/schema#"</span></span>,
"<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>}</code></pre><div style="height: 1px;"></div></div></div></div><div class="tab"><div><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-literal">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">$schema</span>": <span class="hljs-value"><span class="hljs-string">"http://json-schema.org/draft-04/schema#"</span></span>,
"<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">"boolean"</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>}</code></pre><div style="height: 1px;"></div></div></div></div></div></div></div></div><div class="middle"><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">
<p><strong>Importing an Existing Email</strong></p>
<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></div><hr class="split"><div class="middle"><div id="templates-template" class="resource"><h3 class="resource-heading">Template <a href="#templates-template" class="permalink">&para;</a></h3></div></div><div class="right"><div class="definition"><span class="method get">GET</span>&nbsp;<span class="uri"><span class="hostname">http://localhost:3333/api</span>/templates/<span class="hljs-attribute" title="id">1</span></span></div><div class="tabs"><div class="tabs"><div class="example-names"><span>Responses</span><span class="tab-button">200</span><span class="tab-button">404</span></div><div class="tab"><div><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 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 Attachment"</span></span>,
"<span class="hljs-attribute">content</span>": <span class="hljs-value"><span class="hljs-string">"Hello, world!"</span></span>,
"<span class="hljs-attribute">type</span>": <span class="hljs-value"><span class="hljs-string">"text/plain"</span>
</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">$schema</span>": <span class="hljs-value"><span class="hljs-string">"http://json-schema.org/draft-04/schema#"</span></span>,
"<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>}</code></pre><div style="height: 1px;"></div></div></div></div><div class="tab"><div><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></div></div><div class="middle"><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>URI 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></div><hr class="split"><div class="right"><div class="definition"><span class="method delete">DELETE</span>&nbsp;<span class="uri"><span class="hostname">http://localhost:3333/api</span>/templates/<span class="hljs-attribute" title="id">1</span></span></div><div class="tabs"><div class="tabs"><div class="example-names"><span>Responses</span><span class="tab-button">200</span><span class="tab-button">404</span></div><div class="tab"><div><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><div class="tab"><div><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></div></div><div class="middle"><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>URI 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></div><hr class="split"><div class="middle"><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 (array[Target]) (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">
<p><strong>Have A Lot of Users to Import?</strong></p>
<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>
</section></div><div class="middle"><div id="groups-groups" class="resource"><h3 class="resource-heading">Groups <a href="#groups-groups" class="permalink">&para;</a></h3></div></div><div class="right"><div class="definition"><span class="method get">GET</span>&nbsp;<span class="uri"><span class="hostname">http://localhost:3333/api</span>/groups</span></div><div class="tabs"><div class="tabs"><div class="example-names"><span>Responses</span><span class="tab-button">200</span><span class="tab-button">404</span></div><div class="tab"><div><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 class="hljs-string">"array[Target]"</span>
</span>}
]</code></pre><div style="height: 1px;"></div><h5>Schema</h5><pre><code>{
"<span class="hljs-attribute">$schema</span>": <span class="hljs-value"><span class="hljs-string">"http://json-schema.org/draft-04/schema#"</span></span>,
"<span class="hljs-attribute">type</span>": <span class="hljs-value"><span class="hljs-string">"array"</span>
</span>}</code></pre><div style="height: 1px;"></div></div></div></div><div class="tab"><div><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>[]</code></pre><div style="height: 1px;"></div></div></div></div></div></div></div><div class="middle"><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></div><hr class="split"><div class="right"><div class="definition"><span class="method post">POST</span>&nbsp;<span class="uri"><span class="hostname">http://localhost:3333/api</span>/groups</span></div><div class="tabs"><div class="example-names"><span>Requests</span><span class="tab-button">example 1</span></div><div class="tab"><div><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 class="hljs-string">"array[Target]"</span>
</span>}</code></pre><div style="height: 1px;"></div><h5>Schema</h5><pre><code>{
"<span class="hljs-attribute">$schema</span>": <span class="hljs-value"><span class="hljs-string">"http://json-schema.org/draft-04/schema#"</span></span>,
"<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">"string"</span></span>,
"<span class="hljs-attribute">description</span>": <span class="hljs-value"><span class="hljs-string">"The targets in the group"</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">"targets"</span>
]
</span>}</code></pre><div style="height: 1px;"></div></div></div><div class="tabs"><div class="example-names"><span>Responses</span><span class="tab-button">201</span><span class="tab-button">400</span></div><div class="tab"><div><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 class="hljs-string">"array[Target]"</span>
</span>}</code></pre><div style="height: 1px;"></div><h5>Schema</h5><pre><code>{
"<span class="hljs-attribute">$schema</span>": <span class="hljs-value"><span class="hljs-string">"http://json-schema.org/draft-04/schema#"</span></span>,
"<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">"string"</span></span>,
"<span class="hljs-attribute">description</span>": <span class="hljs-value"><span class="hljs-string">"The targets in the group"</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">"targets"</span>
]
</span>}</code></pre><div style="height: 1px;"></div></div></div></div><div class="tab"><div><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-literal">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">$schema</span>": <span class="hljs-value"><span class="hljs-string">"http://json-schema.org/draft-04/schema#"</span></span>,
"<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">"boolean"</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>}</code></pre><div style="height: 1px;"></div></div></div></div></div></div></div></div><div class="middle"><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></div><hr class="split"><div class="middle"><div id="groups-group" class="resource"><h3 class="resource-heading">Group <a href="#groups-group" class="permalink">&para;</a></h3></div></div><div class="right"><div class="definition"><span class="method get">GET</span>&nbsp;<span class="uri"><span class="hostname">http://localhost:3333/api</span>/groups/<span class="hljs-attribute" title="id">1</span></span></div><div class="tabs"><div class="tabs"><div class="example-names"><span>Responses</span><span class="tab-button">200</span><span class="tab-button">404</span></div><div class="tab"><div><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 class="hljs-string">"array[Target]"</span>
</span>}</code></pre><div style="height: 1px;"></div><h5>Schema</h5><pre><code>{
"<span class="hljs-attribute">$schema</span>": <span class="hljs-value"><span class="hljs-string">"http://json-schema.org/draft-04/schema#"</span></span>,
"<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">"string"</span></span>,
"<span class="hljs-attribute">description</span>": <span class="hljs-value"><span class="hljs-string">"The targets in the group"</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">"targets"</span>
]
</span>}</code></pre><div style="height: 1px;"></div></div></div></div><div class="tab"><div><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></div></div><div class="middle"><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>URI 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></div><hr class="split"><div class="right"><div class="definition"><span class="method delete">DELETE</span>&nbsp;<span class="uri"><span class="hostname">http://localhost:3333/api</span>/groups/<span class="hljs-attribute" title="id">1</span></span></div><div class="tabs"><div class="tabs"><div class="example-names"><span>Responses</span><span class="tab-button">200</span><span class="tab-button">404</span></div><div class="tab"><div><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><div class="tab"><div><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></div></div><div class="middle"><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>URI 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></div><hr class="split"><div class="middle"><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">
<p><strong>Importing a Site</strong></p>
<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>
</section></div><div class="middle"><div id="pages-pages" class="resource"><h3 class="resource-heading">Pages <a href="#pages-pages" class="permalink">&para;</a></h3></div></div><div class="right"><div class="definition"><span class="method get">GET</span>&nbsp;<span class="uri"><span class="hostname">http://localhost:3333/api</span>/pages</span></div><div class="tabs"><div class="tabs"><div class="example-names"><span>Responses</span><span class="tab-button">200</span><span class="tab-button">404</span></div><div class="tab"><div><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">$schema</span>": <span class="hljs-value"><span class="hljs-string">"http://json-schema.org/draft-04/schema#"</span></span>,
"<span class="hljs-attribute">type</span>": <span class="hljs-value"><span class="hljs-string">"array"</span>
</span>}</code></pre><div style="height: 1px;"></div></div></div></div><div class="tab"><div><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>[]</code></pre><div style="height: 1px;"></div></div></div></div></div></div></div><div class="middle"><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></div><hr class="split"><div class="right"><div class="definition"><span class="method post">POST</span>&nbsp;<span class="uri"><span class="hostname">http://localhost:3333/api</span>/pages</span></div><div class="tabs"><div class="example-names"><span>Requests</span><span class="tab-button">example 1</span></div><div class="tab"><div><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">$schema</span>": <span class="hljs-value"><span class="hljs-string">"http://json-schema.org/draft-04/schema#"</span></span>,
"<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>}</code></pre><div style="height: 1px;"></div></div></div><div class="tabs"><div class="example-names"><span>Responses</span><span class="tab-button">201</span><span class="tab-button">400</span></div><div class="tab"><div><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">$schema</span>": <span class="hljs-value"><span class="hljs-string">"http://json-schema.org/draft-04/schema#"</span></span>,
"<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>}</code></pre><div style="height: 1px;"></div></div></div></div><div class="tab"><div><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-literal">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">$schema</span>": <span class="hljs-value"><span class="hljs-string">"http://json-schema.org/draft-04/schema#"</span></span>,
"<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">"boolean"</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>}</code></pre><div style="height: 1px;"></div></div></div></div></div></div></div></div><div class="middle"><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></div><hr class="split"><div class="middle"><div id="pages-page" class="resource"><h3 class="resource-heading">Page <a href="#pages-page" class="permalink">&para;</a></h3></div></div><div class="right"><div class="definition"><span class="method get">GET</span>&nbsp;<span class="uri"><span class="hostname">http://localhost:3333/api</span>/pages/<span class="hljs-attribute" title="id">1</span></span></div><div class="tabs"><div class="tabs"><div class="example-names"><span>Responses</span><span class="tab-button">200</span><span class="tab-button">404</span></div><div class="tab"><div><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">$schema</span>": <span class="hljs-value"><span class="hljs-string">"http://json-schema.org/draft-04/schema#"</span></span>,
"<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>}</code></pre><div style="height: 1px;"></div></div></div></div><div class="tab"><div><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></div></div><div class="middle"><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>URI 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></div><hr class="split"><div class="right"><div class="definition"><span class="method put">PUT</span>&nbsp;<span class="uri"><span class="hostname">http://localhost:3333/api</span>/pages</span></div><div class="tabs"><div class="example-names"><span>Requests</span><span class="tab-button">example 1</span></div><div class="tab"><div><div class="inner"><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">$schema</span>": <span class="hljs-value"><span class="hljs-string">"http://json-schema.org/draft-04/schema#"</span></span>,
"<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>}</code></pre><div style="height: 1px;"></div></div></div><div class="tabs"><div class="example-names"><span>Responses</span><span class="tab-button">200</span><span class="tab-button">404</span><span class="tab-button">400</span></div><div class="tab"><div><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">$schema</span>": <span class="hljs-value"><span class="hljs-string">"http://json-schema.org/draft-04/schema#"</span></span>,
"<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>}</code></pre><div style="height: 1px;"></div></div></div></div><div class="tab"><div><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 class="tab"><div><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-literal">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">$schema</span>": <span class="hljs-value"><span class="hljs-string">"http://json-schema.org/draft-04/schema#"</span></span>,
"<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">"boolean"</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>}</code></pre><div style="height: 1px;"></div></div></div></div></div></div></div></div><div class="middle"><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></div><hr class="split"><div class="right"><div class="definition"><span class="method delete">DELETE</span>&nbsp;<span class="uri"><span class="hostname">http://localhost:3333/api</span>/pages/<span class="hljs-attribute" title="id">1</span></span></div><div class="tabs"><div class="tabs"><div class="example-names"><span>Responses</span><span class="tab-button">200</span><span class="tab-button">404</span></div><div class="tab"><div><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><div class="tab"><div><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></div></div><div class="middle"><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>URI 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></div><hr class="split"><div class="middle"><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>
</section></div><div class="middle"><div id="import-group" class="resource"><h3 class="resource-heading">Group <a href="#import-group" class="permalink">&para;</a></h3></div></div><div class="right"><div class="definition"><span class="method post">POST</span>&nbsp;<span class="uri"><span class="hostname">http://localhost:3333/api</span>/import/group</span></div><div class="tabs"><div class="example-names"><span>Requests</span><span class="tab-button">example 1</span></div><div class="tab"><div><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="tabs"><div class="example-names"><span>Responses</span><span class="tab-button">201</span><span class="tab-button">400</span></div><div class="tab"><div><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">$schema</span>": <span class="hljs-value"><span class="hljs-string">"http://json-schema.org/draft-04/schema#"</span></span>,
"<span class="hljs-attribute">type</span>": <span class="hljs-value"><span class="hljs-string">"array"</span>
</span>}</code></pre><div style="height: 1px;"></div></div></div></div><div class="tab"><div><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-literal">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">$schema</span>": <span class="hljs-value"><span class="hljs-string">"http://json-schema.org/draft-04/schema#"</span></span>,
"<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">"boolean"</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>}</code></pre><div style="height: 1px;"></div></div></div></div></div></div></div></div><div class="middle"><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></div><hr class="split"><div class="middle"><div id="import-email" class="resource"><h3 class="resource-heading">Email <a href="#import-email" class="permalink">&para;</a></h3></div></div><div class="right"><div class="definition"><span class="method post">POST</span>&nbsp;<span class="uri"><span class="hostname">http://localhost:3333/api</span>/import/email</span></div><div class="tabs"><div class="example-names"><span>Requests</span><span class="tab-button">example 1</span></div><div class="tab"><div><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="tabs"><div class="example-names"><span>Responses</span><span class="tab-button">201</span><span class="tab-button">400</span></div><div class="tab"><div><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">$schema</span>": <span class="hljs-value"><span class="hljs-string">"http://json-schema.org/draft-04/schema#"</span></span>,
"<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>}</code></pre><div style="height: 1px;"></div></div></div></div><div class="tab"><div><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-literal">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">$schema</span>": <span class="hljs-value"><span class="hljs-string">"http://json-schema.org/draft-04/schema#"</span></span>,
"<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">"boolean"</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>}</code></pre><div style="height: 1px;"></div></div></div></div></div></div></div></div><div class="middle"><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></div><hr class="split"><div class="middle"><div id="import-site" class="resource"><h3 class="resource-heading">Site <a href="#import-site" class="permalink">&para;</a></h3></div></div><div class="right"><div class="definition"><span class="method post">POST</span>&nbsp;<span class="uri"><span class="hostname">http://localhost:3333/api</span>/import/site</span></div><div class="tabs"><div class="example-names"><span>Requests</span><span class="tab-button">example 1</span></div><div class="tab"><div><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">$schema</span>": <span class="hljs-value"><span class="hljs-string">"http://json-schema.org/draft-04/schema#"</span></span>,
"<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>}</code></pre><div style="height: 1px;"></div></div></div><div class="tabs"><div class="example-names"><span>Responses</span><span class="tab-button">201</span><span class="tab-button">400</span></div><div class="tab"><div><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">$schema</span>": <span class="hljs-value"><span class="hljs-string">"http://json-schema.org/draft-04/schema#"</span></span>,
"<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>}</code></pre><div style="height: 1px;"></div></div></div></div><div class="tab"><div><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-literal">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">$schema</span>": <span class="hljs-value"><span class="hljs-string">"http://json-schema.org/draft-04/schema#"</span></span>,
"<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">"boolean"</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>}</code></pre><div style="height: 1px;"></div></div></div></div></div></div></div></div><div class="middle"><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></div><hr class="split"><div class="middle"><p style="text-align: center;" class="text-muted">Generated by&nbsp;<a href="https://github.com/danielgtaylor/aglio" class="aglio">aglio</a>&nbsp;on 12 Jan 2016</p></div></div></div></div><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 a list of direct child elements by class name.
*/
function childrenByClass(element, name) {
var filtered = [];
for (var i = 0; i < element.children.length; i++) {
var child = element.children[i];
var classNames = child.className.split(' ');
if (classNames.indexOf(name) !== -1) {
filtered.push(child);
}
}
return filtered;
}
/*
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';
}
}
function toggleTabButton(event) {
var i, index;
var button = event.target;
// Get index of the current button.
var buttons = childrenByClass(button.parentNode, 'tab-button');
for (i = 0; i < buttons.length; i++) {
if (buttons[i] === button) {
index = i;
button.className = 'tab-button active';
} else {
buttons[i].className = 'tab-button';
}
}
// Hide other tabs and show this one.
var tabs = childrenByClass(button.parentNode.parentNode, 'tab');
for (i = 0; i < tabs.length; i++) {
if (i === index) {
tabs[i].style.display = 'block';
} else {
tabs[i].style.display = 'none';
}
}
}
/*
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, j;
// 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]});
}
}
var responseCodes = document.querySelectorAll('.example-names');
for (i = 0; i < responseCodes.length; i++) {
var tabButtons = childrenByClass(responseCodes[i], 'tab-button');
for (j = 0; j < tabButtons.length; j++) {
tabButtons[j].onclick = toggleTabButton;
// Show by default?
if (j === 0) {
toggleTabButton({target: tabButtons[j]});
}
}
}
// 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>