Gophish API
Gophish was built from the ground-up with a JSON API that makes it easy for developers and sysadmins to automate simulated phishing campaigns.
+{{ define "base" }} +Gophish API
Gophish was built from the ground-up with a JSON API that makes it easy for developers and sysadmins to automate simulated phishing campaigns.
These docs describe how to use the gophish API.
Authorization
@@ -29,10 +29,10 @@completed_date
: 2015-1-1T01:02:03.000000Z (datetime) - Date the Campaign was completed
template
: Template
template
: Template
page
: Attributes (Page) (required) - Landing page for users who click the phishing link
page
: Page (required) - Landing page for users who click the phishing link
status
: Emails Sent (required, string) - The current status of the campaign
Delete a CampaignDELETE/campaigns/{id}
Delete a campaign by its ID.
- id
number
(required) Example: 1The Campaign ID
200
Headers
Content-Type: application/json
Body
{
- "id": 1,
- "name": "Example Campaign",
- "created_date": "2015-01-01T01:02:03.000000Z",
- "completed_date": "2015-01-01T01:02:03.000000Z",
- "template": {
- "id": 1,
- "name": "Example Template",
- "subject": "Example email template subject",
- "text": "This is a test message!",
- "html": "<html><head></head><body>This is a test message!</body></html>",
- "attachments": [],
- "modified_date": "2015-01-01T01:02:03.000000Z"
- },
- "page": {
- "id": 1,
- "name": "Example Page",
- "html": "<html><head></head><body>This is a test message!</body></html>",
- "modified_date": "2015-01-01T01:02:03.000000Z"
- },
- "status": "Emails Sent",
- "results": [],
- "timeline": [],
- "smtp": {
- "id": 1
- },
- "url": "http://foo.bar"
-}
Schema
{
- "type": "object",
- "properties": {
- "id": {
- "type": "number",
- "description": "Unique identifier"
- },
- "name": {
- "type": "string",
- "description": "Title of Campaign"
- },
- "created_date": {
- "type": "string",
- "description": "Date the Campaign was created"
- },
- "completed_date": {
- "type": "string",
- "description": "Date the Campaign was completed"
- },
- "template": {
- "type": "object",
- "properties": {
- "id": {
- "type": "number",
- "description": "Unique identifier"
- },
- "name": {
- "type": "string",
- "description": "Name of template"
- },
- "subject": {
- "type": "string",
- "description": "Subject of email sent to users"
- },
- "text": {
- "type": "string",
- "description": "Raw text of email sent to users"
- },
- "html": {
- "type": "string",
- "description": "HTML of email sent to users"
- },
- "attachments": {
- "type": "array",
- "description": "The attachments sent with the email template"
- },
- "modified_date": {
- "type": "string",
- "description": "Date the Template was last modified"
- }
- },
- "required": [
- "id",
- "name"
- ]
- },
- "page": {
- "type": "object",
- "properties": {
- "id": {
- "type": "number",
- "description": "Unique identifier"
- },
- "name": {
- "type": "string",
- "description": "Name of Page"
- },
- "html": {
- "type": "string",
- "description": "HTML of the landing page users hit when clicking links in the email template"
- },
- "modified_date": {
- "type": "string",
- "description": "Date the Page was last modified"
- }
- },
- "required": [
- "id",
- "name",
- "html"
- ]
- },
- "status": {
- "type": "string",
- "description": "The current status of the campaign"
- },
- "results": {
- "type": "array"
- },
- "timeline": {
- "type": "array"
- },
- "smtp": {
- "type": "object",
- "properties": {
- "id": {
- "type": "number",
- "description": "Unique identifier"
- }
- },
- "required": [
- "id"
- ]
- },
- "url": {
- "type": "string",
- "description": "The URL used in the Template sent to users"
- }
- },
- "required": [
- "id",
- "name",
- "status",
- "url"
- ],
- "$schema": "http://json-schema.org/draft-04/schema#"
+ "message": "Page deleted successfully!",
+ "success": true,
+ "data": null
}
404
Headers
Content-Type: application/json
Body
{
"message": "Campaign not found",
"success": false,
@@ -744,6 +605,11 @@ ers
"type": "array",
"$schema": "http://json-schema.org/draft-04/schema#"
}
Create New TemplatePOST/templates
Create a new template
+Importing an Existing Email
+What better way to make pixel-perfect emails than by importing an existing email you already have sitting in your inbox?
+Using the Import Email endpoint, you can take a raw email and import it as a template into gophish.
+Headers
Content-Type: application/json
Body
{
"id": 1,
"name": "Example Template",
@@ -908,50 +774,9 @@ ers
}
Delete a TemplateDELETE/templates/{id}
Delete a template by its ID.
- id
number
(required) Example: 1The Template ID
200
Headers
Content-Type: application/json
Body
{
- "id": 1,
- "name": "Example Template",
- "subject": "Example email template subject",
- "text": "This is a test message!",
- "html": "<html><head></head><body>This is a test message!</body></html>",
- "attachments": [],
- "modified_date": "2015-01-01T01:02:03.000000Z"
-}
Schema
{
- "type": "object",
- "properties": {
- "id": {
- "type": "number",
- "description": "Unique identifier"
- },
- "name": {
- "type": "string",
- "description": "Name of template"
- },
- "subject": {
- "type": "string",
- "description": "Subject of email sent to users"
- },
- "text": {
- "type": "string",
- "description": "Raw text of email sent to users"
- },
- "html": {
- "type": "string",
- "description": "HTML of email sent to users"
- },
- "attachments": {
- "type": "array",
- "description": "The attachments sent with the email template"
- },
- "modified_date": {
- "type": "string",
- "description": "Date the Template was last modified"
- }
- },
- "required": [
- "id",
- "name"
- ],
- "$schema": "http://json-schema.org/draft-04/schema#"
+ "message": "Template deleted successfully!",
+ "success": true,
+ "data": null
}
404
Headers
Content-Type: application/json
Body
{
"message": "Template not found",
"success": false,
@@ -989,6 +814,11 @@ ers
position
: System Administrator - Company position of the Target
+
+Have A Lot of Users to Import?
+If you have all your targets in a CSV file, you can bulk import them into a group using the Import CSV endpoint.
+In the future, we plan to add other importation methods to make setting up groups a breeze.
+
Groups¶
Get GroupsGET/groups
Get a list of groups.
Response 200
Headers
Content-Type: application/json
Body
[
{
@@ -1117,56 +947,14 @@ ers
}
Delete a GroupDELETE/groups/{id}
Delete a Group by its ID.
Parameters- id
number
(required) Example: 1The Template ID
Response 200
Headers
Content-Type: application/json
Body
{
- "id": 1,
- "name": "Example Template",
- "subject": "Example email template subject",
- "text": "This is a test message!",
- "html": "<html><head></head><body>This is a test message!</body></html>",
- "attachments": [],
- "modified_date": "2015-01-01T01:02:03.000000Z"
-}
Schema
{
- "type": "object",
- "properties": {
- "id": {
- "type": "number",
- "description": "Unique identifier"
- },
- "name": {
- "type": "string",
- "description": "Name of template"
- },
- "subject": {
- "type": "string",
- "description": "Subject of email sent to users"
- },
- "text": {
- "type": "string",
- "description": "Raw text of email sent to users"
- },
- "html": {
- "type": "string",
- "description": "HTML of email sent to users"
- },
- "attachments": {
- "type": "array",
- "description": "The attachments sent with the email template"
- },
- "modified_date": {
- "type": "string",
- "description": "Date the Template was last modified"
- }
- },
- "required": [
- "id",
- "name"
- ],
- "$schema": "http://json-schema.org/draft-04/schema#"
+ "message": "Group deleted successfully!",
+ "success": true,
+ "data": null
}
Response 404
Headers
Content-Type: application/json
Body
{
"message": "Group not found",
"success": false,
"data": null
-}
Pages¶
Campaigns object contain the resources needed for gophish to launch and track a simulated phishing campaign.
-Pages¶
Pages are the HTML page that a user lands on after clicking on a phishing link.
+}
Pages¶
Pages are the HTML page that a user lands on after clicking on a phishing link.
-
@@ -1181,7 +969,11 @@ ersid
: 1 (required, number) - Unique identifiermodified_date
:2015-01-01T01:02:03.000000Z
(string) - Date the Page was last modified
Get PagesGET/pages
Get a list of templates.
+Importing a Site
+Let gophish do the hard work for you in importing a site. By using the Import Site endpoint, you can simply give gophish a URL and have the site imported for you.
+Pages¶
Get PagesGET/pages
Get a list of pages.
200
Headers
Content-Type: application/json
Body
[
{
"id": 1,
@@ -1345,49 +1137,19 @@ ers
],
"$schema": "http://json-schema.org/draft-04/schema#"
}
404
Headers
Content-Type: application/json
Body
{
- "message": "Group not found",
+ "message": "Page not found",
"success": false,
"data": null
}
Delete a PageDELETE/pages/{id}
Delete a page by its ID.
- id
number
(required) Example: 1The Page ID
200
Headers
Content-Type: application/json
Body
{
- "id": 1,
- "name": "Example Page",
- "html": "<html><head></head><body>This is a test message!</body></html>",
- "modified_date": "2015-01-01T01:02:03.000000Z"
-}
Schema
{
- "type": "object",
- "properties": {
- "id": {
- "type": "number",
- "description": "Unique identifier"
- },
- "name": {
- "type": "string",
- "description": "Name of Page"
- },
- "html": {
- "type": "string",
- "description": "HTML of the landing page users hit when clicking links in the email template"
- },
- "modified_date": {
- "type": "string",
- "description": "Date the Page was last modified"
- }
- },
- "required": [
- "id",
- "name",
- "html"
- ],
- "$schema": "http://json-schema.org/draft-04/schema#"
+ "message": "Page deleted successfully!",
+ "success": true,
+ "data": null
}
404
Headers
Content-Type: application/json
Body
{
- "message": "Group not found",
- "success": false,
- "data": null
-}
-{
- "error": "Template not found"
+ "message": "Page not found",
+ "success": false,
+ "data": null
}
Import¶
Import functions facilitate the ability to import emails, groups and more using simple interfaces.