openapi: 3.1.0
info:
title: Mailjet API
description: |-
A complete collection of all publicly available endpoints and methods for the Mailjet API.
## Status codes and errors
The Mailjet API uses conventional HTTP response codes to indicate the success or failure of an API request. Overall:
- Codes in the `2xx` range indicate that the request was processed successfully.
- Codes in the `4xx` range indicate that there was an error with the request (e.g. unauthorized access, a required parameter is missing etc.).
- Codes in the `5xx` range indicate that there is an issue with Mailjet's servers.
Error responses will usually include an Error Identifier, Error Message and Status Code.
| Code | Reason | Description |
| --- | --- | --- |
| `200` | OK | All went well. Congrats! |
| `201` | Created | The `POST` request was successfully executed. |
| `204` | No Content | No content found or expected to return. Returned when a `DELETE` request was successful. |
| `304` | Not Modified | The `PUT` request didn't affect any record. |
| `400` | Bad Request | One or more parameters are missing or maybe misspelled (unknown resource or action). |
| `401` | Unauthorized | You have specified an incorrect API Key / API Secret Key pair. You may be unauthorized to access the API or your API key may be inactive. Visit the API keys Management section to check your keys. |
| `403` | Forbidden | You are not authorized to access this resource. |
| `404` | Not Found | The resource with the specified ID you are trying to reach does not exist. |
| `405` | Method Not Allowed | The method requested on the resource does not exist. |
| `429` | Too Many Requests | You have reached the maximum number of calls allowed per minute by our API. Please review your integration to reduce the number of calls issued by your system. |
| `500` | Internal Server Error | Something went wrong on our side. When such an error occurs, the response contains an error identifier (e.g. `"ErrorIdentifier": "D4DF574C-0C5F-45C7-BA52-7AA8E533C3DE"`), which is crucial for tracking the problem and identifying the root cause. Please contact our support team, providing the error identifier. |
version: 1.0.0
servers:
- url: https://api.mailjet.com
paths:
"/v3.1/send":
post:
x-seo:
title: "Send an email message via Send API v3.1"
description: "Send API v3.1 is built mainly for reliability, providing very detailed information in case of sending errors. This results in a lower sending limit\u2026"
tags:
- Send Emails
summary: Send an email message via Send API v3.1
description: "Send API v3.1 is built mainly for reliability, providing very detailed information in case of sending errors. This results in a lower sending limit, however - Send API v3.1 allows you to send up to 50 messages in a single API call, as opposed to v3, where the limit is 100 messages per call.\n\nAdditionally, Send API v3.1 includes a Sandbox mode. When enabled, the API will perform all the required validations and return success or error messages, but the message will not be sent.\n"
operationId: postSendV31
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/NewSendAPIv31Send'
example:
Messages:
- From:
Email: no-reply@example.com
Name: Example Sender
To:
- Email: contact@example.com
Name: Example Contact
Subject: Hello from Mailjet
TextPart: Greetings from Mailjet!
HTMLPart:
Hello from Mailjet
responses:
'201':
description: Default OK response for `/send`
content:
application/json:
schema:
type: object
properties:
Messages:
description: A JSON array containing message objects.
type: array
items:
$ref: '#/components/schemas/OutputSendAPIv31Send'
'400':
$ref: '#/components/responses/400'
'401':
$ref: '#/components/responses/401'
'403':
$ref: '#/components/responses/403'
'404':
$ref: '#/components/responses/404'
'429':
$ref: '#/components/responses/429'
'500':
$ref: '#/components/responses/500'
security:
- basicAuth: []
x-codeSamples:
- lang: curl
label: cURL
source: "curl -s \\\n\t-X POST \\\n\t--user \"$MJ_APIKEY_PUBLIC:$MJ_APIKEY_PRIVATE\" \\\n\thttps://api.mailjet.com/v3.1/send \\\n\t-H 'Content-Type: application/json' \\\n\t-d '{\n \"SandboxMode\":true,\n \"Messages\":[\n {\n \"From\":{\n \"Email\":\"pilot@mailjet.com\",\n \"Name\":\"Your Mailjet Pilot\"\n },\n \"HTMLPart\":\"Dear passenger, welcome to Mailjet!
May the delivery force be with you!\",\n \"Subject\":\"Your email flight plan!\",\n \"TextPart\":\"Dear passenger, welcome to Mailjet! May the delivery force be with you!\",\n \"To\":[\n {\n \"Email\":\"passenger@mailjet.com\",\n \"Name\":\"Passenger 1\"\n }\n ]\n }\n ]\n\t}'"
- lang: PHP
label: PHP
source: " 'v3.1']);\n$body = [\n 'SandboxMode' => true,\n 'Messages' => [\n [\n 'From' => [\n 'Email' => \"pilot@mailjet.com\",\n 'Name' => \"Your Mailjet Pilot\"\n ],\n 'HTMLPart' => \"Dear passenger, welcome to Mailjet!
May the delivery force be with you!\",\n 'Subject' => \"Your email flight plan!\",\n 'TextPart' => \"Dear passenger, welcome to Mailjet! May the delivery force be with you!\",\n 'To' => [\n [\n 'Email' => \"passenger@mailjet.com\",\n 'Name' => \"Passenger 1\"\n ]\n ]\n ]\n ]\n];\n$response = $mj->post(Resources::$Email, ['body' => $body]);\n$response->success() && var_dump($response->getData());\n?>"
- lang: Node.js
label: Node
source: "const mailjet = require ('node-mailjet')\n\t.connect(process.env.MJ_APIKEY_PUBLIC, process.env.MJ_APIKEY_PRIVATE)\nconst request = mailjet\n\t.post(\"send\", {'version': 'v3.1'})\n\t.request({\n \"SandboxMode\":true,\n \"Messages\":[\n {\n \"From\":{\n \"Email\":\"pilot@mailjet.com\",\n \"Name\":\"Your Mailjet Pilot\"\n },\n \"HTMLPart\":\"Dear passenger, welcome to Mailjet!
May the delivery force be with you!\",\n \"Subject\":\"Your email flight plan!\",\n \"TextPart\":\"Dear passenger, welcome to Mailjet! May the delivery force be with you!\",\n \"To\":[\n {\n \"Email\":\"passenger@mailjet.com\",\n \"Name\":\"Passenger 1\"\n }\n ]\n }\n ]\n })\nrequest\n\t.then((result) => {\n\t\tconsole.log(result.body)\n\t})\n\t.catch((err) => {\n\t\tconsole.log(err.statusCode)\n\t})"
- lang: Ruby
label: Ruby
source: "require 'mailjet'\nMailjet.configure do |config|\n config.api_key = ENV['MJ_APIKEY_PUBLIC']\n config.secret_key = ENV['MJ_APIKEY_PRIVATE']\n config.api_version = \"v3.1\"\nend\nvariable = Mailjet::Send.create(\n sandbox_mode: true,\n messages: [\n {\n 'from': {\n 'email' => \"pilot@mailjet.com\",\n 'name' => \"Your Mailjet Pilot\"\n },\n 'htmlpart' => \"Dear passenger, welcome to Mailjet!
May the delivery force be with you!\",\n 'subject' => \"Your email flight plan!\",\n 'text_part' => \"Dear passenger, welcome to Mailjet! May the delivery force be with you!\",\n 'to': [\n {\n 'email' => \"passenger@mailjet.com\",\n 'name' => \"Passenger 1\"\n }\n ]\n }\n ]\n)\np variable.attributes['Messages']"
- lang: Python
label: Python
source: "from mailjet_rest import Client\nimport os\napi_key = os.environ['MJ_APIKEY_PUBLIC']\napi_secret = os.environ['MJ_APIKEY_PRIVATE']\nmailjet = Client(auth=(api_key, api_secret), version='v3.1')\ndata = {\n 'SandboxMode': True,\n 'Messages': [\n {\n 'From': {\n \"Email\": \"pilot@mailjet.com\",\n \"Name\": \"Your Mailjet Pilot\"\n },\n \"HTMLPart\": \"Dear passenger, welcome to Mailjet!
May the delivery force be with you!\",\n \"Subject\": \"Your email flight plan!\",\n \"TextPart\": \"Dear passenger, welcome to Mailjet! May the delivery force be with you!\",\n 'To': [\n {\n \"Email\": \"passenger@mailjet.com\",\n \"Name\": \"Passenger 1\"\n }\n ]\n }\n ]\n}\nresult = mailjet.send.create(data=data)\nprint result.status_code\nprint result.json()"
- lang: Java
label: Java
source: "package com.my.project;\nimport com.mailjet.client.errors.MailjetException;\nimport com.mailjet.client.errors.MailjetSocketTimeoutException;\nimport com.mailjet.client.MailjetClient;\nimport com.mailjet.client.MailjetRequest;\nimport com.mailjet.client.MailjetResponse;\nimport com.mailjet.client.ClientOptions;\nimport com.mailjet.client.resource.Emailv31;\nimport org.json.JSONArray;\nimport org.json.JSONObject;\npublic class MyClass {\n public static void main(String[] args) throws MailjetException, MailjetSocketTimeoutException {\n MailjetClient client;\n MailjetRequest request;\n MailjetResponse response;\n client = new MailjetClient(System.getenv(\"MJ_APIKEY_PUBLIC\"), System.getenv(\"MJ_APIKEY_PRIVATE\"), new ClientOptions(\"v3.1\"));\n request = new MailjetRequest(Emailv31.resource)\n .property(Emailv31.SANDBOXMODE, true)\n .property(Emailv31.MESSAGES, new JSONArray()\n .put(new JSONObject()\n .put(Emailv31.Message.FROM, new JSONObject()\n .put(\"Email\", \"pilot@mailjet.com\")\n .put(\"Name\", \"Your Mailjet Pilot\")\n )\n .put(\"HTMLPart\", \"Dear passenger, welcome to Mailjet!
May the delivery force be with you!\")\n .put(\"Subject\", \"Your email flight plan!\")\n .put(\"TextPart\", \"Dear passenger, welcome to Mailjet! May the delivery force be with you!\")\n .put(Emailv31.Message.TO, new JSONArray()\n .put(new JSONObject()\n .put(\"Email\", \"passenger@mailjet.com\")\n .put(\"Name\", \"Passenger 1\")\n )\n )\n )\n )\n );\n response = client.post(request);\n System.out.println(response.getStatus());\n System.out.println(response.getData());\n }\n}"
- lang: C#
label: C#
source: "using Mailjet.Client;\nusing Mailjet.Client.Resources;\nusing System;\nusing Newtonsoft.Json.Linq;\nnamespace Mailjet.ConsoleApplication\n{\n class Program\n {\n static void Main(string[] args)\n {\n RunAsync().Wait();\n }\n static async Task RunAsync()\n {\n MailjetClient client = new MailjetClient(Environment.GetEnvironmentVariable(\"MJ_APIKEY_PUBLIC\"), Environment.GetEnvironmentVariable(\"MJ_APIKEY_PRIVATE\"))\n {\n Version = ApiVersion.V3_1,\n };\n MailjetRequest request = new MailjetRequest\n {\n Resource = Send.Resource,\n }\n .Property(Send.SandboxMode, true)\n .Property(Send.Messages, new JArray {\n new JObject {\n {\"From\", new JObject {\n {\"Email\", \"pilot@mailjet.com\"},\n {\"Name\", \"Your Mailjet Pilot\"}\n }},\n {\"HTMLPart\", \"Dear passenger, welcome to Mailjet!
May the delivery force be with you!\"},\n {\"Subject\", \"Your email flight plan!\"},\n {\"TextPart\", \"Dear passenger, welcome to Mailjet! May the delivery force be with you!\"},\n {\"To\", new JArray {\n new JObject {\n {\"Email\", \"passenger@mailjet.com\"},\n {\"Name\", \"Passenger 1\"}\n }\n }}\n }\n });\n MailjetResponse response = await client.PostAsync(request);\n if (response.IsSuccessStatusCode)\n {\n Console.WriteLine(string.Format(\"Total: {0}, Count: {1}\\n\", response.GetTotal(), response.GetCount()));\n Console.WriteLine(response.GetData());\n }\n else\n {\n Console.WriteLine(string.Format(\"StatusCode: {0}\\n\", response.StatusCode));\n Console.WriteLine(string.Format(\"ErrorInfo: {0}\\n\", response.GetErrorInfo()));\n Console.WriteLine(response.GetData());\n Console.WriteLine(string.Format(\"ErrorMessage: {0}\\n\", response.GetErrorMessage()));\n }\n }\n }\n}"
"/v3/send":
post:
x-seo:
title: "Send an email message via Send API v3"
description: "Send a message via Send API v3. Send API v3 is built mainly for speed, allowing you to send up to 100 messages in a single API call, as opposed to v3.1\u2026"
tags:
- Send Emails
summary: Send an email message via Send API v3
description: Send a message via Send API v3. Send API v3 is built mainly for speed, allowing you to send up to 100 messages in a single API call, as opposed to v3.1, where the limit is 50 messages per call. However, it lacks some of the more complex functionalities of Send API v3.1 like detailed feedback information in case of sending errors.
operationId: postSendV3
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/NewMessageSendAPIv3Send'
example:
FromEmail: no-reply@example.com
FromName: Example Sender
To: Example Contact
Subject: Hello from Mailjet
Text-part: Greetings from Mailjet!
Html-part: Hello from Mailjet
responses:
'201':
description: Default OK response for /send
content:
application/json:
schema:
type: object
properties:
Sent:
type: array
items:
$ref: '#/components/schemas/OutputSendAPIv3Send'
'400':
$ref: '#/components/responses/400'
'401':
$ref: '#/components/responses/401'
'403':
$ref: '#/components/responses/403'
'404':
$ref: '#/components/responses/404'
'429':
$ref: '#/components/responses/429'
'500':
$ref: '#/components/responses/500'
security:
- basicAuth: []
x-codeSamples:
- lang: curl
label: cURL
source: "curl -s \\\n\t-X POST \\\n\t--user \"$MJ_APIKEY_PUBLIC:$MJ_APIKEY_PRIVATE\" \\\n\thttps://api.mailjet.com/v3/send \\\n\t-H 'Content-Type: application/json' \\\n\t-d '{\n \"FromEmail\":\"pilot@mailjet.com\",\n \"FromName\":\"Your Mailjet Pilot\",\n \"Recipients\":[\n {\n \"Email\":\"passenger@mailjet.com\",\n \"Name\":\"Passenger 1\"\n }\n ],\n \"Subject\":\"Your email flight plan!\",\n \"Text-part\":\"Dear passenger, welcome to Mailjet! May the delivery force be with you!\",\n \"Html-part\":\"Dear passenger, welcome to Mailjet!
May the delivery force be with you!\"\n\t}'"
- lang: PHP
label: PHP
source: " 'v3']);\n$body = [\n 'FromEmail' => \"pilot@mailjet.com\",\n 'FromName' => \"Your Mailjet Pilot\",\n 'Recipients' => [\n [\n 'Email' => \"passenger@mailjet.com\",\n 'Name' => \"Passenger 1\"\n ]\n ],\n 'Subject' => \"Your email flight plan!\",\n 'Text-part' => \"Dear passenger, welcome to Mailjet! May the delivery force be with you!\",\n 'Html-part' => \"Dear passenger, welcome to Mailjet!
May the delivery force be with you!\"\n];\n$response = $mj->post(Resources::$Email, ['body' => $body]);\n$response->success() && var_dump($response->getData());\n?>"
- lang: Node.js
label: Node
source: "const mailjet = require ('node-mailjet')\n\t.connect(process.env.MJ_APIKEY_PUBLIC, process.env.MJ_APIKEY_PRIVATE)\nconst request = mailjet\n\t.post(\"send\", {'version': 'v3'})\n\t.request({\n \"FromEmail\":\"pilot@mailjet.com\",\n \"FromName\":\"Your Mailjet Pilot\",\n \"Recipients\":[\n {\n \"Email\":\"passenger@mailjet.com\",\n \"Name\":\"Passenger 1\"\n }\n ],\n \"Subject\":\"Your email flight plan!\",\n \"Text-part\":\"Dear passenger, welcome to Mailjet! May the delivery force be with you!\",\n \"Html-part\":\"Dear passenger, welcome to Mailjet!
May the delivery force be with you!\"\n })\nrequest\n\t.then((result) => {\n\t\tconsole.log(result.body)\n\t})\n\t.catch((err) => {\n\t\tconsole.log(err.statusCode)\n\t})"
- lang: Ruby
label: Ruby
source: "require 'mailjet'\nMailjet.configure do |config|\n config.api_key = ENV['MJ_APIKEY_PUBLIC']\n config.secret_key = ENV['MJ_APIKEY_PRIVATE']\n config.api_version = \"v3\"\nend\nvariable = Mailjet::Send.create(\n from_email: \"pilot@mailjet.com\",\n from_name: \"Your Mailjet Pilot\",\n recipients: [\n {\n 'email' => \"passenger@mailjet.com\",\n 'name' => \"Passenger 1\"\n }\n ],\n ,\n subject: \"Your email flight plan!\",\n text_part: \"Dear passenger, welcome to Mailjet! May the delivery force be with you!\",\n html_part: \"Dear passenger, welcome to Mailjet!
May the delivery force be with you!\"\n)\np variable.attributes['Messages']"
- lang: Python
label: Python
source: "from mailjet_rest import Client\nimport os\napi_key = os.environ['MJ_APIKEY_PUBLIC']\napi_secret = os.environ['MJ_APIKEY_PRIVATE']\nmailjet = Client(auth=(api_key, api_secret), version='v3')\ndata = {\n 'FromEmail': \"pilot@mailjet.com\",\n 'FromName': \"Your Mailjet Pilot\",\n 'Recipients': [\n {\n \"Email\": \"passenger@mailjet.com\",\n \"Name\": \"Passenger 1\"\n }\n ],\n 'Subject': \"Your email flight plan!\",\n 'Text-part': \"Dear passenger, welcome to Mailjet! May the delivery force be with you!\",\n 'Html-part': \"Dear passenger, welcome to Mailjet!
May the delivery force be with you!\"\n}\nresult = mailjet.send.create(data=data)\nprint result.status_code\nprint result.json()"
- lang: Java
label: Java
source: "package com.my.project;\nimport com.mailjet.client.errors.MailjetException;\nimport com.mailjet.client.errors.MailjetSocketTimeoutException;\nimport com.mailjet.client.MailjetClient;\nimport com.mailjet.client.MailjetRequest;\nimport com.mailjet.client.MailjetResponse;\nimport com.mailjet.client.ClientOptions;\nimport com.mailjet.client.resource.Emailv31;\nimport org.json.JSONArray;\nimport org.json.JSONObject;\npublic class MyClass {\n public static void main(String[] args) throws MailjetException, MailjetSocketTimeoutException {\n MailjetClient client;\n MailjetRequest request;\n MailjetResponse response;\n client = new MailjetClient(System.getenv(\"MJ_APIKEY_PUBLIC\"), System.getenv(\"MJ_APIKEY_PRIVATE\"), new ClientOptions(\"v3\"));\n request = new MailjetRequest(Emailv31.resource)\n .property(Emailv31.FROMEMAIL, \"pilot@mailjet.com\")\n .property(Emailv31.FROMNAME, \"Your Mailjet Pilot\")\n .property(Emailv31.RECIPIENTS, new JSONArray()\n .put(new JSONObject()\n .put(\"Email\", \"passenger@mailjet.com\")\n .put(\"Name\", \"Passenger 1\")\n )\n )\n .property(Emailv31.SUBJECT, \"Your email flight plan!\")\n .property(Emailv31.TEXTPART, \"Dear passenger, welcome to Mailjet! May the delivery force be with you!\")\n .property(Emailv31.HTMLPART, \"Dear passenger, welcome to Mailjet!
May the delivery force be with you!\")\n );\n response = client.post(request);\n System.out.println(response.getStatus());\n System.out.println(response.getData());\n }\n}"
- lang: C#
label: C#
source: "using Mailjet.Client;\nusing Mailjet.Client.Resources;\nusing System;\nusing Newtonsoft.Json.Linq;\nnamespace Mailjet.ConsoleApplication\n{\n class Program\n {\n static void Main(string[] args)\n {\n RunAsync().Wait();\n }\n static async Task RunAsync()\n {\n MailjetClient client = new MailjetClient(Environment.GetEnvironmentVariable(\"MJ_APIKEY_PUBLIC\"), Environment.GetEnvironmentVariable(\"MJ_APIKEY_PRIVATE\"))\n {\n Version = ApiVersion.V3,\n };\n MailjetRequest request = new MailjetRequest\n {\n Resource = Send.Resource,\n }\n .Property(Send.FromEmail, \"pilot@mailjet.com\")\n .Property(Send.FromName, \"Your Mailjet Pilot\")\n .Property(Send.Recipients, new JArray {\n new JObject {\n {\"Email\", \"passenger@mailjet.com\"},\n {\"Name\", \"Passenger 1\"}\n }\n })\n .Property(Send.Subject, \"Your email flight plan!\")\n .Property(Send.Textpart, \"Dear passenger, welcome to Mailjet! May the delivery force be with you!\")\n .Property(Send.Htmlpart, \"Dear passenger, welcome to Mailjet!
May the delivery force be with you!\");\n MailjetResponse response = await client.PostAsync(request);\n if (response.IsSuccessStatusCode)\n {\n Console.WriteLine(string.Format(\"Total: {0}, Count: {1}\\n\", response.GetTotal(), response.GetCount()));\n Console.WriteLine(response.GetData());\n }\n else\n {\n Console.WriteLine(string.Format(\"StatusCode: {0}\\n\", response.StatusCode));\n Console.WriteLine(string.Format(\"ErrorInfo: {0}\\n\", response.GetErrorInfo()));\n Console.WriteLine(response.GetData());\n Console.WriteLine(string.Format(\"ErrorMessage: {0}\\n\", response.GetErrorMessage()));\n }\n }\n }\n}"
"/v3/REST/message":
get:
x-seo:
title: "Message List"
description: "Message List in the Mailjet Email API. Get a list of messages with specific information on the type of content, tracking, sending and delivery."
tags:
- Messages
summary: Message List
description: Get a list of messages with specific information on the type of content, tracking, sending and delivery.
operationId: get_v3_message
parameters:
- name: Campaign
in: query
schema:
$ref: '#/components/schemas/get_v3_message_QueryParams/properties/Campaign'
- name: Contact
in: query
schema:
$ref: '#/components/schemas/get_v3_message_QueryParams/properties/Contact'
- name: CustomID
in: query
schema:
$ref: '#/components/schemas/get_v3_message_QueryParams/properties/CustomID'
- name: Destination
in: query
schema:
$ref: '#/components/schemas/get_v3_message_QueryParams/properties/Destination'
- name: FromTS
in: query
schema:
$ref: '#/components/schemas/get_v3_message_QueryParams/properties/FromTS'
- name: FromType
in: query
schema:
$ref: '#/components/schemas/get_v3_message_QueryParams/properties/FromType'
- name: MessageState
in: query
schema:
$ref: '#/components/schemas/get_v3_message_QueryParams/properties/MessageState'
- name: MessageStatus
in: query
schema:
$ref: '#/components/schemas/get_v3_message_QueryParams/properties/MessageStatus'
- name: PlanSubscription
in: query
schema:
$ref: '#/components/schemas/get_v3_message_QueryParams/properties/PlanSubscription'
- name: SenderID
in: query
schema:
$ref: '#/components/schemas/get_v3_message_QueryParams/properties/SenderID'
- name: ShowContactAlt
in: query
schema:
$ref: '#/components/schemas/get_v3_message_QueryParams/properties/ShowContactAlt'
- name: ShowCustomID
in: query
schema:
$ref: '#/components/schemas/get_v3_message_QueryParams/properties/ShowCustomID'
- name: ShowSubject
in: query
schema:
$ref: '#/components/schemas/get_v3_message_QueryParams/properties/ShowSubject'
- name: ToTS
in: query
schema:
$ref: '#/components/schemas/get_v3_message_QueryParams/properties/ToTS'
responses:
'200':
description: Default OK response for `/message`
content:
application/json:
schema:
type: object
properties:
Count:
description: Indicates the number of objects in the `Data` array.
type: integer
format: int64
examples:
- 1
Data:
description: A JSON array containing a list of objects returned by this endpoint.
type: array
items:
$ref: '#/components/schemas/OutputMessage'
Total:
description: Indicates the number of objects in the `Data` array.
type: integer
format: int64
examples:
- 1
'400':
$ref: '#/components/responses/400'
'401':
$ref: '#/components/responses/401'
'403':
$ref: '#/components/responses/403'
'404':
$ref: '#/components/responses/404'
'429':
$ref: '#/components/responses/429'
'500':
$ref: '#/components/responses/500'
security:
- basicAuth: []
x-codeSamples:
- lang: curl
label: cURL
source: "curl -s \\\n\t-X GET \\\n\t--user \"$MJ_APIKEY_PUBLIC:$MJ_APIKEY_PRIVATE\" \\\n\thttps://api.mailjet.com/v3/REST/message \\"
- lang: PHP
label: PHP
source: " 'v3']);\n$response = $mj->get(Resources::$Message);\n$response->success() && var_dump($response->getData());\n?>"
- lang: Node.js
label: Node
source: "const mailjet = require ('node-mailjet')\n\t.connect(process.env.MJ_APIKEY_PUBLIC, process.env.MJ_APIKEY_PRIVATE)\nconst request = mailjet\n\t.get(\"message\", {'version': 'v3'})\n\t.request()\nrequest\n\t.then((result) => {\n\t\tconsole.log(result.body)\n\t})\n\t.catch((err) => {\n\t\tconsole.log(err.statusCode)\n\t})"
- lang: Ruby
label: Ruby
source: "require 'mailjet'\nMailjet.configure do |config|\n config.api_key = ENV['MJ_APIKEY_PUBLIC']\n config.secret_key = ENV['MJ_APIKEY_PRIVATE']\n config.api_version = \"v3\"\nend\nvariable = Mailjet::Message.all(\n)\np variable.attributes['Data']"
- lang: Python
label: Python
source: "from mailjet_rest import Client\nimport os\napi_key = os.environ['MJ_APIKEY_PUBLIC']\napi_secret = os.environ['MJ_APIKEY_PRIVATE']\nmailjet = Client(auth=(api_key, api_secret), version='v3')\nresult = mailjet.message.get()\nprint result.status_code\nprint result.json()"
- lang: Java
label: Java
source: "package com.my.project;\nimport com.mailjet.client.errors.MailjetException;\nimport com.mailjet.client.errors.MailjetSocketTimeoutException;\nimport com.mailjet.client.MailjetClient;\nimport com.mailjet.client.MailjetRequest;\nimport com.mailjet.client.MailjetResponse;\nimport com.mailjet.client.ClientOptions;\nimport com.mailjet.client.resource.Message;\nimport org.json.JSONArray;\nimport org.json.JSONObject;\npublic class MyClass {\n public static void main(String[] args) throws MailjetException, MailjetSocketTimeoutException {\n MailjetClient client;\n MailjetRequest request;\n MailjetResponse response;\n client = new MailjetClient(System.getenv(\"MJ_APIKEY_PUBLIC\"), System.getenv(\"MJ_APIKEY_PRIVATE\"), new ClientOptions(\"v3\"));\n request = new MailjetRequest(Message.resource);\n response = client.get(request);\n System.out.println(response.getStatus());\n System.out.println(response.getData());\n }\n}"
- lang: Go
label: Go
source: "package main\nimport (\n\t\"fmt\"\n\t\"log\"\n\t\"os\"\n\tmailjet \"github.com/mailjet/mailjet-apiv3-go\"\n\t\"github.com/mailjet/mailjet-apiv3-go/resources\"\n)\nfunc main () {\n\tmailjetClient := NewMailjetClient(os.Getenv(\"MJ_APIKEY_PUBLIC\"), os.Getenv(\"MJ_APIKEY_PRIVATE\"))\n\tvar data []resources.Message\n\t_, _, err := mailjetClient.List(\"message\", &data)\n\tif err != nil {\n\t fmt.Println(err)\n\t}\n\tfmt.Printf(\"Data array: %+v\\n\", data)\n}"
- lang: C#
label: C#
source: "using Mailjet.Client;\nusing Mailjet.Client.Resources;\nusing System;\nusing Newtonsoft.Json.Linq;\nnamespace Mailjet.ConsoleApplication\n{\n class Program\n {\n static void Main(string[] args)\n {\n RunAsync().Wait();\n }\n static async Task RunAsync()\n {\n MailjetClient client = new MailjetClient(Environment.GetEnvironmentVariable(\"MJ_APIKEY_PUBLIC\"), Environment.GetEnvironmentVariable(\"MJ_APIKEY_PRIVATE\"))\n {\n Version = ApiVersion.V3,\n };\n MailjetRequest request = new MailjetRequest\n {\n Resource = Message.Resource,\n }\n MailjetResponse response = await client.GetAsync(request);\n if (response.IsSuccessStatusCode)\n {\n Console.WriteLine(string.Format(\"Total: {0}, Count: {1}\\n\", response.GetTotal(), response.GetCount()));\n Console.WriteLine(response.GetData());\n }\n else\n {\n Console.WriteLine(string.Format(\"StatusCode: {0}\\n\", response.StatusCode));\n Console.WriteLine(string.Format(\"ErrorInfo: {0}\\n\", response.GetErrorInfo()));\n Console.WriteLine(response.GetData());\n Console.WriteLine(string.Format(\"ErrorMessage: {0}\\n\", response.GetErrorMessage()));\n }\n }\n }\n}"
"/v3/REST/message/{message_ID}":
get:
x-seo:
title: "Message by ID"
description: "Retrieve specific information on the type of content, tracking, sending and delivery for a specific processed message."
tags:
- Messages
summary: Message by ID
description: Retrieve specific information on the type of content, tracking, sending and delivery for a specific processed message. To obtain a valid `message_ID`, first call `GET /v3/REST/message` to list your messages.
operationId: get_v3_message_id
parameters:
- name: message_ID
in: path
schema:
$ref: '#/components/schemas/get_v3_message_id_PathParams/properties/message_ID'
required: true
example: 7000
responses:
'200':
description: Default OK response for `/message`
content:
application/json:
schema:
type: object
properties:
Count:
description: Indicates the number of objects in the `Data` array.
type: integer
format: int64
examples:
- 1
Data:
description: A JSON array containing a list of objects returned by this endpoint.
type: array
items:
$ref: '#/components/schemas/OutputMessage'
Total:
description: Indicates the number of objects in the `Data` array.
type: integer
format: int64
examples:
- 1
'400':
$ref: '#/components/responses/400'
'401':
$ref: '#/components/responses/401'
'403':
$ref: '#/components/responses/403'
'404':
$ref: '#/components/responses/404'
'429':
$ref: '#/components/responses/429'
'500':
$ref: '#/components/responses/500'
security:
- basicAuth: []
x-codeSamples:
- lang: curl
label: cURL
source: "curl -s \\\n\t-X GET \\\n\t--user \"$MJ_APIKEY_PUBLIC:$MJ_APIKEY_PRIVATE\" \\\n\thttps://api.mailjet.com/v3/REST/message/$message_ID \\"
- lang: PHP
label: PHP
source: " 'v3']);\n$response = $mj->get(Resources::$Message, ['id' => $id]);\n$response->success() && var_dump($response->getData());\n?>"
- lang: Node.js
label: Node
source: "const mailjet = require ('node-mailjet')\n\t.connect(process.env.MJ_APIKEY_PUBLIC, process.env.MJ_APIKEY_PRIVATE)\nconst request = mailjet\n\t.get(\"message\", {'version': 'v3'})\n\t.id($message_ID)\n\t.request()\nrequest\n\t.then((result) => {\n\t\tconsole.log(result.body)\n\t})\n\t.catch((err) => {\n\t\tconsole.log(err.statusCode)\n\t})"
- lang: Ruby
label: Ruby
source: "require 'mailjet'\nMailjet.configure do |config|\n config.api_key = ENV['MJ_APIKEY_PUBLIC']\n config.secret_key = ENV['MJ_APIKEY_PRIVATE']\n config.api_version = \"v3\"\nend\nvariable = Mailjet::Message.find($message_ID\n)\np variable.attributes['Data']"
- lang: Python
label: Python
source: "from mailjet_rest import Client\nimport os\napi_key = os.environ['MJ_APIKEY_PUBLIC']\napi_secret = os.environ['MJ_APIKEY_PRIVATE']\nmailjet = Client(auth=(api_key, api_secret), version='v3')\nid = '$message_ID'\nresult = mailjet.message.get(id=id)\nprint result.status_code\nprint result.json()"
- lang: Java
label: Java
source: "package com.my.project;\nimport com.mailjet.client.errors.MailjetException;\nimport com.mailjet.client.errors.MailjetSocketTimeoutException;\nimport com.mailjet.client.MailjetClient;\nimport com.mailjet.client.MailjetRequest;\nimport com.mailjet.client.MailjetResponse;\nimport com.mailjet.client.ClientOptions;\nimport com.mailjet.client.resource.Message;\nimport org.json.JSONArray;\nimport org.json.JSONObject;\npublic class MyClass {\n public static void main(String[] args) throws MailjetException, MailjetSocketTimeoutException {\n MailjetClient client;\n MailjetRequest request;\n MailjetResponse response;\n client = new MailjetClient(System.getenv(\"MJ_APIKEY_PUBLIC\"), System.getenv(\"MJ_APIKEY_PRIVATE\"), new ClientOptions(\"v3\"));\n request = new MailjetRequest(Message.resource, ID);\n response = client.get(request);\n System.out.println(response.getStatus());\n System.out.println(response.getData());\n }\n}"
- lang: Go
label: Go
source: "package main\nimport (\n\t\"fmt\"\n\t\"log\"\n\t\"os\"\n\tmailjet \"github.com/mailjet/mailjet-apiv3-go\"\n\t\"github.com/mailjet/mailjet-apiv3-go/resources\"\n)\nfunc main () {\n\tmailjetClient := NewMailjetClient(os.Getenv(\"MJ_APIKEY_PUBLIC\"), os.Getenv(\"MJ_APIKEY_PRIVATE\"))\n\tvar data []resources.Message\n\tmr := &Request{\n\t Resource: \"message\",\n\t ID: RESOURCE_ID,\n\t}\n\terr := mailjetClient.Get(mr, &data)\n\tif err != nil {\n\t fmt.Println(err)\n\t}\n\tfmt.Printf(\"Data array: %+v\\n\", data)\n}"
- lang: C#
label: C#
source: "using Mailjet.Client;\nusing Mailjet.Client.Resources;\nusing System;\nusing Newtonsoft.Json.Linq;\nnamespace Mailjet.ConsoleApplication\n{\n class Program\n {\n static void Main(string[] args)\n {\n RunAsync().Wait();\n }\n static async Task RunAsync()\n {\n MailjetClient client = new MailjetClient(Environment.GetEnvironmentVariable(\"MJ_APIKEY_PUBLIC\"), Environment.GetEnvironmentVariable(\"MJ_APIKEY_PRIVATE\"))\n {\n Version = ApiVersion.V3,\n };\n MailjetRequest request = new MailjetRequest\n {\n Resource = Message.Resource,\n ResourceId = ResourceId.Numeric(ID)\n }\n MailjetResponse response = await client.GetAsync(request);\n if (response.IsSuccessStatusCode)\n {\n Console.WriteLine(string.Format(\"Total: {0}, Count: {1}\\n\", response.GetTotal(), response.GetCount()));\n Console.WriteLine(response.GetData());\n }\n else\n {\n Console.WriteLine(string.Format(\"StatusCode: {0}\\n\", response.StatusCode));\n Console.WriteLine(string.Format(\"ErrorInfo: {0}\\n\", response.GetErrorInfo()));\n Console.WriteLine(response.GetData());\n Console.WriteLine(string.Format(\"ErrorMessage: {0}\\n\", response.GetErrorMessage()));\n }\n }\n }\n}"
/v3/REST/messagehistory/{message_ID}:
get:
x-seo:
title: "Message History by ID"
description: "Message History by ID in the Mailjet Email API. Retrieve the event history (sending, open, click etc.) for a specific message."
tags:
- Messages
summary: Message History by ID
description: Retrieve the event history (sending, open, click etc.) for a specific message. To obtain a valid `message_ID`, first call `GET /v3/REST/message` to list your messages.
operationId: get_v3_messagehistory_id
parameters:
- name: message_ID
in: path
schema:
$ref: '#/components/schemas/get_v3_messagehistory_id_PathParams/properties/message_ID'
required: true
example: 7000
responses:
'200':
description: Default OK response for `/messagehistory`
content:
application/json:
schema:
type: object
properties:
Count:
description: Indicates the number of objects in the `Data` array.
type: integer
format: int64
examples:
- 1
Data:
description: A JSON array containing a list of objects returned by this endpoint.
type: array
items:
$ref: '#/components/schemas/OutputMessagehistory'
Total:
description: Indicates the number of objects in the `Data` array.
type: integer
format: int64
examples:
- 1
'400':
$ref: '#/components/responses/400'
'401':
$ref: '#/components/responses/401'
'403':
$ref: '#/components/responses/403'
'404':
$ref: '#/components/responses/404'
'429':
$ref: '#/components/responses/429'
'500':
$ref: '#/components/responses/500'
security:
- basicAuth: []
x-codeSamples:
- lang: curl
label: cURL
source: "curl -s \\\n\t-X GET \\\n\t--user \"$MJ_APIKEY_PUBLIC:$MJ_APIKEY_PRIVATE\" \\\n\thttps://api.mailjet.com/v3/REST/messagehistory/$message_ID \\"
- lang: PHP
label: PHP
source: " 'v3']);\n$response = $mj->get(Resources::$Messagehistory, ['id' => $id]);\n$response->success() && var_dump($response->getData());\n?>"
- lang: Node.js
label: Node
source: "const mailjet = require ('node-mailjet')\n\t.connect(process.env.MJ_APIKEY_PUBLIC, process.env.MJ_APIKEY_PRIVATE)\nconst request = mailjet\n\t.get(\"messagehistory\", {'version': 'v3'})\n\t.id($message_ID)\n\t.request()\nrequest\n\t.then((result) => {\n\t\tconsole.log(result.body)\n\t})\n\t.catch((err) => {\n\t\tconsole.log(err.statusCode)\n\t})"
- lang: Ruby
label: Ruby
source: "require 'mailjet'\nMailjet.configure do |config|\n config.api_key = ENV['MJ_APIKEY_PUBLIC']\n config.secret_key = ENV['MJ_APIKEY_PRIVATE']\n config.api_version = \"v3\"\nend\nvariable = Mailjet::Messagehistory.find($message_ID\n)\np variable.attributes['Data']"
- lang: Python
label: Python
source: "from mailjet_rest import Client\nimport os\napi_key = os.environ['MJ_APIKEY_PUBLIC']\napi_secret = os.environ['MJ_APIKEY_PRIVATE']\nmailjet = Client(auth=(api_key, api_secret), version='v3')\nid = '$message_ID'\nresult = mailjet.messagehistory.get(id=id)\nprint result.status_code\nprint result.json()"
- lang: Java
label: Java
source: "package com.my.project;\nimport com.mailjet.client.errors.MailjetException;\nimport com.mailjet.client.errors.MailjetSocketTimeoutException;\nimport com.mailjet.client.MailjetClient;\nimport com.mailjet.client.MailjetRequest;\nimport com.mailjet.client.MailjetResponse;\nimport com.mailjet.client.ClientOptions;\nimport com.mailjet.client.resource.Messagehistory;\nimport org.json.JSONArray;\nimport org.json.JSONObject;\npublic class MyClass {\n public static void main(String[] args) throws MailjetException, MailjetSocketTimeoutException {\n MailjetClient client;\n MailjetRequest request;\n MailjetResponse response;\n client = new MailjetClient(System.getenv(\"MJ_APIKEY_PUBLIC\"), System.getenv(\"MJ_APIKEY_PRIVATE\"), new ClientOptions(\"v3\"));\n request = new MailjetRequest(Messagehistory.resource, ID);\n response = client.get(request);\n System.out.println(response.getStatus());\n System.out.println(response.getData());\n }\n}"
- lang: Go
label: Go
source: "package main\nimport (\n\t\"fmt\"\n\t\"log\"\n\t\"os\"\n\tmailjet \"github.com/mailjet/mailjet-apiv3-go\"\n\t\"github.com/mailjet/mailjet-apiv3-go/resources\"\n)\nfunc main () {\n\tmailjetClient := NewMailjetClient(os.Getenv(\"MJ_APIKEY_PUBLIC\"), os.Getenv(\"MJ_APIKEY_PRIVATE\"))\n\tvar data []resources.Messagehistory\n\tmr := &Request{\n\t Resource: \"messagehistory\",\n\t ID: RESOURCE_ID,\n\t}\n\terr := mailjetClient.Get(mr, &data)\n\tif err != nil {\n\t fmt.Println(err)\n\t}\n\tfmt.Printf(\"Data array: %+v\\n\", data)\n}"
- lang: C#
label: C#
source: "using Mailjet.Client;\nusing Mailjet.Client.Resources;\nusing System;\nusing Newtonsoft.Json.Linq;\nnamespace Mailjet.ConsoleApplication\n{\n class Program\n {\n static void Main(string[] args)\n {\n RunAsync().Wait();\n }\n static async Task RunAsync()\n {\n MailjetClient client = new MailjetClient(Environment.GetEnvironmentVariable(\"MJ_APIKEY_PUBLIC\"), Environment.GetEnvironmentVariable(\"MJ_APIKEY_PRIVATE\"))\n {\n Version = ApiVersion.V3,\n };\n MailjetRequest request = new MailjetRequest\n {\n Resource = Messagehistory.Resource,\n ResourceId = ResourceId.Numeric(ID)\n }\n MailjetResponse response = await client.GetAsync(request);\n if (response.IsSuccessStatusCode)\n {\n Console.WriteLine(string.Format(\"Total: {0}, Count: {1}\\n\", response.GetTotal(), response.GetCount()));\n Console.WriteLine(response.GetData());\n }\n else\n {\n Console.WriteLine(string.Format(\"StatusCode: {0}\\n\", response.StatusCode));\n Console.WriteLine(string.Format(\"ErrorInfo: {0}\\n\", response.GetErrorInfo()));\n Console.WriteLine(response.GetData());\n Console.WriteLine(string.Format(\"ErrorMessage: {0}\\n\", response.GetErrorMessage()));\n }\n }\n }\n}"
"/v3/REST/messageinformation":
get:
x-seo:
title: "Message Information"
description: "Message Information using the Mailjet Email API. Retrieve sending / size / spam information about all messages."
tags:
- Messages
summary: Message Information
description: Retrieve sending / size / spam information about all messages.
operationId: get_v3_messageinformation
parameters:
- name: CampaignID
in: query
schema:
$ref: '#/components/schemas/get_v3_messageinformation_QueryParams/properties/CampaignID'
- name: ContactsList
in: query
schema:
$ref: '#/components/schemas/get_v3_messageinformation_QueryParams/properties/ContactsList'
- name: CustomCampaign
in: query
schema:
$ref: '#/components/schemas/get_v3_messageinformation_QueryParams/properties/CustomCampaign'
- name: From
in: query
schema:
$ref: '#/components/schemas/get_v3_messageinformation_QueryParams/properties/From'
- name: FromDomain
in: query
schema:
$ref: '#/components/schemas/get_v3_messageinformation_QueryParams/properties/FromDomain'
- name: FromID
in: query
schema:
$ref: '#/components/schemas/get_v3_messageinformation_QueryParams/properties/FromID'
- name: FromTS
in: query
schema:
$ref: '#/components/schemas/get_v3_messageinformation_QueryParams/properties/FromTS'
- name: FromType
in: query
schema:
$ref: '#/components/schemas/get_v3_messageinformation_QueryParams/properties/FromType'
- name: IsDeleted
in: query
schema:
$ref: '#/components/schemas/get_v3_messageinformation_QueryParams/properties/IsDeleted'
- name: IsNewsletterTool
in: query
schema:
$ref: '#/components/schemas/get_v3_messageinformation_QueryParams/properties/IsNewsletterTool'
- name: IsStarred
in: query
schema:
$ref: '#/components/schemas/get_v3_messageinformation_QueryParams/properties/IsStarred'
- name: MessageStatus
in: query
schema:
$ref: '#/components/schemas/get_v3_messageinformation_QueryParams/properties/MessageStatus'
- name: Period
in: query
schema:
$ref: '#/components/schemas/get_v3_messageinformation_QueryParams/properties/Period'
- name: ToTS
in: query
schema:
$ref: '#/components/schemas/get_v3_messageinformation_QueryParams/properties/ToTS'
responses:
'200':
description: Default OK response for `/messageinformation`
content:
application/json:
schema:
type: object
properties:
Count:
description: Indicates the number of objects in the `Data` array.
type: integer
format: int64
examples:
- 1
Data:
description: A JSON array containing a list of objects returned by this endpoint.
type: array
items:
$ref: '#/components/schemas/OutputMessageinformation'
Total:
description: Indicates the number of objects in the `Data` array.
type: integer
format: int64
examples:
- 1
'400':
$ref: '#/components/responses/400'
'401':
$ref: '#/components/responses/401'
'403':
$ref: '#/components/responses/403'
'404':
$ref: '#/components/responses/404'
'429':
$ref: '#/components/responses/429'
'500':
$ref: '#/components/responses/500'
security:
- basicAuth: []
x-codeSamples:
- lang: curl
label: cURL
source: "curl -s \\\n\t-X GET \\\n\t--user \"$MJ_APIKEY_PUBLIC:$MJ_APIKEY_PRIVATE\" \\\n\thttps://api.mailjet.com/v3/REST/messageinformation \\"
- lang: PHP
label: PHP
source: " 'v3']);\n$response = $mj->get(Resources::$Messageinformation);\n$response->success() && var_dump($response->getData());\n?>"
- lang: Node.js
label: Node
source: "const mailjet = require ('node-mailjet')\n\t.connect(process.env.MJ_APIKEY_PUBLIC, process.env.MJ_APIKEY_PRIVATE)\nconst request = mailjet\n\t.get(\"messageinformation\", {'version': 'v3'})\n\t.request()\nrequest\n\t.then((result) => {\n\t\tconsole.log(result.body)\n\t})\n\t.catch((err) => {\n\t\tconsole.log(err.statusCode)\n\t})"
- lang: Ruby
label: Ruby
source: "require 'mailjet'\nMailjet.configure do |config|\n config.api_key = ENV['MJ_APIKEY_PUBLIC']\n config.secret_key = ENV['MJ_APIKEY_PRIVATE']\n config.api_version = \"v3\"\nend\nvariable = Mailjet::Messageinformation.all(\n)\np variable.attributes['Data']"
- lang: Python
label: Python
source: "from mailjet_rest import Client\nimport os\napi_key = os.environ['MJ_APIKEY_PUBLIC']\napi_secret = os.environ['MJ_APIKEY_PRIVATE']\nmailjet = Client(auth=(api_key, api_secret), version='v3')\nresult = mailjet.messageinformation.get()\nprint result.status_code\nprint result.json()"
- lang: Java
label: Java
source: "package com.my.project;\nimport com.mailjet.client.errors.MailjetException;\nimport com.mailjet.client.errors.MailjetSocketTimeoutException;\nimport com.mailjet.client.MailjetClient;\nimport com.mailjet.client.MailjetRequest;\nimport com.mailjet.client.MailjetResponse;\nimport com.mailjet.client.ClientOptions;\nimport com.mailjet.client.resource.Messageinformation;\nimport org.json.JSONArray;\nimport org.json.JSONObject;\npublic class MyClass {\n public static void main(String[] args) throws MailjetException, MailjetSocketTimeoutException {\n MailjetClient client;\n MailjetRequest request;\n MailjetResponse response;\n client = new MailjetClient(System.getenv(\"MJ_APIKEY_PUBLIC\"), System.getenv(\"MJ_APIKEY_PRIVATE\"), new ClientOptions(\"v3\"));\n request = new MailjetRequest(Messageinformation.resource);\n response = client.get(request);\n System.out.println(response.getStatus());\n System.out.println(response.getData());\n }\n}"
- lang: Go
label: Go
source: "package main\nimport (\n\t\"fmt\"\n\t\"log\"\n\t\"os\"\n\tmailjet \"github.com/mailjet/mailjet-apiv3-go\"\n\t\"github.com/mailjet/mailjet-apiv3-go/resources\"\n)\nfunc main () {\n\tmailjetClient := NewMailjetClient(os.Getenv(\"MJ_APIKEY_PUBLIC\"), os.Getenv(\"MJ_APIKEY_PRIVATE\"))\n\tvar data []resources.Messageinformation\n\t_, _, err := mailjetClient.List(\"messageinformation\", &data)\n\tif err != nil {\n\t fmt.Println(err)\n\t}\n\tfmt.Printf(\"Data array: %+v\\n\", data)\n}"
- lang: C#
label: C#
source: "using Mailjet.Client;\nusing Mailjet.Client.Resources;\nusing System;\nusing Newtonsoft.Json.Linq;\nnamespace Mailjet.ConsoleApplication\n{\n class Program\n {\n static void Main(string[] args)\n {\n RunAsync().Wait();\n }\n static async Task RunAsync()\n {\n MailjetClient client = new MailjetClient(Environment.GetEnvironmentVariable(\"MJ_APIKEY_PUBLIC\"), Environment.GetEnvironmentVariable(\"MJ_APIKEY_PRIVATE\"))\n {\n Version = ApiVersion.V3,\n };\n MailjetRequest request = new MailjetRequest\n {\n Resource = Messageinformation.Resource,\n }\n MailjetResponse response = await client.GetAsync(request);\n if (response.IsSuccessStatusCode)\n {\n Console.WriteLine(string.Format(\"Total: {0}, Count: {1}\\n\", response.GetTotal(), response.GetCount()));\n Console.WriteLine(response.GetData());\n }\n else\n {\n Console.WriteLine(string.Format(\"StatusCode: {0}\\n\", response.StatusCode));\n Console.WriteLine(string.Format(\"ErrorInfo: {0}\\n\", response.GetErrorInfo()));\n Console.WriteLine(response.GetData());\n Console.WriteLine(string.Format(\"ErrorMessage: {0}\\n\", response.GetErrorMessage()));\n }\n }\n }\n}"
/v3/REST/messageinformation/{message_ID}:
get:
x-seo:
title: "Message Information by ID"
description: "Message Information by ID in the Mailjet Email API. Retrieve sending / size / spam information about a specific message ID."
tags:
- Messages
summary: Message Information by ID
description: Retrieve sending / size / spam information about a specific message ID. To obtain a valid `message_ID`, first call `GET /v3/REST/message` to list your messages.
operationId: get_v3_messageinformation_id
parameters:
- name: message_ID
in: path
schema:
$ref: '#/components/schemas/get_v3_messageinformation_id_PathParams/properties/message_ID'
required: true
example: 7000
responses:
'200':
description: Default OK response for `/messageinformation`
content:
application/json:
schema:
type: object
properties:
Count:
description: Indicates the number of objects in the `Data` array.
type: integer
format: int64
examples:
- 1
Data:
description: A JSON array containing a list of objects returned by this endpoint.
type: array
items:
$ref: '#/components/schemas/OutputMessageinformation'
Total:
description: Indicates the number of objects in the `Data` array.
type: integer
format: int64
examples:
- 1
'400':
$ref: '#/components/responses/400'
'401':
$ref: '#/components/responses/401'
'403':
$ref: '#/components/responses/403'
'404':
$ref: '#/components/responses/404'
'429':
$ref: '#/components/responses/429'
'500':
$ref: '#/components/responses/500'
security:
- basicAuth: []
x-codeSamples:
- lang: curl
label: cURL
source: "curl -s \\\n\t-X GET \\\n\t--user \"$MJ_APIKEY_PUBLIC:$MJ_APIKEY_PRIVATE\" \\\n\thttps://api.mailjet.com/v3/REST/messageinformation/$message_ID \\"
- lang: PHP
label: PHP
source: " 'v3']);\n$response = $mj->get(Resources::$Messageinformation, ['id' => $id]);\n$response->success() && var_dump($response->getData());\n?>"
- lang: Node.js
label: Node
source: "const mailjet = require ('node-mailjet')\n\t.connect(process.env.MJ_APIKEY_PUBLIC, process.env.MJ_APIKEY_PRIVATE)\nconst request = mailjet\n\t.get(\"messageinformation\", {'version': 'v3'})\n\t.id($message_ID)\n\t.request()\nrequest\n\t.then((result) => {\n\t\tconsole.log(result.body)\n\t})\n\t.catch((err) => {\n\t\tconsole.log(err.statusCode)\n\t})"
- lang: Ruby
label: Ruby
source: "require 'mailjet'\nMailjet.configure do |config|\n config.api_key = ENV['MJ_APIKEY_PUBLIC']\n config.secret_key = ENV['MJ_APIKEY_PRIVATE']\n config.api_version = \"v3\"\nend\nvariable = Mailjet::Messageinformation.find($message_ID\n)\np variable.attributes['Data']"
- lang: Python
label: Python
source: "from mailjet_rest import Client\nimport os\napi_key = os.environ['MJ_APIKEY_PUBLIC']\napi_secret = os.environ['MJ_APIKEY_PRIVATE']\nmailjet = Client(auth=(api_key, api_secret), version='v3')\nid = '$message_ID'\nresult = mailjet.messageinformation.get(id=id)\nprint result.status_code\nprint result.json()"
- lang: Java
label: Java
source: "package com.my.project;\nimport com.mailjet.client.errors.MailjetException;\nimport com.mailjet.client.errors.MailjetSocketTimeoutException;\nimport com.mailjet.client.MailjetClient;\nimport com.mailjet.client.MailjetRequest;\nimport com.mailjet.client.MailjetResponse;\nimport com.mailjet.client.ClientOptions;\nimport com.mailjet.client.resource.Messageinformation;\nimport org.json.JSONArray;\nimport org.json.JSONObject;\npublic class MyClass {\n public static void main(String[] args) throws MailjetException, MailjetSocketTimeoutException {\n MailjetClient client;\n MailjetRequest request;\n MailjetResponse response;\n client = new MailjetClient(System.getenv(\"MJ_APIKEY_PUBLIC\"), System.getenv(\"MJ_APIKEY_PRIVATE\"), new ClientOptions(\"v3\"));\n request = new MailjetRequest(Messageinformation.resource, ID);\n response = client.get(request);\n System.out.println(response.getStatus());\n System.out.println(response.getData());\n }\n}"
- lang: Go
label: Go
source: "package main\nimport (\n\t\"fmt\"\n\t\"log\"\n\t\"os\"\n\tmailjet \"github.com/mailjet/mailjet-apiv3-go\"\n\t\"github.com/mailjet/mailjet-apiv3-go/resources\"\n)\nfunc main () {\n\tmailjetClient := NewMailjetClient(os.Getenv(\"MJ_APIKEY_PUBLIC\"), os.Getenv(\"MJ_APIKEY_PRIVATE\"))\n\tvar data []resources.Messageinformation\n\tmr := &Request{\n\t Resource: \"messageinformation\",\n\t ID: RESOURCE_ID,\n\t}\n\terr := mailjetClient.Get(mr, &data)\n\tif err != nil {\n\t fmt.Println(err)\n\t}\n\tfmt.Printf(\"Data array: %+v\\n\", data)\n}"
- lang: C#
label: C#
source: "using Mailjet.Client;\nusing Mailjet.Client.Resources;\nusing System;\nusing Newtonsoft.Json.Linq;\nnamespace Mailjet.ConsoleApplication\n{\n class Program\n {\n static void Main(string[] args)\n {\n RunAsync().Wait();\n }\n static async Task RunAsync()\n {\n MailjetClient client = new MailjetClient(Environment.GetEnvironmentVariable(\"MJ_APIKEY_PUBLIC\"), Environment.GetEnvironmentVariable(\"MJ_APIKEY_PRIVATE\"))\n {\n Version = ApiVersion.V3,\n };\n MailjetRequest request = new MailjetRequest\n {\n Resource = Messageinformation.Resource,\n ResourceId = ResourceId.Numeric(ID)\n }\n MailjetResponse response = await client.GetAsync(request);\n if (response.IsSuccessStatusCode)\n {\n Console.WriteLine(string.Format(\"Total: {0}, Count: {1}\\n\", response.GetTotal(), response.GetCount()));\n Console.WriteLine(response.GetData());\n }\n else\n {\n Console.WriteLine(string.Format(\"StatusCode: {0}\\n\", response.StatusCode));\n Console.WriteLine(string.Format(\"ErrorInfo: {0}\\n\", response.GetErrorInfo()));\n Console.WriteLine(response.GetData());\n Console.WriteLine(string.Format(\"ErrorMessage: {0}\\n\", response.GetErrorMessage()));\n }\n }\n }\n}"
"/v3/REST/openinformation":
get:
x-seo:
title: "Open Information"
description: "Retrieve a list of all open events and details about them - message, campaign and contact IDs, timestamp etc. If no query parameters are used, will\u2026"
tags:
- Message Events
summary: Open Information
description: "Retrieve a list of all open events and details about them - message, campaign and contact IDs, timestamp etc.\n\n> If no query parameters are used, will return events with `FromTS` equal to the current day at 00:00 UTC.\n"
operationId: get_v3_openinformation
parameters:
- name: CampaignID
in: query
schema:
$ref: '#/components/schemas/get_v3_openinformation_QueryParams/properties/CampaignID'
- name: ContactsList
in: query
schema:
$ref: '#/components/schemas/get_v3_openinformation_QueryParams/properties/ContactsList'
- name: CustomCampaign
in: query
schema:
$ref: '#/components/schemas/get_v3_openinformation_QueryParams/properties/CustomCampaign'
- name: EventFromTs
in: query
schema:
$ref: '#/components/schemas/get_v3_openinformation_QueryParams/properties/EventFromTs'
- name: EventToTs
in: query
schema:
$ref: '#/components/schemas/get_v3_openinformation_QueryParams/properties/EventToTs'
- name: FromTS
in: query
schema:
$ref: '#/components/schemas/get_v3_openinformation_QueryParams/properties/FromTS'
- name: From
in: query
schema:
$ref: '#/components/schemas/get_v3_openinformation_QueryParams/properties/From'
- name: FromDomain
in: query
schema:
$ref: '#/components/schemas/get_v3_openinformation_QueryParams/properties/FromDomain'
- name: FromID
in: query
schema:
$ref: '#/components/schemas/get_v3_openinformation_QueryParams/properties/FromID'
- name: FromType
in: query
schema:
$ref: '#/components/schemas/get_v3_openinformation_QueryParams/properties/FromType'
- name: IsDeleted
in: query
schema:
$ref: '#/components/schemas/get_v3_openinformation_QueryParams/properties/IsDeleted'
- name: MessageStatus
in: query
schema:
$ref: '#/components/schemas/get_v3_openinformation_QueryParams/properties/MessageStatus'
- name: Period
in: query
schema:
$ref: '#/components/schemas/get_v3_openinformation_QueryParams/properties/Period'
- name: ToTS
in: query
schema:
$ref: '#/components/schemas/get_v3_openinformation_QueryParams/properties/ToTS'
responses:
'200':
description: Default OK response for /openinformation
content:
application/json:
schema:
type: object
properties:
Count:
description: Indicates the number of objects in the `Data` array.
type: integer
format: int64
examples:
- 1
Data:
description: A JSON array containing a list of objects returned by this endpoint.
type: array
items:
$ref: '#/components/schemas/OutputOpeninformation'
Total:
description: Indicates the number of objects in the `Data` array.
type: integer
format: int64
examples:
- 1
'400':
$ref: '#/components/responses/400'
'401':
$ref: '#/components/responses/401'
'403':
$ref: '#/components/responses/403'
'404':
$ref: '#/components/responses/404'
'429':
$ref: '#/components/responses/429'
'500':
$ref: '#/components/responses/500'
security:
- basicAuth: []
x-codeSamples:
- lang: curl
label: cURL
source: "curl -s \\\n\t-X GET \\\n\t--user \"$MJ_APIKEY_PUBLIC:$MJ_APIKEY_PRIVATE\" \\\n\thttps://api.mailjet.com/v3/REST/openinformation \\"
- lang: PHP
label: PHP
source: " 'v3']);\n$response = $mj->get(Resources::$Openinformation);\n$response->success() && var_dump($response->getData());\n?>"
- lang: Node.js
label: Node
source: "const mailjet = require ('node-mailjet')\n\t.connect(process.env.MJ_APIKEY_PUBLIC, process.env.MJ_APIKEY_PRIVATE)\nconst request = mailjet\n\t.get(\"openinformation\", {'version': 'v3'})\n\t.request()\nrequest\n\t.then((result) => {\n\t\tconsole.log(result.body)\n\t})\n\t.catch((err) => {\n\t\tconsole.log(err.statusCode)\n\t})"
- lang: Ruby
label: Ruby
source: "require 'mailjet'\nMailjet.configure do |config|\n config.api_key = ENV['MJ_APIKEY_PUBLIC']\n config.secret_key = ENV['MJ_APIKEY_PRIVATE']\n config.api_version = \"v3\"\nend\nvariable = Mailjet::Openinformation.all(\n)\np variable.attributes['Data']"
- lang: Python
label: Python
source: "from mailjet_rest import Client\nimport os\napi_key = os.environ['MJ_APIKEY_PUBLIC']\napi_secret = os.environ['MJ_APIKEY_PRIVATE']\nmailjet = Client(auth=(api_key, api_secret), version='v3')\nresult = mailjet.openinformation.get()\nprint result.status_code\nprint result.json()"
- lang: Java
label: Java
source: "package com.my.project;\nimport com.mailjet.client.errors.MailjetException;\nimport com.mailjet.client.errors.MailjetSocketTimeoutException;\nimport com.mailjet.client.MailjetClient;\nimport com.mailjet.client.MailjetRequest;\nimport com.mailjet.client.MailjetResponse;\nimport com.mailjet.client.ClientOptions;\nimport com.mailjet.client.resource.Openinformation;\nimport org.json.JSONArray;\nimport org.json.JSONObject;\npublic class MyClass {\n public static void main(String[] args) throws MailjetException, MailjetSocketTimeoutException {\n MailjetClient client;\n MailjetRequest request;\n MailjetResponse response;\n client = new MailjetClient(System.getenv(\"MJ_APIKEY_PUBLIC\"), System.getenv(\"MJ_APIKEY_PRIVATE\"), new ClientOptions(\"v3\"));\n request = new MailjetRequest(Openinformation.resource);\n response = client.get(request);\n System.out.println(response.getStatus());\n System.out.println(response.getData());\n }\n}"
- lang: Go
label: Go
source: "package main\nimport (\n\t\"fmt\"\n\t\"log\"\n\t\"os\"\n\tmailjet \"github.com/mailjet/mailjet-apiv3-go\"\n\t\"github.com/mailjet/mailjet-apiv3-go/resources\"\n)\nfunc main () {\n\tmailjetClient := NewMailjetClient(os.Getenv(\"MJ_APIKEY_PUBLIC\"), os.Getenv(\"MJ_APIKEY_PRIVATE\"))\n\tvar data []resources.Openinformation\n\t_, _, err := mailjetClient.List(\"openinformation\", &data)\n\tif err != nil {\n\t fmt.Println(err)\n\t}\n\tfmt.Printf(\"Data array: %+v\\n\", data)\n}"
- lang: C#
label: C#
source: "using Mailjet.Client;\nusing Mailjet.Client.Resources;\nusing System;\nusing Newtonsoft.Json.Linq;\nnamespace Mailjet.ConsoleApplication\n{\n class Program\n {\n static void Main(string[] args)\n {\n RunAsync().Wait();\n }\n static async Task RunAsync()\n {\n MailjetClient client = new MailjetClient(Environment.GetEnvironmentVariable(\"MJ_APIKEY_PUBLIC\"), Environment.GetEnvironmentVariable(\"MJ_APIKEY_PRIVATE\"))\n {\n Version = ApiVersion.V3,\n };\n MailjetRequest request = new MailjetRequest\n {\n Resource = Openinformation.Resource,\n }\n MailjetResponse response = await client.GetAsync(request);\n if (response.IsSuccessStatusCode)\n {\n Console.WriteLine(string.Format(\"Total: {0}, Count: {1}\\n\", response.GetTotal(), response.GetCount()));\n Console.WriteLine(response.GetData());\n }\n else\n {\n Console.WriteLine(string.Format(\"StatusCode: {0}\\n\", response.StatusCode));\n Console.WriteLine(string.Format(\"ErrorInfo: {0}\\n\", response.GetErrorInfo()));\n Console.WriteLine(response.GetData());\n Console.WriteLine(string.Format(\"ErrorMessage: {0}\\n\", response.GetErrorMessage()));\n }\n }\n }\n}"
/v3/REST/openinformation/{message_ID}:
get:
x-seo:
title: "Open Information by ID"
description: "Open Information by ID using the Mailjet Email API. Retrieve open event details for a specific message."
tags:
- Message Events
summary: Open Information by ID
description: Retrieve open event details for a specific message. To obtain a valid `message_ID`, first call `GET /v3/REST/message` to list your messages.
operationId: get_v3_openinformation_id
parameters:
- name: message_ID
in: path
schema:
$ref: '#/components/schemas/get_v3_openinformation_id_PathParams/properties/message_ID'
required: true
example: 7000
responses:
'200':
description: Default OK response for /openinformation
content:
application/json:
schema:
type: object
properties:
Count:
description: Indicates the number of objects in the `Data` array.
type: integer
format: int64
examples:
- 1
Data:
description: A JSON array containing a list of objects returned by this endpoint.
type: array
items:
$ref: '#/components/schemas/OutputOpeninformation'
Total:
description: Indicates the number of objects in the `Data` array.
type: integer
format: int64
examples:
- 1
'400':
$ref: '#/components/responses/400'
'401':
$ref: '#/components/responses/401'
'403':
$ref: '#/components/responses/403'
'404':
$ref: '#/components/responses/404'
'429':
$ref: '#/components/responses/429'
'500':
$ref: '#/components/responses/500'
security:
- basicAuth: []
x-codeSamples:
- lang: curl
label: cURL
source: "curl -s \\\n\t-X GET \\\n\t--user \"$MJ_APIKEY_PUBLIC:$MJ_APIKEY_PRIVATE\" \\\n\thttps://api.mailjet.com/v3/REST/openinformation/$message_ID \\"
- lang: PHP
label: PHP
source: " 'v3']);\n$response = $mj->get(Resources::$Openinformation, ['id' => $id]);\n$response->success() && var_dump($response->getData());\n?>"
- lang: Node.js
label: Node
source: "const mailjet = require ('node-mailjet')\n\t.connect(process.env.MJ_APIKEY_PUBLIC, process.env.MJ_APIKEY_PRIVATE)\nconst request = mailjet\n\t.get(\"openinformation\", {'version': 'v3'})\n\t.id($message_ID)\n\t.request()\nrequest\n\t.then((result) => {\n\t\tconsole.log(result.body)\n\t})\n\t.catch((err) => {\n\t\tconsole.log(err.statusCode)\n\t})"
- lang: Ruby
label: Ruby
source: "require 'mailjet'\nMailjet.configure do |config|\n config.api_key = ENV['MJ_APIKEY_PUBLIC']\n config.secret_key = ENV['MJ_APIKEY_PRIVATE']\n config.api_version = \"v3\"\nend\nvariable = Mailjet::Openinformation.find($message_ID\n)\np variable.attributes['Data']"
- lang: Python
label: Python
source: "from mailjet_rest import Client\nimport os\napi_key = os.environ['MJ_APIKEY_PUBLIC']\napi_secret = os.environ['MJ_APIKEY_PRIVATE']\nmailjet = Client(auth=(api_key, api_secret), version='v3')\nid = '$message_ID'\nresult = mailjet.openinformation.get(id=id)\nprint result.status_code\nprint result.json()"
- lang: Java
label: Java
source: "package com.my.project;\nimport com.mailjet.client.errors.MailjetException;\nimport com.mailjet.client.errors.MailjetSocketTimeoutException;\nimport com.mailjet.client.MailjetClient;\nimport com.mailjet.client.MailjetRequest;\nimport com.mailjet.client.MailjetResponse;\nimport com.mailjet.client.ClientOptions;\nimport com.mailjet.client.resource.Openinformation;\nimport org.json.JSONArray;\nimport org.json.JSONObject;\npublic class MyClass {\n public static void main(String[] args) throws MailjetException, MailjetSocketTimeoutException {\n MailjetClient client;\n MailjetRequest request;\n MailjetResponse response;\n client = new MailjetClient(System.getenv(\"MJ_APIKEY_PUBLIC\"), System.getenv(\"MJ_APIKEY_PRIVATE\"), new ClientOptions(\"v3\"));\n request = new MailjetRequest(Openinformation.resource, ID);\n response = client.get(request);\n System.out.println(response.getStatus());\n System.out.println(response.getData());\n }\n}"
- lang: Go
label: Go
source: "package main\nimport (\n\t\"fmt\"\n\t\"log\"\n\t\"os\"\n\tmailjet \"github.com/mailjet/mailjet-apiv3-go\"\n\t\"github.com/mailjet/mailjet-apiv3-go/resources\"\n)\nfunc main () {\n\tmailjetClient := NewMailjetClient(os.Getenv(\"MJ_APIKEY_PUBLIC\"), os.Getenv(\"MJ_APIKEY_PRIVATE\"))\n\tvar data []resources.Openinformation\n\tmr := &Request{\n\t Resource: \"openinformation\",\n\t ID: RESOURCE_ID,\n\t}\n\terr := mailjetClient.Get(mr, &data)\n\tif err != nil {\n\t fmt.Println(err)\n\t}\n\tfmt.Printf(\"Data array: %+v\\n\", data)\n}"
- lang: C#
label: C#
source: "using Mailjet.Client;\nusing Mailjet.Client.Resources;\nusing System;\nusing Newtonsoft.Json.Linq;\nnamespace Mailjet.ConsoleApplication\n{\n class Program\n {\n static void Main(string[] args)\n {\n RunAsync().Wait();\n }\n static async Task RunAsync()\n {\n MailjetClient client = new MailjetClient(Environment.GetEnvironmentVariable(\"MJ_APIKEY_PUBLIC\"), Environment.GetEnvironmentVariable(\"MJ_APIKEY_PRIVATE\"))\n {\n Version = ApiVersion.V3,\n };\n MailjetRequest request = new MailjetRequest\n {\n Resource = Openinformation.Resource,\n ResourceId = ResourceId.Numeric(ID)\n }\n MailjetResponse response = await client.GetAsync(request);\n if (response.IsSuccessStatusCode)\n {\n Console.WriteLine(string.Format(\"Total: {0}, Count: {1}\\n\", response.GetTotal(), response.GetCount()));\n Console.WriteLine(response.GetData());\n }\n else\n {\n Console.WriteLine(string.Format(\"StatusCode: {0}\\n\", response.StatusCode));\n Console.WriteLine(string.Format(\"ErrorInfo: {0}\\n\", response.GetErrorInfo()));\n Console.WriteLine(response.GetData());\n Console.WriteLine(string.Format(\"ErrorMessage: {0}\\n\", response.GetErrorMessage()));\n }\n }\n }\n}"
"/v3/REST/clickstatistics":
get:
x-seo:
title: "Click Statistics"
description: "Retrieve a list of all click events and details about them - message and contact IDs, timestamp, URL and click delay. Note: If no query parameters are\u2026"
tags:
- Message Events
summary: Click Statistics
description: "Retrieve a list of all click events and details about them - message and contact IDs, timestamp, URL and click delay.\n\n> Note: If no query parameters are used, will return events with `FromTS` equal to the current day at 00:00 UTC.\n"
operationId: get_v3_clickstatistics
parameters:
- name: CampaignID
in: query
schema:
$ref: '#/components/schemas/get_v3_clickstatistics_QueryParams/properties/CampaignID'
- name: ContactsList
in: query
schema:
$ref: '#/components/schemas/get_v3_clickstatistics_QueryParams/properties/ContactsList'
- name: CustomCampaign
in: query
schema:
$ref: '#/components/schemas/get_v3_clickstatistics_QueryParams/properties/CustomCampaign'
- name: EventFromTs
in: query
schema:
$ref: '#/components/schemas/get_v3_clickstatistics_QueryParams/properties/EventFromTs'
- name: EventToTs
in: query
schema:
$ref: '#/components/schemas/get_v3_clickstatistics_QueryParams/properties/EventToTs'
- name: FromTS
in: query
schema:
$ref: '#/components/schemas/get_v3_clickstatistics_QueryParams/properties/FromTS'
- name: From
in: query
schema:
$ref: '#/components/schemas/get_v3_clickstatistics_QueryParams/properties/From'
- name: FromDomain
in: query
schema:
$ref: '#/components/schemas/get_v3_clickstatistics_QueryParams/properties/FromDomain'
- name: FromID
in: query
schema:
$ref: '#/components/schemas/get_v3_clickstatistics_QueryParams/properties/FromID'
- name: FromType
in: query
schema:
$ref: '#/components/schemas/get_v3_clickstatistics_QueryParams/properties/FromType'
- name: IsDeleted
in: query
schema:
$ref: '#/components/schemas/get_v3_clickstatistics_QueryParams/properties/IsDeleted'
- name: IsNewsletterTool
in: query
schema:
$ref: '#/components/schemas/get_v3_clickstatistics_QueryParams/properties/IsNewsletterTool'
- name: MessageID
in: query
schema:
$ref: '#/components/schemas/get_v3_clickstatistics_QueryParams/properties/MessageID'
- name: MessageStatus
in: query
schema:
$ref: '#/components/schemas/get_v3_clickstatistics_QueryParams/properties/MessageStatus'
- name: Period
in: query
schema:
$ref: '#/components/schemas/get_v3_clickstatistics_QueryParams/properties/Period'
- name: ToTS
in: query
schema:
$ref: '#/components/schemas/get_v3_clickstatistics_QueryParams/properties/ToTS'
responses:
'200':
description: Default OK response for `/clickstatistics`
content:
application/json:
schema:
type: object
properties:
Count:
description: Indicates the number of objects in the `Data` array.
type: integer
format: int64
examples:
- 1
Data:
description: A JSON array containing a list of objects returned by this endpoint.
type: array
items:
$ref: '#/components/schemas/OutputClickstatistics'
Total:
description: Indicates the number of objects in the `Data` array.
type: integer
format: int64
examples:
- 1
'400':
$ref: '#/components/responses/400'
'401':
$ref: '#/components/responses/401'
'403':
$ref: '#/components/responses/403'
'404':
$ref: '#/components/responses/404'
'429':
$ref: '#/components/responses/429'
'500':
$ref: '#/components/responses/500'
security:
- basicAuth: []
x-codeSamples:
- lang: curl
label: cURL
source: "curl -s \\\n\t-X GET \\\n\t--user \"$MJ_APIKEY_PUBLIC:$MJ_APIKEY_PRIVATE\" \\\n\thttps://api.mailjet.com/v3/REST/clickstatistics \\"
- lang: PHP
label: PHP
source: " 'v3']);\n$response = $mj->get(Resources::$Clickstatistics);\n$response->success() && var_dump($response->getData());\n?>"
- lang: Node.js
label: Node
source: "const mailjet = require ('node-mailjet')\n\t.connect(process.env.MJ_APIKEY_PUBLIC, process.env.MJ_APIKEY_PRIVATE)\nconst request = mailjet\n\t.get(\"clickstatistics\", {'version': 'v3'})\n\t.request()\nrequest\n\t.then((result) => {\n\t\tconsole.log(result.body)\n\t})\n\t.catch((err) => {\n\t\tconsole.log(err.statusCode)\n\t})"
- lang: Ruby
label: Ruby
source: "require 'mailjet'\nMailjet.configure do |config|\n config.api_key = ENV['MJ_APIKEY_PUBLIC']\n config.secret_key = ENV['MJ_APIKEY_PRIVATE']\n config.api_version = \"v3\"\nend\nvariable = Mailjet::Clickstatistics.all(\n)\np variable.attributes['Data']"
- lang: Python
label: Python
source: "from mailjet_rest import Client\nimport os\napi_key = os.environ['MJ_APIKEY_PUBLIC']\napi_secret = os.environ['MJ_APIKEY_PRIVATE']\nmailjet = Client(auth=(api_key, api_secret), version='v3')\nresult = mailjet.clickstatistics.get()\nprint result.status_code\nprint result.json()"
- lang: Java
label: Java
source: "package com.my.project;\nimport com.mailjet.client.errors.MailjetException;\nimport com.mailjet.client.errors.MailjetSocketTimeoutException;\nimport com.mailjet.client.MailjetClient;\nimport com.mailjet.client.MailjetRequest;\nimport com.mailjet.client.MailjetResponse;\nimport com.mailjet.client.ClientOptions;\nimport com.mailjet.client.resource.Clickstatistics;\nimport org.json.JSONArray;\nimport org.json.JSONObject;\npublic class MyClass {\n public static void main(String[] args) throws MailjetException, MailjetSocketTimeoutException {\n MailjetClient client;\n MailjetRequest request;\n MailjetResponse response;\n client = new MailjetClient(System.getenv(\"MJ_APIKEY_PUBLIC\"), System.getenv(\"MJ_APIKEY_PRIVATE\"), new ClientOptions(\"v3\"));\n request = new MailjetRequest(Clickstatistics.resource);\n response = client.get(request);\n System.out.println(response.getStatus());\n System.out.println(response.getData());\n }\n}"
- lang: Go
label: Go
source: "package main\nimport (\n\t\"fmt\"\n\t\"log\"\n\t\"os\"\n\tmailjet \"github.com/mailjet/mailjet-apiv3-go\"\n\t\"github.com/mailjet/mailjet-apiv3-go/resources\"\n)\nfunc main () {\n\tmailjetClient := NewMailjetClient(os.Getenv(\"MJ_APIKEY_PUBLIC\"), os.Getenv(\"MJ_APIKEY_PRIVATE\"))\n\tvar data []resources.Clickstatistics\n\t_, _, err := mailjetClient.List(\"clickstatistics\", &data)\n\tif err != nil {\n\t fmt.Println(err)\n\t}\n\tfmt.Printf(\"Data array: %+v\\n\", data)\n}"
- lang: C#
label: C#
source: "using Mailjet.Client;\nusing Mailjet.Client.Resources;\nusing System;\nusing Newtonsoft.Json.Linq;\nnamespace Mailjet.ConsoleApplication\n{\n class Program\n {\n static void Main(string[] args)\n {\n RunAsync().Wait();\n }\n static async Task RunAsync()\n {\n MailjetClient client = new MailjetClient(Environment.GetEnvironmentVariable(\"MJ_APIKEY_PUBLIC\"), Environment.GetEnvironmentVariable(\"MJ_APIKEY_PRIVATE\"))\n {\n Version = ApiVersion.V3,\n };\n MailjetRequest request = new MailjetRequest\n {\n Resource = Clickstatistics.Resource,\n }\n MailjetResponse response = await client.GetAsync(request);\n if (response.IsSuccessStatusCode)\n {\n Console.WriteLine(string.Format(\"Total: {0}, Count: {1}\\n\", response.GetTotal(), response.GetCount()));\n Console.WriteLine(response.GetData());\n }\n else\n {\n Console.WriteLine(string.Format(\"StatusCode: {0}\\n\", response.StatusCode));\n Console.WriteLine(string.Format(\"ErrorInfo: {0}\\n\", response.GetErrorInfo()));\n Console.WriteLine(response.GetData());\n Console.WriteLine(string.Format(\"ErrorMessage: {0}\\n\", response.GetErrorMessage()));\n }\n }\n }\n}"
"/v3/REST/bouncestatistics":
get:
x-seo:
title: "Bounce Statistics"
description: "Retrieve a list of all bounce events and details about them - message, contact and campaign IDs, timestamp etc. Note: If no query parameters are used\u2026"
tags:
- Message Events
summary: Bounce Statistics
description: "Retrieve a list of all bounce events and details about them - message, contact and campaign IDs, timestamp etc.\n\n> Note: If no query parameters are used, will return events with `FromTS` equal to the current day at 00:00 UTC.\n"
operationId: get_v3_bouncestatistics
parameters:
- name: CampaignID
in: query
schema:
$ref: '#/components/schemas/get_v3_bouncestatistics_QueryParams/properties/CampaignID'
- name: ContactsList
in: query
schema:
$ref: '#/components/schemas/get_v3_bouncestatistics_QueryParams/properties/ContactsList'
- name: EventFromTs
in: query
schema:
$ref: '#/components/schemas/get_v3_bouncestatistics_QueryParams/properties/EventFromTs'
- name: EventToTs
in: query
schema:
$ref: '#/components/schemas/get_v3_bouncestatistics_QueryParams/properties/EventToTs'
- name: FromTS
in: query
schema:
$ref: '#/components/schemas/get_v3_bouncestatistics_QueryParams/properties/FromTS'
- name: Period
in: query
schema:
$ref: '#/components/schemas/get_v3_bouncestatistics_QueryParams/properties/Period'
- name: ToTS
in: query
schema:
$ref: '#/components/schemas/get_v3_bouncestatistics_QueryParams/properties/ToTS'
responses:
'200':
description: Default OK response for `/bouncestatistics`
content:
application/json:
schema:
type: object
properties:
Count:
description: Indicates the number of objects in the `Data` array.
type: integer
format: int64
examples:
- 1
Data:
description: A JSON array containing a list of objects returned by this endpoint.
type: array
items:
$ref: '#/components/schemas/OutputBouncestatistics'
Total:
description: Indicates the number of objects in the `Data` array.
type: integer
format: int64
examples:
- 1
'400':
$ref: '#/components/responses/400'
'401':
$ref: '#/components/responses/401'
'403':
$ref: '#/components/responses/403'
'404':
$ref: '#/components/responses/404'
'429':
$ref: '#/components/responses/429'
'500':
$ref: '#/components/responses/500'
security:
- basicAuth: []
x-codeSamples:
- lang: curl
label: cURL
source: "curl -s \\\n\t-X GET \\\n\t--user \"$MJ_APIKEY_PUBLIC:$MJ_APIKEY_PRIVATE\" \\\n\thttps://api.mailjet.com/v3/REST/bouncestatistics \\"
- lang: PHP
label: PHP
source: " 'v3']);\n$response = $mj->get(Resources::$Bouncestatistics);\n$response->success() && var_dump($response->getData());\n?>"
- lang: Node.js
label: Node
source: "const mailjet = require ('node-mailjet')\n\t.connect(process.env.MJ_APIKEY_PUBLIC, process.env.MJ_APIKEY_PRIVATE)\nconst request = mailjet\n\t.get(\"bouncestatistics\", {'version': 'v3'})\n\t.request()\nrequest\n\t.then((result) => {\n\t\tconsole.log(result.body)\n\t})\n\t.catch((err) => {\n\t\tconsole.log(err.statusCode)\n\t})"
- lang: Ruby
label: Ruby
source: "require 'mailjet'\nMailjet.configure do |config|\n config.api_key = ENV['MJ_APIKEY_PUBLIC']\n config.secret_key = ENV['MJ_APIKEY_PRIVATE']\n config.api_version = \"v3\"\nend\nvariable = Mailjet::Bouncestatistics.all(\n)\np variable.attributes['Data']"
- lang: Python
label: Python
source: "from mailjet_rest import Client\nimport os\napi_key = os.environ['MJ_APIKEY_PUBLIC']\napi_secret = os.environ['MJ_APIKEY_PRIVATE']\nmailjet = Client(auth=(api_key, api_secret), version='v3')\nresult = mailjet.bouncestatistics.get()\nprint result.status_code\nprint result.json()"
- lang: Java
label: Java
source: "package com.my.project;\nimport com.mailjet.client.errors.MailjetException;\nimport com.mailjet.client.errors.MailjetSocketTimeoutException;\nimport com.mailjet.client.MailjetClient;\nimport com.mailjet.client.MailjetRequest;\nimport com.mailjet.client.MailjetResponse;\nimport com.mailjet.client.ClientOptions;\nimport com.mailjet.client.resource.Bouncestatistics;\nimport org.json.JSONArray;\nimport org.json.JSONObject;\npublic class MyClass {\n public static void main(String[] args) throws MailjetException, MailjetSocketTimeoutException {\n MailjetClient client;\n MailjetRequest request;\n MailjetResponse response;\n client = new MailjetClient(System.getenv(\"MJ_APIKEY_PUBLIC\"), System.getenv(\"MJ_APIKEY_PRIVATE\"), new ClientOptions(\"v3\"));\n request = new MailjetRequest(Bouncestatistics.resource);\n response = client.get(request);\n System.out.println(response.getStatus());\n System.out.println(response.getData());\n }\n}"
- lang: Go
label: Go
source: "package main\nimport (\n\t\"fmt\"\n\t\"log\"\n\t\"os\"\n\tmailjet \"github.com/mailjet/mailjet-apiv3-go\"\n\t\"github.com/mailjet/mailjet-apiv3-go/resources\"\n)\nfunc main () {\n\tmailjetClient := NewMailjetClient(os.Getenv(\"MJ_APIKEY_PUBLIC\"), os.Getenv(\"MJ_APIKEY_PRIVATE\"))\n\tvar data []resources.Bouncestatistics\n\t_, _, err := mailjetClient.List(\"bouncestatistics\", &data)\n\tif err != nil {\n\t fmt.Println(err)\n\t}\n\tfmt.Printf(\"Data array: %+v\\n\", data)\n}"
- lang: C#
label: C#
source: "using Mailjet.Client;\nusing Mailjet.Client.Resources;\nusing System;\nusing Newtonsoft.Json.Linq;\nnamespace Mailjet.ConsoleApplication\n{\n class Program\n {\n static void Main(string[] args)\n {\n RunAsync().Wait();\n }\n static async Task RunAsync()\n {\n MailjetClient client = new MailjetClient(Environment.GetEnvironmentVariable(\"MJ_APIKEY_PUBLIC\"), Environment.GetEnvironmentVariable(\"MJ_APIKEY_PRIVATE\"))\n {\n Version = ApiVersion.V3,\n };\n MailjetRequest request = new MailjetRequest\n {\n Resource = Bouncestatistics.Resource,\n }\n MailjetResponse response = await client.GetAsync(request);\n if (response.IsSuccessStatusCode)\n {\n Console.WriteLine(string.Format(\"Total: {0}, Count: {1}\\n\", response.GetTotal(), response.GetCount()));\n Console.WriteLine(response.GetData());\n }\n else\n {\n Console.WriteLine(string.Format(\"StatusCode: {0}\\n\", response.StatusCode));\n Console.WriteLine(string.Format(\"ErrorInfo: {0}\\n\", response.GetErrorInfo()));\n Console.WriteLine(response.GetData());\n Console.WriteLine(string.Format(\"ErrorMessage: {0}\\n\", response.GetErrorMessage()));\n }\n }\n }\n}"
/v3/REST/bouncestatistics/{message_ID}:
get:
x-seo:
title: "Bounce Statistics by ID"
description: "Bounce Statistics by ID using the Mailjet Email API. Retrieve information about a specific bounce event."
tags:
- Message Events
summary: Bounce Statistics by ID
description: Retrieve information about a specific bounce event. To obtain a valid `message_ID`, first call `GET /v3/REST/message` to list your messages.
operationId: get_v3_bouncestatistics_id
parameters:
- name: message_ID
in: path
schema:
$ref: '#/components/schemas/get_v3_bouncestatistics_id_PathParams/properties/message_ID'
required: true
example: 7000
responses:
'200':
description: Default OK response for `/bouncestatistics`
content:
application/json:
schema:
type: object
properties:
Count:
description: Indicates the number of objects in the `Data` array.
type: integer
format: int64
examples:
- 1
Data:
description: A JSON array containing a list of objects returned by this endpoint.
type: array
items:
$ref: '#/components/schemas/OutputBouncestatistics'
Total:
description: Indicates the number of objects in the `Data` array.
type: integer
format: int64
examples:
- 1
'400':
$ref: '#/components/responses/400'
'401':
$ref: '#/components/responses/401'
'403':
$ref: '#/components/responses/403'
'404':
$ref: '#/components/responses/404'
'429':
$ref: '#/components/responses/429'
'500':
$ref: '#/components/responses/500'
security:
- basicAuth: []
x-codeSamples:
- lang: curl
label: cURL
source: "curl -s \\\n\t-X GET \\\n\t--user \"$MJ_APIKEY_PUBLIC:$MJ_APIKEY_PRIVATE\" \\\n\thttps://api.mailjet.com/v3/REST/bouncestatistics/$message_ID \\"
- lang: PHP
label: PHP
source: " 'v3']);\n$response = $mj->get(Resources::$Bouncestatistics, ['id' => $id]);\n$response->success() && var_dump($response->getData());\n?>"
- lang: Node.js
label: Node
source: "const mailjet = require ('node-mailjet')\n\t.connect(process.env.MJ_APIKEY_PUBLIC, process.env.MJ_APIKEY_PRIVATE)\nconst request = mailjet\n\t.get(\"bouncestatistics\", {'version': 'v3'})\n\t.id($message_ID)\n\t.request()\nrequest\n\t.then((result) => {\n\t\tconsole.log(result.body)\n\t})\n\t.catch((err) => {\n\t\tconsole.log(err.statusCode)\n\t})"
- lang: Ruby
label: Ruby
source: "require 'mailjet'\nMailjet.configure do |config|\n config.api_key = ENV['MJ_APIKEY_PUBLIC']\n config.secret_key = ENV['MJ_APIKEY_PRIVATE']\n config.api_version = \"v3\"\nend\nvariable = Mailjet::Bouncestatistics.find($message_ID\n)\np variable.attributes['Data']"
- lang: Python
label: Python
source: "from mailjet_rest import Client\nimport os\napi_key = os.environ['MJ_APIKEY_PUBLIC']\napi_secret = os.environ['MJ_APIKEY_PRIVATE']\nmailjet = Client(auth=(api_key, api_secret), version='v3')\nid = '$message_ID'\nresult = mailjet.bouncestatistics.get(id=id)\nprint result.status_code\nprint result.json()"
- lang: Java
label: Java
source: "package com.my.project;\nimport com.mailjet.client.errors.MailjetException;\nimport com.mailjet.client.errors.MailjetSocketTimeoutException;\nimport com.mailjet.client.MailjetClient;\nimport com.mailjet.client.MailjetRequest;\nimport com.mailjet.client.MailjetResponse;\nimport com.mailjet.client.ClientOptions;\nimport com.mailjet.client.resource.Bouncestatistics;\nimport org.json.JSONArray;\nimport org.json.JSONObject;\npublic class MyClass {\n public static void main(String[] args) throws MailjetException, MailjetSocketTimeoutException {\n MailjetClient client;\n MailjetRequest request;\n MailjetResponse response;\n client = new MailjetClient(System.getenv(\"MJ_APIKEY_PUBLIC\"), System.getenv(\"MJ_APIKEY_PRIVATE\"), new ClientOptions(\"v3\"));\n request = new MailjetRequest(Bouncestatistics.resource, ID);\n response = client.get(request);\n System.out.println(response.getStatus());\n System.out.println(response.getData());\n }\n}"
- lang: Go
label: Go
source: "package main\nimport (\n\t\"fmt\"\n\t\"log\"\n\t\"os\"\n\tmailjet \"github.com/mailjet/mailjet-apiv3-go\"\n\t\"github.com/mailjet/mailjet-apiv3-go/resources\"\n)\nfunc main () {\n\tmailjetClient := NewMailjetClient(os.Getenv(\"MJ_APIKEY_PUBLIC\"), os.Getenv(\"MJ_APIKEY_PRIVATE\"))\n\tvar data []resources.Bouncestatistics\n\tmr := &Request{\n\t Resource: \"bouncestatistics\",\n\t ID: RESOURCE_ID,\n\t}\n\terr := mailjetClient.Get(mr, &data)\n\tif err != nil {\n\t fmt.Println(err)\n\t}\n\tfmt.Printf(\"Data array: %+v\\n\", data)\n}"
- lang: C#
label: C#
source: "using Mailjet.Client;\nusing Mailjet.Client.Resources;\nusing System;\nusing Newtonsoft.Json.Linq;\nnamespace Mailjet.ConsoleApplication\n{\n class Program\n {\n static void Main(string[] args)\n {\n RunAsync().Wait();\n }\n static async Task RunAsync()\n {\n MailjetClient client = new MailjetClient(Environment.GetEnvironmentVariable(\"MJ_APIKEY_PUBLIC\"), Environment.GetEnvironmentVariable(\"MJ_APIKEY_PRIVATE\"))\n {\n Version = ApiVersion.V3,\n };\n MailjetRequest request = new MailjetRequest\n {\n Resource = Bouncestatistics.Resource,\n ResourceId = ResourceId.Numeric(ID)\n }\n MailjetResponse response = await client.GetAsync(request);\n if (response.IsSuccessStatusCode)\n {\n Console.WriteLine(string.Format(\"Total: {0}, Count: {1}\\n\", response.GetTotal(), response.GetCount()));\n Console.WriteLine(response.GetData());\n }\n else\n {\n Console.WriteLine(string.Format(\"StatusCode: {0}\\n\", response.StatusCode));\n Console.WriteLine(string.Format(\"ErrorInfo: {0}\\n\", response.GetErrorInfo()));\n Console.WriteLine(response.GetData());\n Console.WriteLine(string.Format(\"ErrorMessage: {0}\\n\", response.GetErrorMessage()));\n }\n }\n }\n}"
"/v3/REST/eventcallbackurl":
get:
x-seo:
title: "Event Callback URL List"
description: "Retrieve a list of all callback URL objects and their configuration settings. Whenever an action (e.g. email open) occurs, the information about it will\u2026"
tags:
- Webhook
summary: Event Callback URL List
description: "Retrieve a list of all callback URL objects and their configuration settings. Whenever an action (e.g. email open) occurs, the information about it will be sent to the selected callback URL. You can then set up different automation workflows triggered by the tracked actions.\n\n> Note: The URL provided cannot be a root URL.\n"
operationId: get_v3_eventcallbackurl
parameters:
- name: Backup
in: query
schema:
$ref: '#/components/schemas/get_v3_eventcallbackurl_QueryParams/properties/Backup'
- name: EventType
in: query
schema:
$ref: '#/components/schemas/get_v3_eventcallbackurl_QueryParams/properties/EventType'
- name: Status
in: query
schema:
$ref: '#/components/schemas/get_v3_eventcallbackurl_QueryParams/properties/Status'
- name: Version
in: query
schema:
$ref: '#/components/schemas/get_v3_eventcallbackurl_QueryParams/properties/Version'
responses:
'200':
description: Default OK response for `/eventcallbackurl`
content:
application/json:
schema:
type: object
properties:
Count:
description: Indicates the number of objects in the `Data` array.
type: integer
format: int64
examples:
- 1
Data:
description: A JSON array containing a list of objects returned by this endpoint.
type: array
items:
$ref: '#/components/schemas/OutputEventcallbackurl'
Total:
description: Indicates the number of objects in the `Data` array.
type: integer
format: int64
examples:
- 1
'400':
$ref: '#/components/responses/400'
'401':
$ref: '#/components/responses/401'
'403':
$ref: '#/components/responses/403'
'404':
$ref: '#/components/responses/404'
'429':
$ref: '#/components/responses/429'
'500':
$ref: '#/components/responses/500'
security:
- basicAuth: []
x-codeSamples:
- lang: curl
label: cURL
source: "curl -s \\\n\t-X GET \\\n\t--user \"$MJ_APIKEY_PUBLIC:$MJ_APIKEY_PRIVATE\" \\\n\thttps://api.mailjet.com/v3/REST/eventcallbackurl \\"
- lang: PHP
label: PHP
source: " 'v3']);\n$response = $mj->get(Resources::$Eventcallbackurl);\n$response->success() && var_dump($response->getData());\n?>"
- lang: Node.js
label: Node
source: "const mailjet = require ('node-mailjet')\n\t.connect(process.env.MJ_APIKEY_PUBLIC, process.env.MJ_APIKEY_PRIVATE)\nconst request = mailjet\n\t.get(\"eventcallbackurl\", {'version': 'v3'})\n\t.request()\nrequest\n\t.then((result) => {\n\t\tconsole.log(result.body)\n\t})\n\t.catch((err) => {\n\t\tconsole.log(err.statusCode)\n\t})"
- lang: Ruby
label: Ruby
source: "require 'mailjet'\nMailjet.configure do |config|\n config.api_key = ENV['MJ_APIKEY_PUBLIC']\n config.secret_key = ENV['MJ_APIKEY_PRIVATE']\n config.api_version = \"v3\"\nend\nvariable = Mailjet::Eventcallbackurl.all(\n)\np variable.attributes['Data']"
- lang: Python
label: Python
source: "from mailjet_rest import Client\nimport os\napi_key = os.environ['MJ_APIKEY_PUBLIC']\napi_secret = os.environ['MJ_APIKEY_PRIVATE']\nmailjet = Client(auth=(api_key, api_secret), version='v3')\nresult = mailjet.eventcallbackurl.get()\nprint result.status_code\nprint result.json()"
- lang: Java
label: Java
source: "package com.my.project;\nimport com.mailjet.client.errors.MailjetException;\nimport com.mailjet.client.errors.MailjetSocketTimeoutException;\nimport com.mailjet.client.MailjetClient;\nimport com.mailjet.client.MailjetRequest;\nimport com.mailjet.client.MailjetResponse;\nimport com.mailjet.client.ClientOptions;\nimport com.mailjet.client.resource.Eventcallbackurl;\nimport org.json.JSONArray;\nimport org.json.JSONObject;\npublic class MyClass {\n public static void main(String[] args) throws MailjetException, MailjetSocketTimeoutException {\n MailjetClient client;\n MailjetRequest request;\n MailjetResponse response;\n client = new MailjetClient(System.getenv(\"MJ_APIKEY_PUBLIC\"), System.getenv(\"MJ_APIKEY_PRIVATE\"), new ClientOptions(\"v3\"));\n request = new MailjetRequest(Eventcallbackurl.resource);\n response = client.get(request);\n System.out.println(response.getStatus());\n System.out.println(response.getData());\n }\n}"
- lang: Go
label: Go
source: "package main\nimport (\n\t\"fmt\"\n\t\"log\"\n\t\"os\"\n\tmailjet \"github.com/mailjet/mailjet-apiv3-go\"\n\t\"github.com/mailjet/mailjet-apiv3-go/resources\"\n)\nfunc main () {\n\tmailjetClient := NewMailjetClient(os.Getenv(\"MJ_APIKEY_PUBLIC\"), os.Getenv(\"MJ_APIKEY_PRIVATE\"))\n\tvar data []resources.Eventcallbackurl\n\t_, _, err := mailjetClient.List(\"eventcallbackurl\", &data)\n\tif err != nil {\n\t fmt.Println(err)\n\t}\n\tfmt.Printf(\"Data array: %+v\\n\", data)\n}"
- lang: C#
label: C#
source: "using Mailjet.Client;\nusing Mailjet.Client.Resources;\nusing System;\nusing Newtonsoft.Json.Linq;\nnamespace Mailjet.ConsoleApplication\n{\n class Program\n {\n static void Main(string[] args)\n {\n RunAsync().Wait();\n }\n static async Task RunAsync()\n {\n MailjetClient client = new MailjetClient(Environment.GetEnvironmentVariable(\"MJ_APIKEY_PUBLIC\"), Environment.GetEnvironmentVariable(\"MJ_APIKEY_PRIVATE\"))\n {\n Version = ApiVersion.V3,\n };\n MailjetRequest request = new MailjetRequest\n {\n Resource = Eventcallbackurl.Resource,\n }\n MailjetResponse response = await client.GetAsync(request);\n if (response.IsSuccessStatusCode)\n {\n Console.WriteLine(string.Format(\"Total: {0}, Count: {1}\\n\", response.GetTotal(), response.GetCount()));\n Console.WriteLine(response.GetData());\n }\n else\n {\n Console.WriteLine(string.Format(\"StatusCode: {0}\\n\", response.StatusCode));\n Console.WriteLine(string.Format(\"ErrorInfo: {0}\\n\", response.GetErrorInfo()));\n Console.WriteLine(response.GetData());\n Console.WriteLine(string.Format(\"ErrorMessage: {0}\\n\", response.GetErrorMessage()));\n }\n }\n }\n}"
post:
x-seo:
title: "Create Event Callback URL"
description: "Add a new callback URL used as a webhook to track different email actions. Whenever an action (e.g. email open) occurs, the information about it will be\u2026"
tags:
- Webhook
summary: Create Event Callback URL
description: "Add a new callback URL used as a webhook to track different email actions. Whenever an action (e.g. email open) occurs, the information about it will be sent to this callback URL. You can then set up different automation workflows triggered by the tracked actions.\n\n> Note: The URL provided cannot be a root URL.\n"
operationId: post_v3_eventcallbackurl
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/NewEventcallbackurl'
example:
EventType: open
IsBackup: false
Status: alive
Url: https://www.example.com/123/
responses:
'201':
description: Default OK response for `/eventcallbackurl`
content:
application/json:
schema:
type: object
properties:
Count:
description: Indicates the number of objects in the `Data` array.
type: integer
format: int64
examples:
- 1
Data:
description: A JSON array containing a list of objects returned by this endpoint.
type: array
items:
$ref: '#/components/schemas/OutputEventcallbackurl'
Total:
description: Indicates the number of objects in the `Data` array.
type: integer
format: int64
examples:
- 1
'400':
$ref: '#/components/responses/400'
'401':
$ref: '#/components/responses/401'
'403':
$ref: '#/components/responses/403'
'404':
$ref: '#/components/responses/404'
'429':
$ref: '#/components/responses/429'
'500':
$ref: '#/components/responses/500'
security:
- basicAuth: []
x-codeSamples:
- lang: curl
label: cURL
source: "curl -s \\\n\t-X POST \\\n\t--user \"$MJ_APIKEY_PUBLIC:$MJ_APIKEY_PRIVATE\" \\\n\thttps://api.mailjet.com/v3/REST/eventcallbackurl \\\n\t-H 'Content-Type: application/json' \\\n\t-d '{\n \"EventType\":\"open\",\n \"IsBackup\":false,\n \"Status\":\"alive\",\n \"Url\":\"https://www.example.com/123/\"\n\t}'"
- lang: PHP
label: PHP
source: " 'v3']);\n$body = [\n 'EventType' => \"open\",\n 'IsBackup' => false,\n 'Status' => \"alive\",\n 'Url' => \"https://www.example.com/123/\"\n];\n$response = $mj->post(Resources::$Eventcallbackurl, ['body' => $body]);\n$response->success() && var_dump($response->getData());\n?>"
- lang: Node.js
label: Node
source: "const mailjet = require ('node-mailjet')\n\t.connect(process.env.MJ_APIKEY_PUBLIC, process.env.MJ_APIKEY_PRIVATE)\nconst request = mailjet\n\t.post(\"eventcallbackurl\", {'version': 'v3'})\n\t.request({\n \"EventType\":\"open\",\n \"IsBackup\":false,\n \"Status\":\"alive\",\n \"Url\":\"https://www.example.com/123/\"\n })\nrequest\n\t.then((result) => {\n\t\tconsole.log(result.body)\n\t})\n\t.catch((err) => {\n\t\tconsole.log(err.statusCode)\n\t})"
- lang: Ruby
label: Ruby
source: "require 'mailjet'\nMailjet.configure do |config|\n config.api_key = ENV['MJ_APIKEY_PUBLIC']\n config.secret_key = ENV['MJ_APIKEY_PRIVATE']\n config.api_version = \"v3\"\nend\nvariable = Mailjet::Eventcallbackurl.create(\n event_type: \"open\",\n is_backup: false,\n status: \"alive\",\n url: \"https://www.example.com/123/\"\n)\np variable.attributes['Data']"
- lang: Python
label: Python
source: "from mailjet_rest import Client\nimport os\napi_key = os.environ['MJ_APIKEY_PUBLIC']\napi_secret = os.environ['MJ_APIKEY_PRIVATE']\nmailjet = Client(auth=(api_key, api_secret), version='v3')\ndata = {\n 'EventType': \"open\",\n 'IsBackup': False,\n 'Status': \"alive\",\n 'Url': \"https://www.example.com/123/\"\n}\nresult = mailjet.eventcallbackurl.create(data=data)\nprint result.status_code\nprint result.json()"
- lang: Java
label: Java
source: "package com.my.project;\nimport com.mailjet.client.errors.MailjetException;\nimport com.mailjet.client.errors.MailjetSocketTimeoutException;\nimport com.mailjet.client.MailjetClient;\nimport com.mailjet.client.MailjetRequest;\nimport com.mailjet.client.MailjetResponse;\nimport com.mailjet.client.ClientOptions;\nimport com.mailjet.client.resource.Eventcallbackurl;\nimport org.json.JSONArray;\nimport org.json.JSONObject;\npublic class MyClass {\n public static void main(String[] args) throws MailjetException, MailjetSocketTimeoutException {\n MailjetClient client;\n MailjetRequest request;\n MailjetResponse response;\n client = new MailjetClient(System.getenv(\"MJ_APIKEY_PUBLIC\"), System.getenv(\"MJ_APIKEY_PRIVATE\"), new ClientOptions(\"v3\"));\n request = new MailjetRequest(Eventcallbackurl.resource)\n .property(Eventcallbackurl.EVENTTYPE, \"open\")\n .property(Eventcallbackurl.ISBACKUP, false)\n .property(Eventcallbackurl.STATUS, \"alive\")\n .property(Eventcallbackurl.URL, \"https://www.example.com/123/\")\n );\n response = client.post(request);\n System.out.println(response.getStatus());\n System.out.println(response.getData());\n }\n}"
- lang: Go
label: Go
source: "package main\nimport (\n\t\"fmt\"\n\t\"log\"\n\t\"os\"\n\tmailjet \"github.com/mailjet/mailjet-apiv3-go\"\n\t\"github.com/mailjet/mailjet-apiv3-go/resources\"\n)\nfunc main () {\n\tmailjetClient := NewMailjetClient(os.Getenv(\"MJ_APIKEY_PUBLIC\"), os.Getenv(\"MJ_APIKEY_PRIVATE\"))\n\tvar data []resources.Eventcallbackurl\n\tmr := &Request{\n\t Resource: \"eventcallbackurl\",\n\t}\n\tfmr := &FullRequest{\n\t Info: mr,\n\t Payload: &resources.Eventcallbackurl { \n\t EventType:\"open\",\n\t IsBackup:false,\n\t Status:\"alive\",\n\t Url:\"https://www.example.com/123/\"\n }\n\t}\n\terr := mailjetClient.Post(fmr, &data)\n\tif err != nil {\n\t fmt.Println(err)\n\t}\n\tfmt.Printf(\"Data array: %+v\\n\", data)\n}"
- lang: C#
label: C#
source: "using Mailjet.Client;\nusing Mailjet.Client.Resources;\nusing System;\nusing Newtonsoft.Json.Linq;\nnamespace Mailjet.ConsoleApplication\n{\n class Program\n {\n static void Main(string[] args)\n {\n RunAsync().Wait();\n }\n static async Task RunAsync()\n {\n MailjetClient client = new MailjetClient(Environment.GetEnvironmentVariable(\"MJ_APIKEY_PUBLIC\"), Environment.GetEnvironmentVariable(\"MJ_APIKEY_PRIVATE\"))\n {\n Version = ApiVersion.V3,\n };\n MailjetRequest request = new MailjetRequest\n {\n Resource = Eventcallbackurl.Resource,\n }\n .Property(Eventcallbackurl.EventType, \"open\")\n .Property(Eventcallbackurl.IsBackup, false)\n .Property(Eventcallbackurl.Status, \"alive\")\n .Property(Eventcallbackurl.Url, \"https://www.example.com/123/\");\n MailjetResponse response = await client.PostAsync(request);\n if (response.IsSuccessStatusCode)\n {\n Console.WriteLine(string.Format(\"Total: {0}, Count: {1}\\n\", response.GetTotal(), response.GetCount()));\n Console.WriteLine(response.GetData());\n }\n else\n {\n Console.WriteLine(string.Format(\"StatusCode: {0}\\n\", response.StatusCode));\n Console.WriteLine(string.Format(\"ErrorInfo: {0}\\n\", response.GetErrorInfo()));\n Console.WriteLine(response.GetData());\n Console.WriteLine(string.Format(\"ErrorMessage: {0}\\n\", response.GetErrorMessage()));\n }\n }\n }\n}"
/v3/REST/eventcallbackurl/{url_ID}:
get:
x-seo:
title: "Event Callback URL by ID"
description: "Retrieve the configuration settings of a specific callback URL. Whenever an action (e.g. email open) occurs, the information about it will be sent to the\u2026"
tags:
- Webhook
summary: Event Callback URL by ID
description: "Retrieve the configuration settings of a specific callback URL. Whenever an action (e.g. email open) occurs, the information about it will be sent to the selected callback URL. You can then set up different automation workflows triggered by the tracked actions.\n\n> Note: The URL provided cannot be a root URL.\n To obtain a valid `url_ID`, first call `GET /v3/REST/eventcallbackurl` to list your callback URLs."
operationId: get_v3_eventcallbackurl_id
parameters:
- name: url_ID
in: path
schema:
$ref: '#/components/schemas/get_v3_eventcallbackurl_id_PathParams/properties/url_ID'
required: true
example: 18000
responses:
'200':
description: Default OK response for `/eventcallbackurl`
content:
application/json:
schema:
type: object
properties:
Count:
description: Indicates the number of objects in the `Data` array.
type: integer
format: int64
examples:
- 1
Data:
description: A JSON array containing a list of objects returned by this endpoint.
type: array
items:
$ref: '#/components/schemas/OutputEventcallbackurl'
Total:
description: Indicates the number of objects in the `Data` array.
type: integer
format: int64
examples:
- 1
'400':
$ref: '#/components/responses/400'
'401':
$ref: '#/components/responses/401'
'403':
$ref: '#/components/responses/403'
'404':
$ref: '#/components/responses/404'
'429':
$ref: '#/components/responses/429'
'500':
$ref: '#/components/responses/500'
security:
- basicAuth: []
x-codeSamples:
- lang: curl
label: cURL
source: "curl -s \\\n\t-X GET \\\n\t--user \"$MJ_APIKEY_PUBLIC:$MJ_APIKEY_PRIVATE\" \\\n\thttps://api.mailjet.com/v3/REST/eventcallbackurl/$url_ID \\"
- lang: PHP
label: PHP
source: " 'v3']);\n$response = $mj->get(Resources::$Eventcallbackurl, ['id' => $id]);\n$response->success() && var_dump($response->getData());\n?>"
- lang: Node.js
label: Node
source: "const mailjet = require ('node-mailjet')\n\t.connect(process.env.MJ_APIKEY_PUBLIC, process.env.MJ_APIKEY_PRIVATE)\nconst request = mailjet\n\t.get(\"eventcallbackurl\", {'version': 'v3'})\n\t.id($url_ID)\n\t.request()\nrequest\n\t.then((result) => {\n\t\tconsole.log(result.body)\n\t})\n\t.catch((err) => {\n\t\tconsole.log(err.statusCode)\n\t})"
- lang: Ruby
label: Ruby
source: "require 'mailjet'\nMailjet.configure do |config|\n config.api_key = ENV['MJ_APIKEY_PUBLIC']\n config.secret_key = ENV['MJ_APIKEY_PRIVATE']\n config.api_version = \"v3\"\nend\nvariable = Mailjet::Eventcallbackurl.find($url_ID\n)\np variable.attributes['Data']"
- lang: Python
label: Python
source: "from mailjet_rest import Client\nimport os\napi_key = os.environ['MJ_APIKEY_PUBLIC']\napi_secret = os.environ['MJ_APIKEY_PRIVATE']\nmailjet = Client(auth=(api_key, api_secret), version='v3')\nid = '$url_ID'\nresult = mailjet.eventcallbackurl.get(id=id)\nprint result.status_code\nprint result.json()"
- lang: Java
label: Java
source: "package com.my.project;\nimport com.mailjet.client.errors.MailjetException;\nimport com.mailjet.client.errors.MailjetSocketTimeoutException;\nimport com.mailjet.client.MailjetClient;\nimport com.mailjet.client.MailjetRequest;\nimport com.mailjet.client.MailjetResponse;\nimport com.mailjet.client.ClientOptions;\nimport com.mailjet.client.resource.Eventcallbackurl;\nimport org.json.JSONArray;\nimport org.json.JSONObject;\npublic class MyClass {\n public static void main(String[] args) throws MailjetException, MailjetSocketTimeoutException {\n MailjetClient client;\n MailjetRequest request;\n MailjetResponse response;\n client = new MailjetClient(System.getenv(\"MJ_APIKEY_PUBLIC\"), System.getenv(\"MJ_APIKEY_PRIVATE\"), new ClientOptions(\"v3\"));\n request = new MailjetRequest(Eventcallbackurl.resource, ID);\n response = client.get(request);\n System.out.println(response.getStatus());\n System.out.println(response.getData());\n }\n}"
- lang: Go
label: Go
source: "package main\nimport (\n\t\"fmt\"\n\t\"log\"\n\t\"os\"\n\tmailjet \"github.com/mailjet/mailjet-apiv3-go\"\n\t\"github.com/mailjet/mailjet-apiv3-go/resources\"\n)\nfunc main () {\n\tmailjetClient := NewMailjetClient(os.Getenv(\"MJ_APIKEY_PUBLIC\"), os.Getenv(\"MJ_APIKEY_PRIVATE\"))\n\tvar data []resources.Eventcallbackurl\n\tmr := &Request{\n\t Resource: \"eventcallbackurl\",\n\t ID: RESOURCE_ID,\n\t}\n\terr := mailjetClient.Get(mr, &data)\n\tif err != nil {\n\t fmt.Println(err)\n\t}\n\tfmt.Printf(\"Data array: %+v\\n\", data)\n}"
- lang: C#
label: C#
source: "using Mailjet.Client;\nusing Mailjet.Client.Resources;\nusing System;\nusing Newtonsoft.Json.Linq;\nnamespace Mailjet.ConsoleApplication\n{\n class Program\n {\n static void Main(string[] args)\n {\n RunAsync().Wait();\n }\n static async Task RunAsync()\n {\n MailjetClient client = new MailjetClient(Environment.GetEnvironmentVariable(\"MJ_APIKEY_PUBLIC\"), Environment.GetEnvironmentVariable(\"MJ_APIKEY_PRIVATE\"))\n {\n Version = ApiVersion.V3,\n };\n MailjetRequest request = new MailjetRequest\n {\n Resource = Eventcallbackurl.Resource,\n ResourceId = ResourceId.Numeric(ID)\n }\n MailjetResponse response = await client.GetAsync(request);\n if (response.IsSuccessStatusCode)\n {\n Console.WriteLine(string.Format(\"Total: {0}, Count: {1}\\n\", response.GetTotal(), response.GetCount()));\n Console.WriteLine(response.GetData());\n }\n else\n {\n Console.WriteLine(string.Format(\"StatusCode: {0}\\n\", response.StatusCode));\n Console.WriteLine(string.Format(\"ErrorInfo: {0}\\n\", response.GetErrorInfo()));\n Console.WriteLine(response.GetData());\n Console.WriteLine(string.Format(\"ErrorMessage: {0}\\n\", response.GetErrorMessage()));\n }\n }\n }\n}"
put:
x-seo:
title: "Update Event Callback URL"
description: "Update the configuration settings of an existing callback URL - which type of events it tracks, the URL used, whether it is active or not etc."
tags:
- Webhook
summary: Update Event Callback URL
description: Update the configuration settings of an existing callback URL - which type of events it tracks, the URL used, whether it is active or not etc. To obtain a valid `url_ID`, first call `GET /v3/REST/eventcallbackurl` to list your callback URLs.
operationId: put_v3_eventcallbackurl_id
parameters:
- name: url_ID
in: path
schema:
$ref: '#/components/schemas/put_v3_eventcallbackurl_id_PathParams/properties/url_ID'
required: true
example: 18000
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/UpdateEventcallbackurl'
example:
EventType: open
IsBackup: false
Status: alive
Url: https://www.example.com/123/
responses:
'200':
description: Default OK response for `/eventcallbackurl`
content:
application/json:
schema:
type: object
properties:
Count:
description: Indicates the number of objects in the `Data` array.
type: integer
format: int64
examples:
- 1
Data:
description: A JSON array containing a list of objects returned by this endpoint.
type: array
items:
$ref: '#/components/schemas/OutputEventcallbackurl'
Total:
description: Indicates the number of objects in the `Data` array.
type: integer
format: int64
examples:
- 1
'400':
$ref: '#/components/responses/400'
'401':
$ref: '#/components/responses/401'
'403':
$ref: '#/components/responses/403'
'404':
$ref: '#/components/responses/404'
'429':
$ref: '#/components/responses/429'
'500':
$ref: '#/components/responses/500'
security:
- basicAuth: []
x-codeSamples:
- lang: curl
label: cURL
source: "curl -s \\\n\t-X PUT \\\n\t--user \"$MJ_APIKEY_PUBLIC:$MJ_APIKEY_PRIVATE\" \\\n\thttps://api.mailjet.com/v3/REST/eventcallbackurl/$url_ID \\\n\t-H 'Content-Type: application/json' \\\n\t-d '{\n \"EventType\":\"open\",\n \"IsBackup\":false,\n \"Status\":\"alive\",\n \"Url\":\"https://www.example.com/123/\"\n\t}'"
- lang: PHP
label: PHP
source: " 'v3']);\n$body = [\n 'EventType' => \"open\",\n 'IsBackup' => false,\n 'Status' => \"alive\",\n 'Url' => \"https://www.example.com/123/\"\n];\n$response = $mj->put(Resources::$Eventcallbackurl, ['id' => $id, 'body' => $body]);\n$response->success() && var_dump($response->getData());\n?>"
- lang: Node.js
label: Node
source: "const mailjet = require ('node-mailjet')\n\t.connect(process.env.MJ_APIKEY_PUBLIC, process.env.MJ_APIKEY_PRIVATE)\nconst request = mailjet\n\t.put(\"eventcallbackurl\", {'version': 'v3'})\n\t.id($url_ID)\n\t.request({\n \"EventType\":\"open\",\n \"IsBackup\":false,\n \"Status\":\"alive\",\n \"Url\":\"https://www.example.com/123/\"\n })\nrequest\n\t.then((result) => {\n\t\tconsole.log(result.body)\n\t})\n\t.catch((err) => {\n\t\tconsole.log(err.statusCode)\n\t})"
- lang: Ruby
label: Ruby
source: "require 'mailjet'\nMailjet.configure do |config|\n config.api_key = ENV['MJ_APIKEY_PUBLIC']\n config.secret_key = ENV['MJ_APIKEY_PRIVATE']\n config.api_version = \"v3\"\nend\ntarget = Mailjet::Eventcallbackurl.find($url_ID)\ntarget.update_attributes(\n event_type: \"open\",\n is_backup: false,\n status: \"alive\",\n url: \"https://www.example.com/123/\"\n)\np variable.attributes['Data']"
- lang: Python
label: Python
source: "from mailjet_rest import Client\nimport os\napi_key = os.environ['MJ_APIKEY_PUBLIC']\napi_secret = os.environ['MJ_APIKEY_PRIVATE']\nmailjet = Client(auth=(api_key, api_secret), version='v3')\nid = '$url_ID'\ndata = {\n 'EventType': \"open\",\n 'IsBackup': False,\n 'Status': \"alive\",\n 'Url': \"https://www.example.com/123/\"\n}\nresult = mailjet.eventcallbackurl.update(id=id, data=data)\nprint result.status_code\nprint result.json()"
- lang: Java
label: Java
source: "package com.my.project;\nimport com.mailjet.client.errors.MailjetException;\nimport com.mailjet.client.errors.MailjetSocketTimeoutException;\nimport com.mailjet.client.MailjetClient;\nimport com.mailjet.client.MailjetRequest;\nimport com.mailjet.client.MailjetResponse;\nimport com.mailjet.client.ClientOptions;\nimport com.mailjet.client.resource.Eventcallbackurl;\nimport org.json.JSONArray;\nimport org.json.JSONObject;\npublic class MyClass {\n public static void main(String[] args) throws MailjetException, MailjetSocketTimeoutException {\n MailjetClient client;\n MailjetRequest request;\n MailjetResponse response;\n client = new MailjetClient(System.getenv(\"MJ_APIKEY_PUBLIC\"), System.getenv(\"MJ_APIKEY_PRIVATE\"), new ClientOptions(\"v3\"));\n request = new MailjetRequest(Eventcallbackurl.resource, ID)\n .property(Eventcallbackurl.EVENTTYPE, \"open\")\n .property(Eventcallbackurl.ISBACKUP, false)\n .property(Eventcallbackurl.STATUS, \"alive\")\n .property(Eventcallbackurl.URL, \"https://www.example.com/123/\")\n );\n response = client.put(request);\n System.out.println(response.getStatus());\n System.out.println(response.getData());\n }\n}"
- lang: Go
label: Go
source: "package main\nimport (\n\t\"fmt\"\n\t\"log\"\n\t\"os\"\n\tmailjet \"github.com/mailjet/mailjet-apiv3-go\"\n\t\"github.com/mailjet/mailjet-apiv3-go/resources\"\n)\nfunc main () {\n\tmailjetClient := NewMailjetClient(os.Getenv(\"MJ_APIKEY_PUBLIC\"), os.Getenv(\"MJ_APIKEY_PRIVATE\"))\n\tmr := &Request{\n\t Resource: \"eventcallbackurl\",\n\t ID: RESOURCE_ID,\n\t}\n\tfmr := &FullRequest{\n\t Info: mr,\n\t Payload: &resources.Eventcallbackurl { \n\t EventType:\"open\",\n\t IsBackup:false,\n\t Status:\"alive\",\n\t Url:\"https://www.example.com/123/\"\n }\n\t}\n\terr := mailjetClient.Put(fmr)\n\tif err != nil {\n\t fmt.Println(err)\n\t}\n}"
- lang: C#
label: C#
source: "using Mailjet.Client;\nusing Mailjet.Client.Resources;\nusing System;\nusing Newtonsoft.Json.Linq;\nnamespace Mailjet.ConsoleApplication\n{\n class Program\n {\n static void Main(string[] args)\n {\n RunAsync().Wait();\n }\n static async Task RunAsync()\n {\n MailjetClient client = new MailjetClient(Environment.GetEnvironmentVariable(\"MJ_APIKEY_PUBLIC\"), Environment.GetEnvironmentVariable(\"MJ_APIKEY_PRIVATE\"))\n {\n Version = ApiVersion.V3,\n };\n MailjetRequest request = new MailjetRequest\n {\n Resource = Eventcallbackurl.Resource,\n ResourceId = ResourceId.Numeric(ID)\n }\n .Property(Eventcallbackurl.EventType, \"open\")\n .Property(Eventcallbackurl.IsBackup, false)\n .Property(Eventcallbackurl.Status, \"alive\")\n .Property(Eventcallbackurl.Url, \"https://www.example.com/123/\");\n MailjetResponse response = await client.PutAsync(request);\n if (response.IsSuccessStatusCode)\n {\n Console.WriteLine(string.Format(\"Total: {0}, Count: {1}\\n\", response.GetTotal(), response.GetCount()));\n Console.WriteLine(response.GetData());\n }\n else\n {\n Console.WriteLine(string.Format(\"StatusCode: {0}\\n\", response.StatusCode));\n Console.WriteLine(string.Format(\"ErrorInfo: {0}\\n\", response.GetErrorInfo()));\n Console.WriteLine(response.GetData());\n Console.WriteLine(string.Format(\"ErrorMessage: {0}\\n\", response.GetErrorMessage()));\n }\n }\n }\n}"
delete:
x-seo:
title: "Delete Event Callback URL"
description: "Delete Event Callback URL using the Mailjet Email API. Delete an existing callback URL."
tags:
- Webhook
summary: Delete Event Callback URL
description: Delete an existing callback URL.
operationId: delete_v3_eventcallbackurl_id
parameters:
- name: url_ID
in: path
schema:
$ref: '#/components/schemas/delete_v3_eventcallbackurl_id_PathParams/properties/url_ID'
required: true
responses:
'204':
$ref: '#/components/responses/204'
'400':
$ref: '#/components/responses/400'
'401':
$ref: '#/components/responses/401'
'403':
$ref: '#/components/responses/403'
'404':
$ref: '#/components/responses/404'
'429':
$ref: '#/components/responses/429'
'500':
$ref: '#/components/responses/500'
security:
- basicAuth: []
x-codeSamples:
- lang: curl
label: cURL
source: "curl -s \\\n\t-X DELETE \\\n\t--user \"$MJ_APIKEY_PUBLIC:$MJ_APIKEY_PRIVATE\" \\\n\thttps://api.mailjet.com/v3/REST/eventcallbackurl/$url_ID \\\n\t-H 'Content-Type: application/json' \\\n\t-d '{\n\t}'"
- lang: PHP
label: PHP
source: " 'v3']);\n$response = $mj->delete(Resources::$Eventcallbackurl, ['id' => $id]);\n$response->success() && var_dump($response->getData());\n?>"
- lang: Node.js
label: Node
source: "const mailjet = require ('node-mailjet')\n\t.connect(process.env.MJ_APIKEY_PUBLIC, process.env.MJ_APIKEY_PRIVATE)\nconst request = mailjet\n\t.delete(\"eventcallbackurl\", {'version': 'v3'})\n\t.id($url_ID)\n\t.request()\nrequest\n\t.then((result) => {\n\t\tconsole.log(result.body)\n\t})\n\t.catch((err) => {\n\t\tconsole.log(err.statusCode)\n\t})"
- lang: Ruby
label: Ruby
source: "require 'mailjet'\nMailjet.configure do |config|\n config.api_key = ENV['MJ_APIKEY_PUBLIC']\n config.secret_key = ENV['MJ_APIKEY_PRIVATE']\n config.api_version = \"v3\"\nend\ntarget = Mailjet::Eventcallbackurl.find($url_ID)\ntarget.delete(\n)\np variable.attributes['Data']"
- lang: Python
label: Python
source: "from mailjet_rest import Client\nimport os\napi_key = os.environ['MJ_APIKEY_PUBLIC']\napi_secret = os.environ['MJ_APIKEY_PRIVATE']\nmailjet = Client(auth=(api_key, api_secret), version='v3')\nid = '$url_ID'\nresult = mailjet.eventcallbackurl.delete(id=id)\nprint result.status_code\nprint result.json()"
- lang: Java
label: Java
source: "package com.my.project;\nimport com.mailjet.client.errors.MailjetException;\nimport com.mailjet.client.errors.MailjetSocketTimeoutException;\nimport com.mailjet.client.MailjetClient;\nimport com.mailjet.client.MailjetRequest;\nimport com.mailjet.client.MailjetResponse;\nimport com.mailjet.client.ClientOptions;\nimport com.mailjet.client.resource.Eventcallbackurl;\nimport org.json.JSONArray;\nimport org.json.JSONObject;\npublic class MyClass {\n public static void main(String[] args) throws MailjetException, MailjetSocketTimeoutException {\n MailjetClient client;\n MailjetRequest request;\n MailjetResponse response;\n client = new MailjetClient(System.getenv(\"MJ_APIKEY_PUBLIC\"), System.getenv(\"MJ_APIKEY_PRIVATE\"), new ClientOptions(\"v3\"));\n request = new MailjetRequest(Eventcallbackurl.resource, ID);\n response = client.delete(request);\n System.out.println(response.getStatus());\n System.out.println(response.getData());\n }\n}"
- lang: Go
label: Go
source: "package main\nimport (\n\t\"fmt\"\n\t\"log\"\n\t\"os\"\n\tmailjet \"github.com/mailjet/mailjet-apiv3-go\"\n\t\"github.com/mailjet/mailjet-apiv3-go/resources\"\n)\nfunc main () {\n\tmailjetClient := NewMailjetClient(os.Getenv(\"MJ_APIKEY_PUBLIC\"), os.Getenv(\"MJ_APIKEY_PRIVATE\"))\n\tmr := &Request{\n\t Resource: \"eventcallbackurl\",\n\t ID: RESOURCE_ID,\n\t}\n\terr := mailjetClient.Delete(mr)\n\tif err != nil {\n\t fmt.Println(err)\n\t}\n}"
- lang: C#
label: C#
source: "using Mailjet.Client;\nusing Mailjet.Client.Resources;\nusing System;\nusing Newtonsoft.Json.Linq;\nnamespace Mailjet.ConsoleApplication\n{\n class Program\n {\n static void Main(string[] args)\n {\n RunAsync().Wait();\n }\n static async Task RunAsync()\n {\n MailjetClient client = new MailjetClient(Environment.GetEnvironmentVariable(\"MJ_APIKEY_PUBLIC\"), Environment.GetEnvironmentVariable(\"MJ_APIKEY_PRIVATE\"))\n {\n Version = ApiVersion.V3,\n };\n MailjetRequest request = new MailjetRequest\n {\n Resource = Eventcallbackurl.Resource,\n ResourceId = ResourceId.Numeric(ID)\n }\n MailjetResponse response = await client.DeleteAsync(request);\n if (response.IsSuccessStatusCode)\n {\n Console.WriteLine(string.Format(\"Total: {0}, Count: {1}\\n\", response.GetTotal(), response.GetCount()));\n Console.WriteLine(response.GetData());\n }\n else\n {\n Console.WriteLine(string.Format(\"StatusCode: {0}\\n\", response.StatusCode));\n Console.WriteLine(string.Format(\"ErrorInfo: {0}\\n\", response.GetErrorInfo()));\n Console.WriteLine(response.GetData());\n Console.WriteLine(string.Format(\"ErrorMessage: {0}\\n\", response.GetErrorMessage()));\n }\n }\n }\n}"
"/v3/REST/parseroute":
get:
x-seo:
title: "Parse Route List"
description: "Parse Route List in the Mailjet Email API. Retrieve a list of all parseroute instances and their configuration settings."
tags:
- Parse
summary: Parse Route List
description: Retrieve a list of all parseroute instances and their configuration settings.
operationId: get_v3_parseroute
responses:
'200':
description: Default OK response for `/parseroute`
content:
application/json:
schema:
type: object
properties:
Count:
description: Indicates the number of objects in the `Data` array.
type: integer
format: int64
examples:
- 1
Data:
description: A JSON array containing a list of objects returned by this endpoint.
type: array
items:
$ref: '#/components/schemas/OutputParseroute'
Total:
description: Indicates the number of objects in the `Data` array.
type: integer
format: int64
examples:
- 1
'400':
$ref: '#/components/responses/400'
'401':
$ref: '#/components/responses/401'
'403':
$ref: '#/components/responses/403'
'404':
$ref: '#/components/responses/404'
'429':
$ref: '#/components/responses/429'
'500':
$ref: '#/components/responses/500'
security:
- basicAuth: []
x-codeSamples:
- lang: curl
label: cURL
source: "curl -s \\\n\t-X GET \\\n\t--user \"$MJ_APIKEY_PUBLIC:$MJ_APIKEY_PRIVATE\" \\\n\thttps://api.mailjet.com/v3/REST/parseroute \\"
- lang: PHP
label: PHP
source: " 'v3']);\n$response = $mj->get(Resources::$Parseroute);\n$response->success() && var_dump($response->getData());\n?>"
- lang: Node.js
label: Node
source: "const mailjet = require ('node-mailjet')\n\t.connect(process.env.MJ_APIKEY_PUBLIC, process.env.MJ_APIKEY_PRIVATE)\nconst request = mailjet\n\t.get(\"parseroute\", {'version': 'v3'})\n\t.request()\nrequest\n\t.then((result) => {\n\t\tconsole.log(result.body)\n\t})\n\t.catch((err) => {\n\t\tconsole.log(err.statusCode)\n\t})"
- lang: Ruby
label: Ruby
source: "require 'mailjet'\nMailjet.configure do |config|\n config.api_key = ENV['MJ_APIKEY_PUBLIC']\n config.secret_key = ENV['MJ_APIKEY_PRIVATE']\n config.api_version = \"v3\"\nend\nvariable = Mailjet::Parseroute.all(\n)\np variable.attributes['Data']"
- lang: Python
label: Python
source: "from mailjet_rest import Client\nimport os\napi_key = os.environ['MJ_APIKEY_PUBLIC']\napi_secret = os.environ['MJ_APIKEY_PRIVATE']\nmailjet = Client(auth=(api_key, api_secret), version='v3')\nresult = mailjet.parseroute.get()\nprint result.status_code\nprint result.json()"
- lang: Java
label: Java
source: "package com.my.project;\nimport com.mailjet.client.errors.MailjetException;\nimport com.mailjet.client.errors.MailjetSocketTimeoutException;\nimport com.mailjet.client.MailjetClient;\nimport com.mailjet.client.MailjetRequest;\nimport com.mailjet.client.MailjetResponse;\nimport com.mailjet.client.ClientOptions;\nimport com.mailjet.client.resource.Parseroute;\nimport org.json.JSONArray;\nimport org.json.JSONObject;\npublic class MyClass {\n public static void main(String[] args) throws MailjetException, MailjetSocketTimeoutException {\n MailjetClient client;\n MailjetRequest request;\n MailjetResponse response;\n client = new MailjetClient(System.getenv(\"MJ_APIKEY_PUBLIC\"), System.getenv(\"MJ_APIKEY_PRIVATE\"), new ClientOptions(\"v3\"));\n request = new MailjetRequest(Parseroute.resource);\n response = client.get(request);\n System.out.println(response.getStatus());\n System.out.println(response.getData());\n }\n}"
- lang: Go
label: Go
source: "package main\nimport (\n\t\"fmt\"\n\t\"log\"\n\t\"os\"\n\tmailjet \"github.com/mailjet/mailjet-apiv3-go\"\n\t\"github.com/mailjet/mailjet-apiv3-go/resources\"\n)\nfunc main () {\n\tmailjetClient := NewMailjetClient(os.Getenv(\"MJ_APIKEY_PUBLIC\"), os.Getenv(\"MJ_APIKEY_PRIVATE\"))\n\tvar data []resources.Parseroute\n\t_, _, err := mailjetClient.List(\"parseroute\", &data)\n\tif err != nil {\n\t fmt.Println(err)\n\t}\n\tfmt.Printf(\"Data array: %+v\\n\", data)\n}"
- lang: C#
label: C#
source: "using Mailjet.Client;\nusing Mailjet.Client.Resources;\nusing System;\nusing Newtonsoft.Json.Linq;\nnamespace Mailjet.ConsoleApplication\n{\n class Program\n {\n static void Main(string[] args)\n {\n RunAsync().Wait();\n }\n static async Task RunAsync()\n {\n MailjetClient client = new MailjetClient(Environment.GetEnvironmentVariable(\"MJ_APIKEY_PUBLIC\"), Environment.GetEnvironmentVariable(\"MJ_APIKEY_PRIVATE\"))\n {\n Version = ApiVersion.V3,\n };\n MailjetRequest request = new MailjetRequest\n {\n Resource = Parseroute.Resource,\n }\n MailjetResponse response = await client.GetAsync(request);\n if (response.IsSuccessStatusCode)\n {\n Console.WriteLine(string.Format(\"Total: {0}, Count: {1}\\n\", response.GetTotal(), response.GetCount()));\n Console.WriteLine(response.GetData());\n }\n else\n {\n Console.WriteLine(string.Format(\"StatusCode: {0}\\n\", response.StatusCode));\n Console.WriteLine(string.Format(\"ErrorInfo: {0}\\n\", response.GetErrorInfo()));\n Console.WriteLine(response.GetData());\n Console.WriteLine(string.Format(\"ErrorMessage: {0}\\n\", response.GetErrorMessage()));\n }\n }\n }\n}"
post:
x-seo:
title: "Create Parse Route"
description: "Create a new parseroute instance. Provide the webhook URL you want to use. The Mailjet Parse API will then createa parse email adedress in the response\u2026"
tags:
- Parse
summary: Create Parse Route
description: "Create a new parseroute instance. Provide the webhook URL you want to use. The Mailjet Parse API will then createa parse email adedress in the response. Alternatively, you can [select a parse email yourself](/docs/email-api/parse-api/use-own-domain). Emails received to this address will be parsed and the information sent to the webhook URL you have provided in a JSON format.\n\n> Note: The URL provided cannot be a root URL.\n"
operationId: post_v3_parseroute
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/NewParseroute'
example:
Email: contact@example.com
Url: https://www.example.com/123/
responses:
'201':
description: Default OK response for `/parseroute`
content:
application/json:
schema:
type: object
properties:
Count:
description: Indicates the number of objects in the `Data` array.
type: integer
format: int64
examples:
- 1
Data:
description: A JSON array containing a list of objects returned by this endpoint.
type: array
items:
$ref: '#/components/schemas/OutputParseroute'
Total:
description: Indicates the number of objects in the `Data` array.
type: integer
format: int64
examples:
- 1
'400':
$ref: '#/components/responses/400'
'401':
$ref: '#/components/responses/401'
'403':
$ref: '#/components/responses/403'
'404':
$ref: '#/components/responses/404'
'429':
$ref: '#/components/responses/429'
'500':
$ref: '#/components/responses/500'
security:
- basicAuth: []
x-codeSamples:
- lang: curl
label: cURL
source: "curl -s \\\n\t-X POST \\\n\t--user \"$MJ_APIKEY_PUBLIC:$MJ_APIKEY_PRIVATE\" \\\n\thttps://api.mailjet.com/v3/REST/parseroute \\\n\t-H 'Content-Type: application/json' \\\n\t-d '{\n \"APIKeyID\":123456,\n \"Email\":\"parseroute@example.com\",\n \"Url\":\"https://www.example.com/123/\"\n\t}'"
- lang: PHP
label: PHP
source: " 'v3']);\n$body = [\n 'APIKeyID' => 123456,\n 'Email' => \"parseroute@example.com\",\n 'Url' => \"https://www.example.com/123/\"\n];\n$response = $mj->post(Resources::$Parseroute, ['body' => $body]);\n$response->success() && var_dump($response->getData());\n?>"
- lang: Node.js
label: Node
source: "const mailjet = require ('node-mailjet')\n\t.connect(process.env.MJ_APIKEY_PUBLIC, process.env.MJ_APIKEY_PRIVATE)\nconst request = mailjet\n\t.post(\"parseroute\", {'version': 'v3'})\n\t.request({\n \"APIKeyID\":123456,\n \"Email\":\"parseroute@example.com\",\n \"Url\":\"https://www.example.com/123/\"\n })\nrequest\n\t.then((result) => {\n\t\tconsole.log(result.body)\n\t})\n\t.catch((err) => {\n\t\tconsole.log(err.statusCode)\n\t})"
- lang: Ruby
label: Ruby
source: "require 'mailjet'\nMailjet.configure do |config|\n config.api_key = ENV['MJ_APIKEY_PUBLIC']\n config.secret_key = ENV['MJ_APIKEY_PRIVATE']\n config.api_version = \"v3\"\nend\nvariable = Mailjet::Parseroute.create(\n apikey_id: 123456,\n email: \"parseroute@example.com\",\n url: \"https://www.example.com/123/\"\n)\np variable.attributes['Data']"
- lang: Python
label: Python
source: "from mailjet_rest import Client\nimport os\napi_key = os.environ['MJ_APIKEY_PUBLIC']\napi_secret = os.environ['MJ_APIKEY_PRIVATE']\nmailjet = Client(auth=(api_key, api_secret), version='v3')\ndata = {\n 'APIKeyID': 123456,\n 'Email': \"parseroute@example.com\",\n 'Url': \"https://www.example.com/123/\"\n}\nresult = mailjet.parseroute.create(data=data)\nprint result.status_code\nprint result.json()"
- lang: Java
label: Java
source: "package com.my.project;\nimport com.mailjet.client.errors.MailjetException;\nimport com.mailjet.client.errors.MailjetSocketTimeoutException;\nimport com.mailjet.client.MailjetClient;\nimport com.mailjet.client.MailjetRequest;\nimport com.mailjet.client.MailjetResponse;\nimport com.mailjet.client.ClientOptions;\nimport com.mailjet.client.resource.Parseroute;\nimport org.json.JSONArray;\nimport org.json.JSONObject;\npublic class MyClass {\n public static void main(String[] args) throws MailjetException, MailjetSocketTimeoutException {\n MailjetClient client;\n MailjetRequest request;\n MailjetResponse response;\n client = new MailjetClient(System.getenv(\"MJ_APIKEY_PUBLIC\"), System.getenv(\"MJ_APIKEY_PRIVATE\"), new ClientOptions(\"v3\"));\n request = new MailjetRequest(Parseroute.resource)\n .property(Parseroute.APIKEYID, 123456)\n .property(Parseroute.EMAIL, \"parseroute@example.com\")\n .property(Parseroute.URL, \"https://www.example.com/123/\")\n );\n response = client.post(request);\n System.out.println(response.getStatus());\n System.out.println(response.getData());\n }\n}"
- lang: Go
label: Go
source: "package main\nimport (\n\t\"fmt\"\n\t\"log\"\n\t\"os\"\n\tmailjet \"github.com/mailjet/mailjet-apiv3-go\"\n\t\"github.com/mailjet/mailjet-apiv3-go/resources\"\n)\nfunc main () {\n\tmailjetClient := NewMailjetClient(os.Getenv(\"MJ_APIKEY_PUBLIC\"), os.Getenv(\"MJ_APIKEY_PRIVATE\"))\n\tvar data []resources.Parseroute\n\tmr := &Request{\n\t Resource: \"parseroute\",\n\t}\n\tfmr := &FullRequest{\n\t Info: mr,\n\t Payload: &resources.Parseroute { \n\t APIKeyID:123456,\n\t Email:\"parseroute@example.com\",\n\t Url:\"https://www.example.com/123/\"\n }\n\t}\n\terr := mailjetClient.Post(fmr, &data)\n\tif err != nil {\n\t fmt.Println(err)\n\t}\n\tfmt.Printf(\"Data array: %+v\\n\", data)\n}"
- lang: C#
label: C#
source: "using Mailjet.Client;\nusing Mailjet.Client.Resources;\nusing System;\nusing Newtonsoft.Json.Linq;\nnamespace Mailjet.ConsoleApplication\n{\n class Program\n {\n static void Main(string[] args)\n {\n RunAsync().Wait();\n }\n static async Task RunAsync()\n {\n MailjetClient client = new MailjetClient(Environment.GetEnvironmentVariable(\"MJ_APIKEY_PUBLIC\"), Environment.GetEnvironmentVariable(\"MJ_APIKEY_PRIVATE\"))\n {\n Version = ApiVersion.V3,\n };\n MailjetRequest request = new MailjetRequest\n {\n Resource = Parseroute.Resource,\n }\n .Property(Parseroute.APIKeyID, 123456)\n .Property(Parseroute.Email, \"parseroute@example.com\")\n .Property(Parseroute.Url, \"https://www.example.com/123/\");\n MailjetResponse response = await client.PostAsync(request);\n if (response.IsSuccessStatusCode)\n {\n Console.WriteLine(string.Format(\"Total: {0}, Count: {1}\\n\", response.GetTotal(), response.GetCount()));\n Console.WriteLine(response.GetData());\n }\n else\n {\n Console.WriteLine(string.Format(\"StatusCode: {0}\\n\", response.StatusCode));\n Console.WriteLine(string.Format(\"ErrorInfo: {0}\\n\", response.GetErrorInfo()));\n Console.WriteLine(response.GetData());\n Console.WriteLine(string.Format(\"ErrorMessage: {0}\\n\", response.GetErrorMessage()));\n }\n }\n }\n}"
"/v3/REST/parseroute/{parseroute_ID}":
get:
x-seo:
title: "Parse Route by ID"
description: "Parse Route by ID using the Mailjet Email API. Get the configuration details for a specific parseroute resource."
tags:
- Parse
summary: Parse Route by ID
description: Get the configuration details for a specific parseroute resource. To obtain a valid `parseroute_ID`, first call `GET /v3/REST/parseroute` to list your parseroutes.
operationId: get_v3_parseroute_id
parameters:
- name: parseroute_ID
in: path
schema:
$ref: '#/components/schemas/get_v3_parseroute_id_PathParams/properties/parseroute_ID'
required: true
example: 16000
responses:
'200':
description: Default OK response for `/parseroute`
content:
application/json:
schema:
type: object
properties:
Count:
description: Indicates the number of objects in the `Data` array.
type: integer
format: int64
examples:
- 1
Data:
description: A JSON array containing a list of objects returned by this endpoint.
type: array
items:
$ref: '#/components/schemas/OutputParseroute'
Total:
description: Indicates the number of objects in the `Data` array.
type: integer
format: int64
examples:
- 1
'400':
$ref: '#/components/responses/400'
'401':
$ref: '#/components/responses/401'
'403':
$ref: '#/components/responses/403'
'404':
$ref: '#/components/responses/404'
'429':
$ref: '#/components/responses/429'
'500':
$ref: '#/components/responses/500'
security:
- basicAuth: []
x-codeSamples:
- lang: curl
label: cURL
source: "curl -s \\\n\t-X GET \\\n\t--user \"$MJ_APIKEY_PUBLIC:$MJ_APIKEY_PRIVATE\" \\\n\thttps://api.mailjet.com/v3/REST/parseroute/$parseroute_ID \\"
- lang: PHP
label: PHP
source: " 'v3']);\n$response = $mj->get(Resources::$Parseroute, ['id' => $id]);\n$response->success() && var_dump($response->getData());\n?>"
- lang: Node.js
label: Node
source: "const mailjet = require ('node-mailjet')\n\t.connect(process.env.MJ_APIKEY_PUBLIC, process.env.MJ_APIKEY_PRIVATE)\nconst request = mailjet\n\t.get(\"parseroute\", {'version': 'v3'})\n\t.id($parseroute_ID)\n\t.request()\nrequest\n\t.then((result) => {\n\t\tconsole.log(result.body)\n\t})\n\t.catch((err) => {\n\t\tconsole.log(err.statusCode)\n\t})"
- lang: Ruby
label: Ruby
source: "require 'mailjet'\nMailjet.configure do |config|\n config.api_key = ENV['MJ_APIKEY_PUBLIC']\n config.secret_key = ENV['MJ_APIKEY_PRIVATE']\n config.api_version = \"v3\"\nend\nvariable = Mailjet::Parseroute.find($parseroute_ID\n)\np variable.attributes['Data']"
- lang: Python
label: Python
source: "from mailjet_rest import Client\nimport os\napi_key = os.environ['MJ_APIKEY_PUBLIC']\napi_secret = os.environ['MJ_APIKEY_PRIVATE']\nmailjet = Client(auth=(api_key, api_secret), version='v3')\nid = '$parseroute_ID'\nresult = mailjet.parseroute.get(id=id)\nprint result.status_code\nprint result.json()"
- lang: Java
label: Java
source: "package com.my.project;\nimport com.mailjet.client.errors.MailjetException;\nimport com.mailjet.client.errors.MailjetSocketTimeoutException;\nimport com.mailjet.client.MailjetClient;\nimport com.mailjet.client.MailjetRequest;\nimport com.mailjet.client.MailjetResponse;\nimport com.mailjet.client.ClientOptions;\nimport com.mailjet.client.resource.Parseroute;\nimport org.json.JSONArray;\nimport org.json.JSONObject;\npublic class MyClass {\n public static void main(String[] args) throws MailjetException, MailjetSocketTimeoutException {\n MailjetClient client;\n MailjetRequest request;\n MailjetResponse response;\n client = new MailjetClient(System.getenv(\"MJ_APIKEY_PUBLIC\"), System.getenv(\"MJ_APIKEY_PRIVATE\"), new ClientOptions(\"v3\"));\n request = new MailjetRequest(Parseroute.resource, ID);\n response = client.get(request);\n System.out.println(response.getStatus());\n System.out.println(response.getData());\n }\n}"
- lang: Go
label: Go
source: "package main\nimport (\n\t\"fmt\"\n\t\"log\"\n\t\"os\"\n\tmailjet \"github.com/mailjet/mailjet-apiv3-go\"\n\t\"github.com/mailjet/mailjet-apiv3-go/resources\"\n)\nfunc main () {\n\tmailjetClient := NewMailjetClient(os.Getenv(\"MJ_APIKEY_PUBLIC\"), os.Getenv(\"MJ_APIKEY_PRIVATE\"))\n\tvar data []resources.Parseroute\n\tmr := &Request{\n\t Resource: \"parseroute\",\n\t ID: RESOURCE_ID,\n\t}\n\terr := mailjetClient.Get(mr, &data)\n\tif err != nil {\n\t fmt.Println(err)\n\t}\n\tfmt.Printf(\"Data array: %+v\\n\", data)\n}"
- lang: C#
label: C#
source: "using Mailjet.Client;\nusing Mailjet.Client.Resources;\nusing System;\nusing Newtonsoft.Json.Linq;\nnamespace Mailjet.ConsoleApplication\n{\n class Program\n {\n static void Main(string[] args)\n {\n RunAsync().Wait();\n }\n static async Task RunAsync()\n {\n MailjetClient client = new MailjetClient(Environment.GetEnvironmentVariable(\"MJ_APIKEY_PUBLIC\"), Environment.GetEnvironmentVariable(\"MJ_APIKEY_PRIVATE\"))\n {\n Version = ApiVersion.V3,\n };\n MailjetRequest request = new MailjetRequest\n {\n Resource = Parseroute.Resource,\n ResourceId = ResourceId.Numeric(ID)\n }\n MailjetResponse response = await client.GetAsync(request);\n if (response.IsSuccessStatusCode)\n {\n Console.WriteLine(string.Format(\"Total: {0}, Count: {1}\\n\", response.GetTotal(), response.GetCount()));\n Console.WriteLine(response.GetData());\n }\n else\n {\n Console.WriteLine(string.Format(\"StatusCode: {0}\\n\", response.StatusCode));\n Console.WriteLine(string.Format(\"ErrorInfo: {0}\\n\", response.GetErrorInfo()));\n Console.WriteLine(response.GetData());\n Console.WriteLine(string.Format(\"ErrorMessage: {0}\\n\", response.GetErrorMessage()));\n }\n }\n }\n}"
put:
x-seo:
title: "Update Parse Route"
description: "Update Parse Route in the Mailjet Email API. Update the settings of an existing parseroute instance - the webhook URL and/or email address."
tags:
- Parse
summary: Update Parse Route
description: Update the settings of an existing parseroute instance - the webhook URL and/or email address. To obtain a valid `parseroute_ID`, first call `GET /v3/REST/parseroute` to list your parseroutes.
operationId: put_v3_parseroute_id
parameters:
- name: parseroute_ID
in: path
schema:
$ref: '#/components/schemas/put_v3_parseroute_id_PathParams/properties/parseroute_ID'
required: true
example: 16000
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/UpdateParseroute'
example:
Email: contact@example.com
Url: https://www.example.com/123/
responses:
'200':
description: Default OK response for `/parseroute`
content:
application/json:
schema:
type: object
properties:
Count:
description: Indicates the number of objects in the `Data` array.
type: integer
format: int64
examples:
- 1
Data:
description: A JSON array containing a list of objects returned by this endpoint.
type: array
items:
$ref: '#/components/schemas/OutputParseroute'
Total:
description: Indicates the number of objects in the `Data` array.
type: integer
format: int64
examples:
- 1
'400':
$ref: '#/components/responses/400'
'401':
$ref: '#/components/responses/401'
'403':
$ref: '#/components/responses/403'
'404':
$ref: '#/components/responses/404'
'429':
$ref: '#/components/responses/429'
'500':
$ref: '#/components/responses/500'
security:
- basicAuth: []
x-codeSamples:
- lang: curl
label: cURL
source: "curl -s \\\n\t-X PUT \\\n\t--user \"$MJ_APIKEY_PUBLIC:$MJ_APIKEY_PRIVATE\" \\\n\thttps://api.mailjet.com/v3/REST/parseroute/$parseroute_ID \\\n\t-H 'Content-Type: application/json' \\\n\t-d '{\n \"APIKeyID\":123456,\n \"Email\":\"parseroute@example.com\",\n \"Url\":\"https://www.example.com/123/\"\n\t}'"
- lang: PHP
label: PHP
source: " 'v3']);\n$body = [\n 'APIKeyID' => 123456,\n 'Email' => \"parseroute@example.com\",\n 'Url' => \"https://www.example.com/123/\"\n];\n$response = $mj->put(Resources::$Parseroute, ['id' => $id, 'body' => $body]);\n$response->success() && var_dump($response->getData());\n?>"
- lang: Node.js
label: Node
source: "const mailjet = require ('node-mailjet')\n\t.connect(process.env.MJ_APIKEY_PUBLIC, process.env.MJ_APIKEY_PRIVATE)\nconst request = mailjet\n\t.put(\"parseroute\", {'version': 'v3'})\n\t.id($parseroute_ID)\n\t.request({\n \"APIKeyID\":123456,\n \"Email\":\"parseroute@example.com\",\n \"Url\":\"https://www.example.com/123/\"\n })\nrequest\n\t.then((result) => {\n\t\tconsole.log(result.body)\n\t})\n\t.catch((err) => {\n\t\tconsole.log(err.statusCode)\n\t})"
- lang: Ruby
label: Ruby
source: "require 'mailjet'\nMailjet.configure do |config|\n config.api_key = ENV['MJ_APIKEY_PUBLIC']\n config.secret_key = ENV['MJ_APIKEY_PRIVATE']\n config.api_version = \"v3\"\nend\ntarget = Mailjet::Parseroute.find($parseroute_ID)\ntarget.update_attributes(\n apikey_id: 123456,\n email: \"parseroute@example.com\",\n url: \"https://www.example.com/123/\"\n)\np variable.attributes['Data']"
- lang: Python
label: Python
source: "from mailjet_rest import Client\nimport os\napi_key = os.environ['MJ_APIKEY_PUBLIC']\napi_secret = os.environ['MJ_APIKEY_PRIVATE']\nmailjet = Client(auth=(api_key, api_secret), version='v3')\nid = '$parseroute_ID'\ndata = {\n 'APIKeyID': 123456,\n 'Email': \"parseroute@example.com\",\n 'Url': \"https://www.example.com/123/\"\n}\nresult = mailjet.parseroute.update(id=id, data=data)\nprint result.status_code\nprint result.json()"
- lang: Java
label: Java
source: "package com.my.project;\nimport com.mailjet.client.errors.MailjetException;\nimport com.mailjet.client.errors.MailjetSocketTimeoutException;\nimport com.mailjet.client.MailjetClient;\nimport com.mailjet.client.MailjetRequest;\nimport com.mailjet.client.MailjetResponse;\nimport com.mailjet.client.ClientOptions;\nimport com.mailjet.client.resource.Parseroute;\nimport org.json.JSONArray;\nimport org.json.JSONObject;\npublic class MyClass {\n public static void main(String[] args) throws MailjetException, MailjetSocketTimeoutException {\n MailjetClient client;\n MailjetRequest request;\n MailjetResponse response;\n client = new MailjetClient(System.getenv(\"MJ_APIKEY_PUBLIC\"), System.getenv(\"MJ_APIKEY_PRIVATE\"), new ClientOptions(\"v3\"));\n request = new MailjetRequest(Parseroute.resource, ID)\n .property(Parseroute.APIKEYID, 123456)\n .property(Parseroute.EMAIL, \"parseroute@example.com\")\n .property(Parseroute.URL, \"https://www.example.com/123/\")\n );\n response = client.put(request);\n System.out.println(response.getStatus());\n System.out.println(response.getData());\n }\n}"
- lang: Go
label: Go
source: "package main\nimport (\n\t\"fmt\"\n\t\"log\"\n\t\"os\"\n\tmailjet \"github.com/mailjet/mailjet-apiv3-go\"\n\t\"github.com/mailjet/mailjet-apiv3-go/resources\"\n)\nfunc main () {\n\tmailjetClient := NewMailjetClient(os.Getenv(\"MJ_APIKEY_PUBLIC\"), os.Getenv(\"MJ_APIKEY_PRIVATE\"))\n\tmr := &Request{\n\t Resource: \"parseroute\",\n\t ID: RESOURCE_ID,\n\t}\n\tfmr := &FullRequest{\n\t Info: mr,\n\t Payload: &resources.Parseroute { \n\t APIKeyID:123456,\n\t Email:\"parseroute@example.com\",\n\t Url:\"https://www.example.com/123/\"\n }\n\t}\n\terr := mailjetClient.Put(fmr)\n\tif err != nil {\n\t fmt.Println(err)\n\t}\n}"
- lang: C#
label: C#
source: "using Mailjet.Client;\nusing Mailjet.Client.Resources;\nusing System;\nusing Newtonsoft.Json.Linq;\nnamespace Mailjet.ConsoleApplication\n{\n class Program\n {\n static void Main(string[] args)\n {\n RunAsync().Wait();\n }\n static async Task RunAsync()\n {\n MailjetClient client = new MailjetClient(Environment.GetEnvironmentVariable(\"MJ_APIKEY_PUBLIC\"), Environment.GetEnvironmentVariable(\"MJ_APIKEY_PRIVATE\"))\n {\n Version = ApiVersion.V3,\n };\n MailjetRequest request = new MailjetRequest\n {\n Resource = Parseroute.Resource,\n ResourceId = ResourceId.Numeric(ID)\n }\n .Property(Parseroute.APIKeyID, 123456)\n .Property(Parseroute.Email, \"parseroute@example.com\")\n .Property(Parseroute.Url, \"https://www.example.com/123/\");\n MailjetResponse response = await client.PutAsync(request);\n if (response.IsSuccessStatusCode)\n {\n Console.WriteLine(string.Format(\"Total: {0}, Count: {1}\\n\", response.GetTotal(), response.GetCount()));\n Console.WriteLine(response.GetData());\n }\n else\n {\n Console.WriteLine(string.Format(\"StatusCode: {0}\\n\", response.StatusCode));\n Console.WriteLine(string.Format(\"ErrorInfo: {0}\\n\", response.GetErrorInfo()));\n Console.WriteLine(response.GetData());\n Console.WriteLine(string.Format(\"ErrorMessage: {0}\\n\", response.GetErrorMessage()));\n }\n }\n }\n}"
delete:
x-seo:
title: "Delete Parse Route"
description: "Delete Parse Route using the Mailjet Email API. Delete an existing parseroute instance."
tags:
- Parse
summary: Delete Parse Route
description: Delete an existing parseroute instance.
operationId: delete_v3_parseroute_id
parameters:
- name: parseroute_ID
in: path
schema:
$ref: '#/components/schemas/delete_v3_parseroute_id_PathParams/properties/parseroute_ID'
required: true
responses:
'204':
$ref: '#/components/responses/204'
'400':
$ref: '#/components/responses/400'
'401':
$ref: '#/components/responses/401'
'403':
$ref: '#/components/responses/403'
'404':
$ref: '#/components/responses/404'
'429':
$ref: '#/components/responses/429'
'500':
$ref: '#/components/responses/500'
security:
- basicAuth: []
x-codeSamples:
- lang: curl
label: cURL
source: "curl -s \\\n\t-X DELETE \\\n\t--user \"$MJ_APIKEY_PUBLIC:$MJ_APIKEY_PRIVATE\" \\\n\thttps://api.mailjet.com/v3/REST/parseroute/$parseroute_ID \\\n\t-H 'Content-Type: application/json' \\\n\t-d '{\n\t}'"
- lang: PHP
label: PHP
source: " 'v3']);\n$response = $mj->delete(Resources::$Parseroute, ['id' => $id]);\n$response->success() && var_dump($response->getData());\n?>"
- lang: Node.js
label: Node
source: "const mailjet = require ('node-mailjet')\n\t.connect(process.env.MJ_APIKEY_PUBLIC, process.env.MJ_APIKEY_PRIVATE)\nconst request = mailjet\n\t.delete(\"parseroute\", {'version': 'v3'})\n\t.id($parseroute_ID)\n\t.request()\nrequest\n\t.then((result) => {\n\t\tconsole.log(result.body)\n\t})\n\t.catch((err) => {\n\t\tconsole.log(err.statusCode)\n\t})"
- lang: Ruby
label: Ruby
source: "require 'mailjet'\nMailjet.configure do |config|\n config.api_key = ENV['MJ_APIKEY_PUBLIC']\n config.secret_key = ENV['MJ_APIKEY_PRIVATE']\n config.api_version = \"v3\"\nend\ntarget = Mailjet::Parseroute.find($parseroute_ID)\ntarget.delete(\n)\np variable.attributes['Data']"
- lang: Python
label: Python
source: "from mailjet_rest import Client\nimport os\napi_key = os.environ['MJ_APIKEY_PUBLIC']\napi_secret = os.environ['MJ_APIKEY_PRIVATE']\nmailjet = Client(auth=(api_key, api_secret), version='v3')\nid = '$parseroute_ID'\nresult = mailjet.parseroute.delete(id=id)\nprint result.status_code\nprint result.json()"
- lang: Java
label: Java
source: "package com.my.project;\nimport com.mailjet.client.errors.MailjetException;\nimport com.mailjet.client.errors.MailjetSocketTimeoutException;\nimport com.mailjet.client.MailjetClient;\nimport com.mailjet.client.MailjetRequest;\nimport com.mailjet.client.MailjetResponse;\nimport com.mailjet.client.ClientOptions;\nimport com.mailjet.client.resource.Parseroute;\nimport org.json.JSONArray;\nimport org.json.JSONObject;\npublic class MyClass {\n public static void main(String[] args) throws MailjetException, MailjetSocketTimeoutException {\n MailjetClient client;\n MailjetRequest request;\n MailjetResponse response;\n client = new MailjetClient(System.getenv(\"MJ_APIKEY_PUBLIC\"), System.getenv(\"MJ_APIKEY_PRIVATE\"), new ClientOptions(\"v3\"));\n request = new MailjetRequest(Parseroute.resource, ID);\n response = client.delete(request);\n System.out.println(response.getStatus());\n System.out.println(response.getData());\n }\n}"
- lang: Go
label: Go
source: "package main\nimport (\n\t\"fmt\"\n\t\"log\"\n\t\"os\"\n\tmailjet \"github.com/mailjet/mailjet-apiv3-go\"\n\t\"github.com/mailjet/mailjet-apiv3-go/resources\"\n)\nfunc main () {\n\tmailjetClient := NewMailjetClient(os.Getenv(\"MJ_APIKEY_PUBLIC\"), os.Getenv(\"MJ_APIKEY_PRIVATE\"))\n\tmr := &Request{\n\t Resource: \"parseroute\",\n\t ID: RESOURCE_ID,\n\t}\n\terr := mailjetClient.Delete(mr)\n\tif err != nil {\n\t fmt.Println(err)\n\t}\n}"
- lang: C#
label: C#
source: "using Mailjet.Client;\nusing Mailjet.Client.Resources;\nusing System;\nusing Newtonsoft.Json.Linq;\nnamespace Mailjet.ConsoleApplication\n{\n class Program\n {\n static void Main(string[] args)\n {\n RunAsync().Wait();\n }\n static async Task RunAsync()\n {\n MailjetClient client = new MailjetClient(Environment.GetEnvironmentVariable(\"MJ_APIKEY_PUBLIC\"), Environment.GetEnvironmentVariable(\"MJ_APIKEY_PRIVATE\"))\n {\n Version = ApiVersion.V3,\n };\n MailjetRequest request = new MailjetRequest\n {\n Resource = Parseroute.Resource,\n ResourceId = ResourceId.Numeric(ID)\n }\n MailjetResponse response = await client.DeleteAsync(request);\n if (response.IsSuccessStatusCode)\n {\n Console.WriteLine(string.Format(\"Total: {0}, Count: {1}\\n\", response.GetTotal(), response.GetCount()));\n Console.WriteLine(response.GetData());\n }\n else\n {\n Console.WriteLine(string.Format(\"StatusCode: {0}\\n\", response.StatusCode));\n Console.WriteLine(string.Format(\"ErrorInfo: {0}\\n\", response.GetErrorInfo()));\n Console.WriteLine(response.GetData());\n Console.WriteLine(string.Format(\"ErrorMessage: {0}\\n\", response.GetErrorMessage()));\n }\n }\n }\n}"
"/v3/REST/statcounters":
get:
x-seo:
title: "Stat Counters List"
description: "Get aggregated statistics for a specific campaign, list, API Key or sender email address. Both message-based and event-based stats can be retrieved."
tags:
- Statistics
summary: Stat Counters List
description: "Get aggregated statistics for a specific campaign, list, API Key or sender email address. Both message-based and event-based stats can be retrieved.\n"
operationId: get_v3_statcounters
parameters:
- name: CounterSource
in: query
schema:
$ref: '#/components/schemas/get_v3_statcounters_QueryParams/properties/CounterSource'
required: true
example: Campaign
- name: CounterResolution
in: query
schema:
$ref: '#/components/schemas/get_v3_statcounters_QueryParams/properties/CounterResolution'
required: true
example: Lifetime
- name: CounterTiming
in: query
schema:
$ref: '#/components/schemas/get_v3_statcounters_QueryParams/properties/CounterTiming'
required: true
example: Message
- name: FromTS
in: query
schema:
$ref: '#/components/schemas/get_v3_statcounters_QueryParams/properties/FromTS'
- name: SourceID
example: 0
in: query
schema:
$ref: '#/components/schemas/get_v3_statcounters_QueryParams/properties/SourceID'
- name: ToTS
in: query
schema:
$ref: '#/components/schemas/get_v3_statcounters_QueryParams/properties/ToTS'
responses:
'200':
description: Default OK response for `/Statcounters`
content:
application/json:
schema:
type: object
properties:
Count:
description: Indicates the number of objects in the `Data` array.
type: integer
format: int64
examples:
- 1
Data:
description: A JSON array containing a list of objects returned by this endpoint.
type: array
items:
$ref: '#/components/schemas/OutputStatcounters'
Total:
description: Indicates the number of objects in the `Data` array.
type: integer
format: int64
examples:
- 1
'400':
$ref: '#/components/responses/400'
'401':
$ref: '#/components/responses/401'
'403':
$ref: '#/components/responses/403'
'404':
$ref: '#/components/responses/404'
'429':
$ref: '#/components/responses/429'
'500':
$ref: '#/components/responses/500'
security:
- basicAuth: []
x-codeSamples:
- lang: curl
label: cURL
source: "curl -s \\\n\t-X GET \\\n\t--user \"$MJ_APIKEY_PUBLIC:$MJ_APIKEY_PRIVATE\" \\\n\thttps://api.mailjet.com/v3/REST/statcounters \\"
- lang: PHP
label: PHP
source: " 'v3']);\n$response = $mj->get(Resources::$Statcounters);\n$response->success() && var_dump($response->getData());\n?>"
- lang: Node.js
label: Node
source: "const mailjet = require ('node-mailjet')\n\t.connect(process.env.MJ_APIKEY_PUBLIC, process.env.MJ_APIKEY_PRIVATE)\nconst request = mailjet\n\t.get(\"statcounters\", {'version': 'v3'})\n\t.request()\nrequest\n\t.then((result) => {\n\t\tconsole.log(result.body)\n\t})\n\t.catch((err) => {\n\t\tconsole.log(err.statusCode)\n\t})"
- lang: Ruby
label: Ruby
source: "require 'mailjet'\nMailjet.configure do |config|\n config.api_key = ENV['MJ_APIKEY_PUBLIC']\n config.secret_key = ENV['MJ_APIKEY_PRIVATE']\n config.api_version = \"v3\"\nend\nvariable = Mailjet::Statcounters.all(\n)\np variable.attributes['Data']"
- lang: Python
label: Python
source: "from mailjet_rest import Client\nimport os\napi_key = os.environ['MJ_APIKEY_PUBLIC']\napi_secret = os.environ['MJ_APIKEY_PRIVATE']\nmailjet = Client(auth=(api_key, api_secret), version='v3')\nresult = mailjet.statcounters.get()\nprint result.status_code\nprint result.json()"
- lang: Java
label: Java
source: "package com.my.project;\nimport com.mailjet.client.errors.MailjetException;\nimport com.mailjet.client.errors.MailjetSocketTimeoutException;\nimport com.mailjet.client.MailjetClient;\nimport com.mailjet.client.MailjetRequest;\nimport com.mailjet.client.MailjetResponse;\nimport com.mailjet.client.ClientOptions;\nimport com.mailjet.client.resource.Statcounters;\nimport org.json.JSONArray;\nimport org.json.JSONObject;\npublic class MyClass {\n public static void main(String[] args) throws MailjetException, MailjetSocketTimeoutException {\n MailjetClient client;\n MailjetRequest request;\n MailjetResponse response;\n client = new MailjetClient(System.getenv(\"MJ_APIKEY_PUBLIC\"), System.getenv(\"MJ_APIKEY_PRIVATE\"), new ClientOptions(\"v3\"));\n request = new MailjetRequest(Statcounters.resource);\n response = client.get(request);\n System.out.println(response.getStatus());\n System.out.println(response.getData());\n }\n}"
- lang: Go
label: Go
source: "package main\nimport (\n\t\"fmt\"\n\t\"log\"\n\t\"os\"\n\tmailjet \"github.com/mailjet/mailjet-apiv3-go\"\n\t\"github.com/mailjet/mailjet-apiv3-go/resources\"\n)\nfunc main () {\n\tmailjetClient := NewMailjetClient(os.Getenv(\"MJ_APIKEY_PUBLIC\"), os.Getenv(\"MJ_APIKEY_PRIVATE\"))\n\tvar data []resources.Statcounters\n\t_, _, err := mailjetClient.List(\"statcounters\", &data)\n\tif err != nil {\n\t fmt.Println(err)\n\t}\n\tfmt.Printf(\"Data array: %+v\\n\", data)\n}"
- lang: C#
label: C#
source: "using Mailjet.Client;\nusing Mailjet.Client.Resources;\nusing System;\nusing Newtonsoft.Json.Linq;\nnamespace Mailjet.ConsoleApplication\n{\n class Program\n {\n static void Main(string[] args)\n {\n RunAsync().Wait();\n }\n static async Task RunAsync()\n {\n MailjetClient client = new MailjetClient(Environment.GetEnvironmentVariable(\"MJ_APIKEY_PUBLIC\"), Environment.GetEnvironmentVariable(\"MJ_APIKEY_PRIVATE\"))\n {\n Version = ApiVersion.V3,\n };\n MailjetRequest request = new MailjetRequest\n {\n Resource = Statcounters.Resource,\n }\n MailjetResponse response = await client.GetAsync(request);\n if (response.IsSuccessStatusCode)\n {\n Console.WriteLine(string.Format(\"Total: {0}, Count: {1}\\n\", response.GetTotal(), response.GetCount()));\n Console.WriteLine(response.GetData());\n }\n else\n {\n Console.WriteLine(string.Format(\"StatusCode: {0}\\n\", response.StatusCode));\n Console.WriteLine(string.Format(\"ErrorInfo: {0}\\n\", response.GetErrorInfo()));\n Console.WriteLine(response.GetData());\n Console.WriteLine(string.Format(\"ErrorMessage: {0}\\n\", response.GetErrorMessage()));\n }\n }\n }\n}"
"/v3/REST/campaignoverview":
get:
x-seo:
title: "Campaign Overview List"
description: "Retrieve delivery and engagement statistics for all drafts, AB Testing objects or sent campaigns. In addition, for each object you will see its type\u2026"
tags:
- Statistics
summary: Campaign Overview List
description: Retrieve delivery and engagement statistics for all drafts, AB Testing objects or sent campaigns. In addition, for each object you will see its type, edit tool used and creation time, as well as general info like the title and subject line for the campaign.
operationId: get_v3_campaignoverview
parameters:
- name: All
in: query
schema:
$ref: '#/components/schemas/get_v3_campaignoverview_QueryParams/properties/All'
- name: Archived
in: query
schema:
$ref: '#/components/schemas/get_v3_campaignoverview_QueryParams/properties/Archived'
- name: Drafts
in: query
schema:
$ref: '#/components/schemas/get_v3_campaignoverview_QueryParams/properties/Drafts'
- name: ID
in: query
schema:
$ref: '#/components/schemas/get_v3_campaignoverview_QueryParams/properties/ID'
- name: IDType
in: query
schema:
$ref: '#/components/schemas/get_v3_campaignoverview_QueryParams/properties/IDType'
- name: Programmed
in: query
schema:
$ref: '#/components/schemas/get_v3_campaignoverview_QueryParams/properties/Programmed'
- name: Sent
in: query
schema:
$ref: '#/components/schemas/get_v3_campaignoverview_QueryParams/properties/Sent'
- name: Starred
in: query
schema:
$ref: '#/components/schemas/get_v3_campaignoverview_QueryParams/properties/Starred'
- name: Subject
in: query
schema:
$ref: '#/components/schemas/get_v3_campaignoverview_QueryParams/properties/Subject'
responses:
'200':
description: Default OK response for `/campaignoverview`
content:
application/json:
schema:
type: object
properties:
Count:
description: Indicates the number of objects in the `Data` array.
type: integer
format: int64
examples:
- 1
Data:
description: A JSON array containing a list of objects returned by this endpoint.
type: array
items:
$ref: '#/components/schemas/OutputCampaignoverview'
Total:
description: Indicates the number of objects in the `Data` array.
type: integer
format: int64
examples:
- 1
'400':
$ref: '#/components/responses/400'
'401':
$ref: '#/components/responses/401'
'403':
$ref: '#/components/responses/403'
'404':
$ref: '#/components/responses/404'
'429':
$ref: '#/components/responses/429'
'500':
$ref: '#/components/responses/500'
security:
- basicAuth: []
x-codeSamples:
- lang: curl
label: cURL
source: "curl -s \\\n\t-X GET \\\n\t--user \"$MJ_APIKEY_PUBLIC:$MJ_APIKEY_PRIVATE\" \\\n\thttps://api.mailjet.com/v3/REST/campaignoverview \\"
- lang: PHP
label: PHP
source: " 'v3']);\n$response = $mj->get(Resources::$Campaignoverview);\n$response->success() && var_dump($response->getData());\n?>"
- lang: Node.js
label: Node
source: "const mailjet = require ('node-mailjet')\n\t.connect(process.env.MJ_APIKEY_PUBLIC, process.env.MJ_APIKEY_PRIVATE)\nconst request = mailjet\n\t.get(\"campaignoverview\", {'version': 'v3'})\n\t.request()\nrequest\n\t.then((result) => {\n\t\tconsole.log(result.body)\n\t})\n\t.catch((err) => {\n\t\tconsole.log(err.statusCode)\n\t})"
- lang: Ruby
label: Ruby
source: "require 'mailjet'\nMailjet.configure do |config|\n config.api_key = ENV['MJ_APIKEY_PUBLIC']\n config.secret_key = ENV['MJ_APIKEY_PRIVATE']\n config.api_version = \"v3\"\nend\nvariable = Mailjet::Campaignoverview.all(\n)\np variable.attributes['Data']"
- lang: Python
label: Python
source: "from mailjet_rest import Client\nimport os\napi_key = os.environ['MJ_APIKEY_PUBLIC']\napi_secret = os.environ['MJ_APIKEY_PRIVATE']\nmailjet = Client(auth=(api_key, api_secret), version='v3')\nresult = mailjet.campaignoverview.get()\nprint result.status_code\nprint result.json()"
- lang: Java
label: Java
source: "package com.my.project;\nimport com.mailjet.client.errors.MailjetException;\nimport com.mailjet.client.errors.MailjetSocketTimeoutException;\nimport com.mailjet.client.MailjetClient;\nimport com.mailjet.client.MailjetRequest;\nimport com.mailjet.client.MailjetResponse;\nimport com.mailjet.client.ClientOptions;\nimport com.mailjet.client.resource.Campaignoverview;\nimport org.json.JSONArray;\nimport org.json.JSONObject;\npublic class MyClass {\n public static void main(String[] args) throws MailjetException, MailjetSocketTimeoutException {\n MailjetClient client;\n MailjetRequest request;\n MailjetResponse response;\n client = new MailjetClient(System.getenv(\"MJ_APIKEY_PUBLIC\"), System.getenv(\"MJ_APIKEY_PRIVATE\"), new ClientOptions(\"v3\"));\n request = new MailjetRequest(Campaignoverview.resource);\n response = client.get(request);\n System.out.println(response.getStatus());\n System.out.println(response.getData());\n }\n}"
- lang: Go
label: Go
source: "package main\nimport (\n\t\"fmt\"\n\t\"log\"\n\t\"os\"\n\tmailjet \"github.com/mailjet/mailjet-apiv3-go\"\n\t\"github.com/mailjet/mailjet-apiv3-go/resources\"\n)\nfunc main () {\n\tmailjetClient := NewMailjetClient(os.Getenv(\"MJ_APIKEY_PUBLIC\"), os.Getenv(\"MJ_APIKEY_PRIVATE\"))\n\tvar data []resources.Campaignoverview\n\t_, _, err := mailjetClient.List(\"campaignoverview\", &data)\n\tif err != nil {\n\t fmt.Println(err)\n\t}\n\tfmt.Printf(\"Data array: %+v\\n\", data)\n}"
- lang: C#
label: C#
source: "using Mailjet.Client;\nusing Mailjet.Client.Resources;\nusing System;\nusing Newtonsoft.Json.Linq;\nnamespace Mailjet.ConsoleApplication\n{\n class Program\n {\n static void Main(string[] args)\n {\n RunAsync().Wait();\n }\n static async Task RunAsync()\n {\n MailjetClient client = new MailjetClient(Environment.GetEnvironmentVariable(\"MJ_APIKEY_PUBLIC\"), Environment.GetEnvironmentVariable(\"MJ_APIKEY_PRIVATE\"))\n {\n Version = ApiVersion.V3,\n };\n MailjetRequest request = new MailjetRequest\n {\n Resource = Campaignoverview.Resource,\n }\n MailjetResponse response = await client.GetAsync(request);\n if (response.IsSuccessStatusCode)\n {\n Console.WriteLine(string.Format(\"Total: {0}, Count: {1}\\n\", response.GetTotal(), response.GetCount()));\n Console.WriteLine(response.GetData());\n }\n else\n {\n Console.WriteLine(string.Format(\"StatusCode: {0}\\n\", response.StatusCode));\n Console.WriteLine(string.Format(\"ErrorInfo: {0}\\n\", response.GetErrorInfo()));\n Console.WriteLine(response.GetData());\n Console.WriteLine(string.Format(\"ErrorMessage: {0}\\n\", response.GetErrorMessage()));\n }\n }\n }\n}"
"/v3/REST/campaignoverview/{ID}":
get:
x-seo:
title: "Campaign Overview by ID"
description: "Retrieve information about a specific draft, AB Testing object or sent campaign. You will see its type, edit tool used and creation time, as well as\u2026"
tags:
- Statistics
summary: Campaign Overview by ID
description: Retrieve information about a specific draft, AB Testing object or sent campaign. You will see its type, edit tool used and creation time, as well as general info like the title and subject line for the campaign.
operationId: get_v3_campaignoverview_id
parameters:
- name: ID
in: path
schema:
$ref: '#/components/schemas/get_v3_campaignoverview_id_PathParams/properties/ID'
required: true
example: Campaign|6000
responses:
'200':
description: Default OK response for `/campaignoverview`
content:
application/json:
schema:
type: object
properties:
Count:
description: Indicates the number of objects in the `Data` array.
type: integer
format: int64
examples:
- 1
Data:
description: A JSON array containing a list of objects returned by this endpoint.
type: array
items:
$ref: '#/components/schemas/OutputCampaignoverview'
Total:
description: Indicates the number of objects in the `Data` array.
type: integer
format: int64
examples:
- 1
'400':
$ref: '#/components/responses/400'
'401':
$ref: '#/components/responses/401'
'403':
$ref: '#/components/responses/403'
'404':
$ref: '#/components/responses/404'
'429':
$ref: '#/components/responses/429'
'500':
$ref: '#/components/responses/500'
security:
- basicAuth: []
x-codeSamples:
- lang: curl
label: cURL
source: "curl -s \\\n\t-X GET \\\n\t--user \"$MJ_APIKEY_PUBLIC:$MJ_APIKEY_PRIVATE\" \\\n\thttps://api.mailjet.com/v3/REST/campaignoverview/$IDType \\"
- lang: PHP
label: PHP
source: " 'v3']);\n$response = $mj->get(Resources::$Campaignoverview, ['id' => $id]);\n$response->success() && var_dump($response->getData());\n?>"
- lang: Node.js
label: Node
source: "const mailjet = require ('node-mailjet')\n\t.connect(process.env.MJ_APIKEY_PUBLIC, process.env.MJ_APIKEY_PRIVATE)\nconst request = mailjet\n\t.get(\"campaignoverview\", {'version': 'v3'})\n\t.id($IDType)\n\t.request()\nrequest\n\t.then((result) => {\n\t\tconsole.log(result.body)\n\t})\n\t.catch((err) => {\n\t\tconsole.log(err.statusCode)\n\t})"
- lang: Ruby
label: Ruby
source: "require 'mailjet'\nMailjet.configure do |config|\n config.api_key = ENV['MJ_APIKEY_PUBLIC']\n config.secret_key = ENV['MJ_APIKEY_PRIVATE']\n config.api_version = \"v3\"\nend\nvariable = Mailjet::Campaignoverview.find($IDType\n)\np variable.attributes['Data']"
- lang: Python
label: Python
source: "from mailjet_rest import Client\nimport os\napi_key = os.environ['MJ_APIKEY_PUBLIC']\napi_secret = os.environ['MJ_APIKEY_PRIVATE']\nmailjet = Client(auth=(api_key, api_secret), version='v3')\nid = '$IDType'\nresult = mailjet.campaignoverview.get(id=id)\nprint result.status_code\nprint result.json()"
- lang: Java
label: Java
source: "package com.my.project;\nimport com.mailjet.client.errors.MailjetException;\nimport com.mailjet.client.errors.MailjetSocketTimeoutException;\nimport com.mailjet.client.MailjetClient;\nimport com.mailjet.client.MailjetRequest;\nimport com.mailjet.client.MailjetResponse;\nimport com.mailjet.client.ClientOptions;\nimport com.mailjet.client.resource.Campaignoverview;\nimport org.json.JSONArray;\nimport org.json.JSONObject;\npublic class MyClass {\n public static void main(String[] args) throws MailjetException, MailjetSocketTimeoutException {\n MailjetClient client;\n MailjetRequest request;\n MailjetResponse response;\n client = new MailjetClient(System.getenv(\"MJ_APIKEY_PUBLIC\"), System.getenv(\"MJ_APIKEY_PRIVATE\"), new ClientOptions(\"v3\"));\n request = new MailjetRequest(Campaignoverview.resource, ID);\n response = client.get(request);\n System.out.println(response.getStatus());\n System.out.println(response.getData());\n }\n}"
- lang: Go
label: Go
source: "package main\nimport (\n\t\"fmt\"\n\t\"log\"\n\t\"os\"\n\tmailjet \"github.com/mailjet/mailjet-apiv3-go\"\n\t\"github.com/mailjet/mailjet-apiv3-go/resources\"\n)\nfunc main () {\n\tmailjetClient := NewMailjetClient(os.Getenv(\"MJ_APIKEY_PUBLIC\"), os.Getenv(\"MJ_APIKEY_PRIVATE\"))\n\tvar data []resources.Campaignoverview\n\tmr := &Request{\n\t Resource: \"campaignoverview\",\n\t ID: RESOURCE_ID,\n\t}\n\terr := mailjetClient.Get(mr, &data)\n\tif err != nil {\n\t fmt.Println(err)\n\t}\n\tfmt.Printf(\"Data array: %+v\\n\", data)\n}"
- lang: C#
label: C#
source: "using Mailjet.Client;\nusing Mailjet.Client.Resources;\nusing System;\nusing Newtonsoft.Json.Linq;\nnamespace Mailjet.ConsoleApplication\n{\n class Program\n {\n static void Main(string[] args)\n {\n RunAsync().Wait();\n }\n static async Task RunAsync()\n {\n MailjetClient client = new MailjetClient(Environment.GetEnvironmentVariable(\"MJ_APIKEY_PUBLIC\"), Environment.GetEnvironmentVariable(\"MJ_APIKEY_PRIVATE\"))\n {\n Version = ApiVersion.V3,\n };\n MailjetRequest request = new MailjetRequest\n {\n Resource = Campaignoverview.Resource,\n ResourceId = ResourceId.Numeric(ID)\n }\n MailjetResponse response = await client.GetAsync(request);\n if (response.IsSuccessStatusCode)\n {\n Console.WriteLine(string.Format(\"Total: {0}, Count: {1}\\n\", response.GetTotal(), response.GetCount()));\n Console.WriteLine(response.GetData());\n }\n else\n {\n Console.WriteLine(string.Format(\"StatusCode: {0}\\n\", response.StatusCode));\n Console.WriteLine(string.Format(\"ErrorInfo: {0}\\n\", response.GetErrorInfo()));\n Console.WriteLine(response.GetData());\n Console.WriteLine(string.Format(\"ErrorMessage: {0}\\n\", response.GetErrorMessage()));\n }\n }\n }\n}"
"/v3/REST/contactstatistics":
get:
x-seo:
title: "Contact Statistics List"
description: "Contact Statistics List in the Mailjet Email API. Retrieve a list of overall aggregated delivery and engagement statistics, grouped by contact."
tags:
- Statistics
summary: Contact Statistics List
description: Retrieve a list of overall aggregated delivery and engagement statistics, grouped by contact.
operationId: get_v3_contactstatistics
parameters:
- name: Blocked
in: query
schema:
$ref: '#/components/schemas/get_v3_contactstatistics_QueryParams/properties/Blocked'
- name: Bounced
in: query
schema:
$ref: '#/components/schemas/get_v3_contactstatistics_QueryParams/properties/Bounced'
- name: Click
in: query
schema:
$ref: '#/components/schemas/get_v3_contactstatistics_QueryParams/properties/Click'
- name: Deferred
in: query
schema:
$ref: '#/components/schemas/get_v3_contactstatistics_QueryParams/properties/Deferred'
- name: Hardbounced
in: query
schema:
$ref: '#/components/schemas/get_v3_contactstatistics_QueryParams/properties/Hardbounced'
- name: LastActivityAt
in: query
schema:
$ref: '#/components/schemas/get_v3_contactstatistics_QueryParams/properties/LastActivityAt'
- name: MaxLastActivityAt
in: query
schema:
$ref: '#/components/schemas/get_v3_contactstatistics_QueryParams/properties/MaxLastActivityAt'
- name: MinLastActivityAt
in: query
schema:
$ref: '#/components/schemas/get_v3_contactstatistics_QueryParams/properties/MinLastActivityAt'
- name: Open
in: query
schema:
$ref: '#/components/schemas/get_v3_contactstatistics_QueryParams/properties/Open'
- name: Queued
in: query
schema:
$ref: '#/components/schemas/get_v3_contactstatistics_QueryParams/properties/Queued'
- name: Recalculate
in: query
schema:
$ref: '#/components/schemas/get_v3_contactstatistics_QueryParams/properties/Recalculate'
- name: Sent
in: query
schema:
$ref: '#/components/schemas/get_v3_contactstatistics_QueryParams/properties/Sent'
- name: Spam
in: query
schema:
$ref: '#/components/schemas/get_v3_contactstatistics_QueryParams/properties/Spam'
- name: Softbounced
in: query
schema:
$ref: '#/components/schemas/get_v3_contactstatistics_QueryParams/properties/Softbounced'
- name: Unsubscribed
in: query
schema:
$ref: '#/components/schemas/get_v3_contactstatistics_QueryParams/properties/Unsubscribed'
responses:
'200':
description: Default OK response for `/contactstatistics`
content:
application/json:
schema:
type: object
properties:
Count:
description: Indicates the number of objects in the `Data` array.
type: integer
format: int64
examples:
- 1
Data:
description: A JSON array containing a list of objects returned by this endpoint.
type: array
items:
$ref: '#/components/schemas/OutputContactstatistics'
Total:
description: Indicates the number of objects in the `Data` array.
type: integer
format: int64
examples:
- 1
'400':
$ref: '#/components/responses/400'
'401':
$ref: '#/components/responses/401'
'403':
$ref: '#/components/responses/403'
'404':
$ref: '#/components/responses/404'
'429':
$ref: '#/components/responses/429'
'500':
$ref: '#/components/responses/500'
security:
- basicAuth: []
x-codeSamples:
- lang: curl
label: cURL
source: "curl -s \\\n\t-X GET \\\n\t--user \"$MJ_APIKEY_PUBLIC:$MJ_APIKEY_PRIVATE\" \\\n\thttps://api.mailjet.com/v3/REST/contactstatistics \\"
- lang: PHP
label: PHP
source: " 'v3']);\n$response = $mj->get(Resources::$Contactstatistics);\n$response->success() && var_dump($response->getData());\n?>"
- lang: Node.js
label: Node
source: "const mailjet = require ('node-mailjet')\n\t.connect(process.env.MJ_APIKEY_PUBLIC, process.env.MJ_APIKEY_PRIVATE)\nconst request = mailjet\n\t.get(\"contactstatistics\", {'version': 'v3'})\n\t.request()\nrequest\n\t.then((result) => {\n\t\tconsole.log(result.body)\n\t})\n\t.catch((err) => {\n\t\tconsole.log(err.statusCode)\n\t})"
- lang: Ruby
label: Ruby
source: "require 'mailjet'\nMailjet.configure do |config|\n config.api_key = ENV['MJ_APIKEY_PUBLIC']\n config.secret_key = ENV['MJ_APIKEY_PRIVATE']\n config.api_version = \"v3\"\nend\nvariable = Mailjet::Contactstatistics.all(\n)\np variable.attributes['Data']"
- lang: Python
label: Python
source: "from mailjet_rest import Client\nimport os\napi_key = os.environ['MJ_APIKEY_PUBLIC']\napi_secret = os.environ['MJ_APIKEY_PRIVATE']\nmailjet = Client(auth=(api_key, api_secret), version='v3')\nresult = mailjet.contactstatistics.get()\nprint result.status_code\nprint result.json()"
- lang: Java
label: Java
source: "package com.my.project;\nimport com.mailjet.client.errors.MailjetException;\nimport com.mailjet.client.errors.MailjetSocketTimeoutException;\nimport com.mailjet.client.MailjetClient;\nimport com.mailjet.client.MailjetRequest;\nimport com.mailjet.client.MailjetResponse;\nimport com.mailjet.client.ClientOptions;\nimport com.mailjet.client.resource.Contactstatistics;\nimport org.json.JSONArray;\nimport org.json.JSONObject;\npublic class MyClass {\n public static void main(String[] args) throws MailjetException, MailjetSocketTimeoutException {\n MailjetClient client;\n MailjetRequest request;\n MailjetResponse response;\n client = new MailjetClient(System.getenv(\"MJ_APIKEY_PUBLIC\"), System.getenv(\"MJ_APIKEY_PRIVATE\"), new ClientOptions(\"v3\"));\n request = new MailjetRequest(Contactstatistics.resource);\n response = client.get(request);\n System.out.println(response.getStatus());\n System.out.println(response.getData());\n }\n}"
- lang: Go
label: Go
source: "package main\nimport (\n\t\"fmt\"\n\t\"log\"\n\t\"os\"\n\tmailjet \"github.com/mailjet/mailjet-apiv3-go\"\n\t\"github.com/mailjet/mailjet-apiv3-go/resources\"\n)\nfunc main () {\n\tmailjetClient := NewMailjetClient(os.Getenv(\"MJ_APIKEY_PUBLIC\"), os.Getenv(\"MJ_APIKEY_PRIVATE\"))\n\tvar data []resources.Contactstatistics\n\t_, _, err := mailjetClient.List(\"contactstatistics\", &data)\n\tif err != nil {\n\t fmt.Println(err)\n\t}\n\tfmt.Printf(\"Data array: %+v\\n\", data)\n}"
- lang: C#
label: C#
source: "using Mailjet.Client;\nusing Mailjet.Client.Resources;\nusing System;\nusing Newtonsoft.Json.Linq;\nnamespace Mailjet.ConsoleApplication\n{\n class Program\n {\n static void Main(string[] args)\n {\n RunAsync().Wait();\n }\n static async Task RunAsync()\n {\n MailjetClient client = new MailjetClient(Environment.GetEnvironmentVariable(\"MJ_APIKEY_PUBLIC\"), Environment.GetEnvironmentVariable(\"MJ_APIKEY_PRIVATE\"))\n {\n Version = ApiVersion.V3,\n };\n MailjetRequest request = new MailjetRequest\n {\n Resource = Contactstatistics.Resource,\n }\n MailjetResponse response = await client.GetAsync(request);\n if (response.IsSuccessStatusCode)\n {\n Console.WriteLine(string.Format(\"Total: {0}, Count: {1}\\n\", response.GetTotal(), response.GetCount()));\n Console.WriteLine(response.GetData());\n }\n else\n {\n Console.WriteLine(string.Format(\"StatusCode: {0}\\n\", response.StatusCode));\n Console.WriteLine(string.Format(\"ErrorInfo: {0}\\n\", response.GetErrorInfo()));\n Console.WriteLine(response.GetData());\n Console.WriteLine(string.Format(\"ErrorMessage: {0}\\n\", response.GetErrorMessage()));\n }\n }\n }\n}"
/v3/REST/contactstatistics/{contact_ID}:
get:
x-seo:
title: "Contact Statistics by ID"
description: "Contact Statistics by ID in the Mailjet Email API. Retrieve a list of overall aggregated delivery and engagement statistics for a specific contact."
tags:
- Statistics
summary: Contact Statistics by ID
description: Retrieve a list of overall aggregated delivery and engagement statistics for a specific contact. To obtain a valid `contact_ID`, first call `GET /v3/REST/contact` to list your contacts.
operationId: get_v3_contactstatistics_id
parameters:
- name: contact_ID
in: path
schema:
$ref: '#/components/schemas/get_v3_contactstatistics_id_PathParams/properties/contact_ID'
required: true
example: 1000
responses:
'200':
description: Default OK response for `/contactstatistics`
content:
application/json:
schema:
type: object
properties:
Count:
description: Indicates the number of objects in the `Data` array.
type: integer
format: int64
examples:
- 1
Data:
description: A JSON array containing a list of objects returned by this endpoint.
type: array
items:
$ref: '#/components/schemas/OutputContactstatistics'
Total:
description: Indicates the number of objects in the `Data` array.
type: integer
format: int64
examples:
- 1
'400':
$ref: '#/components/responses/400'
'401':
$ref: '#/components/responses/401'
'403':
$ref: '#/components/responses/403'
'404':
$ref: '#/components/responses/404'
'429':
$ref: '#/components/responses/429'
'500':
$ref: '#/components/responses/500'
security:
- basicAuth: []
x-codeSamples:
- lang: curl
label: cURL
source: "curl -s \\\n\t-X GET \\\n\t--user \"$MJ_APIKEY_PUBLIC:$MJ_APIKEY_PRIVATE\" \\\n\thttps://api.mailjet.com/v3/REST/contactstatistics/$contact_ID \\"
- lang: PHP
label: PHP
source: " 'v3']);\n$response = $mj->get(Resources::$Contactstatistics, ['id' => $id]);\n$response->success() && var_dump($response->getData());\n?>"
- lang: Node.js
label: Node
source: "const mailjet = require ('node-mailjet')\n\t.connect(process.env.MJ_APIKEY_PUBLIC, process.env.MJ_APIKEY_PRIVATE)\nconst request = mailjet\n\t.get(\"contactstatistics\", {'version': 'v3'})\n\t.id($contact_ID)\n\t.request()\nrequest\n\t.then((result) => {\n\t\tconsole.log(result.body)\n\t})\n\t.catch((err) => {\n\t\tconsole.log(err.statusCode)\n\t})"
- lang: Ruby
label: Ruby
source: "require 'mailjet'\nMailjet.configure do |config|\n config.api_key = ENV['MJ_APIKEY_PUBLIC']\n config.secret_key = ENV['MJ_APIKEY_PRIVATE']\n config.api_version = \"v3\"\nend\nvariable = Mailjet::Contactstatistics.find($contact_ID\n)\np variable.attributes['Data']"
- lang: Python
label: Python
source: "from mailjet_rest import Client\nimport os\napi_key = os.environ['MJ_APIKEY_PUBLIC']\napi_secret = os.environ['MJ_APIKEY_PRIVATE']\nmailjet = Client(auth=(api_key, api_secret), version='v3')\nid = '$contact_ID'\nresult = mailjet.contactstatistics.get(id=id)\nprint result.status_code\nprint result.json()"
- lang: Java
label: Java
source: "package com.my.project;\nimport com.mailjet.client.errors.MailjetException;\nimport com.mailjet.client.errors.MailjetSocketTimeoutException;\nimport com.mailjet.client.MailjetClient;\nimport com.mailjet.client.MailjetRequest;\nimport com.mailjet.client.MailjetResponse;\nimport com.mailjet.client.ClientOptions;\nimport com.mailjet.client.resource.Contactstatistics;\nimport org.json.JSONArray;\nimport org.json.JSONObject;\npublic class MyClass {\n public static void main(String[] args) throws MailjetException, MailjetSocketTimeoutException {\n MailjetClient client;\n MailjetRequest request;\n MailjetResponse response;\n client = new MailjetClient(System.getenv(\"MJ_APIKEY_PUBLIC\"), System.getenv(\"MJ_APIKEY_PRIVATE\"), new ClientOptions(\"v3\"));\n request = new MailjetRequest(Contactstatistics.resource, ID);\n response = client.get(request);\n System.out.println(response.getStatus());\n System.out.println(response.getData());\n }\n}"
- lang: Go
label: Go
source: "package main\nimport (\n\t\"fmt\"\n\t\"log\"\n\t\"os\"\n\tmailjet \"github.com/mailjet/mailjet-apiv3-go\"\n\t\"github.com/mailjet/mailjet-apiv3-go/resources\"\n)\nfunc main () {\n\tmailjetClient := NewMailjetClient(os.Getenv(\"MJ_APIKEY_PUBLIC\"), os.Getenv(\"MJ_APIKEY_PRIVATE\"))\n\tvar data []resources.Contactstatistics\n\tmr := &Request{\n\t Resource: \"contactstatistics\",\n\t ID: RESOURCE_ID,\n\t}\n\terr := mailjetClient.Get(mr, &data)\n\tif err != nil {\n\t fmt.Println(err)\n\t}\n\tfmt.Printf(\"Data array: %+v\\n\", data)\n}"
- lang: C#
label: C#
source: "using Mailjet.Client;\nusing Mailjet.Client.Resources;\nusing System;\nusing Newtonsoft.Json.Linq;\nnamespace Mailjet.ConsoleApplication\n{\n class Program\n {\n static void Main(string[] args)\n {\n RunAsync().Wait();\n }\n static async Task RunAsync()\n {\n MailjetClient client = new MailjetClient(Environment.GetEnvironmentVariable(\"MJ_APIKEY_PUBLIC\"), Environment.GetEnvironmentVariable(\"MJ_APIKEY_PRIVATE\"))\n {\n Version = ApiVersion.V3,\n };\n MailjetRequest request = new MailjetRequest\n {\n Resource = Contactstatistics.Resource,\n ResourceId = ResourceId.Numeric(ID)\n }\n MailjetResponse response = await client.GetAsync(request);\n if (response.IsSuccessStatusCode)\n {\n Console.WriteLine(string.Format(\"Total: {0}, Count: {1}\\n\", response.GetTotal(), response.GetCount()));\n Console.WriteLine(response.GetData());\n }\n else\n {\n Console.WriteLine(string.Format(\"StatusCode: {0}\\n\", response.StatusCode));\n Console.WriteLine(string.Format(\"ErrorInfo: {0}\\n\", response.GetErrorInfo()));\n Console.WriteLine(response.GetData());\n Console.WriteLine(string.Format(\"ErrorMessage: {0}\\n\", response.GetErrorMessage()));\n }\n }\n }\n}"
"/v3/REST/listrecipientstatistics":
get:
x-seo:
title: "List Recipient Statistics"
description: "Retrieve a list of overall aggregated delivery and engagement statistics for all list recipients. A list recipient object manages the relationship\u2026"
tags:
- Statistics
summary: List Recipient Statistics
description: Retrieve a list of overall aggregated delivery and engagement statistics for all list recipients. A list recipient object manages the relationship between a `contact` and a `contactslist` - every instance of a contact being added to a list creates a new list recipient.
operationId: get_v3_listrecipientstatistics
parameters:
- name: Blocked
in: query
schema:
$ref: '#/components/schemas/get_v3_listrecipientstatistics_QueryParams/properties/Blocked'
- name: Bounced
in: query
schema:
$ref: '#/components/schemas/get_v3_listrecipientstatistics_QueryParams/properties/Bounced'
- name: Click
in: query
schema:
$ref: '#/components/schemas/get_v3_listrecipientstatistics_QueryParams/properties/Click'
- name: Contact
in: query
schema:
$ref: '#/components/schemas/get_v3_listrecipientstatistics_QueryParams/properties/Contact'
- name: ContactsList
in: query
schema:
$ref: '#/components/schemas/get_v3_listrecipientstatistics_QueryParams/properties/ContactsList'
- name: IsExcludedFromCampaigns
in: query
schema:
$ref: '#/components/schemas/get_v3_listrecipientstatistics_QueryParams/properties/IsExcludedFromCampaigns'
- name: IsUnsubscribed
in: query
schema:
$ref: '#/components/schemas/get_v3_listrecipientstatistics_QueryParams/properties/IsUnsubscribed'
- name: LastActivityAt
in: query
schema:
$ref: '#/components/schemas/get_v3_listrecipientstatistics_QueryParams/properties/LastActivityAt'
- name: MaxLastActivityAt
in: query
schema:
$ref: '#/components/schemas/get_v3_listrecipientstatistics_QueryParams/properties/MaxLastActivityAt'
- name: MaxUnsubscribedAt
in: query
schema:
$ref: '#/components/schemas/get_v3_listrecipientstatistics_QueryParams/properties/MaxUnsubscribedAt'
- name: MinLastActivityAt
in: query
schema:
$ref: '#/components/schemas/get_v3_listrecipientstatistics_QueryParams/properties/MinLastActivityAt'
- name: MinUnsubscribedAt
in: query
schema:
$ref: '#/components/schemas/get_v3_listrecipientstatistics_QueryParams/properties/MinUnsubscribedAt'
- name: Open
in: query
schema:
$ref: '#/components/schemas/get_v3_listrecipientstatistics_QueryParams/properties/Open'
- name: Queued
in: query
schema:
$ref: '#/components/schemas/get_v3_listrecipientstatistics_QueryParams/properties/Queued'
- name: Sent
in: query
schema:
$ref: '#/components/schemas/get_v3_listrecipientstatistics_QueryParams/properties/Sent'
- name: ShowExtraData
in: query
schema:
$ref: '#/components/schemas/get_v3_listrecipientstatistics_QueryParams/properties/ShowExtraData'
- name: Spam
in: query
schema:
$ref: '#/components/schemas/get_v3_listrecipientstatistics_QueryParams/properties/Spam'
- name: TimeZone
in: query
schema:
$ref: '#/components/schemas/get_v3_listrecipientstatistics_QueryParams/properties/TimeZone'
- name: Unsubscribed
in: query
schema:
$ref: '#/components/schemas/get_v3_listrecipientstatistics_QueryParams/properties/Unsubscribed'
responses:
'200':
description: Default OK response for `/listrecipientstatistics`
content:
application/json:
schema:
type: object
properties:
Count:
description: Indicates the number of objects in the `Data` array.
type: integer
format: int64
examples:
- 1
Data:
description: A JSON array containing a list of objects returned by this endpoint.
type: array
items:
$ref: '#/components/schemas/OutputListrecipientstatistics'
Total:
description: Indicates the number of objects in the `Data` array.
type: integer
format: int64
examples:
- 1
'400':
$ref: '#/components/responses/400'
'401':
$ref: '#/components/responses/401'
'403':
$ref: '#/components/responses/403'
'404':
$ref: '#/components/responses/404'
'429':
$ref: '#/components/responses/429'
'500':
$ref: '#/components/responses/500'
security:
- basicAuth: []
x-codeSamples:
- lang: curl
label: cURL
source: "curl -s \\\n\t-X GET \\\n\t--user \"$MJ_APIKEY_PUBLIC:$MJ_APIKEY_PRIVATE\" \\\n\thttps://api.mailjet.com/v3/REST/listrecipientstatistics \\"
- lang: PHP
label: PHP
source: " 'v3']);\n$response = $mj->get(Resources::$Listrecipientstatistics);\n$response->success() && var_dump($response->getData());\n?>"
- lang: Node.js
label: Node
source: "const mailjet = require ('node-mailjet')\n\t.connect(process.env.MJ_APIKEY_PUBLIC, process.env.MJ_APIKEY_PRIVATE)\nconst request = mailjet\n\t.get(\"listrecipientstatistics\", {'version': 'v3'})\n\t.request()\nrequest\n\t.then((result) => {\n\t\tconsole.log(result.body)\n\t})\n\t.catch((err) => {\n\t\tconsole.log(err.statusCode)\n\t})"
- lang: Ruby
label: Ruby
source: "require 'mailjet'\nMailjet.configure do |config|\n config.api_key = ENV['MJ_APIKEY_PUBLIC']\n config.secret_key = ENV['MJ_APIKEY_PRIVATE']\n config.api_version = \"v3\"\nend\nvariable = Mailjet::Listrecipientstatistics.all(\n)\np variable.attributes['Data']"
- lang: Python
label: Python
source: "from mailjet_rest import Client\nimport os\napi_key = os.environ['MJ_APIKEY_PUBLIC']\napi_secret = os.environ['MJ_APIKEY_PRIVATE']\nmailjet = Client(auth=(api_key, api_secret), version='v3')\nresult = mailjet.listrecipientstatistics.get()\nprint result.status_code\nprint result.json()"
- lang: Java
label: Java
source: "package com.my.project;\nimport com.mailjet.client.errors.MailjetException;\nimport com.mailjet.client.errors.MailjetSocketTimeoutException;\nimport com.mailjet.client.MailjetClient;\nimport com.mailjet.client.MailjetRequest;\nimport com.mailjet.client.MailjetResponse;\nimport com.mailjet.client.ClientOptions;\nimport com.mailjet.client.resource.Listrecipientstatistics;\nimport org.json.JSONArray;\nimport org.json.JSONObject;\npublic class MyClass {\n public static void main(String[] args) throws MailjetException, MailjetSocketTimeoutException {\n MailjetClient client;\n MailjetRequest request;\n MailjetResponse response;\n client = new MailjetClient(System.getenv(\"MJ_APIKEY_PUBLIC\"), System.getenv(\"MJ_APIKEY_PRIVATE\"), new ClientOptions(\"v3\"));\n request = new MailjetRequest(Listrecipientstatistics.resource);\n response = client.get(request);\n System.out.println(response.getStatus());\n System.out.println(response.getData());\n }\n}"
- lang: Go
label: Go
source: "package main\nimport (\n\t\"fmt\"\n\t\"log\"\n\t\"os\"\n\tmailjet \"github.com/mailjet/mailjet-apiv3-go\"\n\t\"github.com/mailjet/mailjet-apiv3-go/resources\"\n)\nfunc main () {\n\tmailjetClient := NewMailjetClient(os.Getenv(\"MJ_APIKEY_PUBLIC\"), os.Getenv(\"MJ_APIKEY_PRIVATE\"))\n\tvar data []resources.Listrecipientstatistics\n\t_, _, err := mailjetClient.List(\"listrecipientstatistics\", &data)\n\tif err != nil {\n\t fmt.Println(err)\n\t}\n\tfmt.Printf(\"Data array: %+v\\n\", data)\n}"
- lang: C#
label: C#
source: "using Mailjet.Client;\nusing Mailjet.Client.Resources;\nusing System;\nusing Newtonsoft.Json.Linq;\nnamespace Mailjet.ConsoleApplication\n{\n class Program\n {\n static void Main(string[] args)\n {\n RunAsync().Wait();\n }\n static async Task RunAsync()\n {\n MailjetClient client = new MailjetClient(Environment.GetEnvironmentVariable(\"MJ_APIKEY_PUBLIC\"), Environment.GetEnvironmentVariable(\"MJ_APIKEY_PRIVATE\"))\n {\n Version = ApiVersion.V3,\n };\n MailjetRequest request = new MailjetRequest\n {\n Resource = Listrecipientstatistics.Resource,\n }\n MailjetResponse response = await client.GetAsync(request);\n if (response.IsSuccessStatusCode)\n {\n Console.WriteLine(string.Format(\"Total: {0}, Count: {1}\\n\", response.GetTotal(), response.GetCount()));\n Console.WriteLine(response.GetData());\n }\n else\n {\n Console.WriteLine(string.Format(\"StatusCode: {0}\\n\", response.StatusCode));\n Console.WriteLine(string.Format(\"ErrorInfo: {0}\\n\", response.GetErrorInfo()));\n Console.WriteLine(response.GetData());\n Console.WriteLine(string.Format(\"ErrorMessage: {0}\\n\", response.GetErrorMessage()));\n }\n }\n }\n}"
/v3/REST/listrecipientstatistics/{listrecipient_ID}:
get:
x-seo:
title: "List Recipient Statistics by ID"
description: "List Recipient Statistics by ID in the Mailjet Email API. Retrieve a list of overall aggregated delivery and engagement statistics for a specific list\u2026"
tags:
- Statistics
summary: List Recipient Statistics by ID
description: Retrieve a list of overall aggregated delivery and engagement statistics for a specific list recipient. To obtain a valid `listrecipient_ID`, first call `GET /v3/REST/listrecipient` to list your list recipients.
operationId: get_v3_listrecipientstatistics_id
parameters:
- name: listrecipient_ID
in: path
schema:
$ref: '#/components/schemas/get_v3_listrecipientstatistics_id_PathParams/properties/listrecipient_ID'
required: true
example: 14000
responses:
'200':
description: Default OK response for `/listrecipientstatistics`
content:
application/json:
schema:
type: object
properties:
Count:
description: Indicates the number of objects in the `Data` array.
type: integer
format: int64
examples:
- 1
Data:
description: A JSON array containing a list of objects returned by this endpoint.
type: array
items:
$ref: '#/components/schemas/OutputListrecipientstatistics'
Total:
description: Indicates the number of objects in the `Data` array.
type: integer
format: int64
examples:
- 1
'400':
$ref: '#/components/responses/400'
'401':
$ref: '#/components/responses/401'
'403':
$ref: '#/components/responses/403'
'404':
$ref: '#/components/responses/404'
'429':
$ref: '#/components/responses/429'
'500':
$ref: '#/components/responses/500'
security:
- basicAuth: []
x-codeSamples:
- lang: curl
label: cURL
source: "curl -s \\\n\t-X GET \\\n\t--user \"$MJ_APIKEY_PUBLIC:$MJ_APIKEY_PRIVATE\" \\\n\thttps://api.mailjet.com/v3/REST/listrecipientstatistics/$listrecipient_ID \\"
- lang: PHP
label: PHP
source: " 'v3']);\n$response = $mj->get(Resources::$Listrecipientstatistics, ['id' => $id]);\n$response->success() && var_dump($response->getData());\n?>"
- lang: Node.js
label: Node
source: "const mailjet = require ('node-mailjet')\n\t.connect(process.env.MJ_APIKEY_PUBLIC, process.env.MJ_APIKEY_PRIVATE)\nconst request = mailjet\n\t.get(\"listrecipientstatistics\", {'version': 'v3'})\n\t.id($listrecipient_ID)\n\t.request()\nrequest\n\t.then((result) => {\n\t\tconsole.log(result.body)\n\t})\n\t.catch((err) => {\n\t\tconsole.log(err.statusCode)\n\t})"
- lang: Ruby
label: Ruby
source: "require 'mailjet'\nMailjet.configure do |config|\n config.api_key = ENV['MJ_APIKEY_PUBLIC']\n config.secret_key = ENV['MJ_APIKEY_PRIVATE']\n config.api_version = \"v3\"\nend\nvariable = Mailjet::Listrecipientstatistics.find($listrecipient_ID\n)\np variable.attributes['Data']"
- lang: Python
label: Python
source: "from mailjet_rest import Client\nimport os\napi_key = os.environ['MJ_APIKEY_PUBLIC']\napi_secret = os.environ['MJ_APIKEY_PRIVATE']\nmailjet = Client(auth=(api_key, api_secret), version='v3')\nid = '$listrecipient_ID'\nresult = mailjet.listrecipientstatistics.get(id=id)\nprint result.status_code\nprint result.json()"
- lang: Java
label: Java
source: "package com.my.project;\nimport com.mailjet.client.errors.MailjetException;\nimport com.mailjet.client.errors.MailjetSocketTimeoutException;\nimport com.mailjet.client.MailjetClient;\nimport com.mailjet.client.MailjetRequest;\nimport com.mailjet.client.MailjetResponse;\nimport com.mailjet.client.ClientOptions;\nimport com.mailjet.client.resource.Listrecipientstatistics;\nimport org.json.JSONArray;\nimport org.json.JSONObject;\npublic class MyClass {\n public static void main(String[] args) throws MailjetException, MailjetSocketTimeoutException {\n MailjetClient client;\n MailjetRequest request;\n MailjetResponse response;\n client = new MailjetClient(System.getenv(\"MJ_APIKEY_PUBLIC\"), System.getenv(\"MJ_APIKEY_PRIVATE\"), new ClientOptions(\"v3\"));\n request = new MailjetRequest(Listrecipientstatistics.resource, ID);\n response = client.get(request);\n System.out.println(response.getStatus());\n System.out.println(response.getData());\n }\n}"
- lang: Go
label: Go
source: "package main\nimport (\n\t\"fmt\"\n\t\"log\"\n\t\"os\"\n\tmailjet \"github.com/mailjet/mailjet-apiv3-go\"\n\t\"github.com/mailjet/mailjet-apiv3-go/resources\"\n)\nfunc main () {\n\tmailjetClient := NewMailjetClient(os.Getenv(\"MJ_APIKEY_PUBLIC\"), os.Getenv(\"MJ_APIKEY_PRIVATE\"))\n\tvar data []resources.Listrecipientstatistics\n\tmr := &Request{\n\t Resource: \"listrecipientstatistics\",\n\t ID: RESOURCE_ID,\n\t}\n\terr := mailjetClient.Get(mr, &data)\n\tif err != nil {\n\t fmt.Println(err)\n\t}\n\tfmt.Printf(\"Data array: %+v\\n\", data)\n}"
- lang: C#
label: C#
source: "using Mailjet.Client;\nusing Mailjet.Client.Resources;\nusing System;\nusing Newtonsoft.Json.Linq;\nnamespace Mailjet.ConsoleApplication\n{\n class Program\n {\n static void Main(string[] args)\n {\n RunAsync().Wait();\n }\n static async Task RunAsync()\n {\n MailjetClient client = new MailjetClient(Environment.GetEnvironmentVariable(\"MJ_APIKEY_PUBLIC\"), Environment.GetEnvironmentVariable(\"MJ_APIKEY_PRIVATE\"))\n {\n Version = ApiVersion.V3,\n };\n MailjetRequest request = new MailjetRequest\n {\n Resource = Listrecipientstatistics.Resource,\n ResourceId = ResourceId.Numeric(ID)\n }\n MailjetResponse response = await client.GetAsync(request);\n if (response.IsSuccessStatusCode)\n {\n Console.WriteLine(string.Format(\"Total: {0}, Count: {1}\\n\", response.GetTotal(), response.GetCount()));\n Console.WriteLine(response.GetData());\n }\n else\n {\n Console.WriteLine(string.Format(\"StatusCode: {0}\\n\", response.StatusCode));\n Console.WriteLine(string.Format(\"ErrorInfo: {0}\\n\", response.GetErrorInfo()));\n Console.WriteLine(response.GetData());\n Console.WriteLine(string.Format(\"ErrorMessage: {0}\\n\", response.GetErrorMessage()));\n }\n }\n }\n}"
"/v3/REST/statistics/link-click":
get:
x-seo:
title: "Link Click Statistics"
description: "Retrieve aggregated click statistics for a campaign, grouped by URL links. Links will be identified by their URL and position index within the campaign\u2026"
tags:
- Statistics
summary: Link Click Statistics
description: "Retrieve aggregated click statistics for a campaign, grouped by URL links. Links will be identified by their URL and position index within the campaign template.\n"
operationId: get_v3_statistics_link_click
parameters:
- name: CampaignID
in: query
schema:
$ref: '#/components/schemas/get_v3_statistics_link_click_QueryParams/properties/CampaignID'
required: true
example: 6000
responses:
'200':
description: Default OK response for `/statistics/link-click`
content:
application/json:
schema:
type: object
properties:
Count:
description: Indicates the number of objects in the `Data` array.
type: integer
format: int64
examples:
- 1
Data:
description: A JSON array containing a list of objects returned by this endpoint.
type: array
items:
$ref: '#/components/schemas/OutputLinkClick'
Total:
type: integer
format: int64
examples:
- 1
'400':
$ref: '#/components/responses/400'
'401':
$ref: '#/components/responses/401'
'403':
$ref: '#/components/responses/403'
'404':
$ref: '#/components/responses/404'
'429':
$ref: '#/components/responses/429'
'500':
$ref: '#/components/responses/500'
security:
- basicAuth: []
x-codeSamples:
- lang: curl
label: cURL
source: "curl -s \\\n\t-X GET \\\n\t--user \"$MJ_APIKEY_PUBLIC:$MJ_APIKEY_PRIVATE\" \\\n\thttps://api.mailjet.com/v3/REST/statistics/ \\"
- lang: PHP
label: PHP
source: " 'v3']);\n$response = $mj->get(Resources::$Statistics);\n$response->success() && var_dump($response->getData());\n?>"
- lang: Node.js
label: Node
source: "const mailjet = require ('node-mailjet')\n\t.connect(process.env.MJ_APIKEY_PUBLIC, process.env.MJ_APIKEY_PRIVATE)\nconst request = mailjet\n\t.get(\"statistics\", {'version': 'v3'})\n\t.id()\n\t.request()\nrequest\n\t.then((result) => {\n\t\tconsole.log(result.body)\n\t})\n\t.catch((err) => {\n\t\tconsole.log(err.statusCode)\n\t})"
- lang: Ruby
label: Ruby
source: "require 'mailjet'\nMailjet.configure do |config|\n config.api_key = ENV['MJ_APIKEY_PUBLIC']\n config.secret_key = ENV['MJ_APIKEY_PRIVATE']\n config.api_version = \"v3\"\nend\nvariable = Mailjet::Statistics.all(id: ,\n)\np variable.attributes['Data']"
- lang: Python
label: Python
source: "from mailjet_rest import Client\nimport os\napi_key = os.environ['MJ_APIKEY_PUBLIC']\napi_secret = os.environ['MJ_APIKEY_PRIVATE']\nmailjet = Client(auth=(api_key, api_secret), version='v3')\nid = ''\nresult = mailjet.statistics.get(id=id)\nprint result.status_code\nprint result.json()"
- lang: Java
label: Java
source: "package com.my.project;\nimport com.mailjet.client.errors.MailjetException;\nimport com.mailjet.client.errors.MailjetSocketTimeoutException;\nimport com.mailjet.client.MailjetClient;\nimport com.mailjet.client.MailjetRequest;\nimport com.mailjet.client.MailjetResponse;\nimport com.mailjet.client.ClientOptions;\nimport com.mailjet.client.resource.Statistics;\nimport org.json.JSONArray;\nimport org.json.JSONObject;\npublic class MyClass {\n public static void main(String[] args) throws MailjetException, MailjetSocketTimeoutException {\n MailjetClient client;\n MailjetRequest request;\n MailjetResponse response;\n client = new MailjetClient(System.getenv(\"MJ_APIKEY_PUBLIC\"), System.getenv(\"MJ_APIKEY_PRIVATE\"), new ClientOptions(\"v3\"));\n request = new MailjetRequest(Statistics.resource, ID);\n response = client.get(request);\n System.out.println(response.getStatus());\n System.out.println(response.getData());\n }\n}"
- lang: Go
label: Go
source: "package main\nimport (\n\t\"fmt\"\n\t\"log\"\n\t\"os\"\n\tmailjet \"github.com/mailjet/mailjet-apiv3-go\"\n\t\"github.com/mailjet/mailjet-apiv3-go/resources\"\n)\nfunc main () {\n\tmailjetClient := NewMailjetClient(os.Getenv(\"MJ_APIKEY_PUBLIC\"), os.Getenv(\"MJ_APIKEY_PRIVATE\"))\n\tvar data []resources.Statistics\n\tmr := &Request{\n\t Resource: \"statistics\",\n\t ID: RESOURCE_ID,\n\t}\n\terr := mailjetClient.Get(mr, &data)\n\tif err != nil {\n\t fmt.Println(err)\n\t}\n\tfmt.Printf(\"Data array: %+v\\n\", data)\n}"
- lang: C#
label: C#
source: "using Mailjet.Client;\nusing Mailjet.Client.Resources;\nusing System;\nusing Newtonsoft.Json.Linq;\nnamespace Mailjet.ConsoleApplication\n{\n class Program\n {\n static void Main(string[] args)\n {\n RunAsync().Wait();\n }\n static async Task RunAsync()\n {\n MailjetClient client = new MailjetClient(Environment.GetEnvironmentVariable(\"MJ_APIKEY_PUBLIC\"), Environment.GetEnvironmentVariable(\"MJ_APIKEY_PRIVATE\"))\n {\n Version = ApiVersion.V3,\n };\n MailjetRequest request = new MailjetRequest\n {\n Resource = Statistics.Resource,\n ResourceId = ResourceId.Numeric(ID)\n }\n MailjetResponse response = await client.GetAsync(request);\n if (response.IsSuccessStatusCode)\n {\n Console.WriteLine(string.Format(\"Total: {0}, Count: {1}\\n\", response.GetTotal(), response.GetCount()));\n Console.WriteLine(response.GetData());\n }\n else\n {\n Console.WriteLine(string.Format(\"StatusCode: {0}\\n\", response.StatusCode));\n Console.WriteLine(string.Format(\"ErrorInfo: {0}\\n\", response.GetErrorInfo()));\n Console.WriteLine(response.GetData());\n Console.WriteLine(string.Format(\"ErrorMessage: {0}\\n\", response.GetErrorMessage()));\n }\n }\n }\n}"
"/v3/REST/toplinkclicked":
get:
x-seo:
title: "Top Link Clicked List"
description: "Retrieve a list of overall aggregated click statistics, grouped by URL. Note: If no query parameters are used, will return stats with FromTS equal to the\u2026"
tags:
- Statistics
summary: Top Link Clicked List
description: "Retrieve a list of overall aggregated click statistics, grouped by URL.\n\n> Note: If no query parameters are used, will return stats with `FromTS` equal to the current day at 00:00 UTC.\n"
operationId: get_v3_toplinkclicked
parameters:
- name: ActualClicks
in: query
schema:
$ref: '#/components/schemas/get_v3_toplinkclicked_QueryParams/properties/ActualClicks'
- name: CampaignID
in: query
schema:
$ref: '#/components/schemas/get_v3_toplinkclicked_QueryParams/properties/CampaignID'
- name: Contact
in: query
schema:
$ref: '#/components/schemas/get_v3_toplinkclicked_QueryParams/properties/Contact'
- name: ContactsList
in: query
schema:
$ref: '#/components/schemas/get_v3_toplinkclicked_QueryParams/properties/ContactsList'
- name: CustomCampaign
in: query
schema:
$ref: '#/components/schemas/get_v3_toplinkclicked_QueryParams/properties/CustomCampaign'
- name: From
in: query
schema:
$ref: '#/components/schemas/get_v3_toplinkclicked_QueryParams/properties/From'
- name: FromDomain
in: query
schema:
$ref: '#/components/schemas/get_v3_toplinkclicked_QueryParams/properties/FromDomain'
- name: FromID
in: query
schema:
$ref: '#/components/schemas/get_v3_toplinkclicked_QueryParams/properties/FromID'
- name: FromTS
in: query
schema:
$ref: '#/components/schemas/get_v3_toplinkclicked_QueryParams/properties/FromTS'
- name: FromType
in: query
schema:
$ref: '#/components/schemas/get_v3_toplinkclicked_QueryParams/properties/FromType'
- name: IsDeleted
in: query
schema:
$ref: '#/components/schemas/get_v3_toplinkclicked_QueryParams/properties/IsDeleted'
- name: IsNewsletterTool
in: query
schema:
$ref: '#/components/schemas/get_v3_toplinkclicked_QueryParams/properties/IsNewsletterTool'
- name: IsStarred
in: query
schema:
$ref: '#/components/schemas/get_v3_toplinkclicked_QueryParams/properties/IsStarred'
- name: Message
in: query
schema:
$ref: '#/components/schemas/get_v3_toplinkclicked_QueryParams/properties/Message'
- name: Period
in: query
schema:
$ref: '#/components/schemas/get_v3_toplinkclicked_QueryParams/properties/Period'
- name: ToTS
in: query
schema:
$ref: '#/components/schemas/get_v3_toplinkclicked_QueryParams/properties/ToTS'
responses:
'200':
description: Default OK response for /toplinkclicked
content:
application/json:
schema:
type: object
properties:
Count:
description: Indicates the number of objects in the `Data` array.
type: integer
format: int64
examples:
- 1
Data:
description: A JSON array containing a list of objects returned by this endpoint.
type: array
items:
$ref: '#/components/schemas/OutputToplinkclicked'
Total:
description: Indicates the number of objects in the `Data` array.
type: integer
format: int64
examples:
- 1
'400':
$ref: '#/components/responses/400'
'401':
$ref: '#/components/responses/401'
'403':
$ref: '#/components/responses/403'
'404':
$ref: '#/components/responses/404'
'429':
$ref: '#/components/responses/429'
'500':
$ref: '#/components/responses/500'
security:
- basicAuth: []
x-codeSamples:
- lang: curl
label: cURL
source: "curl -s \\\n\t-X GET \\\n\t--user \"$MJ_APIKEY_PUBLIC:$MJ_APIKEY_PRIVATE\" \\\n\thttps://api.mailjet.com/v3/REST/toplinkclicked \\"
- lang: PHP
label: PHP
source: " 'v3']);\n$response = $mj->get(Resources::$Toplinkclicked);\n$response->success() && var_dump($response->getData());\n?>"
- lang: Node.js
label: Node
source: "const mailjet = require ('node-mailjet')\n\t.connect(process.env.MJ_APIKEY_PUBLIC, process.env.MJ_APIKEY_PRIVATE)\nconst request = mailjet\n\t.get(\"toplinkclicked\", {'version': 'v3'})\n\t.request()\nrequest\n\t.then((result) => {\n\t\tconsole.log(result.body)\n\t})\n\t.catch((err) => {\n\t\tconsole.log(err.statusCode)\n\t})"
- lang: Ruby
label: Ruby
source: "require 'mailjet'\nMailjet.configure do |config|\n config.api_key = ENV['MJ_APIKEY_PUBLIC']\n config.secret_key = ENV['MJ_APIKEY_PRIVATE']\n config.api_version = \"v3\"\nend\nvariable = Mailjet::Toplinkclicked.all(\n)\np variable.attributes['Data']"
- lang: Python
label: Python
source: "from mailjet_rest import Client\nimport os\napi_key = os.environ['MJ_APIKEY_PUBLIC']\napi_secret = os.environ['MJ_APIKEY_PRIVATE']\nmailjet = Client(auth=(api_key, api_secret), version='v3')\nresult = mailjet.toplinkclicked.get()\nprint result.status_code\nprint result.json()"
- lang: Java
label: Java
source: "package com.my.project;\nimport com.mailjet.client.errors.MailjetException;\nimport com.mailjet.client.errors.MailjetSocketTimeoutException;\nimport com.mailjet.client.MailjetClient;\nimport com.mailjet.client.MailjetRequest;\nimport com.mailjet.client.MailjetResponse;\nimport com.mailjet.client.ClientOptions;\nimport com.mailjet.client.resource.Toplinkclicked;\nimport org.json.JSONArray;\nimport org.json.JSONObject;\npublic class MyClass {\n public static void main(String[] args) throws MailjetException, MailjetSocketTimeoutException {\n MailjetClient client;\n MailjetRequest request;\n MailjetResponse response;\n client = new MailjetClient(System.getenv(\"MJ_APIKEY_PUBLIC\"), System.getenv(\"MJ_APIKEY_PRIVATE\"), new ClientOptions(\"v3\"));\n request = new MailjetRequest(Toplinkclicked.resource);\n response = client.get(request);\n System.out.println(response.getStatus());\n System.out.println(response.getData());\n }\n}"
- lang: Go
label: Go
source: "package main\nimport (\n\t\"fmt\"\n\t\"log\"\n\t\"os\"\n\tmailjet \"github.com/mailjet/mailjet-apiv3-go\"\n\t\"github.com/mailjet/mailjet-apiv3-go/resources\"\n)\nfunc main () {\n\tmailjetClient := NewMailjetClient(os.Getenv(\"MJ_APIKEY_PUBLIC\"), os.Getenv(\"MJ_APIKEY_PRIVATE\"))\n\tvar data []resources.Toplinkclicked\n\t_, _, err := mailjetClient.List(\"toplinkclicked\", &data)\n\tif err != nil {\n\t fmt.Println(err)\n\t}\n\tfmt.Printf(\"Data array: %+v\\n\", data)\n}"
- lang: C#
label: C#
source: "using Mailjet.Client;\nusing Mailjet.Client.Resources;\nusing System;\nusing Newtonsoft.Json.Linq;\nnamespace Mailjet.ConsoleApplication\n{\n class Program\n {\n static void Main(string[] args)\n {\n RunAsync().Wait();\n }\n static async Task RunAsync()\n {\n MailjetClient client = new MailjetClient(Environment.GetEnvironmentVariable(\"MJ_APIKEY_PUBLIC\"), Environment.GetEnvironmentVariable(\"MJ_APIKEY_PRIVATE\"))\n {\n Version = ApiVersion.V3,\n };\n MailjetRequest request = new MailjetRequest\n {\n Resource = Toplinkclicked.Resource,\n }\n MailjetResponse response = await client.GetAsync(request);\n if (response.IsSuccessStatusCode)\n {\n Console.WriteLine(string.Format(\"Total: {0}, Count: {1}\\n\", response.GetTotal(), response.GetCount()));\n Console.WriteLine(response.GetData());\n }\n else\n {\n Console.WriteLine(string.Format(\"StatusCode: {0}\\n\", response.StatusCode));\n Console.WriteLine(string.Format(\"ErrorInfo: {0}\\n\", response.GetErrorInfo()));\n Console.WriteLine(response.GetData());\n Console.WriteLine(string.Format(\"ErrorMessage: {0}\\n\", response.GetErrorMessage()));\n }\n }\n }\n}"
"/v3/REST/useragentstatistics":
get:
x-seo:
title: "User Agent Statistics"
description: "Retrieve a list of open or click statistics, grouped by web browser or email client. Note: If no query parameters are used, will return stats with FromTS\u2026"
tags:
- Statistics
summary: User Agent Statistics
description: "Retrieve a list of open or click statistics, grouped by web browser or email client.\n\n> Note: If no query parameters are used, will return stats with `FromTS` equal to the current day at 00:00 UTC.\n"
operationId: get_v3_useragentstatistics
parameters:
- name: CampaignID
in: query
schema:
$ref: '#/components/schemas/get_v3_useragentstatistics_QueryParams/properties/CampaignID'
- name: ContactsList
in: query
schema:
$ref: '#/components/schemas/get_v3_useragentstatistics_QueryParams/properties/ContactsList'
- name: CustomCampaign
in: query
schema:
$ref: '#/components/schemas/get_v3_useragentstatistics_QueryParams/properties/CustomCampaign'
- name: Event
in: query
schema:
$ref: '#/components/schemas/get_v3_useragentstatistics_QueryParams/properties/Event'
- name: ExcludePlatform
in: query
schema:
$ref: '#/components/schemas/get_v3_useragentstatistics_QueryParams/properties/ExcludePlatform'
- name: From
in: query
schema:
$ref: '#/components/schemas/get_v3_useragentstatistics_QueryParams/properties/From'
- name: FromDomain
in: query
schema:
$ref: '#/components/schemas/get_v3_useragentstatistics_QueryParams/properties/FromDomain'
- name: FromID
in: query
schema:
$ref: '#/components/schemas/get_v3_useragentstatistics_QueryParams/properties/FromID'
- name: FromTS
in: query
schema:
$ref: '#/components/schemas/get_v3_useragentstatistics_QueryParams/properties/FromTS'
- name: FromType
in: query
schema:
$ref: '#/components/schemas/get_v3_useragentstatistics_QueryParams/properties/FromType'
- name: IsDeleted
in: query
schema:
$ref: '#/components/schemas/get_v3_useragentstatistics_QueryParams/properties/IsDeleted'
- name: IsNewsletterTool
in: query
schema:
$ref: '#/components/schemas/get_v3_useragentstatistics_QueryParams/properties/IsNewsletterTool'
- name: IsStarred
in: query
schema:
$ref: '#/components/schemas/get_v3_useragentstatistics_QueryParams/properties/IsStarred'
- name: Period
in: query
schema:
$ref: '#/components/schemas/get_v3_useragentstatistics_QueryParams/properties/Period'
- name: Platform
in: query
schema:
$ref: '#/components/schemas/get_v3_useragentstatistics_QueryParams/properties/Platform'
- name: ToTS
in: query
schema:
$ref: '#/components/schemas/get_v3_useragentstatistics_QueryParams/properties/ToTS'
responses:
'200':
description: Default OK response for `/useragentstatistics`
content:
application/json:
schema:
type: object
properties:
Count:
description: Indicates the number of objects in the `Data` array.
type: integer
format: int64
examples:
- 1
Data:
description: A JSON array containing a list of objects returned by this endpoint.
type: array
items:
$ref: '#/components/schemas/OutputUseragentstatistics'
Total:
description: Indicates the number of objects in the `Data` array.
type: integer
format: int64
examples:
- 1
'400':
$ref: '#/components/responses/400'
'401':
$ref: '#/components/responses/401'
'403':
$ref: '#/components/responses/403'
'404':
$ref: '#/components/responses/404'
'429':
$ref: '#/components/responses/429'
'500':
$ref: '#/components/responses/500'
security:
- basicAuth: []
x-codeSamples:
- lang: curl
label: cURL
source: "curl -s \\\n\t-X GET \\\n\t--user \"$MJ_APIKEY_PUBLIC:$MJ_APIKEY_PRIVATE\" \\\n\thttps://api.mailjet.com/v3/REST/useragentstatistics \\"
- lang: PHP
label: PHP
source: " 'v3']);\n$response = $mj->get(Resources::$Useragentstatistics);\n$response->success() && var_dump($response->getData());\n?>"
- lang: Node.js
label: Node
source: "const mailjet = require ('node-mailjet')\n\t.connect(process.env.MJ_APIKEY_PUBLIC, process.env.MJ_APIKEY_PRIVATE)\nconst request = mailjet\n\t.get(\"useragentstatistics\", {'version': 'v3'})\n\t.request()\nrequest\n\t.then((result) => {\n\t\tconsole.log(result.body)\n\t})\n\t.catch((err) => {\n\t\tconsole.log(err.statusCode)\n\t})"
- lang: Ruby
label: Ruby
source: "require 'mailjet'\nMailjet.configure do |config|\n config.api_key = ENV['MJ_APIKEY_PUBLIC']\n config.secret_key = ENV['MJ_APIKEY_PRIVATE']\n config.api_version = \"v3\"\nend\nvariable = Mailjet::Useragentstatistics.all(\n)\np variable.attributes['Data']"
- lang: Python
label: Python
source: "from mailjet_rest import Client\nimport os\napi_key = os.environ['MJ_APIKEY_PUBLIC']\napi_secret = os.environ['MJ_APIKEY_PRIVATE']\nmailjet = Client(auth=(api_key, api_secret), version='v3')\nresult = mailjet.useragentstatistics.get()\nprint result.status_code\nprint result.json()"
- lang: Java
label: Java
source: "package com.my.project;\nimport com.mailjet.client.errors.MailjetException;\nimport com.mailjet.client.errors.MailjetSocketTimeoutException;\nimport com.mailjet.client.MailjetClient;\nimport com.mailjet.client.MailjetRequest;\nimport com.mailjet.client.MailjetResponse;\nimport com.mailjet.client.ClientOptions;\nimport com.mailjet.client.resource.Useragentstatistics;\nimport org.json.JSONArray;\nimport org.json.JSONObject;\npublic class MyClass {\n public static void main(String[] args) throws MailjetException, MailjetSocketTimeoutException {\n MailjetClient client;\n MailjetRequest request;\n MailjetResponse response;\n client = new MailjetClient(System.getenv(\"MJ_APIKEY_PUBLIC\"), System.getenv(\"MJ_APIKEY_PRIVATE\"), new ClientOptions(\"v3\"));\n request = new MailjetRequest(Useragentstatistics.resource);\n response = client.get(request);\n System.out.println(response.getStatus());\n System.out.println(response.getData());\n }\n}"
- lang: Go
label: Go
source: "package main\nimport (\n\t\"fmt\"\n\t\"log\"\n\t\"os\"\n\tmailjet \"github.com/mailjet/mailjet-apiv3-go\"\n\t\"github.com/mailjet/mailjet-apiv3-go/resources\"\n)\nfunc main () {\n\tmailjetClient := NewMailjetClient(os.Getenv(\"MJ_APIKEY_PUBLIC\"), os.Getenv(\"MJ_APIKEY_PRIVATE\"))\n\tvar data []resources.Useragentstatistics\n\t_, _, err := mailjetClient.List(\"useragentstatistics\", &data)\n\tif err != nil {\n\t fmt.Println(err)\n\t}\n\tfmt.Printf(\"Data array: %+v\\n\", data)\n}"
- lang: C#
label: C#
source: "using Mailjet.Client;\nusing Mailjet.Client.Resources;\nusing System;\nusing Newtonsoft.Json.Linq;\nnamespace Mailjet.ConsoleApplication\n{\n class Program\n {\n static void Main(string[] args)\n {\n RunAsync().Wait();\n }\n static async Task RunAsync()\n {\n MailjetClient client = new MailjetClient(Environment.GetEnvironmentVariable(\"MJ_APIKEY_PUBLIC\"), Environment.GetEnvironmentVariable(\"MJ_APIKEY_PRIVATE\"))\n {\n Version = ApiVersion.V3,\n };\n MailjetRequest request = new MailjetRequest\n {\n Resource = Useragentstatistics.Resource,\n }\n MailjetResponse response = await client.GetAsync(request);\n if (response.IsSuccessStatusCode)\n {\n Console.WriteLine(string.Format(\"Total: {0}, Count: {1}\\n\", response.GetTotal(), response.GetCount()));\n Console.WriteLine(response.GetData());\n }\n else\n {\n Console.WriteLine(string.Format(\"StatusCode: {0}\\n\", response.StatusCode));\n Console.WriteLine(string.Format(\"ErrorInfo: {0}\\n\", response.GetErrorInfo()));\n Console.WriteLine(response.GetData());\n Console.WriteLine(string.Format(\"ErrorMessage: {0}\\n\", response.GetErrorMessage()));\n }\n }\n }\n}"
"/v3/REST/statistics/recipient-esp":
get:
x-seo:
title: "Recipient ESP Statistics"
description: "Recipient ESP Statistics in the Mailjet Email API. Get aggregated delivery and engagement statistics, grouped by recipient Email Service Provider (ESP)."
tags:
- Statistics
summary: Recipient ESP Statistics
description: "Get aggregated delivery and engagement statistics, grouped by recipient Email Service Provider (ESP).\n"
operationId: get_v3_statistics_recipient_esp
parameters:
- name: CampaignID
in: query
schema:
$ref: '#/components/schemas/get_v3_statistics_recipient_esp_QueryParams/properties/CampaignID'
required: true
example: 6000
- name: ESP_Name
in: query
schema:
$ref: '#/components/schemas/get_v3_statistics_recipient_esp_QueryParams/properties/ESP_Name'
responses:
'200':
description: Default OK response for `/statistics/recipient-esp`
content:
application/json:
schema:
type: object
properties:
Count:
description: Indicates the number of objects in the `Data` array.
type: integer
format: int64
examples:
- 1
Data:
description: A JSON array containing a list of objects returned by this endpoint.
type: array
items:
$ref: '#/components/schemas/OutputRecipientEsp'
Total:
description: Indicates the number of objects in the `Data` array.
type: integer
format: int64
examples:
- 1
'400':
$ref: '#/components/responses/400'
'401':
$ref: '#/components/responses/401'
'403':
$ref: '#/components/responses/403'
'404':
$ref: '#/components/responses/404'
'429':
$ref: '#/components/responses/429'
'500':
$ref: '#/components/responses/500'
security:
- basicAuth: []
x-codeSamples:
- lang: curl
label: cURL
source: "curl -s \\\n\t-X GET \\\n\t--user \"$MJ_APIKEY_PUBLIC:$MJ_APIKEY_PRIVATE\" \\\n\thttps://api.mailjet.com/v3/REST/statistics/ \\"
- lang: PHP
label: PHP
source: " 'v3']);\n$response = $mj->get(Resources::$Statistics);\n$response->success() && var_dump($response->getData());\n?>"
- lang: Node.js
label: Node
source: "const mailjet = require ('node-mailjet')\n\t.connect(process.env.MJ_APIKEY_PUBLIC, process.env.MJ_APIKEY_PRIVATE)\nconst request = mailjet\n\t.get(\"statistics\", {'version': 'v3'})\n\t.id()\n\t.request()\nrequest\n\t.then((result) => {\n\t\tconsole.log(result.body)\n\t})\n\t.catch((err) => {\n\t\tconsole.log(err.statusCode)\n\t})"
- lang: Ruby
label: Ruby
source: "require 'mailjet'\nMailjet.configure do |config|\n config.api_key = ENV['MJ_APIKEY_PUBLIC']\n config.secret_key = ENV['MJ_APIKEY_PRIVATE']\n config.api_version = \"v3\"\nend\nvariable = Mailjet::Statistics.all(id: ,\n)\np variable.attributes['Data']"
- lang: Python
label: Python
source: "from mailjet_rest import Client\nimport os\napi_key = os.environ['MJ_APIKEY_PUBLIC']\napi_secret = os.environ['MJ_APIKEY_PRIVATE']\nmailjet = Client(auth=(api_key, api_secret), version='v3')\nid = ''\nresult = mailjet.statistics.get(id=id)\nprint result.status_code\nprint result.json()"
- lang: Java
label: Java
source: "package com.my.project;\nimport com.mailjet.client.errors.MailjetException;\nimport com.mailjet.client.errors.MailjetSocketTimeoutException;\nimport com.mailjet.client.MailjetClient;\nimport com.mailjet.client.MailjetRequest;\nimport com.mailjet.client.MailjetResponse;\nimport com.mailjet.client.ClientOptions;\nimport com.mailjet.client.resource.Statistics;\nimport org.json.JSONArray;\nimport org.json.JSONObject;\npublic class MyClass {\n public static void main(String[] args) throws MailjetException, MailjetSocketTimeoutException {\n MailjetClient client;\n MailjetRequest request;\n MailjetResponse response;\n client = new MailjetClient(System.getenv(\"MJ_APIKEY_PUBLIC\"), System.getenv(\"MJ_APIKEY_PRIVATE\"), new ClientOptions(\"v3\"));\n request = new MailjetRequest(Statistics.resource, ID);\n response = client.get(request);\n System.out.println(response.getStatus());\n System.out.println(response.getData());\n }\n}"
- lang: Go
label: Go
source: "package main\nimport (\n\t\"fmt\"\n\t\"log\"\n\t\"os\"\n\tmailjet \"github.com/mailjet/mailjet-apiv3-go\"\n\t\"github.com/mailjet/mailjet-apiv3-go/resources\"\n)\nfunc main () {\n\tmailjetClient := NewMailjetClient(os.Getenv(\"MJ_APIKEY_PUBLIC\"), os.Getenv(\"MJ_APIKEY_PRIVATE\"))\n\tvar data []resources.Statistics\n\tmr := &Request{\n\t Resource: \"statistics\",\n\t ID: RESOURCE_ID,\n\t}\n\terr := mailjetClient.Get(mr, &data)\n\tif err != nil {\n\t fmt.Println(err)\n\t}\n\tfmt.Printf(\"Data array: %+v\\n\", data)\n}"
- lang: C#
label: C#
source: "using Mailjet.Client;\nusing Mailjet.Client.Resources;\nusing System;\nusing Newtonsoft.Json.Linq;\nnamespace Mailjet.ConsoleApplication\n{\n class Program\n {\n static void Main(string[] args)\n {\n RunAsync().Wait();\n }\n static async Task RunAsync()\n {\n MailjetClient client = new MailjetClient(Environment.GetEnvironmentVariable(\"MJ_APIKEY_PUBLIC\"), Environment.GetEnvironmentVariable(\"MJ_APIKEY_PRIVATE\"))\n {\n Version = ApiVersion.V3,\n };\n MailjetRequest request = new MailjetRequest\n {\n Resource = Statistics.Resource,\n ResourceId = ResourceId.Numeric(ID)\n }\n MailjetResponse response = await client.GetAsync(request);\n if (response.IsSuccessStatusCode)\n {\n Console.WriteLine(string.Format(\"Total: {0}, Count: {1}\\n\", response.GetTotal(), response.GetCount()));\n Console.WriteLine(response.GetData());\n }\n else\n {\n Console.WriteLine(string.Format(\"StatusCode: {0}\\n\", response.StatusCode));\n Console.WriteLine(string.Format(\"ErrorInfo: {0}\\n\", response.GetErrorInfo()));\n Console.WriteLine(response.GetData());\n Console.WriteLine(string.Format(\"ErrorMessage: {0}\\n\", response.GetErrorMessage()));\n }\n }\n }\n}"
"/v3/REST/contact":
get:
x-seo:
title: "List Contacts"
description: "Retrieve a list of all contacts. Includes information about contact status and creation / activity timestamps."
tags:
- Contacts
summary: List Contacts
description: Retrieve a list of all contacts. Includes information about contact status and creation / activity timestamps.
operationId: get_v3_contact
parameters:
- name: Campaign
in: query
schema:
$ref: '#/components/schemas/get_v3_contact_QueryParams/properties/Campaign'
- name: ContactsList
in: query
schema:
$ref: '#/components/schemas/get_v3_contact_QueryParams/properties/ContactsList'
- name: IsExcludedFromCampaigns
in: query
schema:
$ref: '#/components/schemas/get_v3_contact_QueryParams/properties/IsExcludedFromCampaigns'
- name: LastActivityAt
in: query
schema:
$ref: '#/components/schemas/get_v3_contact_QueryParams/properties/LastActivityAt'
responses:
'200':
description: Default OK response for `/contact`
content:
application/json:
schema:
type: object
properties:
Count:
description: Indicates the number of objects in the `Data` array.
type: integer
format: int64
examples:
- 1
Data:
description: A JSON array containing a list of objects returned by this endpoint.
type: array
items:
$ref: '#/components/schemas/OutputContact'
Total:
description: Indicates the number of objects in the `Data` array.
type: integer
format: int64
examples:
- 1
'400':
$ref: '#/components/responses/400'
'401':
$ref: '#/components/responses/401'
'403':
$ref: '#/components/responses/403'
'404':
$ref: '#/components/responses/404'
'429':
$ref: '#/components/responses/429'
'500':
$ref: '#/components/responses/500'
security:
- basicAuth: []
x-codeSamples:
- lang: curl
label: cURL
source: "curl -s \\\n\t-X GET \\\n\t--user \"$MJ_APIKEY_PUBLIC:$MJ_APIKEY_PRIVATE\" \\\n\thttps://api.mailjet.com/v3/REST/contact \\"
- lang: PHP
label: PHP
source: " 'v3']);\n$response = $mj->get(Resources::$Contact);\n$response->success() && var_dump($response->getData());\n?>"
- lang: Node.js
label: Node
source: "const mailjet = require ('node-mailjet')\n\t.connect(process.env.MJ_APIKEY_PUBLIC, process.env.MJ_APIKEY_PRIVATE)\nconst request = mailjet\n\t.get(\"contact\", {'version': 'v3'})\n\t.request()\nrequest\n\t.then((result) => {\n\t\tconsole.log(result.body)\n\t})\n\t.catch((err) => {\n\t\tconsole.log(err.statusCode)\n\t})"
- lang: Ruby
label: Ruby
source: "require 'mailjet'\nMailjet.configure do |config|\n config.api_key = ENV['MJ_APIKEY_PUBLIC']\n config.secret_key = ENV['MJ_APIKEY_PRIVATE']\n config.api_version = \"v3\"\nend\nvariable = Mailjet::Contact.all(\n)\np variable.attributes['Data']"
- lang: Python
label: Python
source: "from mailjet_rest import Client\nimport os\napi_key = os.environ['MJ_APIKEY_PUBLIC']\napi_secret = os.environ['MJ_APIKEY_PRIVATE']\nmailjet = Client(auth=(api_key, api_secret), version='v3')\nresult = mailjet.contact.get()\nprint result.status_code\nprint result.json()"
- lang: Java
label: Java
source: "package com.my.project;\nimport com.mailjet.client.errors.MailjetException;\nimport com.mailjet.client.errors.MailjetSocketTimeoutException;\nimport com.mailjet.client.MailjetClient;\nimport com.mailjet.client.MailjetRequest;\nimport com.mailjet.client.MailjetResponse;\nimport com.mailjet.client.ClientOptions;\nimport com.mailjet.client.resource.Contact;\nimport org.json.JSONArray;\nimport org.json.JSONObject;\npublic class MyClass {\n public static void main(String[] args) throws MailjetException, MailjetSocketTimeoutException {\n MailjetClient client;\n MailjetRequest request;\n MailjetResponse response;\n client = new MailjetClient(System.getenv(\"MJ_APIKEY_PUBLIC\"), System.getenv(\"MJ_APIKEY_PRIVATE\"), new ClientOptions(\"v3\"));\n request = new MailjetRequest(Contact.resource);\n response = client.get(request);\n System.out.println(response.getStatus());\n System.out.println(response.getData());\n }\n}"
- lang: Go
label: Go
source: "package main\nimport (\n\t\"fmt\"\n\t\"log\"\n\t\"os\"\n\tmailjet \"github.com/mailjet/mailjet-apiv3-go\"\n\t\"github.com/mailjet/mailjet-apiv3-go/resources\"\n)\nfunc main () {\n\tmailjetClient := NewMailjetClient(os.Getenv(\"MJ_APIKEY_PUBLIC\"), os.Getenv(\"MJ_APIKEY_PRIVATE\"))\n\tvar data []resources.Contact\n\t_, _, err := mailjetClient.List(\"contact\", &data)\n\tif err != nil {\n\t fmt.Println(err)\n\t}\n\tfmt.Printf(\"Data array: %+v\\n\", data)\n}"
- lang: C#
label: C#
source: "using Mailjet.Client;\nusing Mailjet.Client.Resources;\nusing System;\nusing Newtonsoft.Json.Linq;\nnamespace Mailjet.ConsoleApplication\n{\n class Program\n {\n static void Main(string[] args)\n {\n RunAsync().Wait();\n }\n static async Task RunAsync()\n {\n MailjetClient client = new MailjetClient(Environment.GetEnvironmentVariable(\"MJ_APIKEY_PUBLIC\"), Environment.GetEnvironmentVariable(\"MJ_APIKEY_PRIVATE\"))\n {\n Version = ApiVersion.V3,\n };\n MailjetRequest request = new MailjetRequest\n {\n Resource = Contact.Resource,\n }\n MailjetResponse response = await client.GetAsync(request);\n if (response.IsSuccessStatusCode)\n {\n Console.WriteLine(string.Format(\"Total: {0}, Count: {1}\\n\", response.GetTotal(), response.GetCount()));\n Console.WriteLine(response.GetData());\n }\n else\n {\n Console.WriteLine(string.Format(\"StatusCode: {0}\\n\", response.StatusCode));\n Console.WriteLine(string.Format(\"ErrorInfo: {0}\\n\", response.GetErrorInfo()));\n Console.WriteLine(response.GetData());\n Console.WriteLine(string.Format(\"ErrorMessage: {0}\\n\", response.GetErrorMessage()));\n }\n }\n }\n}"
post:
x-seo:
title: "Create Contact"
description: "Create Contact in the Mailjet Email API. Add a new unique contact to your global contact list and select its exclusion status."
tags:
- Contacts
summary: Create Contact
description: Add a new unique contact to your global contact list and select its exclusion status.
operationId: post_v3_contact
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/NewContact'
example:
Email: contact@example.com
Name: Example Contact
IsExcludedFromCampaigns: false
responses:
'201':
description: Default OK response for `/contact`
content:
application/json:
schema:
type: object
properties:
Count:
description: Indicates the number of objects in the `Data` array.
type: integer
format: int64
examples:
- 1
Data:
description: A JSON array containing a list of objects returned by this endpoint.
type: array
items:
$ref: '#/components/schemas/OutputContact'
Total:
description: Indicates the number of objects in the `Data` array.
type: integer
format: int64
examples:
- 1
'400':
$ref: '#/components/responses/400'
'401':
$ref: '#/components/responses/401'
'403':
$ref: '#/components/responses/403'
'404':
$ref: '#/components/responses/404'
'429':
$ref: '#/components/responses/429'
'500':
$ref: '#/components/responses/500'
security:
- basicAuth: []
x-codeSamples:
- lang: curl
label: cURL
source: "curl -s \\\n\t-X POST \\\n\t--user \"$MJ_APIKEY_PUBLIC:$MJ_APIKEY_PRIVATE\" \\\n\thttps://api.mailjet.com/v3/REST/contact \\\n\t-H 'Content-Type: application/json' \\\n\t-d '{\n \"IsExcludedFromCampaigns\":false,\n \"Name\":\"New Contact\",\n \"Email\":\"passenger@mailjet.com\"\n\t}'"
- lang: PHP
label: PHP
source: " 'v3']);\n$body = [\n 'IsExcludedFromCampaigns' => false,\n 'Name' => \"New Contact\",\n 'Email' => \"passenger@mailjet.com\"\n];\n$response = $mj->post(Resources::$Contact, ['body' => $body]);\n$response->success() && var_dump($response->getData());\n?>"
- lang: Node.js
label: Node
source: "const mailjet = require ('node-mailjet')\n\t.connect(process.env.MJ_APIKEY_PUBLIC, process.env.MJ_APIKEY_PRIVATE)\nconst request = mailjet\n\t.post(\"contact\", {'version': 'v3'})\n\t.request({\n \"IsExcludedFromCampaigns\":false,\n \"Name\":\"New Contact\",\n \"Email\":\"passenger@mailjet.com\"\n })\nrequest\n\t.then((result) => {\n\t\tconsole.log(result.body)\n\t})\n\t.catch((err) => {\n\t\tconsole.log(err.statusCode)\n\t})"
- lang: Ruby
label: Ruby
source: "require 'mailjet'\nMailjet.configure do |config|\n config.api_key = ENV['MJ_APIKEY_PUBLIC']\n config.secret_key = ENV['MJ_APIKEY_PRIVATE']\n config.api_version = \"v3\"\nend\nvariable = Mailjet::Contact.create(\n is_excluded_from_campaigns: false,\n name: \"New Contact\",\n email: \"passenger@mailjet.com\"\n)\np variable.attributes['Data']"
- lang: Python
label: Python
source: "from mailjet_rest import Client\nimport os\napi_key = os.environ['MJ_APIKEY_PUBLIC']\napi_secret = os.environ['MJ_APIKEY_PRIVATE']\nmailjet = Client(auth=(api_key, api_secret), version='v3')\ndata = {\n 'IsExcludedFromCampaigns': False,\n 'Name': \"New Contact\",\n 'Email': \"passenger@mailjet.com\"\n}\nresult = mailjet.contact.create(data=data)\nprint result.status_code\nprint result.json()"
- lang: Java
label: Java
source: "package com.my.project;\nimport com.mailjet.client.errors.MailjetException;\nimport com.mailjet.client.errors.MailjetSocketTimeoutException;\nimport com.mailjet.client.MailjetClient;\nimport com.mailjet.client.MailjetRequest;\nimport com.mailjet.client.MailjetResponse;\nimport com.mailjet.client.ClientOptions;\nimport com.mailjet.client.resource.Contact;\nimport org.json.JSONArray;\nimport org.json.JSONObject;\npublic class MyClass {\n public static void main(String[] args) throws MailjetException, MailjetSocketTimeoutException {\n MailjetClient client;\n MailjetRequest request;\n MailjetResponse response;\n client = new MailjetClient(System.getenv(\"MJ_APIKEY_PUBLIC\"), System.getenv(\"MJ_APIKEY_PRIVATE\"), new ClientOptions(\"v3\"));\n request = new MailjetRequest(Contact.resource)\n .property(Contact.ISEXCLUDEDFROMCAMPAIGNS, false)\n .property(Contact.NAME, \"New Contact\")\n .property(Contact.EMAIL, \"passenger@mailjet.com\")\n );\n response = client.post(request);\n System.out.println(response.getStatus());\n System.out.println(response.getData());\n }\n}"
- lang: Go
label: Go
source: "package main\nimport (\n\t\"fmt\"\n\t\"log\"\n\t\"os\"\n\tmailjet \"github.com/mailjet/mailjet-apiv3-go\"\n\t\"github.com/mailjet/mailjet-apiv3-go/resources\"\n)\nfunc main () {\n\tmailjetClient := NewMailjetClient(os.Getenv(\"MJ_APIKEY_PUBLIC\"), os.Getenv(\"MJ_APIKEY_PRIVATE\"))\n\tvar data []resources.Contact\n\tmr := &Request{\n\t Resource: \"contact\",\n\t}\n\tfmr := &FullRequest{\n\t Info: mr,\n\t Payload: &resources.Contact { \n\t IsExcludedFromCampaigns:false,\n\t Name:\"New Contact\",\n\t Email:\"passenger@mailjet.com\"\n }\n\t}\n\terr := mailjetClient.Post(fmr, &data)\n\tif err != nil {\n\t fmt.Println(err)\n\t}\n\tfmt.Printf(\"Data array: %+v\\n\", data)\n}"
- lang: C#
label: C#
source: "using Mailjet.Client;\nusing Mailjet.Client.Resources;\nusing System;\nusing Newtonsoft.Json.Linq;\nnamespace Mailjet.ConsoleApplication\n{\n class Program\n {\n static void Main(string[] args)\n {\n RunAsync().Wait();\n }\n static async Task RunAsync()\n {\n MailjetClient client = new MailjetClient(Environment.GetEnvironmentVariable(\"MJ_APIKEY_PUBLIC\"), Environment.GetEnvironmentVariable(\"MJ_APIKEY_PRIVATE\"))\n {\n Version = ApiVersion.V3,\n };\n MailjetRequest request = new MailjetRequest\n {\n Resource = Contact.Resource,\n }\n .Property(Contact.IsExcludedFromCampaigns, false)\n .Property(Contact.Name, \"New Contact\")\n .Property(Contact.Email, \"passenger@mailjet.com\");\n MailjetResponse response = await client.PostAsync(request);\n if (response.IsSuccessStatusCode)\n {\n Console.WriteLine(string.Format(\"Total: {0}, Count: {1}\\n\", response.GetTotal(), response.GetCount()));\n Console.WriteLine(response.GetData());\n }\n else\n {\n Console.WriteLine(string.Format(\"StatusCode: {0}\\n\", response.StatusCode));\n Console.WriteLine(string.Format(\"ErrorInfo: {0}\\n\", response.GetErrorInfo()));\n Console.WriteLine(response.GetData());\n Console.WriteLine(string.Format(\"ErrorMessage: {0}\\n\", response.GetErrorMessage()));\n }\n }\n }\n}"
"/v3/REST/contact/{contact_ID}":
get:
x-seo:
title: "Contact by ID"
description: "Contact by ID in the Mailjet Email API. Retrieve a specific contact. Includes information about contact status and creation / activity timestamps."
tags:
- Contacts
summary: Contact by ID
description: Retrieve a specific contact. Includes information about contact status and creation / activity timestamps. To obtain a valid `contact_ID`, first call `GET /v3/REST/contact` to list your contacts.
operationId: get_v3_contact_id
parameters:
- name: contact_ID
in: path
schema:
$ref: '#/components/schemas/get_v3_contact_id_PathParams/properties/contact_ID'
required: true
example: 1000
responses:
'200':
description: Default OK response for `/contact`
content:
application/json:
schema:
type: object
properties:
Count:
description: Indicates the number of objects in the `Data` array.
type: integer
format: int64
examples:
- 1
Data:
description: A JSON array containing a list of objects returned by this endpoint.
type: array
items:
$ref: '#/components/schemas/OutputContact'
Total:
description: Indicates the number of objects in the `Data` array.
type: integer
format: int64
examples:
- 1
'400':
$ref: '#/components/responses/400'
'401':
$ref: '#/components/responses/401'
'403':
$ref: '#/components/responses/403'
'404':
$ref: '#/components/responses/404'
'429':
$ref: '#/components/responses/429'
'500':
$ref: '#/components/responses/500'
security:
- basicAuth: []
x-codeSamples:
- lang: curl
label: cURL
source: "curl -s \\\n\t-X GET \\\n\t--user \"$MJ_APIKEY_PUBLIC:$MJ_APIKEY_PRIVATE\" \\\n\thttps://api.mailjet.com/v3/REST/contact/$contact_ID \\"
- lang: PHP
label: PHP
source: " 'v3']);\n$response = $mj->get(Resources::$Contact, ['id' => $id]);\n$response->success() && var_dump($response->getData());\n?>"
- lang: Node.js
label: Node
source: "const mailjet = require ('node-mailjet')\n\t.connect(process.env.MJ_APIKEY_PUBLIC, process.env.MJ_APIKEY_PRIVATE)\nconst request = mailjet\n\t.get(\"contact\", {'version': 'v3'})\n\t.id($contact_ID)\n\t.request()\nrequest\n\t.then((result) => {\n\t\tconsole.log(result.body)\n\t})\n\t.catch((err) => {\n\t\tconsole.log(err.statusCode)\n\t})"
- lang: Ruby
label: Ruby
source: "require 'mailjet'\nMailjet.configure do |config|\n config.api_key = ENV['MJ_APIKEY_PUBLIC']\n config.secret_key = ENV['MJ_APIKEY_PRIVATE']\n config.api_version = \"v3\"\nend\nvariable = Mailjet::Contact.find($contact_ID\n)\np variable.attributes['Data']"
- lang: Python
label: Python
source: "from mailjet_rest import Client\nimport os\napi_key = os.environ['MJ_APIKEY_PUBLIC']\napi_secret = os.environ['MJ_APIKEY_PRIVATE']\nmailjet = Client(auth=(api_key, api_secret), version='v3')\nid = '$contact_ID'\nresult = mailjet.contact.get(id=id)\nprint result.status_code\nprint result.json()"
- lang: Java
label: Java
source: "package com.my.project;\nimport com.mailjet.client.errors.MailjetException;\nimport com.mailjet.client.errors.MailjetSocketTimeoutException;\nimport com.mailjet.client.MailjetClient;\nimport com.mailjet.client.MailjetRequest;\nimport com.mailjet.client.MailjetResponse;\nimport com.mailjet.client.ClientOptions;\nimport com.mailjet.client.resource.Contact;\nimport org.json.JSONArray;\nimport org.json.JSONObject;\npublic class MyClass {\n public static void main(String[] args) throws MailjetException, MailjetSocketTimeoutException {\n MailjetClient client;\n MailjetRequest request;\n MailjetResponse response;\n client = new MailjetClient(System.getenv(\"MJ_APIKEY_PUBLIC\"), System.getenv(\"MJ_APIKEY_PRIVATE\"), new ClientOptions(\"v3\"));\n request = new MailjetRequest(Contact.resource, ID);\n response = client.get(request);\n System.out.println(response.getStatus());\n System.out.println(response.getData());\n }\n}"
- lang: Go
label: Go
source: "package main\nimport (\n\t\"fmt\"\n\t\"log\"\n\t\"os\"\n\tmailjet \"github.com/mailjet/mailjet-apiv3-go\"\n\t\"github.com/mailjet/mailjet-apiv3-go/resources\"\n)\nfunc main () {\n\tmailjetClient := NewMailjetClient(os.Getenv(\"MJ_APIKEY_PUBLIC\"), os.Getenv(\"MJ_APIKEY_PRIVATE\"))\n\tvar data []resources.Contact\n\tmr := &Request{\n\t Resource: \"contact\",\n\t ID: RESOURCE_ID,\n\t}\n\terr := mailjetClient.Get(mr, &data)\n\tif err != nil {\n\t fmt.Println(err)\n\t}\n\tfmt.Printf(\"Data array: %+v\\n\", data)\n}"
- lang: C#
label: C#
source: "using Mailjet.Client;\nusing Mailjet.Client.Resources;\nusing System;\nusing Newtonsoft.Json.Linq;\nnamespace Mailjet.ConsoleApplication\n{\n class Program\n {\n static void Main(string[] args)\n {\n RunAsync().Wait();\n }\n static async Task RunAsync()\n {\n MailjetClient client = new MailjetClient(Environment.GetEnvironmentVariable(\"MJ_APIKEY_PUBLIC\"), Environment.GetEnvironmentVariable(\"MJ_APIKEY_PRIVATE\"))\n {\n Version = ApiVersion.V3,\n };\n MailjetRequest request = new MailjetRequest\n {\n Resource = Contact.Resource,\n ResourceId = ResourceId.Numeric(ID)\n }\n MailjetResponse response = await client.GetAsync(request);\n if (response.IsSuccessStatusCode)\n {\n Console.WriteLine(string.Format(\"Total: {0}, Count: {1}\\n\", response.GetTotal(), response.GetCount()));\n Console.WriteLine(response.GetData());\n }\n else\n {\n Console.WriteLine(string.Format(\"StatusCode: {0}\\n\", response.StatusCode));\n Console.WriteLine(string.Format(\"ErrorInfo: {0}\\n\", response.GetErrorInfo()));\n Console.WriteLine(response.GetData());\n Console.WriteLine(string.Format(\"ErrorMessage: {0}\\n\", response.GetErrorMessage()));\n }\n }\n }\n}"
put:
x-seo:
title: "Update Contact"
description: "Update Contact in the Mailjet Email API. Update the user-given name and exclusion status of a specific contact."
tags:
- Contacts
summary: Update Contact
description: Update the user-given name and exclusion status of a specific contact. To obtain a valid `contact_ID`, first call `GET /v3/REST/contact` to list your contacts.
operationId: put_v3_contact_id
parameters:
- name: contact_ID
in: path
schema:
$ref: '#/components/schemas/put_v3_contact_id_PathParams/properties/contact_ID'
required: true
example: 1000
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/UpdateContact'
example:
Name: Example Contact
IsExcludedFromCampaigns: false
responses:
'200':
description: Default OK response for `/contact`
content:
application/json:
schema:
type: object
properties:
Count:
description: Indicates the number of objects in the `Data` array.
type: integer
format: int64
examples:
- 1
Data:
description: A JSON array containing a list of objects returned by this endpoint.
type: array
items:
$ref: '#/components/schemas/OutputContact'
Total:
description: Indicates the number of objects in the `Data` array.
type: integer
format: int64
examples:
- 1
'400':
$ref: '#/components/responses/400'
'401':
$ref: '#/components/responses/401'
'403':
$ref: '#/components/responses/403'
'404':
$ref: '#/components/responses/404'
'429':
$ref: '#/components/responses/429'
'500':
$ref: '#/components/responses/500'
security:
- basicAuth: []
x-codeSamples:
- lang: curl
label: cURL
source: "curl -s \\\n\t-X PUT \\\n\t--user \"$MJ_APIKEY_PUBLIC:$MJ_APIKEY_PRIVATE\" \\\n\thttps://api.mailjet.com/v3/REST/contact/$contact_ID \\\n\t-H 'Content-Type: application/json' \\\n\t-d '{\n \"IsExcludedFromCampaigns\":false,\n \"Name\":\"New Contact\"\n\t}'"
- lang: PHP
label: PHP
source: " 'v3']);\n$body = [\n 'IsExcludedFromCampaigns' => false,\n 'Name' => \"New Contact\"\n];\n$response = $mj->put(Resources::$Contact, ['id' => $id, 'body' => $body]);\n$response->success() && var_dump($response->getData());\n?>"
- lang: Node.js
label: Node
source: "const mailjet = require ('node-mailjet')\n\t.connect(process.env.MJ_APIKEY_PUBLIC, process.env.MJ_APIKEY_PRIVATE)\nconst request = mailjet\n\t.put(\"contact\", {'version': 'v3'})\n\t.id($contact_ID)\n\t.request({\n \"IsExcludedFromCampaigns\":false,\n \"Name\":\"New Contact\"\n })\nrequest\n\t.then((result) => {\n\t\tconsole.log(result.body)\n\t})\n\t.catch((err) => {\n\t\tconsole.log(err.statusCode)\n\t})"
- lang: Ruby
label: Ruby
source: "require 'mailjet'\nMailjet.configure do |config|\n config.api_key = ENV['MJ_APIKEY_PUBLIC']\n config.secret_key = ENV['MJ_APIKEY_PRIVATE']\n config.api_version = \"v3\"\nend\ntarget = Mailjet::Contact.find($contact_ID)\ntarget.update_attributes(\n is_excluded_from_campaigns: false,\n name: \"New Contact\"\n)\np variable.attributes['Data']"
- lang: Python
label: Python
source: "from mailjet_rest import Client\nimport os\napi_key = os.environ['MJ_APIKEY_PUBLIC']\napi_secret = os.environ['MJ_APIKEY_PRIVATE']\nmailjet = Client(auth=(api_key, api_secret), version='v3')\nid = '$contact_ID'\ndata = {\n 'IsExcludedFromCampaigns': False,\n 'Name': \"New Contact\"\n}\nresult = mailjet.contact.update(id=id, data=data)\nprint result.status_code\nprint result.json()"
- lang: Java
label: Java
source: "package com.my.project;\nimport com.mailjet.client.errors.MailjetException;\nimport com.mailjet.client.errors.MailjetSocketTimeoutException;\nimport com.mailjet.client.MailjetClient;\nimport com.mailjet.client.MailjetRequest;\nimport com.mailjet.client.MailjetResponse;\nimport com.mailjet.client.ClientOptions;\nimport com.mailjet.client.resource.Contact;\nimport org.json.JSONArray;\nimport org.json.JSONObject;\npublic class MyClass {\n public static void main(String[] args) throws MailjetException, MailjetSocketTimeoutException {\n MailjetClient client;\n MailjetRequest request;\n MailjetResponse response;\n client = new MailjetClient(System.getenv(\"MJ_APIKEY_PUBLIC\"), System.getenv(\"MJ_APIKEY_PRIVATE\"), new ClientOptions(\"v3\"));\n request = new MailjetRequest(Contact.resource, ID)\n .property(Contact.ISEXCLUDEDFROMCAMPAIGNS, false)\n .property(Contact.NAME, \"New Contact\")\n );\n response = client.put(request);\n System.out.println(response.getStatus());\n System.out.println(response.getData());\n }\n}"
- lang: Go
label: Go
source: "package main\nimport (\n\t\"fmt\"\n\t\"log\"\n\t\"os\"\n\tmailjet \"github.com/mailjet/mailjet-apiv3-go\"\n\t\"github.com/mailjet/mailjet-apiv3-go/resources\"\n)\nfunc main () {\n\tmailjetClient := NewMailjetClient(os.Getenv(\"MJ_APIKEY_PUBLIC\"), os.Getenv(\"MJ_APIKEY_PRIVATE\"))\n\tmr := &Request{\n\t Resource: \"contact\",\n\t ID: RESOURCE_ID,\n\t}\n\tfmr := &FullRequest{\n\t Info: mr,\n\t Payload: &resources.Contact { \n\t IsExcludedFromCampaigns:false,\n\t Name:\"New Contact\"\n }\n\t}\n\terr := mailjetClient.Put(fmr)\n\tif err != nil {\n\t fmt.Println(err)\n\t}\n}"
- lang: C#
label: C#
source: "using Mailjet.Client;\nusing Mailjet.Client.Resources;\nusing System;\nusing Newtonsoft.Json.Linq;\nnamespace Mailjet.ConsoleApplication\n{\n class Program\n {\n static void Main(string[] args)\n {\n RunAsync().Wait();\n }\n static async Task RunAsync()\n {\n MailjetClient client = new MailjetClient(Environment.GetEnvironmentVariable(\"MJ_APIKEY_PUBLIC\"), Environment.GetEnvironmentVariable(\"MJ_APIKEY_PRIVATE\"))\n {\n Version = ApiVersion.V3,\n };\n MailjetRequest request = new MailjetRequest\n {\n Resource = Contact.Resource,\n ResourceId = ResourceId.Numeric(ID)\n }\n .Property(Contact.IsExcludedFromCampaigns, false)\n .Property(Contact.Name, \"New Contact\");\n MailjetResponse response = await client.PutAsync(request);\n if (response.IsSuccessStatusCode)\n {\n Console.WriteLine(string.Format(\"Total: {0}, Count: {1}\\n\", response.GetTotal(), response.GetCount()));\n Console.WriteLine(response.GetData());\n }\n else\n {\n Console.WriteLine(string.Format(\"StatusCode: {0}\\n\", response.StatusCode));\n Console.WriteLine(string.Format(\"ErrorInfo: {0}\\n\", response.GetErrorInfo()));\n Console.WriteLine(response.GetData());\n Console.WriteLine(string.Format(\"ErrorMessage: {0}\\n\", response.GetErrorMessage()));\n }\n }\n }\n}"
"/v3/REST/contactmetadata":
get:
x-seo:
title: "Contact Metadata List"
description: "Contact Metadata List in the Mailjet Email API. Retrieve a list of contact properties and their general settings - name and data type."
tags:
- Contacts
summary: Contact Metadata List
description: Retrieve a list of contact properties and their general settings - name and data type.
operationId: get_v3_contactmetadata
parameters:
- name: DataType
in: query
schema:
$ref: '#/components/schemas/get_v3_contactmetadata_QueryParams/properties/DataType'
- name: Namespace
in: query
schema:
$ref: '#/components/schemas/get_v3_contactmetadata_QueryParams/properties/Namespace'
responses:
'200':
description: Default OK response for `/contactmetadata`
content:
application/json:
schema:
type: object
properties:
Count:
description: Indicates the number of objects in the `Data` array.
type: integer
format: int64
examples:
- 1
Data:
description: A JSON array containing a list of objects returned by this endpoint.
type: array
items:
$ref: '#/components/schemas/OutputContactmetadata'
Total:
description: Indicates the number of objects in the `Data` array.
type: integer
format: int64
examples:
- 1
'400':
$ref: '#/components/responses/400'
'401':
$ref: '#/components/responses/401'
'403':
$ref: '#/components/responses/403'
'404':
$ref: '#/components/responses/404'
'429':
$ref: '#/components/responses/429'
'500':
$ref: '#/components/responses/500'
security:
- basicAuth: []
x-codeSamples:
- lang: curl
label: cURL
source: "curl -s \\\n\t-X GET \\\n\t--user \"$MJ_APIKEY_PUBLIC:$MJ_APIKEY_PRIVATE\" \\\n\thttps://api.mailjet.com/v3/REST/contactmetadata \\"
- lang: PHP
label: PHP
source: " 'v3']);\n$response = $mj->get(Resources::$Contactmetadata);\n$response->success() && var_dump($response->getData());\n?>"
- lang: Node.js
label: Node
source: "const mailjet = require ('node-mailjet')\n\t.connect(process.env.MJ_APIKEY_PUBLIC, process.env.MJ_APIKEY_PRIVATE)\nconst request = mailjet\n\t.get(\"contactmetadata\", {'version': 'v3'})\n\t.request()\nrequest\n\t.then((result) => {\n\t\tconsole.log(result.body)\n\t})\n\t.catch((err) => {\n\t\tconsole.log(err.statusCode)\n\t})"
- lang: Ruby
label: Ruby
source: "require 'mailjet'\nMailjet.configure do |config|\n config.api_key = ENV['MJ_APIKEY_PUBLIC']\n config.secret_key = ENV['MJ_APIKEY_PRIVATE']\n config.api_version = \"v3\"\nend\nvariable = Mailjet::Contactmetadata.all(\n)\np variable.attributes['Data']"
- lang: Python
label: Python
source: "from mailjet_rest import Client\nimport os\napi_key = os.environ['MJ_APIKEY_PUBLIC']\napi_secret = os.environ['MJ_APIKEY_PRIVATE']\nmailjet = Client(auth=(api_key, api_secret), version='v3')\nresult = mailjet.contactmetadata.get()\nprint result.status_code\nprint result.json()"
- lang: Java
label: Java
source: "package com.my.project;\nimport com.mailjet.client.errors.MailjetException;\nimport com.mailjet.client.errors.MailjetSocketTimeoutException;\nimport com.mailjet.client.MailjetClient;\nimport com.mailjet.client.MailjetRequest;\nimport com.mailjet.client.MailjetResponse;\nimport com.mailjet.client.ClientOptions;\nimport com.mailjet.client.resource.Contactmetadata;\nimport org.json.JSONArray;\nimport org.json.JSONObject;\npublic class MyClass {\n public static void main(String[] args) throws MailjetException, MailjetSocketTimeoutException {\n MailjetClient client;\n MailjetRequest request;\n MailjetResponse response;\n client = new MailjetClient(System.getenv(\"MJ_APIKEY_PUBLIC\"), System.getenv(\"MJ_APIKEY_PRIVATE\"), new ClientOptions(\"v3\"));\n request = new MailjetRequest(Contactmetadata.resource);\n response = client.get(request);\n System.out.println(response.getStatus());\n System.out.println(response.getData());\n }\n}"
- lang: Go
label: Go
source: "package main\nimport (\n\t\"fmt\"\n\t\"log\"\n\t\"os\"\n\tmailjet \"github.com/mailjet/mailjet-apiv3-go\"\n\t\"github.com/mailjet/mailjet-apiv3-go/resources\"\n)\nfunc main () {\n\tmailjetClient := NewMailjetClient(os.Getenv(\"MJ_APIKEY_PUBLIC\"), os.Getenv(\"MJ_APIKEY_PRIVATE\"))\n\tvar data []resources.Contactmetadata\n\t_, _, err := mailjetClient.List(\"contactmetadata\", &data)\n\tif err != nil {\n\t fmt.Println(err)\n\t}\n\tfmt.Printf(\"Data array: %+v\\n\", data)\n}"
- lang: C#
label: C#
source: "using Mailjet.Client;\nusing Mailjet.Client.Resources;\nusing System;\nusing Newtonsoft.Json.Linq;\nnamespace Mailjet.ConsoleApplication\n{\n class Program\n {\n static void Main(string[] args)\n {\n RunAsync().Wait();\n }\n static async Task RunAsync()\n {\n MailjetClient client = new MailjetClient(Environment.GetEnvironmentVariable(\"MJ_APIKEY_PUBLIC\"), Environment.GetEnvironmentVariable(\"MJ_APIKEY_PRIVATE\"))\n {\n Version = ApiVersion.V3,\n };\n MailjetRequest request = new MailjetRequest\n {\n Resource = Contactmetadata.Resource,\n }\n MailjetResponse response = await client.GetAsync(request);\n if (response.IsSuccessStatusCode)\n {\n Console.WriteLine(string.Format(\"Total: {0}, Count: {1}\\n\", response.GetTotal(), response.GetCount()));\n Console.WriteLine(response.GetData());\n }\n else\n {\n Console.WriteLine(string.Format(\"StatusCode: {0}\\n\", response.StatusCode));\n Console.WriteLine(string.Format(\"ErrorInfo: {0}\\n\", response.GetErrorInfo()));\n Console.WriteLine(response.GetData());\n Console.WriteLine(string.Format(\"ErrorMessage: {0}\\n\", response.GetErrorMessage()));\n }\n }\n }\n}"
post:
x-seo:
title: "Create Contact Metadata"
description: "Create a new contact property. Select its name and data type, then use it to assign property values for contacts of your choice (with /contactdata )."
tags:
- Contacts
summary: Create Contact Metadata
description: Create a new contact property. Select its name and data type, then use it to assign property values for contacts of your choice (with `/contactdata`).
operationId: post_v3_contactmetadata
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/NewContactmetadata'
example:
Datatype: str
Name: first_name
NameSpace: static
responses:
'201':
description: Default OK response for `/contactmetadata`
content:
application/json:
schema:
type: object
properties:
Count:
description: Indicates the number of objects in the `Data` array.
type: integer
format: int64
examples:
- 1
Data:
description: A JSON array containing a list of objects returned by this endpoint.
type: array
items:
$ref: '#/components/schemas/OutputContactmetadata'
Total:
description: Indicates the number of objects in the `Data` array.
type: integer
format: int64
examples:
- 1
'400':
$ref: '#/components/responses/400'
'401':
$ref: '#/components/responses/401'
'403':
$ref: '#/components/responses/403'
'404':
$ref: '#/components/responses/404'
'429':
$ref: '#/components/responses/429'
'500':
$ref: '#/components/responses/500'
security:
- basicAuth: []
x-codeSamples:
- lang: curl
label: cURL
source: "curl -s \\\n\t-X POST \\\n\t--user \"$MJ_APIKEY_PUBLIC:$MJ_APIKEY_PRIVATE\" \\\n\thttps://api.mailjet.com/v3/REST/contactmetadata \\\n\t-H 'Content-Type: application/json' \\\n\t-d '{\n \"Datatype\":\"str\",\n \"Name\":\"first_name\",\n \"NameSpace\":\"static\"\n\t}'"
- lang: PHP
label: PHP
source: " 'v3']);\n$body = [\n 'Datatype' => \"str\",\n 'Name' => \"first_name\",\n 'NameSpace' => \"static\"\n];\n$response = $mj->post(Resources::$Contactmetadata, ['body' => $body]);\n$response->success() && var_dump($response->getData());\n?>"
- lang: Node.js
label: Node
source: "const mailjet = require ('node-mailjet')\n\t.connect(process.env.MJ_APIKEY_PUBLIC, process.env.MJ_APIKEY_PRIVATE)\nconst request = mailjet\n\t.post(\"contactmetadata\", {'version': 'v3'})\n\t.request({\n \"Datatype\":\"str\",\n \"Name\":\"first_name\",\n \"NameSpace\":\"static\"\n })\nrequest\n\t.then((result) => {\n\t\tconsole.log(result.body)\n\t})\n\t.catch((err) => {\n\t\tconsole.log(err.statusCode)\n\t})"
- lang: Ruby
label: Ruby
source: "require 'mailjet'\nMailjet.configure do |config|\n config.api_key = ENV['MJ_APIKEY_PUBLIC']\n config.secret_key = ENV['MJ_APIKEY_PRIVATE']\n config.api_version = \"v3\"\nend\nvariable = Mailjet::Contactmetadata.create(\n datatype: \"str\",\n name: \"first_name\",\n name_space: \"static\"\n)\np variable.attributes['Data']"
- lang: Python
label: Python
source: "from mailjet_rest import Client\nimport os\napi_key = os.environ['MJ_APIKEY_PUBLIC']\napi_secret = os.environ['MJ_APIKEY_PRIVATE']\nmailjet = Client(auth=(api_key, api_secret), version='v3')\ndata = {\n 'Datatype': \"str\",\n 'Name': \"first_name\",\n 'NameSpace': \"static\"\n}\nresult = mailjet.contactmetadata.create(data=data)\nprint result.status_code\nprint result.json()"
- lang: Java
label: Java
source: "package com.my.project;\nimport com.mailjet.client.errors.MailjetException;\nimport com.mailjet.client.errors.MailjetSocketTimeoutException;\nimport com.mailjet.client.MailjetClient;\nimport com.mailjet.client.MailjetRequest;\nimport com.mailjet.client.MailjetResponse;\nimport com.mailjet.client.ClientOptions;\nimport com.mailjet.client.resource.Contactmetadata;\nimport org.json.JSONArray;\nimport org.json.JSONObject;\npublic class MyClass {\n public static void main(String[] args) throws MailjetException, MailjetSocketTimeoutException {\n MailjetClient client;\n MailjetRequest request;\n MailjetResponse response;\n client = new MailjetClient(System.getenv(\"MJ_APIKEY_PUBLIC\"), System.getenv(\"MJ_APIKEY_PRIVATE\"), new ClientOptions(\"v3\"));\n request = new MailjetRequest(Contactmetadata.resource)\n .property(Contactmetadata.DATATYPE, \"str\")\n .property(Contactmetadata.NAME, \"first_name\")\n .property(Contactmetadata.NAMESPACE, \"static\")\n );\n response = client.post(request);\n System.out.println(response.getStatus());\n System.out.println(response.getData());\n }\n}"
- lang: Go
label: Go
source: "package main\nimport (\n\t\"fmt\"\n\t\"log\"\n\t\"os\"\n\tmailjet \"github.com/mailjet/mailjet-apiv3-go\"\n\t\"github.com/mailjet/mailjet-apiv3-go/resources\"\n)\nfunc main () {\n\tmailjetClient := NewMailjetClient(os.Getenv(\"MJ_APIKEY_PUBLIC\"), os.Getenv(\"MJ_APIKEY_PRIVATE\"))\n\tvar data []resources.Contactmetadata\n\tmr := &Request{\n\t Resource: \"contactmetadata\",\n\t}\n\tfmr := &FullRequest{\n\t Info: mr,\n\t Payload: &resources.Contactmetadata { \n\t Datatype:\"str\",\n\t Name:\"first_name\",\n\t NameSpace:\"static\"\n }\n\t}\n\terr := mailjetClient.Post(fmr, &data)\n\tif err != nil {\n\t fmt.Println(err)\n\t}\n\tfmt.Printf(\"Data array: %+v\\n\", data)\n}"
- lang: C#
label: C#
source: "using Mailjet.Client;\nusing Mailjet.Client.Resources;\nusing System;\nusing Newtonsoft.Json.Linq;\nnamespace Mailjet.ConsoleApplication\n{\n class Program\n {\n static void Main(string[] args)\n {\n RunAsync().Wait();\n }\n static async Task RunAsync()\n {\n MailjetClient client = new MailjetClient(Environment.GetEnvironmentVariable(\"MJ_APIKEY_PUBLIC\"), Environment.GetEnvironmentVariable(\"MJ_APIKEY_PRIVATE\"))\n {\n Version = ApiVersion.V3,\n };\n MailjetRequest request = new MailjetRequest\n {\n Resource = Contactmetadata.Resource,\n }\n .Property(Contactmetadata.Datatype, \"str\")\n .Property(Contactmetadata.Name, \"first_name\")\n .Property(Contactmetadata.NameSpace, \"static\");\n MailjetResponse response = await client.PostAsync(request);\n if (response.IsSuccessStatusCode)\n {\n Console.WriteLine(string.Format(\"Total: {0}, Count: {1}\\n\", response.GetTotal(), response.GetCount()));\n Console.WriteLine(response.GetData());\n }\n else\n {\n Console.WriteLine(string.Format(\"StatusCode: {0}\\n\", response.StatusCode));\n Console.WriteLine(string.Format(\"ErrorInfo: {0}\\n\", response.GetErrorInfo()));\n Console.WriteLine(response.GetData());\n Console.WriteLine(string.Format(\"ErrorMessage: {0}\\n\", response.GetErrorMessage()));\n }\n }\n }\n}"
"/v3/REST/contactmetadata/{contactmetadata_ID}":
get:
x-seo:
title: "Contact Metadata by ID"
description: "Contact Metadata by ID in the Mailjet Email API. Retrieve information on a specific contact property - its name and data type."
tags:
- Contacts
summary: Contact Metadata by ID
description: Retrieve information on a specific contact property - its name and data type. To obtain a valid `contactmetadata_ID`, first call `GET /v3/REST/contactmetadata` to list your contact properties.
operationId: get_v3_contactmetadata_id
parameters:
- name: contactmetadata_ID
in: path
schema:
$ref: '#/components/schemas/get_v3_contactmetadata_id_PathParams/properties/contactmetadata_ID'
required: true
example: 10000
responses:
'200':
description: Default OK response for `/contactmetadata`
content:
application/json:
schema:
type: object
properties:
Count:
description: Indicates the number of objects in the `Data` array.
type: integer
format: int64
examples:
- 1
Data:
description: A JSON array containing a list of objects returned by this endpoint.
type: array
items:
$ref: '#/components/schemas/OutputContactmetadata'
Total:
description: Indicates the number of objects in the `Data` array.
type: integer
format: int64
examples:
- 1
'400':
$ref: '#/components/responses/400'
'401':
$ref: '#/components/responses/401'
'403':
$ref: '#/components/responses/403'
'404':
$ref: '#/components/responses/404'
'429':
$ref: '#/components/responses/429'
'500':
$ref: '#/components/responses/500'
security:
- basicAuth: []
x-codeSamples:
- lang: curl
label: cURL
source: "curl -s \\\n\t-X GET \\\n\t--user \"$MJ_APIKEY_PUBLIC:$MJ_APIKEY_PRIVATE\" \\\n\thttps://api.mailjet.com/v3/REST/contactmetadata/$contactmetadata_ID \\"
- lang: PHP
label: PHP
source: " 'v3']);\n$response = $mj->get(Resources::$Contactmetadata, ['id' => $id]);\n$response->success() && var_dump($response->getData());\n?>"
- lang: Node.js
label: Node
source: "const mailjet = require ('node-mailjet')\n\t.connect(process.env.MJ_APIKEY_PUBLIC, process.env.MJ_APIKEY_PRIVATE)\nconst request = mailjet\n\t.get(\"contactmetadata\", {'version': 'v3'})\n\t.id($contactmetadata_ID)\n\t.request()\nrequest\n\t.then((result) => {\n\t\tconsole.log(result.body)\n\t})\n\t.catch((err) => {\n\t\tconsole.log(err.statusCode)\n\t})"
- lang: Ruby
label: Ruby
source: "require 'mailjet'\nMailjet.configure do |config|\n config.api_key = ENV['MJ_APIKEY_PUBLIC']\n config.secret_key = ENV['MJ_APIKEY_PRIVATE']\n config.api_version = \"v3\"\nend\nvariable = Mailjet::Contactmetadata.find($contactmetadata_ID\n)\np variable.attributes['Data']"
- lang: Python
label: Python
source: "from mailjet_rest import Client\nimport os\napi_key = os.environ['MJ_APIKEY_PUBLIC']\napi_secret = os.environ['MJ_APIKEY_PRIVATE']\nmailjet = Client(auth=(api_key, api_secret), version='v3')\nid = '$contactmetadata_ID'\nresult = mailjet.contactmetadata.get(id=id)\nprint result.status_code\nprint result.json()"
- lang: Java
label: Java
source: "package com.my.project;\nimport com.mailjet.client.errors.MailjetException;\nimport com.mailjet.client.errors.MailjetSocketTimeoutException;\nimport com.mailjet.client.MailjetClient;\nimport com.mailjet.client.MailjetRequest;\nimport com.mailjet.client.MailjetResponse;\nimport com.mailjet.client.ClientOptions;\nimport com.mailjet.client.resource.Contactmetadata;\nimport org.json.JSONArray;\nimport org.json.JSONObject;\npublic class MyClass {\n public static void main(String[] args) throws MailjetException, MailjetSocketTimeoutException {\n MailjetClient client;\n MailjetRequest request;\n MailjetResponse response;\n client = new MailjetClient(System.getenv(\"MJ_APIKEY_PUBLIC\"), System.getenv(\"MJ_APIKEY_PRIVATE\"), new ClientOptions(\"v3\"));\n request = new MailjetRequest(Contactmetadata.resource, ID);\n response = client.get(request);\n System.out.println(response.getStatus());\n System.out.println(response.getData());\n }\n}"
- lang: Go
label: Go
source: "package main\nimport (\n\t\"fmt\"\n\t\"log\"\n\t\"os\"\n\tmailjet \"github.com/mailjet/mailjet-apiv3-go\"\n\t\"github.com/mailjet/mailjet-apiv3-go/resources\"\n)\nfunc main () {\n\tmailjetClient := NewMailjetClient(os.Getenv(\"MJ_APIKEY_PUBLIC\"), os.Getenv(\"MJ_APIKEY_PRIVATE\"))\n\tvar data []resources.Contactmetadata\n\tmr := &Request{\n\t Resource: \"contactmetadata\",\n\t ID: RESOURCE_ID,\n\t}\n\terr := mailjetClient.Get(mr, &data)\n\tif err != nil {\n\t fmt.Println(err)\n\t}\n\tfmt.Printf(\"Data array: %+v\\n\", data)\n}"
- lang: C#
label: C#
source: "using Mailjet.Client;\nusing Mailjet.Client.Resources;\nusing System;\nusing Newtonsoft.Json.Linq;\nnamespace Mailjet.ConsoleApplication\n{\n class Program\n {\n static void Main(string[] args)\n {\n RunAsync().Wait();\n }\n static async Task RunAsync()\n {\n MailjetClient client = new MailjetClient(Environment.GetEnvironmentVariable(\"MJ_APIKEY_PUBLIC\"), Environment.GetEnvironmentVariable(\"MJ_APIKEY_PRIVATE\"))\n {\n Version = ApiVersion.V3,\n };\n MailjetRequest request = new MailjetRequest\n {\n Resource = Contactmetadata.Resource,\n ResourceId = ResourceId.Numeric(ID)\n }\n MailjetResponse response = await client.GetAsync(request);\n if (response.IsSuccessStatusCode)\n {\n Console.WriteLine(string.Format(\"Total: {0}, Count: {1}\\n\", response.GetTotal(), response.GetCount()));\n Console.WriteLine(response.GetData());\n }\n else\n {\n Console.WriteLine(string.Format(\"StatusCode: {0}\\n\", response.StatusCode));\n Console.WriteLine(string.Format(\"ErrorInfo: {0}\\n\", response.GetErrorInfo()));\n Console.WriteLine(response.GetData());\n Console.WriteLine(string.Format(\"ErrorMessage: {0}\\n\", response.GetErrorMessage()));\n }\n }\n }\n}"
put:
x-seo:
title: "Update Contact Metadata"
description: "Update the settings of an existing contact property - name and data type. Changing the data type will not affect existing property values, but new values\u2026"
tags:
- Contacts
summary: Update Contact Metadata
description: Update the settings of an existing contact property - name and data type. Changing the data type will not affect existing property values, but new values must be entered using the new data type. To obtain a valid `contactmetadata_ID`, first call `GET /v3/REST/contactmetadata` to list your contact properties.
operationId: put_v3_contactmetadata_id
parameters:
- name: contactmetadata_ID
in: path
schema:
$ref: '#/components/schemas/put_v3_contactmetadata_id_PathParams/properties/contactmetadata_ID'
required: true
example: 10000
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/UpdateContactmetadata'
example:
Datatype: str
Name: first_name
responses:
'200':
description: Default OK response for `/contactmetadata`
content:
application/json:
schema:
type: object
properties:
Count:
description: Indicates the number of objects in the `Data` array.
type: integer
format: int64
examples:
- 1
Data:
description: A JSON array containing a list of objects returned by this endpoint.
type: array
items:
$ref: '#/components/schemas/OutputContactmetadata'
Total:
description: Indicates the number of objects in the `Data` array.
type: integer
format: int64
examples:
- 1
'400':
$ref: '#/components/responses/400'
'401':
$ref: '#/components/responses/401'
'403':
$ref: '#/components/responses/403'
'404':
$ref: '#/components/responses/404'
'429':
$ref: '#/components/responses/429'
'500':
$ref: '#/components/responses/500'
security:
- basicAuth: []
x-codeSamples:
- lang: curl
label: cURL
source: "curl -s \\\n\t-X PUT \\\n\t--user \"$MJ_APIKEY_PUBLIC:$MJ_APIKEY_PRIVATE\" \\\n\thttps://api.mailjet.com/v3/REST/contactmetadata/$contactmetadata_ID \\\n\t-H 'Content-Type: application/json' \\\n\t-d '{\n \"Datatype\":\"str\",\n \"Name\":\"first_name\"\n\t}'"
- lang: PHP
label: PHP
source: " 'v3']);\n$body = [\n 'Datatype' => \"str\",\n 'Name' => \"first_name\"\n];\n$response = $mj->put(Resources::$Contactmetadata, ['id' => $id, 'body' => $body]);\n$response->success() && var_dump($response->getData());\n?>"
- lang: Node.js
label: Node
source: "const mailjet = require ('node-mailjet')\n\t.connect(process.env.MJ_APIKEY_PUBLIC, process.env.MJ_APIKEY_PRIVATE)\nconst request = mailjet\n\t.put(\"contactmetadata\", {'version': 'v3'})\n\t.id($contactmetadata_ID)\n\t.request({\n \"Datatype\":\"str\",\n \"Name\":\"first_name\"\n })\nrequest\n\t.then((result) => {\n\t\tconsole.log(result.body)\n\t})\n\t.catch((err) => {\n\t\tconsole.log(err.statusCode)\n\t})"
- lang: Ruby
label: Ruby
source: "require 'mailjet'\nMailjet.configure do |config|\n config.api_key = ENV['MJ_APIKEY_PUBLIC']\n config.secret_key = ENV['MJ_APIKEY_PRIVATE']\n config.api_version = \"v3\"\nend\ntarget = Mailjet::Contactmetadata.find($contactmetadata_ID)\ntarget.update_attributes(\n datatype: \"str\",\n name: \"first_name\"\n)\np variable.attributes['Data']"
- lang: Python
label: Python
source: "from mailjet_rest import Client\nimport os\napi_key = os.environ['MJ_APIKEY_PUBLIC']\napi_secret = os.environ['MJ_APIKEY_PRIVATE']\nmailjet = Client(auth=(api_key, api_secret), version='v3')\nid = '$contactmetadata_ID'\ndata = {\n 'Datatype': \"str\",\n 'Name': \"first_name\"\n}\nresult = mailjet.contactmetadata.update(id=id, data=data)\nprint result.status_code\nprint result.json()"
- lang: Java
label: Java
source: "package com.my.project;\nimport com.mailjet.client.errors.MailjetException;\nimport com.mailjet.client.errors.MailjetSocketTimeoutException;\nimport com.mailjet.client.MailjetClient;\nimport com.mailjet.client.MailjetRequest;\nimport com.mailjet.client.MailjetResponse;\nimport com.mailjet.client.ClientOptions;\nimport com.mailjet.client.resource.Contactmetadata;\nimport org.json.JSONArray;\nimport org.json.JSONObject;\npublic class MyClass {\n public static void main(String[] args) throws MailjetException, MailjetSocketTimeoutException {\n MailjetClient client;\n MailjetRequest request;\n MailjetResponse response;\n client = new MailjetClient(System.getenv(\"MJ_APIKEY_PUBLIC\"), System.getenv(\"MJ_APIKEY_PRIVATE\"), new ClientOptions(\"v3\"));\n request = new MailjetRequest(Contactmetadata.resource, ID)\n .property(Contactmetadata.DATATYPE, \"str\")\n .property(Contactmetadata.NAME, \"first_name\")\n );\n response = client.put(request);\n System.out.println(response.getStatus());\n System.out.println(response.getData());\n }\n}"
- lang: Go
label: Go
source: "package main\nimport (\n\t\"fmt\"\n\t\"log\"\n\t\"os\"\n\tmailjet \"github.com/mailjet/mailjet-apiv3-go\"\n\t\"github.com/mailjet/mailjet-apiv3-go/resources\"\n)\nfunc main () {\n\tmailjetClient := NewMailjetClient(os.Getenv(\"MJ_APIKEY_PUBLIC\"), os.Getenv(\"MJ_APIKEY_PRIVATE\"))\n\tmr := &Request{\n\t Resource: \"contactmetadata\",\n\t ID: RESOURCE_ID,\n\t}\n\tfmr := &FullRequest{\n\t Info: mr,\n\t Payload: &resources.Contactmetadata { \n\t Datatype:\"str\",\n\t Name:\"first_name\"\n }\n\t}\n\terr := mailjetClient.Put(fmr)\n\tif err != nil {\n\t fmt.Println(err)\n\t}\n}"
- lang: C#
label: C#
source: "using Mailjet.Client;\nusing Mailjet.Client.Resources;\nusing System;\nusing Newtonsoft.Json.Linq;\nnamespace Mailjet.ConsoleApplication\n{\n class Program\n {\n static void Main(string[] args)\n {\n RunAsync().Wait();\n }\n static async Task RunAsync()\n {\n MailjetClient client = new MailjetClient(Environment.GetEnvironmentVariable(\"MJ_APIKEY_PUBLIC\"), Environment.GetEnvironmentVariable(\"MJ_APIKEY_PRIVATE\"))\n {\n Version = ApiVersion.V3,\n };\n MailjetRequest request = new MailjetRequest\n {\n Resource = Contactmetadata.Resource,\n ResourceId = ResourceId.Numeric(ID)\n }\n .Property(Contactmetadata.Datatype, \"str\")\n .Property(Contactmetadata.Name, \"first_name\");\n MailjetResponse response = await client.PutAsync(request);\n if (response.IsSuccessStatusCode)\n {\n Console.WriteLine(string.Format(\"Total: {0}, Count: {1}\\n\", response.GetTotal(), response.GetCount()));\n Console.WriteLine(response.GetData());\n }\n else\n {\n Console.WriteLine(string.Format(\"StatusCode: {0}\\n\", response.StatusCode));\n Console.WriteLine(string.Format(\"ErrorInfo: {0}\\n\", response.GetErrorInfo()));\n Console.WriteLine(response.GetData());\n Console.WriteLine(string.Format(\"ErrorMessage: {0}\\n\", response.GetErrorMessage()));\n }\n }\n }\n}"
delete:
x-seo:
title: "Delete Contact Metadata"
description: "Delete an existing contact property. Once the property is deleted, the values assigned to it for all contacts are also deleted."
tags:
- Contacts
summary: Delete Contact Metadata
description: Delete an existing contact property. Once the property is deleted, the values assigned to it for all contacts are also deleted.
operationId: delete_v3_contactmetadata_id
parameters:
- name: contactmetadata_ID
in: path
schema:
$ref: '#/components/schemas/delete_v3_contactmetadata_id_PathParams/properties/contactmetadata_ID'
required: true
responses:
'204':
$ref: '#/components/responses/204'
'400':
$ref: '#/components/responses/400'
'401':
$ref: '#/components/responses/401'
'403':
$ref: '#/components/responses/403'
'404':
$ref: '#/components/responses/404'
'429':
$ref: '#/components/responses/429'
'500':
$ref: '#/components/responses/500'
security:
- basicAuth: []
x-codeSamples:
- lang: curl
label: cURL
source: "curl -s \\\n\t-X DELETE \\\n\t--user \"$MJ_APIKEY_PUBLIC:$MJ_APIKEY_PRIVATE\" \\\n\thttps://api.mailjet.com/v3/REST/contactmetadata/$contactmetadata_ID \\\n\t-H 'Content-Type: application/json' \\\n\t-d '{\n\t}'"
- lang: PHP
label: PHP
source: " 'v3']);\n$response = $mj->delete(Resources::$Contactmetadata, ['id' => $id]);\n$response->success() && var_dump($response->getData());\n?>"
- lang: Node.js
label: Node
source: "const mailjet = require ('node-mailjet')\n\t.connect(process.env.MJ_APIKEY_PUBLIC, process.env.MJ_APIKEY_PRIVATE)\nconst request = mailjet\n\t.delete(\"contactmetadata\", {'version': 'v3'})\n\t.id($contactmetadata_ID)\n\t.request()\nrequest\n\t.then((result) => {\n\t\tconsole.log(result.body)\n\t})\n\t.catch((err) => {\n\t\tconsole.log(err.statusCode)\n\t})"
- lang: Ruby
label: Ruby
source: "require 'mailjet'\nMailjet.configure do |config|\n config.api_key = ENV['MJ_APIKEY_PUBLIC']\n config.secret_key = ENV['MJ_APIKEY_PRIVATE']\n config.api_version = \"v3\"\nend\ntarget = Mailjet::Contactmetadata.find($contactmetadata_ID)\ntarget.delete(\n)\np variable.attributes['Data']"
- lang: Python
label: Python
source: "from mailjet_rest import Client\nimport os\napi_key = os.environ['MJ_APIKEY_PUBLIC']\napi_secret = os.environ['MJ_APIKEY_PRIVATE']\nmailjet = Client(auth=(api_key, api_secret), version='v3')\nid = '$contactmetadata_ID'\nresult = mailjet.contactmetadata.delete(id=id)\nprint result.status_code\nprint result.json()"
- lang: Java
label: Java
source: "package com.my.project;\nimport com.mailjet.client.errors.MailjetException;\nimport com.mailjet.client.errors.MailjetSocketTimeoutException;\nimport com.mailjet.client.MailjetClient;\nimport com.mailjet.client.MailjetRequest;\nimport com.mailjet.client.MailjetResponse;\nimport com.mailjet.client.ClientOptions;\nimport com.mailjet.client.resource.Contactmetadata;\nimport org.json.JSONArray;\nimport org.json.JSONObject;\npublic class MyClass {\n public static void main(String[] args) throws MailjetException, MailjetSocketTimeoutException {\n MailjetClient client;\n MailjetRequest request;\n MailjetResponse response;\n client = new MailjetClient(System.getenv(\"MJ_APIKEY_PUBLIC\"), System.getenv(\"MJ_APIKEY_PRIVATE\"), new ClientOptions(\"v3\"));\n request = new MailjetRequest(Contactmetadata.resource, ID);\n response = client.delete(request);\n System.out.println(response.getStatus());\n System.out.println(response.getData());\n }\n}"
- lang: Go
label: Go
source: "package main\nimport (\n\t\"fmt\"\n\t\"log\"\n\t\"os\"\n\tmailjet \"github.com/mailjet/mailjet-apiv3-go\"\n\t\"github.com/mailjet/mailjet-apiv3-go/resources\"\n)\nfunc main () {\n\tmailjetClient := NewMailjetClient(os.Getenv(\"MJ_APIKEY_PUBLIC\"), os.Getenv(\"MJ_APIKEY_PRIVATE\"))\n\tmr := &Request{\n\t Resource: \"contactmetadata\",\n\t ID: RESOURCE_ID,\n\t}\n\terr := mailjetClient.Delete(mr)\n\tif err != nil {\n\t fmt.Println(err)\n\t}\n}"
- lang: C#
label: C#
source: "using Mailjet.Client;\nusing Mailjet.Client.Resources;\nusing System;\nusing Newtonsoft.Json.Linq;\nnamespace Mailjet.ConsoleApplication\n{\n class Program\n {\n static void Main(string[] args)\n {\n RunAsync().Wait();\n }\n static async Task RunAsync()\n {\n MailjetClient client = new MailjetClient(Environment.GetEnvironmentVariable(\"MJ_APIKEY_PUBLIC\"), Environment.GetEnvironmentVariable(\"MJ_APIKEY_PRIVATE\"))\n {\n Version = ApiVersion.V3,\n };\n MailjetRequest request = new MailjetRequest\n {\n Resource = Contactmetadata.Resource,\n ResourceId = ResourceId.Numeric(ID)\n }\n MailjetResponse response = await client.DeleteAsync(request);\n if (response.IsSuccessStatusCode)\n {\n Console.WriteLine(string.Format(\"Total: {0}, Count: {1}\\n\", response.GetTotal(), response.GetCount()));\n Console.WriteLine(response.GetData());\n }\n else\n {\n Console.WriteLine(string.Format(\"StatusCode: {0}\\n\", response.StatusCode));\n Console.WriteLine(string.Format(\"ErrorInfo: {0}\\n\", response.GetErrorInfo()));\n Console.WriteLine(response.GetData());\n Console.WriteLine(string.Format(\"ErrorMessage: {0}\\n\", response.GetErrorMessage()));\n }\n }\n }\n}"
"/v3/REST/contactdata":
get:
x-seo:
title: "Contact Data"
description: "Contact Data in the Mailjet Email API. Retrieve a list of contacts with all properties and respective values associated with those contacts."
tags:
- Contacts
summary: Contact Data
description: Retrieve a list of contacts with all properties and respective values associated with those contacts.
operationId: get_v3_contactdata
parameters:
- name: Campaign
in: query
schema:
$ref: '#/components/schemas/get_v3_contactdata_QueryParams/properties/Campaign'
- name: ContactEmail
in: query
schema:
$ref: '#/components/schemas/get_v3_contactdata_QueryParams/properties/ContactEmail'
- name: ContactsList
in: query
schema:
$ref: '#/components/schemas/get_v3_contactdata_QueryParams/properties/ContactsList'
- name: Fields
in: query
schema:
$ref: '#/components/schemas/get_v3_contactdata_QueryParams/properties/Fields'
- name: LastActivityAt
in: query
schema:
$ref: '#/components/schemas/get_v3_contactdata_QueryParams/properties/LastActivityAt'
responses:
'200':
description: Default OK response for `/contactdata`
content:
application/json:
schema:
type: object
properties:
Count:
description: Indicates the number of objects in the `Data` array.
type: integer
format: int64
examples:
- 1
Data:
description: A JSON array containing a list of objects returned by this endpoint.
type: array
items:
$ref: '#/components/schemas/OutputContactdata'
Total:
description: Indicates the number of objects in the `Data` array.
type: integer
format: int64
examples:
- 1
'400':
$ref: '#/components/responses/400'
'401':
$ref: '#/components/responses/401'
'403':
$ref: '#/components/responses/403'
'404':
$ref: '#/components/responses/404'
'429':
$ref: '#/components/responses/429'
'500':
$ref: '#/components/responses/500'
security:
- basicAuth: []
x-codeSamples:
- lang: curl
label: cURL
source: "curl -s \\\n\t-X GET \\\n\t--user \"$MJ_APIKEY_PUBLIC:$MJ_APIKEY_PRIVATE\" \\\n\thttps://api.mailjet.com/v3/REST/contactdata \\"
- lang: PHP
label: PHP
source: " 'v3']);\n$response = $mj->get(Resources::$Contactdata);\n$response->success() && var_dump($response->getData());\n?>"
- lang: Node.js
label: Node
source: "const mailjet = require ('node-mailjet')\n\t.connect(process.env.MJ_APIKEY_PUBLIC, process.env.MJ_APIKEY_PRIVATE)\nconst request = mailjet\n\t.get(\"contactdata\", {'version': 'v3'})\n\t.request()\nrequest\n\t.then((result) => {\n\t\tconsole.log(result.body)\n\t})\n\t.catch((err) => {\n\t\tconsole.log(err.statusCode)\n\t})"
- lang: Ruby
label: Ruby
source: "require 'mailjet'\nMailjet.configure do |config|\n config.api_key = ENV['MJ_APIKEY_PUBLIC']\n config.secret_key = ENV['MJ_APIKEY_PRIVATE']\n config.api_version = \"v3\"\nend\nvariable = Mailjet::Contactdata.all(\n)\np variable.attributes['Data']"
- lang: Python
label: Python
source: "from mailjet_rest import Client\nimport os\napi_key = os.environ['MJ_APIKEY_PUBLIC']\napi_secret = os.environ['MJ_APIKEY_PRIVATE']\nmailjet = Client(auth=(api_key, api_secret), version='v3')\nresult = mailjet.contactdata.get()\nprint result.status_code\nprint result.json()"
- lang: Java
label: Java
source: "package com.my.project;\nimport com.mailjet.client.errors.MailjetException;\nimport com.mailjet.client.errors.MailjetSocketTimeoutException;\nimport com.mailjet.client.MailjetClient;\nimport com.mailjet.client.MailjetRequest;\nimport com.mailjet.client.MailjetResponse;\nimport com.mailjet.client.ClientOptions;\nimport com.mailjet.client.resource.Contactdata;\nimport org.json.JSONArray;\nimport org.json.JSONObject;\npublic class MyClass {\n public static void main(String[] args) throws MailjetException, MailjetSocketTimeoutException {\n MailjetClient client;\n MailjetRequest request;\n MailjetResponse response;\n client = new MailjetClient(System.getenv(\"MJ_APIKEY_PUBLIC\"), System.getenv(\"MJ_APIKEY_PRIVATE\"), new ClientOptions(\"v3\"));\n request = new MailjetRequest(Contactdata.resource);\n response = client.get(request);\n System.out.println(response.getStatus());\n System.out.println(response.getData());\n }\n}"
- lang: Go
label: Go
source: "package main\nimport (\n\t\"fmt\"\n\t\"log\"\n\t\"os\"\n\tmailjet \"github.com/mailjet/mailjet-apiv3-go\"\n\t\"github.com/mailjet/mailjet-apiv3-go/resources\"\n)\nfunc main () {\n\tmailjetClient := NewMailjetClient(os.Getenv(\"MJ_APIKEY_PUBLIC\"), os.Getenv(\"MJ_APIKEY_PRIVATE\"))\n\tvar data []resources.Contactdata\n\t_, _, err := mailjetClient.List(\"contactdata\", &data)\n\tif err != nil {\n\t fmt.Println(err)\n\t}\n\tfmt.Printf(\"Data array: %+v\\n\", data)\n}"
- lang: C#
label: C#
source: "using Mailjet.Client;\nusing Mailjet.Client.Resources;\nusing System;\nusing Newtonsoft.Json.Linq;\nnamespace Mailjet.ConsoleApplication\n{\n class Program\n {\n static void Main(string[] args)\n {\n RunAsync().Wait();\n }\n static async Task RunAsync()\n {\n MailjetClient client = new MailjetClient(Environment.GetEnvironmentVariable(\"MJ_APIKEY_PUBLIC\"), Environment.GetEnvironmentVariable(\"MJ_APIKEY_PRIVATE\"))\n {\n Version = ApiVersion.V3,\n };\n MailjetRequest request = new MailjetRequest\n {\n Resource = Contactdata.Resource,\n }\n MailjetResponse response = await client.GetAsync(request);\n if (response.IsSuccessStatusCode)\n {\n Console.WriteLine(string.Format(\"Total: {0}, Count: {1}\\n\", response.GetTotal(), response.GetCount()));\n Console.WriteLine(response.GetData());\n }\n else\n {\n Console.WriteLine(string.Format(\"StatusCode: {0}\\n\", response.StatusCode));\n Console.WriteLine(string.Format(\"ErrorInfo: {0}\\n\", response.GetErrorInfo()));\n Console.WriteLine(response.GetData());\n Console.WriteLine(string.Format(\"ErrorMessage: {0}\\n\", response.GetErrorMessage()));\n }\n }\n }\n}"
/v3/REST/contactdata/{contact_ID}:
get:
x-seo:
title: "Contact Data by ID"
description: "Contact Data by ID in the Mailjet Email API. Retrieve all properties and respective values associated with a specific contact."
tags:
- Contacts
summary: Contact Data by ID
description: Retrieve all properties and respective values associated with a specific contact. To obtain a valid `contact_ID`, first call `GET /v3/REST/contact` to list your contacts.
operationId: get_v3_contactdata_id
parameters:
- name: contact_ID
in: path
schema:
$ref: '#/components/schemas/get_v3_contactdata_id_PathParams/properties/contact_ID'
required: true
example: 1000
responses:
'200':
description: Default OK response for `/contactdata`
content:
application/json:
schema:
type: object
properties:
Count:
description: Indicates the number of objects in the `Data` array.
type: integer
format: int64
examples:
- 1
Data:
description: A JSON array containing a list of objects returned by this endpoint.
type: array
items:
$ref: '#/components/schemas/OutputContactdata'
Total:
description: Indicates the number of objects in the `Data` array.
type: integer
format: int64
examples:
- 1
'400':
$ref: '#/components/responses/400'
'401':
$ref: '#/components/responses/401'
'403':
$ref: '#/components/responses/403'
'404':
$ref: '#/components/responses/404'
'429':
$ref: '#/components/responses/429'
'500':
$ref: '#/components/responses/500'
security:
- basicAuth: []
x-codeSamples:
- lang: curl
label: cURL
source: "curl -s \\\n\t-X GET \\\n\t--user \"$MJ_APIKEY_PUBLIC:$MJ_APIKEY_PRIVATE\" \\\n\thttps://api.mailjet.com/v3/REST/contactdata/$contact_ID \\"
- lang: PHP
label: PHP
source: " 'v3']);\n$response = $mj->get(Resources::$Contactdata, ['id' => $id]);\n$response->success() && var_dump($response->getData());\n?>"
- lang: Node.js
label: Node
source: "const mailjet = require ('node-mailjet')\n\t.connect(process.env.MJ_APIKEY_PUBLIC, process.env.MJ_APIKEY_PRIVATE)\nconst request = mailjet\n\t.get(\"contactdata\", {'version': 'v3'})\n\t.id($contact_ID)\n\t.request()\nrequest\n\t.then((result) => {\n\t\tconsole.log(result.body)\n\t})\n\t.catch((err) => {\n\t\tconsole.log(err.statusCode)\n\t})"
- lang: Ruby
label: Ruby
source: "require 'mailjet'\nMailjet.configure do |config|\n config.api_key = ENV['MJ_APIKEY_PUBLIC']\n config.secret_key = ENV['MJ_APIKEY_PRIVATE']\n config.api_version = \"v3\"\nend\nvariable = Mailjet::Contactdata.find($contact_ID\n)\np variable.attributes['Data']"
- lang: Python
label: Python
source: "from mailjet_rest import Client\nimport os\napi_key = os.environ['MJ_APIKEY_PUBLIC']\napi_secret = os.environ['MJ_APIKEY_PRIVATE']\nmailjet = Client(auth=(api_key, api_secret), version='v3')\nid = '$contact_ID'\nresult = mailjet.contactdata.get(id=id)\nprint result.status_code\nprint result.json()"
- lang: Java
label: Java
source: "package com.my.project;\nimport com.mailjet.client.errors.MailjetException;\nimport com.mailjet.client.errors.MailjetSocketTimeoutException;\nimport com.mailjet.client.MailjetClient;\nimport com.mailjet.client.MailjetRequest;\nimport com.mailjet.client.MailjetResponse;\nimport com.mailjet.client.ClientOptions;\nimport com.mailjet.client.resource.Contactdata;\nimport org.json.JSONArray;\nimport org.json.JSONObject;\npublic class MyClass {\n public static void main(String[] args) throws MailjetException, MailjetSocketTimeoutException {\n MailjetClient client;\n MailjetRequest request;\n MailjetResponse response;\n client = new MailjetClient(System.getenv(\"MJ_APIKEY_PUBLIC\"), System.getenv(\"MJ_APIKEY_PRIVATE\"), new ClientOptions(\"v3\"));\n request = new MailjetRequest(Contactdata.resource, ID);\n response = client.get(request);\n System.out.println(response.getStatus());\n System.out.println(response.getData());\n }\n}"
- lang: Go
label: Go
source: "package main\nimport (\n\t\"fmt\"\n\t\"log\"\n\t\"os\"\n\tmailjet \"github.com/mailjet/mailjet-apiv3-go\"\n\t\"github.com/mailjet/mailjet-apiv3-go/resources\"\n)\nfunc main () {\n\tmailjetClient := NewMailjetClient(os.Getenv(\"MJ_APIKEY_PUBLIC\"), os.Getenv(\"MJ_APIKEY_PRIVATE\"))\n\tvar data []resources.Contactdata\n\tmr := &Request{\n\t Resource: \"contactdata\",\n\t ID: RESOURCE_ID,\n\t}\n\terr := mailjetClient.Get(mr, &data)\n\tif err != nil {\n\t fmt.Println(err)\n\t}\n\tfmt.Printf(\"Data array: %+v\\n\", data)\n}"
- lang: C#
label: C#
source: "using Mailjet.Client;\nusing Mailjet.Client.Resources;\nusing System;\nusing Newtonsoft.Json.Linq;\nnamespace Mailjet.ConsoleApplication\n{\n class Program\n {\n static void Main(string[] args)\n {\n RunAsync().Wait();\n }\n static async Task RunAsync()\n {\n MailjetClient client = new MailjetClient(Environment.GetEnvironmentVariable(\"MJ_APIKEY_PUBLIC\"), Environment.GetEnvironmentVariable(\"MJ_APIKEY_PRIVATE\"))\n {\n Version = ApiVersion.V3,\n };\n MailjetRequest request = new MailjetRequest\n {\n Resource = Contactdata.Resource,\n ResourceId = ResourceId.Numeric(ID)\n }\n MailjetResponse response = await client.GetAsync(request);\n if (response.IsSuccessStatusCode)\n {\n Console.WriteLine(string.Format(\"Total: {0}, Count: {1}\\n\", response.GetTotal(), response.GetCount()));\n Console.WriteLine(response.GetData());\n }\n else\n {\n Console.WriteLine(string.Format(\"StatusCode: {0}\\n\", response.StatusCode));\n Console.WriteLine(string.Format(\"ErrorInfo: {0}\\n\", response.GetErrorInfo()));\n Console.WriteLine(response.GetData());\n Console.WriteLine(string.Format(\"ErrorMessage: {0}\\n\", response.GetErrorMessage()));\n }\n }\n }\n}"
put:
x-seo:
title: "Update Contact Data"
description: "Update the extra static data for a contact by using your already created /contactmetadata objects (contact properties) and assigning / updating values to\u2026"
tags:
- Contacts
summary: Update Contact Data
description: Update the extra static data for a contact by using your already created `/contactmetadata` objects (contact properties) and assigning / updating values to them for the specific `ContactID`. To obtain a valid `contact_ID`, first call `GET /v3/REST/contact` to list your contacts.
operationId: put_v3_contactdata_id
parameters:
- name: contact_ID
in: path
schema:
$ref: '#/components/schemas/put_v3_contactdata_id_PathParams/properties/contact_ID'
required: true
example: 1000
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/UpdateContactdata'
example:
Data:
- Name: first_name
Value: John
responses:
'200':
description: Default OK response for `/contactdata`
content:
application/json:
schema:
type: object
properties:
Count:
description: Indicates the number of objects in the `Data` array.
type: integer
format: int64
examples:
- 1
Data:
description: A JSON array containing a list of objects returned by this endpoint.
type: array
items:
$ref: '#/components/schemas/OutputContactdata'
Total:
description: Indicates the number of objects in the `Data` array.
type: integer
format: int64
examples:
- 1
'400':
$ref: '#/components/responses/400'
'401':
$ref: '#/components/responses/401'
'403':
$ref: '#/components/responses/403'
'404':
$ref: '#/components/responses/404'
'429':
$ref: '#/components/responses/429'
'500':
$ref: '#/components/responses/500'
security:
- basicAuth: []
x-codeSamples:
- lang: curl
label: cURL
source: "curl -s \\\n\t-X PUT \\\n\t--user \"$MJ_APIKEY_PUBLIC:$MJ_APIKEY_PRIVATE\" \\\n\thttps://api.mailjet.com/v3/REST/contactdata/$contact_ID \\\n\t-H 'Content-Type: application/json' \\\n\t-d '{\n \"Data\":[\n {\n \"Name\":\"first_name\",\n \"Value\":\"John\"\n }\n ]\n\t}'"
- lang: PHP
label: PHP
source: " 'v3']);\n$body = [\n 'Data' => [\n [\n 'Name' => \"first_name\",\n 'Value' => \"John\"\n ]\n ]\n];\n$response = $mj->put(Resources::$Contactdata, ['id' => $id, 'body' => $body]);\n$response->success() && var_dump($response->getData());\n?>"
- lang: Node.js
label: Node
source: "const mailjet = require ('node-mailjet')\n\t.connect(process.env.MJ_APIKEY_PUBLIC, process.env.MJ_APIKEY_PRIVATE)\nconst request = mailjet\n\t.put(\"contactdata\", {'version': 'v3'})\n\t.id($contact_ID)\n\t.request({\n \"Data\":[\n {\n \"Name\":\"first_name\",\n \"Value\":\"John\"\n }\n ]\n })\nrequest\n\t.then((result) => {\n\t\tconsole.log(result.body)\n\t})\n\t.catch((err) => {\n\t\tconsole.log(err.statusCode)\n\t})"
- lang: Ruby
label: Ruby
source: "require 'mailjet'\nMailjet.configure do |config|\n config.api_key = ENV['MJ_APIKEY_PUBLIC']\n config.secret_key = ENV['MJ_APIKEY_PRIVATE']\n config.api_version = \"v3\"\nend\ntarget = Mailjet::Contactdata.find($contact_ID)\ntarget.update_attributes(\n data: [\n {\n 'name' => \"first_name\",\n 'value' => \"John\"\n }\n ]\n)\np variable.attributes['Data']"
- lang: Python
label: Python
source: "from mailjet_rest import Client\nimport os\napi_key = os.environ['MJ_APIKEY_PUBLIC']\napi_secret = os.environ['MJ_APIKEY_PRIVATE']\nmailjet = Client(auth=(api_key, api_secret), version='v3')\nid = '$contact_ID'\ndata = {\n 'Data': [\n {\n \"Name\": \"first_name\",\n \"Value\": \"John\"\n }\n ]\n}\nresult = mailjet.contactdata.update(id=id, data=data)\nprint result.status_code\nprint result.json()"
- lang: Java
label: Java
source: "package com.my.project;\nimport com.mailjet.client.errors.MailjetException;\nimport com.mailjet.client.errors.MailjetSocketTimeoutException;\nimport com.mailjet.client.MailjetClient;\nimport com.mailjet.client.MailjetRequest;\nimport com.mailjet.client.MailjetResponse;\nimport com.mailjet.client.ClientOptions;\nimport com.mailjet.client.resource.Contactdata;\nimport org.json.JSONArray;\nimport org.json.JSONObject;\npublic class MyClass {\n public static void main(String[] args) throws MailjetException, MailjetSocketTimeoutException {\n MailjetClient client;\n MailjetRequest request;\n MailjetResponse response;\n client = new MailjetClient(System.getenv(\"MJ_APIKEY_PUBLIC\"), System.getenv(\"MJ_APIKEY_PRIVATE\"), new ClientOptions(\"v3\"));\n request = new MailjetRequest(Contactdata.resource, ID)\n .property(Contactdata.DATA, new JSONArray()\n .put(new JSONObject()\n .put(\"Name\", \"first_name\")\n .put(\"Value\", \"John\")\n )\n )\n );\n response = client.put(request);\n System.out.println(response.getStatus());\n System.out.println(response.getData());\n }\n}"
- lang: Go
label: Go
source: "package main\nimport (\n\t\"fmt\"\n\t\"log\"\n\t\"os\"\n\tmailjet \"github.com/mailjet/mailjet-apiv3-go\"\n\t\"github.com/mailjet/mailjet-apiv3-go/resources\"\n)\nfunc main () {\n\tmailjetClient := NewMailjetClient(os.Getenv(\"MJ_APIKEY_PUBLIC\"), os.Getenv(\"MJ_APIKEY_PRIVATE\"))\n\tmr := &Request{\n\t Resource: \"contactdata\",\n\t ID: RESOURCE_ID,\n\t}\n\tfmr := &FullRequest{\n\t Info: mr,\n\t Payload: &resources.Contactdata { \n Data: []MailjetDat {\n MailjetDat {\n Name:\"first_name\",\n Value:\"John\"\n }\n }\n }\n\t}\n\terr := mailjetClient.Put(fmr)\n\tif err != nil {\n\t fmt.Println(err)\n\t}\n}"
- lang: C#
label: C#
source: "using Mailjet.Client;\nusing Mailjet.Client.Resources;\nusing System;\nusing Newtonsoft.Json.Linq;\nnamespace Mailjet.ConsoleApplication\n{\n class Program\n {\n static void Main(string[] args)\n {\n RunAsync().Wait();\n }\n static async Task RunAsync()\n {\n MailjetClient client = new MailjetClient(Environment.GetEnvironmentVariable(\"MJ_APIKEY_PUBLIC\"), Environment.GetEnvironmentVariable(\"MJ_APIKEY_PRIVATE\"))\n {\n Version = ApiVersion.V3,\n };\n MailjetRequest request = new MailjetRequest\n {\n Resource = Contactdata.Resource,\n ResourceId = ResourceId.Numeric(ID)\n }\n .Property(Contactdata.Data, new JArray {\n new JObject {\n {\"Name\", \"first_name\"},\n {\"Value\", \"John\"}\n }\n });\n MailjetResponse response = await client.PutAsync(request);\n if (response.IsSuccessStatusCode)\n {\n Console.WriteLine(string.Format(\"Total: {0}, Count: {1}\\n\", response.GetTotal(), response.GetCount()));\n Console.WriteLine(response.GetData());\n }\n else\n {\n Console.WriteLine(string.Format(\"StatusCode: {0}\\n\", response.StatusCode));\n Console.WriteLine(string.Format(\"ErrorInfo: {0}\\n\", response.GetErrorInfo()));\n Console.WriteLine(response.GetData());\n Console.WriteLine(string.Format(\"ErrorMessage: {0}\\n\", response.GetErrorMessage()));\n }\n }\n }\n}"
delete:
x-seo:
title: "Delete Contact Data"
description: "Delete Contact Data in the Mailjet Email API. Delete all contact property values relating to a specific contact."
tags:
- Contacts
summary: Delete Contact Data
description: Delete all contact property values relating to a specific contact.
operationId: delete_v3_contactdata_id
parameters:
- name: contact_ID
in: path
schema:
$ref: '#/components/schemas/delete_v3_contactdata_id_PathParams/properties/contact_ID'
required: true
responses:
'204':
$ref: '#/components/responses/204'
'400':
$ref: '#/components/responses/400'
'401':
$ref: '#/components/responses/401'
'403':
$ref: '#/components/responses/403'
'404':
$ref: '#/components/responses/404'
'429':
$ref: '#/components/responses/429'
'500':
$ref: '#/components/responses/500'
security:
- basicAuth: []
x-codeSamples:
- lang: curl
label: cURL
source: "curl -s \\\n\t-X DELETE \\\n\t--user \"$MJ_APIKEY_PUBLIC:$MJ_APIKEY_PRIVATE\" \\\n\thttps://api.mailjet.com/v3/REST/contactdata/$contact_ID \\\n\t-H 'Content-Type: application/json' \\\n\t-d '{\n\t}'"
- lang: PHP
label: PHP
source: " 'v3']);\n$response = $mj->delete(Resources::$Contactdata, ['id' => $id]);\n$response->success() && var_dump($response->getData());\n?>"
- lang: Node.js
label: Node
source: "const mailjet = require ('node-mailjet')\n\t.connect(process.env.MJ_APIKEY_PUBLIC, process.env.MJ_APIKEY_PRIVATE)\nconst request = mailjet\n\t.delete(\"contactdata\", {'version': 'v3'})\n\t.id($contact_ID)\n\t.request()\nrequest\n\t.then((result) => {\n\t\tconsole.log(result.body)\n\t})\n\t.catch((err) => {\n\t\tconsole.log(err.statusCode)\n\t})"
- lang: Ruby
label: Ruby
source: "require 'mailjet'\nMailjet.configure do |config|\n config.api_key = ENV['MJ_APIKEY_PUBLIC']\n config.secret_key = ENV['MJ_APIKEY_PRIVATE']\n config.api_version = \"v3\"\nend\ntarget = Mailjet::Contactdata.find($contact_ID)\ntarget.delete(\n)\np variable.attributes['Data']"
- lang: Python
label: Python
source: "from mailjet_rest import Client\nimport os\napi_key = os.environ['MJ_APIKEY_PUBLIC']\napi_secret = os.environ['MJ_APIKEY_PRIVATE']\nmailjet = Client(auth=(api_key, api_secret), version='v3')\nid = '$contact_ID'\nresult = mailjet.contactdata.delete(id=id)\nprint result.status_code\nprint result.json()"
- lang: Java
label: Java
source: "package com.my.project;\nimport com.mailjet.client.errors.MailjetException;\nimport com.mailjet.client.errors.MailjetSocketTimeoutException;\nimport com.mailjet.client.MailjetClient;\nimport com.mailjet.client.MailjetRequest;\nimport com.mailjet.client.MailjetResponse;\nimport com.mailjet.client.ClientOptions;\nimport com.mailjet.client.resource.Contactdata;\nimport org.json.JSONArray;\nimport org.json.JSONObject;\npublic class MyClass {\n public static void main(String[] args) throws MailjetException, MailjetSocketTimeoutException {\n MailjetClient client;\n MailjetRequest request;\n MailjetResponse response;\n client = new MailjetClient(System.getenv(\"MJ_APIKEY_PUBLIC\"), System.getenv(\"MJ_APIKEY_PRIVATE\"), new ClientOptions(\"v3\"));\n request = new MailjetRequest(Contactdata.resource, ID);\n response = client.delete(request);\n System.out.println(response.getStatus());\n System.out.println(response.getData());\n }\n}"
- lang: Go
label: Go
source: "package main\nimport (\n\t\"fmt\"\n\t\"log\"\n\t\"os\"\n\tmailjet \"github.com/mailjet/mailjet-apiv3-go\"\n\t\"github.com/mailjet/mailjet-apiv3-go/resources\"\n)\nfunc main () {\n\tmailjetClient := NewMailjetClient(os.Getenv(\"MJ_APIKEY_PUBLIC\"), os.Getenv(\"MJ_APIKEY_PRIVATE\"))\n\tmr := &Request{\n\t Resource: \"contactdata\",\n\t ID: RESOURCE_ID,\n\t}\n\terr := mailjetClient.Delete(mr)\n\tif err != nil {\n\t fmt.Println(err)\n\t}\n}"
- lang: C#
label: C#
source: "using Mailjet.Client;\nusing Mailjet.Client.Resources;\nusing System;\nusing Newtonsoft.Json.Linq;\nnamespace Mailjet.ConsoleApplication\n{\n class Program\n {\n static void Main(string[] args)\n {\n RunAsync().Wait();\n }\n static async Task RunAsync()\n {\n MailjetClient client = new MailjetClient(Environment.GetEnvironmentVariable(\"MJ_APIKEY_PUBLIC\"), Environment.GetEnvironmentVariable(\"MJ_APIKEY_PRIVATE\"))\n {\n Version = ApiVersion.V3,\n };\n MailjetRequest request = new MailjetRequest\n {\n Resource = Contactdata.Resource,\n ResourceId = ResourceId.Numeric(ID)\n }\n MailjetResponse response = await client.DeleteAsync(request);\n if (response.IsSuccessStatusCode)\n {\n Console.WriteLine(string.Format(\"Total: {0}, Count: {1}\\n\", response.GetTotal(), response.GetCount()));\n Console.WriteLine(response.GetData());\n }\n else\n {\n Console.WriteLine(string.Format(\"StatusCode: {0}\\n\", response.StatusCode));\n Console.WriteLine(string.Format(\"ErrorInfo: {0}\\n\", response.GetErrorInfo()));\n Console.WriteLine(response.GetData());\n Console.WriteLine(string.Format(\"ErrorMessage: {0}\\n\", response.GetErrorMessage()));\n }\n }\n }\n}"
"/v3/REST/contactslist":
get:
x-seo:
title: "List Contact Lists"
description: "List Contact Lists in the Mailjet Email API. Retrieve details for all contact lists - name, subscriber count, creation timestamp, deletion status."
tags:
- Contacts
summary: List Contact Lists
description: Retrieve details for all contact lists - name, subscriber count, creation timestamp, deletion status.
operationId: get_v3_contactslist
parameters:
- name: Address
in: query
schema:
$ref: '#/components/schemas/get_v3_contactslist_QueryParams/properties/Address'
- name: ExcludeID
in: query
schema:
$ref: '#/components/schemas/get_v3_contactslist_QueryParams/properties/ExcludeID'
- name: IsDeleted
in: query
schema:
$ref: '#/components/schemas/get_v3_contactslist_QueryParams/properties/IsDeleted'
- name: Name
in: query
schema:
$ref: '#/components/schemas/get_v3_contactslist_QueryParams/properties/Name'
responses:
'200':
description: Default OK response for `/contactslist`
content:
application/json:
schema:
type: object
properties:
Count:
description: Indicates the number of objects in the `Data` array.
type: integer
format: int64
examples:
- 1
Data:
description: A JSON array containing a list of objects returned by this endpoint.
type: array
items:
$ref: '#/components/schemas/OutputContactslist'
Total:
description: Indicates the number of objects in the `Data` array.
type: integer
format: int64
examples:
- 1
'400':
$ref: '#/components/responses/400'
'401':
$ref: '#/components/responses/401'
'403':
$ref: '#/components/responses/403'
'404':
$ref: '#/components/responses/404'
'429':
$ref: '#/components/responses/429'
'500':
$ref: '#/components/responses/500'
security:
- basicAuth: []
x-codeSamples:
- lang: curl
label: cURL
source: "curl -s \\\n\t-X GET \\\n\t--user \"$MJ_APIKEY_PUBLIC:$MJ_APIKEY_PRIVATE\" \\\n\thttps://api.mailjet.com/v3/REST/contactslist \\"
- lang: PHP
label: PHP
source: " 'v3']);\n$response = $mj->get(Resources::$Contactslist);\n$response->success() && var_dump($response->getData());\n?>"
- lang: Node.js
label: Node
source: "const mailjet = require ('node-mailjet')\n\t.connect(process.env.MJ_APIKEY_PUBLIC, process.env.MJ_APIKEY_PRIVATE)\nconst request = mailjet\n\t.get(\"contactslist\", {'version': 'v3'})\n\t.request()\nrequest\n\t.then((result) => {\n\t\tconsole.log(result.body)\n\t})\n\t.catch((err) => {\n\t\tconsole.log(err.statusCode)\n\t})"
- lang: Ruby
label: Ruby
source: "require 'mailjet'\nMailjet.configure do |config|\n config.api_key = ENV['MJ_APIKEY_PUBLIC']\n config.secret_key = ENV['MJ_APIKEY_PRIVATE']\n config.api_version = \"v3\"\nend\nvariable = Mailjet::Contactslist.all(\n)\np variable.attributes['Data']"
- lang: Python
label: Python
source: "from mailjet_rest import Client\nimport os\napi_key = os.environ['MJ_APIKEY_PUBLIC']\napi_secret = os.environ['MJ_APIKEY_PRIVATE']\nmailjet = Client(auth=(api_key, api_secret), version='v3')\nresult = mailjet.contactslist.get()\nprint result.status_code\nprint result.json()"
- lang: Java
label: Java
source: "package com.my.project;\nimport com.mailjet.client.errors.MailjetException;\nimport com.mailjet.client.errors.MailjetSocketTimeoutException;\nimport com.mailjet.client.MailjetClient;\nimport com.mailjet.client.MailjetRequest;\nimport com.mailjet.client.MailjetResponse;\nimport com.mailjet.client.ClientOptions;\nimport com.mailjet.client.resource.Contactslist;\nimport org.json.JSONArray;\nimport org.json.JSONObject;\npublic class MyClass {\n public static void main(String[] args) throws MailjetException, MailjetSocketTimeoutException {\n MailjetClient client;\n MailjetRequest request;\n MailjetResponse response;\n client = new MailjetClient(System.getenv(\"MJ_APIKEY_PUBLIC\"), System.getenv(\"MJ_APIKEY_PRIVATE\"), new ClientOptions(\"v3\"));\n request = new MailjetRequest(Contactslist.resource);\n response = client.get(request);\n System.out.println(response.getStatus());\n System.out.println(response.getData());\n }\n}"
- lang: Go
label: Go
source: "package main\nimport (\n\t\"fmt\"\n\t\"log\"\n\t\"os\"\n\tmailjet \"github.com/mailjet/mailjet-apiv3-go\"\n\t\"github.com/mailjet/mailjet-apiv3-go/resources\"\n)\nfunc main () {\n\tmailjetClient := NewMailjetClient(os.Getenv(\"MJ_APIKEY_PUBLIC\"), os.Getenv(\"MJ_APIKEY_PRIVATE\"))\n\tvar data []resources.Contactslist\n\t_, _, err := mailjetClient.List(\"contactslist\", &data)\n\tif err != nil {\n\t fmt.Println(err)\n\t}\n\tfmt.Printf(\"Data array: %+v\\n\", data)\n}"
- lang: C#
label: C#
source: "using Mailjet.Client;\nusing Mailjet.Client.Resources;\nusing System;\nusing Newtonsoft.Json.Linq;\nnamespace Mailjet.ConsoleApplication\n{\n class Program\n {\n static void Main(string[] args)\n {\n RunAsync().Wait();\n }\n static async Task RunAsync()\n {\n MailjetClient client = new MailjetClient(Environment.GetEnvironmentVariable(\"MJ_APIKEY_PUBLIC\"), Environment.GetEnvironmentVariable(\"MJ_APIKEY_PRIVATE\"))\n {\n Version = ApiVersion.V3,\n };\n MailjetRequest request = new MailjetRequest\n {\n Resource = Contactslist.Resource,\n }\n MailjetResponse response = await client.GetAsync(request);\n if (response.IsSuccessStatusCode)\n {\n Console.WriteLine(string.Format(\"Total: {0}, Count: {1}\\n\", response.GetTotal(), response.GetCount()));\n Console.WriteLine(response.GetData());\n }\n else\n {\n Console.WriteLine(string.Format(\"StatusCode: {0}\\n\", response.StatusCode));\n Console.WriteLine(string.Format(\"ErrorInfo: {0}\\n\", response.GetErrorInfo()));\n Console.WriteLine(response.GetData());\n Console.WriteLine(string.Format(\"ErrorMessage: {0}\\n\", response.GetErrorMessage()));\n }\n }\n }\n}"
post:
x-seo:
title: "Create Contact List"
description: "Create Contact List using the Mailjet Email API. Create a new contact list."
tags:
- Contacts
summary: Create Contact List
description: Create a new contact list.
operationId: post_v3_contactslist
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/NewContactslist'
example:
Name: Example List
responses:
'201':
description: Default OK response for `/contactslist`
content:
application/json:
schema:
type: object
properties:
Count:
description: Indicates the number of objects in the `Data` array.
type: integer
format: int64
examples:
- 1
Data:
description: A JSON array containing a list of objects returned by this endpoint.
type: array
items:
$ref: '#/components/schemas/OutputContactslist'
Total:
description: Indicates the number of objects in the `Data` array.
type: integer
format: int64
examples:
- 1
'400':
$ref: '#/components/responses/400'
'401':
$ref: '#/components/responses/401'
'403':
$ref: '#/components/responses/403'
'404':
$ref: '#/components/responses/404'
'429':
$ref: '#/components/responses/429'
'500':
$ref: '#/components/responses/500'
security:
- basicAuth: []
x-codeSamples:
- lang: curl
label: cURL
source: "curl -s \\\n\t-X POST \\\n\t--user \"$MJ_APIKEY_PUBLIC:$MJ_APIKEY_PRIVATE\" \\\n\thttps://api.mailjet.com/v3/REST/contactslist \\\n\t-H 'Content-Type: application/json' \\\n\t-d '{\n \"Name\":\"my_contactslist\"\n\t}'"
- lang: PHP
label: PHP
source: " 'v3']);\n$body = [\n 'Name' => \"my_contactslist\"\n];\n$response = $mj->post(Resources::$Contactslist, ['body' => $body]);\n$response->success() && var_dump($response->getData());\n?>"
- lang: Node.js
label: Node
source: "const mailjet = require ('node-mailjet')\n\t.connect(process.env.MJ_APIKEY_PUBLIC, process.env.MJ_APIKEY_PRIVATE)\nconst request = mailjet\n\t.post(\"contactslist\", {'version': 'v3'})\n\t.request({\n \"Name\":\"my_contactslist\"\n })\nrequest\n\t.then((result) => {\n\t\tconsole.log(result.body)\n\t})\n\t.catch((err) => {\n\t\tconsole.log(err.statusCode)\n\t})"
- lang: Ruby
label: Ruby
source: "require 'mailjet'\nMailjet.configure do |config|\n config.api_key = ENV['MJ_APIKEY_PUBLIC']\n config.secret_key = ENV['MJ_APIKEY_PRIVATE']\n config.api_version = \"v3\"\nend\nvariable = Mailjet::Contactslist.create(\n name: \"my_contactslist\"\n)\np variable.attributes['Data']"
- lang: Python
label: Python
source: "from mailjet_rest import Client\nimport os\napi_key = os.environ['MJ_APIKEY_PUBLIC']\napi_secret = os.environ['MJ_APIKEY_PRIVATE']\nmailjet = Client(auth=(api_key, api_secret), version='v3')\ndata = {\n 'Name': \"my_contactslist\"\n}\nresult = mailjet.contactslist.create(data=data)\nprint result.status_code\nprint result.json()"
- lang: Java
label: Java
source: "package com.my.project;\nimport com.mailjet.client.errors.MailjetException;\nimport com.mailjet.client.errors.MailjetSocketTimeoutException;\nimport com.mailjet.client.MailjetClient;\nimport com.mailjet.client.MailjetRequest;\nimport com.mailjet.client.MailjetResponse;\nimport com.mailjet.client.ClientOptions;\nimport com.mailjet.client.resource.Contactslist;\nimport org.json.JSONArray;\nimport org.json.JSONObject;\npublic class MyClass {\n public static void main(String[] args) throws MailjetException, MailjetSocketTimeoutException {\n MailjetClient client;\n MailjetRequest request;\n MailjetResponse response;\n client = new MailjetClient(System.getenv(\"MJ_APIKEY_PUBLIC\"), System.getenv(\"MJ_APIKEY_PRIVATE\"), new ClientOptions(\"v3\"));\n request = new MailjetRequest(Contactslist.resource)\n .property(Contactslist.NAME, \"my_contactslist\")\n );\n response = client.post(request);\n System.out.println(response.getStatus());\n System.out.println(response.getData());\n }\n}"
- lang: Go
label: Go
source: "package main\nimport (\n\t\"fmt\"\n\t\"log\"\n\t\"os\"\n\tmailjet \"github.com/mailjet/mailjet-apiv3-go\"\n\t\"github.com/mailjet/mailjet-apiv3-go/resources\"\n)\nfunc main () {\n\tmailjetClient := NewMailjetClient(os.Getenv(\"MJ_APIKEY_PUBLIC\"), os.Getenv(\"MJ_APIKEY_PRIVATE\"))\n\tvar data []resources.Contactslist\n\tmr := &Request{\n\t Resource: \"contactslist\",\n\t}\n\tfmr := &FullRequest{\n\t Info: mr,\n\t Payload: &resources.Contactslist { \n\t Name:\"my_contactslist\"\n }\n\t}\n\terr := mailjetClient.Post(fmr, &data)\n\tif err != nil {\n\t fmt.Println(err)\n\t}\n\tfmt.Printf(\"Data array: %+v\\n\", data)\n}"
- lang: C#
label: C#
source: "using Mailjet.Client;\nusing Mailjet.Client.Resources;\nusing System;\nusing Newtonsoft.Json.Linq;\nnamespace Mailjet.ConsoleApplication\n{\n class Program\n {\n static void Main(string[] args)\n {\n RunAsync().Wait();\n }\n static async Task RunAsync()\n {\n MailjetClient client = new MailjetClient(Environment.GetEnvironmentVariable(\"MJ_APIKEY_PUBLIC\"), Environment.GetEnvironmentVariable(\"MJ_APIKEY_PRIVATE\"))\n {\n Version = ApiVersion.V3,\n };\n MailjetRequest request = new MailjetRequest\n {\n Resource = Contactslist.Resource,\n }\n .Property(Contactslist.Name, \"my_contactslist\");\n MailjetResponse response = await client.PostAsync(request);\n if (response.IsSuccessStatusCode)\n {\n Console.WriteLine(string.Format(\"Total: {0}, Count: {1}\\n\", response.GetTotal(), response.GetCount()));\n Console.WriteLine(response.GetData());\n }\n else\n {\n Console.WriteLine(string.Format(\"StatusCode: {0}\\n\", response.StatusCode));\n Console.WriteLine(string.Format(\"ErrorInfo: {0}\\n\", response.GetErrorInfo()));\n Console.WriteLine(response.GetData());\n Console.WriteLine(string.Format(\"ErrorMessage: {0}\\n\", response.GetErrorMessage()));\n }\n }\n }\n}"
/v3/REST/contactslist/{list_ID}:
get:
x-seo:
title: "Contact List by ID"
description: "Contact List by ID in the Mailjet Email API. Retrieve details for a specific contact list - name, subscriber count, creation timestamp, deletion status."
tags:
- Contacts
summary: Contact List by ID
description: Retrieve details for a specific contact list - name, subscriber count, creation timestamp, deletion status. To obtain a valid `list_ID`, first call `GET /v3/REST/contactslist` to list your contact lists.
operationId: get_v3_contactslist_id
parameters:
- name: list_ID
in: path
schema:
$ref: '#/components/schemas/get_v3_contactslist_id_PathParams/properties/list_ID'
required: true
example: 2000
responses:
'200':
description: Default OK response for `/contactslist`
content:
application/json:
schema:
type: object
properties:
Count:
description: Indicates the number of objects in the `Data` array.
type: integer
format: int64
examples:
- 1
Data:
description: A JSON array containing a list of objects returned by this endpoint.
type: array
items:
$ref: '#/components/schemas/OutputContactslist'
Total:
description: Indicates the number of objects in the `Data` array.
type: integer
format: int64
examples:
- 1
'400':
$ref: '#/components/responses/400'
'401':
$ref: '#/components/responses/401'
'403':
$ref: '#/components/responses/403'
'404':
$ref: '#/components/responses/404'
'429':
$ref: '#/components/responses/429'
'500':
$ref: '#/components/responses/500'
security:
- basicAuth: []
x-codeSamples:
- lang: curl
label: cURL
source: "curl -s \\\n\t-X GET \\\n\t--user \"$MJ_APIKEY_PUBLIC:$MJ_APIKEY_PRIVATE\" \\\n\thttps://api.mailjet.com/v3/REST/contactslist/$list_ID \\"
- lang: PHP
label: PHP
source: " 'v3']);\n$response = $mj->get(Resources::$Contactslist, ['id' => $id]);\n$response->success() && var_dump($response->getData());\n?>"
- lang: Node.js
label: Node
source: "const mailjet = require ('node-mailjet')\n\t.connect(process.env.MJ_APIKEY_PUBLIC, process.env.MJ_APIKEY_PRIVATE)\nconst request = mailjet\n\t.get(\"contactslist\", {'version': 'v3'})\n\t.id($list_ID)\n\t.request()\nrequest\n\t.then((result) => {\n\t\tconsole.log(result.body)\n\t})\n\t.catch((err) => {\n\t\tconsole.log(err.statusCode)\n\t})"
- lang: Ruby
label: Ruby
source: "require 'mailjet'\nMailjet.configure do |config|\n config.api_key = ENV['MJ_APIKEY_PUBLIC']\n config.secret_key = ENV['MJ_APIKEY_PRIVATE']\n config.api_version = \"v3\"\nend\nvariable = Mailjet::Contactslist.find($list_ID\n)\np variable.attributes['Data']"
- lang: Python
label: Python
source: "from mailjet_rest import Client\nimport os\napi_key = os.environ['MJ_APIKEY_PUBLIC']\napi_secret = os.environ['MJ_APIKEY_PRIVATE']\nmailjet = Client(auth=(api_key, api_secret), version='v3')\nid = '$list_ID'\nresult = mailjet.contactslist.get(id=id)\nprint result.status_code\nprint result.json()"
- lang: Java
label: Java
source: "package com.my.project;\nimport com.mailjet.client.errors.MailjetException;\nimport com.mailjet.client.errors.MailjetSocketTimeoutException;\nimport com.mailjet.client.MailjetClient;\nimport com.mailjet.client.MailjetRequest;\nimport com.mailjet.client.MailjetResponse;\nimport com.mailjet.client.ClientOptions;\nimport com.mailjet.client.resource.Contactslist;\nimport org.json.JSONArray;\nimport org.json.JSONObject;\npublic class MyClass {\n public static void main(String[] args) throws MailjetException, MailjetSocketTimeoutException {\n MailjetClient client;\n MailjetRequest request;\n MailjetResponse response;\n client = new MailjetClient(System.getenv(\"MJ_APIKEY_PUBLIC\"), System.getenv(\"MJ_APIKEY_PRIVATE\"), new ClientOptions(\"v3\"));\n request = new MailjetRequest(Contactslist.resource, ID);\n response = client.get(request);\n System.out.println(response.getStatus());\n System.out.println(response.getData());\n }\n}"
- lang: Go
label: Go
source: "package main\nimport (\n\t\"fmt\"\n\t\"log\"\n\t\"os\"\n\tmailjet \"github.com/mailjet/mailjet-apiv3-go\"\n\t\"github.com/mailjet/mailjet-apiv3-go/resources\"\n)\nfunc main () {\n\tmailjetClient := NewMailjetClient(os.Getenv(\"MJ_APIKEY_PUBLIC\"), os.Getenv(\"MJ_APIKEY_PRIVATE\"))\n\tvar data []resources.Contactslist\n\tmr := &Request{\n\t Resource: \"contactslist\",\n\t ID: RESOURCE_ID,\n\t}\n\terr := mailjetClient.Get(mr, &data)\n\tif err != nil {\n\t fmt.Println(err)\n\t}\n\tfmt.Printf(\"Data array: %+v\\n\", data)\n}"
- lang: C#
label: C#
source: "using Mailjet.Client;\nusing Mailjet.Client.Resources;\nusing System;\nusing Newtonsoft.Json.Linq;\nnamespace Mailjet.ConsoleApplication\n{\n class Program\n {\n static void Main(string[] args)\n {\n RunAsync().Wait();\n }\n static async Task RunAsync()\n {\n MailjetClient client = new MailjetClient(Environment.GetEnvironmentVariable(\"MJ_APIKEY_PUBLIC\"), Environment.GetEnvironmentVariable(\"MJ_APIKEY_PRIVATE\"))\n {\n Version = ApiVersion.V3,\n };\n MailjetRequest request = new MailjetRequest\n {\n Resource = Contactslist.Resource,\n ResourceId = ResourceId.Numeric(ID)\n }\n MailjetResponse response = await client.GetAsync(request);\n if (response.IsSuccessStatusCode)\n {\n Console.WriteLine(string.Format(\"Total: {0}, Count: {1}\\n\", response.GetTotal(), response.GetCount()));\n Console.WriteLine(response.GetData());\n }\n else\n {\n Console.WriteLine(string.Format(\"StatusCode: {0}\\n\", response.StatusCode));\n Console.WriteLine(string.Format(\"ErrorInfo: {0}\\n\", response.GetErrorInfo()));\n Console.WriteLine(response.GetData());\n Console.WriteLine(string.Format(\"ErrorMessage: {0}\\n\", response.GetErrorMessage()));\n }\n }\n }\n}"
put:
x-seo:
title: "Update Contact List"
description: "Update a specific contact list by changing its name and / or deletion status. Using PUT you can delete lists, as well as reinstate previously deleted ones."
tags:
- Contacts
summary: Update Contact List
description: Update a specific contact list by changing its name and / or deletion status. Using PUT you can delete lists, as well as reinstate previously deleted ones. To obtain a valid `list_ID`, first call `GET /v3/REST/contactslist` to list your contact lists.
operationId: put_v3_contactslist_id
parameters:
- name: list_ID
in: path
schema:
$ref: '#/components/schemas/put_v3_contactslist_id_PathParams/properties/list_ID'
required: true
example: 2000
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/UpdateContactslist'
example:
Name: Example List
IsDeleted: false
responses:
'200':
description: Default OK response for `/contactslist`
content:
application/json:
schema:
type: object
properties:
Count:
description: Indicates the number of objects in the `Data` array.
type: integer
format: int64
examples:
- 1
Data:
description: A JSON array containing a list of objects returned by this endpoint.
type: array
items:
$ref: '#/components/schemas/OutputContactslist'
Total:
description: Indicates the number of objects in the `Data` array.
type: integer
format: int64
examples:
- 1
'400':
$ref: '#/components/responses/400'
'401':
$ref: '#/components/responses/401'
'403':
$ref: '#/components/responses/403'
'404':
$ref: '#/components/responses/404'
'429':
$ref: '#/components/responses/429'
'500':
$ref: '#/components/responses/500'
security:
- basicAuth: []
x-codeSamples:
- lang: curl
label: cURL
source: "curl -s \\\n\t-X PUT \\\n\t--user \"$MJ_APIKEY_PUBLIC:$MJ_APIKEY_PRIVATE\" \\\n\thttps://api.mailjet.com/v3/REST/contactslist/$list_ID \\\n\t-H 'Content-Type: application/json' \\\n\t-d '{\n \"Name\":\"my_contactslist\"\n\t}'"
- lang: PHP
label: PHP
source: " 'v3']);\n$body = [\n 'Name' => \"my_contactslist\"\n];\n$response = $mj->put(Resources::$Contactslist, ['id' => $id, 'body' => $body]);\n$response->success() && var_dump($response->getData());\n?>"
- lang: Node.js
label: Node
source: "const mailjet = require ('node-mailjet')\n\t.connect(process.env.MJ_APIKEY_PUBLIC, process.env.MJ_APIKEY_PRIVATE)\nconst request = mailjet\n\t.put(\"contactslist\", {'version': 'v3'})\n\t.id($list_ID)\n\t.request({\n \"Name\":\"my_contactslist\"\n })\nrequest\n\t.then((result) => {\n\t\tconsole.log(result.body)\n\t})\n\t.catch((err) => {\n\t\tconsole.log(err.statusCode)\n\t})"
- lang: Ruby
label: Ruby
source: "require 'mailjet'\nMailjet.configure do |config|\n config.api_key = ENV['MJ_APIKEY_PUBLIC']\n config.secret_key = ENV['MJ_APIKEY_PRIVATE']\n config.api_version = \"v3\"\nend\ntarget = Mailjet::Contactslist.find($list_ID)\ntarget.update_attributes(\n name: \"my_contactslist\"\n)\np variable.attributes['Data']"
- lang: Python
label: Python
source: "from mailjet_rest import Client\nimport os\napi_key = os.environ['MJ_APIKEY_PUBLIC']\napi_secret = os.environ['MJ_APIKEY_PRIVATE']\nmailjet = Client(auth=(api_key, api_secret), version='v3')\nid = '$list_ID'\ndata = {\n 'Name': \"my_contactslist\"\n}\nresult = mailjet.contactslist.update(id=id, data=data)\nprint result.status_code\nprint result.json()"
- lang: Java
label: Java
source: "package com.my.project;\nimport com.mailjet.client.errors.MailjetException;\nimport com.mailjet.client.errors.MailjetSocketTimeoutException;\nimport com.mailjet.client.MailjetClient;\nimport com.mailjet.client.MailjetRequest;\nimport com.mailjet.client.MailjetResponse;\nimport com.mailjet.client.ClientOptions;\nimport com.mailjet.client.resource.Contactslist;\nimport org.json.JSONArray;\nimport org.json.JSONObject;\npublic class MyClass {\n public static void main(String[] args) throws MailjetException, MailjetSocketTimeoutException {\n MailjetClient client;\n MailjetRequest request;\n MailjetResponse response;\n client = new MailjetClient(System.getenv(\"MJ_APIKEY_PUBLIC\"), System.getenv(\"MJ_APIKEY_PRIVATE\"), new ClientOptions(\"v3\"));\n request = new MailjetRequest(Contactslist.resource, ID)\n .property(Contactslist.NAME, \"my_contactslist\")\n );\n response = client.put(request);\n System.out.println(response.getStatus());\n System.out.println(response.getData());\n }\n}"
- lang: Go
label: Go
source: "package main\nimport (\n\t\"fmt\"\n\t\"log\"\n\t\"os\"\n\tmailjet \"github.com/mailjet/mailjet-apiv3-go\"\n\t\"github.com/mailjet/mailjet-apiv3-go/resources\"\n)\nfunc main () {\n\tmailjetClient := NewMailjetClient(os.Getenv(\"MJ_APIKEY_PUBLIC\"), os.Getenv(\"MJ_APIKEY_PRIVATE\"))\n\tmr := &Request{\n\t Resource: \"contactslist\",\n\t ID: RESOURCE_ID,\n\t}\n\tfmr := &FullRequest{\n\t Info: mr,\n\t Payload: &resources.Contactslist { \n\t Name:\"my_contactslist\"\n }\n\t}\n\terr := mailjetClient.Put(fmr)\n\tif err != nil {\n\t fmt.Println(err)\n\t}\n}"
- lang: C#
label: C#
source: "using Mailjet.Client;\nusing Mailjet.Client.Resources;\nusing System;\nusing Newtonsoft.Json.Linq;\nnamespace Mailjet.ConsoleApplication\n{\n class Program\n {\n static void Main(string[] args)\n {\n RunAsync().Wait();\n }\n static async Task RunAsync()\n {\n MailjetClient client = new MailjetClient(Environment.GetEnvironmentVariable(\"MJ_APIKEY_PUBLIC\"), Environment.GetEnvironmentVariable(\"MJ_APIKEY_PRIVATE\"))\n {\n Version = ApiVersion.V3,\n };\n MailjetRequest request = new MailjetRequest\n {\n Resource = Contactslist.Resource,\n ResourceId = ResourceId.Numeric(ID)\n }\n .Property(Contactslist.Name, \"my_contactslist\");\n MailjetResponse response = await client.PutAsync(request);\n if (response.IsSuccessStatusCode)\n {\n Console.WriteLine(string.Format(\"Total: {0}, Count: {1}\\n\", response.GetTotal(), response.GetCount()));\n Console.WriteLine(response.GetData());\n }\n else\n {\n Console.WriteLine(string.Format(\"StatusCode: {0}\\n\", response.StatusCode));\n Console.WriteLine(string.Format(\"ErrorInfo: {0}\\n\", response.GetErrorInfo()));\n Console.WriteLine(response.GetData());\n Console.WriteLine(string.Format(\"ErrorMessage: {0}\\n\", response.GetErrorMessage()));\n }\n }\n }\n}"
delete:
x-seo:
title: "Delete Contact List"
description: "Delete a contact list. The ContactsList object will continue to exist with Deleted status for 30 days, and can be reinstated by changing the value of\u2026"
tags:
- Contacts
summary: Delete Contact List
description: Delete a contact list. The ContactsList object will continue to exist with Deleted status for 30 days, and can be reinstated by changing the value of IsDeleted to false via `PUT /contactslist/{list_ID}`.
operationId: delete_v3_contactslist_id
parameters:
- name: list_ID
in: path
schema:
$ref: '#/components/schemas/delete_v3_contactslist_id_PathParams/properties/list_ID'
required: true
responses:
'204':
$ref: '#/components/responses/204'
'400':
$ref: '#/components/responses/400'
'401':
$ref: '#/components/responses/401'
'403':
$ref: '#/components/responses/403'
'404':
$ref: '#/components/responses/404'
'429':
$ref: '#/components/responses/429'
'500':
$ref: '#/components/responses/500'
security:
- basicAuth: []
x-codeSamples:
- lang: curl
label: cURL
source: "curl -s \\\n\t-X DELETE \\\n\t--user \"$MJ_APIKEY_PUBLIC:$MJ_APIKEY_PRIVATE\" \\\n\thttps://api.mailjet.com/v3/REST/contactslist/$list_ID \\\n\t-H 'Content-Type: application/json' \\\n\t-d '{\n\t}'"
- lang: PHP
label: PHP
source: " 'v3']);\n$response = $mj->delete(Resources::$Contactslist, ['id' => $id]);\n$response->success() && var_dump($response->getData());\n?>"
- lang: Node.js
label: Node
source: "const mailjet = require ('node-mailjet')\n\t.connect(process.env.MJ_APIKEY_PUBLIC, process.env.MJ_APIKEY_PRIVATE)\nconst request = mailjet\n\t.delete(\"contactslist\", {'version': 'v3'})\n\t.id($list_ID)\n\t.request()\nrequest\n\t.then((result) => {\n\t\tconsole.log(result.body)\n\t})\n\t.catch((err) => {\n\t\tconsole.log(err.statusCode)\n\t})"
- lang: Ruby
label: Ruby
source: "require 'mailjet'\nMailjet.configure do |config|\n config.api_key = ENV['MJ_APIKEY_PUBLIC']\n config.secret_key = ENV['MJ_APIKEY_PRIVATE']\n config.api_version = \"v3\"\nend\ntarget = Mailjet::Contactslist.find($list_ID)\ntarget.delete(\n)\np variable.attributes['Data']"
- lang: Python
label: Python
source: "from mailjet_rest import Client\nimport os\napi_key = os.environ['MJ_APIKEY_PUBLIC']\napi_secret = os.environ['MJ_APIKEY_PRIVATE']\nmailjet = Client(auth=(api_key, api_secret), version='v3')\nid = '$list_ID'\nresult = mailjet.contactslist.delete(id=id)\nprint result.status_code\nprint result.json()"
- lang: Java
label: Java
source: "package com.my.project;\nimport com.mailjet.client.errors.MailjetException;\nimport com.mailjet.client.errors.MailjetSocketTimeoutException;\nimport com.mailjet.client.MailjetClient;\nimport com.mailjet.client.MailjetRequest;\nimport com.mailjet.client.MailjetResponse;\nimport com.mailjet.client.ClientOptions;\nimport com.mailjet.client.resource.Contactslist;\nimport org.json.JSONArray;\nimport org.json.JSONObject;\npublic class MyClass {\n public static void main(String[] args) throws MailjetException, MailjetSocketTimeoutException {\n MailjetClient client;\n MailjetRequest request;\n MailjetResponse response;\n client = new MailjetClient(System.getenv(\"MJ_APIKEY_PUBLIC\"), System.getenv(\"MJ_APIKEY_PRIVATE\"), new ClientOptions(\"v3\"));\n request = new MailjetRequest(Contactslist.resource, ID);\n response = client.delete(request);\n System.out.println(response.getStatus());\n System.out.println(response.getData());\n }\n}"
- lang: Go
label: Go
source: "package main\nimport (\n\t\"fmt\"\n\t\"log\"\n\t\"os\"\n\tmailjet \"github.com/mailjet/mailjet-apiv3-go\"\n\t\"github.com/mailjet/mailjet-apiv3-go/resources\"\n)\nfunc main () {\n\tmailjetClient := NewMailjetClient(os.Getenv(\"MJ_APIKEY_PUBLIC\"), os.Getenv(\"MJ_APIKEY_PRIVATE\"))\n\tmr := &Request{\n\t Resource: \"contactslist\",\n\t ID: RESOURCE_ID,\n\t}\n\terr := mailjetClient.Delete(mr)\n\tif err != nil {\n\t fmt.Println(err)\n\t}\n}"
- lang: C#
label: C#
source: "using Mailjet.Client;\nusing Mailjet.Client.Resources;\nusing System;\nusing Newtonsoft.Json.Linq;\nnamespace Mailjet.ConsoleApplication\n{\n class Program\n {\n static void Main(string[] args)\n {\n RunAsync().Wait();\n }\n static async Task RunAsync()\n {\n MailjetClient client = new MailjetClient(Environment.GetEnvironmentVariable(\"MJ_APIKEY_PUBLIC\"), Environment.GetEnvironmentVariable(\"MJ_APIKEY_PRIVATE\"))\n {\n Version = ApiVersion.V3,\n };\n MailjetRequest request = new MailjetRequest\n {\n Resource = Contactslist.Resource,\n ResourceId = ResourceId.Numeric(ID)\n }\n MailjetResponse response = await client.DeleteAsync(request);\n if (response.IsSuccessStatusCode)\n {\n Console.WriteLine(string.Format(\"Total: {0}, Count: {1}\\n\", response.GetTotal(), response.GetCount()));\n Console.WriteLine(response.GetData());\n }\n else\n {\n Console.WriteLine(string.Format(\"StatusCode: {0}\\n\", response.StatusCode));\n Console.WriteLine(string.Format(\"ErrorInfo: {0}\\n\", response.GetErrorInfo()));\n Console.WriteLine(response.GetData());\n Console.WriteLine(string.Format(\"ErrorMessage: {0}\\n\", response.GetErrorMessage()));\n }\n }\n }\n}"
/v3/REST/contact/{contact_ID}/getcontactslists:
get:
x-seo:
title: "Get Contact: Get Contact Lists"
description: "Retrieve all contact lists for a specific contact. You will receive information on the status of the contact for each list. Information about lists\u2026"
tags:
- Contacts
summary: 'Get Contact: Get Contact Lists'
description: Retrieve all contact lists for a specific contact. You will receive information on the status of the contact for each list. Information about lists deleted within the last 60 days will be returned as well, since those are soft-deleted and can be reinstated. To obtain a valid `contact_ID`, first call `GET /v3/REST/contact` to list your contacts.
operationId: get_v3_contact_id_getcontactslists
parameters:
- name: contact_ID
in: path
schema:
$ref: '#/components/schemas/get_v3_contact_id_getcontactslists_PathParams/properties/contact_ID'
required: true
example: 1000
responses:
'200':
description: Default OK response for `/contact/{contact_ID}/getcontactslists`
content:
application/json:
schema:
type: object
properties:
Count:
description: Indicates the number of objects in the `Data` array.
type: integer
format: int64
examples:
- 1
Data:
description: A JSON array containing a list of objects returned by this endpoint.
type: array
items:
$ref: '#/components/schemas/OutputContactGetcontactslists'
Total:
description: Indicates the number of objects in the `Data` array.
type: integer
format: int64
examples:
- 1
'400':
$ref: '#/components/responses/400'
'401':
$ref: '#/components/responses/401'
'403':
$ref: '#/components/responses/403'
'404':
$ref: '#/components/responses/404'
'429':
$ref: '#/components/responses/429'
'500':
$ref: '#/components/responses/500'
security:
- basicAuth: []
x-codeSamples:
- lang: curl
label: cURL
source: "curl -s \\\n\t-X GET \\\n\t--user \"$MJ_APIKEY_PUBLIC:$MJ_APIKEY_PRIVATE\" \\\n\thttps://api.mailjet.com/v3/REST/contact/$contact_ID/getcontactslists \\"
- lang: PHP
label: PHP
source: " 'v3']);\n$response = $mj->get(Resources::$ContactGetcontactslists, ['id' => $id]);\n$response->success() && var_dump($response->getData());\n?>"
- lang: Node.js
label: Node
source: "const mailjet = require ('node-mailjet')\n\t.connect(process.env.MJ_APIKEY_PUBLIC, process.env.MJ_APIKEY_PRIVATE)\nconst request = mailjet\n\t.get(\"contact\", {'version': 'v3'})\n\t.id($contact_ID)\n\t.action(\"getcontactslists\")\n\t.request()\nrequest\n\t.then((result) => {\n\t\tconsole.log(result.body)\n\t})\n\t.catch((err) => {\n\t\tconsole.log(err.statusCode)\n\t})"
- lang: Ruby
label: Ruby
source: "require 'mailjet'\nMailjet.configure do |config|\n config.api_key = ENV['MJ_APIKEY_PUBLIC']\n config.secret_key = ENV['MJ_APIKEY_PRIVATE']\n config.api_version = \"v3\"\nend\nvariable = Mailjet::Contact_getcontactslists.find($contact_ID\n)\np variable.attributes['Data']"
- lang: Python
label: Python
source: "from mailjet_rest import Client\nimport os\napi_key = os.environ['MJ_APIKEY_PUBLIC']\napi_secret = os.environ['MJ_APIKEY_PRIVATE']\nmailjet = Client(auth=(api_key, api_secret), version='v3')\nid = '$contact_ID'\nresult = mailjet.contact_getcontactslists.get(id=id)\nprint result.status_code\nprint result.json()"
- lang: Java
label: Java
source: "package com.my.project;\nimport com.mailjet.client.errors.MailjetException;\nimport com.mailjet.client.errors.MailjetSocketTimeoutException;\nimport com.mailjet.client.MailjetClient;\nimport com.mailjet.client.MailjetRequest;\nimport com.mailjet.client.MailjetResponse;\nimport com.mailjet.client.ClientOptions;\nimport com.mailjet.client.resource.ContactGetcontactslists;\nimport org.json.JSONArray;\nimport org.json.JSONObject;\npublic class MyClass {\n public static void main(String[] args) throws MailjetException, MailjetSocketTimeoutException {\n MailjetClient client;\n MailjetRequest request;\n MailjetResponse response;\n client = new MailjetClient(System.getenv(\"MJ_APIKEY_PUBLIC\"), System.getenv(\"MJ_APIKEY_PRIVATE\"), new ClientOptions(\"v3\"));\n request = new MailjetRequest(ContactGetcontactslists.resource, ID);\n response = client.get(request);\n System.out.println(response.getStatus());\n System.out.println(response.getData());\n }\n}"
- lang: Go
label: Go
source: "package main\nimport (\n\t\"fmt\"\n\t\"log\"\n\t\"os\"\n\tmailjet \"github.com/mailjet/mailjet-apiv3-go\"\n\t\"github.com/mailjet/mailjet-apiv3-go/resources\"\n)\nfunc main () {\n\tmailjetClient := NewMailjetClient(os.Getenv(\"MJ_APIKEY_PUBLIC\"), os.Getenv(\"MJ_APIKEY_PRIVATE\"))\n\tvar data []resources.ContactGetcontactslists\n\tmr := &Request{\n\t Resource: \"contact\",\n\t ID: RESOURCE_ID,\n\t Action: \"getcontactslists\",\n\t}\n\terr := mailjetClient.Get(mr, &data)\n\tif err != nil {\n\t fmt.Println(err)\n\t}\n\tfmt.Printf(\"Data array: %+v\\n\", data)\n}"
- lang: C#
label: C#
source: "using Mailjet.Client;\nusing Mailjet.Client.Resources;\nusing System;\nusing Newtonsoft.Json.Linq;\nnamespace Mailjet.ConsoleApplication\n{\n class Program\n {\n static void Main(string[] args)\n {\n RunAsync().Wait();\n }\n static async Task RunAsync()\n {\n MailjetClient client = new MailjetClient(Environment.GetEnvironmentVariable(\"MJ_APIKEY_PUBLIC\"), Environment.GetEnvironmentVariable(\"MJ_APIKEY_PRIVATE\"))\n {\n Version = ApiVersion.V3,\n };\n MailjetRequest request = new MailjetRequest\n {\n Resource = ContactGetcontactslists.Resource,\n ResourceId = ResourceId.Numeric(ID)\n }\n MailjetResponse response = await client.GetAsync(request);\n if (response.IsSuccessStatusCode)\n {\n Console.WriteLine(string.Format(\"Total: {0}, Count: {1}\\n\", response.GetTotal(), response.GetCount()));\n Console.WriteLine(response.GetData());\n }\n else\n {\n Console.WriteLine(string.Format(\"StatusCode: {0}\\n\", response.StatusCode));\n Console.WriteLine(string.Format(\"ErrorInfo: {0}\\n\", response.GetErrorInfo()));\n Console.WriteLine(response.GetData());\n Console.WriteLine(string.Format(\"ErrorMessage: {0}\\n\", response.GetErrorMessage()));\n }\n }\n }\n}"
/v3/REST/contact/{contact_ID}/managecontactslists:
post:
x-seo:
title: "Contact: Manage Contact Lists"
description: "Manage the presence and subscription status of a contact for multiple contact lists. Select the contact lists, as well as the desired action to be\u2026"
tags:
- Contacts
summary: 'Contact: Manage Contact Lists'
description: Manage the presence and subscription status of a contact for multiple contact lists. Select the contact lists, as well as the desired action to be performed on each one - add, remove or unsub. The contact should already be present in the global contact list. To obtain a valid `contact_ID`, first call `GET /v3/REST/contact` to list your contacts.
operationId: post_v3_contact_id_managecontactslists
parameters:
- name: contact_ID
in: path
schema:
$ref: '#/components/schemas/post_v3_contact_id_managecontactslists_PathParams/properties/contact_ID'
required: true
example: 1000
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/NewContactManagecontactslists'
example:
ContactsLists:
- ListID: 987654321
Action: addforce
responses:
'201':
description: Default OK response for `/contact/{contact_ID}/managecontactslists`
content:
application/json:
schema:
type: object
properties:
Count:
description: Indicates the number of objects in the `Data` array.
type: integer
format: int64
examples:
- 1
Data:
description: A JSON array containing a list of objects returned by this endpoint.
type: array
items:
$ref: '#/components/schemas/OutputContactManagecontactslists'
Total:
description: Indicates the number of objects in the `Data` array.
type: integer
format: int64
examples:
- 1
'400':
$ref: '#/components/responses/400'
'401':
$ref: '#/components/responses/401'
'403':
$ref: '#/components/responses/403'
'404':
$ref: '#/components/responses/404'
'429':
$ref: '#/components/responses/429'
'500':
$ref: '#/components/responses/500'
security:
- basicAuth: []
x-codeSamples:
- lang: curl
label: cURL
source: "curl -s \\\n\t-X POST \\\n\t--user \"$MJ_APIKEY_PUBLIC:$MJ_APIKEY_PRIVATE\" \\\n\thttps://api.mailjet.com/v3/REST/contact/$contact_ID/managecontactslists \\\n\t-H 'Content-Type: application/json' \\\n\t-d '{\n \"ContactsLists\":[\n {\n \"Action\":\"addforce\",\n \"ListID\":\"987654321\"\n },\n {\n \"Action\":\"addnoforce\",\n \"ListID\":\"987654321\"\n },\n {\n \"Action\":\"remove\",\n \"ListID\":\"987654321\"\n },\n {\n \"Action\":\"unsub\",\n \"ListID\":\"987654321\"\n }\n ]\n\t}'"
- lang: PHP
label: PHP
source: " 'v3']);\n$body = [\n 'ContactsLists' => [\n [\n 'Action' => \"addforce\",\n 'ListID' => \"987654321\"\n ],\n [\n 'Action' => \"addnoforce\",\n 'ListID' => \"987654321\"\n ],\n [\n 'Action' => \"remove\",\n 'ListID' => \"987654321\"\n ],\n [\n 'Action' => \"unsub\",\n 'ListID' => \"987654321\"\n ]\n ]\n];\n$response = $mj->post(Resources::$ContactManagecontactslists, ['id' => $id, 'body' => $body]);\n$response->success() && var_dump($response->getData());\n?>"
- lang: Node.js
label: Node
source: "const mailjet = require ('node-mailjet')\n\t.connect(process.env.MJ_APIKEY_PUBLIC, process.env.MJ_APIKEY_PRIVATE)\nconst request = mailjet\n\t.post(\"contact\", {'version': 'v3'})\n\t.id($contact_ID)\n\t.action(\"managecontactslists\")\n\t.request({\n \"ContactsLists\":[\n {\n \"Action\":\"addforce\",\n \"ListID\":\"987654321\"\n },\n {\n \"Action\":\"addnoforce\",\n \"ListID\":\"987654321\"\n },\n {\n \"Action\":\"remove\",\n \"ListID\":\"987654321\"\n },\n {\n \"Action\":\"unsub\",\n \"ListID\":\"987654321\"\n }\n ]\n })\nrequest\n\t.then((result) => {\n\t\tconsole.log(result.body)\n\t})\n\t.catch((err) => {\n\t\tconsole.log(err.statusCode)\n\t})"
- lang: Ruby
label: Ruby
source: "require 'mailjet'\nMailjet.configure do |config|\n config.api_key = ENV['MJ_APIKEY_PUBLIC']\n config.secret_key = ENV['MJ_APIKEY_PRIVATE']\n config.api_version = \"v3\"\nend\nvariable = Mailjet::Contact_managecontactslists.create(id: $contact_ID,\n contacts_lists: [\n {\n 'action' => \"addforce\",\n 'list_id' => \"987654321\"\n },\n {\n 'action' => \"addnoforce\",\n 'list_id' => \"987654321\"\n },\n {\n 'action' => \"remove\",\n 'list_id' => \"987654321\"\n },\n {\n 'action' => \"unsub\",\n 'list_id' => \"987654321\"\n }\n ]\n)\np variable.attributes['Data']"
- lang: Python
label: Python
source: "from mailjet_rest import Client\nimport os\napi_key = os.environ['MJ_APIKEY_PUBLIC']\napi_secret = os.environ['MJ_APIKEY_PRIVATE']\nmailjet = Client(auth=(api_key, api_secret), version='v3')\nid = '$contact_ID'\ndata = {\n 'ContactsLists': [\n {\n \"Action\": \"addforce\",\n \"ListID\": \"987654321\"\n },\n {\n \"Action\": \"addnoforce\",\n \"ListID\": \"987654321\"\n },\n {\n \"Action\": \"remove\",\n \"ListID\": \"987654321\"\n },\n {\n \"Action\": \"unsub\",\n \"ListID\": \"987654321\"\n }\n ]\n}\nresult = mailjet.contact_managecontactslists.create(id=id, data=data)\nprint result.status_code\nprint result.json()"
- lang: Java
label: Java
source: "package com.my.project;\nimport com.mailjet.client.errors.MailjetException;\nimport com.mailjet.client.errors.MailjetSocketTimeoutException;\nimport com.mailjet.client.MailjetClient;\nimport com.mailjet.client.MailjetRequest;\nimport com.mailjet.client.MailjetResponse;\nimport com.mailjet.client.ClientOptions;\nimport com.mailjet.client.resource.ContactManagecontactslists;\nimport org.json.JSONArray;\nimport org.json.JSONObject;\npublic class MyClass {\n public static void main(String[] args) throws MailjetException, MailjetSocketTimeoutException {\n MailjetClient client;\n MailjetRequest request;\n MailjetResponse response;\n client = new MailjetClient(System.getenv(\"MJ_APIKEY_PUBLIC\"), System.getenv(\"MJ_APIKEY_PRIVATE\"), new ClientOptions(\"v3\"));\n request = new MailjetRequest(ContactManagecontactslists.resource, ID)\n .property(ContactManagecontactslists.CONTACTSLISTS, new JSONArray()\n .put(new JSONObject()\n .put(\"Action\", \"addforce\")\n .put(\"ListID\", \"987654321\")\n )\n .put(new JSONObject()\n .put(\"Action\", \"addnoforce\")\n .put(\"ListID\", \"987654321\")\n )\n .put(new JSONObject()\n .put(\"Action\", \"remove\")\n .put(\"ListID\", \"987654321\")\n )\n .put(new JSONObject()\n .put(\"Action\", \"unsub\")\n .put(\"ListID\", \"987654321\")\n )\n )\n );\n response = client.post(request);\n System.out.println(response.getStatus());\n System.out.println(response.getData());\n }\n}"
- lang: Go
label: Go
source: "package main\nimport (\n\t\"fmt\"\n\t\"log\"\n\t\"os\"\n\tmailjet \"github.com/mailjet/mailjet-apiv3-go\"\n\t\"github.com/mailjet/mailjet-apiv3-go/resources\"\n)\nfunc main () {\n\tmailjetClient := NewMailjetClient(os.Getenv(\"MJ_APIKEY_PUBLIC\"), os.Getenv(\"MJ_APIKEY_PRIVATE\"))\n\tvar data []resources.ContactManagecontactslists\n\tmr := &Request{\n\t Resource: \"contact\",\n\t ID: RESOURCE_ID,\n\t Action: \"managecontactslists\",\n\t}\n\tfmr := &FullRequest{\n\t Info: mr,\n\t Payload: &resources.ContactManagecontactslists { \n ContactsLists: []MailjetContactsList {\n MailjetContactsList {\n Action:\"addforce\",\n ListID:\"987654321\"\n },\n MailjetContactsList {\n Action:\"addnoforce\",\n ListID:\"987654321\"\n },\n MailjetContactsList {\n Action:\"remove\",\n ListID:\"987654321\"\n },\n MailjetContactsList {\n Action:\"unsub\",\n ListID:\"987654321\"\n }\n }\n }\n\t}\n\terr := mailjetClient.Post(fmr, &data)\n\tif err != nil {\n\t fmt.Println(err)\n\t}\n\tfmt.Printf(\"Data array: %+v\\n\", data)\n}"
- lang: C#
label: C#
source: "using Mailjet.Client;\nusing Mailjet.Client.Resources;\nusing System;\nusing Newtonsoft.Json.Linq;\nnamespace Mailjet.ConsoleApplication\n{\n class Program\n {\n static void Main(string[] args)\n {\n RunAsync().Wait();\n }\n static async Task RunAsync()\n {\n MailjetClient client = new MailjetClient(Environment.GetEnvironmentVariable(\"MJ_APIKEY_PUBLIC\"), Environment.GetEnvironmentVariable(\"MJ_APIKEY_PRIVATE\"))\n {\n Version = ApiVersion.V3,\n };\n MailjetRequest request = new MailjetRequest\n {\n Resource = ContactManagecontactslists.Resource,\n ResourceId = ResourceId.Numeric(ID)\n }\n .Property(ContactManagecontactslists.ContactsLists, new JArray {\n new JObject {\n {\"Action\", \"addforce\"},\n {\"ListID\", \"987654321\"}\n },\n new JObject {\n {\"Action\", \"addnoforce\"},\n {\"ListID\", \"987654321\"}\n },\n new JObject {\n {\"Action\", \"remove\"},\n {\"ListID\", \"987654321\"}\n },\n new JObject {\n {\"Action\", \"unsub\"},\n {\"ListID\", \"987654321\"}\n }\n });\n MailjetResponse response = await client.PostAsync(request);\n if (response.IsSuccessStatusCode)\n {\n Console.WriteLine(string.Format(\"Total: {0}, Count: {1}\\n\", response.GetTotal(), response.GetCount()));\n Console.WriteLine(response.GetData());\n }\n else\n {\n Console.WriteLine(string.Format(\"StatusCode: {0}\\n\", response.StatusCode));\n Console.WriteLine(string.Format(\"ErrorInfo: {0}\\n\", response.GetErrorInfo()));\n Console.WriteLine(response.GetData());\n Console.WriteLine(string.Format(\"ErrorMessage: {0}\\n\", response.GetErrorMessage()));\n }\n }\n }\n}"
/v3/REST/contactslist/{list_ID}/managecontact:
post:
x-seo:
title: "Contact List: Manage Contact"
description: "Manage the presence and subscription status of a contact to a specific contact list. The API will internally create the new contact if it does not exist\u2026"
tags:
- Contacts
summary: 'Contact List: Manage Contact'
description: Manage the presence and subscription status of a contact to a specific contact list. The API will internally create the new contact if it does not exist, as well as add or update the name and properties. To obtain a valid `list_ID`, first call `GET /v3/REST/contactslist` to list your contact lists.
operationId: post_v3_contactslist_id_managecontact
parameters:
- name: list_ID
in: path
schema:
$ref: '#/components/schemas/post_v3_contactslist_id_managecontact_PathParams/properties/list_ID'
required: true
example: 2000
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/NewContactslistManageContact'
example:
Name: John Smith
Action: addnoforce
Email: contact@example.com
responses:
'201':
description: Default OK response for `/contactslist` action `/managecontact`
content:
application/json:
schema:
type: object
properties:
Count:
description: Indicates the number of objects in the `Data` array.
type: integer
format: int64
examples:
- 1
Data:
description: A JSON array containing a list of objects returned by this endpoint.
type: array
items:
$ref: '#/components/schemas/OutputContactslistManageContact'
Total:
description: Indicates the number of objects in the `Data` array.
type: integer
format: int64
examples:
- 1
'400':
$ref: '#/components/responses/400'
'401':
$ref: '#/components/responses/401'
'403':
$ref: '#/components/responses/403'
'404':
$ref: '#/components/responses/404'
'429':
$ref: '#/components/responses/429'
'500':
$ref: '#/components/responses/500'
security:
- basicAuth: []
x-codeSamples:
- lang: curl
label: cURL
source: "curl -s \\\n\t-X POST \\\n\t--user \"$MJ_APIKEY_PUBLIC:$MJ_APIKEY_PRIVATE\" \\\n\thttps://api.mailjet.com/v3/REST/contactslist/$list_ID/managecontact \\\n\t-H 'Content-Type: application/json' \\\n\t-d '{\n \"Name\":\"John Smith\",\n \"Properties\":\"object\",\n \"Action\":\"addnoforce\",\n \"Email\":\"passenger@mailjet.com\"\n\t}'"
- lang: PHP
label: PHP
source: " 'v3']);\n$body = [\n 'Name' => \"John Smith\",\n 'Properties' => \"object\",\n 'Action' => \"addnoforce\",\n 'Email' => \"passenger@mailjet.com\"\n];\n$response = $mj->post(Resources::$ContactslistManagecontact, ['id' => $id, 'body' => $body]);\n$response->success() && var_dump($response->getData());\n?>"
- lang: Node.js
label: Node
source: "const mailjet = require ('node-mailjet')\n\t.connect(process.env.MJ_APIKEY_PUBLIC, process.env.MJ_APIKEY_PRIVATE)\nconst request = mailjet\n\t.post(\"contactslist\", {'version': 'v3'})\n\t.id($list_ID)\n\t.action(\"managecontact\")\n\t.request({\n \"Name\":\"John Smith\",\n \"Properties\":\"object\",\n \"Action\":\"addnoforce\",\n \"Email\":\"passenger@mailjet.com\"\n })\nrequest\n\t.then((result) => {\n\t\tconsole.log(result.body)\n\t})\n\t.catch((err) => {\n\t\tconsole.log(err.statusCode)\n\t})"
- lang: Ruby
label: Ruby
source: "require 'mailjet'\nMailjet.configure do |config|\n config.api_key = ENV['MJ_APIKEY_PUBLIC']\n config.secret_key = ENV['MJ_APIKEY_PRIVATE']\n config.api_version = \"v3\"\nend\nvariable = Mailjet::Contactslist_managecontact.create(id: $list_ID,\n name: \"John Smith\",\n properties: \"object\",\n action: \"addnoforce\",\n email: \"passenger@mailjet.com\"\n)\np variable.attributes['Data']"
- lang: Python
label: Python
source: "from mailjet_rest import Client\nimport os\napi_key = os.environ['MJ_APIKEY_PUBLIC']\napi_secret = os.environ['MJ_APIKEY_PRIVATE']\nmailjet = Client(auth=(api_key, api_secret), version='v3')\nid = '$list_ID'\ndata = {\n 'Name': \"John Smith\",\n 'Properties': \"object\",\n 'Action': \"addnoforce\",\n 'Email': \"passenger@mailjet.com\"\n}\nresult = mailjet.contactslist_managecontact.create(id=id, data=data)\nprint result.status_code\nprint result.json()"
- lang: Java
label: Java
source: "package com.my.project;\nimport com.mailjet.client.errors.MailjetException;\nimport com.mailjet.client.errors.MailjetSocketTimeoutException;\nimport com.mailjet.client.MailjetClient;\nimport com.mailjet.client.MailjetRequest;\nimport com.mailjet.client.MailjetResponse;\nimport com.mailjet.client.ClientOptions;\nimport com.mailjet.client.resource.ContactslistManagecontact;\nimport org.json.JSONArray;\nimport org.json.JSONObject;\npublic class MyClass {\n public static void main(String[] args) throws MailjetException, MailjetSocketTimeoutException {\n MailjetClient client;\n MailjetRequest request;\n MailjetResponse response;\n client = new MailjetClient(System.getenv(\"MJ_APIKEY_PUBLIC\"), System.getenv(\"MJ_APIKEY_PRIVATE\"), new ClientOptions(\"v3\"));\n request = new MailjetRequest(ContactslistManagecontact.resource, ID)\n .property(ContactslistManagecontact.NAME, \"John Smith\")\n .property(ContactslistManagecontact.PROPERTIES, \"object\")\n .property(ContactslistManagecontact.ACTION, \"addnoforce\")\n .property(ContactslistManagecontact.EMAIL, \"passenger@mailjet.com\")\n );\n response = client.post(request);\n System.out.println(response.getStatus());\n System.out.println(response.getData());\n }\n}"
- lang: Go
label: Go
source: "package main\nimport (\n\t\"fmt\"\n\t\"log\"\n\t\"os\"\n\tmailjet \"github.com/mailjet/mailjet-apiv3-go\"\n\t\"github.com/mailjet/mailjet-apiv3-go/resources\"\n)\nfunc main () {\n\tmailjetClient := NewMailjetClient(os.Getenv(\"MJ_APIKEY_PUBLIC\"), os.Getenv(\"MJ_APIKEY_PRIVATE\"))\n\tvar data []resources.ContactslistManagecontact\n\tmr := &Request{\n\t Resource: \"contactslist\",\n\t ID: RESOURCE_ID,\n\t Action: \"managecontact\",\n\t}\n\tfmr := &FullRequest{\n\t Info: mr,\n\t Payload: &resources.ContactslistManagecontact { \n\t Name:\"John Smith\",\n\t Properties:\"object\",\n\t Action:\"addnoforce\",\n\t Email:\"passenger@mailjet.com\"\n }\n\t}\n\terr := mailjetClient.Post(fmr, &data)\n\tif err != nil {\n\t fmt.Println(err)\n\t}\n\tfmt.Printf(\"Data array: %+v\\n\", data)\n}"
- lang: C#
label: C#
source: "using Mailjet.Client;\nusing Mailjet.Client.Resources;\nusing System;\nusing Newtonsoft.Json.Linq;\nnamespace Mailjet.ConsoleApplication\n{\n class Program\n {\n static void Main(string[] args)\n {\n RunAsync().Wait();\n }\n static async Task RunAsync()\n {\n MailjetClient client = new MailjetClient(Environment.GetEnvironmentVariable(\"MJ_APIKEY_PUBLIC\"), Environment.GetEnvironmentVariable(\"MJ_APIKEY_PRIVATE\"))\n {\n Version = ApiVersion.V3,\n };\n MailjetRequest request = new MailjetRequest\n {\n Resource = ContactslistManagecontact.Resource,\n ResourceId = ResourceId.Numeric(ID)\n }\n .Property(ContactslistManagecontact.Name, \"John Smith\")\n .Property(ContactslistManagecontact.Properties, \"object\")\n .Property(ContactslistManagecontact.Action, \"addnoforce\")\n .Property(ContactslistManagecontact.Email, \"passenger@mailjet.com\");\n MailjetResponse response = await client.PostAsync(request);\n if (response.IsSuccessStatusCode)\n {\n Console.WriteLine(string.Format(\"Total: {0}, Count: {1}\\n\", response.GetTotal(), response.GetCount()));\n Console.WriteLine(response.GetData());\n }\n else\n {\n Console.WriteLine(string.Format(\"StatusCode: {0}\\n\", response.StatusCode));\n Console.WriteLine(string.Format(\"ErrorInfo: {0}\\n\", response.GetErrorInfo()));\n Console.WriteLine(response.GetData());\n Console.WriteLine(string.Format(\"ErrorMessage: {0}\\n\", response.GetErrorMessage()));\n }\n }\n }\n}"
"/v3/REST/contactslistsignup":
get:
x-seo:
title: "Contact List Signup List"
description: "Retrieve details about all contact list signup requests via a subscription widget. Provides details on signup and subscription confirmation IPs\u2026"
tags:
- Contacts
summary: Contact List Signup List
description: Retrieve details about all contact list signup requests via a subscription widget. Provides details on signup and subscription confirmation IPs, timestamp, subscription source etc.
operationId: get_v3_contactslistsignup
parameters:
- name: Contact
in: query
schema:
$ref: '#/components/schemas/get_v3_contactslistsignup_QueryParams/properties/Contact'
- name: ContactsList
in: query
schema:
$ref: '#/components/schemas/get_v3_contactslistsignup_QueryParams/properties/ContactsList'
- name: Domain
in: query
schema:
$ref: '#/components/schemas/get_v3_contactslistsignup_QueryParams/properties/Domain'
- name: Email
in: query
schema:
$ref: '#/components/schemas/get_v3_contactslistsignup_QueryParams/properties/Email'
- name: LocalPart
in: query
schema:
$ref: '#/components/schemas/get_v3_contactslistsignup_QueryParams/properties/LocalPart'
- name: MaxConfirmAt
in: query
schema:
$ref: '#/components/schemas/get_v3_contactslistsignup_QueryParams/properties/MaxConfirmAt'
- name: MaxSignupAt
in: query
schema:
$ref: '#/components/schemas/get_v3_contactslistsignup_QueryParams/properties/MaxSignupAt'
- name: MinConfirmAt
in: query
schema:
$ref: '#/components/schemas/get_v3_contactslistsignup_QueryParams/properties/MinConfirmAt'
- name: MinSignupAt
in: query
schema:
$ref: '#/components/schemas/get_v3_contactslistsignup_QueryParams/properties/MinSignupAt'
- name: SignupIp
in: query
schema:
$ref: '#/components/schemas/get_v3_contactslistsignup_QueryParams/properties/SignupIp'
- name: Source
in: query
schema:
$ref: '#/components/schemas/get_v3_contactslistsignup_QueryParams/properties/Source'
- name: SourceID
in: query
schema:
$ref: '#/components/schemas/get_v3_contactslistsignup_QueryParams/properties/SourceID'
responses:
'200':
description: Default OK response for `/contactslistsignup`
content:
application/json:
schema:
type: object
properties:
Count:
description: Indicates the number of objects in the `Data` array.
type: integer
format: int64
examples:
- 1
Data:
description: A JSON array containing a list of objects returned by this endpoint.
type: array
items:
$ref: '#/components/schemas/OutputContactslistsignup'
Total:
description: Indicates the number of objects in the `Data` array.
type: integer
format: int64
examples:
- 1
'400':
$ref: '#/components/responses/400'
'401':
$ref: '#/components/responses/401'
'403':
$ref: '#/components/responses/403'
'404':
$ref: '#/components/responses/404'
'429':
$ref: '#/components/responses/429'
'500':
$ref: '#/components/responses/500'
security:
- basicAuth: []
x-codeSamples:
- lang: curl
label: cURL
source: "curl -s \\\n\t-X GET \\\n\t--user \"$MJ_APIKEY_PUBLIC:$MJ_APIKEY_PRIVATE\" \\\n\thttps://api.mailjet.com/v3/REST/contactslistsignup \\"
- lang: PHP
label: PHP
source: " 'v3']);\n$response = $mj->get(Resources::$Contactslistsignup);\n$response->success() && var_dump($response->getData());\n?>"
- lang: Node.js
label: Node
source: "const mailjet = require ('node-mailjet')\n\t.connect(process.env.MJ_APIKEY_PUBLIC, process.env.MJ_APIKEY_PRIVATE)\nconst request = mailjet\n\t.get(\"contactslistsignup\", {'version': 'v3'})\n\t.request()\nrequest\n\t.then((result) => {\n\t\tconsole.log(result.body)\n\t})\n\t.catch((err) => {\n\t\tconsole.log(err.statusCode)\n\t})"
- lang: Ruby
label: Ruby
source: "require 'mailjet'\nMailjet.configure do |config|\n config.api_key = ENV['MJ_APIKEY_PUBLIC']\n config.secret_key = ENV['MJ_APIKEY_PRIVATE']\n config.api_version = \"v3\"\nend\nvariable = Mailjet::Contactslistsignup.all(\n)\np variable.attributes['Data']"
- lang: Python
label: Python
source: "from mailjet_rest import Client\nimport os\napi_key = os.environ['MJ_APIKEY_PUBLIC']\napi_secret = os.environ['MJ_APIKEY_PRIVATE']\nmailjet = Client(auth=(api_key, api_secret), version='v3')\nresult = mailjet.contactslistsignup.get()\nprint result.status_code\nprint result.json()"
- lang: Java
label: Java
source: "package com.my.project;\nimport com.mailjet.client.errors.MailjetException;\nimport com.mailjet.client.errors.MailjetSocketTimeoutException;\nimport com.mailjet.client.MailjetClient;\nimport com.mailjet.client.MailjetRequest;\nimport com.mailjet.client.MailjetResponse;\nimport com.mailjet.client.ClientOptions;\nimport com.mailjet.client.resource.Contactslistsignup;\nimport org.json.JSONArray;\nimport org.json.JSONObject;\npublic class MyClass {\n public static void main(String[] args) throws MailjetException, MailjetSocketTimeoutException {\n MailjetClient client;\n MailjetRequest request;\n MailjetResponse response;\n client = new MailjetClient(System.getenv(\"MJ_APIKEY_PUBLIC\"), System.getenv(\"MJ_APIKEY_PRIVATE\"), new ClientOptions(\"v3\"));\n request = new MailjetRequest(Contactslistsignup.resource);\n response = client.get(request);\n System.out.println(response.getStatus());\n System.out.println(response.getData());\n }\n}"
- lang: Go
label: Go
source: "package main\nimport (\n\t\"fmt\"\n\t\"log\"\n\t\"os\"\n\tmailjet \"github.com/mailjet/mailjet-apiv3-go\"\n\t\"github.com/mailjet/mailjet-apiv3-go/resources\"\n)\nfunc main () {\n\tmailjetClient := NewMailjetClient(os.Getenv(\"MJ_APIKEY_PUBLIC\"), os.Getenv(\"MJ_APIKEY_PRIVATE\"))\n\tvar data []resources.Contactslistsignup\n\t_, _, err := mailjetClient.List(\"contactslistsignup\", &data)\n\tif err != nil {\n\t fmt.Println(err)\n\t}\n\tfmt.Printf(\"Data array: %+v\\n\", data)\n}"
- lang: C#
label: C#
source: "using Mailjet.Client;\nusing Mailjet.Client.Resources;\nusing System;\nusing Newtonsoft.Json.Linq;\nnamespace Mailjet.ConsoleApplication\n{\n class Program\n {\n static void Main(string[] args)\n {\n RunAsync().Wait();\n }\n static async Task RunAsync()\n {\n MailjetClient client = new MailjetClient(Environment.GetEnvironmentVariable(\"MJ_APIKEY_PUBLIC\"), Environment.GetEnvironmentVariable(\"MJ_APIKEY_PRIVATE\"))\n {\n Version = ApiVersion.V3,\n };\n MailjetRequest request = new MailjetRequest\n {\n Resource = Contactslistsignup.Resource,\n }\n MailjetResponse response = await client.GetAsync(request);\n if (response.IsSuccessStatusCode)\n {\n Console.WriteLine(string.Format(\"Total: {0}, Count: {1}\\n\", response.GetTotal(), response.GetCount()));\n Console.WriteLine(response.GetData());\n }\n else\n {\n Console.WriteLine(string.Format(\"StatusCode: {0}\\n\", response.StatusCode));\n Console.WriteLine(string.Format(\"ErrorInfo: {0}\\n\", response.GetErrorInfo()));\n Console.WriteLine(response.GetData());\n Console.WriteLine(string.Format(\"ErrorMessage: {0}\\n\", response.GetErrorMessage()));\n }\n }\n }\n}"
/v3/REST/contactslistsignup/{signuprequest_ID}:
get:
x-seo:
title: "Contact List Signup by ID"
description: "Retrieve details about a specific subscription request done via a subscription widget. Provides details on signup and subscription confirmation IP\u2026"
tags:
- Contacts
summary: Contact List Signup by ID
description: Retrieve details about a specific subscription request done via a subscription widget. Provides details on signup and subscription confirmation IP, timestamp, subscription source etc. To obtain a valid `signuprequest_ID`, first call `GET /v3/REST/contactslistsignup` to list your subscription requests.
operationId: get_v3_contactslistsignup_id
parameters:
- name: signuprequest_ID
in: path
schema:
$ref: '#/components/schemas/get_v3_contactslistsignup_id_PathParams/properties/signuprequest_ID'
required: true
example: 17000
responses:
'200':
description: Default OK response for `/contactslistsignup`
content:
application/json:
schema:
type: object
properties:
Count:
description: Indicates the number of objects in the `Data` array.
type: integer
format: int64
examples:
- 1
Data:
description: A JSON array containing a list of objects returned by this endpoint.
type: array
items:
$ref: '#/components/schemas/OutputContactslistsignup'
Total:
description: Indicates the number of objects in the `Data` array.
type: integer
format: int64
examples:
- 1
'400':
$ref: '#/components/responses/400'
'401':
$ref: '#/components/responses/401'
'403':
$ref: '#/components/responses/403'
'404':
$ref: '#/components/responses/404'
'429':
$ref: '#/components/responses/429'
'500':
$ref: '#/components/responses/500'
security:
- basicAuth: []
x-codeSamples:
- lang: curl
label: cURL
source: "curl -s \\\n\t-X GET \\\n\t--user \"$MJ_APIKEY_PUBLIC:$MJ_APIKEY_PRIVATE\" \\\n\thttps://api.mailjet.com/v3/REST/contactslistsignup/$signuprequest_ID \\"
- lang: PHP
label: PHP
source: " 'v3']);\n$response = $mj->get(Resources::$Contactslistsignup, ['id' => $id]);\n$response->success() && var_dump($response->getData());\n?>"
- lang: Node.js
label: Node
source: "const mailjet = require ('node-mailjet')\n\t.connect(process.env.MJ_APIKEY_PUBLIC, process.env.MJ_APIKEY_PRIVATE)\nconst request = mailjet\n\t.get(\"contactslistsignup\", {'version': 'v3'})\n\t.id($signuprequest_ID)\n\t.request()\nrequest\n\t.then((result) => {\n\t\tconsole.log(result.body)\n\t})\n\t.catch((err) => {\n\t\tconsole.log(err.statusCode)\n\t})"
- lang: Ruby
label: Ruby
source: "require 'mailjet'\nMailjet.configure do |config|\n config.api_key = ENV['MJ_APIKEY_PUBLIC']\n config.secret_key = ENV['MJ_APIKEY_PRIVATE']\n config.api_version = \"v3\"\nend\nvariable = Mailjet::Contactslistsignup.find($signuprequest_ID\n)\np variable.attributes['Data']"
- lang: Python
label: Python
source: "from mailjet_rest import Client\nimport os\napi_key = os.environ['MJ_APIKEY_PUBLIC']\napi_secret = os.environ['MJ_APIKEY_PRIVATE']\nmailjet = Client(auth=(api_key, api_secret), version='v3')\nid = '$signuprequest_ID'\nresult = mailjet.contactslistsignup.get(id=id)\nprint result.status_code\nprint result.json()"
- lang: Java
label: Java
source: "package com.my.project;\nimport com.mailjet.client.errors.MailjetException;\nimport com.mailjet.client.errors.MailjetSocketTimeoutException;\nimport com.mailjet.client.MailjetClient;\nimport com.mailjet.client.MailjetRequest;\nimport com.mailjet.client.MailjetResponse;\nimport com.mailjet.client.ClientOptions;\nimport com.mailjet.client.resource.Contactslistsignup;\nimport org.json.JSONArray;\nimport org.json.JSONObject;\npublic class MyClass {\n public static void main(String[] args) throws MailjetException, MailjetSocketTimeoutException {\n MailjetClient client;\n MailjetRequest request;\n MailjetResponse response;\n client = new MailjetClient(System.getenv(\"MJ_APIKEY_PUBLIC\"), System.getenv(\"MJ_APIKEY_PRIVATE\"), new ClientOptions(\"v3\"));\n request = new MailjetRequest(Contactslistsignup.resource, ID);\n response = client.get(request);\n System.out.println(response.getStatus());\n System.out.println(response.getData());\n }\n}"
- lang: Go
label: Go
source: "package main\nimport (\n\t\"fmt\"\n\t\"log\"\n\t\"os\"\n\tmailjet \"github.com/mailjet/mailjet-apiv3-go\"\n\t\"github.com/mailjet/mailjet-apiv3-go/resources\"\n)\nfunc main () {\n\tmailjetClient := NewMailjetClient(os.Getenv(\"MJ_APIKEY_PUBLIC\"), os.Getenv(\"MJ_APIKEY_PRIVATE\"))\n\tvar data []resources.Contactslistsignup\n\tmr := &Request{\n\t Resource: \"contactslistsignup\",\n\t ID: RESOURCE_ID,\n\t}\n\terr := mailjetClient.Get(mr, &data)\n\tif err != nil {\n\t fmt.Println(err)\n\t}\n\tfmt.Printf(\"Data array: %+v\\n\", data)\n}"
- lang: C#
label: C#
source: "using Mailjet.Client;\nusing Mailjet.Client.Resources;\nusing System;\nusing Newtonsoft.Json.Linq;\nnamespace Mailjet.ConsoleApplication\n{\n class Program\n {\n static void Main(string[] args)\n {\n RunAsync().Wait();\n }\n static async Task RunAsync()\n {\n MailjetClient client = new MailjetClient(Environment.GetEnvironmentVariable(\"MJ_APIKEY_PUBLIC\"), Environment.GetEnvironmentVariable(\"MJ_APIKEY_PRIVATE\"))\n {\n Version = ApiVersion.V3,\n };\n MailjetRequest request = new MailjetRequest\n {\n Resource = Contactslistsignup.Resource,\n ResourceId = ResourceId.Numeric(ID)\n }\n MailjetResponse response = await client.GetAsync(request);\n if (response.IsSuccessStatusCode)\n {\n Console.WriteLine(string.Format(\"Total: {0}, Count: {1}\\n\", response.GetTotal(), response.GetCount()));\n Console.WriteLine(response.GetData());\n }\n else\n {\n Console.WriteLine(string.Format(\"StatusCode: {0}\\n\", response.StatusCode));\n Console.WriteLine(string.Format(\"ErrorInfo: {0}\\n\", response.GetErrorInfo()));\n Console.WriteLine(response.GetData());\n Console.WriteLine(string.Format(\"ErrorMessage: {0}\\n\", response.GetErrorMessage()));\n }\n }\n }\n}"
"/v3/REST/listrecipient":
get:
x-seo:
title: "List Recipient List"
description: "Retrieve details on all list recipients, including the contact and list associated with them, as well as subscription status."
tags:
- Contacts
summary: List Recipient List
description: Retrieve details on all list recipients, including the contact and list associated with them, as well as subscription status.
operationId: get_v3_listrecipient
parameters:
- name: Active
in: query
schema:
$ref: '#/components/schemas/get_v3_listrecipient_QueryParams/properties/Active'
- name: Blocked
in: query
schema:
$ref: '#/components/schemas/get_v3_listrecipient_QueryParams/properties/Blocked'
- name: Contact
in: query
schema:
$ref: '#/components/schemas/get_v3_listrecipient_QueryParams/properties/Contact'
- name: ContactEmail
in: query
schema:
$ref: '#/components/schemas/get_v3_listrecipient_QueryParams/properties/ContactEmail'
- name: ContactsList
in: query
schema:
$ref: '#/components/schemas/get_v3_listrecipient_QueryParams/properties/ContactsList'
- name: IgnoreDeleted
in: query
schema:
$ref: '#/components/schemas/get_v3_listrecipient_QueryParams/properties/IgnoreDeleted'
- name: IsExcludedFromCampaigns
in: query
schema:
$ref: '#/components/schemas/get_v3_listrecipient_QueryParams/properties/IsExcludedFromCampaigns'
- name: LastActivityAt
in: query
schema:
$ref: '#/components/schemas/get_v3_listrecipient_QueryParams/properties/LastActivityAt'
- name: ListName
in: query
schema:
$ref: '#/components/schemas/get_v3_listrecipient_QueryParams/properties/ListName'
- name: Opened
in: query
schema:
$ref: '#/components/schemas/get_v3_listrecipient_QueryParams/properties/Opened'
- name: Unsub
in: query
schema:
$ref: '#/components/schemas/get_v3_listrecipient_QueryParams/properties/Unsub'
responses:
'200':
description: Default OK response for `/listrecipient`
content:
application/json:
schema:
type: object
properties:
Count:
description: Indicates the number of objects in the `Data` array.
type: integer
format: int64
examples:
- 1
Data:
description: A JSON array containing a list of objects returned by this endpoint.
type: array
items:
$ref: '#/components/schemas/OutputListrecipient'
Total:
description: Indicates the number of objects in the `Data` array.
type: integer
format: int64
examples:
- 1
'400':
$ref: '#/components/responses/400'
'401':
$ref: '#/components/responses/401'
'403':
$ref: '#/components/responses/403'
'404':
$ref: '#/components/responses/404'
'429':
$ref: '#/components/responses/429'
'500':
$ref: '#/components/responses/500'
security:
- basicAuth: []
x-codeSamples:
- lang: curl
label: cURL
source: "curl -s \\\n\t-X GET \\\n\t--user \"$MJ_APIKEY_PUBLIC:$MJ_APIKEY_PRIVATE\" \\\n\thttps://api.mailjet.com/v3/REST/listrecipient \\"
- lang: PHP
label: PHP
source: " 'v3']);\n$response = $mj->get(Resources::$Listrecipient);\n$response->success() && var_dump($response->getData());\n?>"
- lang: Node.js
label: Node
source: "const mailjet = require ('node-mailjet')\n\t.connect(process.env.MJ_APIKEY_PUBLIC, process.env.MJ_APIKEY_PRIVATE)\nconst request = mailjet\n\t.get(\"listrecipient\", {'version': 'v3'})\n\t.request()\nrequest\n\t.then((result) => {\n\t\tconsole.log(result.body)\n\t})\n\t.catch((err) => {\n\t\tconsole.log(err.statusCode)\n\t})"
- lang: Ruby
label: Ruby
source: "require 'mailjet'\nMailjet.configure do |config|\n config.api_key = ENV['MJ_APIKEY_PUBLIC']\n config.secret_key = ENV['MJ_APIKEY_PRIVATE']\n config.api_version = \"v3\"\nend\nvariable = Mailjet::Listrecipient.all(\n)\np variable.attributes['Data']"
- lang: Python
label: Python
source: "from mailjet_rest import Client\nimport os\napi_key = os.environ['MJ_APIKEY_PUBLIC']\napi_secret = os.environ['MJ_APIKEY_PRIVATE']\nmailjet = Client(auth=(api_key, api_secret), version='v3')\nresult = mailjet.listrecipient.get()\nprint result.status_code\nprint result.json()"
- lang: Java
label: Java
source: "package com.my.project;\nimport com.mailjet.client.errors.MailjetException;\nimport com.mailjet.client.errors.MailjetSocketTimeoutException;\nimport com.mailjet.client.MailjetClient;\nimport com.mailjet.client.MailjetRequest;\nimport com.mailjet.client.MailjetResponse;\nimport com.mailjet.client.ClientOptions;\nimport com.mailjet.client.resource.Listrecipient;\nimport org.json.JSONArray;\nimport org.json.JSONObject;\npublic class MyClass {\n public static void main(String[] args) throws MailjetException, MailjetSocketTimeoutException {\n MailjetClient client;\n MailjetRequest request;\n MailjetResponse response;\n client = new MailjetClient(System.getenv(\"MJ_APIKEY_PUBLIC\"), System.getenv(\"MJ_APIKEY_PRIVATE\"), new ClientOptions(\"v3\"));\n request = new MailjetRequest(Listrecipient.resource);\n response = client.get(request);\n System.out.println(response.getStatus());\n System.out.println(response.getData());\n }\n}"
- lang: Go
label: Go
source: "package main\nimport (\n\t\"fmt\"\n\t\"log\"\n\t\"os\"\n\tmailjet \"github.com/mailjet/mailjet-apiv3-go\"\n\t\"github.com/mailjet/mailjet-apiv3-go/resources\"\n)\nfunc main () {\n\tmailjetClient := NewMailjetClient(os.Getenv(\"MJ_APIKEY_PUBLIC\"), os.Getenv(\"MJ_APIKEY_PRIVATE\"))\n\tvar data []resources.Listrecipient\n\t_, _, err := mailjetClient.List(\"listrecipient\", &data)\n\tif err != nil {\n\t fmt.Println(err)\n\t}\n\tfmt.Printf(\"Data array: %+v\\n\", data)\n}"
- lang: C#
label: C#
source: "using Mailjet.Client;\nusing Mailjet.Client.Resources;\nusing System;\nusing Newtonsoft.Json.Linq;\nnamespace Mailjet.ConsoleApplication\n{\n class Program\n {\n static void Main(string[] args)\n {\n RunAsync().Wait();\n }\n static async Task RunAsync()\n {\n MailjetClient client = new MailjetClient(Environment.GetEnvironmentVariable(\"MJ_APIKEY_PUBLIC\"), Environment.GetEnvironmentVariable(\"MJ_APIKEY_PRIVATE\"))\n {\n Version = ApiVersion.V3,\n };\n MailjetRequest request = new MailjetRequest\n {\n Resource = Listrecipient.Resource,\n }\n MailjetResponse response = await client.GetAsync(request);\n if (response.IsSuccessStatusCode)\n {\n Console.WriteLine(string.Format(\"Total: {0}, Count: {1}\\n\", response.GetTotal(), response.GetCount()));\n Console.WriteLine(response.GetData());\n }\n else\n {\n Console.WriteLine(string.Format(\"StatusCode: {0}\\n\", response.StatusCode));\n Console.WriteLine(string.Format(\"ErrorInfo: {0}\\n\", response.GetErrorInfo()));\n Console.WriteLine(response.GetData());\n Console.WriteLine(string.Format(\"ErrorMessage: {0}\\n\", response.GetErrorMessage()));\n }\n }\n }\n}"
post:
x-seo:
title: "Create List Recipient"
description: "Create a new list recipient. A list recipient object manages the relationship between a contact and a contactslist - every instance of a contact being\u2026"
tags:
- Contacts
summary: Create List Recipient
description: Create a new list recipient. A list recipient object manages the relationship between a `contact` and a `contactslist` - every instance of a contact being added to a list creates a new list recipient. Both the contact and the list need to be created beforehand. Use `GET /v3/REST/contact` and `GET /v3/REST/contactslist` to obtain valid `ContactID` and `ListID` values - the IDs in the example below are placeholders and will not exist in your account.
operationId: post_v3_listrecipient
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/NewListrecipient'
example:
ContactID: 1000
ListID: 2000
responses:
'201':
description: Default OK response for `/listrecipient`
content:
application/json:
schema:
type: object
properties:
Count:
description: Indicates the number of objects in the `Data` array.
type: integer
format: int64
examples:
- 1
Data:
description: A JSON array containing a list of objects returned by this endpoint.
type: array
items:
$ref: '#/components/schemas/OutputListrecipient'
Total:
description: Indicates the number of objects in the `Data` array.
type: integer
format: int64
examples:
- 1
'400':
$ref: '#/components/responses/400'
'401':
$ref: '#/components/responses/401'
'403':
$ref: '#/components/responses/403'
'404':
$ref: '#/components/responses/404'
'429':
$ref: '#/components/responses/429'
'500':
$ref: '#/components/responses/500'
security:
- basicAuth: []
x-codeSamples:
- lang: curl
label: cURL
source: "curl -s \\\n\t-X POST \\\n\t--user \"$MJ_APIKEY_PUBLIC:$MJ_APIKEY_PRIVATE\" \\\n\thttps://api.mailjet.com/v3/REST/listrecipient \\\n\t-H 'Content-Type: application/json' \\\n\t-d '{\n \"IsUnsubscribed\":true,\n \"ContactID\":987654321,\n \"ContactAlt\":\"passenger@mailjet.com\",\n \"ListID\":123456,\n \"ListAlt\":\"abcdef123\"\n\t}'"
- lang: PHP
label: PHP
source: " 'v3']);\n$body = [\n 'IsUnsubscribed' => true,\n 'ContactID' => 987654321,\n 'ContactAlt' => \"passenger@mailjet.com\",\n 'ListID' => 123456,\n 'ListAlt' => \"abcdef123\"\n];\n$response = $mj->post(Resources::$Listrecipient, ['body' => $body]);\n$response->success() && var_dump($response->getData());\n?>"
- lang: Node.js
label: Node
source: "const mailjet = require ('node-mailjet')\n\t.connect(process.env.MJ_APIKEY_PUBLIC, process.env.MJ_APIKEY_PRIVATE)\nconst request = mailjet\n\t.post(\"listrecipient\", {'version': 'v3'})\n\t.request({\n \"IsUnsubscribed\":true,\n \"ContactID\":987654321,\n \"ContactAlt\":\"passenger@mailjet.com\",\n \"ListID\":123456,\n \"ListAlt\":\"abcdef123\"\n })\nrequest\n\t.then((result) => {\n\t\tconsole.log(result.body)\n\t})\n\t.catch((err) => {\n\t\tconsole.log(err.statusCode)\n\t})"
- lang: Ruby
label: Ruby
source: "require 'mailjet'\nMailjet.configure do |config|\n config.api_key = ENV['MJ_APIKEY_PUBLIC']\n config.secret_key = ENV['MJ_APIKEY_PRIVATE']\n config.api_version = \"v3\"\nend\nvariable = Mailjet::Listrecipient.create(\n is_unsubscribed: true,\n contact_id: 987654321,\n contact_alt: \"passenger@mailjet.com\",\n list_id: 123456,\n list_alt: \"abcdef123\"\n)\np variable.attributes['Data']"
- lang: Python
label: Python
source: "from mailjet_rest import Client\nimport os\napi_key = os.environ['MJ_APIKEY_PUBLIC']\napi_secret = os.environ['MJ_APIKEY_PRIVATE']\nmailjet = Client(auth=(api_key, api_secret), version='v3')\ndata = {\n 'IsUnsubscribed': True,\n 'ContactID': 987654321,\n 'ContactAlt': \"passenger@mailjet.com\",\n 'ListID': 123456,\n 'ListAlt': \"abcdef123\"\n}\nresult = mailjet.listrecipient.create(data=data)\nprint result.status_code\nprint result.json()"
- lang: Java
label: Java
source: "package com.my.project;\nimport com.mailjet.client.errors.MailjetException;\nimport com.mailjet.client.errors.MailjetSocketTimeoutException;\nimport com.mailjet.client.MailjetClient;\nimport com.mailjet.client.MailjetRequest;\nimport com.mailjet.client.MailjetResponse;\nimport com.mailjet.client.ClientOptions;\nimport com.mailjet.client.resource.Listrecipient;\nimport org.json.JSONArray;\nimport org.json.JSONObject;\npublic class MyClass {\n public static void main(String[] args) throws MailjetException, MailjetSocketTimeoutException {\n MailjetClient client;\n MailjetRequest request;\n MailjetResponse response;\n client = new MailjetClient(System.getenv(\"MJ_APIKEY_PUBLIC\"), System.getenv(\"MJ_APIKEY_PRIVATE\"), new ClientOptions(\"v3\"));\n request = new MailjetRequest(Listrecipient.resource)\n .property(Listrecipient.ISUNSUBSCRIBED, true)\n .property(Listrecipient.CONTACTID, 987654321)\n .property(Listrecipient.CONTACTALT, \"passenger@mailjet.com\")\n .property(Listrecipient.LISTID, 123456)\n .property(Listrecipient.LISTALT, \"abcdef123\")\n );\n response = client.post(request);\n System.out.println(response.getStatus());\n System.out.println(response.getData());\n }\n}"
- lang: Go
label: Go
source: "package main\nimport (\n\t\"fmt\"\n\t\"log\"\n\t\"os\"\n\tmailjet \"github.com/mailjet/mailjet-apiv3-go\"\n\t\"github.com/mailjet/mailjet-apiv3-go/resources\"\n)\nfunc main () {\n\tmailjetClient := NewMailjetClient(os.Getenv(\"MJ_APIKEY_PUBLIC\"), os.Getenv(\"MJ_APIKEY_PRIVATE\"))\n\tvar data []resources.Listrecipient\n\tmr := &Request{\n\t Resource: \"listrecipient\",\n\t}\n\tfmr := &FullRequest{\n\t Info: mr,\n\t Payload: &resources.Listrecipient { \n\t IsUnsubscribed:true,\n\t ContactID:987654321,\n\t ContactAlt:\"passenger@mailjet.com\",\n\t ListID:123456,\n\t ListAlt:\"abcdef123\"\n }\n\t}\n\terr := mailjetClient.Post(fmr, &data)\n\tif err != nil {\n\t fmt.Println(err)\n\t}\n\tfmt.Printf(\"Data array: %+v\\n\", data)\n}"
- lang: C#
label: C#
source: "using Mailjet.Client;\nusing Mailjet.Client.Resources;\nusing System;\nusing Newtonsoft.Json.Linq;\nnamespace Mailjet.ConsoleApplication\n{\n class Program\n {\n static void Main(string[] args)\n {\n RunAsync().Wait();\n }\n static async Task RunAsync()\n {\n MailjetClient client = new MailjetClient(Environment.GetEnvironmentVariable(\"MJ_APIKEY_PUBLIC\"), Environment.GetEnvironmentVariable(\"MJ_APIKEY_PRIVATE\"))\n {\n Version = ApiVersion.V3,\n };\n MailjetRequest request = new MailjetRequest\n {\n Resource = Listrecipient.Resource,\n }\n .Property(Listrecipient.IsUnsubscribed, true)\n .Property(Listrecipient.ContactID, 987654321)\n .Property(Listrecipient.ContactAlt, \"passenger@mailjet.com\")\n .Property(Listrecipient.ListID, 123456)\n .Property(Listrecipient.ListAlt, \"abcdef123\");\n MailjetResponse response = await client.PostAsync(request);\n if (response.IsSuccessStatusCode)\n {\n Console.WriteLine(string.Format(\"Total: {0}, Count: {1}\\n\", response.GetTotal(), response.GetCount()));\n Console.WriteLine(response.GetData());\n }\n else\n {\n Console.WriteLine(string.Format(\"StatusCode: {0}\\n\", response.StatusCode));\n Console.WriteLine(string.Format(\"ErrorInfo: {0}\\n\", response.GetErrorInfo()));\n Console.WriteLine(response.GetData());\n Console.WriteLine(string.Format(\"ErrorMessage: {0}\\n\", response.GetErrorMessage()));\n }\n }\n }\n}"
"/v3/REST/listrecipient/{listrecipient_ID}":
get:
x-seo:
title: "List Recipient by ID"
description: "Retrieve details for a specific list recipient, including the contact and list associated with it, as well as the subscription status."
tags:
- Contacts
summary: List Recipient by ID
description: Retrieve details for a specific list recipient, including the contact and list associated with it, as well as the subscription status. To obtain a valid `listrecipient_ID`, first call `GET /v3/REST/listrecipient` to list your list recipients.
operationId: get_v3_listrecipient_id
parameters:
- name: listrecipient_ID
in: path
schema:
$ref: '#/components/schemas/get_v3_listrecipient_id_PathParams/properties/listrecipient_ID'
required: true
example: 14000
responses:
'200':
description: Default OK response for `/listrecipient`
content:
application/json:
schema:
type: object
properties:
Count:
description: Indicates the number of objects in the `Data` array.
type: integer
format: int64
examples:
- 1
Data:
description: A JSON array containing a list of objects returned by this endpoint.
type: array
items:
$ref: '#/components/schemas/OutputListrecipient'
Total:
description: Indicates the number of objects in the `Data` array.
type: integer
format: int64
examples:
- 1
'400':
$ref: '#/components/responses/400'
'401':
$ref: '#/components/responses/401'
'403':
$ref: '#/components/responses/403'
'404':
$ref: '#/components/responses/404'
'429':
$ref: '#/components/responses/429'
'500':
$ref: '#/components/responses/500'
security:
- basicAuth: []
x-codeSamples:
- lang: curl
label: cURL
source: "curl -s \\\n\t-X GET \\\n\t--user \"$MJ_APIKEY_PUBLIC:$MJ_APIKEY_PRIVATE\" \\\n\thttps://api.mailjet.com/v3/REST/listrecipient/$listrecipient_ID \\"
- lang: PHP
label: PHP
source: " 'v3']);\n$response = $mj->get(Resources::$Listrecipient, ['id' => $id]);\n$response->success() && var_dump($response->getData());\n?>"
- lang: Node.js
label: Node
source: "const mailjet = require ('node-mailjet')\n\t.connect(process.env.MJ_APIKEY_PUBLIC, process.env.MJ_APIKEY_PRIVATE)\nconst request = mailjet\n\t.get(\"listrecipient\", {'version': 'v3'})\n\t.id($listrecipient_ID)\n\t.request()\nrequest\n\t.then((result) => {\n\t\tconsole.log(result.body)\n\t})\n\t.catch((err) => {\n\t\tconsole.log(err.statusCode)\n\t})"
- lang: Ruby
label: Ruby
source: "require 'mailjet'\nMailjet.configure do |config|\n config.api_key = ENV['MJ_APIKEY_PUBLIC']\n config.secret_key = ENV['MJ_APIKEY_PRIVATE']\n config.api_version = \"v3\"\nend\nvariable = Mailjet::Listrecipient.find($listrecipient_ID\n)\np variable.attributes['Data']"
- lang: Python
label: Python
source: "from mailjet_rest import Client\nimport os\napi_key = os.environ['MJ_APIKEY_PUBLIC']\napi_secret = os.environ['MJ_APIKEY_PRIVATE']\nmailjet = Client(auth=(api_key, api_secret), version='v3')\nid = '$listrecipient_ID'\nresult = mailjet.listrecipient.get(id=id)\nprint result.status_code\nprint result.json()"
- lang: Java
label: Java
source: "package com.my.project;\nimport com.mailjet.client.errors.MailjetException;\nimport com.mailjet.client.errors.MailjetSocketTimeoutException;\nimport com.mailjet.client.MailjetClient;\nimport com.mailjet.client.MailjetRequest;\nimport com.mailjet.client.MailjetResponse;\nimport com.mailjet.client.ClientOptions;\nimport com.mailjet.client.resource.Listrecipient;\nimport org.json.JSONArray;\nimport org.json.JSONObject;\npublic class MyClass {\n public static void main(String[] args) throws MailjetException, MailjetSocketTimeoutException {\n MailjetClient client;\n MailjetRequest request;\n MailjetResponse response;\n client = new MailjetClient(System.getenv(\"MJ_APIKEY_PUBLIC\"), System.getenv(\"MJ_APIKEY_PRIVATE\"), new ClientOptions(\"v3\"));\n request = new MailjetRequest(Listrecipient.resource, ID);\n response = client.get(request);\n System.out.println(response.getStatus());\n System.out.println(response.getData());\n }\n}"
- lang: Go
label: Go
source: "package main\nimport (\n\t\"fmt\"\n\t\"log\"\n\t\"os\"\n\tmailjet \"github.com/mailjet/mailjet-apiv3-go\"\n\t\"github.com/mailjet/mailjet-apiv3-go/resources\"\n)\nfunc main () {\n\tmailjetClient := NewMailjetClient(os.Getenv(\"MJ_APIKEY_PUBLIC\"), os.Getenv(\"MJ_APIKEY_PRIVATE\"))\n\tvar data []resources.Listrecipient\n\tmr := &Request{\n\t Resource: \"listrecipient\",\n\t ID: RESOURCE_ID,\n\t}\n\terr := mailjetClient.Get(mr, &data)\n\tif err != nil {\n\t fmt.Println(err)\n\t}\n\tfmt.Printf(\"Data array: %+v\\n\", data)\n}"
- lang: C#
label: C#
source: "using Mailjet.Client;\nusing Mailjet.Client.Resources;\nusing System;\nusing Newtonsoft.Json.Linq;\nnamespace Mailjet.ConsoleApplication\n{\n class Program\n {\n static void Main(string[] args)\n {\n RunAsync().Wait();\n }\n static async Task RunAsync()\n {\n MailjetClient client = new MailjetClient(Environment.GetEnvironmentVariable(\"MJ_APIKEY_PUBLIC\"), Environment.GetEnvironmentVariable(\"MJ_APIKEY_PRIVATE\"))\n {\n Version = ApiVersion.V3,\n };\n MailjetRequest request = new MailjetRequest\n {\n Resource = Listrecipient.Resource,\n ResourceId = ResourceId.Numeric(ID)\n }\n MailjetResponse response = await client.GetAsync(request);\n if (response.IsSuccessStatusCode)\n {\n Console.WriteLine(string.Format(\"Total: {0}, Count: {1}\\n\", response.GetTotal(), response.GetCount()));\n Console.WriteLine(response.GetData());\n }\n else\n {\n Console.WriteLine(string.Format(\"StatusCode: {0}\\n\", response.StatusCode));\n Console.WriteLine(string.Format(\"ErrorInfo: {0}\\n\", response.GetErrorInfo()));\n Console.WriteLine(response.GetData());\n Console.WriteLine(string.Format(\"ErrorMessage: {0}\\n\", response.GetErrorMessage()));\n }\n }\n }\n}"
put:
x-seo:
title: "Update List Recipient"
description: "Update List Recipient using the Mailjet Email API. Update the subscription status of a list recipient."
tags:
- Contacts
summary: Update List Recipient
description: Update the subscription status of a list recipient. To obtain a valid `listrecipient_ID`, first call `GET /v3/REST/listrecipient` to list your list recipients.
operationId: put_v3_listrecipient_id
parameters:
- name: listrecipient_ID
in: path
schema:
$ref: '#/components/schemas/put_v3_listrecipient_id_PathParams/properties/listrecipient_ID'
required: true
example: 14000
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/UpdateListrecipient'
example:
IsUnsubscribed: false
responses:
'200':
description: Default OK response for `/listrecipient`
content:
application/json:
schema:
type: object
properties:
Count:
description: Indicates the number of objects in the `Data` array.
type: integer
format: int64
examples:
- 1
Data:
description: A JSON array containing a list of objects returned by this endpoint.
type: array
items:
$ref: '#/components/schemas/OutputListrecipient'
Total:
description: Indicates the number of objects in the `Data` array.
type: integer
format: int64
examples:
- 1
'400':
$ref: '#/components/responses/400'
'401':
$ref: '#/components/responses/401'
'403':
$ref: '#/components/responses/403'
'404':
$ref: '#/components/responses/404'
'429':
$ref: '#/components/responses/429'
'500':
$ref: '#/components/responses/500'
security:
- basicAuth: []
x-codeSamples:
- lang: curl
label: cURL
source: "curl -s \\\n\t-X PUT \\\n\t--user \"$MJ_APIKEY_PUBLIC:$MJ_APIKEY_PRIVATE\" \\\n\thttps://api.mailjet.com/v3/REST/listrecipient/$listrecipient_ID \\\n\t-H 'Content-Type: application/json' \\\n\t-d '{\n \"IsUnsubscribed\":true\n\t}'"
- lang: PHP
label: PHP
source: " 'v3']);\n$body = [\n 'IsUnsubscribed' => true\n];\n$response = $mj->put(Resources::$Listrecipient, ['id' => $id, 'body' => $body]);\n$response->success() && var_dump($response->getData());\n?>"
- lang: Node.js
label: Node
source: "const mailjet = require ('node-mailjet')\n\t.connect(process.env.MJ_APIKEY_PUBLIC, process.env.MJ_APIKEY_PRIVATE)\nconst request = mailjet\n\t.put(\"listrecipient\", {'version': 'v3'})\n\t.id($listrecipient_ID)\n\t.request({\n \"IsUnsubscribed\":true\n })\nrequest\n\t.then((result) => {\n\t\tconsole.log(result.body)\n\t})\n\t.catch((err) => {\n\t\tconsole.log(err.statusCode)\n\t})"
- lang: Ruby
label: Ruby
source: "require 'mailjet'\nMailjet.configure do |config|\n config.api_key = ENV['MJ_APIKEY_PUBLIC']\n config.secret_key = ENV['MJ_APIKEY_PRIVATE']\n config.api_version = \"v3\"\nend\ntarget = Mailjet::Listrecipient.find($listrecipient_ID)\ntarget.update_attributes(\n is_unsubscribed: true\n)\np variable.attributes['Data']"
- lang: Python
label: Python
source: "from mailjet_rest import Client\nimport os\napi_key = os.environ['MJ_APIKEY_PUBLIC']\napi_secret = os.environ['MJ_APIKEY_PRIVATE']\nmailjet = Client(auth=(api_key, api_secret), version='v3')\nid = '$listrecipient_ID'\ndata = {\n 'IsUnsubscribed': True\n}\nresult = mailjet.listrecipient.update(id=id, data=data)\nprint result.status_code\nprint result.json()"
- lang: Java
label: Java
source: "package com.my.project;\nimport com.mailjet.client.errors.MailjetException;\nimport com.mailjet.client.errors.MailjetSocketTimeoutException;\nimport com.mailjet.client.MailjetClient;\nimport com.mailjet.client.MailjetRequest;\nimport com.mailjet.client.MailjetResponse;\nimport com.mailjet.client.ClientOptions;\nimport com.mailjet.client.resource.Listrecipient;\nimport org.json.JSONArray;\nimport org.json.JSONObject;\npublic class MyClass {\n public static void main(String[] args) throws MailjetException, MailjetSocketTimeoutException {\n MailjetClient client;\n MailjetRequest request;\n MailjetResponse response;\n client = new MailjetClient(System.getenv(\"MJ_APIKEY_PUBLIC\"), System.getenv(\"MJ_APIKEY_PRIVATE\"), new ClientOptions(\"v3\"));\n request = new MailjetRequest(Listrecipient.resource, ID)\n .property(Listrecipient.ISUNSUBSCRIBED, true)\n );\n response = client.put(request);\n System.out.println(response.getStatus());\n System.out.println(response.getData());\n }\n}"
- lang: Go
label: Go
source: "package main\nimport (\n\t\"fmt\"\n\t\"log\"\n\t\"os\"\n\tmailjet \"github.com/mailjet/mailjet-apiv3-go\"\n\t\"github.com/mailjet/mailjet-apiv3-go/resources\"\n)\nfunc main () {\n\tmailjetClient := NewMailjetClient(os.Getenv(\"MJ_APIKEY_PUBLIC\"), os.Getenv(\"MJ_APIKEY_PRIVATE\"))\n\tmr := &Request{\n\t Resource: \"listrecipient\",\n\t ID: RESOURCE_ID,\n\t}\n\tfmr := &FullRequest{\n\t Info: mr,\n\t Payload: &resources.Listrecipient { \n\t IsUnsubscribed:true\n }\n\t}\n\terr := mailjetClient.Put(fmr)\n\tif err != nil {\n\t fmt.Println(err)\n\t}\n}"
- lang: C#
label: C#
source: "using Mailjet.Client;\nusing Mailjet.Client.Resources;\nusing System;\nusing Newtonsoft.Json.Linq;\nnamespace Mailjet.ConsoleApplication\n{\n class Program\n {\n static void Main(string[] args)\n {\n RunAsync().Wait();\n }\n static async Task RunAsync()\n {\n MailjetClient client = new MailjetClient(Environment.GetEnvironmentVariable(\"MJ_APIKEY_PUBLIC\"), Environment.GetEnvironmentVariable(\"MJ_APIKEY_PRIVATE\"))\n {\n Version = ApiVersion.V3,\n };\n MailjetRequest request = new MailjetRequest\n {\n Resource = Listrecipient.Resource,\n ResourceId = ResourceId.Numeric(ID)\n }\n .Property(Listrecipient.IsUnsubscribed, true);\n MailjetResponse response = await client.PutAsync(request);\n if (response.IsSuccessStatusCode)\n {\n Console.WriteLine(string.Format(\"Total: {0}, Count: {1}\\n\", response.GetTotal(), response.GetCount()));\n Console.WriteLine(response.GetData());\n }\n else\n {\n Console.WriteLine(string.Format(\"StatusCode: {0}\\n\", response.StatusCode));\n Console.WriteLine(string.Format(\"ErrorInfo: {0}\\n\", response.GetErrorInfo()));\n Console.WriteLine(response.GetData());\n Console.WriteLine(string.Format(\"ErrorMessage: {0}\\n\", response.GetErrorMessage()));\n }\n }\n }\n}"
delete:
x-seo:
title: "Delete List Recipient"
description: "Delete List Recipient in the Mailjet Email API. Delete a list recipient. This effectively removes a contact from a contact list."
tags:
- Contacts
summary: Delete List Recipient
description: Delete a list recipient. This effectively removes a contact from a contact list.
operationId: delete_v3_listrecipient_id
parameters:
- name: listrecipient_ID
in: path
schema:
$ref: '#/components/schemas/delete_v3_listrecipient_id_PathParams/properties/listrecipient_ID'
required: true
responses:
'204':
$ref: '#/components/responses/204'
'400':
$ref: '#/components/responses/400'
'401':
$ref: '#/components/responses/401'
'403':
$ref: '#/components/responses/403'
'404':
$ref: '#/components/responses/404'
'429':
$ref: '#/components/responses/429'
'500':
$ref: '#/components/responses/500'
security:
- basicAuth: []
x-codeSamples:
- lang: curl
label: cURL
source: "curl -s \\\n\t-X DELETE \\\n\t--user \"$MJ_APIKEY_PUBLIC:$MJ_APIKEY_PRIVATE\" \\\n\thttps://api.mailjet.com/v3/REST/listrecipient/$listrecipient_ID \\\n\t-H 'Content-Type: application/json' \\\n\t-d '{\n\t}'"
- lang: PHP
label: PHP
source: " 'v3']);\n$response = $mj->delete(Resources::$Listrecipient, ['id' => $id]);\n$response->success() && var_dump($response->getData());\n?>"
- lang: Node.js
label: Node
source: "const mailjet = require ('node-mailjet')\n\t.connect(process.env.MJ_APIKEY_PUBLIC, process.env.MJ_APIKEY_PRIVATE)\nconst request = mailjet\n\t.delete(\"listrecipient\", {'version': 'v3'})\n\t.id($listrecipient_ID)\n\t.request()\nrequest\n\t.then((result) => {\n\t\tconsole.log(result.body)\n\t})\n\t.catch((err) => {\n\t\tconsole.log(err.statusCode)\n\t})"
- lang: Ruby
label: Ruby
source: "require 'mailjet'\nMailjet.configure do |config|\n config.api_key = ENV['MJ_APIKEY_PUBLIC']\n config.secret_key = ENV['MJ_APIKEY_PRIVATE']\n config.api_version = \"v3\"\nend\ntarget = Mailjet::Listrecipient.find($listrecipient_ID)\ntarget.delete(\n)\np variable.attributes['Data']"
- lang: Python
label: Python
source: "from mailjet_rest import Client\nimport os\napi_key = os.environ['MJ_APIKEY_PUBLIC']\napi_secret = os.environ['MJ_APIKEY_PRIVATE']\nmailjet = Client(auth=(api_key, api_secret), version='v3')\nid = '$listrecipient_ID'\nresult = mailjet.listrecipient.delete(id=id)\nprint result.status_code\nprint result.json()"
- lang: Java
label: Java
source: "package com.my.project;\nimport com.mailjet.client.errors.MailjetException;\nimport com.mailjet.client.errors.MailjetSocketTimeoutException;\nimport com.mailjet.client.MailjetClient;\nimport com.mailjet.client.MailjetRequest;\nimport com.mailjet.client.MailjetResponse;\nimport com.mailjet.client.ClientOptions;\nimport com.mailjet.client.resource.Listrecipient;\nimport org.json.JSONArray;\nimport org.json.JSONObject;\npublic class MyClass {\n public static void main(String[] args) throws MailjetException, MailjetSocketTimeoutException {\n MailjetClient client;\n MailjetRequest request;\n MailjetResponse response;\n client = new MailjetClient(System.getenv(\"MJ_APIKEY_PUBLIC\"), System.getenv(\"MJ_APIKEY_PRIVATE\"), new ClientOptions(\"v3\"));\n request = new MailjetRequest(Listrecipient.resource, ID);\n response = client.delete(request);\n System.out.println(response.getStatus());\n System.out.println(response.getData());\n }\n}"
- lang: Go
label: Go
source: "package main\nimport (\n\t\"fmt\"\n\t\"log\"\n\t\"os\"\n\tmailjet \"github.com/mailjet/mailjet-apiv3-go\"\n\t\"github.com/mailjet/mailjet-apiv3-go/resources\"\n)\nfunc main () {\n\tmailjetClient := NewMailjetClient(os.Getenv(\"MJ_APIKEY_PUBLIC\"), os.Getenv(\"MJ_APIKEY_PRIVATE\"))\n\tmr := &Request{\n\t Resource: \"listrecipient\",\n\t ID: RESOURCE_ID,\n\t}\n\terr := mailjetClient.Delete(mr)\n\tif err != nil {\n\t fmt.Println(err)\n\t}\n}"
- lang: C#
label: C#
source: "using Mailjet.Client;\nusing Mailjet.Client.Resources;\nusing System;\nusing Newtonsoft.Json.Linq;\nnamespace Mailjet.ConsoleApplication\n{\n class Program\n {\n static void Main(string[] args)\n {\n RunAsync().Wait();\n }\n static async Task RunAsync()\n {\n MailjetClient client = new MailjetClient(Environment.GetEnvironmentVariable(\"MJ_APIKEY_PUBLIC\"), Environment.GetEnvironmentVariable(\"MJ_APIKEY_PRIVATE\"))\n {\n Version = ApiVersion.V3,\n };\n MailjetRequest request = new MailjetRequest\n {\n Resource = Listrecipient.Resource,\n ResourceId = ResourceId.Numeric(ID)\n }\n MailjetResponse response = await client.DeleteAsync(request);\n if (response.IsSuccessStatusCode)\n {\n Console.WriteLine(string.Format(\"Total: {0}, Count: {1}\\n\", response.GetTotal(), response.GetCount()));\n Console.WriteLine(response.GetData());\n }\n else\n {\n Console.WriteLine(string.Format(\"StatusCode: {0}\\n\", response.StatusCode));\n Console.WriteLine(string.Format(\"ErrorInfo: {0}\\n\", response.GetErrorInfo()));\n Console.WriteLine(response.GetData());\n Console.WriteLine(string.Format(\"ErrorMessage: {0}\\n\", response.GetErrorMessage()));\n }\n }\n }\n}"
/v3/REST/contact/managemanycontacts:
post:
x-seo:
title: "Contact: Manage Many Contacts"
description: "Manage multiple contacts by adding, removing or unsubscribing them from multiple contact lists. Separate actions are set for each list and implemented\u2026"
tags:
- Contacts
summary: 'Contact: Manage Many Contacts'
description: "Manage multiple contacts by adding, removing or unsubscribing them from multiple contact lists. Separate actions are set for each list and implemented for all contacts listed.\n\nOnce you submit the `POST` request, it will return a `JobID`, which you can use to verify the success of the `POST` request, as well as see what kind of errors came up.\n"
operationId: post_v3_contact_managemanycontacts
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/NewContactManagemanycontacts'
example:
Contacts:
- Email: contact@example.com
Name: Passenger 1
IsExcludedFromCampaigns: false
ContactsLists:
- ListID: 987654321
Action: addforce
responses:
'201':
description: Default OK response `/contact/managemanycontacts`
content:
application/json:
schema:
type: object
properties:
Count:
description: Indicates the number of objects in the `Data` array.
type: integer
format: int64
examples:
- 1
Data:
description: A JSON array containing a list of objects returned by this endpoint.
type: array
items:
$ref: '#/components/schemas/ActionIDContactManagemanycontacts'
Total:
description: Indicates the number of objects in the `Data` array.
type: integer
format: int64
examples:
- 1
'400':
$ref: '#/components/responses/400'
'401':
$ref: '#/components/responses/401'
'403':
$ref: '#/components/responses/403'
'404':
$ref: '#/components/responses/404'
'429':
$ref: '#/components/responses/429'
'500':
$ref: '#/components/responses/500'
security:
- basicAuth: []
x-codeSamples:
- lang: curl
label: cURL
source: "curl -s \\\n\t-X POST \\\n\t--user \"$MJ_APIKEY_PUBLIC:$MJ_APIKEY_PRIVATE\" \\\n\thttps://api.mailjet.com/v3/REST/contact/managemanycontacts \\\n\t-H 'Content-Type: application/json' \\\n\t-d '{\n \"Contacts\":[\n {\n \"Email\":\"passenger@mailjet.com\",\n \"IsExcludedFromCampaigns\":\"false\",\n \"Name\":\"Passenger 1\",\n \"Properties\":\"object\"\n }\n ],\n \"ContactsLists\":[\n {\n \"Action\":\"addforce\",\n \"ListID\":\"987654321\"\n },\n {\n \"Action\":\"addnoforce\",\n \"ListID\":\"987654321\"\n },\n {\n \"Action\":\"remove\",\n \"ListID\":\"987654321\"\n },\n {\n \"Action\":\"unsub\",\n \"ListID\":\"987654321\"\n }\n ]\n\t}'"
- lang: PHP
label: PHP
source: " 'v3']);\n$body = [\n 'Contacts' => [\n [\n 'Email' => \"passenger@mailjet.com\",\n 'IsExcludedFromCampaigns' => \"false\",\n 'Name' => \"Passenger 1\",\n 'Properties' => \"object\"\n ]\n ],\n 'ContactsLists' => [\n [\n 'Action' => \"addforce\",\n 'ListID' => \"987654321\"\n ],\n [\n 'Action' => \"addnoforce\",\n 'ListID' => \"987654321\"\n ],\n [\n 'Action' => \"remove\",\n 'ListID' => \"987654321\"\n ],\n [\n 'Action' => \"unsub\",\n 'ListID' => \"987654321\"\n ]\n ]\n];\n$response = $mj->post(Resources::$ContactManagemanycontacts, ['body' => $body]);\n$response->success() && var_dump($response->getData());\n?>"
- lang: Node.js
label: Node
source: "const mailjet = require ('node-mailjet')\n\t.connect(process.env.MJ_APIKEY_PUBLIC, process.env.MJ_APIKEY_PRIVATE)\nconst request = mailjet\n\t.post(\"contact\", {'version': 'v3'})\n\t.action(\"managemanycontacts\")\n\t.request({\n \"Contacts\":[\n {\n \"Email\":\"passenger@mailjet.com\",\n \"IsExcludedFromCampaigns\":\"false\",\n \"Name\":\"Passenger 1\",\n \"Properties\":\"object\"\n }\n ],\n \"ContactsLists\":[\n {\n \"Action\":\"addforce\",\n \"ListID\":\"987654321\"\n },\n {\n \"Action\":\"addnoforce\",\n \"ListID\":\"987654321\"\n },\n {\n \"Action\":\"remove\",\n \"ListID\":\"987654321\"\n },\n {\n \"Action\":\"unsub\",\n \"ListID\":\"987654321\"\n }\n ]\n })\nrequest\n\t.then((result) => {\n\t\tconsole.log(result.body)\n\t})\n\t.catch((err) => {\n\t\tconsole.log(err.statusCode)\n\t})"
- lang: Ruby
label: Ruby
source: "require 'mailjet'\nMailjet.configure do |config|\n config.api_key = ENV['MJ_APIKEY_PUBLIC']\n config.secret_key = ENV['MJ_APIKEY_PRIVATE']\n config.api_version = \"v3\"\nend\nvariable = Mailjet::Contact_managemanycontacts.create(\n contacts: [\n {\n 'email' => \"passenger@mailjet.com\",\n 'is_excluded_from_campaigns' => \"false\",\n 'name' => \"Passenger 1\",\n 'properties' => \"object\"\n }\n ],\n ,\n contacts_lists: [\n {\n 'action' => \"addforce\",\n 'list_id' => \"987654321\"\n },\n {\n 'action' => \"addnoforce\",\n 'list_id' => \"987654321\"\n },\n {\n 'action' => \"remove\",\n 'list_id' => \"987654321\"\n },\n {\n 'action' => \"unsub\",\n 'list_id' => \"987654321\"\n }\n ]\n)\np variable.attributes['Data']"
- lang: Python
label: Python
source: "from mailjet_rest import Client\nimport os\napi_key = os.environ['MJ_APIKEY_PUBLIC']\napi_secret = os.environ['MJ_APIKEY_PRIVATE']\nmailjet = Client(auth=(api_key, api_secret), version='v3')\ndata = {\n 'Contacts': [\n {\n \"Email\": \"passenger@mailjet.com\",\n \"IsExcludedFromCampaigns\": \"false\",\n \"Name\": \"Passenger 1\",\n \"Properties\": \"object\"\n }\n ],\n 'ContactsLists': [\n {\n \"Action\": \"addforce\",\n \"ListID\": \"987654321\"\n },\n {\n \"Action\": \"addnoforce\",\n \"ListID\": \"987654321\"\n },\n {\n \"Action\": \"remove\",\n \"ListID\": \"987654321\"\n },\n {\n \"Action\": \"unsub\",\n \"ListID\": \"987654321\"\n }\n ]\n}\nresult = mailjet.contact_managemanycontacts.create(data=data)\nprint result.status_code\nprint result.json()"
- lang: Java
label: Java
source: "package com.my.project;\nimport com.mailjet.client.errors.MailjetException;\nimport com.mailjet.client.errors.MailjetSocketTimeoutException;\nimport com.mailjet.client.MailjetClient;\nimport com.mailjet.client.MailjetRequest;\nimport com.mailjet.client.MailjetResponse;\nimport com.mailjet.client.ClientOptions;\nimport com.mailjet.client.resource.ContactManagemanycontacts;\nimport org.json.JSONArray;\nimport org.json.JSONObject;\npublic class MyClass {\n public static void main(String[] args) throws MailjetException, MailjetSocketTimeoutException {\n MailjetClient client;\n MailjetRequest request;\n MailjetResponse response;\n client = new MailjetClient(System.getenv(\"MJ_APIKEY_PUBLIC\"), System.getenv(\"MJ_APIKEY_PRIVATE\"), new ClientOptions(\"v3\"));\n request = new MailjetRequest(ContactManagemanycontacts.resource)\n .property(ContactManagemanycontacts.CONTACTS, new JSONArray()\n .put(new JSONObject()\n .put(\"Email\", \"passenger@mailjet.com\")\n .put(\"IsExcludedFromCampaigns\", \"false\")\n .put(\"Name\", \"Passenger 1\")\n .put(\"Properties\", \"object\")\n )\n )\n .property(ContactManagemanycontacts.CONTACTSLISTS, new JSONArray()\n .put(new JSONObject()\n .put(\"Action\", \"addforce\")\n .put(\"ListID\", \"987654321\")\n )\n .put(new JSONObject()\n .put(\"Action\", \"addnoforce\")\n .put(\"ListID\", \"987654321\")\n )\n .put(new JSONObject()\n .put(\"Action\", \"remove\")\n .put(\"ListID\", \"987654321\")\n )\n .put(new JSONObject()\n .put(\"Action\", \"unsub\")\n .put(\"ListID\", \"987654321\")\n )\n )\n );\n response = client.post(request);\n System.out.println(response.getStatus());\n System.out.println(response.getData());\n }\n}"
- lang: Go
label: Go
source: "package main\nimport (\n\t\"fmt\"\n\t\"log\"\n\t\"os\"\n\tmailjet \"github.com/mailjet/mailjet-apiv3-go\"\n\t\"github.com/mailjet/mailjet-apiv3-go/resources\"\n)\nfunc main () {\n\tmailjetClient := NewMailjetClient(os.Getenv(\"MJ_APIKEY_PUBLIC\"), os.Getenv(\"MJ_APIKEY_PRIVATE\"))\n\tvar data []resources.ContactManagemanycontacts\n\tmr := &Request{\n\t Resource: \"contact\",\n\t Action: \"managemanycontacts\",\n\t}\n\tfmr := &FullRequest{\n\t Info: mr,\n\t Payload: &resources.ContactManagemanycontacts { \n Contacts: []MailjetContact {\n MailjetContact {\n Email:\"passenger@mailjet.com\",\n IsExcludedFromCampaigns:\"false\",\n Name:\"Passenger 1\",\n Properties:\"object\"\n }\n },\n ContactsLists: []MailjetContactsList {\n MailjetContactsList {\n Action:\"addforce\",\n ListID:\"987654321\"\n },\n MailjetContactsList {\n Action:\"addnoforce\",\n ListID:\"987654321\"\n },\n MailjetContactsList {\n Action:\"remove\",\n ListID:\"987654321\"\n },\n MailjetContactsList {\n Action:\"unsub\",\n ListID:\"987654321\"\n }\n }\n }\n\t}\n\terr := mailjetClient.Post(fmr, &data)\n\tif err != nil {\n\t fmt.Println(err)\n\t}\n\tfmt.Printf(\"Data array: %+v\\n\", data)\n}"
- lang: C#
label: C#
source: "using Mailjet.Client;\nusing Mailjet.Client.Resources;\nusing System;\nusing Newtonsoft.Json.Linq;\nnamespace Mailjet.ConsoleApplication\n{\n class Program\n {\n static void Main(string[] args)\n {\n RunAsync().Wait();\n }\n static async Task RunAsync()\n {\n MailjetClient client = new MailjetClient(Environment.GetEnvironmentVariable(\"MJ_APIKEY_PUBLIC\"), Environment.GetEnvironmentVariable(\"MJ_APIKEY_PRIVATE\"))\n {\n Version = ApiVersion.V3,\n };\n MailjetRequest request = new MailjetRequest\n {\n Resource = ContactManagemanycontacts.Resource,\n }\n .Property(ContactManagemanycontacts.Contacts, new JArray {\n new JObject {\n {\"Email\", \"passenger@mailjet.com\"},\n {\"IsExcludedFromCampaigns\", \"false\"},\n {\"Name\", \"Passenger 1\"},\n {\"Properties\", \"object\"}\n }\n })\n .Property(ContactManagemanycontacts.ContactsLists, new JArray {\n new JObject {\n {\"Action\", \"addforce\"},\n {\"ListID\", \"987654321\"}\n },\n new JObject {\n {\"Action\", \"addnoforce\"},\n {\"ListID\", \"987654321\"}\n },\n new JObject {\n {\"Action\", \"remove\"},\n {\"ListID\", \"987654321\"}\n },\n new JObject {\n {\"Action\", \"unsub\"},\n {\"ListID\", \"987654321\"}\n }\n });\n MailjetResponse response = await client.PostAsync(request);\n if (response.IsSuccessStatusCode)\n {\n Console.WriteLine(string.Format(\"Total: {0}, Count: {1}\\n\", response.GetTotal(), response.GetCount()));\n Console.WriteLine(response.GetData());\n }\n else\n {\n Console.WriteLine(string.Format(\"StatusCode: {0}\\n\", response.StatusCode));\n Console.WriteLine(string.Format(\"ErrorInfo: {0}\\n\", response.GetErrorInfo()));\n Console.WriteLine(response.GetData());\n Console.WriteLine(string.Format(\"ErrorMessage: {0}\\n\", response.GetErrorMessage()));\n }\n }\n }\n}"
/v3/REST/contact/managemanycontacts/{job_ID}:
get:
x-seo:
title: "Get Contact: Manage Many Contacts"
description: "Use the JobID generated after a POST /contact/managemanycontacts request to check its success, as well as any errors that might have occurred."
tags:
- Contacts
summary: 'Get Contact: Manage Many Contacts'
description: Use the `JobID` generated after a `POST /contact/managemanycontacts` request to check its success, as well as any errors that might have occurred.
operationId: get_v3_contact_managemanycontacts_id
parameters:
- name: job_ID
in: path
schema:
$ref: '#/components/schemas/get_v3_contact_managemanycontacts_id_PathParams/properties/job_ID'
required: true
example: 13000
responses:
'200':
description: Default OK response for /contact/managemanycontacts/{job_ID}
content:
application/json:
schema:
type: object
properties:
Count:
description: Indicates the number of objects in the `Data` array.
type: integer
format: int64
examples:
- 1
Data:
description: A JSON array containing a list of objects returned by this endpoint.
type: array
items:
$ref: '#/components/schemas/OutputContactManagemanycontacts'
Total:
description: Indicates the number of objects in the `Data` array.
type: integer
format: int64
examples:
- 1
'400':
$ref: '#/components/responses/400'
'401':
$ref: '#/components/responses/401'
'403':
$ref: '#/components/responses/403'
'404':
$ref: '#/components/responses/404'
'429':
$ref: '#/components/responses/429'
'500':
$ref: '#/components/responses/500'
security:
- basicAuth: []
x-codeSamples:
- lang: curl
label: cURL
source: "curl -s \\\n\t-X GET \\\n\t--user \"$MJ_APIKEY_PUBLIC:$MJ_APIKEY_PRIVATE\" \\\n\thttps://api.mailjet.com/v3/REST/contact/$job_ID/managemanycontacts \\"
- lang: PHP
label: PHP
source: " 'v3']);\n$response = $mj->get(Resources::$ContactManagemanycontacts, ['id' => $id]);\n$response->success() && var_dump($response->getData());\n?>"
- lang: Node.js
label: Node
source: "const mailjet = require ('node-mailjet')\n\t.connect(process.env.MJ_APIKEY_PUBLIC, process.env.MJ_APIKEY_PRIVATE)\nconst request = mailjet\n\t.get(\"contact\", {'version': 'v3'})\n\t.id($job_ID)\n\t.action(\"managemanycontacts\")\n\t.request()\nrequest\n\t.then((result) => {\n\t\tconsole.log(result.body)\n\t})\n\t.catch((err) => {\n\t\tconsole.log(err.statusCode)\n\t})"
- lang: Ruby
label: Ruby
source: "require 'mailjet'\nMailjet.configure do |config|\n config.api_key = ENV['MJ_APIKEY_PUBLIC']\n config.secret_key = ENV['MJ_APIKEY_PRIVATE']\n config.api_version = \"v3\"\nend\nvariable = Mailjet::Contact_managemanycontacts.find($job_ID\n)\np variable.attributes['Data']"
- lang: Python
label: Python
source: "from mailjet_rest import Client\nimport os\napi_key = os.environ['MJ_APIKEY_PUBLIC']\napi_secret = os.environ['MJ_APIKEY_PRIVATE']\nmailjet = Client(auth=(api_key, api_secret), version='v3')\nid = '$job_ID'\nresult = mailjet.contact_managemanycontacts.get(id=id)\nprint result.status_code\nprint result.json()"
- lang: Java
label: Java
source: "package com.my.project;\nimport com.mailjet.client.errors.MailjetException;\nimport com.mailjet.client.errors.MailjetSocketTimeoutException;\nimport com.mailjet.client.MailjetClient;\nimport com.mailjet.client.MailjetRequest;\nimport com.mailjet.client.MailjetResponse;\nimport com.mailjet.client.ClientOptions;\nimport com.mailjet.client.resource.ContactManagemanycontacts;\nimport org.json.JSONArray;\nimport org.json.JSONObject;\npublic class MyClass {\n public static void main(String[] args) throws MailjetException, MailjetSocketTimeoutException {\n MailjetClient client;\n MailjetRequest request;\n MailjetResponse response;\n client = new MailjetClient(System.getenv(\"MJ_APIKEY_PUBLIC\"), System.getenv(\"MJ_APIKEY_PRIVATE\"), new ClientOptions(\"v3\"));\n request = new MailjetRequest(ContactManagemanycontacts.resource, ID);\n response = client.get(request);\n System.out.println(response.getStatus());\n System.out.println(response.getData());\n }\n}"
- lang: Go
label: Go
source: "package main\nimport (\n\t\"fmt\"\n\t\"log\"\n\t\"os\"\n\tmailjet \"github.com/mailjet/mailjet-apiv3-go\"\n\t\"github.com/mailjet/mailjet-apiv3-go/resources\"\n)\nfunc main () {\n\tmailjetClient := NewMailjetClient(os.Getenv(\"MJ_APIKEY_PUBLIC\"), os.Getenv(\"MJ_APIKEY_PRIVATE\"))\n\tvar data []resources.ContactManagemanycontacts\n\tmr := &Request{\n\t Resource: \"contact\",\n\t ID: RESOURCE_ID,\n\t Action: \"managemanycontacts\",\n\t}\n\terr := mailjetClient.Get(mr, &data)\n\tif err != nil {\n\t fmt.Println(err)\n\t}\n\tfmt.Printf(\"Data array: %+v\\n\", data)\n}"
- lang: C#
label: C#
source: "using Mailjet.Client;\nusing Mailjet.Client.Resources;\nusing System;\nusing Newtonsoft.Json.Linq;\nnamespace Mailjet.ConsoleApplication\n{\n class Program\n {\n static void Main(string[] args)\n {\n RunAsync().Wait();\n }\n static async Task RunAsync()\n {\n MailjetClient client = new MailjetClient(Environment.GetEnvironmentVariable(\"MJ_APIKEY_PUBLIC\"), Environment.GetEnvironmentVariable(\"MJ_APIKEY_PRIVATE\"))\n {\n Version = ApiVersion.V3,\n };\n MailjetRequest request = new MailjetRequest\n {\n Resource = ContactManagemanycontacts.Resource,\n ResourceId = ResourceId.Numeric(ID)\n }\n MailjetResponse response = await client.GetAsync(request);\n if (response.IsSuccessStatusCode)\n {\n Console.WriteLine(string.Format(\"Total: {0}, Count: {1}\\n\", response.GetTotal(), response.GetCount()));\n Console.WriteLine(response.GetData());\n }\n else\n {\n Console.WriteLine(string.Format(\"StatusCode: {0}\\n\", response.StatusCode));\n Console.WriteLine(string.Format(\"ErrorInfo: {0}\\n\", response.GetErrorInfo()));\n Console.WriteLine(response.GetData());\n Console.WriteLine(string.Format(\"ErrorMessage: {0}\\n\", response.GetErrorMessage()));\n }\n }\n }\n}"
/v3/REST/contactslist/{list_ID}/managemanycontacts:
post:
x-seo:
title: "Contact List: Manage Many Contacts"
description: "Manage multiple contacts by adding, removing or unsubscribing them from a specific contact list. Once you submit the POST request, it will return a JobID\u2026"
tags:
- Contacts
summary: 'Contact List: Manage Many Contacts'
description: Manage multiple contacts by adding, removing or unsubscribing them from a specific contact list. Once you submit the `POST` request, it will return a `JobID`, which you can use to verify the success of the `POST` request, as well as see what kind of errors came up. To obtain a valid `list_ID`, first call `GET /v3/REST/contactslist` to list your contact lists.
operationId: post_v3_contactslist_id_managemanycontacts
parameters:
- name: list_ID
in: path
schema:
$ref: '#/components/schemas/post_v3_contactslist_id_managemanycontacts_PathParams/properties/list_ID'
required: true
example: 2000
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/NewContactslistManageManyContacts'
example:
Action: addnoforce
Contacts:
- Email: contact@example.com
Name: Passenger 1
IsExcludedFromCampaigns: false
responses:
'201':
description: Default OK response for `/contactslist` action `/managemanycontacts`
content:
application/json:
schema:
type: object
properties:
Count:
description: Indicates the number of objects in the `Data` array.
type: integer
format: int64
examples:
- 1
Data:
description: A JSON array containing a list of objects returned by this endpoint.
type: array
items:
$ref: '#/components/schemas/ActionIDContactslistManageManyContacts'
Total:
description: Indicates the number of objects in the `Data` array.
type: integer
format: int64
examples:
- 1
'400':
$ref: '#/components/responses/400'
'401':
$ref: '#/components/responses/401'
'403':
$ref: '#/components/responses/403'
'404':
$ref: '#/components/responses/404'
'429':
$ref: '#/components/responses/429'
'500':
$ref: '#/components/responses/500'
security:
- basicAuth: []
x-codeSamples:
- lang: curl
label: cURL
source: "curl -s \\\n\t-X POST \\\n\t--user \"$MJ_APIKEY_PUBLIC:$MJ_APIKEY_PRIVATE\" \\\n\thttps://api.mailjet.com/v3/REST/contactslist/$list_ID/managemanycontacts \\\n\t-H 'Content-Type: application/json' \\\n\t-d '{\n \"Action\":\"addnoforce\",\n \"Contacts\":[\n {\n \"Email\":\"passenger@mailjet.com\",\n \"IsExcludedFromCampaigns\":\"false\",\n \"Name\":\"Passenger 1\",\n \"Properties\":\"object\"\n }\n ]\n\t}'"
- lang: PHP
label: PHP
source: " 'v3']);\n$body = [\n 'Action' => \"addnoforce\",\n 'Contacts' => [\n [\n 'Email' => \"passenger@mailjet.com\",\n 'IsExcludedFromCampaigns' => \"false\",\n 'Name' => \"Passenger 1\",\n 'Properties' => \"object\"\n ]\n ]\n];\n$response = $mj->post(Resources::$ContactslistManagemanycontacts, ['id' => $id, 'body' => $body]);\n$response->success() && var_dump($response->getData());\n?>"
- lang: Node.js
label: Node
source: "const mailjet = require ('node-mailjet')\n\t.connect(process.env.MJ_APIKEY_PUBLIC, process.env.MJ_APIKEY_PRIVATE)\nconst request = mailjet\n\t.post(\"contactslist\", {'version': 'v3'})\n\t.id($list_ID)\n\t.action(\"managemanycontacts\")\n\t.request({\n \"Action\":\"addnoforce\",\n \"Contacts\":[\n {\n \"Email\":\"passenger@mailjet.com\",\n \"IsExcludedFromCampaigns\":\"false\",\n \"Name\":\"Passenger 1\",\n \"Properties\":\"object\"\n }\n ]\n })\nrequest\n\t.then((result) => {\n\t\tconsole.log(result.body)\n\t})\n\t.catch((err) => {\n\t\tconsole.log(err.statusCode)\n\t})"
- lang: Ruby
label: Ruby
source: "require 'mailjet'\nMailjet.configure do |config|\n config.api_key = ENV['MJ_APIKEY_PUBLIC']\n config.secret_key = ENV['MJ_APIKEY_PRIVATE']\n config.api_version = \"v3\"\nend\nvariable = Mailjet::Contactslist_managemanycontacts.create(id: $list_ID,\n action: \"addnoforce\",\n contacts: [\n {\n 'email' => \"passenger@mailjet.com\",\n 'is_excluded_from_campaigns' => \"false\",\n 'name' => \"Passenger 1\",\n 'properties' => \"object\"\n }\n ]\n)\np variable.attributes['Data']"
- lang: Python
label: Python
source: "from mailjet_rest import Client\nimport os\napi_key = os.environ['MJ_APIKEY_PUBLIC']\napi_secret = os.environ['MJ_APIKEY_PRIVATE']\nmailjet = Client(auth=(api_key, api_secret), version='v3')\nid = '$list_ID'\ndata = {\n 'Action': \"addnoforce\",\n 'Contacts': [\n {\n \"Email\": \"passenger@mailjet.com\",\n \"IsExcludedFromCampaigns\": \"false\",\n \"Name\": \"Passenger 1\",\n \"Properties\": \"object\"\n }\n ]\n}\nresult = mailjet.contactslist_managemanycontacts.create(id=id, data=data)\nprint result.status_code\nprint result.json()"
- lang: Java
label: Java
source: "package com.my.project;\nimport com.mailjet.client.errors.MailjetException;\nimport com.mailjet.client.errors.MailjetSocketTimeoutException;\nimport com.mailjet.client.MailjetClient;\nimport com.mailjet.client.MailjetRequest;\nimport com.mailjet.client.MailjetResponse;\nimport com.mailjet.client.ClientOptions;\nimport com.mailjet.client.resource.ContactslistManagemanycontacts;\nimport org.json.JSONArray;\nimport org.json.JSONObject;\npublic class MyClass {\n public static void main(String[] args) throws MailjetException, MailjetSocketTimeoutException {\n MailjetClient client;\n MailjetRequest request;\n MailjetResponse response;\n client = new MailjetClient(System.getenv(\"MJ_APIKEY_PUBLIC\"), System.getenv(\"MJ_APIKEY_PRIVATE\"), new ClientOptions(\"v3\"));\n request = new MailjetRequest(ContactslistManagemanycontacts.resource, ID)\n .property(ContactslistManagemanycontacts.ACTION, \"addnoforce\")\n .property(ContactslistManagemanycontacts.CONTACTS, new JSONArray()\n .put(new JSONObject()\n .put(\"Email\", \"passenger@mailjet.com\")\n .put(\"IsExcludedFromCampaigns\", \"false\")\n .put(\"Name\", \"Passenger 1\")\n .put(\"Properties\", \"object\")\n )\n )\n );\n response = client.post(request);\n System.out.println(response.getStatus());\n System.out.println(response.getData());\n }\n}"
- lang: Go
label: Go
source: "package main\nimport (\n\t\"fmt\"\n\t\"log\"\n\t\"os\"\n\tmailjet \"github.com/mailjet/mailjet-apiv3-go\"\n\t\"github.com/mailjet/mailjet-apiv3-go/resources\"\n)\nfunc main () {\n\tmailjetClient := NewMailjetClient(os.Getenv(\"MJ_APIKEY_PUBLIC\"), os.Getenv(\"MJ_APIKEY_PRIVATE\"))\n\tvar data []resources.ContactslistManagemanycontacts\n\tmr := &Request{\n\t Resource: \"contactslist\",\n\t ID: RESOURCE_ID,\n\t Action: \"managemanycontacts\",\n\t}\n\tfmr := &FullRequest{\n\t Info: mr,\n\t Payload: &resources.ContactslistManagemanycontacts { \n\t Action:\"addnoforce\",\n Contacts: []MailjetContact {\n MailjetContact {\n Email:\"passenger@mailjet.com\",\n IsExcludedFromCampaigns:\"false\",\n Name:\"Passenger 1\",\n Properties:\"object\"\n }\n }\n }\n\t}\n\terr := mailjetClient.Post(fmr, &data)\n\tif err != nil {\n\t fmt.Println(err)\n\t}\n\tfmt.Printf(\"Data array: %+v\\n\", data)\n}"
- lang: C#
label: C#
source: "using Mailjet.Client;\nusing Mailjet.Client.Resources;\nusing System;\nusing Newtonsoft.Json.Linq;\nnamespace Mailjet.ConsoleApplication\n{\n class Program\n {\n static void Main(string[] args)\n {\n RunAsync().Wait();\n }\n static async Task RunAsync()\n {\n MailjetClient client = new MailjetClient(Environment.GetEnvironmentVariable(\"MJ_APIKEY_PUBLIC\"), Environment.GetEnvironmentVariable(\"MJ_APIKEY_PRIVATE\"))\n {\n Version = ApiVersion.V3,\n };\n MailjetRequest request = new MailjetRequest\n {\n Resource = ContactslistManagemanycontacts.Resource,\n ResourceId = ResourceId.Numeric(ID)\n }\n .Property(ContactslistManagemanycontacts.Action, \"addnoforce\")\n .Property(ContactslistManagemanycontacts.Contacts, new JArray {\n new JObject {\n {\"Email\", \"passenger@mailjet.com\"},\n {\"IsExcludedFromCampaigns\", \"false\"},\n {\"Name\", \"Passenger 1\"},\n {\"Properties\", \"object\"}\n }\n });\n MailjetResponse response = await client.PostAsync(request);\n if (response.IsSuccessStatusCode)\n {\n Console.WriteLine(string.Format(\"Total: {0}, Count: {1}\\n\", response.GetTotal(), response.GetCount()));\n Console.WriteLine(response.GetData());\n }\n else\n {\n Console.WriteLine(string.Format(\"StatusCode: {0}\\n\", response.StatusCode));\n Console.WriteLine(string.Format(\"ErrorInfo: {0}\\n\", response.GetErrorInfo()));\n Console.WriteLine(response.GetData());\n Console.WriteLine(string.Format(\"ErrorMessage: {0}\\n\", response.GetErrorMessage()));\n }\n }\n }\n}"
/v3/REST/contactslist/{list_ID}/managemanycontacts/{job_ID}:
get:
x-seo:
title: "Get Contact List: Manage Many Contacts"
description: "Use the JobID generated after a POST /contactslist/{list id}/managemanycontacts request to check its progress, success, as well as any errors that might\u2026"
tags:
- Contacts
summary: 'Get Contact List: Manage Many Contacts'
description: Use the `JobID` generated after a `POST /contactslist/{list_id}/managemanycontacts` request to check its progress, success, as well as any errors that might have occurred. To obtain a valid `list_ID`, first call `GET /v3/REST/contactslist` to list your contact lists.
operationId: get_v3_contactslist_id_managemanycontacts_id
parameters:
- name: list_ID
in: path
schema:
$ref: '#/components/schemas/get_v3_contactslist_id_managemanycontacts_id_PathParams/properties/list_ID'
required: true
example: 2000
- name: job_ID
in: path
schema:
$ref: '#/components/schemas/get_v3_contactslist_id_managemanycontacts_id_PathParams/properties/job_ID'
required: true
example: 13000
responses:
'200':
description: Default OK response for `/contactslist` action `/managemanycontacts`
content:
application/json:
schema:
type: object
properties:
Count:
description: Indicates the number of objects in the `Data` array.
type: integer
format: int64
examples:
- 1
Data:
description: A JSON array containing a list of objects returned by this endpoint.
type: array
items:
$ref: '#/components/schemas/OutputContactslistManageManyContacts'
Total:
description: Indicates the number of objects in the `Data` array.
type: integer
format: int64
examples:
- 1
'400':
$ref: '#/components/responses/400'
'401':
$ref: '#/components/responses/401'
'403':
$ref: '#/components/responses/403'
'404':
$ref: '#/components/responses/404'
'429':
$ref: '#/components/responses/429'
'500':
$ref: '#/components/responses/500'
security:
- basicAuth: []
x-codeSamples:
- lang: curl
label: cURL
source: "curl -s \\\n\t-X GET \\\n\t--user \"$MJ_APIKEY_PUBLIC:$MJ_APIKEY_PRIVATE\" \\\n\thttps://api.mailjet.com/v3/REST/contactslist/$list_ID/managemanycontacts \\"
- lang: PHP
label: PHP
source: " 'v3']);\n$response = $mj->get(Resources::$ContactslistManagemanycontacts, ['id' => $id]);\n$response->success() && var_dump($response->getData());\n?>"
- lang: Node.js
label: Node
source: "const mailjet = require ('node-mailjet')\n\t.connect(process.env.MJ_APIKEY_PUBLIC, process.env.MJ_APIKEY_PRIVATE)\nconst request = mailjet\n\t.get(\"contactslist\", {'version': 'v3'})\n\t.id($list_ID)\n\t.action(\"managemanycontacts\")\n\t.id($job_ID)\n\t.request()\nrequest\n\t.then((result) => {\n\t\tconsole.log(result.body)\n\t})\n\t.catch((err) => {\n\t\tconsole.log(err.statusCode)\n\t})"
- lang: Ruby
label: Ruby
source: "require 'mailjet'\nMailjet.configure do |config|\n config.api_key = ENV['MJ_APIKEY_PUBLIC']\n config.secret_key = ENV['MJ_APIKEY_PRIVATE']\n config.api_version = \"v3\"\nend\nvariable = Mailjet::Contactslist_managemanycontacts.find($list_ID\n)\np variable.attributes['Data']"
- lang: Python
label: Python
source: "from mailjet_rest import Client\nimport os\napi_key = os.environ['MJ_APIKEY_PUBLIC']\napi_secret = os.environ['MJ_APIKEY_PRIVATE']\nmailjet = Client(auth=(api_key, api_secret), version='v3')\nid = '$list_ID'\nresult = mailjet.contactslist_managemanycontacts.get(id=id)\nprint result.status_code\nprint result.json()"
- lang: Java
label: Java
source: "package com.my.project;\nimport com.mailjet.client.errors.MailjetException;\nimport com.mailjet.client.errors.MailjetSocketTimeoutException;\nimport com.mailjet.client.MailjetClient;\nimport com.mailjet.client.MailjetRequest;\nimport com.mailjet.client.MailjetResponse;\nimport com.mailjet.client.ClientOptions;\nimport com.mailjet.client.resource.ContactslistManagemanycontacts;\nimport org.json.JSONArray;\nimport org.json.JSONObject;\npublic class MyClass {\n public static void main(String[] args) throws MailjetException, MailjetSocketTimeoutException {\n MailjetClient client;\n MailjetRequest request;\n MailjetResponse response;\n client = new MailjetClient(System.getenv(\"MJ_APIKEY_PUBLIC\"), System.getenv(\"MJ_APIKEY_PRIVATE\"), new ClientOptions(\"v3\"));\n request = new MailjetRequest(ContactslistManagemanycontacts.resource, ID);\n response = client.get(request);\n System.out.println(response.getStatus());\n System.out.println(response.getData());\n }\n}"
- lang: Go
label: Go
source: "package main\nimport (\n\t\"fmt\"\n\t\"log\"\n\t\"os\"\n\tmailjet \"github.com/mailjet/mailjet-apiv3-go\"\n\t\"github.com/mailjet/mailjet-apiv3-go/resources\"\n)\nfunc main () {\n\tmailjetClient := NewMailjetClient(os.Getenv(\"MJ_APIKEY_PUBLIC\"), os.Getenv(\"MJ_APIKEY_PRIVATE\"))\n\tvar data []resources.ContactslistManagemanycontacts\n\tmr := &Request{\n\t Resource: \"contactslist\",\n\t ID: RESOURCE_ID,\n\t Action: \"managemanycontacts\",\n\t}\n\terr := mailjetClient.Get(mr, &data)\n\tif err != nil {\n\t fmt.Println(err)\n\t}\n\tfmt.Printf(\"Data array: %+v\\n\", data)\n}"
- lang: C#
label: C#
source: "using Mailjet.Client;\nusing Mailjet.Client.Resources;\nusing System;\nusing Newtonsoft.Json.Linq;\nnamespace Mailjet.ConsoleApplication\n{\n class Program\n {\n static void Main(string[] args)\n {\n RunAsync().Wait();\n }\n static async Task RunAsync()\n {\n MailjetClient client = new MailjetClient(Environment.GetEnvironmentVariable(\"MJ_APIKEY_PUBLIC\"), Environment.GetEnvironmentVariable(\"MJ_APIKEY_PRIVATE\"))\n {\n Version = ApiVersion.V3,\n };\n MailjetRequest request = new MailjetRequest\n {\n Resource = ContactslistManagemanycontacts.Resource,\n ResourceId = ResourceId.Numeric(ID)\n }\n MailjetResponse response = await client.GetAsync(request);\n if (response.IsSuccessStatusCode)\n {\n Console.WriteLine(string.Format(\"Total: {0}, Count: {1}\\n\", response.GetTotal(), response.GetCount()));\n Console.WriteLine(response.GetData());\n }\n else\n {\n Console.WriteLine(string.Format(\"StatusCode: {0}\\n\", response.StatusCode));\n Console.WriteLine(string.Format(\"ErrorInfo: {0}\\n\", response.GetErrorInfo()));\n Console.WriteLine(response.GetData());\n Console.WriteLine(string.Format(\"ErrorMessage: {0}\\n\", response.GetErrorMessage()));\n }\n }\n }\n}"
/v3/REST/contactslist/{list_ID}/importlist:
post:
x-seo:
title: "Contact List: Import List"
description: "Add, unsubscribe or remove the contacts present in a list to / from another list. The list ID specified in the body of the payload is the source, while\u2026"
tags:
- Contacts
summary: 'Contact List: Import List'
description: Add, unsubscribe or remove the contacts present in a list to / from another list. The list ID specified in the body of the payload is the source, while ID in the path specifies the destination list. To obtain a valid `list_ID`, first call `GET /v3/REST/contactslist` to list your contact lists.
operationId: post_v3_contactslist_id_importlist
parameters:
- name: list_ID
in: path
schema:
$ref: '#/components/schemas/post_v3_contactslist_id_importlist_PathParams/properties/list_ID'
required: true
example: 2000
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/NewContactslistImportList'
example:
Action: addnoforce
ListID: 123456
responses:
'201':
description: Default OK response for `/contactslist` action `/importlist`
content:
application/json:
schema:
type: object
properties:
Count:
description: Indicates the number of objects in the `Data` array.
type: integer
format: int64
examples:
- 1
Data:
description: A JSON array containing a list of objects returned by this endpoint.
type: array
items:
$ref: '#/components/schemas/ActionIDContactslistImportList'
Total:
description: Indicates the number of objects in the `Data` array.
type: integer
format: int64
examples:
- 1
'400':
$ref: '#/components/responses/400'
'401':
$ref: '#/components/responses/401'
'403':
$ref: '#/components/responses/403'
'404':
$ref: '#/components/responses/404'
'429':
$ref: '#/components/responses/429'
'500':
$ref: '#/components/responses/500'
security:
- basicAuth: []
x-codeSamples:
- lang: curl
label: cURL
source: "curl -s \\\n\t-X POST \\\n\t--user \"$MJ_APIKEY_PUBLIC:$MJ_APIKEY_PRIVATE\" \\\n\thttps://api.mailjet.com/v3/REST/contactslist/$list_ID/importlist \\\n\t-H 'Content-Type: application/json' \\\n\t-d '{\n \"Action\":\"addnoforce\",\n \"ListID\":123456\n\t}'"
- lang: PHP
label: PHP
source: " 'v3']);\n$body = [\n 'Action' => \"addnoforce\",\n 'ListID' => 123456\n];\n$response = $mj->post(Resources::$ContactslistImportlist, ['id' => $id, 'body' => $body]);\n$response->success() && var_dump($response->getData());\n?>"
- lang: Node.js
label: Node
source: "const mailjet = require ('node-mailjet')\n\t.connect(process.env.MJ_APIKEY_PUBLIC, process.env.MJ_APIKEY_PRIVATE)\nconst request = mailjet\n\t.post(\"contactslist\", {'version': 'v3'})\n\t.id($list_ID)\n\t.action(\"importlist\")\n\t.request({\n \"Action\":\"addnoforce\",\n \"ListID\":123456\n })\nrequest\n\t.then((result) => {\n\t\tconsole.log(result.body)\n\t})\n\t.catch((err) => {\n\t\tconsole.log(err.statusCode)\n\t})"
- lang: Ruby
label: Ruby
source: "require 'mailjet'\nMailjet.configure do |config|\n config.api_key = ENV['MJ_APIKEY_PUBLIC']\n config.secret_key = ENV['MJ_APIKEY_PRIVATE']\n config.api_version = \"v3\"\nend\nvariable = Mailjet::Contactslist_importlist.create(id: $list_ID,\n action: \"addnoforce\",\n list_id: 123456\n)\np variable.attributes['Data']"
- lang: Python
label: Python
source: "from mailjet_rest import Client\nimport os\napi_key = os.environ['MJ_APIKEY_PUBLIC']\napi_secret = os.environ['MJ_APIKEY_PRIVATE']\nmailjet = Client(auth=(api_key, api_secret), version='v3')\nid = '$list_ID'\ndata = {\n 'Action': \"addnoforce\",\n 'ListID': 123456\n}\nresult = mailjet.contactslist_importlist.create(id=id, data=data)\nprint result.status_code\nprint result.json()"
- lang: Java
label: Java
source: "package com.my.project;\nimport com.mailjet.client.errors.MailjetException;\nimport com.mailjet.client.errors.MailjetSocketTimeoutException;\nimport com.mailjet.client.MailjetClient;\nimport com.mailjet.client.MailjetRequest;\nimport com.mailjet.client.MailjetResponse;\nimport com.mailjet.client.ClientOptions;\nimport com.mailjet.client.resource.ContactslistImportlist;\nimport org.json.JSONArray;\nimport org.json.JSONObject;\npublic class MyClass {\n public static void main(String[] args) throws MailjetException, MailjetSocketTimeoutException {\n MailjetClient client;\n MailjetRequest request;\n MailjetResponse response;\n client = new MailjetClient(System.getenv(\"MJ_APIKEY_PUBLIC\"), System.getenv(\"MJ_APIKEY_PRIVATE\"), new ClientOptions(\"v3\"));\n request = new MailjetRequest(ContactslistImportlist.resource, ID)\n .property(ContactslistImportlist.ACTION, \"addnoforce\")\n .property(ContactslistImportlist.LISTID, 123456)\n );\n response = client.post(request);\n System.out.println(response.getStatus());\n System.out.println(response.getData());\n }\n}"
- lang: Go
label: Go
source: "package main\nimport (\n\t\"fmt\"\n\t\"log\"\n\t\"os\"\n\tmailjet \"github.com/mailjet/mailjet-apiv3-go\"\n\t\"github.com/mailjet/mailjet-apiv3-go/resources\"\n)\nfunc main () {\n\tmailjetClient := NewMailjetClient(os.Getenv(\"MJ_APIKEY_PUBLIC\"), os.Getenv(\"MJ_APIKEY_PRIVATE\"))\n\tvar data []resources.ContactslistImportlist\n\tmr := &Request{\n\t Resource: \"contactslist\",\n\t ID: RESOURCE_ID,\n\t Action: \"importlist\",\n\t}\n\tfmr := &FullRequest{\n\t Info: mr,\n\t Payload: &resources.ContactslistImportlist { \n\t Action:\"addnoforce\",\n\t ListID:123456\n }\n\t}\n\terr := mailjetClient.Post(fmr, &data)\n\tif err != nil {\n\t fmt.Println(err)\n\t}\n\tfmt.Printf(\"Data array: %+v\\n\", data)\n}"
- lang: C#
label: C#
source: "using Mailjet.Client;\nusing Mailjet.Client.Resources;\nusing System;\nusing Newtonsoft.Json.Linq;\nnamespace Mailjet.ConsoleApplication\n{\n class Program\n {\n static void Main(string[] args)\n {\n RunAsync().Wait();\n }\n static async Task RunAsync()\n {\n MailjetClient client = new MailjetClient(Environment.GetEnvironmentVariable(\"MJ_APIKEY_PUBLIC\"), Environment.GetEnvironmentVariable(\"MJ_APIKEY_PRIVATE\"))\n {\n Version = ApiVersion.V3,\n };\n MailjetRequest request = new MailjetRequest\n {\n Resource = ContactslistImportlist.Resource,\n ResourceId = ResourceId.Numeric(ID)\n }\n .Property(ContactslistImportlist.Action, \"addnoforce\")\n .Property(ContactslistImportlist.ListID, 123456);\n MailjetResponse response = await client.PostAsync(request);\n if (response.IsSuccessStatusCode)\n {\n Console.WriteLine(string.Format(\"Total: {0}, Count: {1}\\n\", response.GetTotal(), response.GetCount()));\n Console.WriteLine(response.GetData());\n }\n else\n {\n Console.WriteLine(string.Format(\"StatusCode: {0}\\n\", response.StatusCode));\n Console.WriteLine(string.Format(\"ErrorInfo: {0}\\n\", response.GetErrorInfo()));\n Console.WriteLine(response.GetData());\n Console.WriteLine(string.Format(\"ErrorMessage: {0}\\n\", response.GetErrorMessage()));\n }\n }\n }\n}"
/v3/REST/contactslist/{list_ID}/importlist/{job_ID}:
get:
x-seo:
title: "Get Contact List: Import List"
description: "Use the JobID generated after a POST /contactslist/{list id}/importlist request to check its progress, success, as well as any errors that might have\u2026"
tags:
- Contacts
summary: 'Get Contact List: Import List'
description: Use the JobID generated after a `POST /contactslist/{list_id}/importlist` request to check its progress, success, as well as any errors that might have occurred. To obtain a valid `list_ID`, first call `GET /v3/REST/contactslist` to list your contact lists.
operationId: get_v3_contactslist_id_importlist_id
parameters:
- name: list_ID
in: path
schema:
$ref: '#/components/schemas/get_v3_contactslist_id_importlist_id_PathParams/properties/list_ID'
required: true
example: 2000
- name: job_ID
in: path
schema:
$ref: '#/components/schemas/get_v3_contactslist_id_importlist_id_PathParams/properties/job_ID'
required: true
example: 13000
responses:
'200':
description: Default OK response for `/contactslist` action `/importlist`
content:
application/json:
schema:
type: object
properties:
Count:
description: Indicates the number of objects in the `Data` array.
type: integer
format: int64
examples:
- 1
Data:
description: A JSON array containing a list of objects returned by this endpoint.
type: array
items:
$ref: '#/components/schemas/OutputContactslistImportList'
Total:
description: Indicates the number of objects in the `Data` array.
type: integer
format: int64
examples:
- 1
'400':
$ref: '#/components/responses/400'
'401':
$ref: '#/components/responses/401'
'403':
$ref: '#/components/responses/403'
'404':
$ref: '#/components/responses/404'
'429':
$ref: '#/components/responses/429'
'500':
$ref: '#/components/responses/500'
security:
- basicAuth: []
x-codeSamples:
- lang: curl
label: cURL
source: "curl -s \\\n\t-X GET \\\n\t--user \"$MJ_APIKEY_PUBLIC:$MJ_APIKEY_PRIVATE\" \\\n\thttps://api.mailjet.com/v3/REST/contactslist/$list_ID/importlist \\"
- lang: PHP
label: PHP
source: " 'v3']);\n$response = $mj->get(Resources::$ContactslistImportlist, ['id' => $id]);\n$response->success() && var_dump($response->getData());\n?>"
- lang: Node.js
label: Node
source: "const mailjet = require ('node-mailjet')\n\t.connect(process.env.MJ_APIKEY_PUBLIC, process.env.MJ_APIKEY_PRIVATE)\nconst request = mailjet\n\t.get(\"contactslist\", {'version': 'v3'})\n\t.id($list_ID)\n\t.action(\"importlist\")\n\t.id($job_ID)\n\t.request()\nrequest\n\t.then((result) => {\n\t\tconsole.log(result.body)\n\t})\n\t.catch((err) => {\n\t\tconsole.log(err.statusCode)\n\t})"
- lang: Ruby
label: Ruby
source: "require 'mailjet'\nMailjet.configure do |config|\n config.api_key = ENV['MJ_APIKEY_PUBLIC']\n config.secret_key = ENV['MJ_APIKEY_PRIVATE']\n config.api_version = \"v3\"\nend\nvariable = Mailjet::Contactslist_importlist.find($list_ID\n)\np variable.attributes['Data']"
- lang: Python
label: Python
source: "from mailjet_rest import Client\nimport os\napi_key = os.environ['MJ_APIKEY_PUBLIC']\napi_secret = os.environ['MJ_APIKEY_PRIVATE']\nmailjet = Client(auth=(api_key, api_secret), version='v3')\nid = '$list_ID'\nresult = mailjet.contactslist_importlist.get(id=id)\nprint result.status_code\nprint result.json()"
- lang: Java
label: Java
source: "package com.my.project;\nimport com.mailjet.client.errors.MailjetException;\nimport com.mailjet.client.errors.MailjetSocketTimeoutException;\nimport com.mailjet.client.MailjetClient;\nimport com.mailjet.client.MailjetRequest;\nimport com.mailjet.client.MailjetResponse;\nimport com.mailjet.client.ClientOptions;\nimport com.mailjet.client.resource.ContactslistImportlist;\nimport org.json.JSONArray;\nimport org.json.JSONObject;\npublic class MyClass {\n public static void main(String[] args) throws MailjetException, MailjetSocketTimeoutException {\n MailjetClient client;\n MailjetRequest request;\n MailjetResponse response;\n client = new MailjetClient(System.getenv(\"MJ_APIKEY_PUBLIC\"), System.getenv(\"MJ_APIKEY_PRIVATE\"), new ClientOptions(\"v3\"));\n request = new MailjetRequest(ContactslistImportlist.resource, ID);\n response = client.get(request);\n System.out.println(response.getStatus());\n System.out.println(response.getData());\n }\n}"
- lang: Go
label: Go
source: "package main\nimport (\n\t\"fmt\"\n\t\"log\"\n\t\"os\"\n\tmailjet \"github.com/mailjet/mailjet-apiv3-go\"\n\t\"github.com/mailjet/mailjet-apiv3-go/resources\"\n)\nfunc main () {\n\tmailjetClient := NewMailjetClient(os.Getenv(\"MJ_APIKEY_PUBLIC\"), os.Getenv(\"MJ_APIKEY_PRIVATE\"))\n\tvar data []resources.ContactslistImportlist\n\tmr := &Request{\n\t Resource: \"contactslist\",\n\t ID: RESOURCE_ID,\n\t Action: \"importlist\",\n\t}\n\terr := mailjetClient.Get(mr, &data)\n\tif err != nil {\n\t fmt.Println(err)\n\t}\n\tfmt.Printf(\"Data array: %+v\\n\", data)\n}"
- lang: C#
label: C#
source: "using Mailjet.Client;\nusing Mailjet.Client.Resources;\nusing System;\nusing Newtonsoft.Json.Linq;\nnamespace Mailjet.ConsoleApplication\n{\n class Program\n {\n static void Main(string[] args)\n {\n RunAsync().Wait();\n }\n static async Task RunAsync()\n {\n MailjetClient client = new MailjetClient(Environment.GetEnvironmentVariable(\"MJ_APIKEY_PUBLIC\"), Environment.GetEnvironmentVariable(\"MJ_APIKEY_PRIVATE\"))\n {\n Version = ApiVersion.V3,\n };\n MailjetRequest request = new MailjetRequest\n {\n Resource = ContactslistImportlist.Resource,\n ResourceId = ResourceId.Numeric(ID)\n }\n MailjetResponse response = await client.GetAsync(request);\n if (response.IsSuccessStatusCode)\n {\n Console.WriteLine(string.Format(\"Total: {0}, Count: {1}\\n\", response.GetTotal(), response.GetCount()));\n Console.WriteLine(response.GetData());\n }\n else\n {\n Console.WriteLine(string.Format(\"StatusCode: {0}\\n\", response.StatusCode));\n Console.WriteLine(string.Format(\"ErrorInfo: {0}\\n\", response.GetErrorInfo()));\n Console.WriteLine(response.GetData());\n Console.WriteLine(string.Format(\"ErrorMessage: {0}\\n\", response.GetErrorMessage()));\n }\n }\n }\n}"
"/v3/REST/csvimport":
post:
x-seo:
title: "Create CSV Import"
description: "Add, remove or unsubscribe a list of contacts to/from a specific contact list by using a CSV uploaded to the Mailjet Data server. The CSV needs to be\u2026"
tags:
- Contacts
summary: Create CSV Import
description: Add, remove or unsubscribe a list of contacts to/from a specific contact list by using a CSV uploaded to the Mailjet Data server. The CSV needs to be uploaded via the `/contactslist/{list_id}/CSVData/text:plain` endpoint.
operationId: post_v3_csvimport
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/NewCsvimport'
example:
ErrTreshold: 1
Method: addnoforce
ContactsListID: 123456
DataID: 98765432123456789
responses:
'201':
description: Default OK response for `/csvimport`
content:
application/json:
schema:
type: object
properties:
Count:
description: Indicates the number of objects in the `Data` array.
type: integer
format: int64
examples:
- 1
Data:
description: A JSON array containing a list of objects returned by this endpoint.
type: array
items:
$ref: '#/components/schemas/OutputCsvimport'
Total:
description: Indicates the number of objects in the `Data` array.
type: integer
format: int64
examples:
- 1
'400':
$ref: '#/components/responses/400'
'401':
$ref: '#/components/responses/401'
'403':
$ref: '#/components/responses/403'
'404':
$ref: '#/components/responses/404'
'429':
$ref: '#/components/responses/429'
'500':
$ref: '#/components/responses/500'
security:
- basicAuth: []
x-codeSamples:
- lang: curl
label: cURL
source: "curl -s \\\n\t-X POST \\\n\t--user \"$MJ_APIKEY_PUBLIC:$MJ_APIKEY_PRIVATE\" \\\n\thttps://api.mailjet.com/v3/REST/csvimport \\\n\t-H 'Content-Type: application/json' \\\n\t-d '{\n \"ErrTreshold\":1,\n \"ImportOptions\":\"\",\n \"Method\":\"addnoforce\",\n \"ContactsListID\":123456,\n \"DataID\":98765432123456789\n\t}'"
- lang: PHP
label: PHP
source: " 'v3']);\n$body = [\n 'ErrTreshold' => 1,\n 'ImportOptions' => \"\",\n 'Method' => \"addnoforce\",\n 'ContactsListID' => 123456,\n 'DataID' => 98765432123456789\n];\n$response = $mj->post(Resources::$Csvimport, ['body' => $body]);\n$response->success() && var_dump($response->getData());\n?>"
- lang: Node.js
label: Node
source: "const mailjet = require ('node-mailjet')\n\t.connect(process.env.MJ_APIKEY_PUBLIC, process.env.MJ_APIKEY_PRIVATE)\nconst request = mailjet\n\t.post(\"csvimport\", {'version': 'v3'})\n\t.request({\n \"ErrTreshold\":1,\n \"ImportOptions\":\"\",\n \"Method\":\"addnoforce\",\n \"ContactsListID\":123456,\n \"DataID\":98765432123456789\n })\nrequest\n\t.then((result) => {\n\t\tconsole.log(result.body)\n\t})\n\t.catch((err) => {\n\t\tconsole.log(err.statusCode)\n\t})"
- lang: Ruby
label: Ruby
source: "require 'mailjet'\nMailjet.configure do |config|\n config.api_key = ENV['MJ_APIKEY_PUBLIC']\n config.secret_key = ENV['MJ_APIKEY_PRIVATE']\n config.api_version = \"v3\"\nend\nvariable = Mailjet::Csvimport.create(\n err_treshold: 1,\n import_options: \"\",\n method: \"addnoforce\",\n contacts_list_id: 123456,\n data_id: 98765432123456789\n)\np variable.attributes['Data']"
- lang: Python
label: Python
source: "from mailjet_rest import Client\nimport os\napi_key = os.environ['MJ_APIKEY_PUBLIC']\napi_secret = os.environ['MJ_APIKEY_PRIVATE']\nmailjet = Client(auth=(api_key, api_secret), version='v3')\ndata = {\n 'ErrTreshold': 1,\n 'ImportOptions': \"\",\n 'Method': \"addnoforce\",\n 'ContactsListID': 123456,\n 'DataID': 98765432123456789\n}\nresult = mailjet.csvimport.create(data=data)\nprint result.status_code\nprint result.json()"
- lang: Java
label: Java
source: "package com.my.project;\nimport com.mailjet.client.errors.MailjetException;\nimport com.mailjet.client.errors.MailjetSocketTimeoutException;\nimport com.mailjet.client.MailjetClient;\nimport com.mailjet.client.MailjetRequest;\nimport com.mailjet.client.MailjetResponse;\nimport com.mailjet.client.ClientOptions;\nimport com.mailjet.client.resource.Csvimport;\nimport org.json.JSONArray;\nimport org.json.JSONObject;\npublic class MyClass {\n public static void main(String[] args) throws MailjetException, MailjetSocketTimeoutException {\n MailjetClient client;\n MailjetRequest request;\n MailjetResponse response;\n client = new MailjetClient(System.getenv(\"MJ_APIKEY_PUBLIC\"), System.getenv(\"MJ_APIKEY_PRIVATE\"), new ClientOptions(\"v3\"));\n request = new MailjetRequest(Csvimport.resource)\n .property(Csvimport.ERRTRESHOLD, 1)\n .property(Csvimport.IMPORTOPTIONS, )\n .property(Csvimport.METHOD, \"addnoforce\")\n .property(Csvimport.CONTACTSLISTID, 123456)\n .property(Csvimport.DATAID, 98765432123456789)\n );\n response = client.post(request);\n System.out.println(response.getStatus());\n System.out.println(response.getData());\n }\n}"
- lang: Go
label: Go
source: "package main\nimport (\n\t\"fmt\"\n\t\"log\"\n\t\"os\"\n\tmailjet \"github.com/mailjet/mailjet-apiv3-go\"\n\t\"github.com/mailjet/mailjet-apiv3-go/resources\"\n)\nfunc main () {\n\tmailjetClient := NewMailjetClient(os.Getenv(\"MJ_APIKEY_PUBLIC\"), os.Getenv(\"MJ_APIKEY_PRIVATE\"))\n\tvar data []resources.Csvimport\n\tmr := &Request{\n\t Resource: \"csvimport\",\n\t}\n\tfmr := &FullRequest{\n\t Info: mr,\n\t Payload: &resources.Csvimport { \n\t ErrTreshold:1,\n\t ImportOptions:\"\",\n\t Method:\"addnoforce\",\n\t ContactsListID:123456,\n\t DataID:98765432123456789\n }\n\t}\n\terr := mailjetClient.Post(fmr, &data)\n\tif err != nil {\n\t fmt.Println(err)\n\t}\n\tfmt.Printf(\"Data array: %+v\\n\", data)\n}"
- lang: C#
label: C#
source: "using Mailjet.Client;\nusing Mailjet.Client.Resources;\nusing System;\nusing Newtonsoft.Json.Linq;\nnamespace Mailjet.ConsoleApplication\n{\n class Program\n {\n static void Main(string[] args)\n {\n RunAsync().Wait();\n }\n static async Task RunAsync()\n {\n MailjetClient client = new MailjetClient(Environment.GetEnvironmentVariable(\"MJ_APIKEY_PUBLIC\"), Environment.GetEnvironmentVariable(\"MJ_APIKEY_PRIVATE\"))\n {\n Version = ApiVersion.V3,\n };\n MailjetRequest request = new MailjetRequest\n {\n Resource = Csvimport.Resource,\n }\n .Property(Csvimport.ErrTreshold, 1)\n .Property(Csvimport.ImportOptions, )\n .Property(Csvimport.Method, \"addnoforce\")\n .Property(Csvimport.ContactsListID, 123456)\n .Property(Csvimport.DataID, 98765432123456789);\n MailjetResponse response = await client.PostAsync(request);\n if (response.IsSuccessStatusCode)\n {\n Console.WriteLine(string.Format(\"Total: {0}, Count: {1}\\n\", response.GetTotal(), response.GetCount()));\n Console.WriteLine(response.GetData());\n }\n else\n {\n Console.WriteLine(string.Format(\"StatusCode: {0}\\n\", response.StatusCode));\n Console.WriteLine(string.Format(\"ErrorInfo: {0}\\n\", response.GetErrorInfo()));\n Console.WriteLine(response.GetData());\n Console.WriteLine(string.Format(\"ErrorMessage: {0}\\n\", response.GetErrorMessage()));\n }\n }\n }\n}"
/v3/REST/csvimport/{importjob_ID}:
get:
x-seo:
title: "CSV Import by ID"
description: "View the settings and status of a contact CSV import job. The CSV needs to be uploaded via the /contactslist/{list id}/CSVData/text:plain endpoint - only\u2026"
tags:
- Contacts
summary: CSV Import by ID
description: View the settings and status of a contact CSV import job. The CSV needs to be uploaded via the `/contactslist/{list_id}/CSVData/text:plain endpoint` - only then can you create an import job. To obtain a valid `importjob_ID`, first call `GET /v3/REST/csvimport` to list your import jobs.
operationId: get_v3_csvimport_id
parameters:
- name: importjob_ID
in: path
schema:
$ref: '#/components/schemas/get_v3_csvimport_id_PathParams/properties/importjob_ID'
required: true
example: 12000
responses:
'200':
description: Default OK response for `/csvimport`
content:
application/json:
schema:
type: object
properties:
Count:
description: Indicates the number of objects in the `Data` array.
type: integer
format: int64
examples:
- 1
Data:
description: A JSON array containing a list of objects returned by this endpoint.
type: array
items:
$ref: '#/components/schemas/OutputCsvimport'
Total:
description: Indicates the number of objects in the `Data` array.
type: integer
format: int64
examples:
- 1
'400':
$ref: '#/components/responses/400'
'401':
$ref: '#/components/responses/401'
'403':
$ref: '#/components/responses/403'
'404':
$ref: '#/components/responses/404'
'429':
$ref: '#/components/responses/429'
'500':
$ref: '#/components/responses/500'
security:
- basicAuth: []
x-codeSamples:
- lang: curl
label: cURL
source: "curl -s \\\n\t-X GET \\\n\t--user \"$MJ_APIKEY_PUBLIC:$MJ_APIKEY_PRIVATE\" \\\n\thttps://api.mailjet.com/v3/REST/csvimport/$importjob_ID \\"
- lang: PHP
label: PHP
source: " 'v3']);\n$response = $mj->get(Resources::$Csvimport, ['id' => $id]);\n$response->success() && var_dump($response->getData());\n?>"
- lang: Node.js
label: Node
source: "const mailjet = require ('node-mailjet')\n\t.connect(process.env.MJ_APIKEY_PUBLIC, process.env.MJ_APIKEY_PRIVATE)\nconst request = mailjet\n\t.get(\"csvimport\", {'version': 'v3'})\n\t.id($importjob_ID)\n\t.request()\nrequest\n\t.then((result) => {\n\t\tconsole.log(result.body)\n\t})\n\t.catch((err) => {\n\t\tconsole.log(err.statusCode)\n\t})"
- lang: Ruby
label: Ruby
source: "require 'mailjet'\nMailjet.configure do |config|\n config.api_key = ENV['MJ_APIKEY_PUBLIC']\n config.secret_key = ENV['MJ_APIKEY_PRIVATE']\n config.api_version = \"v3\"\nend\nvariable = Mailjet::Csvimport.find($importjob_ID\n)\np variable.attributes['Data']"
- lang: Python
label: Python
source: "from mailjet_rest import Client\nimport os\napi_key = os.environ['MJ_APIKEY_PUBLIC']\napi_secret = os.environ['MJ_APIKEY_PRIVATE']\nmailjet = Client(auth=(api_key, api_secret), version='v3')\nid = '$importjob_ID'\nresult = mailjet.csvimport.get(id=id)\nprint result.status_code\nprint result.json()"
- lang: Java
label: Java
source: "package com.my.project;\nimport com.mailjet.client.errors.MailjetException;\nimport com.mailjet.client.errors.MailjetSocketTimeoutException;\nimport com.mailjet.client.MailjetClient;\nimport com.mailjet.client.MailjetRequest;\nimport com.mailjet.client.MailjetResponse;\nimport com.mailjet.client.ClientOptions;\nimport com.mailjet.client.resource.Csvimport;\nimport org.json.JSONArray;\nimport org.json.JSONObject;\npublic class MyClass {\n public static void main(String[] args) throws MailjetException, MailjetSocketTimeoutException {\n MailjetClient client;\n MailjetRequest request;\n MailjetResponse response;\n client = new MailjetClient(System.getenv(\"MJ_APIKEY_PUBLIC\"), System.getenv(\"MJ_APIKEY_PRIVATE\"), new ClientOptions(\"v3\"));\n request = new MailjetRequest(Csvimport.resource, ID);\n response = client.get(request);\n System.out.println(response.getStatus());\n System.out.println(response.getData());\n }\n}"
- lang: Go
label: Go
source: "package main\nimport (\n\t\"fmt\"\n\t\"log\"\n\t\"os\"\n\tmailjet \"github.com/mailjet/mailjet-apiv3-go\"\n\t\"github.com/mailjet/mailjet-apiv3-go/resources\"\n)\nfunc main () {\n\tmailjetClient := NewMailjetClient(os.Getenv(\"MJ_APIKEY_PUBLIC\"), os.Getenv(\"MJ_APIKEY_PRIVATE\"))\n\tvar data []resources.Csvimport\n\tmr := &Request{\n\t Resource: \"csvimport\",\n\t ID: RESOURCE_ID,\n\t}\n\terr := mailjetClient.Get(mr, &data)\n\tif err != nil {\n\t fmt.Println(err)\n\t}\n\tfmt.Printf(\"Data array: %+v\\n\", data)\n}"
- lang: C#
label: C#
source: "using Mailjet.Client;\nusing Mailjet.Client.Resources;\nusing System;\nusing Newtonsoft.Json.Linq;\nnamespace Mailjet.ConsoleApplication\n{\n class Program\n {\n static void Main(string[] args)\n {\n RunAsync().Wait();\n }\n static async Task RunAsync()\n {\n MailjetClient client = new MailjetClient(Environment.GetEnvironmentVariable(\"MJ_APIKEY_PUBLIC\"), Environment.GetEnvironmentVariable(\"MJ_APIKEY_PRIVATE\"))\n {\n Version = ApiVersion.V3,\n };\n MailjetRequest request = new MailjetRequest\n {\n Resource = Csvimport.Resource,\n ResourceId = ResourceId.Numeric(ID)\n }\n MailjetResponse response = await client.GetAsync(request);\n if (response.IsSuccessStatusCode)\n {\n Console.WriteLine(string.Format(\"Total: {0}, Count: {1}\\n\", response.GetTotal(), response.GetCount()));\n Console.WriteLine(response.GetData());\n }\n else\n {\n Console.WriteLine(string.Format(\"StatusCode: {0}\\n\", response.StatusCode));\n Console.WriteLine(string.Format(\"ErrorInfo: {0}\\n\", response.GetErrorInfo()));\n Console.WriteLine(response.GetData());\n Console.WriteLine(string.Format(\"ErrorMessage: {0}\\n\", response.GetErrorMessage()));\n }\n }\n }\n}"
put:
x-seo:
title: "Update CSV Import"
description: "Update CSV Import using the Mailjet Email API. Update or abort a contact CSV import job in progress."
tags:
- Contacts
summary: Update CSV Import
description: Update or abort a contact CSV import job in progress. To obtain a valid `importjob_ID`, first call `GET /v3/REST/csvimport` to list your import jobs.
operationId: put_v3_csvimport_id
parameters:
- name: importjob_ID
in: path
schema:
$ref: '#/components/schemas/put_v3_csvimport_id_PathParams/properties/importjob_ID'
required: true
example: 12000
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/UpdateCsvimport'
example:
ErrTreshold: 1
Method: addnoforce
DataID: 987654
Status: Upload
responses:
'200':
description: Default OK response for /csvimport
content:
application/json:
schema:
type: object
properties:
Count:
description: Indicates the number of objects in the `Data` array.
type: integer
format: int64
examples:
- 1
Data:
description: A JSON array containing a list of objects returned by this endpoint.
type: array
items:
$ref: '#/components/schemas/OutputCsvimport'
Total:
description: Indicates the number of objects in the `Data` array.
type: integer
format: int64
examples:
- 1
'400':
$ref: '#/components/responses/400'
'401':
$ref: '#/components/responses/401'
'403':
$ref: '#/components/responses/403'
'404':
$ref: '#/components/responses/404'
'429':
$ref: '#/components/responses/429'
'500':
$ref: '#/components/responses/500'
security:
- basicAuth: []
x-codeSamples:
- lang: curl
label: cURL
source: "curl -s \\\n\t-X PUT \\\n\t--user \"$MJ_APIKEY_PUBLIC:$MJ_APIKEY_PRIVATE\" \\\n\thttps://api.mailjet.com/v3/REST/csvimport/$importjob_ID \\\n\t-H 'Content-Type: application/json' \\\n\t-d '{\n \"ErrTreshold\":1,\n \"ImportOptions\":\"\",\n \"Method\":\"addnoforce\",\n \"ContactsListID\":123456,\n \"DataID\":987654,\n \"Status\":\"Upload\"\n\t}'"
- lang: PHP
label: PHP
source: " 'v3']);\n$body = [\n 'ErrTreshold' => 1,\n 'ImportOptions' => \"\",\n 'Method' => \"addnoforce\",\n 'ContactsListID' => 123456,\n 'DataID' => 987654,\n 'Status' => \"Upload\"\n];\n$response = $mj->put(Resources::$Csvimport, ['id' => $id, 'body' => $body]);\n$response->success() && var_dump($response->getData());\n?>"
- lang: Node.js
label: Node
source: "const mailjet = require ('node-mailjet')\n\t.connect(process.env.MJ_APIKEY_PUBLIC, process.env.MJ_APIKEY_PRIVATE)\nconst request = mailjet\n\t.put(\"csvimport\", {'version': 'v3'})\n\t.id($importjob_ID)\n\t.request({\n \"ErrTreshold\":1,\n \"ImportOptions\":\"\",\n \"Method\":\"addnoforce\",\n \"ContactsListID\":123456,\n \"DataID\":987654,\n \"Status\":\"Upload\"\n })\nrequest\n\t.then((result) => {\n\t\tconsole.log(result.body)\n\t})\n\t.catch((err) => {\n\t\tconsole.log(err.statusCode)\n\t})"
- lang: Ruby
label: Ruby
source: "require 'mailjet'\nMailjet.configure do |config|\n config.api_key = ENV['MJ_APIKEY_PUBLIC']\n config.secret_key = ENV['MJ_APIKEY_PRIVATE']\n config.api_version = \"v3\"\nend\ntarget = Mailjet::Csvimport.find($importjob_ID)\ntarget.update_attributes(\n err_treshold: 1,\n import_options: \"\",\n method: \"addnoforce\",\n contacts_list_id: 123456,\n data_id: 987654,\n status: \"Upload\"\n)\np variable.attributes['Data']"
- lang: Python
label: Python
source: "from mailjet_rest import Client\nimport os\napi_key = os.environ['MJ_APIKEY_PUBLIC']\napi_secret = os.environ['MJ_APIKEY_PRIVATE']\nmailjet = Client(auth=(api_key, api_secret), version='v3')\nid = '$importjob_ID'\ndata = {\n 'ErrTreshold': 1,\n 'ImportOptions': \"\",\n 'Method': \"addnoforce\",\n 'ContactsListID': 123456,\n 'DataID': 987654,\n 'Status': \"Upload\"\n}\nresult = mailjet.csvimport.update(id=id, data=data)\nprint result.status_code\nprint result.json()"
- lang: Java
label: Java
source: "package com.my.project;\nimport com.mailjet.client.errors.MailjetException;\nimport com.mailjet.client.errors.MailjetSocketTimeoutException;\nimport com.mailjet.client.MailjetClient;\nimport com.mailjet.client.MailjetRequest;\nimport com.mailjet.client.MailjetResponse;\nimport com.mailjet.client.ClientOptions;\nimport com.mailjet.client.resource.Csvimport;\nimport org.json.JSONArray;\nimport org.json.JSONObject;\npublic class MyClass {\n public static void main(String[] args) throws MailjetException, MailjetSocketTimeoutException {\n MailjetClient client;\n MailjetRequest request;\n MailjetResponse response;\n client = new MailjetClient(System.getenv(\"MJ_APIKEY_PUBLIC\"), System.getenv(\"MJ_APIKEY_PRIVATE\"), new ClientOptions(\"v3\"));\n request = new MailjetRequest(Csvimport.resource, ID)\n .property(Csvimport.ERRTRESHOLD, 1)\n .property(Csvimport.IMPORTOPTIONS, )\n .property(Csvimport.METHOD, \"addnoforce\")\n .property(Csvimport.CONTACTSLISTID, 123456)\n .property(Csvimport.DATAID, 987654)\n .property(Csvimport.STATUS, \"Upload\")\n );\n response = client.put(request);\n System.out.println(response.getStatus());\n System.out.println(response.getData());\n }\n}"
- lang: Go
label: Go
source: "package main\nimport (\n\t\"fmt\"\n\t\"log\"\n\t\"os\"\n\tmailjet \"github.com/mailjet/mailjet-apiv3-go\"\n\t\"github.com/mailjet/mailjet-apiv3-go/resources\"\n)\nfunc main () {\n\tmailjetClient := NewMailjetClient(os.Getenv(\"MJ_APIKEY_PUBLIC\"), os.Getenv(\"MJ_APIKEY_PRIVATE\"))\n\tmr := &Request{\n\t Resource: \"csvimport\",\n\t ID: RESOURCE_ID,\n\t}\n\tfmr := &FullRequest{\n\t Info: mr,\n\t Payload: &resources.Csvimport { \n\t ErrTreshold:1,\n\t ImportOptions:\"\",\n\t Method:\"addnoforce\",\n\t ContactsListID:123456,\n\t DataID:987654,\n\t Status:\"Upload\"\n }\n\t}\n\terr := mailjetClient.Put(fmr)\n\tif err != nil {\n\t fmt.Println(err)\n\t}\n}"
- lang: C#
label: C#
source: "using Mailjet.Client;\nusing Mailjet.Client.Resources;\nusing System;\nusing Newtonsoft.Json.Linq;\nnamespace Mailjet.ConsoleApplication\n{\n class Program\n {\n static void Main(string[] args)\n {\n RunAsync().Wait();\n }\n static async Task RunAsync()\n {\n MailjetClient client = new MailjetClient(Environment.GetEnvironmentVariable(\"MJ_APIKEY_PUBLIC\"), Environment.GetEnvironmentVariable(\"MJ_APIKEY_PRIVATE\"))\n {\n Version = ApiVersion.V3,\n };\n MailjetRequest request = new MailjetRequest\n {\n Resource = Csvimport.Resource,\n ResourceId = ResourceId.Numeric(ID)\n }\n .Property(Csvimport.ErrTreshold, 1)\n .Property(Csvimport.ImportOptions, )\n .Property(Csvimport.Method, \"addnoforce\")\n .Property(Csvimport.ContactsListID, 123456)\n .Property(Csvimport.DataID, 987654)\n .Property(Csvimport.Status, \"Upload\");\n MailjetResponse response = await client.PutAsync(request);\n if (response.IsSuccessStatusCode)\n {\n Console.WriteLine(string.Format(\"Total: {0}, Count: {1}\\n\", response.GetTotal(), response.GetCount()));\n Console.WriteLine(response.GetData());\n }\n else\n {\n Console.WriteLine(string.Format(\"StatusCode: {0}\\n\", response.StatusCode));\n Console.WriteLine(string.Format(\"ErrorInfo: {0}\\n\", response.GetErrorInfo()));\n Console.WriteLine(response.GetData());\n Console.WriteLine(string.Format(\"ErrorMessage: {0}\\n\", response.GetErrorMessage()));\n }\n }\n }\n}"
/v3/REST/contactslist/{list_ID}/verify:
post:
x-seo:
title: "Contact List: Verify"
description: "Creates a job to verify a contact list. The job will process the contact list for verification and GET /contactslist/{list ID}/verify/{job ID} can be\u2026"
tags:
- Contacts
summary: 'Contact List: Verify'
description: Creates a job to verify a contact list. The job will process the contact list for verification and `GET /contactslist/{list_ID}/verify/{job_ID}` can be used to retrieve results of the job. Typically, processing will complete in less than 5 minutes. We recommend calling `GET /contactslist/{list_ID/verify/{job_ID}` every 30 seconds to poll for results. To obtain a valid `list_ID`, first call `GET /v3/REST/contactslist` to list your contact lists.
operationId: post_v3_contactslist_id_verify
parameters:
- name: list_ID
in: path
schema:
$ref: '#/components/schemas/post_v3_contactslist_id_verify_PathParams/properties/list_ID'
required: true
example: 2000
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/NewContactslistVerify'
example:
Method: fulllist
responses:
'201':
description: Default Created response for `/contactslist` action `/verify`
content:
application/json:
schema:
type: object
properties:
Count:
description: Indicates the number of objects in the `Data` array.
type: integer
format: int64
examples:
- 1
Data:
description: A JSON array containing a list of objects returned by this endpoint.
type: array
items:
$ref: '#/components/schemas/ActionIDContactslistVerify'
Total:
description: Indicates the number of objects in the `Data` array.
type: integer
format: int64
examples:
- 1
'400':
$ref: '#/components/responses/400'
'401':
$ref: '#/components/responses/401'
'403':
$ref: '#/components/responses/403'
'404':
$ref: '#/components/responses/404'
'429':
$ref: '#/components/responses/429'
'500':
$ref: '#/components/responses/500'
security:
- basicAuth: []
x-codeSamples:
- lang: curl
label: cURL
source: "curl -s \\\n\t-X POST \\\n\t--user \"$MJ_APIKEY_PUBLIC:$MJ_APIKEY_PRIVATE\" \\\n\thttps://api.mailjet.com/v3/REST/contactslist/$list_ID \\\n\t-H 'Content-Type: application/json' \\\n\t-d '{\n \"Method\":\"fulllist\"\n\t}'"
- lang: PHP
label: PHP
source: " 'v3']);\n$body = [\n 'Method' => \"fulllist\"\n];\n$response = $mj->post(Resources::$Contactslist, ['id' => $id, 'body' => $body]);\n$response->success() && var_dump($response->getData());\n?>"
- lang: Node.js
label: Node
source: "const mailjet = require ('node-mailjet')\n\t.connect(process.env.MJ_APIKEY_PUBLIC, process.env.MJ_APIKEY_PRIVATE)\nconst request = mailjet\n\t.post(\"contactslist\", {'version': 'v3'})\n\t.id($list_ID)\n\t.request({\n \"Method\":\"fulllist\"\n })\nrequest\n\t.then((result) => {\n\t\tconsole.log(result.body)\n\t})\n\t.catch((err) => {\n\t\tconsole.log(err.statusCode)\n\t})"
- lang: Ruby
label: Ruby
source: "require 'mailjet'\nMailjet.configure do |config|\n config.api_key = ENV['MJ_APIKEY_PUBLIC']\n config.secret_key = ENV['MJ_APIKEY_PRIVATE']\n config.api_version = \"v3\"\nend\nvariable = Mailjet::Contactslist.create(id: $list_ID,\n method: \"fulllist\"\n)\np variable.attributes['Data']"
- lang: Python
label: Python
source: "from mailjet_rest import Client\nimport os\napi_key = os.environ['MJ_APIKEY_PUBLIC']\napi_secret = os.environ['MJ_APIKEY_PRIVATE']\nmailjet = Client(auth=(api_key, api_secret), version='v3')\nid = '$list_ID'\ndata = {\n 'Method': \"fulllist\"\n}\nresult = mailjet.contactslist.create(id=id, data=data)\nprint result.status_code\nprint result.json()"
- lang: Java
label: Java
source: "package com.my.project;\nimport com.mailjet.client.errors.MailjetException;\nimport com.mailjet.client.errors.MailjetSocketTimeoutException;\nimport com.mailjet.client.MailjetClient;\nimport com.mailjet.client.MailjetRequest;\nimport com.mailjet.client.MailjetResponse;\nimport com.mailjet.client.ClientOptions;\nimport com.mailjet.client.resource.Contactslist;\nimport org.json.JSONArray;\nimport org.json.JSONObject;\npublic class MyClass {\n public static void main(String[] args) throws MailjetException, MailjetSocketTimeoutException {\n MailjetClient client;\n MailjetRequest request;\n MailjetResponse response;\n client = new MailjetClient(System.getenv(\"MJ_APIKEY_PUBLIC\"), System.getenv(\"MJ_APIKEY_PRIVATE\"), new ClientOptions(\"v3\"));\n request = new MailjetRequest(Contactslist.resource, ID)\n .property(Contactslist.METHOD, \"fulllist\")\n );\n response = client.post(request);\n System.out.println(response.getStatus());\n System.out.println(response.getData());\n }\n}"
- lang: Go
label: Go
source: "package main\nimport (\n\t\"fmt\"\n\t\"log\"\n\t\"os\"\n\tmailjet \"github.com/mailjet/mailjet-apiv3-go\"\n\t\"github.com/mailjet/mailjet-apiv3-go/resources\"\n)\nfunc main () {\n\tmailjetClient := NewMailjetClient(os.Getenv(\"MJ_APIKEY_PUBLIC\"), os.Getenv(\"MJ_APIKEY_PRIVATE\"))\n\tvar data []resources.Contactslist\n\tmr := &Request{\n\t Resource: \"contactslist\",\n\t ID: RESOURCE_ID,\n\t}\n\tfmr := &FullRequest{\n\t Info: mr,\n\t Payload: &resources.Contactslist { \n\t Method:\"fulllist\"\n }\n\t}\n\terr := mailjetClient.Post(fmr, &data)\n\tif err != nil {\n\t fmt.Println(err)\n\t}\n\tfmt.Printf(\"Data array: %+v\\n\", data)\n}"
- lang: C#
label: C#
source: "using Mailjet.Client;\nusing Mailjet.Client.Resources;\nusing System;\nusing Newtonsoft.Json.Linq;\nnamespace Mailjet.ConsoleApplication\n{\n class Program\n {\n static void Main(string[] args)\n {\n RunAsync().Wait();\n }\n static async Task RunAsync()\n {\n MailjetClient client = new MailjetClient(Environment.GetEnvironmentVariable(\"MJ_APIKEY_PUBLIC\"), Environment.GetEnvironmentVariable(\"MJ_APIKEY_PRIVATE\"))\n {\n Version = ApiVersion.V3,\n };\n MailjetRequest request = new MailjetRequest\n {\n Resource = Contactslist.Resource,\n ResourceId = ResourceId.Numeric(ID)\n }\n .Property(Contactslist.Method, \"fulllist\");\n MailjetResponse response = await client.PostAsync(request);\n if (response.IsSuccessStatusCode)\n {\n Console.WriteLine(string.Format(\"Total: {0}, Count: {1}\\n\", response.GetTotal(), response.GetCount()));\n Console.WriteLine(response.GetData());\n }\n else\n {\n Console.WriteLine(string.Format(\"StatusCode: {0}\\n\", response.StatusCode));\n Console.WriteLine(string.Format(\"ErrorInfo: {0}\\n\", response.GetErrorInfo()));\n Console.WriteLine(response.GetData());\n Console.WriteLine(string.Format(\"ErrorMessage: {0}\\n\", response.GetErrorMessage()));\n }\n }\n }\n}"
/v3/REST/contactslist/{list_ID}/verify/{job_ID}:
get:
x-seo:
title: "Get Contact List: Verify"
description: "The contact list verification job created by a successful POST /contactslist/{list id}/verify may progress through multiple states and ultimately remain\u2026"
tags:
- Contacts
summary: 'Get Contact List: Verify'
description: The contact list verification job created by a successful `POST /contactslist/{list_id}/verify` may progress through multiple states and ultimately remain in a successful or failed state with associated data. We encourage calls to this at a rate of once every 30 seconds. Typically, jobs resolve to final status within 5 minutes. To obtain a valid `list_ID`, first call `GET /v3/REST/contactslist` to list your contact lists.
operationId: get_v3_contactslist_id_verify_id
parameters:
- name: list_ID
in: path
schema:
$ref: '#/components/schemas/get_v3_contactslist_id_verify_id_PathParams/properties/list_ID'
required: true
example: 2000
- name: job_ID
in: path
schema:
$ref: '#/components/schemas/get_v3_contactslist_id_verify_id_PathParams/properties/job_ID'
required: true
example: 13000
responses:
'200':
description: Default OK response for `/contactslist` action `/verify`. All statuses (success, failure, pending) will all result in a `200` status code.
content:
application/json:
schema:
type: object
properties:
Count:
description: Indicates the number of objects in the `Data` array.
type: integer
format: int64
examples:
- 1
Data:
description: An array containing the results of the contact list verification.
type: array
items:
$ref: '#/components/schemas/OutputContactslistVerifyData'
Total:
description: Indicates the number of objects in the `Data` array.
type: integer
format: int64
examples:
- 1
'400':
$ref: '#/components/responses/400'
'401':
$ref: '#/components/responses/401'
'403':
$ref: '#/components/responses/403'
'404':
$ref: '#/components/responses/404'
'429':
$ref: '#/components/responses/429'
'500':
$ref: '#/components/responses/500'
security:
- basicAuth: []
x-codeSamples:
- lang: curl
label: cURL
source: "curl -s \\\n\t-X GET \\\n\t--user \"$MJ_APIKEY_PUBLIC:$MJ_APIKEY_PRIVATE\" \\\n\thttps://api.mailjet.com/v3/REST/contactslist/$list_ID \\"
- lang: PHP
label: PHP
source: " 'v3']);\n$response = $mj->get(Resources::$Contactslist, ['id' => $id]);\n$response->success() && var_dump($response->getData());\n?>"
- lang: Node.js
label: Node
source: "const mailjet = require ('node-mailjet')\n\t.connect(process.env.MJ_APIKEY_PUBLIC, process.env.MJ_APIKEY_PRIVATE)\nconst request = mailjet\n\t.get(\"contactslist\", {'version': 'v3'})\n\t.id($list_ID)\n\t.id($job_ID)\n\t.request()\nrequest\n\t.then((result) => {\n\t\tconsole.log(result.body)\n\t})\n\t.catch((err) => {\n\t\tconsole.log(err.statusCode)\n\t})"
- lang: Ruby
label: Ruby
source: "require 'mailjet'\nMailjet.configure do |config|\n config.api_key = ENV['MJ_APIKEY_PUBLIC']\n config.secret_key = ENV['MJ_APIKEY_PRIVATE']\n config.api_version = \"v3\"\nend\nvariable = Mailjet::Contactslist.find($list_ID\n)\np variable.attributes['Data']"
- lang: Python
label: Python
source: "from mailjet_rest import Client\nimport os\napi_key = os.environ['MJ_APIKEY_PUBLIC']\napi_secret = os.environ['MJ_APIKEY_PRIVATE']\nmailjet = Client(auth=(api_key, api_secret), version='v3')\nid = '$list_ID'\nresult = mailjet.contactslist.get(id=id)\nprint result.status_code\nprint result.json()"
- lang: Java
label: Java
source: "package com.my.project;\nimport com.mailjet.client.errors.MailjetException;\nimport com.mailjet.client.errors.MailjetSocketTimeoutException;\nimport com.mailjet.client.MailjetClient;\nimport com.mailjet.client.MailjetRequest;\nimport com.mailjet.client.MailjetResponse;\nimport com.mailjet.client.ClientOptions;\nimport com.mailjet.client.resource.Contactslist;\nimport org.json.JSONArray;\nimport org.json.JSONObject;\npublic class MyClass {\n public static void main(String[] args) throws MailjetException, MailjetSocketTimeoutException {\n MailjetClient client;\n MailjetRequest request;\n MailjetResponse response;\n client = new MailjetClient(System.getenv(\"MJ_APIKEY_PUBLIC\"), System.getenv(\"MJ_APIKEY_PRIVATE\"), new ClientOptions(\"v3\"));\n request = new MailjetRequest(Contactslist.resource, ID);\n response = client.get(request);\n System.out.println(response.getStatus());\n System.out.println(response.getData());\n }\n}"
- lang: Go
label: Go
source: "package main\nimport (\n\t\"fmt\"\n\t\"log\"\n\t\"os\"\n\tmailjet \"github.com/mailjet/mailjet-apiv3-go\"\n\t\"github.com/mailjet/mailjet-apiv3-go/resources\"\n)\nfunc main () {\n\tmailjetClient := NewMailjetClient(os.Getenv(\"MJ_APIKEY_PUBLIC\"), os.Getenv(\"MJ_APIKEY_PRIVATE\"))\n\tvar data []resources.Contactslist\n\tmr := &Request{\n\t Resource: \"contactslist\",\n\t ID: RESOURCE_ID,\n\t}\n\terr := mailjetClient.Get(mr, &data)\n\tif err != nil {\n\t fmt.Println(err)\n\t}\n\tfmt.Printf(\"Data array: %+v\\n\", data)\n}"
- lang: C#
label: C#
source: "using Mailjet.Client;\nusing Mailjet.Client.Resources;\nusing System;\nusing Newtonsoft.Json.Linq;\nnamespace Mailjet.ConsoleApplication\n{\n class Program\n {\n static void Main(string[] args)\n {\n RunAsync().Wait();\n }\n static async Task RunAsync()\n {\n MailjetClient client = new MailjetClient(Environment.GetEnvironmentVariable(\"MJ_APIKEY_PUBLIC\"), Environment.GetEnvironmentVariable(\"MJ_APIKEY_PRIVATE\"))\n {\n Version = ApiVersion.V3,\n };\n MailjetRequest request = new MailjetRequest\n {\n Resource = Contactslist.Resource,\n ResourceId = ResourceId.Numeric(ID)\n }\n MailjetResponse response = await client.GetAsync(request);\n if (response.IsSuccessStatusCode)\n {\n Console.WriteLine(string.Format(\"Total: {0}, Count: {1}\\n\", response.GetTotal(), response.GetCount()));\n Console.WriteLine(response.GetData());\n }\n else\n {\n Console.WriteLine(string.Format(\"StatusCode: {0}\\n\", response.StatusCode));\n Console.WriteLine(string.Format(\"ErrorInfo: {0}\\n\", response.GetErrorInfo()));\n Console.WriteLine(response.GetData());\n Console.WriteLine(string.Format(\"ErrorMessage: {0}\\n\", response.GetErrorMessage()));\n }\n }\n }\n}"
"/v3/REST/contactfilter":
get:
x-seo:
title: "Contact Filter List"
description: "Retrieve a list of all segments and details on their configuration. Segments can be applied on contact lists when you send your campaigns. Segmentation\u2026"
tags:
- Segmentation
summary: Contact Filter List
description: Retrieve a list of all segments and details on their configuration. Segments can be applied on contact lists when you send your campaigns. Segmentation is done based on additional data saved for contacts via `/contactmetadata` and/or based on contact activity (or lack thereof).
operationId: get_v3_contactfilter
parameters:
- name: ShowDeleted
in: query
schema:
$ref: '#/components/schemas/get_v3_contactfilter_QueryParams/properties/ShowDeleted'
- name: Status
in: query
schema:
$ref: '#/components/schemas/get_v3_contactfilter_QueryParams/properties/Status'
responses:
'200':
description: Default OK response for `/contactfilter`
content:
application/json:
schema:
type: object
properties:
Count:
description: Indicates the number of objects in the `Data` array.
type: integer
format: int64
examples:
- 1
Data:
description: A JSON array containing a list of objects returned by this endpoint.
type: array
items:
$ref: '#/components/schemas/OutputContactfilter'
Total:
description: Indicates the number of objects in the `Data` array.
type: integer
format: int64
examples:
- 1
'400':
$ref: '#/components/responses/400'
'401':
$ref: '#/components/responses/401'
'403':
$ref: '#/components/responses/403'
'404':
$ref: '#/components/responses/404'
'429':
$ref: '#/components/responses/429'
'500':
$ref: '#/components/responses/500'
security:
- basicAuth: []
x-codeSamples:
- lang: curl
label: cURL
source: "curl -s \\\n\t-X GET \\\n\t--user \"$MJ_APIKEY_PUBLIC:$MJ_APIKEY_PRIVATE\" \\\n\thttps://api.mailjet.com/v3/REST/contactfilter \\"
- lang: PHP
label: PHP
source: " 'v3']);\n$response = $mj->get(Resources::$Contactfilter);\n$response->success() && var_dump($response->getData());\n?>"
- lang: Node.js
label: Node
source: "const mailjet = require ('node-mailjet')\n\t.connect(process.env.MJ_APIKEY_PUBLIC, process.env.MJ_APIKEY_PRIVATE)\nconst request = mailjet\n\t.get(\"contactfilter\", {'version': 'v3'})\n\t.request()\nrequest\n\t.then((result) => {\n\t\tconsole.log(result.body)\n\t})\n\t.catch((err) => {\n\t\tconsole.log(err.statusCode)\n\t})"
- lang: Ruby
label: Ruby
source: "require 'mailjet'\nMailjet.configure do |config|\n config.api_key = ENV['MJ_APIKEY_PUBLIC']\n config.secret_key = ENV['MJ_APIKEY_PRIVATE']\n config.api_version = \"v3\"\nend\nvariable = Mailjet::Contactfilter.all(\n)\np variable.attributes['Data']"
- lang: Python
label: Python
source: "from mailjet_rest import Client\nimport os\napi_key = os.environ['MJ_APIKEY_PUBLIC']\napi_secret = os.environ['MJ_APIKEY_PRIVATE']\nmailjet = Client(auth=(api_key, api_secret), version='v3')\nresult = mailjet.contactfilter.get()\nprint result.status_code\nprint result.json()"
- lang: Java
label: Java
source: "package com.my.project;\nimport com.mailjet.client.errors.MailjetException;\nimport com.mailjet.client.errors.MailjetSocketTimeoutException;\nimport com.mailjet.client.MailjetClient;\nimport com.mailjet.client.MailjetRequest;\nimport com.mailjet.client.MailjetResponse;\nimport com.mailjet.client.ClientOptions;\nimport com.mailjet.client.resource.Contactfilter;\nimport org.json.JSONArray;\nimport org.json.JSONObject;\npublic class MyClass {\n public static void main(String[] args) throws MailjetException, MailjetSocketTimeoutException {\n MailjetClient client;\n MailjetRequest request;\n MailjetResponse response;\n client = new MailjetClient(System.getenv(\"MJ_APIKEY_PUBLIC\"), System.getenv(\"MJ_APIKEY_PRIVATE\"), new ClientOptions(\"v3\"));\n request = new MailjetRequest(Contactfilter.resource);\n response = client.get(request);\n System.out.println(response.getStatus());\n System.out.println(response.getData());\n }\n}"
- lang: Go
label: Go
source: "package main\nimport (\n\t\"fmt\"\n\t\"log\"\n\t\"os\"\n\tmailjet \"github.com/mailjet/mailjet-apiv3-go\"\n\t\"github.com/mailjet/mailjet-apiv3-go/resources\"\n)\nfunc main () {\n\tmailjetClient := NewMailjetClient(os.Getenv(\"MJ_APIKEY_PUBLIC\"), os.Getenv(\"MJ_APIKEY_PRIVATE\"))\n\tvar data []resources.Contactfilter\n\t_, _, err := mailjetClient.List(\"contactfilter\", &data)\n\tif err != nil {\n\t fmt.Println(err)\n\t}\n\tfmt.Printf(\"Data array: %+v\\n\", data)\n}"
- lang: C#
label: C#
source: "using Mailjet.Client;\nusing Mailjet.Client.Resources;\nusing System;\nusing Newtonsoft.Json.Linq;\nnamespace Mailjet.ConsoleApplication\n{\n class Program\n {\n static void Main(string[] args)\n {\n RunAsync().Wait();\n }\n static async Task RunAsync()\n {\n MailjetClient client = new MailjetClient(Environment.GetEnvironmentVariable(\"MJ_APIKEY_PUBLIC\"), Environment.GetEnvironmentVariable(\"MJ_APIKEY_PRIVATE\"))\n {\n Version = ApiVersion.V3,\n };\n MailjetRequest request = new MailjetRequest\n {\n Resource = Contactfilter.Resource,\n }\n MailjetResponse response = await client.GetAsync(request);\n if (response.IsSuccessStatusCode)\n {\n Console.WriteLine(string.Format(\"Total: {0}, Count: {1}\\n\", response.GetTotal(), response.GetCount()));\n Console.WriteLine(response.GetData());\n }\n else\n {\n Console.WriteLine(string.Format(\"StatusCode: {0}\\n\", response.StatusCode));\n Console.WriteLine(string.Format(\"ErrorInfo: {0}\\n\", response.GetErrorInfo()));\n Console.WriteLine(response.GetData());\n Console.WriteLine(string.Format(\"ErrorMessage: {0}\\n\", response.GetErrorMessage()));\n }\n }\n }\n}"
post:
x-seo:
title: "Create Contact Filter"
description: "Create a new segmentation formula to be applied on contact lists when you send your campaigns. Segmentation can be done based on additional data saved\u2026"
tags:
- Segmentation
summary: Create Contact Filter
description: Create a new segmentation formula to be applied on contact lists when you send your campaigns. Segmentation can be done based on additional data saved for contacts via `/contactmetadata` and/or based on contact activity (or lack thereof). The properties used in `Expression` must already exist on your account - create them first with `POST /v3/REST/contactmetadata`, otherwise the request fails with `Unknown identifier`.
operationId: post_v3_contactfilter
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/NewContactfilter'
example:
Description: Will send only to contacts whose first name is John.
Expression: first_name="John"
Name: Example Contact Filter
responses:
'201':
description: Default OK response for `/contactfilter`
content:
application/json:
schema:
type: object
properties:
Count:
description: Indicates the number of objects in the `Data` array.
type: integer
format: int64
examples:
- 1
Data:
description: A JSON array containing a list of objects returned by this endpoint.
type: array
items:
$ref: '#/components/schemas/OutputContactfilter'
Total:
description: Indicates the number of objects in the `Data` array.
type: integer
format: int64
examples:
- 1
'400':
$ref: '#/components/responses/400'
'401':
$ref: '#/components/responses/401'
'403':
$ref: '#/components/responses/403'
'404':
$ref: '#/components/responses/404'
'429':
$ref: '#/components/responses/429'
'500':
$ref: '#/components/responses/500'
security:
- basicAuth: []
x-codeSamples:
- lang: curl
label: cURL
source: "curl -s \\\n\t-X POST \\\n\t--user \"$MJ_APIKEY_PUBLIC:$MJ_APIKEY_PRIVATE\" \\\n\thttps://api.mailjet.com/v3/REST/contactfilter \\\n\t-H 'Content-Type: application/json' \\\n\t-d '{\n \"Description\":\"Will send only to contacts under 35 years of age.\",\n \"Expression\":\"(age<35)\",\n \"Name\":\"Customers under 35\"\n\t}'"
- lang: PHP
label: PHP
source: " 'v3']);\n$body = [\n 'Description' => \"Will send only to contacts under 35 years of age.\",\n 'Expression' => \"(age<35)\",\n 'Name' => \"Customers under 35\"\n];\n$response = $mj->post(Resources::$Contactfilter, ['body' => $body]);\n$response->success() && var_dump($response->getData());\n?>"
- lang: Node.js
label: Node
source: "const mailjet = require ('node-mailjet')\n\t.connect(process.env.MJ_APIKEY_PUBLIC, process.env.MJ_APIKEY_PRIVATE)\nconst request = mailjet\n\t.post(\"contactfilter\", {'version': 'v3'})\n\t.request({\n \"Description\":\"Will send only to contacts under 35 years of age.\",\n \"Expression\":\"(age<35)\",\n \"Name\":\"Customers under 35\"\n })\nrequest\n\t.then((result) => {\n\t\tconsole.log(result.body)\n\t})\n\t.catch((err) => {\n\t\tconsole.log(err.statusCode)\n\t})"
- lang: Ruby
label: Ruby
source: "require 'mailjet'\nMailjet.configure do |config|\n config.api_key = ENV['MJ_APIKEY_PUBLIC']\n config.secret_key = ENV['MJ_APIKEY_PRIVATE']\n config.api_version = \"v3\"\nend\nvariable = Mailjet::Contactfilter.create(\n description: \"Will send only to contacts under 35 years of age.\",\n expression: \"(age<35)\",\n name: \"Customers under 35\"\n)\np variable.attributes['Data']"
- lang: Python
label: Python
source: "from mailjet_rest import Client\nimport os\napi_key = os.environ['MJ_APIKEY_PUBLIC']\napi_secret = os.environ['MJ_APIKEY_PRIVATE']\nmailjet = Client(auth=(api_key, api_secret), version='v3')\ndata = {\n 'Description': \"Will send only to contacts under 35 years of age.\",\n 'Expression': \"(age<35)\",\n 'Name': \"Customers under 35\"\n}\nresult = mailjet.contactfilter.create(data=data)\nprint result.status_code\nprint result.json()"
- lang: Java
label: Java
source: "package com.my.project;\nimport com.mailjet.client.errors.MailjetException;\nimport com.mailjet.client.errors.MailjetSocketTimeoutException;\nimport com.mailjet.client.MailjetClient;\nimport com.mailjet.client.MailjetRequest;\nimport com.mailjet.client.MailjetResponse;\nimport com.mailjet.client.ClientOptions;\nimport com.mailjet.client.resource.Contactfilter;\nimport org.json.JSONArray;\nimport org.json.JSONObject;\npublic class MyClass {\n public static void main(String[] args) throws MailjetException, MailjetSocketTimeoutException {\n MailjetClient client;\n MailjetRequest request;\n MailjetResponse response;\n client = new MailjetClient(System.getenv(\"MJ_APIKEY_PUBLIC\"), System.getenv(\"MJ_APIKEY_PRIVATE\"), new ClientOptions(\"v3\"));\n request = new MailjetRequest(Contactfilter.resource)\n .property(Contactfilter.DESCRIPTION, \"Will send only to contacts under 35 years of age.\")\n .property(Contactfilter.EXPRESSION, \"(age<35)\")\n .property(Contactfilter.NAME, \"Customers under 35\")\n );\n response = client.post(request);\n System.out.println(response.getStatus());\n System.out.println(response.getData());\n }\n}"
- lang: Go
label: Go
source: "package main\nimport (\n\t\"fmt\"\n\t\"log\"\n\t\"os\"\n\tmailjet \"github.com/mailjet/mailjet-apiv3-go\"\n\t\"github.com/mailjet/mailjet-apiv3-go/resources\"\n)\nfunc main () {\n\tmailjetClient := NewMailjetClient(os.Getenv(\"MJ_APIKEY_PUBLIC\"), os.Getenv(\"MJ_APIKEY_PRIVATE\"))\n\tvar data []resources.Contactfilter\n\tmr := &Request{\n\t Resource: \"contactfilter\",\n\t}\n\tfmr := &FullRequest{\n\t Info: mr,\n\t Payload: &resources.Contactfilter { \n\t Description:\"Will send only to contacts under 35 years of age.\",\n\t Expression:\"(age<35)\",\n\t Name:\"Customers under 35\"\n }\n\t}\n\terr := mailjetClient.Post(fmr, &data)\n\tif err != nil {\n\t fmt.Println(err)\n\t}\n\tfmt.Printf(\"Data array: %+v\\n\", data)\n}"
- lang: C#
label: C#
source: "using Mailjet.Client;\nusing Mailjet.Client.Resources;\nusing System;\nusing Newtonsoft.Json.Linq;\nnamespace Mailjet.ConsoleApplication\n{\n class Program\n {\n static void Main(string[] args)\n {\n RunAsync().Wait();\n }\n static async Task RunAsync()\n {\n MailjetClient client = new MailjetClient(Environment.GetEnvironmentVariable(\"MJ_APIKEY_PUBLIC\"), Environment.GetEnvironmentVariable(\"MJ_APIKEY_PRIVATE\"))\n {\n Version = ApiVersion.V3,\n };\n MailjetRequest request = new MailjetRequest\n {\n Resource = Contactfilter.Resource,\n }\n .Property(Contactfilter.Description, \"Will send only to contacts under 35 years of age.\")\n .Property(Contactfilter.Expression, \"(age<35)\")\n .Property(Contactfilter.Name, \"Customers under 35\");\n MailjetResponse response = await client.PostAsync(request);\n if (response.IsSuccessStatusCode)\n {\n Console.WriteLine(string.Format(\"Total: {0}, Count: {1}\\n\", response.GetTotal(), response.GetCount()));\n Console.WriteLine(response.GetData());\n }\n else\n {\n Console.WriteLine(string.Format(\"StatusCode: {0}\\n\", response.StatusCode));\n Console.WriteLine(string.Format(\"ErrorInfo: {0}\\n\", response.GetErrorInfo()));\n Console.WriteLine(response.GetData());\n Console.WriteLine(string.Format(\"ErrorMessage: {0}\\n\", response.GetErrorMessage()));\n }\n }\n }\n}"
"/v3/REST/contactfilter/{contactfilter_ID}":
get:
x-seo:
title: "Contact Filter by ID"
description: "Retrieve configuration details for a specific segment. Segments can be applied on contact lists when you send your campaigns. Segmentation is done based\u2026"
tags:
- Segmentation
summary: Contact Filter by ID
description: Retrieve configuration details for a specific segment. Segments can be applied on contact lists when you send your campaigns. Segmentation is done based on additional data saved for contacts via `/contactmetadata` and/or based on contact activity (or lack thereof). To obtain a valid `contactfilter_ID`, first call `GET /v3/REST/contactfilter` to list your segments.
operationId: get_v3_contactfilter_id
parameters:
- name: contactfilter_ID
in: path
schema:
$ref: '#/components/schemas/get_v3_contactfilter_id_PathParams/properties/contactfilter_ID'
required: true
example: 9000
responses:
'200':
description: Default OK response for `/contactfilter`
content:
application/json:
schema:
type: object
properties:
Count:
description: Indicates the number of objects in the `Data` array.
type: integer
format: int64
examples:
- 1
Data:
description: A JSON array containing a list of objects returned by this endpoint.
type: array
items:
$ref: '#/components/schemas/OutputContactfilter'
Total:
description: Indicates the number of objects in the `Data` array.
type: integer
format: int64
examples:
- 1
'400':
$ref: '#/components/responses/400'
'401':
$ref: '#/components/responses/401'
'403':
$ref: '#/components/responses/403'
'404':
$ref: '#/components/responses/404'
'429':
$ref: '#/components/responses/429'
'500':
$ref: '#/components/responses/500'
security:
- basicAuth: []
x-codeSamples:
- lang: curl
label: cURL
source: "curl -s \\\n\t-X GET \\\n\t--user \"$MJ_APIKEY_PUBLIC:$MJ_APIKEY_PRIVATE\" \\\n\thttps://api.mailjet.com/v3/REST/contactfilter/$contactfilter_ID \\"
- lang: PHP
label: PHP
source: " 'v3']);\n$response = $mj->get(Resources::$Contactfilter, ['id' => $id]);\n$response->success() && var_dump($response->getData());\n?>"
- lang: Node.js
label: Node
source: "const mailjet = require ('node-mailjet')\n\t.connect(process.env.MJ_APIKEY_PUBLIC, process.env.MJ_APIKEY_PRIVATE)\nconst request = mailjet\n\t.get(\"contactfilter\", {'version': 'v3'})\n\t.id($contactfilter_ID)\n\t.request()\nrequest\n\t.then((result) => {\n\t\tconsole.log(result.body)\n\t})\n\t.catch((err) => {\n\t\tconsole.log(err.statusCode)\n\t})"
- lang: Ruby
label: Ruby
source: "require 'mailjet'\nMailjet.configure do |config|\n config.api_key = ENV['MJ_APIKEY_PUBLIC']\n config.secret_key = ENV['MJ_APIKEY_PRIVATE']\n config.api_version = \"v3\"\nend\nvariable = Mailjet::Contactfilter.find($contactfilter_ID\n)\np variable.attributes['Data']"
- lang: Python
label: Python
source: "from mailjet_rest import Client\nimport os\napi_key = os.environ['MJ_APIKEY_PUBLIC']\napi_secret = os.environ['MJ_APIKEY_PRIVATE']\nmailjet = Client(auth=(api_key, api_secret), version='v3')\nid = '$contactfilter_ID'\nresult = mailjet.contactfilter.get(id=id)\nprint result.status_code\nprint result.json()"
- lang: Java
label: Java
source: "package com.my.project;\nimport com.mailjet.client.errors.MailjetException;\nimport com.mailjet.client.errors.MailjetSocketTimeoutException;\nimport com.mailjet.client.MailjetClient;\nimport com.mailjet.client.MailjetRequest;\nimport com.mailjet.client.MailjetResponse;\nimport com.mailjet.client.ClientOptions;\nimport com.mailjet.client.resource.Contactfilter;\nimport org.json.JSONArray;\nimport org.json.JSONObject;\npublic class MyClass {\n public static void main(String[] args) throws MailjetException, MailjetSocketTimeoutException {\n MailjetClient client;\n MailjetRequest request;\n MailjetResponse response;\n client = new MailjetClient(System.getenv(\"MJ_APIKEY_PUBLIC\"), System.getenv(\"MJ_APIKEY_PRIVATE\"), new ClientOptions(\"v3\"));\n request = new MailjetRequest(Contactfilter.resource, ID);\n response = client.get(request);\n System.out.println(response.getStatus());\n System.out.println(response.getData());\n }\n}"
- lang: Go
label: Go
source: "package main\nimport (\n\t\"fmt\"\n\t\"log\"\n\t\"os\"\n\tmailjet \"github.com/mailjet/mailjet-apiv3-go\"\n\t\"github.com/mailjet/mailjet-apiv3-go/resources\"\n)\nfunc main () {\n\tmailjetClient := NewMailjetClient(os.Getenv(\"MJ_APIKEY_PUBLIC\"), os.Getenv(\"MJ_APIKEY_PRIVATE\"))\n\tvar data []resources.Contactfilter\n\tmr := &Request{\n\t Resource: \"contactfilter\",\n\t ID: RESOURCE_ID,\n\t}\n\terr := mailjetClient.Get(mr, &data)\n\tif err != nil {\n\t fmt.Println(err)\n\t}\n\tfmt.Printf(\"Data array: %+v\\n\", data)\n}"
- lang: C#
label: C#
source: "using Mailjet.Client;\nusing Mailjet.Client.Resources;\nusing System;\nusing Newtonsoft.Json.Linq;\nnamespace Mailjet.ConsoleApplication\n{\n class Program\n {\n static void Main(string[] args)\n {\n RunAsync().Wait();\n }\n static async Task RunAsync()\n {\n MailjetClient client = new MailjetClient(Environment.GetEnvironmentVariable(\"MJ_APIKEY_PUBLIC\"), Environment.GetEnvironmentVariable(\"MJ_APIKEY_PRIVATE\"))\n {\n Version = ApiVersion.V3,\n };\n MailjetRequest request = new MailjetRequest\n {\n Resource = Contactfilter.Resource,\n ResourceId = ResourceId.Numeric(ID)\n }\n MailjetResponse response = await client.GetAsync(request);\n if (response.IsSuccessStatusCode)\n {\n Console.WriteLine(string.Format(\"Total: {0}, Count: {1}\\n\", response.GetTotal(), response.GetCount()));\n Console.WriteLine(response.GetData());\n }\n else\n {\n Console.WriteLine(string.Format(\"StatusCode: {0}\\n\", response.StatusCode));\n Console.WriteLine(string.Format(\"ErrorInfo: {0}\\n\", response.GetErrorInfo()));\n Console.WriteLine(response.GetData());\n Console.WriteLine(string.Format(\"ErrorMessage: {0}\\n\", response.GetErrorMessage()));\n }\n }\n }\n}"
put:
x-seo:
title: "Update Contact Filter"
description: "Update an existing segment. Segments can be applied on contact lists when you send your campaigns. Segmentation is done based on additional data saved\u2026"
tags:
- Segmentation
summary: Update Contact Filter
description: "Update an existing segment. Segments can be applied on contact lists when you send your campaigns. Segmentation is done based on additional data saved for contacts via `/contactmetadata` and/or based on contact activity (or lack thereof).\n\nOnly segments with `deleted` status can be updated via the API. Deleted segments can be updated to `unused`.\n To obtain a valid `contactfilter_ID`, first call `GET /v3/REST/contactfilter` to list your segments."
operationId: put_v3_contactfilter_id
parameters:
- name: contactfilter_ID
in: path
schema:
$ref: '#/components/schemas/put_v3_contactfilter_id_PathParams/properties/contactfilter_ID'
required: true
example: 9000
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/UpdateContactfilter'
example:
Description: Will send only to contacts under 35 years of age.
Expression: (age<35)
Name: Customers under 35
Status: unused
responses:
'200':
description: Default OK response for `/contactfilter`
content:
application/json:
schema:
type: object
properties:
Count:
description: Indicates the number of objects in the `Data` array.
type: integer
format: int64
examples:
- 1
Data:
description: A JSON array containing a list of objects returned by this endpoint.
type: array
items:
$ref: '#/components/schemas/OutputContactfilter'
Total:
description: Indicates the number of objects in the `Data` array.
type: integer
format: int64
examples:
- 1
'400':
$ref: '#/components/responses/400'
'401':
$ref: '#/components/responses/401'
'403':
$ref: '#/components/responses/403'
'404':
$ref: '#/components/responses/404'
'429':
$ref: '#/components/responses/429'
'500':
$ref: '#/components/responses/500'
security:
- basicAuth: []
x-codeSamples:
- lang: curl
label: cURL
source: "curl -s \\\n\t-X PUT \\\n\t--user \"$MJ_APIKEY_PUBLIC:$MJ_APIKEY_PRIVATE\" \\\n\thttps://api.mailjet.com/v3/REST/contactfilter/$contactfilter_ID \\\n\t-H 'Content-Type: application/json' \\\n\t-d '{\n \"Description\":\"Will send only to contacts under 35 years of age.\",\n \"Expression\":\"(age<35)\",\n \"Name\":\"Customers under 35\",\n \"Status\":\"unused\"\n\t}'"
- lang: PHP
label: PHP
source: " 'v3']);\n$body = [\n 'Description' => \"Will send only to contacts under 35 years of age.\",\n 'Expression' => \"(age<35)\",\n 'Name' => \"Customers under 35\",\n 'Status' => \"unused\"\n];\n$response = $mj->put(Resources::$Contactfilter, ['id' => $id, 'body' => $body]);\n$response->success() && var_dump($response->getData());\n?>"
- lang: Node.js
label: Node
source: "const mailjet = require ('node-mailjet')\n\t.connect(process.env.MJ_APIKEY_PUBLIC, process.env.MJ_APIKEY_PRIVATE)\nconst request = mailjet\n\t.put(\"contactfilter\", {'version': 'v3'})\n\t.id($contactfilter_ID)\n\t.request({\n \"Description\":\"Will send only to contacts under 35 years of age.\",\n \"Expression\":\"(age<35)\",\n \"Name\":\"Customers under 35\",\n \"Status\":\"unused\"\n })\nrequest\n\t.then((result) => {\n\t\tconsole.log(result.body)\n\t})\n\t.catch((err) => {\n\t\tconsole.log(err.statusCode)\n\t})"
- lang: Ruby
label: Ruby
source: "require 'mailjet'\nMailjet.configure do |config|\n config.api_key = ENV['MJ_APIKEY_PUBLIC']\n config.secret_key = ENV['MJ_APIKEY_PRIVATE']\n config.api_version = \"v3\"\nend\ntarget = Mailjet::Contactfilter.find($contactfilter_ID)\ntarget.update_attributes(\n description: \"Will send only to contacts under 35 years of age.\",\n expression: \"(age<35)\",\n name: \"Customers under 35\",\n status: \"unused\"\n)\np variable.attributes['Data']"
- lang: Python
label: Python
source: "from mailjet_rest import Client\nimport os\napi_key = os.environ['MJ_APIKEY_PUBLIC']\napi_secret = os.environ['MJ_APIKEY_PRIVATE']\nmailjet = Client(auth=(api_key, api_secret), version='v3')\nid = '$contactfilter_ID'\ndata = {\n 'Description': \"Will send only to contacts under 35 years of age.\",\n 'Expression': \"(age<35)\",\n 'Name': \"Customers under 35\",\n 'Status': \"unused\"\n}\nresult = mailjet.contactfilter.update(id=id, data=data)\nprint result.status_code\nprint result.json()"
- lang: Java
label: Java
source: "package com.my.project;\nimport com.mailjet.client.errors.MailjetException;\nimport com.mailjet.client.errors.MailjetSocketTimeoutException;\nimport com.mailjet.client.MailjetClient;\nimport com.mailjet.client.MailjetRequest;\nimport com.mailjet.client.MailjetResponse;\nimport com.mailjet.client.ClientOptions;\nimport com.mailjet.client.resource.Contactfilter;\nimport org.json.JSONArray;\nimport org.json.JSONObject;\npublic class MyClass {\n public static void main(String[] args) throws MailjetException, MailjetSocketTimeoutException {\n MailjetClient client;\n MailjetRequest request;\n MailjetResponse response;\n client = new MailjetClient(System.getenv(\"MJ_APIKEY_PUBLIC\"), System.getenv(\"MJ_APIKEY_PRIVATE\"), new ClientOptions(\"v3\"));\n request = new MailjetRequest(Contactfilter.resource, ID)\n .property(Contactfilter.DESCRIPTION, \"Will send only to contacts under 35 years of age.\")\n .property(Contactfilter.EXPRESSION, \"(age<35)\")\n .property(Contactfilter.NAME, \"Customers under 35\")\n .property(Contactfilter.STATUS, \"unused\")\n );\n response = client.put(request);\n System.out.println(response.getStatus());\n System.out.println(response.getData());\n }\n}"
- lang: Go
label: Go
source: "package main\nimport (\n\t\"fmt\"\n\t\"log\"\n\t\"os\"\n\tmailjet \"github.com/mailjet/mailjet-apiv3-go\"\n\t\"github.com/mailjet/mailjet-apiv3-go/resources\"\n)\nfunc main () {\n\tmailjetClient := NewMailjetClient(os.Getenv(\"MJ_APIKEY_PUBLIC\"), os.Getenv(\"MJ_APIKEY_PRIVATE\"))\n\tmr := &Request{\n\t Resource: \"contactfilter\",\n\t ID: RESOURCE_ID,\n\t}\n\tfmr := &FullRequest{\n\t Info: mr,\n\t Payload: &resources.Contactfilter { \n\t Description:\"Will send only to contacts under 35 years of age.\",\n\t Expression:\"(age<35)\",\n\t Name:\"Customers under 35\",\n\t Status:\"unused\"\n }\n\t}\n\terr := mailjetClient.Put(fmr)\n\tif err != nil {\n\t fmt.Println(err)\n\t}\n}"
- lang: C#
label: C#
source: "using Mailjet.Client;\nusing Mailjet.Client.Resources;\nusing System;\nusing Newtonsoft.Json.Linq;\nnamespace Mailjet.ConsoleApplication\n{\n class Program\n {\n static void Main(string[] args)\n {\n RunAsync().Wait();\n }\n static async Task RunAsync()\n {\n MailjetClient client = new MailjetClient(Environment.GetEnvironmentVariable(\"MJ_APIKEY_PUBLIC\"), Environment.GetEnvironmentVariable(\"MJ_APIKEY_PRIVATE\"))\n {\n Version = ApiVersion.V3,\n };\n MailjetRequest request = new MailjetRequest\n {\n Resource = Contactfilter.Resource,\n ResourceId = ResourceId.Numeric(ID)\n }\n .Property(Contactfilter.Description, \"Will send only to contacts under 35 years of age.\")\n .Property(Contactfilter.Expression, \"(age<35)\")\n .Property(Contactfilter.Name, \"Customers under 35\")\n .Property(Contactfilter.Status, \"unused\");\n MailjetResponse response = await client.PutAsync(request);\n if (response.IsSuccessStatusCode)\n {\n Console.WriteLine(string.Format(\"Total: {0}, Count: {1}\\n\", response.GetTotal(), response.GetCount()));\n Console.WriteLine(response.GetData());\n }\n else\n {\n Console.WriteLine(string.Format(\"StatusCode: {0}\\n\", response.StatusCode));\n Console.WriteLine(string.Format(\"ErrorInfo: {0}\\n\", response.GetErrorInfo()));\n Console.WriteLine(response.GetData());\n Console.WriteLine(string.Format(\"ErrorMessage: {0}\\n\", response.GetErrorMessage()));\n }\n }\n }\n}"
delete:
x-seo:
title: "Delete Contact Filter"
description: "Delete an existing segment. Segments can be applied on contact lists when you send your campaigns. Segmentation is done based on additional data saved\u2026"
tags:
- Segmentation
summary: Delete Contact Filter
description: "Delete an existing segment. Segments can be applied on contact lists when you send your campaigns. Segmentation is done based on additional data saved for contacts via `/contactmetadata` and/or based on contact activity (or lack thereof).\n\nThe deletion is a soft one and a deleted segment can later be reinstated by changing its `Status` via a `PUT` request.\n"
operationId: delete_v3_contactfilter_id
parameters:
- name: contactfilter_ID
in: path
schema:
$ref: '#/components/schemas/delete_v3_contactfilter_id_PathParams/properties/contactfilter_ID'
required: true
responses:
'204':
$ref: '#/components/responses/204'
'400':
$ref: '#/components/responses/400'
'401':
$ref: '#/components/responses/401'
'403':
$ref: '#/components/responses/403'
'404':
$ref: '#/components/responses/404'
'429':
$ref: '#/components/responses/429'
'500':
$ref: '#/components/responses/500'
security:
- basicAuth: []
x-codeSamples:
- lang: curl
label: cURL
source: "curl -s \\\n\t-X DELETE \\\n\t--user \"$MJ_APIKEY_PUBLIC:$MJ_APIKEY_PRIVATE\" \\\n\thttps://api.mailjet.com/v3/REST/contactfilter/$contactfilter_ID \\\n\t-H 'Content-Type: application/json' \\\n\t-d '{\n\t}'"
- lang: PHP
label: PHP
source: " 'v3']);\n$response = $mj->delete(Resources::$Contactfilter, ['id' => $id]);\n$response->success() && var_dump($response->getData());\n?>"
- lang: Node.js
label: Node
source: "const mailjet = require ('node-mailjet')\n\t.connect(process.env.MJ_APIKEY_PUBLIC, process.env.MJ_APIKEY_PRIVATE)\nconst request = mailjet\n\t.delete(\"contactfilter\", {'version': 'v3'})\n\t.id($contactfilter_ID)\n\t.request()\nrequest\n\t.then((result) => {\n\t\tconsole.log(result.body)\n\t})\n\t.catch((err) => {\n\t\tconsole.log(err.statusCode)\n\t})"
- lang: Ruby
label: Ruby
source: "require 'mailjet'\nMailjet.configure do |config|\n config.api_key = ENV['MJ_APIKEY_PUBLIC']\n config.secret_key = ENV['MJ_APIKEY_PRIVATE']\n config.api_version = \"v3\"\nend\ntarget = Mailjet::Contactfilter.find($contactfilter_ID)\ntarget.delete(\n)\np variable.attributes['Data']"
- lang: Python
label: Python
source: "from mailjet_rest import Client\nimport os\napi_key = os.environ['MJ_APIKEY_PUBLIC']\napi_secret = os.environ['MJ_APIKEY_PRIVATE']\nmailjet = Client(auth=(api_key, api_secret), version='v3')\nid = '$contactfilter_ID'\nresult = mailjet.contactfilter.delete(id=id)\nprint result.status_code\nprint result.json()"
- lang: Java
label: Java
source: "package com.my.project;\nimport com.mailjet.client.errors.MailjetException;\nimport com.mailjet.client.errors.MailjetSocketTimeoutException;\nimport com.mailjet.client.MailjetClient;\nimport com.mailjet.client.MailjetRequest;\nimport com.mailjet.client.MailjetResponse;\nimport com.mailjet.client.ClientOptions;\nimport com.mailjet.client.resource.Contactfilter;\nimport org.json.JSONArray;\nimport org.json.JSONObject;\npublic class MyClass {\n public static void main(String[] args) throws MailjetException, MailjetSocketTimeoutException {\n MailjetClient client;\n MailjetRequest request;\n MailjetResponse response;\n client = new MailjetClient(System.getenv(\"MJ_APIKEY_PUBLIC\"), System.getenv(\"MJ_APIKEY_PRIVATE\"), new ClientOptions(\"v3\"));\n request = new MailjetRequest(Contactfilter.resource, ID);\n response = client.delete(request);\n System.out.println(response.getStatus());\n System.out.println(response.getData());\n }\n}"
- lang: Go
label: Go
source: "package main\nimport (\n\t\"fmt\"\n\t\"log\"\n\t\"os\"\n\tmailjet \"github.com/mailjet/mailjet-apiv3-go\"\n\t\"github.com/mailjet/mailjet-apiv3-go/resources\"\n)\nfunc main () {\n\tmailjetClient := NewMailjetClient(os.Getenv(\"MJ_APIKEY_PUBLIC\"), os.Getenv(\"MJ_APIKEY_PRIVATE\"))\n\tmr := &Request{\n\t Resource: \"contactfilter\",\n\t ID: RESOURCE_ID,\n\t}\n\terr := mailjetClient.Delete(mr)\n\tif err != nil {\n\t fmt.Println(err)\n\t}\n}"
- lang: C#
label: C#
source: "using Mailjet.Client;\nusing Mailjet.Client.Resources;\nusing System;\nusing Newtonsoft.Json.Linq;\nnamespace Mailjet.ConsoleApplication\n{\n class Program\n {\n static void Main(string[] args)\n {\n RunAsync().Wait();\n }\n static async Task RunAsync()\n {\n MailjetClient client = new MailjetClient(Environment.GetEnvironmentVariable(\"MJ_APIKEY_PUBLIC\"), Environment.GetEnvironmentVariable(\"MJ_APIKEY_PRIVATE\"))\n {\n Version = ApiVersion.V3,\n };\n MailjetRequest request = new MailjetRequest\n {\n Resource = Contactfilter.Resource,\n ResourceId = ResourceId.Numeric(ID)\n }\n MailjetResponse response = await client.DeleteAsync(request);\n if (response.IsSuccessStatusCode)\n {\n Console.WriteLine(string.Format(\"Total: {0}, Count: {1}\\n\", response.GetTotal(), response.GetCount()));\n Console.WriteLine(response.GetData());\n }\n else\n {\n Console.WriteLine(string.Format(\"StatusCode: {0}\\n\", response.StatusCode));\n Console.WriteLine(string.Format(\"ErrorInfo: {0}\\n\", response.GetErrorInfo()));\n Console.WriteLine(response.GetData());\n Console.WriteLine(string.Format(\"ErrorMessage: {0}\\n\", response.GetErrorMessage()));\n }\n }\n }\n}"
"/v3/REST/template":
get:
x-seo:
title: "Template List"
description: "Template List using the Mailjet Email API. Retrieve a list of all templates and their configuration settings."
tags:
- Templates
summary: Template List
description: Retrieve a list of all templates and their configuration settings.
operationId: get_v3_template
parameters:
- name: Categories
in: query
schema:
$ref: '#/components/schemas/get_v3_template_QueryParams/properties/Categories'
- name: CategoriesSelectionMethod
in: query
schema:
$ref: '#/components/schemas/get_v3_template_QueryParams/properties/CategoriesSelectionMethod'
- name: EditMode
in: query
schema:
$ref: '#/components/schemas/get_v3_template_QueryParams/properties/EditMode'
- name: Name
in: query
schema:
$ref: '#/components/schemas/get_v3_template_QueryParams/properties/Name'
- name: OwnerType
in: query
schema:
$ref: '#/components/schemas/get_v3_template_QueryParams/properties/OwnerType'
- name: Purposes
in: query
schema:
$ref: '#/components/schemas/get_v3_template_QueryParams/properties/Purposes'
- name: PurposesSelectionMethod
in: query
schema:
$ref: '#/components/schemas/get_v3_template_QueryParams/properties/PurposesSelectionMethod'
responses:
'200':
description: Default OK response for `/template`
content:
application/json:
schema:
type: object
properties:
Count:
description: Indicates the number of objects in the `Data` array.
type: integer
format: int64
examples:
- 1
Data:
description: A JSON array containing a list of objects returned by this endpoint.
type: array
items:
$ref: '#/components/schemas/OutputTemplate'
Total:
description: Indicates the number of objects in the `Data` array.
type: integer
format: int64
examples:
- 1
'400':
$ref: '#/components/responses/400'
'401':
$ref: '#/components/responses/401'
'403':
$ref: '#/components/responses/403'
'404':
$ref: '#/components/responses/404'
'429':
$ref: '#/components/responses/429'
'500':
$ref: '#/components/responses/500'
security:
- basicAuth: []
x-codeSamples:
- lang: curl
label: cURL
source: "curl -s \\\n\t-X GET \\\n\t--user \"$MJ_APIKEY_PUBLIC:$MJ_APIKEY_PRIVATE\" \\\n\thttps://api.mailjet.com/v3/REST/template \\"
- lang: PHP
label: PHP
source: " 'v3']);\n$response = $mj->get(Resources::$Template);\n$response->success() && var_dump($response->getData());\n?>"
- lang: Node.js
label: Node
source: "const mailjet = require ('node-mailjet')\n\t.connect(process.env.MJ_APIKEY_PUBLIC, process.env.MJ_APIKEY_PRIVATE)\nconst request = mailjet\n\t.get(\"template\", {'version': 'v3'})\n\t.request()\nrequest\n\t.then((result) => {\n\t\tconsole.log(result.body)\n\t})\n\t.catch((err) => {\n\t\tconsole.log(err.statusCode)\n\t})"
- lang: Ruby
label: Ruby
source: "require 'mailjet'\nMailjet.configure do |config|\n config.api_key = ENV['MJ_APIKEY_PUBLIC']\n config.secret_key = ENV['MJ_APIKEY_PRIVATE']\n config.api_version = \"v3\"\nend\nvariable = Mailjet::Template.all(\n)\np variable.attributes['Data']"
- lang: Python
label: Python
source: "from mailjet_rest import Client\nimport os\napi_key = os.environ['MJ_APIKEY_PUBLIC']\napi_secret = os.environ['MJ_APIKEY_PRIVATE']\nmailjet = Client(auth=(api_key, api_secret), version='v3')\nresult = mailjet.template.get()\nprint result.status_code\nprint result.json()"
- lang: Java
label: Java
source: "package com.my.project;\nimport com.mailjet.client.errors.MailjetException;\nimport com.mailjet.client.errors.MailjetSocketTimeoutException;\nimport com.mailjet.client.MailjetClient;\nimport com.mailjet.client.MailjetRequest;\nimport com.mailjet.client.MailjetResponse;\nimport com.mailjet.client.ClientOptions;\nimport com.mailjet.client.resource.Template;\nimport org.json.JSONArray;\nimport org.json.JSONObject;\npublic class MyClass {\n public static void main(String[] args) throws MailjetException, MailjetSocketTimeoutException {\n MailjetClient client;\n MailjetRequest request;\n MailjetResponse response;\n client = new MailjetClient(System.getenv(\"MJ_APIKEY_PUBLIC\"), System.getenv(\"MJ_APIKEY_PRIVATE\"), new ClientOptions(\"v3\"));\n request = new MailjetRequest(Template.resource);\n response = client.get(request);\n System.out.println(response.getStatus());\n System.out.println(response.getData());\n }\n}"
- lang: Go
label: Go
source: "package main\nimport (\n\t\"fmt\"\n\t\"log\"\n\t\"os\"\n\tmailjet \"github.com/mailjet/mailjet-apiv3-go\"\n\t\"github.com/mailjet/mailjet-apiv3-go/resources\"\n)\nfunc main () {\n\tmailjetClient := NewMailjetClient(os.Getenv(\"MJ_APIKEY_PUBLIC\"), os.Getenv(\"MJ_APIKEY_PRIVATE\"))\n\tvar data []resources.Template\n\t_, _, err := mailjetClient.List(\"template\", &data)\n\tif err != nil {\n\t fmt.Println(err)\n\t}\n\tfmt.Printf(\"Data array: %+v\\n\", data)\n}"
- lang: C#
label: C#
source: "using Mailjet.Client;\nusing Mailjet.Client.Resources;\nusing System;\nusing Newtonsoft.Json.Linq;\nnamespace Mailjet.ConsoleApplication\n{\n class Program\n {\n static void Main(string[] args)\n {\n RunAsync().Wait();\n }\n static async Task RunAsync()\n {\n MailjetClient client = new MailjetClient(Environment.GetEnvironmentVariable(\"MJ_APIKEY_PUBLIC\"), Environment.GetEnvironmentVariable(\"MJ_APIKEY_PRIVATE\"))\n {\n Version = ApiVersion.V3,\n };\n MailjetRequest request = new MailjetRequest\n {\n Resource = Template.Resource,\n }\n MailjetResponse response = await client.GetAsync(request);\n if (response.IsSuccessStatusCode)\n {\n Console.WriteLine(string.Format(\"Total: {0}, Count: {1}\\n\", response.GetTotal(), response.GetCount()));\n Console.WriteLine(response.GetData());\n }\n else\n {\n Console.WriteLine(string.Format(\"StatusCode: {0}\\n\", response.StatusCode));\n Console.WriteLine(string.Format(\"ErrorInfo: {0}\\n\", response.GetErrorInfo()));\n Console.WriteLine(response.GetData());\n Console.WriteLine(string.Format(\"ErrorMessage: {0}\\n\", response.GetErrorMessage()));\n }\n }\n }\n}"
post:
x-seo:
title: "Create Template"
description: "Create Template in the Mailjet Email API. Create a new email template object and select its basic configuration settings."
tags:
- Templates
summary: Create Template
description: Create a new email template object and select its basic configuration settings.
operationId: post_v3_template
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/NewTemplate'
example:
Name: Example Template
Author: Example Author
Locale: en_US
Purposes:
- transactional
IsStarred: false
EditMode: 1
responses:
'201':
description: Default OK response for `/template`
content:
application/json:
schema:
type: object
properties:
Count:
description: Indicates the number of objects in the `Data` array.
type: integer
format: int64
examples:
- 1
Data:
description: A JSON array containing a list of objects returned by this endpoint.
type: array
items:
$ref: '#/components/schemas/OutputTemplate'
Total:
description: Indicates the number of objects in the `Data` array.
type: integer
format: int64
examples:
- 1
'400':
$ref: '#/components/responses/400'
'401':
$ref: '#/components/responses/401'
'403':
$ref: '#/components/responses/403'
'404':
$ref: '#/components/responses/404'
'429':
$ref: '#/components/responses/429'
'500':
$ref: '#/components/responses/500'
security:
- basicAuth: []
x-codeSamples:
- lang: curl
label: cURL
source: "curl -s \\\n\t-X POST \\\n\t--user \"$MJ_APIKEY_PUBLIC:$MJ_APIKEY_PRIVATE\" \\\n\thttps://api.mailjet.com/v3/REST/template \\\n\t-H 'Content-Type: application/json' \\\n\t-d '{\n \"Author\":\"John Doe\",\n \"Categories\":\"array\",\n \"Copyright\":\"Mailjet\",\n \"Description\":\"Used to send out promo codes.\",\n \"EditMode\":1,\n \"IsStarred\":false,\n \"IsTextPartGenerationEnabled\":true,\n \"Locale\":\"en_US\",\n \"Name\":\"Promo Codes\",\n \"OwnerType\":\"user\",\n \"Presets\":\"string\",\n \"Purposes\":\"array\"\n\t}'"
- lang: PHP
label: PHP
source: " 'v3']);\n$body = [\n 'Author' => \"John Doe\",\n 'Categories' => \"array\",\n 'Copyright' => \"Mailjet\",\n 'Description' => \"Used to send out promo codes.\",\n 'EditMode' => 1,\n 'IsStarred' => false,\n 'IsTextPartGenerationEnabled' => true,\n 'Locale' => \"en_US\",\n 'Name' => \"Promo Codes\",\n 'OwnerType' => \"user\",\n 'Presets' => \"string\",\n 'Purposes' => \"array\"\n];\n$response = $mj->post(Resources::$Template, ['body' => $body]);\n$response->success() && var_dump($response->getData());\n?>"
- lang: Node.js
label: Node
source: "const mailjet = require ('node-mailjet')\n\t.connect(process.env.MJ_APIKEY_PUBLIC, process.env.MJ_APIKEY_PRIVATE)\nconst request = mailjet\n\t.post(\"template\", {'version': 'v3'})\n\t.request({\n \"Author\":\"John Doe\",\n \"Categories\":\"array\",\n \"Copyright\":\"Mailjet\",\n \"Description\":\"Used to send out promo codes.\",\n \"EditMode\":1,\n \"IsStarred\":false,\n \"IsTextPartGenerationEnabled\":true,\n \"Locale\":\"en_US\",\n \"Name\":\"Promo Codes\",\n \"OwnerType\":\"user\",\n \"Presets\":\"string\",\n \"Purposes\":\"array\"\n })\nrequest\n\t.then((result) => {\n\t\tconsole.log(result.body)\n\t})\n\t.catch((err) => {\n\t\tconsole.log(err.statusCode)\n\t})"
- lang: Ruby
label: Ruby
source: "require 'mailjet'\nMailjet.configure do |config|\n config.api_key = ENV['MJ_APIKEY_PUBLIC']\n config.secret_key = ENV['MJ_APIKEY_PRIVATE']\n config.api_version = \"v3\"\nend\nvariable = Mailjet::Template.create(\n author: \"John Doe\",\n categories: \"array\",\n copyright: \"Mailjet\",\n description: \"Used to send out promo codes.\",\n edit_mode: 1,\n is_starred: false,\n is_text_part_generation_enabled: true,\n locale: \"en_US\",\n name: \"Promo Codes\",\n owner_type: \"user\",\n presets: \"string\",\n purposes: \"array\"\n)\np variable.attributes['Data']"
- lang: Python
label: Python
source: "from mailjet_rest import Client\nimport os\napi_key = os.environ['MJ_APIKEY_PUBLIC']\napi_secret = os.environ['MJ_APIKEY_PRIVATE']\nmailjet = Client(auth=(api_key, api_secret), version='v3')\ndata = {\n 'Author': \"John Doe\",\n 'Categories': \"array\",\n 'Copyright': \"Mailjet\",\n 'Description': \"Used to send out promo codes.\",\n 'EditMode': 1,\n 'IsStarred': False,\n 'IsTextPartGenerationEnabled': True,\n 'Locale': \"en_US\",\n 'Name': \"Promo Codes\",\n 'OwnerType': \"user\",\n 'Presets': \"string\",\n 'Purposes': \"array\"\n}\nresult = mailjet.template.create(data=data)\nprint result.status_code\nprint result.json()"
- lang: Java
label: Java
source: "package com.my.project;\nimport com.mailjet.client.errors.MailjetException;\nimport com.mailjet.client.errors.MailjetSocketTimeoutException;\nimport com.mailjet.client.MailjetClient;\nimport com.mailjet.client.MailjetRequest;\nimport com.mailjet.client.MailjetResponse;\nimport com.mailjet.client.ClientOptions;\nimport com.mailjet.client.resource.Template;\nimport org.json.JSONArray;\nimport org.json.JSONObject;\npublic class MyClass {\n public static void main(String[] args) throws MailjetException, MailjetSocketTimeoutException {\n MailjetClient client;\n MailjetRequest request;\n MailjetResponse response;\n client = new MailjetClient(System.getenv(\"MJ_APIKEY_PUBLIC\"), System.getenv(\"MJ_APIKEY_PRIVATE\"), new ClientOptions(\"v3\"));\n request = new MailjetRequest(Template.resource)\n .property(Template.AUTHOR, \"John Doe\")\n .property(Template.CATEGORIES, \"array\")\n .property(Template.COPYRIGHT, \"Mailjet\")\n .property(Template.DESCRIPTION, \"Used to send out promo codes.\")\n .property(Template.EDITMODE, 1)\n .property(Template.ISSTARRED, false)\n .property(Template.ISTEXTPARTGENERATIONENABLED, true)\n .property(Template.LOCALE, \"en_US\")\n .property(Template.NAME, \"Promo Codes\")\n .property(Template.OWNERTYPE, \"user\")\n .property(Template.PRESETS, \"string\")\n .property(Template.PURPOSES, \"array\")\n );\n response = client.post(request);\n System.out.println(response.getStatus());\n System.out.println(response.getData());\n }\n}"
- lang: Go
label: Go
source: "package main\nimport (\n\t\"fmt\"\n\t\"log\"\n\t\"os\"\n\tmailjet \"github.com/mailjet/mailjet-apiv3-go\"\n\t\"github.com/mailjet/mailjet-apiv3-go/resources\"\n)\nfunc main () {\n\tmailjetClient := NewMailjetClient(os.Getenv(\"MJ_APIKEY_PUBLIC\"), os.Getenv(\"MJ_APIKEY_PRIVATE\"))\n\tvar data []resources.Template\n\tmr := &Request{\n\t Resource: \"template\",\n\t}\n\tfmr := &FullRequest{\n\t Info: mr,\n\t Payload: &resources.Template { \n\t Author:\"John Doe\",\n\t Categories:\"array\",\n\t Copyright:\"Mailjet\",\n\t Description:\"Used to send out promo codes.\",\n\t EditMode:1,\n\t IsStarred:false,\n\t IsTextPartGenerationEnabled:true,\n\t Locale:\"en_US\",\n\t Name:\"Promo Codes\",\n\t OwnerType:\"user\",\n\t Presets:\"string\",\n\t Purposes:\"array\"\n }\n\t}\n\terr := mailjetClient.Post(fmr, &data)\n\tif err != nil {\n\t fmt.Println(err)\n\t}\n\tfmt.Printf(\"Data array: %+v\\n\", data)\n}"
- lang: C#
label: C#
source: "using Mailjet.Client;\nusing Mailjet.Client.Resources;\nusing System;\nusing Newtonsoft.Json.Linq;\nnamespace Mailjet.ConsoleApplication\n{\n class Program\n {\n static void Main(string[] args)\n {\n RunAsync().Wait();\n }\n static async Task RunAsync()\n {\n MailjetClient client = new MailjetClient(Environment.GetEnvironmentVariable(\"MJ_APIKEY_PUBLIC\"), Environment.GetEnvironmentVariable(\"MJ_APIKEY_PRIVATE\"))\n {\n Version = ApiVersion.V3,\n };\n MailjetRequest request = new MailjetRequest\n {\n Resource = Template.Resource,\n }\n .Property(Template.Author, \"John Doe\")\n .Property(Template.Categories, \"array\")\n .Property(Template.Copyright, \"Mailjet\")\n .Property(Template.Description, \"Used to send out promo codes.\")\n .Property(Template.EditMode, 1)\n .Property(Template.IsStarred, false)\n .Property(Template.IsTextPartGenerationEnabled, true)\n .Property(Template.Locale, \"en_US\")\n .Property(Template.Name, \"Promo Codes\")\n .Property(Template.OwnerType, \"user\")\n .Property(Template.Presets, \"string\")\n .Property(Template.Purposes, \"array\");\n MailjetResponse response = await client.PostAsync(request);\n if (response.IsSuccessStatusCode)\n {\n Console.WriteLine(string.Format(\"Total: {0}, Count: {1}\\n\", response.GetTotal(), response.GetCount()));\n Console.WriteLine(response.GetData());\n }\n else\n {\n Console.WriteLine(string.Format(\"StatusCode: {0}\\n\", response.StatusCode));\n Console.WriteLine(string.Format(\"ErrorInfo: {0}\\n\", response.GetErrorInfo()));\n Console.WriteLine(response.GetData());\n Console.WriteLine(string.Format(\"ErrorMessage: {0}\\n\", response.GetErrorMessage()));\n }\n }\n }\n}"
"/v3/REST/template/{template_ID}":
get:
x-seo:
title: "Template by ID"
description: "Template by ID using the Mailjet Email API. Retrieve the configuration settings for a specific template."
tags:
- Templates
summary: Template by ID
description: Retrieve the configuration settings for a specific template. To obtain a valid `template_ID`, first call `GET /v3/REST/template` to list your templates.
operationId: get_v3_template_id
parameters:
- name: template_ID
in: path
schema:
$ref: '#/components/schemas/get_v3_template_id_PathParams/properties/template_ID'
required: true
example: 3000
responses:
'200':
description: Default OK response for `/template`
content:
application/json:
schema:
type: object
properties:
Count:
description: Indicates the number of objects in the `Data` array.
type: integer
format: int64
examples:
- 1
Data:
description: A JSON array containing a list of objects returned by this endpoint.
type: array
items:
$ref: '#/components/schemas/OutputTemplate'
Total:
description: Indicates the number of objects in the `Data` array.
type: integer
format: int64
examples:
- 1
'400':
$ref: '#/components/responses/400'
'401':
$ref: '#/components/responses/401'
'403':
$ref: '#/components/responses/403'
'404':
$ref: '#/components/responses/404'
'429':
$ref: '#/components/responses/429'
'500':
$ref: '#/components/responses/500'
security:
- basicAuth: []
x-codeSamples:
- lang: curl
label: cURL
source: "curl -s \\\n\t-X GET \\\n\t--user \"$MJ_APIKEY_PUBLIC:$MJ_APIKEY_PRIVATE\" \\\n\thttps://api.mailjet.com/v3/REST/template/$template_ID \\"
- lang: PHP
label: PHP
source: " 'v3']);\n$response = $mj->get(Resources::$Template, ['id' => $id]);\n$response->success() && var_dump($response->getData());\n?>"
- lang: Node.js
label: Node
source: "const mailjet = require ('node-mailjet')\n\t.connect(process.env.MJ_APIKEY_PUBLIC, process.env.MJ_APIKEY_PRIVATE)\nconst request = mailjet\n\t.get(\"template\", {'version': 'v3'})\n\t.id($template_ID)\n\t.request()\nrequest\n\t.then((result) => {\n\t\tconsole.log(result.body)\n\t})\n\t.catch((err) => {\n\t\tconsole.log(err.statusCode)\n\t})"
- lang: Ruby
label: Ruby
source: "require 'mailjet'\nMailjet.configure do |config|\n config.api_key = ENV['MJ_APIKEY_PUBLIC']\n config.secret_key = ENV['MJ_APIKEY_PRIVATE']\n config.api_version = \"v3\"\nend\nvariable = Mailjet::Template.find($template_ID\n)\np variable.attributes['Data']"
- lang: Python
label: Python
source: "from mailjet_rest import Client\nimport os\napi_key = os.environ['MJ_APIKEY_PUBLIC']\napi_secret = os.environ['MJ_APIKEY_PRIVATE']\nmailjet = Client(auth=(api_key, api_secret), version='v3')\nid = '$template_ID'\nresult = mailjet.template.get(id=id)\nprint result.status_code\nprint result.json()"
- lang: Java
label: Java
source: "package com.my.project;\nimport com.mailjet.client.errors.MailjetException;\nimport com.mailjet.client.errors.MailjetSocketTimeoutException;\nimport com.mailjet.client.MailjetClient;\nimport com.mailjet.client.MailjetRequest;\nimport com.mailjet.client.MailjetResponse;\nimport com.mailjet.client.ClientOptions;\nimport com.mailjet.client.resource.Template;\nimport org.json.JSONArray;\nimport org.json.JSONObject;\npublic class MyClass {\n public static void main(String[] args) throws MailjetException, MailjetSocketTimeoutException {\n MailjetClient client;\n MailjetRequest request;\n MailjetResponse response;\n client = new MailjetClient(System.getenv(\"MJ_APIKEY_PUBLIC\"), System.getenv(\"MJ_APIKEY_PRIVATE\"), new ClientOptions(\"v3\"));\n request = new MailjetRequest(Template.resource, ID);\n response = client.get(request);\n System.out.println(response.getStatus());\n System.out.println(response.getData());\n }\n}"
- lang: Go
label: Go
source: "package main\nimport (\n\t\"fmt\"\n\t\"log\"\n\t\"os\"\n\tmailjet \"github.com/mailjet/mailjet-apiv3-go\"\n\t\"github.com/mailjet/mailjet-apiv3-go/resources\"\n)\nfunc main () {\n\tmailjetClient := NewMailjetClient(os.Getenv(\"MJ_APIKEY_PUBLIC\"), os.Getenv(\"MJ_APIKEY_PRIVATE\"))\n\tvar data []resources.Template\n\tmr := &Request{\n\t Resource: \"template\",\n\t ID: RESOURCE_ID,\n\t}\n\terr := mailjetClient.Get(mr, &data)\n\tif err != nil {\n\t fmt.Println(err)\n\t}\n\tfmt.Printf(\"Data array: %+v\\n\", data)\n}"
- lang: C#
label: C#
source: "using Mailjet.Client;\nusing Mailjet.Client.Resources;\nusing System;\nusing Newtonsoft.Json.Linq;\nnamespace Mailjet.ConsoleApplication\n{\n class Program\n {\n static void Main(string[] args)\n {\n RunAsync().Wait();\n }\n static async Task RunAsync()\n {\n MailjetClient client = new MailjetClient(Environment.GetEnvironmentVariable(\"MJ_APIKEY_PUBLIC\"), Environment.GetEnvironmentVariable(\"MJ_APIKEY_PRIVATE\"))\n {\n Version = ApiVersion.V3,\n };\n MailjetRequest request = new MailjetRequest\n {\n Resource = Template.Resource,\n ResourceId = ResourceId.Numeric(ID)\n }\n MailjetResponse response = await client.GetAsync(request);\n if (response.IsSuccessStatusCode)\n {\n Console.WriteLine(string.Format(\"Total: {0}, Count: {1}\\n\", response.GetTotal(), response.GetCount()));\n Console.WriteLine(response.GetData());\n }\n else\n {\n Console.WriteLine(string.Format(\"StatusCode: {0}\\n\", response.StatusCode));\n Console.WriteLine(string.Format(\"ErrorInfo: {0}\\n\", response.GetErrorInfo()));\n Console.WriteLine(response.GetData());\n Console.WriteLine(string.Format(\"ErrorMessage: {0}\\n\", response.GetErrorMessage()));\n }\n }\n }\n}"
put:
x-seo:
title: "Update Template"
description: "Update Template using the Mailjet Email API. Update the configuration settings of an email template."
tags:
- Templates
summary: Update Template
description: Update the configuration settings of an email template. To obtain a valid `template_ID`, first call `GET /v3/REST/template` to list your templates.
operationId: put_v3_template_id
parameters:
- name: template_ID
in: path
schema:
$ref: '#/components/schemas/put_v3_template_id_PathParams/properties/template_ID'
required: true
example: 3000
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/UpdateTemplate'
example:
Name: Example Template
IsStarred: false
responses:
'200':
description: Default OK response for `/template`
content:
application/json:
schema:
type: object
properties:
Count:
description: Indicates the number of objects in the `Data` array.
type: integer
format: int64
examples:
- 1
Data:
description: A JSON array containing a list of objects returned by this endpoint.
type: array
items:
$ref: '#/components/schemas/OutputTemplate'
Total:
description: Indicates the number of objects in the `Data` array.
type: integer
format: int64
examples:
- 1
'400':
$ref: '#/components/responses/400'
'401':
$ref: '#/components/responses/401'
'403':
$ref: '#/components/responses/403'
'404':
$ref: '#/components/responses/404'
'429':
$ref: '#/components/responses/429'
'500':
$ref: '#/components/responses/500'
security:
- basicAuth: []
x-codeSamples:
- lang: curl
label: cURL
source: "curl -s \\\n\t-X PUT \\\n\t--user \"$MJ_APIKEY_PUBLIC:$MJ_APIKEY_PRIVATE\" \\\n\thttps://api.mailjet.com/v3/REST/template/$template_ID \\\n\t-H 'Content-Type: application/json' \\\n\t-d '{\n \"Author\":\"John Doe\",\n \"Categories\":\"array\",\n \"Copyright\":\"Mailjet\",\n \"Description\":\"Used to send out promo codes.\",\n \"EditMode\":1,\n \"IsStarred\":false,\n \"IsTextPartGenerationEnabled\":true,\n \"Locale\":\"en_US\",\n \"Name\":\"Promo Codes\",\n \"OwnerType\":\"user\",\n \"Presets\":\"string\",\n \"Purposes\":\"array\"\n\t}'"
- lang: PHP
label: PHP
source: " 'v3']);\n$body = [\n 'Author' => \"John Doe\",\n 'Categories' => \"array\",\n 'Copyright' => \"Mailjet\",\n 'Description' => \"Used to send out promo codes.\",\n 'EditMode' => 1,\n 'IsStarred' => false,\n 'IsTextPartGenerationEnabled' => true,\n 'Locale' => \"en_US\",\n 'Name' => \"Promo Codes\",\n 'OwnerType' => \"user\",\n 'Presets' => \"string\",\n 'Purposes' => \"array\"\n];\n$response = $mj->put(Resources::$Template, ['id' => $id, 'body' => $body]);\n$response->success() && var_dump($response->getData());\n?>"
- lang: Node.js
label: Node
source: "const mailjet = require ('node-mailjet')\n\t.connect(process.env.MJ_APIKEY_PUBLIC, process.env.MJ_APIKEY_PRIVATE)\nconst request = mailjet\n\t.put(\"template\", {'version': 'v3'})\n\t.id($template_ID)\n\t.request({\n \"Author\":\"John Doe\",\n \"Categories\":\"array\",\n \"Copyright\":\"Mailjet\",\n \"Description\":\"Used to send out promo codes.\",\n \"EditMode\":1,\n \"IsStarred\":false,\n \"IsTextPartGenerationEnabled\":true,\n \"Locale\":\"en_US\",\n \"Name\":\"Promo Codes\",\n \"OwnerType\":\"user\",\n \"Presets\":\"string\",\n \"Purposes\":\"array\"\n })\nrequest\n\t.then((result) => {\n\t\tconsole.log(result.body)\n\t})\n\t.catch((err) => {\n\t\tconsole.log(err.statusCode)\n\t})"
- lang: Ruby
label: Ruby
source: "require 'mailjet'\nMailjet.configure do |config|\n config.api_key = ENV['MJ_APIKEY_PUBLIC']\n config.secret_key = ENV['MJ_APIKEY_PRIVATE']\n config.api_version = \"v3\"\nend\ntarget = Mailjet::Template.find($template_ID)\ntarget.update_attributes(\n author: \"John Doe\",\n categories: \"array\",\n copyright: \"Mailjet\",\n description: \"Used to send out promo codes.\",\n edit_mode: 1,\n is_starred: false,\n is_text_part_generation_enabled: true,\n locale: \"en_US\",\n name: \"Promo Codes\",\n owner_type: \"user\",\n presets: \"string\",\n purposes: \"array\"\n)\np variable.attributes['Data']"
- lang: Python
label: Python
source: "from mailjet_rest import Client\nimport os\napi_key = os.environ['MJ_APIKEY_PUBLIC']\napi_secret = os.environ['MJ_APIKEY_PRIVATE']\nmailjet = Client(auth=(api_key, api_secret), version='v3')\nid = '$template_ID'\ndata = {\n 'Author': \"John Doe\",\n 'Categories': \"array\",\n 'Copyright': \"Mailjet\",\n 'Description': \"Used to send out promo codes.\",\n 'EditMode': 1,\n 'IsStarred': False,\n 'IsTextPartGenerationEnabled': True,\n 'Locale': \"en_US\",\n 'Name': \"Promo Codes\",\n 'OwnerType': \"user\",\n 'Presets': \"string\",\n 'Purposes': \"array\"\n}\nresult = mailjet.template.update(id=id, data=data)\nprint result.status_code\nprint result.json()"
- lang: Java
label: Java
source: "package com.my.project;\nimport com.mailjet.client.errors.MailjetException;\nimport com.mailjet.client.errors.MailjetSocketTimeoutException;\nimport com.mailjet.client.MailjetClient;\nimport com.mailjet.client.MailjetRequest;\nimport com.mailjet.client.MailjetResponse;\nimport com.mailjet.client.ClientOptions;\nimport com.mailjet.client.resource.Template;\nimport org.json.JSONArray;\nimport org.json.JSONObject;\npublic class MyClass {\n public static void main(String[] args) throws MailjetException, MailjetSocketTimeoutException {\n MailjetClient client;\n MailjetRequest request;\n MailjetResponse response;\n client = new MailjetClient(System.getenv(\"MJ_APIKEY_PUBLIC\"), System.getenv(\"MJ_APIKEY_PRIVATE\"), new ClientOptions(\"v3\"));\n request = new MailjetRequest(Template.resource, ID)\n .property(Template.AUTHOR, \"John Doe\")\n .property(Template.CATEGORIES, \"array\")\n .property(Template.COPYRIGHT, \"Mailjet\")\n .property(Template.DESCRIPTION, \"Used to send out promo codes.\")\n .property(Template.EDITMODE, 1)\n .property(Template.ISSTARRED, false)\n .property(Template.ISTEXTPARTGENERATIONENABLED, true)\n .property(Template.LOCALE, \"en_US\")\n .property(Template.NAME, \"Promo Codes\")\n .property(Template.OWNERTYPE, \"user\")\n .property(Template.PRESETS, \"string\")\n .property(Template.PURPOSES, \"array\")\n );\n response = client.put(request);\n System.out.println(response.getStatus());\n System.out.println(response.getData());\n }\n}"
- lang: Go
label: Go
source: "package main\nimport (\n\t\"fmt\"\n\t\"log\"\n\t\"os\"\n\tmailjet \"github.com/mailjet/mailjet-apiv3-go\"\n\t\"github.com/mailjet/mailjet-apiv3-go/resources\"\n)\nfunc main () {\n\tmailjetClient := NewMailjetClient(os.Getenv(\"MJ_APIKEY_PUBLIC\"), os.Getenv(\"MJ_APIKEY_PRIVATE\"))\n\tmr := &Request{\n\t Resource: \"template\",\n\t ID: RESOURCE_ID,\n\t}\n\tfmr := &FullRequest{\n\t Info: mr,\n\t Payload: &resources.Template { \n\t Author:\"John Doe\",\n\t Categories:\"array\",\n\t Copyright:\"Mailjet\",\n\t Description:\"Used to send out promo codes.\",\n\t EditMode:1,\n\t IsStarred:false,\n\t IsTextPartGenerationEnabled:true,\n\t Locale:\"en_US\",\n\t Name:\"Promo Codes\",\n\t OwnerType:\"user\",\n\t Presets:\"string\",\n\t Purposes:\"array\"\n }\n\t}\n\terr := mailjetClient.Put(fmr)\n\tif err != nil {\n\t fmt.Println(err)\n\t}\n}"
- lang: C#
label: C#
source: "using Mailjet.Client;\nusing Mailjet.Client.Resources;\nusing System;\nusing Newtonsoft.Json.Linq;\nnamespace Mailjet.ConsoleApplication\n{\n class Program\n {\n static void Main(string[] args)\n {\n RunAsync().Wait();\n }\n static async Task RunAsync()\n {\n MailjetClient client = new MailjetClient(Environment.GetEnvironmentVariable(\"MJ_APIKEY_PUBLIC\"), Environment.GetEnvironmentVariable(\"MJ_APIKEY_PRIVATE\"))\n {\n Version = ApiVersion.V3,\n };\n MailjetRequest request = new MailjetRequest\n {\n Resource = Template.Resource,\n ResourceId = ResourceId.Numeric(ID)\n }\n .Property(Template.Author, \"John Doe\")\n .Property(Template.Categories, \"array\")\n .Property(Template.Copyright, \"Mailjet\")\n .Property(Template.Description, \"Used to send out promo codes.\")\n .Property(Template.EditMode, 1)\n .Property(Template.IsStarred, false)\n .Property(Template.IsTextPartGenerationEnabled, true)\n .Property(Template.Locale, \"en_US\")\n .Property(Template.Name, \"Promo Codes\")\n .Property(Template.OwnerType, \"user\")\n .Property(Template.Presets, \"string\")\n .Property(Template.Purposes, \"array\");\n MailjetResponse response = await client.PutAsync(request);\n if (response.IsSuccessStatusCode)\n {\n Console.WriteLine(string.Format(\"Total: {0}, Count: {1}\\n\", response.GetTotal(), response.GetCount()));\n Console.WriteLine(response.GetData());\n }\n else\n {\n Console.WriteLine(string.Format(\"StatusCode: {0}\\n\", response.StatusCode));\n Console.WriteLine(string.Format(\"ErrorInfo: {0}\\n\", response.GetErrorInfo()));\n Console.WriteLine(response.GetData());\n Console.WriteLine(string.Format(\"ErrorMessage: {0}\\n\", response.GetErrorMessage()));\n }\n }\n }\n}"
delete:
x-seo:
title: "Delete Template"
description: "Delete Template using the Mailjet Email API. Delete an email template."
tags:
- Templates
summary: Delete Template
description: Delete an email template.
operationId: delete_v3_template_id
parameters:
- name: template_ID
in: path
schema:
$ref: '#/components/schemas/delete_v3_template_id_PathParams/properties/template_ID'
required: true
responses:
'204':
$ref: '#/components/responses/204'
'400':
$ref: '#/components/responses/400'
'401':
$ref: '#/components/responses/401'
'403':
$ref: '#/components/responses/403'
'404':
$ref: '#/components/responses/404'
'429':
$ref: '#/components/responses/429'
'500':
$ref: '#/components/responses/500'
security:
- basicAuth: []
x-codeSamples:
- lang: curl
label: cURL
source: "curl -s \\\n\t-X DELETE \\\n\t--user \"$MJ_APIKEY_PUBLIC:$MJ_APIKEY_PRIVATE\" \\\n\thttps://api.mailjet.com/v3/REST/template/$template_ID \\\n\t-H 'Content-Type: application/json' \\\n\t-d '{\n\t}'"
- lang: PHP
label: PHP
source: " 'v3']);\n$response = $mj->delete(Resources::$Template, ['id' => $id]);\n$response->success() && var_dump($response->getData());\n?>"
- lang: Node.js
label: Node
source: "const mailjet = require ('node-mailjet')\n\t.connect(process.env.MJ_APIKEY_PUBLIC, process.env.MJ_APIKEY_PRIVATE)\nconst request = mailjet\n\t.delete(\"template\", {'version': 'v3'})\n\t.id($template_ID)\n\t.request()\nrequest\n\t.then((result) => {\n\t\tconsole.log(result.body)\n\t})\n\t.catch((err) => {\n\t\tconsole.log(err.statusCode)\n\t})"
- lang: Ruby
label: Ruby
source: "require 'mailjet'\nMailjet.configure do |config|\n config.api_key = ENV['MJ_APIKEY_PUBLIC']\n config.secret_key = ENV['MJ_APIKEY_PRIVATE']\n config.api_version = \"v3\"\nend\ntarget = Mailjet::Template.find($template_ID)\ntarget.delete(\n)\np variable.attributes['Data']"
- lang: Python
label: Python
source: "from mailjet_rest import Client\nimport os\napi_key = os.environ['MJ_APIKEY_PUBLIC']\napi_secret = os.environ['MJ_APIKEY_PRIVATE']\nmailjet = Client(auth=(api_key, api_secret), version='v3')\nid = '$template_ID'\nresult = mailjet.template.delete(id=id)\nprint result.status_code\nprint result.json()"
- lang: Java
label: Java
source: "package com.my.project;\nimport com.mailjet.client.errors.MailjetException;\nimport com.mailjet.client.errors.MailjetSocketTimeoutException;\nimport com.mailjet.client.MailjetClient;\nimport com.mailjet.client.MailjetRequest;\nimport com.mailjet.client.MailjetResponse;\nimport com.mailjet.client.ClientOptions;\nimport com.mailjet.client.resource.Template;\nimport org.json.JSONArray;\nimport org.json.JSONObject;\npublic class MyClass {\n public static void main(String[] args) throws MailjetException, MailjetSocketTimeoutException {\n MailjetClient client;\n MailjetRequest request;\n MailjetResponse response;\n client = new MailjetClient(System.getenv(\"MJ_APIKEY_PUBLIC\"), System.getenv(\"MJ_APIKEY_PRIVATE\"), new ClientOptions(\"v3\"));\n request = new MailjetRequest(Template.resource, ID);\n response = client.delete(request);\n System.out.println(response.getStatus());\n System.out.println(response.getData());\n }\n}"
- lang: Go
label: Go
source: "package main\nimport (\n\t\"fmt\"\n\t\"log\"\n\t\"os\"\n\tmailjet \"github.com/mailjet/mailjet-apiv3-go\"\n\t\"github.com/mailjet/mailjet-apiv3-go/resources\"\n)\nfunc main () {\n\tmailjetClient := NewMailjetClient(os.Getenv(\"MJ_APIKEY_PUBLIC\"), os.Getenv(\"MJ_APIKEY_PRIVATE\"))\n\tmr := &Request{\n\t Resource: \"template\",\n\t ID: RESOURCE_ID,\n\t}\n\terr := mailjetClient.Delete(mr)\n\tif err != nil {\n\t fmt.Println(err)\n\t}\n}"
- lang: C#
label: C#
source: "using Mailjet.Client;\nusing Mailjet.Client.Resources;\nusing System;\nusing Newtonsoft.Json.Linq;\nnamespace Mailjet.ConsoleApplication\n{\n class Program\n {\n static void Main(string[] args)\n {\n RunAsync().Wait();\n }\n static async Task RunAsync()\n {\n MailjetClient client = new MailjetClient(Environment.GetEnvironmentVariable(\"MJ_APIKEY_PUBLIC\"), Environment.GetEnvironmentVariable(\"MJ_APIKEY_PRIVATE\"))\n {\n Version = ApiVersion.V3,\n };\n MailjetRequest request = new MailjetRequest\n {\n Resource = Template.Resource,\n ResourceId = ResourceId.Numeric(ID)\n }\n MailjetResponse response = await client.DeleteAsync(request);\n if (response.IsSuccessStatusCode)\n {\n Console.WriteLine(string.Format(\"Total: {0}, Count: {1}\\n\", response.GetTotal(), response.GetCount()));\n Console.WriteLine(response.GetData());\n }\n else\n {\n Console.WriteLine(string.Format(\"StatusCode: {0}\\n\", response.StatusCode));\n Console.WriteLine(string.Format(\"ErrorInfo: {0}\\n\", response.GetErrorInfo()));\n Console.WriteLine(response.GetData());\n Console.WriteLine(string.Format(\"ErrorMessage: {0}\\n\", response.GetErrorMessage()));\n }\n }\n }\n}"
/v3/REST/template/{template_ID}/detailcontent:
get:
x-seo:
title: "Get Template: Detail Content"
description: "Retrieve the contents of an email template. It will be split between a Text part, HTML part, MJML content and/or additional headers."
tags:
- Templates
summary: 'Get Template: Detail Content'
description: Retrieve the contents of an email template. It will be split between a Text part, HTML part, MJML content and/or additional headers. To obtain a valid `template_ID`, first call `GET /v3/REST/template` to list your templates.
operationId: get_v3_template_id_detailcontent
parameters:
- name: template_ID
in: path
schema:
$ref: '#/components/schemas/get_v3_template_id_detailcontent_PathParams/properties/template_ID'
required: true
example: 3000
responses:
'200':
description: Default OK response for `/template` action `/detailcontent`
content:
application/json:
schema:
type: object
properties:
Count:
description: Indicates the number of objects in the `Data` array.
type: integer
format: int64
examples:
- 1
Data:
description: A JSON array containing a list of objects returned by this endpoint.
type: array
items:
$ref: '#/components/schemas/OutputTemplateDetailcontent'
Total:
description: Indicates the number of objects in the `Data` array.
type: integer
format: int64
examples:
- 1
'400':
$ref: '#/components/responses/400'
'401':
$ref: '#/components/responses/401'
'403':
$ref: '#/components/responses/403'
'404':
$ref: '#/components/responses/404'
'429':
$ref: '#/components/responses/429'
'500':
$ref: '#/components/responses/500'
security:
- basicAuth: []
x-codeSamples:
- lang: curl
label: cURL
source: "curl -s \\\n\t-X GET \\\n\t--user \"$MJ_APIKEY_PUBLIC:$MJ_APIKEY_PRIVATE\" \\\n\thttps://api.mailjet.com/v3/REST/template/$template_ID/detailcontent \\"
- lang: PHP
label: PHP
source: " 'v3']);\n$response = $mj->get(Resources::$TemplateDetailcontent, ['id' => $id]);\n$response->success() && var_dump($response->getData());\n?>"
- lang: Node.js
label: Node
source: "const mailjet = require ('node-mailjet')\n\t.connect(process.env.MJ_APIKEY_PUBLIC, process.env.MJ_APIKEY_PRIVATE)\nconst request = mailjet\n\t.get(\"template\", {'version': 'v3'})\n\t.id($template_ID)\n\t.action(\"detailcontent\")\n\t.request()\nrequest\n\t.then((result) => {\n\t\tconsole.log(result.body)\n\t})\n\t.catch((err) => {\n\t\tconsole.log(err.statusCode)\n\t})"
- lang: Ruby
label: Ruby
source: "require 'mailjet'\nMailjet.configure do |config|\n config.api_key = ENV['MJ_APIKEY_PUBLIC']\n config.secret_key = ENV['MJ_APIKEY_PRIVATE']\n config.api_version = \"v3\"\nend\nvariable = Mailjet::Template_detailcontent.find($template_ID\n)\np variable.attributes['Data']"
- lang: Python
label: Python
source: "from mailjet_rest import Client\nimport os\napi_key = os.environ['MJ_APIKEY_PUBLIC']\napi_secret = os.environ['MJ_APIKEY_PRIVATE']\nmailjet = Client(auth=(api_key, api_secret), version='v3')\nid = '$template_ID'\nresult = mailjet.template_detailcontent.get(id=id)\nprint result.status_code\nprint result.json()"
- lang: Java
label: Java
source: "package com.my.project;\nimport com.mailjet.client.errors.MailjetException;\nimport com.mailjet.client.errors.MailjetSocketTimeoutException;\nimport com.mailjet.client.MailjetClient;\nimport com.mailjet.client.MailjetRequest;\nimport com.mailjet.client.MailjetResponse;\nimport com.mailjet.client.ClientOptions;\nimport com.mailjet.client.resource.TemplateDetailcontent;\nimport org.json.JSONArray;\nimport org.json.JSONObject;\npublic class MyClass {\n public static void main(String[] args) throws MailjetException, MailjetSocketTimeoutException {\n MailjetClient client;\n MailjetRequest request;\n MailjetResponse response;\n client = new MailjetClient(System.getenv(\"MJ_APIKEY_PUBLIC\"), System.getenv(\"MJ_APIKEY_PRIVATE\"), new ClientOptions(\"v3\"));\n request = new MailjetRequest(TemplateDetailcontent.resource, ID);\n response = client.get(request);\n System.out.println(response.getStatus());\n System.out.println(response.getData());\n }\n}"
- lang: Go
label: Go
source: "package main\nimport (\n\t\"fmt\"\n\t\"log\"\n\t\"os\"\n\tmailjet \"github.com/mailjet/mailjet-apiv3-go\"\n\t\"github.com/mailjet/mailjet-apiv3-go/resources\"\n)\nfunc main () {\n\tmailjetClient := NewMailjetClient(os.Getenv(\"MJ_APIKEY_PUBLIC\"), os.Getenv(\"MJ_APIKEY_PRIVATE\"))\n\tvar data []resources.TemplateDetailcontent\n\tmr := &Request{\n\t Resource: \"template\",\n\t ID: RESOURCE_ID,\n\t Action: \"detailcontent\",\n\t}\n\terr := mailjetClient.Get(mr, &data)\n\tif err != nil {\n\t fmt.Println(err)\n\t}\n\tfmt.Printf(\"Data array: %+v\\n\", data)\n}"
- lang: C#
label: C#
source: "using Mailjet.Client;\nusing Mailjet.Client.Resources;\nusing System;\nusing Newtonsoft.Json.Linq;\nnamespace Mailjet.ConsoleApplication\n{\n class Program\n {\n static void Main(string[] args)\n {\n RunAsync().Wait();\n }\n static async Task RunAsync()\n {\n MailjetClient client = new MailjetClient(Environment.GetEnvironmentVariable(\"MJ_APIKEY_PUBLIC\"), Environment.GetEnvironmentVariable(\"MJ_APIKEY_PRIVATE\"))\n {\n Version = ApiVersion.V3,\n };\n MailjetRequest request = new MailjetRequest\n {\n Resource = TemplateDetailcontent.Resource,\n ResourceId = ResourceId.Numeric(ID)\n }\n MailjetResponse response = await client.GetAsync(request);\n if (response.IsSuccessStatusCode)\n {\n Console.WriteLine(string.Format(\"Total: {0}, Count: {1}\\n\", response.GetTotal(), response.GetCount()));\n Console.WriteLine(response.GetData());\n }\n else\n {\n Console.WriteLine(string.Format(\"StatusCode: {0}\\n\", response.StatusCode));\n Console.WriteLine(string.Format(\"ErrorInfo: {0}\\n\", response.GetErrorInfo()));\n Console.WriteLine(response.GetData());\n Console.WriteLine(string.Format(\"ErrorMessage: {0}\\n\", response.GetErrorMessage()));\n }\n }\n }\n}"
post:
x-seo:
title: "Template: Detail Content"
description: "Create the contents of an email template. You can select a Text part, HTML part, MJML content, as well as additional headers."
tags:
- Templates
summary: 'Template: Detail Content'
description: Create the contents of an email template. You can select a Text part, HTML part, MJML content, as well as additional headers. To obtain a valid `template_ID`, first call `GET /v3/REST/template` to list your templates.
operationId: post_v3_template_id_detailcontent
parameters:
- name: template_ID
in: path
schema:
$ref: '#/components/schemas/post_v3_template_id_detailcontent_PathParams/properties/template_ID'
required: true
example: 3000
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/NewTemplateDetailcontent'
example:
Headers:
From: john@example.com
Subject: Your email flight plan!
Reply-to: copilot@example.com
Html-part: Dear passenger, welcome to Mailjet!
May the delivery force be with you!
Text-part: Dear passenger, welcome to Mailjet! May the delivery force be with you!
responses:
'201':
description: Default OK response for `/template` action `/detailcontent`
content:
application/json:
schema:
type: object
properties:
Count:
description: Indicates the number of objects in the `Data` array.
type: integer
format: int64
examples:
- 1
Data:
description: A JSON array containing a list of objects returned by this endpoint.
type: array
items:
$ref: '#/components/schemas/OutputTemplateDetailcontent'
Total:
description: Indicates the number of objects in the `Data` array.
type: integer
format: int64
examples:
- 1
'400':
$ref: '#/components/responses/400'
'401':
$ref: '#/components/responses/401'
'403':
$ref: '#/components/responses/403'
'404':
$ref: '#/components/responses/404'
'429':
$ref: '#/components/responses/429'
'500':
$ref: '#/components/responses/500'
security:
- basicAuth: []
x-codeSamples:
- lang: curl
label: cURL
source: "curl -s \\\n\t-X POST \\\n\t--user \"$MJ_APIKEY_PUBLIC:$MJ_APIKEY_PRIVATE\" \\\n\thttps://api.mailjet.com/v3/REST/template/$template_ID/detailcontent \\\n\t-H 'Content-Type: application/json' \\\n\t-d '{\n \"Headers\":\"\",\n \"Html-part\":\"Dear passenger, welcome to Mailjet!
May the delivery force be with you!\",\n \"MJMLContent\":\"\",\n \"Text-part\":\"Dear passenger, welcome to Mailjet! May the delivery force be with you!\"\n\t}'"
- lang: PHP
label: PHP
source: " 'v3']);\n$body = [\n 'Headers' => \"\",\n 'Html-part' => \"Dear passenger, welcome to Mailjet!
May the delivery force be with you!\",\n 'MJMLContent' => \"\",\n 'Text-part' => \"Dear passenger, welcome to Mailjet! May the delivery force be with you!\"\n];\n$response = $mj->post(Resources::$TemplateDetailcontent, ['id' => $id, 'body' => $body]);\n$response->success() && var_dump($response->getData());\n?>"
- lang: Node.js
label: Node
source: "const mailjet = require ('node-mailjet')\n\t.connect(process.env.MJ_APIKEY_PUBLIC, process.env.MJ_APIKEY_PRIVATE)\nconst request = mailjet\n\t.post(\"template\", {'version': 'v3'})\n\t.id($template_ID)\n\t.action(\"detailcontent\")\n\t.request({\n \"Headers\":\"\",\n \"Html-part\":\"Dear passenger, welcome to Mailjet!
May the delivery force be with you!\",\n \"MJMLContent\":\"\",\n \"Text-part\":\"Dear passenger, welcome to Mailjet! May the delivery force be with you!\"\n })\nrequest\n\t.then((result) => {\n\t\tconsole.log(result.body)\n\t})\n\t.catch((err) => {\n\t\tconsole.log(err.statusCode)\n\t})"
- lang: Ruby
label: Ruby
source: "require 'mailjet'\nMailjet.configure do |config|\n config.api_key = ENV['MJ_APIKEY_PUBLIC']\n config.secret_key = ENV['MJ_APIKEY_PRIVATE']\n config.api_version = \"v3\"\nend\nvariable = Mailjet::Template_detailcontent.create(id: $template_ID,\n headers: \"\",\n html_part: \"Dear passenger, welcome to Mailjet!
May the delivery force be with you!\",\n mjmlcontent: \"\",\n text_part: \"Dear passenger, welcome to Mailjet! May the delivery force be with you!\"\n)\np variable.attributes['Data']"
- lang: Python
label: Python
source: "from mailjet_rest import Client\nimport os\napi_key = os.environ['MJ_APIKEY_PUBLIC']\napi_secret = os.environ['MJ_APIKEY_PRIVATE']\nmailjet = Client(auth=(api_key, api_secret), version='v3')\nid = '$template_ID'\ndata = {\n 'Headers': \"\",\n 'Html-part': \"Dear passenger, welcome to Mailjet!
May the delivery force be with you!\",\n 'MJMLContent': \"\",\n 'Text-part': \"Dear passenger, welcome to Mailjet! May the delivery force be with you!\"\n}\nresult = mailjet.template_detailcontent.create(id=id, data=data)\nprint result.status_code\nprint result.json()"
- lang: Java
label: Java
source: "package com.my.project;\nimport com.mailjet.client.errors.MailjetException;\nimport com.mailjet.client.errors.MailjetSocketTimeoutException;\nimport com.mailjet.client.MailjetClient;\nimport com.mailjet.client.MailjetRequest;\nimport com.mailjet.client.MailjetResponse;\nimport com.mailjet.client.ClientOptions;\nimport com.mailjet.client.resource.TemplateDetailcontent;\nimport org.json.JSONArray;\nimport org.json.JSONObject;\npublic class MyClass {\n public static void main(String[] args) throws MailjetException, MailjetSocketTimeoutException {\n MailjetClient client;\n MailjetRequest request;\n MailjetResponse response;\n client = new MailjetClient(System.getenv(\"MJ_APIKEY_PUBLIC\"), System.getenv(\"MJ_APIKEY_PRIVATE\"), new ClientOptions(\"v3\"));\n request = new MailjetRequest(TemplateDetailcontent.resource, ID)\n .property(TemplateDetailcontent.HEADERS, )\n .property(TemplateDetailcontent.HTMLPART, \"Dear passenger, welcome to Mailjet!
May the delivery force be with you!\")\n .property(TemplateDetailcontent.MJMLCONTENT, )\n .property(TemplateDetailcontent.TEXTPART, \"Dear passenger, welcome to Mailjet! May the delivery force be with you!\")\n );\n response = client.post(request);\n System.out.println(response.getStatus());\n System.out.println(response.getData());\n }\n}"
- lang: Go
label: Go
source: "package main\nimport (\n\t\"fmt\"\n\t\"log\"\n\t\"os\"\n\tmailjet \"github.com/mailjet/mailjet-apiv3-go\"\n\t\"github.com/mailjet/mailjet-apiv3-go/resources\"\n)\nfunc main () {\n\tmailjetClient := NewMailjetClient(os.Getenv(\"MJ_APIKEY_PUBLIC\"), os.Getenv(\"MJ_APIKEY_PRIVATE\"))\n\tvar data []resources.TemplateDetailcontent\n\tmr := &Request{\n\t Resource: \"template\",\n\t ID: RESOURCE_ID,\n\t Action: \"detailcontent\",\n\t}\n\tfmr := &FullRequest{\n\t Info: mr,\n\t Payload: &resources.TemplateDetailcontent { \n\t Headers:\"\",\n\t Html-part:\"Dear passenger, welcome to Mailjet!
May the delivery force be with you!\",\n\t MJMLContent:\"\",\n\t Text-part:\"Dear passenger, welcome to Mailjet! May the delivery force be with you!\"\n }\n\t}\n\terr := mailjetClient.Post(fmr, &data)\n\tif err != nil {\n\t fmt.Println(err)\n\t}\n\tfmt.Printf(\"Data array: %+v\\n\", data)\n}"
- lang: C#
label: C#
source: "using Mailjet.Client;\nusing Mailjet.Client.Resources;\nusing System;\nusing Newtonsoft.Json.Linq;\nnamespace Mailjet.ConsoleApplication\n{\n class Program\n {\n static void Main(string[] args)\n {\n RunAsync().Wait();\n }\n static async Task RunAsync()\n {\n MailjetClient client = new MailjetClient(Environment.GetEnvironmentVariable(\"MJ_APIKEY_PUBLIC\"), Environment.GetEnvironmentVariable(\"MJ_APIKEY_PRIVATE\"))\n {\n Version = ApiVersion.V3,\n };\n MailjetRequest request = new MailjetRequest\n {\n Resource = TemplateDetailcontent.Resource,\n ResourceId = ResourceId.Numeric(ID)\n }\n .Property(TemplateDetailcontent.Headers, )\n .Property(TemplateDetailcontent.Htmlpart, \"Dear passenger, welcome to Mailjet!
May the delivery force be with you!\")\n .Property(TemplateDetailcontent.MJMLContent, )\n .Property(TemplateDetailcontent.Textpart, \"Dear passenger, welcome to Mailjet! May the delivery force be with you!\");\n MailjetResponse response = await client.PostAsync(request);\n if (response.IsSuccessStatusCode)\n {\n Console.WriteLine(string.Format(\"Total: {0}, Count: {1}\\n\", response.GetTotal(), response.GetCount()));\n Console.WriteLine(response.GetData());\n }\n else\n {\n Console.WriteLine(string.Format(\"StatusCode: {0}\\n\", response.StatusCode));\n Console.WriteLine(string.Format(\"ErrorInfo: {0}\\n\", response.GetErrorInfo()));\n Console.WriteLine(response.GetData());\n Console.WriteLine(string.Format(\"ErrorMessage: {0}\\n\", response.GetErrorMessage()));\n }\n }\n }\n}"
put:
x-seo:
title: "Update Template: Detail Content"
description: "Update the contents of an email template - the Text part, HTML part, MJML content and/or the additional headers."
tags:
- Templates
summary: 'Update Template: Detail Content'
description: Update the contents of an email template - the Text part, HTML part, MJML content and/or the additional headers. To obtain a valid `template_ID`, first call `GET /v3/REST/template` to list your templates.
operationId: put_v3_template_id_detailcontent
parameters:
- name: template_ID
in: path
schema:
$ref: '#/components/schemas/put_v3_template_id_detailcontent_PathParams/properties/template_ID'
required: true
example: 3000
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/NewTemplateDetailcontent'
example:
Headers:
From: john@example.com
Subject: Your email flight plan!
Reply-to: copilot@example.com
Html-part: Dear passenger, welcome to Mailjet!
May the delivery force be with you!
Text-part: Dear passenger, welcome to Mailjet! May the delivery force be with you!
responses:
'201':
description: Default OK response for `/template` action `/detailcontent`
content:
application/json:
schema:
type: object
properties:
Count:
description: Indicates the number of objects in the `Data` array.
type: integer
format: int64
examples:
- 1
Data:
description: A JSON array containing a list of objects returned by this endpoint.
type: array
items:
$ref: '#/components/schemas/OutputTemplateDetailcontent'
Total:
description: Indicates the number of objects in the `Data` array.
type: integer
format: int64
examples:
- 1
'400':
$ref: '#/components/responses/400'
'401':
$ref: '#/components/responses/401'
'403':
$ref: '#/components/responses/403'
'404':
$ref: '#/components/responses/404'
'429':
$ref: '#/components/responses/429'
'500':
$ref: '#/components/responses/500'
security:
- basicAuth: []
x-codeSamples:
- lang: curl
label: cURL
source: "curl -s \\\n\t-X PUT \\\n\t--user \"$MJ_APIKEY_PUBLIC:$MJ_APIKEY_PRIVATE\" \\\n\thttps://api.mailjet.com/v3/REST/template/$template_ID/detailcontent \\\n\t-H 'Content-Type: application/json' \\\n\t-d '{\n \"Headers\":\"\",\n \"Html-part\":\"Dear passenger, welcome to Mailjet!
May the delivery force be with you!\",\n \"MJMLContent\":\"\",\n \"Text-part\":\"Dear passenger, welcome to Mailjet! May the delivery force be with you!\"\n\t}'"
- lang: PHP
label: PHP
source: " 'v3']);\n$body = [\n 'Headers' => \"\",\n 'Html-part' => \"Dear passenger, welcome to Mailjet!
May the delivery force be with you!\",\n 'MJMLContent' => \"\",\n 'Text-part' => \"Dear passenger, welcome to Mailjet! May the delivery force be with you!\"\n];\n$response = $mj->put(Resources::$TemplateDetailcontent, ['id' => $id, 'body' => $body]);\n$response->success() && var_dump($response->getData());\n?>"
- lang: Node.js
label: Node
source: "const mailjet = require ('node-mailjet')\n\t.connect(process.env.MJ_APIKEY_PUBLIC, process.env.MJ_APIKEY_PRIVATE)\nconst request = mailjet\n\t.put(\"template\", {'version': 'v3'})\n\t.id($template_ID)\n\t.action(\"detailcontent\")\n\t.request({\n \"Headers\":\"\",\n \"Html-part\":\"Dear passenger, welcome to Mailjet!
May the delivery force be with you!\",\n \"MJMLContent\":\"\",\n \"Text-part\":\"Dear passenger, welcome to Mailjet! May the delivery force be with you!\"\n })\nrequest\n\t.then((result) => {\n\t\tconsole.log(result.body)\n\t})\n\t.catch((err) => {\n\t\tconsole.log(err.statusCode)\n\t})"
- lang: Ruby
label: Ruby
source: "require 'mailjet'\nMailjet.configure do |config|\n config.api_key = ENV['MJ_APIKEY_PUBLIC']\n config.secret_key = ENV['MJ_APIKEY_PRIVATE']\n config.api_version = \"v3\"\nend\ntarget = Mailjet::Template_detailcontent.find($template_ID)\ntarget.update_attributes(\n headers: \"\",\n html_part: \"Dear passenger, welcome to Mailjet!
May the delivery force be with you!\",\n mjmlcontent: \"\",\n text_part: \"Dear passenger, welcome to Mailjet! May the delivery force be with you!\"\n)\np variable.attributes['Data']"
- lang: Python
label: Python
source: "from mailjet_rest import Client\nimport os\napi_key = os.environ['MJ_APIKEY_PUBLIC']\napi_secret = os.environ['MJ_APIKEY_PRIVATE']\nmailjet = Client(auth=(api_key, api_secret), version='v3')\nid = '$template_ID'\ndata = {\n 'Headers': \"\",\n 'Html-part': \"Dear passenger, welcome to Mailjet!
May the delivery force be with you!\",\n 'MJMLContent': \"\",\n 'Text-part': \"Dear passenger, welcome to Mailjet! May the delivery force be with you!\"\n}\nresult = mailjet.template_detailcontent.update(id=id, data=data)\nprint result.status_code\nprint result.json()"
- lang: Java
label: Java
source: "package com.my.project;\nimport com.mailjet.client.errors.MailjetException;\nimport com.mailjet.client.errors.MailjetSocketTimeoutException;\nimport com.mailjet.client.MailjetClient;\nimport com.mailjet.client.MailjetRequest;\nimport com.mailjet.client.MailjetResponse;\nimport com.mailjet.client.ClientOptions;\nimport com.mailjet.client.resource.TemplateDetailcontent;\nimport org.json.JSONArray;\nimport org.json.JSONObject;\npublic class MyClass {\n public static void main(String[] args) throws MailjetException, MailjetSocketTimeoutException {\n MailjetClient client;\n MailjetRequest request;\n MailjetResponse response;\n client = new MailjetClient(System.getenv(\"MJ_APIKEY_PUBLIC\"), System.getenv(\"MJ_APIKEY_PRIVATE\"), new ClientOptions(\"v3\"));\n request = new MailjetRequest(TemplateDetailcontent.resource, ID)\n .property(TemplateDetailcontent.HEADERS, )\n .property(TemplateDetailcontent.HTMLPART, \"Dear passenger, welcome to Mailjet!
May the delivery force be with you!\")\n .property(TemplateDetailcontent.MJMLCONTENT, )\n .property(TemplateDetailcontent.TEXTPART, \"Dear passenger, welcome to Mailjet! May the delivery force be with you!\")\n );\n response = client.put(request);\n System.out.println(response.getStatus());\n System.out.println(response.getData());\n }\n}"
- lang: Go
label: Go
source: "package main\nimport (\n\t\"fmt\"\n\t\"log\"\n\t\"os\"\n\tmailjet \"github.com/mailjet/mailjet-apiv3-go\"\n\t\"github.com/mailjet/mailjet-apiv3-go/resources\"\n)\nfunc main () {\n\tmailjetClient := NewMailjetClient(os.Getenv(\"MJ_APIKEY_PUBLIC\"), os.Getenv(\"MJ_APIKEY_PRIVATE\"))\n\tmr := &Request{\n\t Resource: \"template\",\n\t ID: RESOURCE_ID,\n\t Action: \"detailcontent\",\n\t}\n\tfmr := &FullRequest{\n\t Info: mr,\n\t Payload: &resources.TemplateDetailcontent { \n\t Headers:\"\",\n\t Html-part:\"Dear passenger, welcome to Mailjet!
May the delivery force be with you!\",\n\t MJMLContent:\"\",\n\t Text-part:\"Dear passenger, welcome to Mailjet! May the delivery force be with you!\"\n }\n\t}\n\terr := mailjetClient.Put(fmr)\n\tif err != nil {\n\t fmt.Println(err)\n\t}\n}"
- lang: C#
label: C#
source: "using Mailjet.Client;\nusing Mailjet.Client.Resources;\nusing System;\nusing Newtonsoft.Json.Linq;\nnamespace Mailjet.ConsoleApplication\n{\n class Program\n {\n static void Main(string[] args)\n {\n RunAsync().Wait();\n }\n static async Task RunAsync()\n {\n MailjetClient client = new MailjetClient(Environment.GetEnvironmentVariable(\"MJ_APIKEY_PUBLIC\"), Environment.GetEnvironmentVariable(\"MJ_APIKEY_PRIVATE\"))\n {\n Version = ApiVersion.V3,\n };\n MailjetRequest request = new MailjetRequest\n {\n Resource = TemplateDetailcontent.Resource,\n ResourceId = ResourceId.Numeric(ID)\n }\n .Property(TemplateDetailcontent.Headers, )\n .Property(TemplateDetailcontent.Htmlpart, \"Dear passenger, welcome to Mailjet!
May the delivery force be with you!\")\n .Property(TemplateDetailcontent.MJMLContent, )\n .Property(TemplateDetailcontent.Textpart, \"Dear passenger, welcome to Mailjet! May the delivery force be with you!\");\n MailjetResponse response = await client.PutAsync(request);\n if (response.IsSuccessStatusCode)\n {\n Console.WriteLine(string.Format(\"Total: {0}, Count: {1}\\n\", response.GetTotal(), response.GetCount()));\n Console.WriteLine(response.GetData());\n }\n else\n {\n Console.WriteLine(string.Format(\"StatusCode: {0}\\n\", response.StatusCode));\n Console.WriteLine(string.Format(\"ErrorInfo: {0}\\n\", response.GetErrorInfo()));\n Console.WriteLine(response.GetData());\n Console.WriteLine(string.Format(\"ErrorMessage: {0}\\n\", response.GetErrorMessage()));\n }\n }\n }\n}"
"/v3/REST/campaigndraft":
get:
x-seo:
title: "Campaign Draft List"
description: "Retrieve details on the configuration of all campaign drafts. Newsletter and CampaignDraft objects are differentiated by the EditMode values. We\u2026"
tags:
- Campaigns
summary: Campaign Draft List
description: Retrieve details on the configuration of all campaign drafts. Newsletter and CampaignDraft objects are differentiated by the `EditMode` values. We recommend using `CampaignDraft`, as `Newsletter` objects are ones created using the legacy Mailjet template builder.
operationId: get_v3_campaigndraft
parameters:
- name: AXTesting
in: query
schema:
$ref: '#/components/schemas/get_v3_campaigndraft_QueryParams/properties/AXTesting'
- name: Campaign
in: query
schema:
$ref: '#/components/schemas/get_v3_campaigndraft_QueryParams/properties/Campaign'
- name: ContactsList
in: query
schema:
$ref: '#/components/schemas/get_v3_campaigndraft_QueryParams/properties/ContactsList'
- name: DeliveredAt
in: query
schema:
$ref: '#/components/schemas/get_v3_campaigndraft_QueryParams/properties/DeliveredAt'
- name: EditMode
in: query
schema:
$ref: '#/components/schemas/get_v3_campaigndraft_QueryParams/properties/EditMode'
- name: IsArchived
in: query
schema:
$ref: '#/components/schemas/get_v3_campaigndraft_QueryParams/properties/IsArchived'
- name: IsCampaign
in: query
schema:
$ref: '#/components/schemas/get_v3_campaigndraft_QueryParams/properties/IsCampaign'
- name: IsDeleted
in: query
schema:
$ref: '#/components/schemas/get_v3_campaigndraft_QueryParams/properties/IsDeleted'
- name: IsHandled
in: query
schema:
$ref: '#/components/schemas/get_v3_campaigndraft_QueryParams/properties/IsHandled'
- name: IsStarred
in: query
schema:
$ref: '#/components/schemas/get_v3_campaigndraft_QueryParams/properties/IsStarred'
- name: Modified
in: query
schema:
$ref: '#/components/schemas/get_v3_campaigndraft_QueryParams/properties/Modified'
- name: NewsLetterTemplate
in: query
schema:
$ref: '#/components/schemas/get_v3_campaigndraft_QueryParams/properties/NewsLetterTemplate'
- name: Segmentation
in: query
schema:
$ref: '#/components/schemas/get_v3_campaigndraft_QueryParams/properties/Segmentation'
- name: Status
in: query
schema:
$ref: '#/components/schemas/get_v3_campaigndraft_QueryParams/properties/Status'
- name: Subject
in: query
schema:
$ref: '#/components/schemas/get_v3_campaigndraft_QueryParams/properties/Subject'
- name: Template
in: query
schema:
$ref: '#/components/schemas/get_v3_campaigndraft_QueryParams/properties/Template'
responses:
'200':
description: Default response OK for `/campaigndraft`
content:
application/json:
schema:
type: object
properties:
Count:
description: Indicates the number of objects in the `Data` array.
type: integer
format: int64
examples:
- 1
Data:
description: A JSON array containing a list of objects returned by this endpoint.
type: array
items:
$ref: '#/components/schemas/OutputCampaigndraft'
Total:
description: Indicates the number of objects in the `Data` array.
type: integer
format: int64
examples:
- 1
'400':
$ref: '#/components/responses/400'
'401':
$ref: '#/components/responses/401'
'403':
$ref: '#/components/responses/403'
'404':
$ref: '#/components/responses/404'
'429':
$ref: '#/components/responses/429'
'500':
$ref: '#/components/responses/500'
security:
- basicAuth: []
x-codeSamples:
- lang: curl
label: cURL
source: "curl -s \\\n\t-X GET \\\n\t--user \"$MJ_APIKEY_PUBLIC:$MJ_APIKEY_PRIVATE\" \\\n\thttps://api.mailjet.com/v3/REST/campaigndraft \\"
- lang: PHP
label: PHP
source: " 'v3']);\n$response = $mj->get(Resources::$Campaigndraft);\n$response->success() && var_dump($response->getData());\n?>"
- lang: Node.js
label: Node
source: "const mailjet = require ('node-mailjet')\n\t.connect(process.env.MJ_APIKEY_PUBLIC, process.env.MJ_APIKEY_PRIVATE)\nconst request = mailjet\n\t.get(\"campaigndraft\", {'version': 'v3'})\n\t.request()\nrequest\n\t.then((result) => {\n\t\tconsole.log(result.body)\n\t})\n\t.catch((err) => {\n\t\tconsole.log(err.statusCode)\n\t})"
- lang: Ruby
label: Ruby
source: "require 'mailjet'\nMailjet.configure do |config|\n config.api_key = ENV['MJ_APIKEY_PUBLIC']\n config.secret_key = ENV['MJ_APIKEY_PRIVATE']\n config.api_version = \"v3\"\nend\nvariable = Mailjet::Campaigndraft.all(\n)\np variable.attributes['Data']"
- lang: Python
label: Python
source: "from mailjet_rest import Client\nimport os\napi_key = os.environ['MJ_APIKEY_PUBLIC']\napi_secret = os.environ['MJ_APIKEY_PRIVATE']\nmailjet = Client(auth=(api_key, api_secret), version='v3')\nresult = mailjet.campaigndraft.get()\nprint result.status_code\nprint result.json()"
- lang: Java
label: Java
source: "package com.my.project;\nimport com.mailjet.client.errors.MailjetException;\nimport com.mailjet.client.errors.MailjetSocketTimeoutException;\nimport com.mailjet.client.MailjetClient;\nimport com.mailjet.client.MailjetRequest;\nimport com.mailjet.client.MailjetResponse;\nimport com.mailjet.client.ClientOptions;\nimport com.mailjet.client.resource.Campaigndraft;\nimport org.json.JSONArray;\nimport org.json.JSONObject;\npublic class MyClass {\n public static void main(String[] args) throws MailjetException, MailjetSocketTimeoutException {\n MailjetClient client;\n MailjetRequest request;\n MailjetResponse response;\n client = new MailjetClient(System.getenv(\"MJ_APIKEY_PUBLIC\"), System.getenv(\"MJ_APIKEY_PRIVATE\"), new ClientOptions(\"v3\"));\n request = new MailjetRequest(Campaigndraft.resource);\n response = client.get(request);\n System.out.println(response.getStatus());\n System.out.println(response.getData());\n }\n}"
- lang: Go
label: Go
source: "package main\nimport (\n\t\"fmt\"\n\t\"log\"\n\t\"os\"\n\tmailjet \"github.com/mailjet/mailjet-apiv3-go\"\n\t\"github.com/mailjet/mailjet-apiv3-go/resources\"\n)\nfunc main () {\n\tmailjetClient := NewMailjetClient(os.Getenv(\"MJ_APIKEY_PUBLIC\"), os.Getenv(\"MJ_APIKEY_PRIVATE\"))\n\tvar data []resources.Campaigndraft\n\t_, _, err := mailjetClient.List(\"campaigndraft\", &data)\n\tif err != nil {\n\t fmt.Println(err)\n\t}\n\tfmt.Printf(\"Data array: %+v\\n\", data)\n}"
- lang: C#
label: C#
source: "using Mailjet.Client;\nusing Mailjet.Client.Resources;\nusing System;\nusing Newtonsoft.Json.Linq;\nnamespace Mailjet.ConsoleApplication\n{\n class Program\n {\n static void Main(string[] args)\n {\n RunAsync().Wait();\n }\n static async Task RunAsync()\n {\n MailjetClient client = new MailjetClient(Environment.GetEnvironmentVariable(\"MJ_APIKEY_PUBLIC\"), Environment.GetEnvironmentVariable(\"MJ_APIKEY_PRIVATE\"))\n {\n Version = ApiVersion.V3,\n };\n MailjetRequest request = new MailjetRequest\n {\n Resource = Campaigndraft.Resource,\n }\n MailjetResponse response = await client.GetAsync(request);\n if (response.IsSuccessStatusCode)\n {\n Console.WriteLine(string.Format(\"Total: {0}, Count: {1}\\n\", response.GetTotal(), response.GetCount()));\n Console.WriteLine(response.GetData());\n }\n else\n {\n Console.WriteLine(string.Format(\"StatusCode: {0}\\n\", response.StatusCode));\n Console.WriteLine(string.Format(\"ErrorInfo: {0}\\n\", response.GetErrorInfo()));\n Console.WriteLine(response.GetData());\n Console.WriteLine(string.Format(\"ErrorMessage: {0}\\n\", response.GetErrorMessage()));\n }\n }\n }\n}"
post:
x-seo:
title: "Create Campaign Draft"
description: "Create a new campaign draft. Newsletter and CampaignDraft objects are differentiated by the EditMode values - we recommend using CampaignDraft , as\u2026"
tags:
- Campaigns
summary: Create Campaign Draft
description: Create a new campaign draft. `Newsletter` and `CampaignDraft` objects are differentiated by the EditMode values - we recommend using `CampaignDraft`, as `Newsletter` objects are ones created using the legacy Mailjet template builder.
operationId: post_v3_campaigndraft
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/NewCampaigndraft'
example:
Locale: en_US
Subject: Your email flight plan!
Title: Example Campaign
SenderEmail: no-reply@example.com
SenderName: Example Sender
responses:
'201':
description: Default OK response for `/campaigndraft`
content:
application/json:
schema:
type: object
properties:
Count:
description: Indicates the number of objects in the `Data` array.
type: integer
format: int64
examples:
- 1
Data:
description: A JSON array containing a list of objects returned by this endpoint.
type: array
items:
$ref: '#/components/schemas/OutputCampaigndraft'
Total:
description: Indicates the number of objects in the `Data` array.
type: integer
format: int64
examples:
- 1
'400':
$ref: '#/components/responses/400'
'401':
$ref: '#/components/responses/401'
'403':
$ref: '#/components/responses/403'
'404':
$ref: '#/components/responses/404'
'429':
$ref: '#/components/responses/429'
'500':
$ref: '#/components/responses/500'
security:
- basicAuth: []
x-codeSamples:
- lang: curl
label: cURL
source: "curl -s \\\n\t-X POST \\\n\t--user \"$MJ_APIKEY_PUBLIC:$MJ_APIKEY_PRIVATE\" \\\n\thttps://api.mailjet.com/v3/REST/campaigndraft \\\n\t-H 'Content-Type: application/json' \\\n\t-d '{\n \"AXFraction\":0,\n \"AXFractionName\":\"Version A\",\n \"AXTesting\":\"123456\",\n \"EditMode\":\"tool2\",\n \"IsStarred\":false,\n \"IsTextPartIncluded\":true,\n \"ReplyEmail\":\"replyto@mailjet.com\",\n \"SenderName\":\"Your Mailjet Pilot\",\n \"TemplateID\":123456,\n \"Title\":\"My Mailjet Campaign\",\n \"ContactsListID\":123456,\n \"ContactsListAlt\":\"abcdef123\",\n \"Locale\":\"en_US\",\n \"SegmentationID\":123,\n \"SegmentationAlt\":\"Customers under 35\",\n \"Sender\":\"1234\",\n \"SenderEmail\":\"pilot@mailjet.com\",\n \"Subject\":\"Your email flight plan!\"\n\t}'"
- lang: PHP
label: PHP
source: " 'v3']);\n$body = [\n 'AXFraction' => 0,\n 'AXFractionName' => \"Version A\",\n 'AXTesting' => \"123456\",\n 'EditMode' => \"tool2\",\n 'IsStarred' => false,\n 'IsTextPartIncluded' => true,\n 'ReplyEmail' => \"replyto@mailjet.com\",\n 'SenderName' => \"Your Mailjet Pilot\",\n 'TemplateID' => 123456,\n 'Title' => \"My Mailjet Campaign\",\n 'ContactsListID' => 123456,\n 'ContactsListAlt' => \"abcdef123\",\n 'Locale' => \"en_US\",\n 'SegmentationID' => 123,\n 'SegmentationAlt' => \"Customers under 35\",\n 'Sender' => \"1234\",\n 'SenderEmail' => \"pilot@mailjet.com\",\n 'Subject' => \"Your email flight plan!\"\n];\n$response = $mj->post(Resources::$Campaigndraft, ['body' => $body]);\n$response->success() && var_dump($response->getData());\n?>"
- lang: Node.js
label: Node
source: "const mailjet = require ('node-mailjet')\n\t.connect(process.env.MJ_APIKEY_PUBLIC, process.env.MJ_APIKEY_PRIVATE)\nconst request = mailjet\n\t.post(\"campaigndraft\", {'version': 'v3'})\n\t.request({\n \"AXFraction\":0,\n \"AXFractionName\":\"Version A\",\n \"AXTesting\":\"123456\",\n \"EditMode\":\"tool2\",\n \"IsStarred\":false,\n \"IsTextPartIncluded\":true,\n \"ReplyEmail\":\"replyto@mailjet.com\",\n \"SenderName\":\"Your Mailjet Pilot\",\n \"TemplateID\":123456,\n \"Title\":\"My Mailjet Campaign\",\n \"ContactsListID\":123456,\n \"ContactsListAlt\":\"abcdef123\",\n \"Locale\":\"en_US\",\n \"SegmentationID\":123,\n \"SegmentationAlt\":\"Customers under 35\",\n \"Sender\":\"1234\",\n \"SenderEmail\":\"pilot@mailjet.com\",\n \"Subject\":\"Your email flight plan!\"\n })\nrequest\n\t.then((result) => {\n\t\tconsole.log(result.body)\n\t})\n\t.catch((err) => {\n\t\tconsole.log(err.statusCode)\n\t})"
- lang: Ruby
label: Ruby
source: "require 'mailjet'\nMailjet.configure do |config|\n config.api_key = ENV['MJ_APIKEY_PUBLIC']\n config.secret_key = ENV['MJ_APIKEY_PRIVATE']\n config.api_version = \"v3\"\nend\nvariable = Mailjet::Campaigndraft.create(\n axfraction: 0,\n axfraction_name: \"Version A\",\n axtesting: \"123456\",\n edit_mode: \"tool2\",\n is_starred: false,\n is_text_part_included: true,\n reply_email: \"replyto@mailjet.com\",\n sender_name: \"Your Mailjet Pilot\",\n template_id: 123456,\n title: \"My Mailjet Campaign\",\n contacts_list_id: 123456,\n contacts_list_alt: \"abcdef123\",\n locale: \"en_US\",\n segmentation_id: 123,\n segmentation_alt: \"Customers under 35\",\n sender: \"1234\",\n sender_email: \"pilot@mailjet.com\",\n subject: \"Your email flight plan!\"\n)\np variable.attributes['Data']"
- lang: Python
label: Python
source: "from mailjet_rest import Client\nimport os\napi_key = os.environ['MJ_APIKEY_PUBLIC']\napi_secret = os.environ['MJ_APIKEY_PRIVATE']\nmailjet = Client(auth=(api_key, api_secret), version='v3')\ndata = {\n 'AXFraction': 0,\n 'AXFractionName': \"Version A\",\n 'AXTesting': \"123456\",\n 'EditMode': \"tool2\",\n 'IsStarred': False,\n 'IsTextPartIncluded': True,\n 'ReplyEmail': \"replyto@mailjet.com\",\n 'SenderName': \"Your Mailjet Pilot\",\n 'TemplateID': 123456,\n 'Title': \"My Mailjet Campaign\",\n 'ContactsListID': 123456,\n 'ContactsListAlt': \"abcdef123\",\n 'Locale': \"en_US\",\n 'SegmentationID': 123,\n 'SegmentationAlt': \"Customers under 35\",\n 'Sender': \"1234\",\n 'SenderEmail': \"pilot@mailjet.com\",\n 'Subject': \"Your email flight plan!\"\n}\nresult = mailjet.campaigndraft.create(data=data)\nprint result.status_code\nprint result.json()"
- lang: Java
label: Java
source: "package com.my.project;\nimport com.mailjet.client.errors.MailjetException;\nimport com.mailjet.client.errors.MailjetSocketTimeoutException;\nimport com.mailjet.client.MailjetClient;\nimport com.mailjet.client.MailjetRequest;\nimport com.mailjet.client.MailjetResponse;\nimport com.mailjet.client.ClientOptions;\nimport com.mailjet.client.resource.Campaigndraft;\nimport org.json.JSONArray;\nimport org.json.JSONObject;\npublic class MyClass {\n public static void main(String[] args) throws MailjetException, MailjetSocketTimeoutException {\n MailjetClient client;\n MailjetRequest request;\n MailjetResponse response;\n client = new MailjetClient(System.getenv(\"MJ_APIKEY_PUBLIC\"), System.getenv(\"MJ_APIKEY_PRIVATE\"), new ClientOptions(\"v3\"));\n request = new MailjetRequest(Campaigndraft.resource)\n .property(Campaigndraft.AXFRACTION, 0)\n .property(Campaigndraft.AXFRACTIONNAME, \"Version A\")\n .property(Campaigndraft.AXTESTING, \"123456\")\n .property(Campaigndraft.EDITMODE, \"tool2\")\n .property(Campaigndraft.ISSTARRED, false)\n .property(Campaigndraft.ISTEXTPARTINCLUDED, true)\n .property(Campaigndraft.REPLYEMAIL, \"replyto@mailjet.com\")\n .property(Campaigndraft.SENDERNAME, \"Your Mailjet Pilot\")\n .property(Campaigndraft.TEMPLATEID, 123456)\n .property(Campaigndraft.TITLE, \"My Mailjet Campaign\")\n .property(Campaigndraft.CONTACTSLISTID, 123456)\n .property(Campaigndraft.CONTACTSLISTALT, \"abcdef123\")\n .property(Campaigndraft.LOCALE, \"en_US\")\n .property(Campaigndraft.SEGMENTATIONID, 123)\n .property(Campaigndraft.SEGMENTATIONALT, \"Customers under 35\")\n .property(Campaigndraft.SENDER, \"1234\")\n .property(Campaigndraft.SENDEREMAIL, \"pilot@mailjet.com\")\n .property(Campaigndraft.SUBJECT, \"Your email flight plan!\")\n );\n response = client.post(request);\n System.out.println(response.getStatus());\n System.out.println(response.getData());\n }\n}"
- lang: Go
label: Go
source: "package main\nimport (\n\t\"fmt\"\n\t\"log\"\n\t\"os\"\n\tmailjet \"github.com/mailjet/mailjet-apiv3-go\"\n\t\"github.com/mailjet/mailjet-apiv3-go/resources\"\n)\nfunc main () {\n\tmailjetClient := NewMailjetClient(os.Getenv(\"MJ_APIKEY_PUBLIC\"), os.Getenv(\"MJ_APIKEY_PRIVATE\"))\n\tvar data []resources.Campaigndraft\n\tmr := &Request{\n\t Resource: \"campaigndraft\",\n\t}\n\tfmr := &FullRequest{\n\t Info: mr,\n\t Payload: &resources.Campaigndraft { \n\t AXFraction:0,\n\t AXFractionName:\"Version A\",\n\t AXTesting:\"123456\",\n\t EditMode:\"tool2\",\n\t IsStarred:false,\n\t IsTextPartIncluded:true,\n\t ReplyEmail:\"replyto@mailjet.com\",\n\t SenderName:\"Your Mailjet Pilot\",\n\t TemplateID:123456,\n\t Title:\"My Mailjet Campaign\",\n\t ContactsListID:123456,\n\t ContactsListAlt:\"abcdef123\",\n\t Locale:\"en_US\",\n\t SegmentationID:123,\n\t SegmentationAlt:\"Customers under 35\",\n\t Sender:\"1234\",\n\t SenderEmail:\"pilot@mailjet.com\",\n\t Subject:\"Your email flight plan!\"\n }\n\t}\n\terr := mailjetClient.Post(fmr, &data)\n\tif err != nil {\n\t fmt.Println(err)\n\t}\n\tfmt.Printf(\"Data array: %+v\\n\", data)\n}"
- lang: C#
label: C#
source: "using Mailjet.Client;\nusing Mailjet.Client.Resources;\nusing System;\nusing Newtonsoft.Json.Linq;\nnamespace Mailjet.ConsoleApplication\n{\n class Program\n {\n static void Main(string[] args)\n {\n RunAsync().Wait();\n }\n static async Task RunAsync()\n {\n MailjetClient client = new MailjetClient(Environment.GetEnvironmentVariable(\"MJ_APIKEY_PUBLIC\"), Environment.GetEnvironmentVariable(\"MJ_APIKEY_PRIVATE\"))\n {\n Version = ApiVersion.V3,\n };\n MailjetRequest request = new MailjetRequest\n {\n Resource = Campaigndraft.Resource,\n }\n .Property(Campaigndraft.AXFraction, 0)\n .Property(Campaigndraft.AXFractionName, \"Version A\")\n .Property(Campaigndraft.AXTesting, \"123456\")\n .Property(Campaigndraft.EditMode, \"tool2\")\n .Property(Campaigndraft.IsStarred, false)\n .Property(Campaigndraft.IsTextPartIncluded, true)\n .Property(Campaigndraft.ReplyEmail, \"replyto@mailjet.com\")\n .Property(Campaigndraft.SenderName, \"Your Mailjet Pilot\")\n .Property(Campaigndraft.TemplateID, 123456)\n .Property(Campaigndraft.Title, \"My Mailjet Campaign\")\n .Property(Campaigndraft.ContactsListID, 123456)\n .Property(Campaigndraft.ContactsListAlt, \"abcdef123\")\n .Property(Campaigndraft.Locale, \"en_US\")\n .Property(Campaigndraft.SegmentationID, 123)\n .Property(Campaigndraft.SegmentationAlt, \"Customers under 35\")\n .Property(Campaigndraft.Sender, \"1234\")\n .Property(Campaigndraft.SenderEmail, \"pilot@mailjet.com\")\n .Property(Campaigndraft.Subject, \"Your email flight plan!\");\n MailjetResponse response = await client.PostAsync(request);\n if (response.IsSuccessStatusCode)\n {\n Console.WriteLine(string.Format(\"Total: {0}, Count: {1}\\n\", response.GetTotal(), response.GetCount()));\n Console.WriteLine(response.GetData());\n }\n else\n {\n Console.WriteLine(string.Format(\"StatusCode: {0}\\n\", response.StatusCode));\n Console.WriteLine(string.Format(\"ErrorInfo: {0}\\n\", response.GetErrorInfo()));\n Console.WriteLine(response.GetData());\n Console.WriteLine(string.Format(\"ErrorMessage: {0}\\n\", response.GetErrorMessage()));\n }\n }\n }\n}"
/v3/REST/campaigndraft/{draft_ID}:
get:
x-seo:
title: "Campaign Draft by ID"
description: "Retrieve details on the configuration of a specific campaign draft. Newsletter and CampaignDraft objects are differentiated by the EditMode values - we\u2026"
tags:
- Campaigns
summary: Campaign Draft by ID
description: Retrieve details on the configuration of a specific campaign draft. `Newsletter` and `CampaignDraft` objects are differentiated by the EditMode values - we recommend using `CampaignDraft`, as `Newsletter` objects are ones created using the legacy Mailjet template builder. To obtain a valid `draft_ID`, first call `GET /v3/REST/campaigndraft` to list your campaign drafts.
operationId: get_v3_campaigndraft_id
parameters:
- name: draft_ID
in: path
schema:
$ref: '#/components/schemas/get_v3_campaigndraft_id_PathParams/properties/draft_ID'
required: true
example: 4000
responses:
'200':
description: Default response OK for `/campaigndraft`
content:
application/json:
schema:
type: object
properties:
Count:
description: Indicates the number of objects in the `Data` array.
type: integer
format: int64
examples:
- 1
Data:
description: A JSON array containing a list of objects returned by this endpoint.
type: array
items:
$ref: '#/components/schemas/OutputCampaigndraft'
Total:
description: Indicates the number of objects in the `Data` array.
type: integer
format: int64
examples:
- 1
'400':
$ref: '#/components/responses/400'
'401':
$ref: '#/components/responses/401'
'403':
$ref: '#/components/responses/403'
'404':
$ref: '#/components/responses/404'
'429':
$ref: '#/components/responses/429'
'500':
$ref: '#/components/responses/500'
security:
- basicAuth: []
x-codeSamples:
- lang: curl
label: cURL
source: "curl -s \\\n\t-X GET \\\n\t--user \"$MJ_APIKEY_PUBLIC:$MJ_APIKEY_PRIVATE\" \\\n\thttps://api.mailjet.com/v3/REST/campaigndraft/$draft_ID \\"
- lang: PHP
label: PHP
source: " 'v3']);\n$response = $mj->get(Resources::$Campaigndraft, ['id' => $id]);\n$response->success() && var_dump($response->getData());\n?>"
- lang: Node.js
label: Node
source: "const mailjet = require ('node-mailjet')\n\t.connect(process.env.MJ_APIKEY_PUBLIC, process.env.MJ_APIKEY_PRIVATE)\nconst request = mailjet\n\t.get(\"campaigndraft\", {'version': 'v3'})\n\t.id($draft_ID)\n\t.request()\nrequest\n\t.then((result) => {\n\t\tconsole.log(result.body)\n\t})\n\t.catch((err) => {\n\t\tconsole.log(err.statusCode)\n\t})"
- lang: Ruby
label: Ruby
source: "require 'mailjet'\nMailjet.configure do |config|\n config.api_key = ENV['MJ_APIKEY_PUBLIC']\n config.secret_key = ENV['MJ_APIKEY_PRIVATE']\n config.api_version = \"v3\"\nend\nvariable = Mailjet::Campaigndraft.find($draft_ID\n)\np variable.attributes['Data']"
- lang: Python
label: Python
source: "from mailjet_rest import Client\nimport os\napi_key = os.environ['MJ_APIKEY_PUBLIC']\napi_secret = os.environ['MJ_APIKEY_PRIVATE']\nmailjet = Client(auth=(api_key, api_secret), version='v3')\nid = '$draft_ID'\nresult = mailjet.campaigndraft.get(id=id)\nprint result.status_code\nprint result.json()"
- lang: Java
label: Java
source: "package com.my.project;\nimport com.mailjet.client.errors.MailjetException;\nimport com.mailjet.client.errors.MailjetSocketTimeoutException;\nimport com.mailjet.client.MailjetClient;\nimport com.mailjet.client.MailjetRequest;\nimport com.mailjet.client.MailjetResponse;\nimport com.mailjet.client.ClientOptions;\nimport com.mailjet.client.resource.Campaigndraft;\nimport org.json.JSONArray;\nimport org.json.JSONObject;\npublic class MyClass {\n public static void main(String[] args) throws MailjetException, MailjetSocketTimeoutException {\n MailjetClient client;\n MailjetRequest request;\n MailjetResponse response;\n client = new MailjetClient(System.getenv(\"MJ_APIKEY_PUBLIC\"), System.getenv(\"MJ_APIKEY_PRIVATE\"), new ClientOptions(\"v3\"));\n request = new MailjetRequest(Campaigndraft.resource, ID);\n response = client.get(request);\n System.out.println(response.getStatus());\n System.out.println(response.getData());\n }\n}"
- lang: Go
label: Go
source: "package main\nimport (\n\t\"fmt\"\n\t\"log\"\n\t\"os\"\n\tmailjet \"github.com/mailjet/mailjet-apiv3-go\"\n\t\"github.com/mailjet/mailjet-apiv3-go/resources\"\n)\nfunc main () {\n\tmailjetClient := NewMailjetClient(os.Getenv(\"MJ_APIKEY_PUBLIC\"), os.Getenv(\"MJ_APIKEY_PRIVATE\"))\n\tvar data []resources.Campaigndraft\n\tmr := &Request{\n\t Resource: \"campaigndraft\",\n\t ID: RESOURCE_ID,\n\t}\n\terr := mailjetClient.Get(mr, &data)\n\tif err != nil {\n\t fmt.Println(err)\n\t}\n\tfmt.Printf(\"Data array: %+v\\n\", data)\n}"
- lang: C#
label: C#
source: "using Mailjet.Client;\nusing Mailjet.Client.Resources;\nusing System;\nusing Newtonsoft.Json.Linq;\nnamespace Mailjet.ConsoleApplication\n{\n class Program\n {\n static void Main(string[] args)\n {\n RunAsync().Wait();\n }\n static async Task RunAsync()\n {\n MailjetClient client = new MailjetClient(Environment.GetEnvironmentVariable(\"MJ_APIKEY_PUBLIC\"), Environment.GetEnvironmentVariable(\"MJ_APIKEY_PRIVATE\"))\n {\n Version = ApiVersion.V3,\n };\n MailjetRequest request = new MailjetRequest\n {\n Resource = Campaigndraft.Resource,\n ResourceId = ResourceId.Numeric(ID)\n }\n MailjetResponse response = await client.GetAsync(request);\n if (response.IsSuccessStatusCode)\n {\n Console.WriteLine(string.Format(\"Total: {0}, Count: {1}\\n\", response.GetTotal(), response.GetCount()));\n Console.WriteLine(response.GetData());\n }\n else\n {\n Console.WriteLine(string.Format(\"StatusCode: {0}\\n\", response.StatusCode));\n Console.WriteLine(string.Format(\"ErrorInfo: {0}\\n\", response.GetErrorInfo()));\n Console.WriteLine(response.GetData());\n Console.WriteLine(string.Format(\"ErrorMessage: {0}\\n\", response.GetErrorMessage()));\n }\n }\n }\n}"
put:
x-seo:
title: "Update Campaign Draft"
description: "Update the configuration settings of a specific campaign draft. Newsletter and CampaignDraft objects are differentiated by the EditMode values - we\u2026"
tags:
- Campaigns
summary: Update Campaign Draft
description: Update the configuration settings of a specific campaign draft. `Newsletter` and `CampaignDraft` objects are differentiated by the EditMode values - we recommend using `CampaignDraft`, as `Newsletter` objects are ones created using the legacy Mailjet template builder. To obtain a valid `draft_ID`, first call `GET /v3/REST/campaigndraft` to list your campaign drafts.
operationId: put_v3_campaigndraft_id
parameters:
- name: draft_ID
in: path
schema:
$ref: '#/components/schemas/put_v3_campaigndraft_id_PathParams/properties/draft_ID'
required: true
example: 4000
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/UpdateCampaigndraft'
example:
Subject: Your email flight plan!
Title: Example Campaign
SenderEmail: no-reply@example.com
responses:
'200':
description: Default OK response for `/campaigndraft`
content:
application/json:
schema:
type: object
properties:
Count:
description: Indicates the number of objects in the `Data` array.
type: integer
format: int64
examples:
- 1
Data:
description: A JSON array containing a list of objects returned by this endpoint.
type: array
items:
$ref: '#/components/schemas/OutputCampaigndraft'
Total:
description: Indicates the number of objects in the `Data` array.
type: integer
format: int64
examples:
- 1
'400':
$ref: '#/components/responses/400'
'401':
$ref: '#/components/responses/401'
'403':
$ref: '#/components/responses/403'
'404':
$ref: '#/components/responses/404'
'429':
$ref: '#/components/responses/429'
'500':
$ref: '#/components/responses/500'
security:
- basicAuth: []
x-codeSamples:
- lang: curl
label: cURL
source: "curl -s \\\n\t-X PUT \\\n\t--user \"$MJ_APIKEY_PUBLIC:$MJ_APIKEY_PRIVATE\" \\\n\thttps://api.mailjet.com/v3/REST/campaigndraft/$draft_ID \\\n\t-H 'Content-Type: application/json' \\\n\t-d '{\n \"AXFraction\":0,\n \"AXFractionName\":\"Version A\",\n \"AXTesting\":\"123456\",\n \"EditMode\":\"tool2\",\n \"IsStarred\":false,\n \"IsTextPartIncluded\":true,\n \"ReplyEmail\":\"replyto@mailjet.com\",\n \"SenderName\":\"Your Mailjet Pilot\",\n \"TemplateID\":123456,\n \"Title\":\"My Mailjet Campaign\",\n \"ContactsListID\":123456,\n \"Locale\":\"en_US\",\n \"SegmentationID\":123,\n \"SegmentationAlt\":\"Customers under 35\",\n \"Sender\":\"1234\",\n \"SenderEmail\":\"pilot@mailjet.com\",\n \"Status\":\"\",\n \"Subject\":\"Your email flight plan!\"\n\t}'"
- lang: PHP
label: PHP
source: " 'v3']);\n$body = [\n 'AXFraction' => 0,\n 'AXFractionName' => \"Version A\",\n 'AXTesting' => \"123456\",\n 'EditMode' => \"tool2\",\n 'IsStarred' => false,\n 'IsTextPartIncluded' => true,\n 'ReplyEmail' => \"replyto@mailjet.com\",\n 'SenderName' => \"Your Mailjet Pilot\",\n 'TemplateID' => 123456,\n 'Title' => \"My Mailjet Campaign\",\n 'ContactsListID' => 123456,\n 'Locale' => \"en_US\",\n 'SegmentationID' => 123,\n 'SegmentationAlt' => \"Customers under 35\",\n 'Sender' => \"1234\",\n 'SenderEmail' => \"pilot@mailjet.com\",\n 'Status' => \"\",\n 'Subject' => \"Your email flight plan!\"\n];\n$response = $mj->put(Resources::$Campaigndraft, ['id' => $id, 'body' => $body]);\n$response->success() && var_dump($response->getData());\n?>"
- lang: Node.js
label: Node
source: "const mailjet = require ('node-mailjet')\n\t.connect(process.env.MJ_APIKEY_PUBLIC, process.env.MJ_APIKEY_PRIVATE)\nconst request = mailjet\n\t.put(\"campaigndraft\", {'version': 'v3'})\n\t.id($draft_ID)\n\t.request({\n \"AXFraction\":0,\n \"AXFractionName\":\"Version A\",\n \"AXTesting\":\"123456\",\n \"EditMode\":\"tool2\",\n \"IsStarred\":false,\n \"IsTextPartIncluded\":true,\n \"ReplyEmail\":\"replyto@mailjet.com\",\n \"SenderName\":\"Your Mailjet Pilot\",\n \"TemplateID\":123456,\n \"Title\":\"My Mailjet Campaign\",\n \"ContactsListID\":123456,\n \"Locale\":\"en_US\",\n \"SegmentationID\":123,\n \"SegmentationAlt\":\"Customers under 35\",\n \"Sender\":\"1234\",\n \"SenderEmail\":\"pilot@mailjet.com\",\n \"Status\":\"\",\n \"Subject\":\"Your email flight plan!\"\n })\nrequest\n\t.then((result) => {\n\t\tconsole.log(result.body)\n\t})\n\t.catch((err) => {\n\t\tconsole.log(err.statusCode)\n\t})"
- lang: Ruby
label: Ruby
source: "require 'mailjet'\nMailjet.configure do |config|\n config.api_key = ENV['MJ_APIKEY_PUBLIC']\n config.secret_key = ENV['MJ_APIKEY_PRIVATE']\n config.api_version = \"v3\"\nend\ntarget = Mailjet::Campaigndraft.find($draft_ID)\ntarget.update_attributes(\n axfraction: 0,\n axfraction_name: \"Version A\",\n axtesting: \"123456\",\n edit_mode: \"tool2\",\n is_starred: false,\n is_text_part_included: true,\n reply_email: \"replyto@mailjet.com\",\n sender_name: \"Your Mailjet Pilot\",\n template_id: 123456,\n title: \"My Mailjet Campaign\",\n contacts_list_id: 123456,\n locale: \"en_US\",\n segmentation_id: 123,\n segmentation_alt: \"Customers under 35\",\n sender: \"1234\",\n sender_email: \"pilot@mailjet.com\",\n status: \"\",\n subject: \"Your email flight plan!\"\n)\np variable.attributes['Data']"
- lang: Python
label: Python
source: "from mailjet_rest import Client\nimport os\napi_key = os.environ['MJ_APIKEY_PUBLIC']\napi_secret = os.environ['MJ_APIKEY_PRIVATE']\nmailjet = Client(auth=(api_key, api_secret), version='v3')\nid = '$draft_ID'\ndata = {\n 'AXFraction': 0,\n 'AXFractionName': \"Version A\",\n 'AXTesting': \"123456\",\n 'EditMode': \"tool2\",\n 'IsStarred': False,\n 'IsTextPartIncluded': True,\n 'ReplyEmail': \"replyto@mailjet.com\",\n 'SenderName': \"Your Mailjet Pilot\",\n 'TemplateID': 123456,\n 'Title': \"My Mailjet Campaign\",\n 'ContactsListID': 123456,\n 'Locale': \"en_US\",\n 'SegmentationID': 123,\n 'SegmentationAlt': \"Customers under 35\",\n 'Sender': \"1234\",\n 'SenderEmail': \"pilot@mailjet.com\",\n 'Status': \"\",\n 'Subject': \"Your email flight plan!\"\n}\nresult = mailjet.campaigndraft.update(id=id, data=data)\nprint result.status_code\nprint result.json()"
- lang: Java
label: Java
source: "package com.my.project;\nimport com.mailjet.client.errors.MailjetException;\nimport com.mailjet.client.errors.MailjetSocketTimeoutException;\nimport com.mailjet.client.MailjetClient;\nimport com.mailjet.client.MailjetRequest;\nimport com.mailjet.client.MailjetResponse;\nimport com.mailjet.client.ClientOptions;\nimport com.mailjet.client.resource.Campaigndraft;\nimport org.json.JSONArray;\nimport org.json.JSONObject;\npublic class MyClass {\n public static void main(String[] args) throws MailjetException, MailjetSocketTimeoutException {\n MailjetClient client;\n MailjetRequest request;\n MailjetResponse response;\n client = new MailjetClient(System.getenv(\"MJ_APIKEY_PUBLIC\"), System.getenv(\"MJ_APIKEY_PRIVATE\"), new ClientOptions(\"v3\"));\n request = new MailjetRequest(Campaigndraft.resource, ID)\n .property(Campaigndraft.AXFRACTION, 0)\n .property(Campaigndraft.AXFRACTIONNAME, \"Version A\")\n .property(Campaigndraft.AXTESTING, \"123456\")\n .property(Campaigndraft.EDITMODE, \"tool2\")\n .property(Campaigndraft.ISSTARRED, false)\n .property(Campaigndraft.ISTEXTPARTINCLUDED, true)\n .property(Campaigndraft.REPLYEMAIL, \"replyto@mailjet.com\")\n .property(Campaigndraft.SENDERNAME, \"Your Mailjet Pilot\")\n .property(Campaigndraft.TEMPLATEID, 123456)\n .property(Campaigndraft.TITLE, \"My Mailjet Campaign\")\n .property(Campaigndraft.CONTACTSLISTID, 123456)\n .property(Campaigndraft.LOCALE, \"en_US\")\n .property(Campaigndraft.SEGMENTATIONID, 123)\n .property(Campaigndraft.SEGMENTATIONALT, \"Customers under 35\")\n .property(Campaigndraft.SENDER, \"1234\")\n .property(Campaigndraft.SENDEREMAIL, \"pilot@mailjet.com\")\n .property(Campaigndraft.STATUS, )\n .property(Campaigndraft.SUBJECT, \"Your email flight plan!\")\n );\n response = client.put(request);\n System.out.println(response.getStatus());\n System.out.println(response.getData());\n }\n}"
- lang: Go
label: Go
source: "package main\nimport (\n\t\"fmt\"\n\t\"log\"\n\t\"os\"\n\tmailjet \"github.com/mailjet/mailjet-apiv3-go\"\n\t\"github.com/mailjet/mailjet-apiv3-go/resources\"\n)\nfunc main () {\n\tmailjetClient := NewMailjetClient(os.Getenv(\"MJ_APIKEY_PUBLIC\"), os.Getenv(\"MJ_APIKEY_PRIVATE\"))\n\tmr := &Request{\n\t Resource: \"campaigndraft\",\n\t ID: RESOURCE_ID,\n\t}\n\tfmr := &FullRequest{\n\t Info: mr,\n\t Payload: &resources.Campaigndraft { \n\t AXFraction:0,\n\t AXFractionName:\"Version A\",\n\t AXTesting:\"123456\",\n\t EditMode:\"tool2\",\n\t IsStarred:false,\n\t IsTextPartIncluded:true,\n\t ReplyEmail:\"replyto@mailjet.com\",\n\t SenderName:\"Your Mailjet Pilot\",\n\t TemplateID:123456,\n\t Title:\"My Mailjet Campaign\",\n\t ContactsListID:123456,\n\t Locale:\"en_US\",\n\t SegmentationID:123,\n\t SegmentationAlt:\"Customers under 35\",\n\t Sender:\"1234\",\n\t SenderEmail:\"pilot@mailjet.com\",\n\t Status:\"\",\n\t Subject:\"Your email flight plan!\"\n }\n\t}\n\terr := mailjetClient.Put(fmr)\n\tif err != nil {\n\t fmt.Println(err)\n\t}\n}"
- lang: C#
label: C#
source: "using Mailjet.Client;\nusing Mailjet.Client.Resources;\nusing System;\nusing Newtonsoft.Json.Linq;\nnamespace Mailjet.ConsoleApplication\n{\n class Program\n {\n static void Main(string[] args)\n {\n RunAsync().Wait();\n }\n static async Task RunAsync()\n {\n MailjetClient client = new MailjetClient(Environment.GetEnvironmentVariable(\"MJ_APIKEY_PUBLIC\"), Environment.GetEnvironmentVariable(\"MJ_APIKEY_PRIVATE\"))\n {\n Version = ApiVersion.V3,\n };\n MailjetRequest request = new MailjetRequest\n {\n Resource = Campaigndraft.Resource,\n ResourceId = ResourceId.Numeric(ID)\n }\n .Property(Campaigndraft.AXFraction, 0)\n .Property(Campaigndraft.AXFractionName, \"Version A\")\n .Property(Campaigndraft.AXTesting, \"123456\")\n .Property(Campaigndraft.EditMode, \"tool2\")\n .Property(Campaigndraft.IsStarred, false)\n .Property(Campaigndraft.IsTextPartIncluded, true)\n .Property(Campaigndraft.ReplyEmail, \"replyto@mailjet.com\")\n .Property(Campaigndraft.SenderName, \"Your Mailjet Pilot\")\n .Property(Campaigndraft.TemplateID, 123456)\n .Property(Campaigndraft.Title, \"My Mailjet Campaign\")\n .Property(Campaigndraft.ContactsListID, 123456)\n .Property(Campaigndraft.Locale, \"en_US\")\n .Property(Campaigndraft.SegmentationID, 123)\n .Property(Campaigndraft.SegmentationAlt, \"Customers under 35\")\n .Property(Campaigndraft.Sender, \"1234\")\n .Property(Campaigndraft.SenderEmail, \"pilot@mailjet.com\")\n .Property(Campaigndraft.Status, )\n .Property(Campaigndraft.Subject, \"Your email flight plan!\");\n MailjetResponse response = await client.PutAsync(request);\n if (response.IsSuccessStatusCode)\n {\n Console.WriteLine(string.Format(\"Total: {0}, Count: {1}\\n\", response.GetTotal(), response.GetCount()));\n Console.WriteLine(response.GetData());\n }\n else\n {\n Console.WriteLine(string.Format(\"StatusCode: {0}\\n\", response.StatusCode));\n Console.WriteLine(string.Format(\"ErrorInfo: {0}\\n\", response.GetErrorInfo()));\n Console.WriteLine(response.GetData());\n Console.WriteLine(string.Format(\"ErrorMessage: {0}\\n\", response.GetErrorMessage()));\n }\n }\n }\n}"
/v3/REST/campaigndraft/{draft_ID}/detailcontent:
get:
x-seo:
title: "Get Campaign Draft: Detail Content"
description: "Retrieve the content of your campaign draft email. It will be split between a Text part, HTML part, MJML content and/or additional headers."
tags:
- Campaigns
summary: 'Get Campaign Draft: Detail Content'
description: Retrieve the content of your campaign draft email. It will be split between a Text part, HTML part, MJML content and/or additional headers. To obtain a valid `draft_ID`, first call `GET /v3/REST/campaigndraft` to list your campaign drafts.
operationId: get_v3_campaigndraft_id_detailcontent
parameters:
- name: draft_ID
in: path
schema:
$ref: '#/components/schemas/get_v3_campaigndraft_id_detailcontent_PathParams/properties/draft_ID'
required: true
example: 4000
responses:
'200':
description: Default OK response for `/campaigndraft` action :detailcontent
content:
application/json:
schema:
type: object
properties:
Count:
description: Indicates the number of objects in the `Data` array.
type: integer
format: int64
examples:
- 1
Data:
description: A JSON array containing a list of objects returned by this endpoint.
type: array
items:
$ref: '#/components/schemas/OutputCampaigndraftDetailcontent'
Total:
description: Indicates the number of objects in the `Data` array.
type: integer
format: int64
examples:
- 1
'400':
$ref: '#/components/responses/400'
'401':
$ref: '#/components/responses/401'
'403':
$ref: '#/components/responses/403'
'404':
$ref: '#/components/responses/404'
'429':
$ref: '#/components/responses/429'
'500':
$ref: '#/components/responses/500'
security:
- basicAuth: []
x-codeSamples:
- lang: curl
label: cURL
source: "curl -s \\\n\t-X GET \\\n\t--user \"$MJ_APIKEY_PUBLIC:$MJ_APIKEY_PRIVATE\" \\\n\thttps://api.mailjet.com/v3/REST/campaigndraft/$draft_ID/detailcontent \\"
- lang: PHP
label: PHP
source: " 'v3']);\n$response = $mj->get(Resources::$CampaigndraftDetailcontent, ['id' => $id]);\n$response->success() && var_dump($response->getData());\n?>"
- lang: Node.js
label: Node
source: "const mailjet = require ('node-mailjet')\n\t.connect(process.env.MJ_APIKEY_PUBLIC, process.env.MJ_APIKEY_PRIVATE)\nconst request = mailjet\n\t.get(\"campaigndraft\", {'version': 'v3'})\n\t.id($draft_ID)\n\t.action(\"detailcontent\")\n\t.request()\nrequest\n\t.then((result) => {\n\t\tconsole.log(result.body)\n\t})\n\t.catch((err) => {\n\t\tconsole.log(err.statusCode)\n\t})"
- lang: Ruby
label: Ruby
source: "require 'mailjet'\nMailjet.configure do |config|\n config.api_key = ENV['MJ_APIKEY_PUBLIC']\n config.secret_key = ENV['MJ_APIKEY_PRIVATE']\n config.api_version = \"v3\"\nend\nvariable = Mailjet::Campaigndraft_detailcontent.find($draft_ID\n)\np variable.attributes['Data']"
- lang: Python
label: Python
source: "from mailjet_rest import Client\nimport os\napi_key = os.environ['MJ_APIKEY_PUBLIC']\napi_secret = os.environ['MJ_APIKEY_PRIVATE']\nmailjet = Client(auth=(api_key, api_secret), version='v3')\nid = '$draft_ID'\nresult = mailjet.campaigndraft_detailcontent.get(id=id)\nprint result.status_code\nprint result.json()"
- lang: Java
label: Java
source: "package com.my.project;\nimport com.mailjet.client.errors.MailjetException;\nimport com.mailjet.client.errors.MailjetSocketTimeoutException;\nimport com.mailjet.client.MailjetClient;\nimport com.mailjet.client.MailjetRequest;\nimport com.mailjet.client.MailjetResponse;\nimport com.mailjet.client.ClientOptions;\nimport com.mailjet.client.resource.CampaigndraftDetailcontent;\nimport org.json.JSONArray;\nimport org.json.JSONObject;\npublic class MyClass {\n public static void main(String[] args) throws MailjetException, MailjetSocketTimeoutException {\n MailjetClient client;\n MailjetRequest request;\n MailjetResponse response;\n client = new MailjetClient(System.getenv(\"MJ_APIKEY_PUBLIC\"), System.getenv(\"MJ_APIKEY_PRIVATE\"), new ClientOptions(\"v3\"));\n request = new MailjetRequest(CampaigndraftDetailcontent.resource, ID);\n response = client.get(request);\n System.out.println(response.getStatus());\n System.out.println(response.getData());\n }\n}"
- lang: Go
label: Go
source: "package main\nimport (\n\t\"fmt\"\n\t\"log\"\n\t\"os\"\n\tmailjet \"github.com/mailjet/mailjet-apiv3-go\"\n\t\"github.com/mailjet/mailjet-apiv3-go/resources\"\n)\nfunc main () {\n\tmailjetClient := NewMailjetClient(os.Getenv(\"MJ_APIKEY_PUBLIC\"), os.Getenv(\"MJ_APIKEY_PRIVATE\"))\n\tvar data []resources.CampaigndraftDetailcontent\n\tmr := &Request{\n\t Resource: \"campaigndraft\",\n\t ID: RESOURCE_ID,\n\t Action: \"detailcontent\",\n\t}\n\terr := mailjetClient.Get(mr, &data)\n\tif err != nil {\n\t fmt.Println(err)\n\t}\n\tfmt.Printf(\"Data array: %+v\\n\", data)\n}"
- lang: C#
label: C#
source: "using Mailjet.Client;\nusing Mailjet.Client.Resources;\nusing System;\nusing Newtonsoft.Json.Linq;\nnamespace Mailjet.ConsoleApplication\n{\n class Program\n {\n static void Main(string[] args)\n {\n RunAsync().Wait();\n }\n static async Task RunAsync()\n {\n MailjetClient client = new MailjetClient(Environment.GetEnvironmentVariable(\"MJ_APIKEY_PUBLIC\"), Environment.GetEnvironmentVariable(\"MJ_APIKEY_PRIVATE\"))\n {\n Version = ApiVersion.V3,\n };\n MailjetRequest request = new MailjetRequest\n {\n Resource = CampaigndraftDetailcontent.Resource,\n ResourceId = ResourceId.Numeric(ID)\n }\n MailjetResponse response = await client.GetAsync(request);\n if (response.IsSuccessStatusCode)\n {\n Console.WriteLine(string.Format(\"Total: {0}, Count: {1}\\n\", response.GetTotal(), response.GetCount()));\n Console.WriteLine(response.GetData());\n }\n else\n {\n Console.WriteLine(string.Format(\"StatusCode: {0}\\n\", response.StatusCode));\n Console.WriteLine(string.Format(\"ErrorInfo: {0}\\n\", response.GetErrorInfo()));\n Console.WriteLine(response.GetData());\n Console.WriteLine(string.Format(\"ErrorMessage: {0}\\n\", response.GetErrorMessage()));\n }\n }\n }\n}"
post:
x-seo:
title: "Campaign Draft: Detail Content"
description: "Create, update or delete the content of your campaign draft email. You can select a Text part, HTML part, MJML content, as well as additional headers\u2026"
tags:
- Campaigns
summary: 'Campaign Draft: Detail Content'
description: "Create, update or delete the content of your campaign draft email. You can select a Text part, HTML part, MJML content, as well as additional headers.\n\nEach `POST` request overwrites any content previously added - e.g. if you have submitted HTML content on the initial `POST`, and on the next you only submit Text content, the previously saved value of `Html-part` will be deleted.\n To obtain a valid `draft_ID`, first call `GET /v3/REST/campaigndraft` to list your campaign drafts."
operationId: post_v3_campaigndraft_id_detailcontent
parameters:
- name: draft_ID
in: path
schema:
$ref: '#/components/schemas/post_v3_campaigndraft_id_detailcontent_PathParams/properties/draft_ID'
required: true
example: 4000
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/NewCampaigndraftDetailcontent'
example:
Html-part: Dear passenger, welcome to Mailjet!
May the delivery force be with you!
Text-part: Dear passenger, welcome to Mailjet! May the delivery force be with you!
responses:
'201':
description: Default OK response for `/campaigndraft` action `/detailcontent`
content:
application/json:
schema:
type: object
properties:
Count:
description: Indicates the number of objects in the `Data` array.
type: integer
format: int64
examples:
- 1
Data:
description: A JSON array containing a list of objects returned by this endpoint.
type: array
items:
$ref: '#/components/schemas/OutputCampaigndraftDetailcontent'
Total:
description: Indicates the number of objects in the `Data` array.
type: integer
format: int64
examples:
- 1
'400':
$ref: '#/components/responses/400'
'401':
$ref: '#/components/responses/401'
'403':
$ref: '#/components/responses/403'
'404':
$ref: '#/components/responses/404'
'429':
$ref: '#/components/responses/429'
'500':
$ref: '#/components/responses/500'
security:
- basicAuth: []
x-codeSamples:
- lang: curl
label: cURL
source: "curl -s \\\n\t-X POST \\\n\t--user \"$MJ_APIKEY_PUBLIC:$MJ_APIKEY_PRIVATE\" \\\n\thttps://api.mailjet.com/v3/REST/campaigndraft/$draft_ID/detailcontent \\\n\t-H 'Content-Type: application/json' \\\n\t-d '{\n \"Headers\":\"object\",\n \"Html-part\":\"Dear passenger, welcome to Mailjet!
May the delivery force be with you!\",\n \"MJMLContent\":\"\",\n \"Text-part\":\"Dear passenger, welcome to Mailjet! May the delivery force be with you!\"\n\t}'"
- lang: PHP
label: PHP
source: " 'v3']);\n$body = [\n 'Headers' => \"object\",\n 'Html-part' => \"Dear passenger, welcome to Mailjet!
May the delivery force be with you!\",\n 'MJMLContent' => \"\",\n 'Text-part' => \"Dear passenger, welcome to Mailjet! May the delivery force be with you!\"\n];\n$response = $mj->post(Resources::$CampaigndraftDetailcontent, ['id' => $id, 'body' => $body]);\n$response->success() && var_dump($response->getData());\n?>"
- lang: Node.js
label: Node
source: "const mailjet = require ('node-mailjet')\n\t.connect(process.env.MJ_APIKEY_PUBLIC, process.env.MJ_APIKEY_PRIVATE)\nconst request = mailjet\n\t.post(\"campaigndraft\", {'version': 'v3'})\n\t.id($draft_ID)\n\t.action(\"detailcontent\")\n\t.request({\n \"Headers\":\"object\",\n \"Html-part\":\"Dear passenger, welcome to Mailjet!
May the delivery force be with you!\",\n \"MJMLContent\":\"\",\n \"Text-part\":\"Dear passenger, welcome to Mailjet! May the delivery force be with you!\"\n })\nrequest\n\t.then((result) => {\n\t\tconsole.log(result.body)\n\t})\n\t.catch((err) => {\n\t\tconsole.log(err.statusCode)\n\t})"
- lang: Ruby
label: Ruby
source: "require 'mailjet'\nMailjet.configure do |config|\n config.api_key = ENV['MJ_APIKEY_PUBLIC']\n config.secret_key = ENV['MJ_APIKEY_PRIVATE']\n config.api_version = \"v3\"\nend\nvariable = Mailjet::Campaigndraft_detailcontent.create(id: $draft_ID,\n headers: \"object\",\n html_part: \"Dear passenger, welcome to Mailjet!
May the delivery force be with you!\",\n mjmlcontent: \"\",\n text_part: \"Dear passenger, welcome to Mailjet! May the delivery force be with you!\"\n)\np variable.attributes['Data']"
- lang: Python
label: Python
source: "from mailjet_rest import Client\nimport os\napi_key = os.environ['MJ_APIKEY_PUBLIC']\napi_secret = os.environ['MJ_APIKEY_PRIVATE']\nmailjet = Client(auth=(api_key, api_secret), version='v3')\nid = '$draft_ID'\ndata = {\n 'Headers': \"object\",\n 'Html-part': \"Dear passenger, welcome to Mailjet!
May the delivery force be with you!\",\n 'MJMLContent': \"\",\n 'Text-part': \"Dear passenger, welcome to Mailjet! May the delivery force be with you!\"\n}\nresult = mailjet.campaigndraft_detailcontent.create(id=id, data=data)\nprint result.status_code\nprint result.json()"
- lang: Java
label: Java
source: "package com.my.project;\nimport com.mailjet.client.errors.MailjetException;\nimport com.mailjet.client.errors.MailjetSocketTimeoutException;\nimport com.mailjet.client.MailjetClient;\nimport com.mailjet.client.MailjetRequest;\nimport com.mailjet.client.MailjetResponse;\nimport com.mailjet.client.ClientOptions;\nimport com.mailjet.client.resource.CampaigndraftDetailcontent;\nimport org.json.JSONArray;\nimport org.json.JSONObject;\npublic class MyClass {\n public static void main(String[] args) throws MailjetException, MailjetSocketTimeoutException {\n MailjetClient client;\n MailjetRequest request;\n MailjetResponse response;\n client = new MailjetClient(System.getenv(\"MJ_APIKEY_PUBLIC\"), System.getenv(\"MJ_APIKEY_PRIVATE\"), new ClientOptions(\"v3\"));\n request = new MailjetRequest(CampaigndraftDetailcontent.resource, ID)\n .property(CampaigndraftDetailcontent.HEADERS, \"object\")\n .property(CampaigndraftDetailcontent.HTMLPART, \"Dear passenger, welcome to Mailjet!
May the delivery force be with you!\")\n .property(CampaigndraftDetailcontent.MJMLCONTENT, )\n .property(CampaigndraftDetailcontent.TEXTPART, \"Dear passenger, welcome to Mailjet! May the delivery force be with you!\")\n );\n response = client.post(request);\n System.out.println(response.getStatus());\n System.out.println(response.getData());\n }\n}"
- lang: Go
label: Go
source: "package main\nimport (\n\t\"fmt\"\n\t\"log\"\n\t\"os\"\n\tmailjet \"github.com/mailjet/mailjet-apiv3-go\"\n\t\"github.com/mailjet/mailjet-apiv3-go/resources\"\n)\nfunc main () {\n\tmailjetClient := NewMailjetClient(os.Getenv(\"MJ_APIKEY_PUBLIC\"), os.Getenv(\"MJ_APIKEY_PRIVATE\"))\n\tvar data []resources.CampaigndraftDetailcontent\n\tmr := &Request{\n\t Resource: \"campaigndraft\",\n\t ID: RESOURCE_ID,\n\t Action: \"detailcontent\",\n\t}\n\tfmr := &FullRequest{\n\t Info: mr,\n\t Payload: &resources.CampaigndraftDetailcontent { \n\t Headers:\"object\",\n\t Html-part:\"Dear passenger, welcome to Mailjet!
May the delivery force be with you!\",\n\t MJMLContent:\"\",\n\t Text-part:\"Dear passenger, welcome to Mailjet! May the delivery force be with you!\"\n }\n\t}\n\terr := mailjetClient.Post(fmr, &data)\n\tif err != nil {\n\t fmt.Println(err)\n\t}\n\tfmt.Printf(\"Data array: %+v\\n\", data)\n}"
- lang: C#
label: C#
source: "using Mailjet.Client;\nusing Mailjet.Client.Resources;\nusing System;\nusing Newtonsoft.Json.Linq;\nnamespace Mailjet.ConsoleApplication\n{\n class Program\n {\n static void Main(string[] args)\n {\n RunAsync().Wait();\n }\n static async Task RunAsync()\n {\n MailjetClient client = new MailjetClient(Environment.GetEnvironmentVariable(\"MJ_APIKEY_PUBLIC\"), Environment.GetEnvironmentVariable(\"MJ_APIKEY_PRIVATE\"))\n {\n Version = ApiVersion.V3,\n };\n MailjetRequest request = new MailjetRequest\n {\n Resource = CampaigndraftDetailcontent.Resource,\n ResourceId = ResourceId.Numeric(ID)\n }\n .Property(CampaigndraftDetailcontent.Headers, \"object\")\n .Property(CampaigndraftDetailcontent.Htmlpart, \"Dear passenger, welcome to Mailjet!
May the delivery force be with you!\")\n .Property(CampaigndraftDetailcontent.MJMLContent, )\n .Property(CampaigndraftDetailcontent.Textpart, \"Dear passenger, welcome to Mailjet! May the delivery force be with you!\");\n MailjetResponse response = await client.PostAsync(request);\n if (response.IsSuccessStatusCode)\n {\n Console.WriteLine(string.Format(\"Total: {0}, Count: {1}\\n\", response.GetTotal(), response.GetCount()));\n Console.WriteLine(response.GetData());\n }\n else\n {\n Console.WriteLine(string.Format(\"StatusCode: {0}\\n\", response.StatusCode));\n Console.WriteLine(string.Format(\"ErrorInfo: {0}\\n\", response.GetErrorInfo()));\n Console.WriteLine(response.GetData());\n Console.WriteLine(string.Format(\"ErrorMessage: {0}\\n\", response.GetErrorMessage()));\n }\n }\n }\n}"
/v3/REST/campaigndraft/{draft_ID}/test:
post:
x-seo:
title: "Campaign Draft: Test"
description: "Test a created campaign draft by sending it to a selection of recipients. The status of the campaign draft will not be affected by the test."
tags:
- Campaigns
summary: 'Campaign Draft: Test'
description: Test a created campaign draft by sending it to a selection of recipients. The status of the campaign draft will not be affected by the test. To obtain a valid `draft_ID`, first call `GET /v3/REST/campaigndraft` to list your campaign drafts.
operationId: post_v3_campaigndraft_id_test
parameters:
- name: draft_ID
in: path
schema:
$ref: '#/components/schemas/post_v3_campaigndraft_id_test_PathParams/properties/draft_ID'
required: true
example: 4000
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/NewCampaigndraftTest'
example:
Recipients:
- Email: contact@example.com
Name: Example Contact
responses:
'201':
description: Default OK response for `/campaigndraft` action `/test`
content:
application/json:
schema:
type: object
properties:
Count:
description: Indicates the number of objects in the `Data` array.
type: integer
format: int64
examples:
- 1
Data:
description: A JSON array containing a list of objects returned by this endpoint.
type: array
items:
$ref: '#/components/schemas/ActionStatusCampaigndraftTest'
Total:
description: Indicates the number of objects in the `Data` array.
type: integer
format: int64
examples:
- 1
'400':
$ref: '#/components/responses/400'
'401':
$ref: '#/components/responses/401'
'403':
$ref: '#/components/responses/403'
'404':
$ref: '#/components/responses/404'
'429':
$ref: '#/components/responses/429'
'500':
$ref: '#/components/responses/500'
security:
- basicAuth: []
x-codeSamples:
- lang: curl
label: cURL
source: "curl -s \\\n\t-X POST \\\n\t--user \"$MJ_APIKEY_PUBLIC:$MJ_APIKEY_PRIVATE\" \\\n\thttps://api.mailjet.com/v3/REST/campaigndraft/$draft_ID/test \\\n\t-H 'Content-Type: application/json' \\\n\t-d '{\n \"Recipients\":[\n {\n \"Email\":\"passenger@mailjet.com\",\n \"Name\":\"Passenger 1\"\n }\n ]\n\t}'"
- lang: PHP
label: PHP
source: " 'v3']);\n$body = [\n 'Recipients' => [\n [\n 'Email' => \"passenger@mailjet.com\",\n 'Name' => \"Passenger 1\"\n ]\n ]\n];\n$response = $mj->post(Resources::$CampaigndraftTest, ['id' => $id, 'body' => $body]);\n$response->success() && var_dump($response->getData());\n?>"
- lang: Node.js
label: Node
source: "const mailjet = require ('node-mailjet')\n\t.connect(process.env.MJ_APIKEY_PUBLIC, process.env.MJ_APIKEY_PRIVATE)\nconst request = mailjet\n\t.post(\"campaigndraft\", {'version': 'v3'})\n\t.id($draft_ID)\n\t.action(\"test\")\n\t.request({\n \"Recipients\":[\n {\n \"Email\":\"passenger@mailjet.com\",\n \"Name\":\"Passenger 1\"\n }\n ]\n })\nrequest\n\t.then((result) => {\n\t\tconsole.log(result.body)\n\t})\n\t.catch((err) => {\n\t\tconsole.log(err.statusCode)\n\t})"
- lang: Ruby
label: Ruby
source: "require 'mailjet'\nMailjet.configure do |config|\n config.api_key = ENV['MJ_APIKEY_PUBLIC']\n config.secret_key = ENV['MJ_APIKEY_PRIVATE']\n config.api_version = \"v3\"\nend\nvariable = Mailjet::Campaigndraft_test.create(id: $draft_ID,\n recipients: [\n {\n 'email' => \"passenger@mailjet.com\",\n 'name' => \"Passenger 1\"\n }\n ]\n)\np variable.attributes['Data']"
- lang: Python
label: Python
source: "from mailjet_rest import Client\nimport os\napi_key = os.environ['MJ_APIKEY_PUBLIC']\napi_secret = os.environ['MJ_APIKEY_PRIVATE']\nmailjet = Client(auth=(api_key, api_secret), version='v3')\nid = '$draft_ID'\ndata = {\n 'Recipients': [\n {\n \"Email\": \"passenger@mailjet.com\",\n \"Name\": \"Passenger 1\"\n }\n ]\n}\nresult = mailjet.campaigndraft_test.create(id=id, data=data)\nprint result.status_code\nprint result.json()"
- lang: Java
label: Java
source: "package com.my.project;\nimport com.mailjet.client.errors.MailjetException;\nimport com.mailjet.client.errors.MailjetSocketTimeoutException;\nimport com.mailjet.client.MailjetClient;\nimport com.mailjet.client.MailjetRequest;\nimport com.mailjet.client.MailjetResponse;\nimport com.mailjet.client.ClientOptions;\nimport com.mailjet.client.resource.CampaigndraftTest;\nimport org.json.JSONArray;\nimport org.json.JSONObject;\npublic class MyClass {\n public static void main(String[] args) throws MailjetException, MailjetSocketTimeoutException {\n MailjetClient client;\n MailjetRequest request;\n MailjetResponse response;\n client = new MailjetClient(System.getenv(\"MJ_APIKEY_PUBLIC\"), System.getenv(\"MJ_APIKEY_PRIVATE\"), new ClientOptions(\"v3\"));\n request = new MailjetRequest(CampaigndraftTest.resource, ID)\n .property(CampaigndraftTest.RECIPIENTS, new JSONArray()\n .put(new JSONObject()\n .put(\"Email\", \"passenger@mailjet.com\")\n .put(\"Name\", \"Passenger 1\")\n )\n )\n );\n response = client.post(request);\n System.out.println(response.getStatus());\n System.out.println(response.getData());\n }\n}"
- lang: Go
label: Go
source: "package main\nimport (\n\t\"fmt\"\n\t\"log\"\n\t\"os\"\n\tmailjet \"github.com/mailjet/mailjet-apiv3-go\"\n\t\"github.com/mailjet/mailjet-apiv3-go/resources\"\n)\nfunc main () {\n\tmailjetClient := NewMailjetClient(os.Getenv(\"MJ_APIKEY_PUBLIC\"), os.Getenv(\"MJ_APIKEY_PRIVATE\"))\n\tvar data []resources.CampaigndraftTest\n\tmr := &Request{\n\t Resource: \"campaigndraft\",\n\t ID: RESOURCE_ID,\n\t Action: \"test\",\n\t}\n\tfmr := &FullRequest{\n\t Info: mr,\n\t Payload: &resources.CampaigndraftTest { \n Recipients: []MailjetRecipient {\n MailjetRecipient {\n Email:\"passenger@mailjet.com\",\n Name:\"Passenger 1\"\n }\n }\n }\n\t}\n\terr := mailjetClient.Post(fmr, &data)\n\tif err != nil {\n\t fmt.Println(err)\n\t}\n\tfmt.Printf(\"Data array: %+v\\n\", data)\n}"
- lang: C#
label: C#
source: "using Mailjet.Client;\nusing Mailjet.Client.Resources;\nusing System;\nusing Newtonsoft.Json.Linq;\nnamespace Mailjet.ConsoleApplication\n{\n class Program\n {\n static void Main(string[] args)\n {\n RunAsync().Wait();\n }\n static async Task RunAsync()\n {\n MailjetClient client = new MailjetClient(Environment.GetEnvironmentVariable(\"MJ_APIKEY_PUBLIC\"), Environment.GetEnvironmentVariable(\"MJ_APIKEY_PRIVATE\"))\n {\n Version = ApiVersion.V3,\n };\n MailjetRequest request = new MailjetRequest\n {\n Resource = CampaigndraftTest.Resource,\n ResourceId = ResourceId.Numeric(ID)\n }\n .Property(CampaigndraftTest.Recipients, new JArray {\n new JObject {\n {\"Email\", \"passenger@mailjet.com\"},\n {\"Name\", \"Passenger 1\"}\n }\n });\n MailjetResponse response = await client.PostAsync(request);\n if (response.IsSuccessStatusCode)\n {\n Console.WriteLine(string.Format(\"Total: {0}, Count: {1}\\n\", response.GetTotal(), response.GetCount()));\n Console.WriteLine(response.GetData());\n }\n else\n {\n Console.WriteLine(string.Format(\"StatusCode: {0}\\n\", response.StatusCode));\n Console.WriteLine(string.Format(\"ErrorInfo: {0}\\n\", response.GetErrorInfo()));\n Console.WriteLine(response.GetData());\n Console.WriteLine(string.Format(\"ErrorMessage: {0}\\n\", response.GetErrorMessage()));\n }\n }\n }\n}"
/v3/REST/campaigndraft/{draft_ID}/schedule:
get:
x-seo:
title: "Get Campaign Draft: Schedule"
description: "Get Campaign Draft: Schedule using the Mailjet Email API. Retrieve the sending schedule of a campaign draft."
tags:
- Campaigns
summary: 'Get Campaign Draft: Schedule'
description: Retrieve the sending schedule of a campaign draft. To obtain a valid `draft_ID`, first call `GET /v3/REST/campaigndraft` to list your campaign drafts.
operationId: get_v3_campaigndraft_id_schedule
parameters:
- name: draft_ID
in: path
schema:
$ref: '#/components/schemas/get_v3_campaigndraft_id_schedule_PathParams/properties/draft_ID'
required: true
example: 4000
responses:
'200':
description: Default OK response for `/campaigndraft` action `/schedule`
content:
application/json:
schema:
type: object
properties:
Count:
description: Indicates the number of objects in the `Data` array.
type: integer
format: int64
examples:
- 1
Data:
description: A JSON array containing a list of objects returned by this endpoint.
type: array
items:
$ref: '#/components/schemas/OutputCampaigndraftSchedule'
Total:
description: Indicates the number of objects in the `Data` array.
type: integer
format: int64
examples:
- 1
'400':
$ref: '#/components/responses/400'
'401':
$ref: '#/components/responses/401'
'403':
$ref: '#/components/responses/403'
'404':
$ref: '#/components/responses/404'
'429':
$ref: '#/components/responses/429'
'500':
$ref: '#/components/responses/500'
security:
- basicAuth: []
x-codeSamples:
- lang: curl
label: cURL
source: "curl -s \\\n\t-X GET \\\n\t--user \"$MJ_APIKEY_PUBLIC:$MJ_APIKEY_PRIVATE\" \\\n\thttps://api.mailjet.com/v3/REST/campaigndraft/$draft_ID/schedule \\"
- lang: PHP
label: PHP
source: " 'v3']);\n$response = $mj->get(Resources::$CampaigndraftSchedule, ['id' => $id]);\n$response->success() && var_dump($response->getData());\n?>"
- lang: Node.js
label: Node
source: "const mailjet = require ('node-mailjet')\n\t.connect(process.env.MJ_APIKEY_PUBLIC, process.env.MJ_APIKEY_PRIVATE)\nconst request = mailjet\n\t.get(\"campaigndraft\", {'version': 'v3'})\n\t.id($draft_ID)\n\t.action(\"schedule\")\n\t.request()\nrequest\n\t.then((result) => {\n\t\tconsole.log(result.body)\n\t})\n\t.catch((err) => {\n\t\tconsole.log(err.statusCode)\n\t})"
- lang: Ruby
label: Ruby
source: "require 'mailjet'\nMailjet.configure do |config|\n config.api_key = ENV['MJ_APIKEY_PUBLIC']\n config.secret_key = ENV['MJ_APIKEY_PRIVATE']\n config.api_version = \"v3\"\nend\nvariable = Mailjet::Campaigndraft_schedule.find($draft_ID\n)\np variable.attributes['Data']"
- lang: Python
label: Python
source: "from mailjet_rest import Client\nimport os\napi_key = os.environ['MJ_APIKEY_PUBLIC']\napi_secret = os.environ['MJ_APIKEY_PRIVATE']\nmailjet = Client(auth=(api_key, api_secret), version='v3')\nid = '$draft_ID'\nresult = mailjet.campaigndraft_schedule.get(id=id)\nprint result.status_code\nprint result.json()"
- lang: Java
label: Java
source: "package com.my.project;\nimport com.mailjet.client.errors.MailjetException;\nimport com.mailjet.client.errors.MailjetSocketTimeoutException;\nimport com.mailjet.client.MailjetClient;\nimport com.mailjet.client.MailjetRequest;\nimport com.mailjet.client.MailjetResponse;\nimport com.mailjet.client.ClientOptions;\nimport com.mailjet.client.resource.CampaigndraftSchedule;\nimport org.json.JSONArray;\nimport org.json.JSONObject;\npublic class MyClass {\n public static void main(String[] args) throws MailjetException, MailjetSocketTimeoutException {\n MailjetClient client;\n MailjetRequest request;\n MailjetResponse response;\n client = new MailjetClient(System.getenv(\"MJ_APIKEY_PUBLIC\"), System.getenv(\"MJ_APIKEY_PRIVATE\"), new ClientOptions(\"v3\"));\n request = new MailjetRequest(CampaigndraftSchedule.resource, ID);\n response = client.get(request);\n System.out.println(response.getStatus());\n System.out.println(response.getData());\n }\n}"
- lang: Go
label: Go
source: "package main\nimport (\n\t\"fmt\"\n\t\"log\"\n\t\"os\"\n\tmailjet \"github.com/mailjet/mailjet-apiv3-go\"\n\t\"github.com/mailjet/mailjet-apiv3-go/resources\"\n)\nfunc main () {\n\tmailjetClient := NewMailjetClient(os.Getenv(\"MJ_APIKEY_PUBLIC\"), os.Getenv(\"MJ_APIKEY_PRIVATE\"))\n\tvar data []resources.CampaigndraftSchedule\n\tmr := &Request{\n\t Resource: \"campaigndraft\",\n\t ID: RESOURCE_ID,\n\t Action: \"schedule\",\n\t}\n\terr := mailjetClient.Get(mr, &data)\n\tif err != nil {\n\t fmt.Println(err)\n\t}\n\tfmt.Printf(\"Data array: %+v\\n\", data)\n}"
- lang: C#
label: C#
source: "using Mailjet.Client;\nusing Mailjet.Client.Resources;\nusing System;\nusing Newtonsoft.Json.Linq;\nnamespace Mailjet.ConsoleApplication\n{\n class Program\n {\n static void Main(string[] args)\n {\n RunAsync().Wait();\n }\n static async Task RunAsync()\n {\n MailjetClient client = new MailjetClient(Environment.GetEnvironmentVariable(\"MJ_APIKEY_PUBLIC\"), Environment.GetEnvironmentVariable(\"MJ_APIKEY_PRIVATE\"))\n {\n Version = ApiVersion.V3,\n };\n MailjetRequest request = new MailjetRequest\n {\n Resource = CampaigndraftSchedule.Resource,\n ResourceId = ResourceId.Numeric(ID)\n }\n MailjetResponse response = await client.GetAsync(request);\n if (response.IsSuccessStatusCode)\n {\n Console.WriteLine(string.Format(\"Total: {0}, Count: {1}\\n\", response.GetTotal(), response.GetCount()));\n Console.WriteLine(response.GetData());\n }\n else\n {\n Console.WriteLine(string.Format(\"StatusCode: {0}\\n\", response.StatusCode));\n Console.WriteLine(string.Format(\"ErrorInfo: {0}\\n\", response.GetErrorInfo()));\n Console.WriteLine(response.GetData());\n Console.WriteLine(string.Format(\"ErrorMessage: {0}\\n\", response.GetErrorMessage()));\n }\n }\n }\n}"
post:
x-seo:
title: "Campaign Draft: Schedule"
description: "Campaign Draft: Schedule using the Mailjet Email API. Schedule the sending of a campaign draft."
tags:
- Campaigns
summary: 'Campaign Draft: Schedule'
description: Schedule the sending of a campaign draft.
operationId: post_v3_campaigndraft_id_schedule
parameters:
- name: draft_ID
in: path
schema:
$ref: '#/components/schemas/post_v3_campaigndraft_id_schedule_PathParams/properties/draft_ID'
required: true
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/NewCampaigndraftSchedule'
responses:
'201':
description: Default OK response for `/campaigndraft` action `/schedule`
content:
application/json:
schema:
type: object
properties:
Count:
description: Indicates the number of objects in the `Data` array.
type: integer
format: int64
examples:
- 1
Data:
description: A JSON array containing a list of objects returned by this endpoint.
type: array
items:
$ref: '#/components/schemas/OutputCampaigndraftSchedule'
Total:
description: Indicates the number of objects in the `Data` array.
type: integer
format: int64
examples:
- 1
'400':
$ref: '#/components/responses/400'
'401':
$ref: '#/components/responses/401'
'403':
$ref: '#/components/responses/403'
'404':
$ref: '#/components/responses/404'
'429':
$ref: '#/components/responses/429'
'500':
$ref: '#/components/responses/500'
security:
- basicAuth: []
x-codeSamples:
- lang: curl
label: cURL
source: "curl -s \\\n\t-X POST \\\n\t--user \"$MJ_APIKEY_PUBLIC:$MJ_APIKEY_PRIVATE\" \\\n\thttps://api.mailjet.com/v3/REST/campaigndraft/$draft_ID/schedule \\\n\t-H 'Content-Type: application/json' \\\n\t-d '{\n \"Date\":\"2018-01-01T00:00:00\"\n\t}'"
- lang: PHP
label: PHP
source: " 'v3']);\n$body = [\n 'Date' => \"2018-01-01T00:00:00\"\n];\n$response = $mj->post(Resources::$CampaigndraftSchedule, ['id' => $id, 'body' => $body]);\n$response->success() && var_dump($response->getData());\n?>"
- lang: Node.js
label: Node
source: "const mailjet = require ('node-mailjet')\n\t.connect(process.env.MJ_APIKEY_PUBLIC, process.env.MJ_APIKEY_PRIVATE)\nconst request = mailjet\n\t.post(\"campaigndraft\", {'version': 'v3'})\n\t.id($draft_ID)\n\t.action(\"schedule\")\n\t.request({\n \"Date\":\"2018-01-01T00:00:00\"\n })\nrequest\n\t.then((result) => {\n\t\tconsole.log(result.body)\n\t})\n\t.catch((err) => {\n\t\tconsole.log(err.statusCode)\n\t})"
- lang: Ruby
label: Ruby
source: "require 'mailjet'\nMailjet.configure do |config|\n config.api_key = ENV['MJ_APIKEY_PUBLIC']\n config.secret_key = ENV['MJ_APIKEY_PRIVATE']\n config.api_version = \"v3\"\nend\nvariable = Mailjet::Campaigndraft_schedule.create(id: $draft_ID,\n date: \"2018-01-01T00:00:00\"\n)\np variable.attributes['Data']"
- lang: Python
label: Python
source: "from mailjet_rest import Client\nimport os\napi_key = os.environ['MJ_APIKEY_PUBLIC']\napi_secret = os.environ['MJ_APIKEY_PRIVATE']\nmailjet = Client(auth=(api_key, api_secret), version='v3')\nid = '$draft_ID'\ndata = {\n 'Date': \"2018-01-01T00:00:00\"\n}\nresult = mailjet.campaigndraft_schedule.create(id=id, data=data)\nprint result.status_code\nprint result.json()"
- lang: Java
label: Java
source: "package com.my.project;\nimport com.mailjet.client.errors.MailjetException;\nimport com.mailjet.client.errors.MailjetSocketTimeoutException;\nimport com.mailjet.client.MailjetClient;\nimport com.mailjet.client.MailjetRequest;\nimport com.mailjet.client.MailjetResponse;\nimport com.mailjet.client.ClientOptions;\nimport com.mailjet.client.resource.CampaigndraftSchedule;\nimport org.json.JSONArray;\nimport org.json.JSONObject;\npublic class MyClass {\n public static void main(String[] args) throws MailjetException, MailjetSocketTimeoutException {\n MailjetClient client;\n MailjetRequest request;\n MailjetResponse response;\n client = new MailjetClient(System.getenv(\"MJ_APIKEY_PUBLIC\"), System.getenv(\"MJ_APIKEY_PRIVATE\"), new ClientOptions(\"v3\"));\n request = new MailjetRequest(CampaigndraftSchedule.resource, ID)\n .property(CampaigndraftSchedule.DATE, \"2018-01-01T00:00:00\")\n );\n response = client.post(request);\n System.out.println(response.getStatus());\n System.out.println(response.getData());\n }\n}"
- lang: Go
label: Go
source: "package main\nimport (\n\t\"fmt\"\n\t\"log\"\n\t\"os\"\n\tmailjet \"github.com/mailjet/mailjet-apiv3-go\"\n\t\"github.com/mailjet/mailjet-apiv3-go/resources\"\n)\nfunc main () {\n\tmailjetClient := NewMailjetClient(os.Getenv(\"MJ_APIKEY_PUBLIC\"), os.Getenv(\"MJ_APIKEY_PRIVATE\"))\n\tvar data []resources.CampaigndraftSchedule\n\tmr := &Request{\n\t Resource: \"campaigndraft\",\n\t ID: RESOURCE_ID,\n\t Action: \"schedule\",\n\t}\n\tfmr := &FullRequest{\n\t Info: mr,\n\t Payload: &resources.CampaigndraftSchedule { \n\t Date:\"2018-01-01T00:00:00\"\n }\n\t}\n\terr := mailjetClient.Post(fmr, &data)\n\tif err != nil {\n\t fmt.Println(err)\n\t}\n\tfmt.Printf(\"Data array: %+v\\n\", data)\n}"
- lang: C#
label: C#
source: "using Mailjet.Client;\nusing Mailjet.Client.Resources;\nusing System;\nusing Newtonsoft.Json.Linq;\nnamespace Mailjet.ConsoleApplication\n{\n class Program\n {\n static void Main(string[] args)\n {\n RunAsync().Wait();\n }\n static async Task RunAsync()\n {\n MailjetClient client = new MailjetClient(Environment.GetEnvironmentVariable(\"MJ_APIKEY_PUBLIC\"), Environment.GetEnvironmentVariable(\"MJ_APIKEY_PRIVATE\"))\n {\n Version = ApiVersion.V3,\n };\n MailjetRequest request = new MailjetRequest\n {\n Resource = CampaigndraftSchedule.Resource,\n ResourceId = ResourceId.Numeric(ID)\n }\n .Property(CampaigndraftSchedule.Date, \"2018-01-01T00:00:00\");\n MailjetResponse response = await client.PostAsync(request);\n if (response.IsSuccessStatusCode)\n {\n Console.WriteLine(string.Format(\"Total: {0}, Count: {1}\\n\", response.GetTotal(), response.GetCount()));\n Console.WriteLine(response.GetData());\n }\n else\n {\n Console.WriteLine(string.Format(\"StatusCode: {0}\\n\", response.StatusCode));\n Console.WriteLine(string.Format(\"ErrorInfo: {0}\\n\", response.GetErrorInfo()));\n Console.WriteLine(response.GetData());\n Console.WriteLine(string.Format(\"ErrorMessage: {0}\\n\", response.GetErrorMessage()));\n }\n }\n }\n}"
put:
x-seo:
title: "Update Campaign Draft: Schedule"
description: "Update Campaign Draft: Schedule using the Mailjet Email API. Update the sending schedule of a campaign draft."
tags:
- Campaigns
summary: 'Update Campaign Draft: Schedule'
description: Update the sending schedule of a campaign draft.
operationId: put_v3_campaigndraft_id_schedule
parameters:
- name: draft_ID
in: path
schema:
$ref: '#/components/schemas/put_v3_campaigndraft_id_schedule_PathParams/properties/draft_ID'
required: true
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/UpdateCampaigndraftSchedule'
responses:
'200':
description: Default OK response for `/campaigndraft` action `/schedule`
content:
application/json:
schema:
type: object
properties:
Count:
description: Indicates the number of objects in the `Data` array.
type: integer
format: int64
examples:
- 1
Data:
description: A JSON array containing a list of objects returned by this endpoint.
type: array
items:
$ref: '#/components/schemas/OutputCampaigndraftSchedule'
Total:
description: Indicates the number of objects in the `Data` array.
type: integer
format: int64
examples:
- 1
'400':
$ref: '#/components/responses/400'
'401':
$ref: '#/components/responses/401'
'403':
$ref: '#/components/responses/403'
'404':
$ref: '#/components/responses/404'
'429':
$ref: '#/components/responses/429'
'500':
$ref: '#/components/responses/500'
security:
- basicAuth: []
x-codeSamples:
- lang: curl
label: cURL
source: "curl -s \\\n\t-X PUT \\\n\t--user \"$MJ_APIKEY_PUBLIC:$MJ_APIKEY_PRIVATE\" \\\n\thttps://api.mailjet.com/v3/REST/campaigndraft/$draft_ID/schedule \\\n\t-H 'Content-Type: application/json' \\\n\t-d '{\n \"Date\":\"2018-01-01T00:00:00\"\n\t}'"
- lang: PHP
label: PHP
source: " 'v3']);\n$body = [\n 'Date' => \"2018-01-01T00:00:00\"\n];\n$response = $mj->put(Resources::$CampaigndraftSchedule, ['id' => $id, 'body' => $body]);\n$response->success() && var_dump($response->getData());\n?>"
- lang: Node.js
label: Node
source: "const mailjet = require ('node-mailjet')\n\t.connect(process.env.MJ_APIKEY_PUBLIC, process.env.MJ_APIKEY_PRIVATE)\nconst request = mailjet\n\t.put(\"campaigndraft\", {'version': 'v3'})\n\t.id($draft_ID)\n\t.action(\"schedule\")\n\t.request({\n \"Date\":\"2018-01-01T00:00:00\"\n })\nrequest\n\t.then((result) => {\n\t\tconsole.log(result.body)\n\t})\n\t.catch((err) => {\n\t\tconsole.log(err.statusCode)\n\t})"
- lang: Ruby
label: Ruby
source: "require 'mailjet'\nMailjet.configure do |config|\n config.api_key = ENV['MJ_APIKEY_PUBLIC']\n config.secret_key = ENV['MJ_APIKEY_PRIVATE']\n config.api_version = \"v3\"\nend\ntarget = Mailjet::Campaigndraft_schedule.find($draft_ID)\ntarget.update_attributes(\n date: \"2018-01-01T00:00:00\"\n)\np variable.attributes['Data']"
- lang: Python
label: Python
source: "from mailjet_rest import Client\nimport os\napi_key = os.environ['MJ_APIKEY_PUBLIC']\napi_secret = os.environ['MJ_APIKEY_PRIVATE']\nmailjet = Client(auth=(api_key, api_secret), version='v3')\nid = '$draft_ID'\ndata = {\n 'Date': \"2018-01-01T00:00:00\"\n}\nresult = mailjet.campaigndraft_schedule.update(id=id, data=data)\nprint result.status_code\nprint result.json()"
- lang: Java
label: Java
source: "package com.my.project;\nimport com.mailjet.client.errors.MailjetException;\nimport com.mailjet.client.errors.MailjetSocketTimeoutException;\nimport com.mailjet.client.MailjetClient;\nimport com.mailjet.client.MailjetRequest;\nimport com.mailjet.client.MailjetResponse;\nimport com.mailjet.client.ClientOptions;\nimport com.mailjet.client.resource.CampaigndraftSchedule;\nimport org.json.JSONArray;\nimport org.json.JSONObject;\npublic class MyClass {\n public static void main(String[] args) throws MailjetException, MailjetSocketTimeoutException {\n MailjetClient client;\n MailjetRequest request;\n MailjetResponse response;\n client = new MailjetClient(System.getenv(\"MJ_APIKEY_PUBLIC\"), System.getenv(\"MJ_APIKEY_PRIVATE\"), new ClientOptions(\"v3\"));\n request = new MailjetRequest(CampaigndraftSchedule.resource, ID)\n .property(CampaigndraftSchedule.DATE, \"2018-01-01T00:00:00\")\n );\n response = client.put(request);\n System.out.println(response.getStatus());\n System.out.println(response.getData());\n }\n}"
- lang: Go
label: Go
source: "package main\nimport (\n\t\"fmt\"\n\t\"log\"\n\t\"os\"\n\tmailjet \"github.com/mailjet/mailjet-apiv3-go\"\n\t\"github.com/mailjet/mailjet-apiv3-go/resources\"\n)\nfunc main () {\n\tmailjetClient := NewMailjetClient(os.Getenv(\"MJ_APIKEY_PUBLIC\"), os.Getenv(\"MJ_APIKEY_PRIVATE\"))\n\tmr := &Request{\n\t Resource: \"campaigndraft\",\n\t ID: RESOURCE_ID,\n\t Action: \"schedule\",\n\t}\n\tfmr := &FullRequest{\n\t Info: mr,\n\t Payload: &resources.CampaigndraftSchedule { \n\t Date:\"2018-01-01T00:00:00\"\n }\n\t}\n\terr := mailjetClient.Put(fmr)\n\tif err != nil {\n\t fmt.Println(err)\n\t}\n}"
- lang: C#
label: C#
source: "using Mailjet.Client;\nusing Mailjet.Client.Resources;\nusing System;\nusing Newtonsoft.Json.Linq;\nnamespace Mailjet.ConsoleApplication\n{\n class Program\n {\n static void Main(string[] args)\n {\n RunAsync().Wait();\n }\n static async Task RunAsync()\n {\n MailjetClient client = new MailjetClient(Environment.GetEnvironmentVariable(\"MJ_APIKEY_PUBLIC\"), Environment.GetEnvironmentVariable(\"MJ_APIKEY_PRIVATE\"))\n {\n Version = ApiVersion.V3,\n };\n MailjetRequest request = new MailjetRequest\n {\n Resource = CampaigndraftSchedule.Resource,\n ResourceId = ResourceId.Numeric(ID)\n }\n .Property(CampaigndraftSchedule.Date, \"2018-01-01T00:00:00\");\n MailjetResponse response = await client.PutAsync(request);\n if (response.IsSuccessStatusCode)\n {\n Console.WriteLine(string.Format(\"Total: {0}, Count: {1}\\n\", response.GetTotal(), response.GetCount()));\n Console.WriteLine(response.GetData());\n }\n else\n {\n Console.WriteLine(string.Format(\"StatusCode: {0}\\n\", response.StatusCode));\n Console.WriteLine(string.Format(\"ErrorInfo: {0}\\n\", response.GetErrorInfo()));\n Console.WriteLine(response.GetData());\n Console.WriteLine(string.Format(\"ErrorMessage: {0}\\n\", response.GetErrorMessage()));\n }\n }\n }\n}"
delete:
x-seo:
title: "Delete Campaign Draft: Schedule"
description: "Delete Campaign Draft: Schedule using the Mailjet Email API. Cancel the scheduled sending of a campaign draft."
tags:
- Campaigns
summary: 'Delete Campaign Draft: Schedule'
description: Cancel the scheduled sending of a campaign draft.
operationId: delete_v3_campaigndraft_id_schedule
parameters:
- name: draft_ID
in: path
schema:
$ref: '#/components/schemas/delete_v3_campaigndraft_id_schedule_PathParams/properties/draft_ID'
required: true
responses:
'204':
$ref: '#/components/responses/204'
'400':
$ref: '#/components/responses/400'
'401':
$ref: '#/components/responses/401'
'403':
$ref: '#/components/responses/403'
'404':
$ref: '#/components/responses/404'
'429':
$ref: '#/components/responses/429'
'500':
$ref: '#/components/responses/500'
security:
- basicAuth: []
x-codeSamples:
- lang: curl
label: cURL
source: "curl -s \\\n\t-X DELETE \\\n\t--user \"$MJ_APIKEY_PUBLIC:$MJ_APIKEY_PRIVATE\" \\\n\thttps://api.mailjet.com/v3/REST/campaigndraft/$draft_ID/schedule \\\n\t-H 'Content-Type: application/json' \\\n\t-d '{\n\t}'"
- lang: PHP
label: PHP
source: " 'v3']);\n$response = $mj->delete(Resources::$CampaigndraftSchedule, ['id' => $id]);\n$response->success() && var_dump($response->getData());\n?>"
- lang: Node.js
label: Node
source: "const mailjet = require ('node-mailjet')\n\t.connect(process.env.MJ_APIKEY_PUBLIC, process.env.MJ_APIKEY_PRIVATE)\nconst request = mailjet\n\t.delete(\"campaigndraft\", {'version': 'v3'})\n\t.id($draft_ID)\n\t.action(\"schedule\")\n\t.request()\nrequest\n\t.then((result) => {\n\t\tconsole.log(result.body)\n\t})\n\t.catch((err) => {\n\t\tconsole.log(err.statusCode)\n\t})"
- lang: Ruby
label: Ruby
source: "require 'mailjet'\nMailjet.configure do |config|\n config.api_key = ENV['MJ_APIKEY_PUBLIC']\n config.secret_key = ENV['MJ_APIKEY_PRIVATE']\n config.api_version = \"v3\"\nend\ntarget = Mailjet::Campaigndraft_schedule.find($draft_ID)\ntarget.delete(\n)\np variable.attributes['Data']"
- lang: Python
label: Python
source: "from mailjet_rest import Client\nimport os\napi_key = os.environ['MJ_APIKEY_PUBLIC']\napi_secret = os.environ['MJ_APIKEY_PRIVATE']\nmailjet = Client(auth=(api_key, api_secret), version='v3')\nid = '$draft_ID'\nresult = mailjet.campaigndraft_schedule.delete(id=id)\nprint result.status_code\nprint result.json()"
- lang: Java
label: Java
source: "package com.my.project;\nimport com.mailjet.client.errors.MailjetException;\nimport com.mailjet.client.errors.MailjetSocketTimeoutException;\nimport com.mailjet.client.MailjetClient;\nimport com.mailjet.client.MailjetRequest;\nimport com.mailjet.client.MailjetResponse;\nimport com.mailjet.client.ClientOptions;\nimport com.mailjet.client.resource.CampaigndraftSchedule;\nimport org.json.JSONArray;\nimport org.json.JSONObject;\npublic class MyClass {\n public static void main(String[] args) throws MailjetException, MailjetSocketTimeoutException {\n MailjetClient client;\n MailjetRequest request;\n MailjetResponse response;\n client = new MailjetClient(System.getenv(\"MJ_APIKEY_PUBLIC\"), System.getenv(\"MJ_APIKEY_PRIVATE\"), new ClientOptions(\"v3\"));\n request = new MailjetRequest(CampaigndraftSchedule.resource, ID);\n response = client.delete(request);\n System.out.println(response.getStatus());\n System.out.println(response.getData());\n }\n}"
- lang: Go
label: Go
source: "package main\nimport (\n\t\"fmt\"\n\t\"log\"\n\t\"os\"\n\tmailjet \"github.com/mailjet/mailjet-apiv3-go\"\n\t\"github.com/mailjet/mailjet-apiv3-go/resources\"\n)\nfunc main () {\n\tmailjetClient := NewMailjetClient(os.Getenv(\"MJ_APIKEY_PUBLIC\"), os.Getenv(\"MJ_APIKEY_PRIVATE\"))\n\tmr := &Request{\n\t Resource: \"campaigndraft\",\n\t ID: RESOURCE_ID,\n\t Action: \"schedule\",\n\t}\n\terr := mailjetClient.Delete(mr)\n\tif err != nil {\n\t fmt.Println(err)\n\t}\n}"
- lang: C#
label: C#
source: "using Mailjet.Client;\nusing Mailjet.Client.Resources;\nusing System;\nusing Newtonsoft.Json.Linq;\nnamespace Mailjet.ConsoleApplication\n{\n class Program\n {\n static void Main(string[] args)\n {\n RunAsync().Wait();\n }\n static async Task RunAsync()\n {\n MailjetClient client = new MailjetClient(Environment.GetEnvironmentVariable(\"MJ_APIKEY_PUBLIC\"), Environment.GetEnvironmentVariable(\"MJ_APIKEY_PRIVATE\"))\n {\n Version = ApiVersion.V3,\n };\n MailjetRequest request = new MailjetRequest\n {\n Resource = CampaigndraftSchedule.Resource,\n ResourceId = ResourceId.Numeric(ID)\n }\n MailjetResponse response = await client.DeleteAsync(request);\n if (response.IsSuccessStatusCode)\n {\n Console.WriteLine(string.Format(\"Total: {0}, Count: {1}\\n\", response.GetTotal(), response.GetCount()));\n Console.WriteLine(response.GetData());\n }\n else\n {\n Console.WriteLine(string.Format(\"StatusCode: {0}\\n\", response.StatusCode));\n Console.WriteLine(string.Format(\"ErrorInfo: {0}\\n\", response.GetErrorInfo()));\n Console.WriteLine(response.GetData());\n Console.WriteLine(string.Format(\"ErrorMessage: {0}\\n\", response.GetErrorMessage()));\n }\n }\n }\n}"
/v3/REST/campaigndraft/{draft_ID}/send:
post:
x-seo:
title: "Campaign Draft: Send"
description: "Campaign Draft: Send using the Mailjet Email API. Send a campaign draft immediately."
tags:
- Campaigns
summary: 'Campaign Draft: Send'
description: Send a campaign draft immediately.
operationId: post_v3_campaigndraft_id_send
parameters:
- name: draft_ID
in: path
schema:
$ref: '#/components/schemas/post_v3_campaigndraft_id_send_PathParams/properties/draft_ID'
required: true
responses:
'201':
description: Default OK response for `/campaigndraft` action `/send`
content:
application/json:
schema:
type: object
properties:
Count:
description: Indicates the number of objects in the `Data` array.
type: integer
format: int64
examples:
- 1
Data:
description: A JSON array containing a list of objects returned by this endpoint.
type: array
items:
$ref: '#/components/schemas/ActionStatusCampaigndraftSend'
Total:
description: Indicates the number of objects in the `Data` array.
type: integer
format: int64
examples:
- 1
'400':
$ref: '#/components/responses/400'
'401':
$ref: '#/components/responses/401'
'403':
$ref: '#/components/responses/403'
'404':
$ref: '#/components/responses/404'
'429':
$ref: '#/components/responses/429'
'500':
$ref: '#/components/responses/500'
security:
- basicAuth: []
x-codeSamples:
- lang: curl
label: cURL
source: "curl -s \\\n\t-X POST \\\n\t--user \"$MJ_APIKEY_PUBLIC:$MJ_APIKEY_PRIVATE\" \\\n\thttps://api.mailjet.com/v3/REST/campaigndraft/$draft_ID/send \\\n\t-H 'Content-Type: application/json' \\\n\t-d '{\n\t}'"
- lang: PHP
label: PHP
source: " 'v3']);\n$response = $mj->post(Resources::$CampaigndraftSend, ['id' => $id]);\n$response->success() && var_dump($response->getData());\n?>"
- lang: Node.js
label: Node
source: "const mailjet = require ('node-mailjet')\n\t.connect(process.env.MJ_APIKEY_PUBLIC, process.env.MJ_APIKEY_PRIVATE)\nconst request = mailjet\n\t.post(\"campaigndraft\", {'version': 'v3'})\n\t.id($draft_ID)\n\t.action(\"send\")\n\t.request()\nrequest\n\t.then((result) => {\n\t\tconsole.log(result.body)\n\t})\n\t.catch((err) => {\n\t\tconsole.log(err.statusCode)\n\t})"
- lang: Ruby
label: Ruby
source: "require 'mailjet'\nMailjet.configure do |config|\n config.api_key = ENV['MJ_APIKEY_PUBLIC']\n config.secret_key = ENV['MJ_APIKEY_PRIVATE']\n config.api_version = \"v3\"\nend\nvariable = Mailjet::Campaigndraft_send.create(id: $draft_ID,\n)\np variable.attributes['Data']"
- lang: Python
label: Python
source: "from mailjet_rest import Client\nimport os\napi_key = os.environ['MJ_APIKEY_PUBLIC']\napi_secret = os.environ['MJ_APIKEY_PRIVATE']\nmailjet = Client(auth=(api_key, api_secret), version='v3')\nid = '$draft_ID'\nresult = mailjet.campaigndraft_send.create(id=id)\nprint result.status_code\nprint result.json()"
- lang: Java
label: Java
source: "package com.my.project;\nimport com.mailjet.client.errors.MailjetException;\nimport com.mailjet.client.errors.MailjetSocketTimeoutException;\nimport com.mailjet.client.MailjetClient;\nimport com.mailjet.client.MailjetRequest;\nimport com.mailjet.client.MailjetResponse;\nimport com.mailjet.client.ClientOptions;\nimport com.mailjet.client.resource.CampaigndraftSend;\nimport org.json.JSONArray;\nimport org.json.JSONObject;\npublic class MyClass {\n public static void main(String[] args) throws MailjetException, MailjetSocketTimeoutException {\n MailjetClient client;\n MailjetRequest request;\n MailjetResponse response;\n client = new MailjetClient(System.getenv(\"MJ_APIKEY_PUBLIC\"), System.getenv(\"MJ_APIKEY_PRIVATE\"), new ClientOptions(\"v3\"));\n request = new MailjetRequest(CampaigndraftSend.resource, ID);\n response = client.post(request);\n System.out.println(response.getStatus());\n System.out.println(response.getData());\n }\n}"
- lang: Go
label: Go
source: "package main\nimport (\n\t\"fmt\"\n\t\"log\"\n\t\"os\"\n\tmailjet \"github.com/mailjet/mailjet-apiv3-go\"\n\t\"github.com/mailjet/mailjet-apiv3-go/resources\"\n)\nfunc main () {\n\tmailjetClient := NewMailjetClient(os.Getenv(\"MJ_APIKEY_PUBLIC\"), os.Getenv(\"MJ_APIKEY_PRIVATE\"))\n\tvar data []resources.CampaigndraftSend\n\tmr := &Request{\n\t Resource: \"campaigndraft\",\n\t ID: RESOURCE_ID,\n\t Action: \"send\",\n\t}\n\tfmr := &FullRequest{\n\t Info: mr,\n\t Payload: &resources.CampaigndraftSend { }\n\t}\n\terr := mailjetClient.Post(fmr, &data)\n\tif err != nil {\n\t fmt.Println(err)\n\t}\n\tfmt.Printf(\"Data array: %+v\\n\", data)\n}"
- lang: C#
label: C#
source: "using Mailjet.Client;\nusing Mailjet.Client.Resources;\nusing System;\nusing Newtonsoft.Json.Linq;\nnamespace Mailjet.ConsoleApplication\n{\n class Program\n {\n static void Main(string[] args)\n {\n RunAsync().Wait();\n }\n static async Task RunAsync()\n {\n MailjetClient client = new MailjetClient(Environment.GetEnvironmentVariable(\"MJ_APIKEY_PUBLIC\"), Environment.GetEnvironmentVariable(\"MJ_APIKEY_PRIVATE\"))\n {\n Version = ApiVersion.V3,\n };\n MailjetRequest request = new MailjetRequest\n {\n Resource = CampaigndraftSend.Resource,\n ResourceId = ResourceId.Numeric(ID)\n }\n MailjetResponse response = await client.PostAsync(request);\n if (response.IsSuccessStatusCode)\n {\n Console.WriteLine(string.Format(\"Total: {0}, Count: {1}\\n\", response.GetTotal(), response.GetCount()));\n Console.WriteLine(response.GetData());\n }\n else\n {\n Console.WriteLine(string.Format(\"StatusCode: {0}\\n\", response.StatusCode));\n Console.WriteLine(string.Format(\"ErrorInfo: {0}\\n\", response.GetErrorInfo()));\n Console.WriteLine(response.GetData());\n Console.WriteLine(string.Format(\"ErrorMessage: {0}\\n\", response.GetErrorMessage()));\n }\n }\n }\n}"
/v3/REST/campaigndraft/{draft_ID}/status:
get:
x-seo:
title: "Get Campaign Draft: Status"
description: "Get Campaign Draft: Status using the Mailjet Email API. View the sending status of a campaign draft."
tags:
- Campaigns
summary: 'Get Campaign Draft: Status'
description: View the sending status of a campaign draft. To obtain a valid `draft_ID`, first call `GET /v3/REST/campaigndraft` to list your campaign drafts.
operationId: get_v3_campaigndraft_id_status
parameters:
- name: draft_ID
in: path
schema:
$ref: '#/components/schemas/get_v3_campaigndraft_id_status_PathParams/properties/draft_ID'
required: true
example: 4000
responses:
'200':
description: Default Ok response for `/campaigndraft` action `/status`
content:
application/json:
schema:
type: object
properties:
Count:
description: Indicates the number of objects in the `Data` array.
type: integer
format: int64
examples:
- 1
Data:
description: A JSON array containing a list of objects returned by this endpoint.
type: array
items:
$ref: '#/components/schemas/ActionStatusCampaigndraftStatus'
Total:
description: Indicates the number of objects in the `Data` array.
type: integer
format: int64
examples:
- 1
'400':
$ref: '#/components/responses/400'
'401':
$ref: '#/components/responses/401'
'403':
$ref: '#/components/responses/403'
'404':
$ref: '#/components/responses/404'
'429':
$ref: '#/components/responses/429'
'500':
$ref: '#/components/responses/500'
security:
- basicAuth: []
x-codeSamples:
- lang: curl
label: cURL
source: "curl -s \\\n\t-X GET \\\n\t--user \"$MJ_APIKEY_PUBLIC:$MJ_APIKEY_PRIVATE\" \\\n\thttps://api.mailjet.com/v3/REST/campaigndraft/$draft_ID/status \\"
- lang: PHP
label: PHP
source: " 'v3']);\n$response = $mj->get(Resources::$CampaigndraftStatus, ['id' => $id]);\n$response->success() && var_dump($response->getData());\n?>"
- lang: Node.js
label: Node
source: "const mailjet = require ('node-mailjet')\n\t.connect(process.env.MJ_APIKEY_PUBLIC, process.env.MJ_APIKEY_PRIVATE)\nconst request = mailjet\n\t.get(\"campaigndraft\", {'version': 'v3'})\n\t.id($draft_ID)\n\t.action(\"status\")\n\t.request()\nrequest\n\t.then((result) => {\n\t\tconsole.log(result.body)\n\t})\n\t.catch((err) => {\n\t\tconsole.log(err.statusCode)\n\t})"
- lang: Ruby
label: Ruby
source: "require 'mailjet'\nMailjet.configure do |config|\n config.api_key = ENV['MJ_APIKEY_PUBLIC']\n config.secret_key = ENV['MJ_APIKEY_PRIVATE']\n config.api_version = \"v3\"\nend\nvariable = Mailjet::Campaigndraft_status.find($draft_ID\n)\np variable.attributes['Data']"
- lang: Python
label: Python
source: "from mailjet_rest import Client\nimport os\napi_key = os.environ['MJ_APIKEY_PUBLIC']\napi_secret = os.environ['MJ_APIKEY_PRIVATE']\nmailjet = Client(auth=(api_key, api_secret), version='v3')\nid = '$draft_ID'\nresult = mailjet.campaigndraft_status.get(id=id)\nprint result.status_code\nprint result.json()"
- lang: Java
label: Java
source: "package com.my.project;\nimport com.mailjet.client.errors.MailjetException;\nimport com.mailjet.client.errors.MailjetSocketTimeoutException;\nimport com.mailjet.client.MailjetClient;\nimport com.mailjet.client.MailjetRequest;\nimport com.mailjet.client.MailjetResponse;\nimport com.mailjet.client.ClientOptions;\nimport com.mailjet.client.resource.CampaigndraftStatus;\nimport org.json.JSONArray;\nimport org.json.JSONObject;\npublic class MyClass {\n public static void main(String[] args) throws MailjetException, MailjetSocketTimeoutException {\n MailjetClient client;\n MailjetRequest request;\n MailjetResponse response;\n client = new MailjetClient(System.getenv(\"MJ_APIKEY_PUBLIC\"), System.getenv(\"MJ_APIKEY_PRIVATE\"), new ClientOptions(\"v3\"));\n request = new MailjetRequest(CampaigndraftStatus.resource, ID);\n response = client.get(request);\n System.out.println(response.getStatus());\n System.out.println(response.getData());\n }\n}"
- lang: Go
label: Go
source: "package main\nimport (\n\t\"fmt\"\n\t\"log\"\n\t\"os\"\n\tmailjet \"github.com/mailjet/mailjet-apiv3-go\"\n\t\"github.com/mailjet/mailjet-apiv3-go/resources\"\n)\nfunc main () {\n\tmailjetClient := NewMailjetClient(os.Getenv(\"MJ_APIKEY_PUBLIC\"), os.Getenv(\"MJ_APIKEY_PRIVATE\"))\n\tvar data []resources.CampaigndraftStatus\n\tmr := &Request{\n\t Resource: \"campaigndraft\",\n\t ID: RESOURCE_ID,\n\t Action: \"status\",\n\t}\n\terr := mailjetClient.Get(mr, &data)\n\tif err != nil {\n\t fmt.Println(err)\n\t}\n\tfmt.Printf(\"Data array: %+v\\n\", data)\n}"
- lang: C#
label: C#
source: "using Mailjet.Client;\nusing Mailjet.Client.Resources;\nusing System;\nusing Newtonsoft.Json.Linq;\nnamespace Mailjet.ConsoleApplication\n{\n class Program\n {\n static void Main(string[] args)\n {\n RunAsync().Wait();\n }\n static async Task RunAsync()\n {\n MailjetClient client = new MailjetClient(Environment.GetEnvironmentVariable(\"MJ_APIKEY_PUBLIC\"), Environment.GetEnvironmentVariable(\"MJ_APIKEY_PRIVATE\"))\n {\n Version = ApiVersion.V3,\n };\n MailjetRequest request = new MailjetRequest\n {\n Resource = CampaigndraftStatus.Resource,\n ResourceId = ResourceId.Numeric(ID)\n }\n MailjetResponse response = await client.GetAsync(request);\n if (response.IsSuccessStatusCode)\n {\n Console.WriteLine(string.Format(\"Total: {0}, Count: {1}\\n\", response.GetTotal(), response.GetCount()));\n Console.WriteLine(response.GetData());\n }\n else\n {\n Console.WriteLine(string.Format(\"StatusCode: {0}\\n\", response.StatusCode));\n Console.WriteLine(string.Format(\"ErrorInfo: {0}\\n\", response.GetErrorInfo()));\n Console.WriteLine(response.GetData());\n Console.WriteLine(string.Format(\"ErrorMessage: {0}\\n\", response.GetErrorMessage()));\n }\n }\n }\n}"
"/v3/REST/campaign":
get:
x-seo:
title: "Campaign List"
description: "Retrieve details about a list of sent campaigns - creation and sending time, sender, subject, tracking options enabled etc. Each e-mail going through\u2026"
tags:
- Campaigns
summary: Campaign List
description: "Retrieve details about a list of sent campaigns - creation and sending time, sender, subject, tracking options enabled etc. Each e-mail going through Mailjet is attached to a Campaign. This object is automatically generated by Mailjet.\n\n> Note: If no query parameters are used, only campaigns sent since 00:00 UTC on the current day will be returned.\n"
operationId: get_v3_campaign
parameters:
- name: CampaignID
in: query
schema:
$ref: '#/components/schemas/get_v3_campaign_QueryParams/properties/CampaignID'
- name: ContactsListID
in: query
schema:
$ref: '#/components/schemas/get_v3_campaign_QueryParams/properties/ContactsListID'
- name: CustomCampaign
in: query
schema:
$ref: '#/components/schemas/get_v3_campaign_QueryParams/properties/CustomCampaign'
- name: From
in: query
schema:
$ref: '#/components/schemas/get_v3_campaign_QueryParams/properties/From'
- name: FromDomain
in: query
schema:
$ref: '#/components/schemas/get_v3_campaign_QueryParams/properties/FromDomain'
- name: FromID
in: query
schema:
$ref: '#/components/schemas/get_v3_campaign_QueryParams/properties/FromID'
- name: FromTS
in: query
schema:
$ref: '#/components/schemas/get_v3_campaign_QueryParams/properties/FromTS'
- name: FromType
in: query
schema:
$ref: '#/components/schemas/get_v3_campaign_QueryParams/properties/FromType'
- name: IsDeleted
in: query
schema:
$ref: '#/components/schemas/get_v3_campaign_QueryParams/properties/IsDeleted'
- name: IsNewsletterTool
in: query
schema:
$ref: '#/components/schemas/get_v3_campaign_QueryParams/properties/IsNewsletterTool'
- name: IsStarred
in: query
schema:
$ref: '#/components/schemas/get_v3_campaign_QueryParams/properties/IsStarred'
- name: Period
in: query
schema:
$ref: '#/components/schemas/get_v3_campaign_QueryParams/properties/Period'
- name: ToTS
in: query
schema:
$ref: '#/components/schemas/get_v3_campaign_QueryParams/properties/ToTS'
- name: WorkflowID
in: query
schema:
$ref: '#/components/schemas/get_v3_campaign_QueryParams/properties/WorkflowID'
responses:
'200':
description: Default OK response for `/campaign`
content:
application/json:
schema:
type: object
properties:
Count:
description: Indicates the number of objects in the `Data` array.
type: integer
format: int64
examples:
- 1
Data:
description: A JSON array containing a list of objects returned by this endpoint.
type: array
items:
$ref: '#/components/schemas/OutputCampaign'
Total:
description: Indicates the number of objects in the `Data` array.
type: integer
format: int64
examples:
- 1
'400':
$ref: '#/components/responses/400'
'401':
$ref: '#/components/responses/401'
'403':
$ref: '#/components/responses/403'
'404':
$ref: '#/components/responses/404'
'429':
$ref: '#/components/responses/429'
'500':
$ref: '#/components/responses/500'
security:
- basicAuth: []
x-codeSamples:
- lang: curl
label: cURL
source: "curl -s \\\n\t-X GET \\\n\t--user \"$MJ_APIKEY_PUBLIC:$MJ_APIKEY_PRIVATE\" \\\n\thttps://api.mailjet.com/v3/REST/campaign \\"
- lang: PHP
label: PHP
source: " 'v3']);\n$response = $mj->get(Resources::$Campaign);\n$response->success() && var_dump($response->getData());\n?>"
- lang: Node.js
label: Node
source: "const mailjet = require ('node-mailjet')\n\t.connect(process.env.MJ_APIKEY_PUBLIC, process.env.MJ_APIKEY_PRIVATE)\nconst request = mailjet\n\t.get(\"campaign\", {'version': 'v3'})\n\t.request()\nrequest\n\t.then((result) => {\n\t\tconsole.log(result.body)\n\t})\n\t.catch((err) => {\n\t\tconsole.log(err.statusCode)\n\t})"
- lang: Ruby
label: Ruby
source: "require 'mailjet'\nMailjet.configure do |config|\n config.api_key = ENV['MJ_APIKEY_PUBLIC']\n config.secret_key = ENV['MJ_APIKEY_PRIVATE']\n config.api_version = \"v3\"\nend\nvariable = Mailjet::Campaign.all(\n)\np variable.attributes['Data']"
- lang: Python
label: Python
source: "from mailjet_rest import Client\nimport os\napi_key = os.environ['MJ_APIKEY_PUBLIC']\napi_secret = os.environ['MJ_APIKEY_PRIVATE']\nmailjet = Client(auth=(api_key, api_secret), version='v3')\nresult = mailjet.campaign.get()\nprint result.status_code\nprint result.json()"
- lang: Java
label: Java
source: "package com.my.project;\nimport com.mailjet.client.errors.MailjetException;\nimport com.mailjet.client.errors.MailjetSocketTimeoutException;\nimport com.mailjet.client.MailjetClient;\nimport com.mailjet.client.MailjetRequest;\nimport com.mailjet.client.MailjetResponse;\nimport com.mailjet.client.ClientOptions;\nimport com.mailjet.client.resource.Campaign;\nimport org.json.JSONArray;\nimport org.json.JSONObject;\npublic class MyClass {\n public static void main(String[] args) throws MailjetException, MailjetSocketTimeoutException {\n MailjetClient client;\n MailjetRequest request;\n MailjetResponse response;\n client = new MailjetClient(System.getenv(\"MJ_APIKEY_PUBLIC\"), System.getenv(\"MJ_APIKEY_PRIVATE\"), new ClientOptions(\"v3\"));\n request = new MailjetRequest(Campaign.resource);\n response = client.get(request);\n System.out.println(response.getStatus());\n System.out.println(response.getData());\n }\n}"
- lang: Go
label: Go
source: "package main\nimport (\n\t\"fmt\"\n\t\"log\"\n\t\"os\"\n\tmailjet \"github.com/mailjet/mailjet-apiv3-go\"\n\t\"github.com/mailjet/mailjet-apiv3-go/resources\"\n)\nfunc main () {\n\tmailjetClient := NewMailjetClient(os.Getenv(\"MJ_APIKEY_PUBLIC\"), os.Getenv(\"MJ_APIKEY_PRIVATE\"))\n\tvar data []resources.Campaign\n\t_, _, err := mailjetClient.List(\"campaign\", &data)\n\tif err != nil {\n\t fmt.Println(err)\n\t}\n\tfmt.Printf(\"Data array: %+v\\n\", data)\n}"
- lang: C#
label: C#
source: "using Mailjet.Client;\nusing Mailjet.Client.Resources;\nusing System;\nusing Newtonsoft.Json.Linq;\nnamespace Mailjet.ConsoleApplication\n{\n class Program\n {\n static void Main(string[] args)\n {\n RunAsync().Wait();\n }\n static async Task RunAsync()\n {\n MailjetClient client = new MailjetClient(Environment.GetEnvironmentVariable(\"MJ_APIKEY_PUBLIC\"), Environment.GetEnvironmentVariable(\"MJ_APIKEY_PRIVATE\"))\n {\n Version = ApiVersion.V3,\n };\n MailjetRequest request = new MailjetRequest\n {\n Resource = Campaign.Resource,\n }\n MailjetResponse response = await client.GetAsync(request);\n if (response.IsSuccessStatusCode)\n {\n Console.WriteLine(string.Format(\"Total: {0}, Count: {1}\\n\", response.GetTotal(), response.GetCount()));\n Console.WriteLine(response.GetData());\n }\n else\n {\n Console.WriteLine(string.Format(\"StatusCode: {0}\\n\", response.StatusCode));\n Console.WriteLine(string.Format(\"ErrorInfo: {0}\\n\", response.GetErrorInfo()));\n Console.WriteLine(response.GetData());\n Console.WriteLine(string.Format(\"ErrorMessage: {0}\\n\", response.GetErrorMessage()));\n }\n }\n }\n}"
"/v3/REST/campaign/{campaign_ID}":
get:
x-seo:
title: "Campaign by ID"
description: "Retrieve details about a specific campaign - creation and sending time, sender, subject, tracking options enabled etc. Each e-mail going through Mailjet\u2026"
tags:
- Campaigns
summary: Campaign by ID
description: Retrieve details about a specific campaign - creation and sending time, sender, subject, tracking options enabled etc. Each e-mail going through Mailjet is attached to a Campaign. This object is automatically generated by Mailjet. To obtain a valid `campaign_ID`, first call `GET /v3/REST/campaign` to list your campaigns.
operationId: get_v3_campaign_id
parameters:
- name: campaign_ID
in: path
schema:
$ref: '#/components/schemas/get_v3_campaign_id_PathParams/properties/campaign_ID'
required: true
example: 6000
responses:
'200':
description: Default OK response for `/campaign`
content:
application/json:
schema:
type: object
properties:
Count:
description: Indicates the number of objects in the `Data` array.
type: integer
format: int64
examples:
- 1
Data:
description: A JSON array containing a list of objects returned by this endpoint.
type: array
items:
$ref: '#/components/schemas/OutputCampaign'
Total:
description: Indicates the number of objects in the `Data` array.
type: integer
format: int64
examples:
- 1
'400':
$ref: '#/components/responses/400'
'401':
$ref: '#/components/responses/401'
'403':
$ref: '#/components/responses/403'
'404':
$ref: '#/components/responses/404'
'429':
$ref: '#/components/responses/429'
'500':
$ref: '#/components/responses/500'
security:
- basicAuth: []
x-codeSamples:
- lang: curl
label: cURL
source: "curl -s \\\n\t-X GET \\\n\t--user \"$MJ_APIKEY_PUBLIC:$MJ_APIKEY_PRIVATE\" \\\n\thttps://api.mailjet.com/v3/REST/campaign/$campaign_ID \\"
- lang: PHP
label: PHP
source: " 'v3']);\n$response = $mj->get(Resources::$Campaign, ['id' => $id]);\n$response->success() && var_dump($response->getData());\n?>"
- lang: Node.js
label: Node
source: "const mailjet = require ('node-mailjet')\n\t.connect(process.env.MJ_APIKEY_PUBLIC, process.env.MJ_APIKEY_PRIVATE)\nconst request = mailjet\n\t.get(\"campaign\", {'version': 'v3'})\n\t.id($campaign_ID)\n\t.request()\nrequest\n\t.then((result) => {\n\t\tconsole.log(result.body)\n\t})\n\t.catch((err) => {\n\t\tconsole.log(err.statusCode)\n\t})"
- lang: Ruby
label: Ruby
source: "require 'mailjet'\nMailjet.configure do |config|\n config.api_key = ENV['MJ_APIKEY_PUBLIC']\n config.secret_key = ENV['MJ_APIKEY_PRIVATE']\n config.api_version = \"v3\"\nend\nvariable = Mailjet::Campaign.find($campaign_ID\n)\np variable.attributes['Data']"
- lang: Python
label: Python
source: "from mailjet_rest import Client\nimport os\napi_key = os.environ['MJ_APIKEY_PUBLIC']\napi_secret = os.environ['MJ_APIKEY_PRIVATE']\nmailjet = Client(auth=(api_key, api_secret), version='v3')\nid = '$campaign_ID'\nresult = mailjet.campaign.get(id=id)\nprint result.status_code\nprint result.json()"
- lang: Java
label: Java
source: "package com.my.project;\nimport com.mailjet.client.errors.MailjetException;\nimport com.mailjet.client.errors.MailjetSocketTimeoutException;\nimport com.mailjet.client.MailjetClient;\nimport com.mailjet.client.MailjetRequest;\nimport com.mailjet.client.MailjetResponse;\nimport com.mailjet.client.ClientOptions;\nimport com.mailjet.client.resource.Campaign;\nimport org.json.JSONArray;\nimport org.json.JSONObject;\npublic class MyClass {\n public static void main(String[] args) throws MailjetException, MailjetSocketTimeoutException {\n MailjetClient client;\n MailjetRequest request;\n MailjetResponse response;\n client = new MailjetClient(System.getenv(\"MJ_APIKEY_PUBLIC\"), System.getenv(\"MJ_APIKEY_PRIVATE\"), new ClientOptions(\"v3\"));\n request = new MailjetRequest(Campaign.resource, ID);\n response = client.get(request);\n System.out.println(response.getStatus());\n System.out.println(response.getData());\n }\n}"
- lang: Go
label: Go
source: "package main\nimport (\n\t\"fmt\"\n\t\"log\"\n\t\"os\"\n\tmailjet \"github.com/mailjet/mailjet-apiv3-go\"\n\t\"github.com/mailjet/mailjet-apiv3-go/resources\"\n)\nfunc main () {\n\tmailjetClient := NewMailjetClient(os.Getenv(\"MJ_APIKEY_PUBLIC\"), os.Getenv(\"MJ_APIKEY_PRIVATE\"))\n\tvar data []resources.Campaign\n\tmr := &Request{\n\t Resource: \"campaign\",\n\t ID: RESOURCE_ID,\n\t}\n\terr := mailjetClient.Get(mr, &data)\n\tif err != nil {\n\t fmt.Println(err)\n\t}\n\tfmt.Printf(\"Data array: %+v\\n\", data)\n}"
- lang: C#
label: C#
source: "using Mailjet.Client;\nusing Mailjet.Client.Resources;\nusing System;\nusing Newtonsoft.Json.Linq;\nnamespace Mailjet.ConsoleApplication\n{\n class Program\n {\n static void Main(string[] args)\n {\n RunAsync().Wait();\n }\n static async Task RunAsync()\n {\n MailjetClient client = new MailjetClient(Environment.GetEnvironmentVariable(\"MJ_APIKEY_PUBLIC\"), Environment.GetEnvironmentVariable(\"MJ_APIKEY_PRIVATE\"))\n {\n Version = ApiVersion.V3,\n };\n MailjetRequest request = new MailjetRequest\n {\n Resource = Campaign.Resource,\n ResourceId = ResourceId.Numeric(ID)\n }\n MailjetResponse response = await client.GetAsync(request);\n if (response.IsSuccessStatusCode)\n {\n Console.WriteLine(string.Format(\"Total: {0}, Count: {1}\\n\", response.GetTotal(), response.GetCount()));\n Console.WriteLine(response.GetData());\n }\n else\n {\n Console.WriteLine(string.Format(\"StatusCode: {0}\\n\", response.StatusCode));\n Console.WriteLine(string.Format(\"ErrorInfo: {0}\\n\", response.GetErrorInfo()));\n Console.WriteLine(response.GetData());\n Console.WriteLine(string.Format(\"ErrorMessage: {0}\\n\", response.GetErrorMessage()));\n }\n }\n }\n}"
put:
x-seo:
title: "Update Campaign"
description: "Manage the deletion and \"starred\" status of a campaign. Each e-mail going through Mailjet is attached to a Campaign. This object is automatically\u2026"
tags:
- Campaigns
summary: Update Campaign
description: Manage the deletion and "starred" status of a campaign. Each e-mail going through Mailjet is attached to a Campaign. This object is automatically generated by Mailjet. To obtain a valid `campaign_ID`, first call `GET /v3/REST/campaign` to list your campaigns.
operationId: put_v3_campaign_id
parameters:
- name: campaign_ID
in: path
schema:
$ref: '#/components/schemas/put_v3_campaign_id_PathParams/properties/campaign_ID'
required: true
example: 6000
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/UpdateCampaign'
example:
IsDeleted: false
IsStarred: false
responses:
'200':
description: Default OK response for `/campaign`
content:
application/json:
schema:
type: object
properties:
Count:
description: Indicates the number of objects in the `Data` array.
type: integer
format: int64
examples:
- 1
Data:
description: A JSON array containing a list of objects returned by this endpoint.
type: array
items:
$ref: '#/components/schemas/OutputCampaign'
Total:
description: Indicates the number of objects in the `Data` array.
type: integer
format: int64
examples:
- 1
'400':
$ref: '#/components/responses/400'
'401':
$ref: '#/components/responses/401'
'403':
$ref: '#/components/responses/403'
'404':
$ref: '#/components/responses/404'
'429':
$ref: '#/components/responses/429'
'500':
$ref: '#/components/responses/500'
security:
- basicAuth: []
x-codeSamples:
- lang: curl
label: cURL
source: "curl -s \\\n\t-X PUT \\\n\t--user \"$MJ_APIKEY_PUBLIC:$MJ_APIKEY_PRIVATE\" \\\n\thttps://api.mailjet.com/v3/REST/campaign/$campaign_ID \\\n\t-H 'Content-Type: application/json' \\\n\t-d '{\n \"IsDeleted\":false,\n \"IsStarred\":false\n\t}'"
- lang: PHP
label: PHP
source: " 'v3']);\n$body = [\n 'IsDeleted' => false,\n 'IsStarred' => false\n];\n$response = $mj->put(Resources::$Campaign, ['id' => $id, 'body' => $body]);\n$response->success() && var_dump($response->getData());\n?>"
- lang: Node.js
label: Node
source: "const mailjet = require ('node-mailjet')\n\t.connect(process.env.MJ_APIKEY_PUBLIC, process.env.MJ_APIKEY_PRIVATE)\nconst request = mailjet\n\t.put(\"campaign\", {'version': 'v3'})\n\t.id($campaign_ID)\n\t.request({\n \"IsDeleted\":false,\n \"IsStarred\":false\n })\nrequest\n\t.then((result) => {\n\t\tconsole.log(result.body)\n\t})\n\t.catch((err) => {\n\t\tconsole.log(err.statusCode)\n\t})"
- lang: Ruby
label: Ruby
source: "require 'mailjet'\nMailjet.configure do |config|\n config.api_key = ENV['MJ_APIKEY_PUBLIC']\n config.secret_key = ENV['MJ_APIKEY_PRIVATE']\n config.api_version = \"v3\"\nend\ntarget = Mailjet::Campaign.find($campaign_ID)\ntarget.update_attributes(\n is_deleted: false,\n is_starred: false\n)\np variable.attributes['Data']"
- lang: Python
label: Python
source: "from mailjet_rest import Client\nimport os\napi_key = os.environ['MJ_APIKEY_PUBLIC']\napi_secret = os.environ['MJ_APIKEY_PRIVATE']\nmailjet = Client(auth=(api_key, api_secret), version='v3')\nid = '$campaign_ID'\ndata = {\n 'IsDeleted': False,\n 'IsStarred': False\n}\nresult = mailjet.campaign.update(id=id, data=data)\nprint result.status_code\nprint result.json()"
- lang: Java
label: Java
source: "package com.my.project;\nimport com.mailjet.client.errors.MailjetException;\nimport com.mailjet.client.errors.MailjetSocketTimeoutException;\nimport com.mailjet.client.MailjetClient;\nimport com.mailjet.client.MailjetRequest;\nimport com.mailjet.client.MailjetResponse;\nimport com.mailjet.client.ClientOptions;\nimport com.mailjet.client.resource.Campaign;\nimport org.json.JSONArray;\nimport org.json.JSONObject;\npublic class MyClass {\n public static void main(String[] args) throws MailjetException, MailjetSocketTimeoutException {\n MailjetClient client;\n MailjetRequest request;\n MailjetResponse response;\n client = new MailjetClient(System.getenv(\"MJ_APIKEY_PUBLIC\"), System.getenv(\"MJ_APIKEY_PRIVATE\"), new ClientOptions(\"v3\"));\n request = new MailjetRequest(Campaign.resource, ID)\n .property(Campaign.ISDELETED, false)\n .property(Campaign.ISSTARRED, false)\n );\n response = client.put(request);\n System.out.println(response.getStatus());\n System.out.println(response.getData());\n }\n}"
- lang: Go
label: Go
source: "package main\nimport (\n\t\"fmt\"\n\t\"log\"\n\t\"os\"\n\tmailjet \"github.com/mailjet/mailjet-apiv3-go\"\n\t\"github.com/mailjet/mailjet-apiv3-go/resources\"\n)\nfunc main () {\n\tmailjetClient := NewMailjetClient(os.Getenv(\"MJ_APIKEY_PUBLIC\"), os.Getenv(\"MJ_APIKEY_PRIVATE\"))\n\tmr := &Request{\n\t Resource: \"campaign\",\n\t ID: RESOURCE_ID,\n\t}\n\tfmr := &FullRequest{\n\t Info: mr,\n\t Payload: &resources.Campaign { \n\t IsDeleted:false,\n\t IsStarred:false\n }\n\t}\n\terr := mailjetClient.Put(fmr)\n\tif err != nil {\n\t fmt.Println(err)\n\t}\n}"
- lang: C#
label: C#
source: "using Mailjet.Client;\nusing Mailjet.Client.Resources;\nusing System;\nusing Newtonsoft.Json.Linq;\nnamespace Mailjet.ConsoleApplication\n{\n class Program\n {\n static void Main(string[] args)\n {\n RunAsync().Wait();\n }\n static async Task RunAsync()\n {\n MailjetClient client = new MailjetClient(Environment.GetEnvironmentVariable(\"MJ_APIKEY_PUBLIC\"), Environment.GetEnvironmentVariable(\"MJ_APIKEY_PRIVATE\"))\n {\n Version = ApiVersion.V3,\n };\n MailjetRequest request = new MailjetRequest\n {\n Resource = Campaign.Resource,\n ResourceId = ResourceId.Numeric(ID)\n }\n .Property(Campaign.IsDeleted, false)\n .Property(Campaign.IsStarred, false);\n MailjetResponse response = await client.PutAsync(request);\n if (response.IsSuccessStatusCode)\n {\n Console.WriteLine(string.Format(\"Total: {0}, Count: {1}\\n\", response.GetTotal(), response.GetCount()));\n Console.WriteLine(response.GetData());\n }\n else\n {\n Console.WriteLine(string.Format(\"StatusCode: {0}\\n\", response.StatusCode));\n Console.WriteLine(string.Format(\"ErrorInfo: {0}\\n\", response.GetErrorInfo()));\n Console.WriteLine(response.GetData());\n Console.WriteLine(string.Format(\"ErrorMessage: {0}\\n\", response.GetErrorMessage()));\n }\n }\n }\n}"
"/v3/REST/sender":
get:
x-seo:
title: "Sender List"
description: "Get information on a list of sender email addresses and/or domains. The e-mail address or domain has to be registered and validated before being used to\u2026"
tags:
- Sender Addresses and Domains
summary: Sender List
description: "Get information on a list of sender email addresses and/or domains. The e-mail address or domain has to be registered and validated before being used to send e-mails. Validation is done via `/sender/{sender_id}/validate`. In order to manage a sender available across multiple API Keys, see the related `/metasender` resource.\n\n> Note: The maximum number of senders and metasenders per user is 100. This includes both validated (`Active`) and non-validated (`Inactive`) ones, but does not include `Deleted` senders / metasenders.\n"
operationId: get_v3_sender
parameters:
- name: DnsID
in: query
schema:
$ref: '#/components/schemas/get_v3_sender_QueryParams/properties/DnsID'
- name: Domain
in: query
schema:
$ref: '#/components/schemas/get_v3_sender_QueryParams/properties/Domain'
- name: Email
in: query
schema:
$ref: '#/components/schemas/get_v3_sender_QueryParams/properties/Email'
- name: IsDomainSender
in: query
schema:
$ref: '#/components/schemas/get_v3_sender_QueryParams/properties/IsDomainSender'
- name: LocalPart
in: query
schema:
$ref: '#/components/schemas/get_v3_sender_QueryParams/properties/LocalPart'
- name: ShowDeleted
in: query
schema:
$ref: '#/components/schemas/get_v3_sender_QueryParams/properties/ShowDeleted'
- name: Status
in: query
schema:
$ref: '#/components/schemas/get_v3_sender_QueryParams/properties/Status'
responses:
'200':
description: Default OK response for `/sender`
content:
application/json:
schema:
type: object
properties:
Count:
description: Indicates the number of objects in the `Data` array.
type: integer
format: int64
examples:
- 1
Data:
description: A JSON array containing a list of objects returned by this endpoint.
type: array
items:
$ref: '#/components/schemas/OutputSender'
Total:
description: Indicates the number of objects in the `Data` array.
type: integer
format: int64
examples:
- 1
'400':
$ref: '#/components/responses/400'
'401':
$ref: '#/components/responses/401'
'403':
$ref: '#/components/responses/403'
'404':
$ref: '#/components/responses/404'
'429':
$ref: '#/components/responses/429'
'500':
$ref: '#/components/responses/500'
security:
- basicAuth: []
x-codeSamples:
- lang: curl
label: cURL
source: "curl -s \\\n\t-X GET \\\n\t--user \"$MJ_APIKEY_PUBLIC:$MJ_APIKEY_PRIVATE\" \\\n\thttps://api.mailjet.com/v3/REST/sender \\"
- lang: PHP
label: PHP
source: " 'v3']);\n$response = $mj->get(Resources::$Sender);\n$response->success() && var_dump($response->getData());\n?>"
- lang: Node.js
label: Node
source: "const mailjet = require ('node-mailjet')\n\t.connect(process.env.MJ_APIKEY_PUBLIC, process.env.MJ_APIKEY_PRIVATE)\nconst request = mailjet\n\t.get(\"sender\", {'version': 'v3'})\n\t.request()\nrequest\n\t.then((result) => {\n\t\tconsole.log(result.body)\n\t})\n\t.catch((err) => {\n\t\tconsole.log(err.statusCode)\n\t})"
- lang: Ruby
label: Ruby
source: "require 'mailjet'\nMailjet.configure do |config|\n config.api_key = ENV['MJ_APIKEY_PUBLIC']\n config.secret_key = ENV['MJ_APIKEY_PRIVATE']\n config.api_version = \"v3\"\nend\nvariable = Mailjet::Sender.all(\n)\np variable.attributes['Data']"
- lang: Python
label: Python
source: "from mailjet_rest import Client\nimport os\napi_key = os.environ['MJ_APIKEY_PUBLIC']\napi_secret = os.environ['MJ_APIKEY_PRIVATE']\nmailjet = Client(auth=(api_key, api_secret), version='v3')\nresult = mailjet.sender.get()\nprint result.status_code\nprint result.json()"
- lang: Java
label: Java
source: "package com.my.project;\nimport com.mailjet.client.errors.MailjetException;\nimport com.mailjet.client.errors.MailjetSocketTimeoutException;\nimport com.mailjet.client.MailjetClient;\nimport com.mailjet.client.MailjetRequest;\nimport com.mailjet.client.MailjetResponse;\nimport com.mailjet.client.ClientOptions;\nimport com.mailjet.client.resource.Sender;\nimport org.json.JSONArray;\nimport org.json.JSONObject;\npublic class MyClass {\n public static void main(String[] args) throws MailjetException, MailjetSocketTimeoutException {\n MailjetClient client;\n MailjetRequest request;\n MailjetResponse response;\n client = new MailjetClient(System.getenv(\"MJ_APIKEY_PUBLIC\"), System.getenv(\"MJ_APIKEY_PRIVATE\"), new ClientOptions(\"v3\"));\n request = new MailjetRequest(Sender.resource);\n response = client.get(request);\n System.out.println(response.getStatus());\n System.out.println(response.getData());\n }\n}"
- lang: Go
label: Go
source: "package main\nimport (\n\t\"fmt\"\n\t\"log\"\n\t\"os\"\n\tmailjet \"github.com/mailjet/mailjet-apiv3-go\"\n\t\"github.com/mailjet/mailjet-apiv3-go/resources\"\n)\nfunc main () {\n\tmailjetClient := NewMailjetClient(os.Getenv(\"MJ_APIKEY_PUBLIC\"), os.Getenv(\"MJ_APIKEY_PRIVATE\"))\n\tvar data []resources.Sender\n\t_, _, err := mailjetClient.List(\"sender\", &data)\n\tif err != nil {\n\t fmt.Println(err)\n\t}\n\tfmt.Printf(\"Data array: %+v\\n\", data)\n}"
- lang: C#
label: C#
source: "using Mailjet.Client;\nusing Mailjet.Client.Resources;\nusing System;\nusing Newtonsoft.Json.Linq;\nnamespace Mailjet.ConsoleApplication\n{\n class Program\n {\n static void Main(string[] args)\n {\n RunAsync().Wait();\n }\n static async Task RunAsync()\n {\n MailjetClient client = new MailjetClient(Environment.GetEnvironmentVariable(\"MJ_APIKEY_PUBLIC\"), Environment.GetEnvironmentVariable(\"MJ_APIKEY_PRIVATE\"))\n {\n Version = ApiVersion.V3,\n };\n MailjetRequest request = new MailjetRequest\n {\n Resource = Sender.Resource,\n }\n MailjetResponse response = await client.GetAsync(request);\n if (response.IsSuccessStatusCode)\n {\n Console.WriteLine(string.Format(\"Total: {0}, Count: {1}\\n\", response.GetTotal(), response.GetCount()));\n Console.WriteLine(response.GetData());\n }\n else\n {\n Console.WriteLine(string.Format(\"StatusCode: {0}\\n\", response.StatusCode));\n Console.WriteLine(string.Format(\"ErrorInfo: {0}\\n\", response.GetErrorInfo()));\n Console.WriteLine(response.GetData());\n Console.WriteLine(string.Format(\"ErrorMessage: {0}\\n\", response.GetErrorMessage()));\n }\n }\n }\n}"
post:
x-seo:
title: "Create Sender"
description: "Create a new sender email address or domain. The e-mail address or domain has to be registered and validated before being used to send e-mails\u2026"
tags:
- Sender Addresses and Domains
summary: Create Sender
description: "Create a new sender email address or domain. The e-mail address or domain has to be registered and validated before being used to send e-mails. Validation is done via `/sender/{sender_id}/validate`. In order to manage a sender available across multiple API Keys, see the related /metasender resource.\n\n> Note: The maximum number of senders and metasenders per user is 100. This includes both validated (`Active`) and non-validated (`Inactive`) ones, but does not include `Deleted` senders / metasenders.\n"
operationId: post_v3_sender
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/NewSender'
example:
EmailType: bulk
IsDefaultSender: false
Name: Marketing sender
Email: contact@example.com
responses:
'201':
description: Default OK response for `/sender`
content:
application/json:
schema:
type: object
properties:
Count:
description: Indicates the number of objects in the `Data` array.
type: integer
format: int64
examples:
- 1
Data:
description: A JSON array containing a list of objects returned by this endpoint.
type: array
items:
$ref: '#/components/schemas/OutputSender'
Total:
description: Indicates the number of objects in the `Data` array.
type: integer
format: int64
examples:
- 1
'400':
$ref: '#/components/responses/400'
'401':
$ref: '#/components/responses/401'
'403':
$ref: '#/components/responses/403'
'404':
$ref: '#/components/responses/404'
'429':
$ref: '#/components/responses/429'
'500':
$ref: '#/components/responses/500'
security:
- basicAuth: []
x-codeSamples:
- lang: curl
label: cURL
source: "curl -s \\\n\t-X POST \\\n\t--user \"$MJ_APIKEY_PUBLIC:$MJ_APIKEY_PRIVATE\" \\\n\thttps://api.mailjet.com/v3/REST/sender \\\n\t-H 'Content-Type: application/json' \\\n\t-d '{\n \"EmailType\":\"bulk\",\n \"IsDefaultSender\":false,\n \"Name\":\"Marketing sender\",\n \"Email\":\"pilot@mailjet.com\"\n\t}'"
- lang: PHP
label: PHP
source: " 'v3']);\n$body = [\n 'EmailType' => \"bulk\",\n 'IsDefaultSender' => false,\n 'Name' => \"Marketing sender\",\n 'Email' => \"pilot@mailjet.com\"\n];\n$response = $mj->post(Resources::$Sender, ['body' => $body]);\n$response->success() && var_dump($response->getData());\n?>"
- lang: Node.js
label: Node
source: "const mailjet = require ('node-mailjet')\n\t.connect(process.env.MJ_APIKEY_PUBLIC, process.env.MJ_APIKEY_PRIVATE)\nconst request = mailjet\n\t.post(\"sender\", {'version': 'v3'})\n\t.request({\n \"EmailType\":\"bulk\",\n \"IsDefaultSender\":false,\n \"Name\":\"Marketing sender\",\n \"Email\":\"pilot@mailjet.com\"\n })\nrequest\n\t.then((result) => {\n\t\tconsole.log(result.body)\n\t})\n\t.catch((err) => {\n\t\tconsole.log(err.statusCode)\n\t})"
- lang: Ruby
label: Ruby
source: "require 'mailjet'\nMailjet.configure do |config|\n config.api_key = ENV['MJ_APIKEY_PUBLIC']\n config.secret_key = ENV['MJ_APIKEY_PRIVATE']\n config.api_version = \"v3\"\nend\nvariable = Mailjet::Sender.create(\n email_type: \"bulk\",\n is_default_sender: false,\n name: \"Marketing sender\",\n email: \"pilot@mailjet.com\"\n)\np variable.attributes['Data']"
- lang: Python
label: Python
source: "from mailjet_rest import Client\nimport os\napi_key = os.environ['MJ_APIKEY_PUBLIC']\napi_secret = os.environ['MJ_APIKEY_PRIVATE']\nmailjet = Client(auth=(api_key, api_secret), version='v3')\ndata = {\n 'EmailType': \"bulk\",\n 'IsDefaultSender': False,\n 'Name': \"Marketing sender\",\n 'Email': \"pilot@mailjet.com\"\n}\nresult = mailjet.sender.create(data=data)\nprint result.status_code\nprint result.json()"
- lang: Java
label: Java
source: "package com.my.project;\nimport com.mailjet.client.errors.MailjetException;\nimport com.mailjet.client.errors.MailjetSocketTimeoutException;\nimport com.mailjet.client.MailjetClient;\nimport com.mailjet.client.MailjetRequest;\nimport com.mailjet.client.MailjetResponse;\nimport com.mailjet.client.ClientOptions;\nimport com.mailjet.client.resource.Sender;\nimport org.json.JSONArray;\nimport org.json.JSONObject;\npublic class MyClass {\n public static void main(String[] args) throws MailjetException, MailjetSocketTimeoutException {\n MailjetClient client;\n MailjetRequest request;\n MailjetResponse response;\n client = new MailjetClient(System.getenv(\"MJ_APIKEY_PUBLIC\"), System.getenv(\"MJ_APIKEY_PRIVATE\"), new ClientOptions(\"v3\"));\n request = new MailjetRequest(Sender.resource)\n .property(Sender.EMAILTYPE, \"bulk\")\n .property(Sender.ISDEFAULTSENDER, false)\n .property(Sender.NAME, \"Marketing sender\")\n .property(Sender.EMAIL, \"pilot@mailjet.com\")\n );\n response = client.post(request);\n System.out.println(response.getStatus());\n System.out.println(response.getData());\n }\n}"
- lang: Go
label: Go
source: "package main\nimport (\n\t\"fmt\"\n\t\"log\"\n\t\"os\"\n\tmailjet \"github.com/mailjet/mailjet-apiv3-go\"\n\t\"github.com/mailjet/mailjet-apiv3-go/resources\"\n)\nfunc main () {\n\tmailjetClient := NewMailjetClient(os.Getenv(\"MJ_APIKEY_PUBLIC\"), os.Getenv(\"MJ_APIKEY_PRIVATE\"))\n\tvar data []resources.Sender\n\tmr := &Request{\n\t Resource: \"sender\",\n\t}\n\tfmr := &FullRequest{\n\t Info: mr,\n\t Payload: &resources.Sender { \n\t EmailType:\"bulk\",\n\t IsDefaultSender:false,\n\t Name:\"Marketing sender\",\n\t Email:\"pilot@mailjet.com\"\n }\n\t}\n\terr := mailjetClient.Post(fmr, &data)\n\tif err != nil {\n\t fmt.Println(err)\n\t}\n\tfmt.Printf(\"Data array: %+v\\n\", data)\n}"
- lang: C#
label: C#
source: "using Mailjet.Client;\nusing Mailjet.Client.Resources;\nusing System;\nusing Newtonsoft.Json.Linq;\nnamespace Mailjet.ConsoleApplication\n{\n class Program\n {\n static void Main(string[] args)\n {\n RunAsync().Wait();\n }\n static async Task RunAsync()\n {\n MailjetClient client = new MailjetClient(Environment.GetEnvironmentVariable(\"MJ_APIKEY_PUBLIC\"), Environment.GetEnvironmentVariable(\"MJ_APIKEY_PRIVATE\"))\n {\n Version = ApiVersion.V3,\n };\n MailjetRequest request = new MailjetRequest\n {\n Resource = Sender.Resource,\n }\n .Property(Sender.EmailType, \"bulk\")\n .Property(Sender.IsDefaultSender, false)\n .Property(Sender.Name, \"Marketing sender\")\n .Property(Sender.Email, \"pilot@mailjet.com\");\n MailjetResponse response = await client.PostAsync(request);\n if (response.IsSuccessStatusCode)\n {\n Console.WriteLine(string.Format(\"Total: {0}, Count: {1}\\n\", response.GetTotal(), response.GetCount()));\n Console.WriteLine(response.GetData());\n }\n else\n {\n Console.WriteLine(string.Format(\"StatusCode: {0}\\n\", response.StatusCode));\n Console.WriteLine(string.Format(\"ErrorInfo: {0}\\n\", response.GetErrorInfo()));\n Console.WriteLine(response.GetData());\n Console.WriteLine(string.Format(\"ErrorMessage: {0}\\n\", response.GetErrorMessage()));\n }\n }\n }\n}"
"/v3/REST/sender/{sender_ID}":
get:
x-seo:
title: "Sender by ID"
description: "Sender by ID using the Mailjet Email API. Retrieve details on a specific sender email address or domain."
tags:
- Sender Addresses and Domains
summary: Sender by ID
description: Retrieve details on a specific sender email address or domain. To obtain a valid `sender_ID`, first call `GET /v3/REST/sender` to list your senders.
operationId: get_v3_sender_id
parameters:
- name: sender_ID
in: path
schema:
$ref: '#/components/schemas/get_v3_sender_id_PathParams/properties/sender_ID'
required: true
example: 8000
responses:
'200':
description: Default OK response for `/sender`
content:
application/json:
schema:
type: object
properties:
Count:
description: Indicates the number of objects in the `Data` array.
type: integer
format: int64
examples:
- 1
Data:
description: A JSON array containing a list of objects returned by this endpoint.
type: array
items:
$ref: '#/components/schemas/OutputSender'
Total:
description: Indicates the number of objects in the `Data` array.
type: integer
format: int64
examples:
- 1
'400':
$ref: '#/components/responses/400'
'401':
$ref: '#/components/responses/401'
'403':
$ref: '#/components/responses/403'
'404':
$ref: '#/components/responses/404'
'429':
$ref: '#/components/responses/429'
'500':
$ref: '#/components/responses/500'
security:
- basicAuth: []
x-codeSamples:
- lang: curl
label: cURL
source: "curl -s \\\n\t-X GET \\\n\t--user \"$MJ_APIKEY_PUBLIC:$MJ_APIKEY_PRIVATE\" \\\n\thttps://api.mailjet.com/v3/REST/sender/$sender_ID \\"
- lang: PHP
label: PHP
source: " 'v3']);\n$response = $mj->get(Resources::$Sender, ['id' => $id]);\n$response->success() && var_dump($response->getData());\n?>"
- lang: Node.js
label: Node
source: "const mailjet = require ('node-mailjet')\n\t.connect(process.env.MJ_APIKEY_PUBLIC, process.env.MJ_APIKEY_PRIVATE)\nconst request = mailjet\n\t.get(\"sender\", {'version': 'v3'})\n\t.id($sender_ID)\n\t.request()\nrequest\n\t.then((result) => {\n\t\tconsole.log(result.body)\n\t})\n\t.catch((err) => {\n\t\tconsole.log(err.statusCode)\n\t})"
- lang: Ruby
label: Ruby
source: "require 'mailjet'\nMailjet.configure do |config|\n config.api_key = ENV['MJ_APIKEY_PUBLIC']\n config.secret_key = ENV['MJ_APIKEY_PRIVATE']\n config.api_version = \"v3\"\nend\nvariable = Mailjet::Sender.find($sender_ID\n)\np variable.attributes['Data']"
- lang: Python
label: Python
source: "from mailjet_rest import Client\nimport os\napi_key = os.environ['MJ_APIKEY_PUBLIC']\napi_secret = os.environ['MJ_APIKEY_PRIVATE']\nmailjet = Client(auth=(api_key, api_secret), version='v3')\nid = '$sender_ID'\nresult = mailjet.sender.get(id=id)\nprint result.status_code\nprint result.json()"
- lang: Java
label: Java
source: "package com.my.project;\nimport com.mailjet.client.errors.MailjetException;\nimport com.mailjet.client.errors.MailjetSocketTimeoutException;\nimport com.mailjet.client.MailjetClient;\nimport com.mailjet.client.MailjetRequest;\nimport com.mailjet.client.MailjetResponse;\nimport com.mailjet.client.ClientOptions;\nimport com.mailjet.client.resource.Sender;\nimport org.json.JSONArray;\nimport org.json.JSONObject;\npublic class MyClass {\n public static void main(String[] args) throws MailjetException, MailjetSocketTimeoutException {\n MailjetClient client;\n MailjetRequest request;\n MailjetResponse response;\n client = new MailjetClient(System.getenv(\"MJ_APIKEY_PUBLIC\"), System.getenv(\"MJ_APIKEY_PRIVATE\"), new ClientOptions(\"v3\"));\n request = new MailjetRequest(Sender.resource, ID);\n response = client.get(request);\n System.out.println(response.getStatus());\n System.out.println(response.getData());\n }\n}"
- lang: Go
label: Go
source: "package main\nimport (\n\t\"fmt\"\n\t\"log\"\n\t\"os\"\n\tmailjet \"github.com/mailjet/mailjet-apiv3-go\"\n\t\"github.com/mailjet/mailjet-apiv3-go/resources\"\n)\nfunc main () {\n\tmailjetClient := NewMailjetClient(os.Getenv(\"MJ_APIKEY_PUBLIC\"), os.Getenv(\"MJ_APIKEY_PRIVATE\"))\n\tvar data []resources.Sender\n\tmr := &Request{\n\t Resource: \"sender\",\n\t ID: RESOURCE_ID,\n\t}\n\terr := mailjetClient.Get(mr, &data)\n\tif err != nil {\n\t fmt.Println(err)\n\t}\n\tfmt.Printf(\"Data array: %+v\\n\", data)\n}"
- lang: C#
label: C#
source: "using Mailjet.Client;\nusing Mailjet.Client.Resources;\nusing System;\nusing Newtonsoft.Json.Linq;\nnamespace Mailjet.ConsoleApplication\n{\n class Program\n {\n static void Main(string[] args)\n {\n RunAsync().Wait();\n }\n static async Task RunAsync()\n {\n MailjetClient client = new MailjetClient(Environment.GetEnvironmentVariable(\"MJ_APIKEY_PUBLIC\"), Environment.GetEnvironmentVariable(\"MJ_APIKEY_PRIVATE\"))\n {\n Version = ApiVersion.V3,\n };\n MailjetRequest request = new MailjetRequest\n {\n Resource = Sender.Resource,\n ResourceId = ResourceId.Numeric(ID)\n }\n MailjetResponse response = await client.GetAsync(request);\n if (response.IsSuccessStatusCode)\n {\n Console.WriteLine(string.Format(\"Total: {0}, Count: {1}\\n\", response.GetTotal(), response.GetCount()));\n Console.WriteLine(response.GetData());\n }\n else\n {\n Console.WriteLine(string.Format(\"StatusCode: {0}\\n\", response.StatusCode));\n Console.WriteLine(string.Format(\"ErrorInfo: {0}\\n\", response.GetErrorInfo()));\n Console.WriteLine(response.GetData());\n Console.WriteLine(string.Format(\"ErrorMessage: {0}\\n\", response.GetErrorMessage()));\n }\n }\n }\n}"
put:
x-seo:
title: "Update Sender"
description: "Update Sender using the Mailjet Email API. Update an existing sender email address or domain."
tags:
- Sender Addresses and Domains
summary: Update Sender
description: Update an existing sender email address or domain. To obtain a valid `sender_ID`, first call `GET /v3/REST/sender` to list your senders.
operationId: put_v3_sender_id
parameters:
- name: sender_ID
in: path
schema:
$ref: '#/components/schemas/put_v3_sender_id_PathParams/properties/sender_ID'
required: true
example: 8000
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/UpdateSender'
example:
EmailType: bulk
IsDefaultSender: false
Name: Marketing sender
responses:
'200':
description: Default OK response for `/sender`
content:
application/json:
schema:
type: object
properties:
Count:
description: Indicates the number of objects in the `Data` array.
type: integer
format: int64
examples:
- 1
Data:
description: A JSON array containing a list of objects returned by this endpoint.
type: array
items:
$ref: '#/components/schemas/OutputSender'
Total:
description: Indicates the number of objects in the `Data` array.
type: integer
format: int64
examples:
- 1
'400':
$ref: '#/components/responses/400'
'401':
$ref: '#/components/responses/401'
'403':
$ref: '#/components/responses/403'
'404':
$ref: '#/components/responses/404'
'429':
$ref: '#/components/responses/429'
'500':
$ref: '#/components/responses/500'
security:
- basicAuth: []
x-codeSamples:
- lang: curl
label: cURL
source: "curl -s \\\n\t-X PUT \\\n\t--user \"$MJ_APIKEY_PUBLIC:$MJ_APIKEY_PRIVATE\" \\\n\thttps://api.mailjet.com/v3/REST/sender/$sender_ID \\\n\t-H 'Content-Type: application/json' \\\n\t-d '{\n \"EmailType\":\"bulk\",\n \"IsDefaultSender\":false,\n \"Name\":\"Marketing sender\"\n\t}'"
- lang: PHP
label: PHP
source: " 'v3']);\n$body = [\n 'EmailType' => \"bulk\",\n 'IsDefaultSender' => false,\n 'Name' => \"Marketing sender\"\n];\n$response = $mj->put(Resources::$Sender, ['id' => $id, 'body' => $body]);\n$response->success() && var_dump($response->getData());\n?>"
- lang: Node.js
label: Node
source: "const mailjet = require ('node-mailjet')\n\t.connect(process.env.MJ_APIKEY_PUBLIC, process.env.MJ_APIKEY_PRIVATE)\nconst request = mailjet\n\t.put(\"sender\", {'version': 'v3'})\n\t.id($sender_ID)\n\t.request({\n \"EmailType\":\"bulk\",\n \"IsDefaultSender\":false,\n \"Name\":\"Marketing sender\"\n })\nrequest\n\t.then((result) => {\n\t\tconsole.log(result.body)\n\t})\n\t.catch((err) => {\n\t\tconsole.log(err.statusCode)\n\t})"
- lang: Ruby
label: Ruby
source: "require 'mailjet'\nMailjet.configure do |config|\n config.api_key = ENV['MJ_APIKEY_PUBLIC']\n config.secret_key = ENV['MJ_APIKEY_PRIVATE']\n config.api_version = \"v3\"\nend\ntarget = Mailjet::Sender.find($sender_ID)\ntarget.update_attributes(\n email_type: \"bulk\",\n is_default_sender: false,\n name: \"Marketing sender\"\n)\np variable.attributes['Data']"
- lang: Python
label: Python
source: "from mailjet_rest import Client\nimport os\napi_key = os.environ['MJ_APIKEY_PUBLIC']\napi_secret = os.environ['MJ_APIKEY_PRIVATE']\nmailjet = Client(auth=(api_key, api_secret), version='v3')\nid = '$sender_ID'\ndata = {\n 'EmailType': \"bulk\",\n 'IsDefaultSender': False,\n 'Name': \"Marketing sender\"\n}\nresult = mailjet.sender.update(id=id, data=data)\nprint result.status_code\nprint result.json()"
- lang: Java
label: Java
source: "package com.my.project;\nimport com.mailjet.client.errors.MailjetException;\nimport com.mailjet.client.errors.MailjetSocketTimeoutException;\nimport com.mailjet.client.MailjetClient;\nimport com.mailjet.client.MailjetRequest;\nimport com.mailjet.client.MailjetResponse;\nimport com.mailjet.client.ClientOptions;\nimport com.mailjet.client.resource.Sender;\nimport org.json.JSONArray;\nimport org.json.JSONObject;\npublic class MyClass {\n public static void main(String[] args) throws MailjetException, MailjetSocketTimeoutException {\n MailjetClient client;\n MailjetRequest request;\n MailjetResponse response;\n client = new MailjetClient(System.getenv(\"MJ_APIKEY_PUBLIC\"), System.getenv(\"MJ_APIKEY_PRIVATE\"), new ClientOptions(\"v3\"));\n request = new MailjetRequest(Sender.resource, ID)\n .property(Sender.EMAILTYPE, \"bulk\")\n .property(Sender.ISDEFAULTSENDER, false)\n .property(Sender.NAME, \"Marketing sender\")\n );\n response = client.put(request);\n System.out.println(response.getStatus());\n System.out.println(response.getData());\n }\n}"
- lang: Go
label: Go
source: "package main\nimport (\n\t\"fmt\"\n\t\"log\"\n\t\"os\"\n\tmailjet \"github.com/mailjet/mailjet-apiv3-go\"\n\t\"github.com/mailjet/mailjet-apiv3-go/resources\"\n)\nfunc main () {\n\tmailjetClient := NewMailjetClient(os.Getenv(\"MJ_APIKEY_PUBLIC\"), os.Getenv(\"MJ_APIKEY_PRIVATE\"))\n\tmr := &Request{\n\t Resource: \"sender\",\n\t ID: RESOURCE_ID,\n\t}\n\tfmr := &FullRequest{\n\t Info: mr,\n\t Payload: &resources.Sender { \n\t EmailType:\"bulk\",\n\t IsDefaultSender:false,\n\t Name:\"Marketing sender\"\n }\n\t}\n\terr := mailjetClient.Put(fmr)\n\tif err != nil {\n\t fmt.Println(err)\n\t}\n}"
- lang: C#
label: C#
source: "using Mailjet.Client;\nusing Mailjet.Client.Resources;\nusing System;\nusing Newtonsoft.Json.Linq;\nnamespace Mailjet.ConsoleApplication\n{\n class Program\n {\n static void Main(string[] args)\n {\n RunAsync().Wait();\n }\n static async Task RunAsync()\n {\n MailjetClient client = new MailjetClient(Environment.GetEnvironmentVariable(\"MJ_APIKEY_PUBLIC\"), Environment.GetEnvironmentVariable(\"MJ_APIKEY_PRIVATE\"))\n {\n Version = ApiVersion.V3,\n };\n MailjetRequest request = new MailjetRequest\n {\n Resource = Sender.Resource,\n ResourceId = ResourceId.Numeric(ID)\n }\n .Property(Sender.EmailType, \"bulk\")\n .Property(Sender.IsDefaultSender, false)\n .Property(Sender.Name, \"Marketing sender\");\n MailjetResponse response = await client.PutAsync(request);\n if (response.IsSuccessStatusCode)\n {\n Console.WriteLine(string.Format(\"Total: {0}, Count: {1}\\n\", response.GetTotal(), response.GetCount()));\n Console.WriteLine(response.GetData());\n }\n else\n {\n Console.WriteLine(string.Format(\"StatusCode: {0}\\n\", response.StatusCode));\n Console.WriteLine(string.Format(\"ErrorInfo: {0}\\n\", response.GetErrorInfo()));\n Console.WriteLine(response.GetData());\n Console.WriteLine(string.Format(\"ErrorMessage: {0}\\n\", response.GetErrorMessage()));\n }\n }\n }\n}"
delete:
x-seo:
title: "Delete Sender"
description: "Delete Sender using the Mailjet Email API. Delete an existing sender email address or domain."
tags:
- Sender Addresses and Domains
summary: Delete Sender
description: Delete an existing sender email address or domain.
operationId: delete_v3_sender_id
parameters:
- name: sender_ID
in: path
schema:
$ref: '#/components/schemas/delete_v3_sender_id_PathParams/properties/sender_ID'
required: true
responses:
'204':
$ref: '#/components/responses/204'
'400':
$ref: '#/components/responses/400'
'401':
$ref: '#/components/responses/401'
'403':
$ref: '#/components/responses/403'
'404':
$ref: '#/components/responses/404'
'429':
$ref: '#/components/responses/429'
'500':
$ref: '#/components/responses/500'
security:
- basicAuth: []
x-codeSamples:
- lang: curl
label: cURL
source: "curl -s \\\n\t-X DELETE \\\n\t--user \"$MJ_APIKEY_PUBLIC:$MJ_APIKEY_PRIVATE\" \\\n\thttps://api.mailjet.com/v3/REST/sender/$sender_ID \\\n\t-H 'Content-Type: application/json' \\\n\t-d '{\n\t}'"
- lang: PHP
label: PHP
source: " 'v3']);\n$response = $mj->delete(Resources::$Sender, ['id' => $id]);\n$response->success() && var_dump($response->getData());\n?>"
- lang: Node.js
label: Node
source: "const mailjet = require ('node-mailjet')\n\t.connect(process.env.MJ_APIKEY_PUBLIC, process.env.MJ_APIKEY_PRIVATE)\nconst request = mailjet\n\t.delete(\"sender\", {'version': 'v3'})\n\t.id($sender_ID)\n\t.request()\nrequest\n\t.then((result) => {\n\t\tconsole.log(result.body)\n\t})\n\t.catch((err) => {\n\t\tconsole.log(err.statusCode)\n\t})"
- lang: Ruby
label: Ruby
source: "require 'mailjet'\nMailjet.configure do |config|\n config.api_key = ENV['MJ_APIKEY_PUBLIC']\n config.secret_key = ENV['MJ_APIKEY_PRIVATE']\n config.api_version = \"v3\"\nend\ntarget = Mailjet::Sender.find($sender_ID)\ntarget.delete(\n)\np variable.attributes['Data']"
- lang: Python
label: Python
source: "from mailjet_rest import Client\nimport os\napi_key = os.environ['MJ_APIKEY_PUBLIC']\napi_secret = os.environ['MJ_APIKEY_PRIVATE']\nmailjet = Client(auth=(api_key, api_secret), version='v3')\nid = '$sender_ID'\nresult = mailjet.sender.delete(id=id)\nprint result.status_code\nprint result.json()"
- lang: Java
label: Java
source: "package com.my.project;\nimport com.mailjet.client.errors.MailjetException;\nimport com.mailjet.client.errors.MailjetSocketTimeoutException;\nimport com.mailjet.client.MailjetClient;\nimport com.mailjet.client.MailjetRequest;\nimport com.mailjet.client.MailjetResponse;\nimport com.mailjet.client.ClientOptions;\nimport com.mailjet.client.resource.Sender;\nimport org.json.JSONArray;\nimport org.json.JSONObject;\npublic class MyClass {\n public static void main(String[] args) throws MailjetException, MailjetSocketTimeoutException {\n MailjetClient client;\n MailjetRequest request;\n MailjetResponse response;\n client = new MailjetClient(System.getenv(\"MJ_APIKEY_PUBLIC\"), System.getenv(\"MJ_APIKEY_PRIVATE\"), new ClientOptions(\"v3\"));\n request = new MailjetRequest(Sender.resource, ID);\n response = client.delete(request);\n System.out.println(response.getStatus());\n System.out.println(response.getData());\n }\n}"
- lang: Go
label: Go
source: "package main\nimport (\n\t\"fmt\"\n\t\"log\"\n\t\"os\"\n\tmailjet \"github.com/mailjet/mailjet-apiv3-go\"\n\t\"github.com/mailjet/mailjet-apiv3-go/resources\"\n)\nfunc main () {\n\tmailjetClient := NewMailjetClient(os.Getenv(\"MJ_APIKEY_PUBLIC\"), os.Getenv(\"MJ_APIKEY_PRIVATE\"))\n\tmr := &Request{\n\t Resource: \"sender\",\n\t ID: RESOURCE_ID,\n\t}\n\terr := mailjetClient.Delete(mr)\n\tif err != nil {\n\t fmt.Println(err)\n\t}\n}"
- lang: C#
label: C#
source: "using Mailjet.Client;\nusing Mailjet.Client.Resources;\nusing System;\nusing Newtonsoft.Json.Linq;\nnamespace Mailjet.ConsoleApplication\n{\n class Program\n {\n static void Main(string[] args)\n {\n RunAsync().Wait();\n }\n static async Task RunAsync()\n {\n MailjetClient client = new MailjetClient(Environment.GetEnvironmentVariable(\"MJ_APIKEY_PUBLIC\"), Environment.GetEnvironmentVariable(\"MJ_APIKEY_PRIVATE\"))\n {\n Version = ApiVersion.V3,\n };\n MailjetRequest request = new MailjetRequest\n {\n Resource = Sender.Resource,\n ResourceId = ResourceId.Numeric(ID)\n }\n MailjetResponse response = await client.DeleteAsync(request);\n if (response.IsSuccessStatusCode)\n {\n Console.WriteLine(string.Format(\"Total: {0}, Count: {1}\\n\", response.GetTotal(), response.GetCount()));\n Console.WriteLine(response.GetData());\n }\n else\n {\n Console.WriteLine(string.Format(\"StatusCode: {0}\\n\", response.StatusCode));\n Console.WriteLine(string.Format(\"ErrorInfo: {0}\\n\", response.GetErrorInfo()));\n Console.WriteLine(response.GetData());\n Console.WriteLine(string.Format(\"ErrorMessage: {0}\\n\", response.GetErrorMessage()));\n }\n }\n }\n}"
/v3/REST/sender/{sender_ID}/validate:
post:
x-seo:
title: "Sender: Validate"
description: "Validate a registered sender email address or domain. A sender domain ( @domain.com) is validated by checking the caller's rights, the existence of a\u2026"
tags:
- Sender Addresses and Domains
summary: 'Sender: Validate'
description: Validate a registered sender email address or domain. A sender domain (*@domain.com) is validated by checking the caller's rights, the existence of a metasender for that domain or by searching for the ownership token on the domain root or in the DNS. To obtain a valid `sender_ID`, first call `GET /v3/REST/sender` to list your senders.
operationId: post_v3_sender_id_validate
parameters:
- name: sender_ID
in: path
schema:
$ref: '#/components/schemas/post_v3_sender_id_validate_PathParams/properties/sender_ID'
required: true
example: 8000
responses:
'201':
description: Default OK response for `/sender` action `/validate`
content:
application/json:
schema:
type: object
properties:
Count:
description: Indicates the number of objects in the `Data` array.
type: integer
format: int64
examples:
- 1
Data:
description: A JSON array containing a list of objects returned by this endpoint.
type: array
items:
$ref: '#/components/schemas/OutputSenderValidate'
Total:
description: Indicates the number of objects in the `Data` array.
type: integer
format: int64
examples:
- 1
'400':
$ref: '#/components/responses/400'
'401':
$ref: '#/components/responses/401'
'403':
$ref: '#/components/responses/403'
'404':
$ref: '#/components/responses/404'
'429':
$ref: '#/components/responses/429'
'500':
$ref: '#/components/responses/500'
security:
- basicAuth: []
x-codeSamples:
- lang: curl
label: cURL
source: "curl -s \\\n\t-X POST \\\n\t--user \"$MJ_APIKEY_PUBLIC:$MJ_APIKEY_PRIVATE\" \\\n\thttps://api.mailjet.com/v3/REST/sender/$sender_ID/validate \\\n\t-H 'Content-Type: application/json' \\\n\t-d '{\n\t}'"
- lang: PHP
label: PHP
source: " 'v3']);\n$response = $mj->post(Resources::$SenderValidate, ['id' => $id]);\n$response->success() && var_dump($response->getData());\n?>"
- lang: Node.js
label: Node
source: "const mailjet = require ('node-mailjet')\n\t.connect(process.env.MJ_APIKEY_PUBLIC, process.env.MJ_APIKEY_PRIVATE)\nconst request = mailjet\n\t.post(\"sender\", {'version': 'v3'})\n\t.id($sender_ID)\n\t.action(\"validate\")\n\t.request()\nrequest\n\t.then((result) => {\n\t\tconsole.log(result.body)\n\t})\n\t.catch((err) => {\n\t\tconsole.log(err.statusCode)\n\t})"
- lang: Ruby
label: Ruby
source: "require 'mailjet'\nMailjet.configure do |config|\n config.api_key = ENV['MJ_APIKEY_PUBLIC']\n config.secret_key = ENV['MJ_APIKEY_PRIVATE']\n config.api_version = \"v3\"\nend\nvariable = Mailjet::Sender_validate.create(id: $sender_ID,\n)\np variable.attributes['Data']"
- lang: Python
label: Python
source: "from mailjet_rest import Client\nimport os\napi_key = os.environ['MJ_APIKEY_PUBLIC']\napi_secret = os.environ['MJ_APIKEY_PRIVATE']\nmailjet = Client(auth=(api_key, api_secret), version='v3')\nid = '$sender_ID'\nresult = mailjet.sender_validate.create(id=id)\nprint result.status_code\nprint result.json()"
- lang: Java
label: Java
source: "package com.my.project;\nimport com.mailjet.client.errors.MailjetException;\nimport com.mailjet.client.errors.MailjetSocketTimeoutException;\nimport com.mailjet.client.MailjetClient;\nimport com.mailjet.client.MailjetRequest;\nimport com.mailjet.client.MailjetResponse;\nimport com.mailjet.client.ClientOptions;\nimport com.mailjet.client.resource.SenderValidate;\nimport org.json.JSONArray;\nimport org.json.JSONObject;\npublic class MyClass {\n public static void main(String[] args) throws MailjetException, MailjetSocketTimeoutException {\n MailjetClient client;\n MailjetRequest request;\n MailjetResponse response;\n client = new MailjetClient(System.getenv(\"MJ_APIKEY_PUBLIC\"), System.getenv(\"MJ_APIKEY_PRIVATE\"), new ClientOptions(\"v3\"));\n request = new MailjetRequest(SenderValidate.resource, ID);\n response = client.post(request);\n System.out.println(response.getStatus());\n System.out.println(response.getData());\n }\n}"
- lang: Go
label: Go
source: "package main\nimport (\n\t\"fmt\"\n\t\"log\"\n\t\"os\"\n\tmailjet \"github.com/mailjet/mailjet-apiv3-go\"\n\t\"github.com/mailjet/mailjet-apiv3-go/resources\"\n)\nfunc main () {\n\tmailjetClient := NewMailjetClient(os.Getenv(\"MJ_APIKEY_PUBLIC\"), os.Getenv(\"MJ_APIKEY_PRIVATE\"))\n\tvar data []resources.SenderValidate\n\tmr := &Request{\n\t Resource: \"sender\",\n\t ID: RESOURCE_ID,\n\t Action: \"validate\",\n\t}\n\tfmr := &FullRequest{\n\t Info: mr,\n\t Payload: &resources.SenderValidate { }\n\t}\n\terr := mailjetClient.Post(fmr, &data)\n\tif err != nil {\n\t fmt.Println(err)\n\t}\n\tfmt.Printf(\"Data array: %+v\\n\", data)\n}"
- lang: C#
label: C#
source: "using Mailjet.Client;\nusing Mailjet.Client.Resources;\nusing System;\nusing Newtonsoft.Json.Linq;\nnamespace Mailjet.ConsoleApplication\n{\n class Program\n {\n static void Main(string[] args)\n {\n RunAsync().Wait();\n }\n static async Task RunAsync()\n {\n MailjetClient client = new MailjetClient(Environment.GetEnvironmentVariable(\"MJ_APIKEY_PUBLIC\"), Environment.GetEnvironmentVariable(\"MJ_APIKEY_PRIVATE\"))\n {\n Version = ApiVersion.V3,\n };\n MailjetRequest request = new MailjetRequest\n {\n Resource = SenderValidate.Resource,\n ResourceId = ResourceId.Numeric(ID)\n }\n MailjetResponse response = await client.PostAsync(request);\n if (response.IsSuccessStatusCode)\n {\n Console.WriteLine(string.Format(\"Total: {0}, Count: {1}\\n\", response.GetTotal(), response.GetCount()));\n Console.WriteLine(response.GetData());\n }\n else\n {\n Console.WriteLine(string.Format(\"StatusCode: {0}\\n\", response.StatusCode));\n Console.WriteLine(string.Format(\"ErrorInfo: {0}\\n\", response.GetErrorInfo()));\n Console.WriteLine(response.GetData());\n Console.WriteLine(string.Format(\"ErrorMessage: {0}\\n\", response.GetErrorMessage()));\n }\n }\n }\n}"
"/v3/REST/dns":
get:
x-seo:
title: "DNS List"
description: "Retrieve the SPF and DKIM settings for all sender domains on this API Key. The information will help you configure your SPF and DKIM settings on the\u2026"
tags:
- Sender Addresses and Domains
summary: DNS List
description: Retrieve the SPF and DKIM settings for all sender domains on this API Key. The information will help you configure your SPF and DKIM settings on the respective domain, before running a DNS check with `/dns/{dns_id}/check` to validate it and complete the SPF and DKIM authentication.
operationId: get_v3_dns
parameters:
- name: IsCheckInProgress
in: query
schema:
$ref: '#/components/schemas/get_v3_dns_QueryParams/properties/IsCheckInProgress'
- name: IsSenderIdentified
in: query
schema:
$ref: '#/components/schemas/get_v3_dns_QueryParams/properties/IsSenderIdentified'
- name: IsYahooFBL
in: query
schema:
$ref: '#/components/schemas/get_v3_dns_QueryParams/properties/IsYahooFBL'
- name: MaxLastCheckAt
in: query
schema:
$ref: '#/components/schemas/get_v3_dns_QueryParams/properties/MaxLastCheckAt'
- name: MinLastCheckAt
in: query
schema:
$ref: '#/components/schemas/get_v3_dns_QueryParams/properties/MinLastCheckAt'
- name: SPFStatus
in: query
schema:
$ref: '#/components/schemas/get_v3_dns_QueryParams/properties/SPFStatus'
responses:
'200':
description: Default OK response for `/dns`
content:
application/json:
schema:
type: object
properties:
Count:
description: Indicates the number of objects in the `Data` array.
type: integer
format: int64
examples:
- 1
Data:
description: A JSON array containing a list of objects returned by this endpoint.
type: array
items:
$ref: '#/components/schemas/OutputDns'
Total:
description: Indicates the number of objects in the `Data` array.
type: integer
format: int64
examples:
- 1
'400':
$ref: '#/components/responses/400'
'401':
$ref: '#/components/responses/401'
'403':
$ref: '#/components/responses/403'
'404':
$ref: '#/components/responses/404'
'429':
$ref: '#/components/responses/429'
'500':
$ref: '#/components/responses/500'
security:
- basicAuth: []
x-codeSamples:
- lang: curl
label: cURL
source: "curl -s \\\n\t-X GET \\\n\t--user \"$MJ_APIKEY_PUBLIC:$MJ_APIKEY_PRIVATE\" \\\n\thttps://api.mailjet.com/v3/REST/dns \\"
- lang: PHP
label: PHP
source: " 'v3']);\n$response = $mj->get(Resources::$Dns);\n$response->success() && var_dump($response->getData());\n?>"
- lang: Node.js
label: Node
source: "const mailjet = require ('node-mailjet')\n\t.connect(process.env.MJ_APIKEY_PUBLIC, process.env.MJ_APIKEY_PRIVATE)\nconst request = mailjet\n\t.get(\"dns\", {'version': 'v3'})\n\t.request()\nrequest\n\t.then((result) => {\n\t\tconsole.log(result.body)\n\t})\n\t.catch((err) => {\n\t\tconsole.log(err.statusCode)\n\t})"
- lang: Ruby
label: Ruby
source: "require 'mailjet'\nMailjet.configure do |config|\n config.api_key = ENV['MJ_APIKEY_PUBLIC']\n config.secret_key = ENV['MJ_APIKEY_PRIVATE']\n config.api_version = \"v3\"\nend\nvariable = Mailjet::Dns.all(\n)\np variable.attributes['Data']"
- lang: Python
label: Python
source: "from mailjet_rest import Client\nimport os\napi_key = os.environ['MJ_APIKEY_PUBLIC']\napi_secret = os.environ['MJ_APIKEY_PRIVATE']\nmailjet = Client(auth=(api_key, api_secret), version='v3')\nresult = mailjet.dns.get()\nprint result.status_code\nprint result.json()"
- lang: Java
label: Java
source: "package com.my.project;\nimport com.mailjet.client.errors.MailjetException;\nimport com.mailjet.client.errors.MailjetSocketTimeoutException;\nimport com.mailjet.client.MailjetClient;\nimport com.mailjet.client.MailjetRequest;\nimport com.mailjet.client.MailjetResponse;\nimport com.mailjet.client.ClientOptions;\nimport com.mailjet.client.resource.Dns;\nimport org.json.JSONArray;\nimport org.json.JSONObject;\npublic class MyClass {\n public static void main(String[] args) throws MailjetException, MailjetSocketTimeoutException {\n MailjetClient client;\n MailjetRequest request;\n MailjetResponse response;\n client = new MailjetClient(System.getenv(\"MJ_APIKEY_PUBLIC\"), System.getenv(\"MJ_APIKEY_PRIVATE\"), new ClientOptions(\"v3\"));\n request = new MailjetRequest(Dns.resource);\n response = client.get(request);\n System.out.println(response.getStatus());\n System.out.println(response.getData());\n }\n}"
- lang: Go
label: Go
source: "package main\nimport (\n\t\"fmt\"\n\t\"log\"\n\t\"os\"\n\tmailjet \"github.com/mailjet/mailjet-apiv3-go\"\n\t\"github.com/mailjet/mailjet-apiv3-go/resources\"\n)\nfunc main () {\n\tmailjetClient := NewMailjetClient(os.Getenv(\"MJ_APIKEY_PUBLIC\"), os.Getenv(\"MJ_APIKEY_PRIVATE\"))\n\tvar data []resources.Dns\n\t_, _, err := mailjetClient.List(\"dns\", &data)\n\tif err != nil {\n\t fmt.Println(err)\n\t}\n\tfmt.Printf(\"Data array: %+v\\n\", data)\n}"
- lang: C#
label: C#
source: "using Mailjet.Client;\nusing Mailjet.Client.Resources;\nusing System;\nusing Newtonsoft.Json.Linq;\nnamespace Mailjet.ConsoleApplication\n{\n class Program\n {\n static void Main(string[] args)\n {\n RunAsync().Wait();\n }\n static async Task RunAsync()\n {\n MailjetClient client = new MailjetClient(Environment.GetEnvironmentVariable(\"MJ_APIKEY_PUBLIC\"), Environment.GetEnvironmentVariable(\"MJ_APIKEY_PRIVATE\"))\n {\n Version = ApiVersion.V3,\n };\n MailjetRequest request = new MailjetRequest\n {\n Resource = Dns.Resource,\n }\n MailjetResponse response = await client.GetAsync(request);\n if (response.IsSuccessStatusCode)\n {\n Console.WriteLine(string.Format(\"Total: {0}, Count: {1}\\n\", response.GetTotal(), response.GetCount()));\n Console.WriteLine(response.GetData());\n }\n else\n {\n Console.WriteLine(string.Format(\"StatusCode: {0}\\n\", response.StatusCode));\n Console.WriteLine(string.Format(\"ErrorInfo: {0}\\n\", response.GetErrorInfo()));\n Console.WriteLine(response.GetData());\n Console.WriteLine(string.Format(\"ErrorMessage: {0}\\n\", response.GetErrorMessage()));\n }\n }\n }\n}"
"/v3/REST/dns/{dns_ID}":
get:
x-seo:
title: "DNS by ID"
description: "Retrieve the SPF and DKIM settings for a specific sender domain on this API Key. The information will help you configure your SPF and DKIM settings on\u2026"
tags:
- Sender Addresses and Domains
summary: DNS by ID
description: Retrieve the SPF and DKIM settings for a specific sender domain on this API Key. The information will help you configure your SPF and DKIM settings on the respective domain, before running a DNS check with `/dns/{dns_id}/check` to validate it. To obtain a valid `dns_ID`, first call `GET /v3/REST/dns` to list your domains.
operationId: get_v3_dns_id
parameters:
- name: dns_ID
in: path
schema:
$ref: '#/components/schemas/get_v3_dns_id_PathParams/properties/dns_ID'
required: true
example: 11000
responses:
'200':
description: Default OK response for `/dns`
content:
application/json:
schema:
type: object
properties:
Count:
description: Indicates the number of objects in the `Data` array.
type: integer
format: int64
examples:
- 1
Data:
description: A JSON array containing a list of objects returned by this endpoint.
type: array
items:
$ref: '#/components/schemas/OutputDns'
Total:
description: Indicates the number of objects in the `Data` array.
type: integer
format: int64
examples:
- 1
'400':
$ref: '#/components/responses/400'
'401':
$ref: '#/components/responses/401'
'403':
$ref: '#/components/responses/403'
'404':
$ref: '#/components/responses/404'
'429':
$ref: '#/components/responses/429'
'500':
$ref: '#/components/responses/500'
security:
- basicAuth: []
x-codeSamples:
- lang: curl
label: cURL
source: "curl -s \\\n\t-X GET \\\n\t--user \"$MJ_APIKEY_PUBLIC:$MJ_APIKEY_PRIVATE\" \\\n\thttps://api.mailjet.com/v3/REST/dns/$dns_ID \\"
- lang: PHP
label: PHP
source: " 'v3']);\n$response = $mj->get(Resources::$Dns, ['id' => $id]);\n$response->success() && var_dump($response->getData());\n?>"
- lang: Node.js
label: Node
source: "const mailjet = require ('node-mailjet')\n\t.connect(process.env.MJ_APIKEY_PUBLIC, process.env.MJ_APIKEY_PRIVATE)\nconst request = mailjet\n\t.get(\"dns\", {'version': 'v3'})\n\t.id($dns_ID)\n\t.request()\nrequest\n\t.then((result) => {\n\t\tconsole.log(result.body)\n\t})\n\t.catch((err) => {\n\t\tconsole.log(err.statusCode)\n\t})"
- lang: Ruby
label: Ruby
source: "require 'mailjet'\nMailjet.configure do |config|\n config.api_key = ENV['MJ_APIKEY_PUBLIC']\n config.secret_key = ENV['MJ_APIKEY_PRIVATE']\n config.api_version = \"v3\"\nend\nvariable = Mailjet::Dns.find($dns_ID\n)\np variable.attributes['Data']"
- lang: Python
label: Python
source: "from mailjet_rest import Client\nimport os\napi_key = os.environ['MJ_APIKEY_PUBLIC']\napi_secret = os.environ['MJ_APIKEY_PRIVATE']\nmailjet = Client(auth=(api_key, api_secret), version='v3')\nid = '$dns_ID'\nresult = mailjet.dns.get(id=id)\nprint result.status_code\nprint result.json()"
- lang: Java
label: Java
source: "package com.my.project;\nimport com.mailjet.client.errors.MailjetException;\nimport com.mailjet.client.errors.MailjetSocketTimeoutException;\nimport com.mailjet.client.MailjetClient;\nimport com.mailjet.client.MailjetRequest;\nimport com.mailjet.client.MailjetResponse;\nimport com.mailjet.client.ClientOptions;\nimport com.mailjet.client.resource.Dns;\nimport org.json.JSONArray;\nimport org.json.JSONObject;\npublic class MyClass {\n public static void main(String[] args) throws MailjetException, MailjetSocketTimeoutException {\n MailjetClient client;\n MailjetRequest request;\n MailjetResponse response;\n client = new MailjetClient(System.getenv(\"MJ_APIKEY_PUBLIC\"), System.getenv(\"MJ_APIKEY_PRIVATE\"), new ClientOptions(\"v3\"));\n request = new MailjetRequest(Dns.resource, ID);\n response = client.get(request);\n System.out.println(response.getStatus());\n System.out.println(response.getData());\n }\n}"
- lang: Go
label: Go
source: "package main\nimport (\n\t\"fmt\"\n\t\"log\"\n\t\"os\"\n\tmailjet \"github.com/mailjet/mailjet-apiv3-go\"\n\t\"github.com/mailjet/mailjet-apiv3-go/resources\"\n)\nfunc main () {\n\tmailjetClient := NewMailjetClient(os.Getenv(\"MJ_APIKEY_PUBLIC\"), os.Getenv(\"MJ_APIKEY_PRIVATE\"))\n\tvar data []resources.Dns\n\tmr := &Request{\n\t Resource: \"dns\",\n\t ID: RESOURCE_ID,\n\t}\n\terr := mailjetClient.Get(mr, &data)\n\tif err != nil {\n\t fmt.Println(err)\n\t}\n\tfmt.Printf(\"Data array: %+v\\n\", data)\n}"
- lang: C#
label: C#
source: "using Mailjet.Client;\nusing Mailjet.Client.Resources;\nusing System;\nusing Newtonsoft.Json.Linq;\nnamespace Mailjet.ConsoleApplication\n{\n class Program\n {\n static void Main(string[] args)\n {\n RunAsync().Wait();\n }\n static async Task RunAsync()\n {\n MailjetClient client = new MailjetClient(Environment.GetEnvironmentVariable(\"MJ_APIKEY_PUBLIC\"), Environment.GetEnvironmentVariable(\"MJ_APIKEY_PRIVATE\"))\n {\n Version = ApiVersion.V3,\n };\n MailjetRequest request = new MailjetRequest\n {\n Resource = Dns.Resource,\n ResourceId = ResourceId.Numeric(ID)\n }\n MailjetResponse response = await client.GetAsync(request);\n if (response.IsSuccessStatusCode)\n {\n Console.WriteLine(string.Format(\"Total: {0}, Count: {1}\\n\", response.GetTotal(), response.GetCount()));\n Console.WriteLine(response.GetData());\n }\n else\n {\n Console.WriteLine(string.Format(\"StatusCode: {0}\\n\", response.StatusCode));\n Console.WriteLine(string.Format(\"ErrorInfo: {0}\\n\", response.GetErrorInfo()));\n Console.WriteLine(response.GetData());\n Console.WriteLine(string.Format(\"ErrorMessage: {0}\\n\", response.GetErrorMessage()));\n }\n }\n }\n}"
/v3/REST/dns/{dns_ID}/check:
post:
x-seo:
title: "DNS: Check"
description: "Perform a DNS validation of a sender domain. The Mailjet API will check for a TXT record in the domain's DNS zone file. More information"
tags:
- Sender Addresses and Domains
summary: 'DNS: Check'
description: Perform a DNS validation of a sender domain. The Mailjet API will check for a TXT record in the domain's DNS zone file. [More information](/docs/email-api/senders-domains/sender-validation) To obtain a valid `dns_ID`, first call `GET /v3/REST/dns` to list your domains.
operationId: post_v3_dns_id_check
parameters:
- name: dns_ID
in: path
schema:
$ref: '#/components/schemas/post_v3_dns_id_check_PathParams/properties/dns_ID'
required: true
example: 11000
responses:
'201':
description: Default OK response for `/dns` action `/check`
content:
application/json:
schema:
type: object
properties:
Count:
description: Indicates the number of objects in the `Data` array.
type: integer
format: int64
examples:
- 1
Data:
description: A JSON array containing a list of objects returned by this endpoint.
type: array
items:
$ref: '#/components/schemas/OutputDnsCheck'
Total:
description: Indicates the number of objects in the `Data` array.
type: integer
format: int64
examples:
- 1
'400':
$ref: '#/components/responses/400'
'401':
$ref: '#/components/responses/401'
'403':
$ref: '#/components/responses/403'
'404':
$ref: '#/components/responses/404'
'429':
$ref: '#/components/responses/429'
'500':
$ref: '#/components/responses/500'
security:
- basicAuth: []
x-codeSamples:
- lang: curl
label: cURL
source: "curl -s \\\n\t-X POST \\\n\t--user \"$MJ_APIKEY_PUBLIC:$MJ_APIKEY_PRIVATE\" \\\n\thttps://api.mailjet.com/v3/REST/dns/$dns_ID/check \\\n\t-H 'Content-Type: application/json' \\\n\t-d '{\n\t}'"
- lang: PHP
label: PHP
source: " 'v3']);\n$response = $mj->post(Resources::$DnsCheck, ['id' => $id]);\n$response->success() && var_dump($response->getData());\n?>"
- lang: Node.js
label: Node
source: "const mailjet = require ('node-mailjet')\n\t.connect(process.env.MJ_APIKEY_PUBLIC, process.env.MJ_APIKEY_PRIVATE)\nconst request = mailjet\n\t.post(\"dns\", {'version': 'v3'})\n\t.id($dns_ID)\n\t.action(\"check\")\n\t.request()\nrequest\n\t.then((result) => {\n\t\tconsole.log(result.body)\n\t})\n\t.catch((err) => {\n\t\tconsole.log(err.statusCode)\n\t})"
- lang: Ruby
label: Ruby
source: "require 'mailjet'\nMailjet.configure do |config|\n config.api_key = ENV['MJ_APIKEY_PUBLIC']\n config.secret_key = ENV['MJ_APIKEY_PRIVATE']\n config.api_version = \"v3\"\nend\nvariable = Mailjet::Dns_check.create(id: $dns_ID,\n)\np variable.attributes['Data']"
- lang: Python
label: Python
source: "from mailjet_rest import Client\nimport os\napi_key = os.environ['MJ_APIKEY_PUBLIC']\napi_secret = os.environ['MJ_APIKEY_PRIVATE']\nmailjet = Client(auth=(api_key, api_secret), version='v3')\nid = '$dns_ID'\nresult = mailjet.dns_check.create(id=id)\nprint result.status_code\nprint result.json()"
- lang: Java
label: Java
source: "package com.my.project;\nimport com.mailjet.client.errors.MailjetException;\nimport com.mailjet.client.errors.MailjetSocketTimeoutException;\nimport com.mailjet.client.MailjetClient;\nimport com.mailjet.client.MailjetRequest;\nimport com.mailjet.client.MailjetResponse;\nimport com.mailjet.client.ClientOptions;\nimport com.mailjet.client.resource.DnsCheck;\nimport org.json.JSONArray;\nimport org.json.JSONObject;\npublic class MyClass {\n public static void main(String[] args) throws MailjetException, MailjetSocketTimeoutException {\n MailjetClient client;\n MailjetRequest request;\n MailjetResponse response;\n client = new MailjetClient(System.getenv(\"MJ_APIKEY_PUBLIC\"), System.getenv(\"MJ_APIKEY_PRIVATE\"), new ClientOptions(\"v3\"));\n request = new MailjetRequest(DnsCheck.resource, ID);\n response = client.post(request);\n System.out.println(response.getStatus());\n System.out.println(response.getData());\n }\n}"
- lang: Go
label: Go
source: "package main\nimport (\n\t\"fmt\"\n\t\"log\"\n\t\"os\"\n\tmailjet \"github.com/mailjet/mailjet-apiv3-go\"\n\t\"github.com/mailjet/mailjet-apiv3-go/resources\"\n)\nfunc main () {\n\tmailjetClient := NewMailjetClient(os.Getenv(\"MJ_APIKEY_PUBLIC\"), os.Getenv(\"MJ_APIKEY_PRIVATE\"))\n\tvar data []resources.DnsCheck\n\tmr := &Request{\n\t Resource: \"dns\",\n\t ID: RESOURCE_ID,\n\t Action: \"check\",\n\t}\n\tfmr := &FullRequest{\n\t Info: mr,\n\t Payload: &resources.DnsCheck { }\n\t}\n\terr := mailjetClient.Post(fmr, &data)\n\tif err != nil {\n\t fmt.Println(err)\n\t}\n\tfmt.Printf(\"Data array: %+v\\n\", data)\n}"
- lang: C#
label: C#
source: "using Mailjet.Client;\nusing Mailjet.Client.Resources;\nusing System;\nusing Newtonsoft.Json.Linq;\nnamespace Mailjet.ConsoleApplication\n{\n class Program\n {\n static void Main(string[] args)\n {\n RunAsync().Wait();\n }\n static async Task RunAsync()\n {\n MailjetClient client = new MailjetClient(Environment.GetEnvironmentVariable(\"MJ_APIKEY_PUBLIC\"), Environment.GetEnvironmentVariable(\"MJ_APIKEY_PRIVATE\"))\n {\n Version = ApiVersion.V3,\n };\n MailjetRequest request = new MailjetRequest\n {\n Resource = DnsCheck.Resource,\n ResourceId = ResourceId.Numeric(ID)\n }\n MailjetResponse response = await client.PostAsync(request);\n if (response.IsSuccessStatusCode)\n {\n Console.WriteLine(string.Format(\"Total: {0}, Count: {1}\\n\", response.GetTotal(), response.GetCount()));\n Console.WriteLine(response.GetData());\n }\n else\n {\n Console.WriteLine(string.Format(\"StatusCode: {0}\\n\", response.StatusCode));\n Console.WriteLine(string.Format(\"ErrorInfo: {0}\\n\", response.GetErrorInfo()));\n Console.WriteLine(response.GetData());\n Console.WriteLine(string.Format(\"ErrorMessage: {0}\\n\", response.GetErrorMessage()));\n }\n }\n }\n}"
"/v3/REST/metasender":
get:
x-seo:
title: "Meta Sender List"
description: "Retrieve a list of all metasenders and their configuration settings. A metasender is a sender available for use by the Primary API Key and all\u2026"
tags:
- Sender Addresses and Domains
summary: Meta Sender List
description: "Retrieve a list of all metasenders and their configuration settings. A metasender is a sender available for use by the Primary API Key and all sub-accounts. The e-mail address or domain has to be registered and validated before being used to send e-mails. Validation is done by contacting the Mailjet Support team. In order to manage a sender available for a single API Key, see the related `/sender` resource.\n\n> Note: The maximum number of senders and metasenders per user is 100. This includes both validated (`Active`) and non-validated (`Inactive`) ones, but does not include Deleted senders / metasenders.\n"
operationId: get_v3_metasender
parameters:
- name: DNS
in: query
schema:
$ref: '#/components/schemas/get_v3_metasender_QueryParams/properties/DNS'
responses:
'200':
description: Default OK response for `/metasender`
content:
application/json:
schema:
type: object
properties:
Count:
description: Indicates the number of objects in the `Data` array.
type: integer
format: int64
examples:
- 1
Data:
description: A JSON array containing a list of objects returned by this endpoint.
type: array
items:
$ref: '#/components/schemas/OutputMetasender'
Total:
description: Indicates the number of objects in the `Data` array.
type: integer
format: int64
examples:
- 1
'400':
$ref: '#/components/responses/400'
'401':
$ref: '#/components/responses/401'
'403':
$ref: '#/components/responses/403'
'404':
$ref: '#/components/responses/404'
'429':
$ref: '#/components/responses/429'
'500':
$ref: '#/components/responses/500'
security:
- basicAuth: []
x-codeSamples:
- lang: curl
label: cURL
source: "curl -s \\\n\t-X GET \\\n\t--user \"$MJ_APIKEY_PUBLIC:$MJ_APIKEY_PRIVATE\" \\\n\thttps://api.mailjet.com/v3/REST/metasender \\"
- lang: PHP
label: PHP
source: " 'v3']);\n$response = $mj->get(Resources::$Metasender);\n$response->success() && var_dump($response->getData());\n?>"
- lang: Node.js
label: Node
source: "const mailjet = require ('node-mailjet')\n\t.connect(process.env.MJ_APIKEY_PUBLIC, process.env.MJ_APIKEY_PRIVATE)\nconst request = mailjet\n\t.get(\"metasender\", {'version': 'v3'})\n\t.request()\nrequest\n\t.then((result) => {\n\t\tconsole.log(result.body)\n\t})\n\t.catch((err) => {\n\t\tconsole.log(err.statusCode)\n\t})"
- lang: Ruby
label: Ruby
source: "require 'mailjet'\nMailjet.configure do |config|\n config.api_key = ENV['MJ_APIKEY_PUBLIC']\n config.secret_key = ENV['MJ_APIKEY_PRIVATE']\n config.api_version = \"v3\"\nend\nvariable = Mailjet::Metasender.all(\n)\np variable.attributes['Data']"
- lang: Python
label: Python
source: "from mailjet_rest import Client\nimport os\napi_key = os.environ['MJ_APIKEY_PUBLIC']\napi_secret = os.environ['MJ_APIKEY_PRIVATE']\nmailjet = Client(auth=(api_key, api_secret), version='v3')\nresult = mailjet.metasender.get()\nprint result.status_code\nprint result.json()"
- lang: Java
label: Java
source: "package com.my.project;\nimport com.mailjet.client.errors.MailjetException;\nimport com.mailjet.client.errors.MailjetSocketTimeoutException;\nimport com.mailjet.client.MailjetClient;\nimport com.mailjet.client.MailjetRequest;\nimport com.mailjet.client.MailjetResponse;\nimport com.mailjet.client.ClientOptions;\nimport com.mailjet.client.resource.Metasender;\nimport org.json.JSONArray;\nimport org.json.JSONObject;\npublic class MyClass {\n public static void main(String[] args) throws MailjetException, MailjetSocketTimeoutException {\n MailjetClient client;\n MailjetRequest request;\n MailjetResponse response;\n client = new MailjetClient(System.getenv(\"MJ_APIKEY_PUBLIC\"), System.getenv(\"MJ_APIKEY_PRIVATE\"), new ClientOptions(\"v3\"));\n request = new MailjetRequest(Metasender.resource);\n response = client.get(request);\n System.out.println(response.getStatus());\n System.out.println(response.getData());\n }\n}"
- lang: Go
label: Go
source: "package main\nimport (\n\t\"fmt\"\n\t\"log\"\n\t\"os\"\n\tmailjet \"github.com/mailjet/mailjet-apiv3-go\"\n\t\"github.com/mailjet/mailjet-apiv3-go/resources\"\n)\nfunc main () {\n\tmailjetClient := NewMailjetClient(os.Getenv(\"MJ_APIKEY_PUBLIC\"), os.Getenv(\"MJ_APIKEY_PRIVATE\"))\n\tvar data []resources.Metasender\n\t_, _, err := mailjetClient.List(\"metasender\", &data)\n\tif err != nil {\n\t fmt.Println(err)\n\t}\n\tfmt.Printf(\"Data array: %+v\\n\", data)\n}"
- lang: C#
label: C#
source: "using Mailjet.Client;\nusing Mailjet.Client.Resources;\nusing System;\nusing Newtonsoft.Json.Linq;\nnamespace Mailjet.ConsoleApplication\n{\n class Program\n {\n static void Main(string[] args)\n {\n RunAsync().Wait();\n }\n static async Task RunAsync()\n {\n MailjetClient client = new MailjetClient(Environment.GetEnvironmentVariable(\"MJ_APIKEY_PUBLIC\"), Environment.GetEnvironmentVariable(\"MJ_APIKEY_PRIVATE\"))\n {\n Version = ApiVersion.V3,\n };\n MailjetRequest request = new MailjetRequest\n {\n Resource = Metasender.Resource,\n }\n MailjetResponse response = await client.GetAsync(request);\n if (response.IsSuccessStatusCode)\n {\n Console.WriteLine(string.Format(\"Total: {0}, Count: {1}\\n\", response.GetTotal(), response.GetCount()));\n Console.WriteLine(response.GetData());\n }\n else\n {\n Console.WriteLine(string.Format(\"StatusCode: {0}\\n\", response.StatusCode));\n Console.WriteLine(string.Format(\"ErrorInfo: {0}\\n\", response.GetErrorInfo()));\n Console.WriteLine(response.GetData());\n Console.WriteLine(string.Format(\"ErrorMessage: {0}\\n\", response.GetErrorMessage()));\n }\n }\n }\n}"
post:
x-seo:
title: "Create Meta Sender"
description: "Create a new metasender email address or domain. A metasender is a sender available for use by the Primary API Key and all sub-accounts. The e-mail\u2026"
tags:
- Sender Addresses and Domains
summary: Create Meta Sender
description: "Create a new metasender email address or domain. A metasender is a sender available for use by the Primary API Key and all sub-accounts. The e-mail address or domain has to be registered and validated before being used to send e-mails. Validation is done by contacting the Mailjet Support team. In order to manage a sender available for a single API Key, see the related `/sender` resource.\n\n> Note: The maximum number of senders and metasenders per user is 100. This includes both validated (`Active`) and non-validated (`Inactive`) ones, but does not include Deleted senders / metasenders.\n"
operationId: post_v3_metasender
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/NewMetasender'
example:
Description: Metasender 1 - used for Promo emails
Email: contact@example.com
responses:
'201':
description: Default OK response for `/metasender`
content:
application/json:
schema:
type: object
properties:
Count:
description: Indicates the number of objects in the `Data` array.
type: integer
format: int64
examples:
- 1
Data:
description: A JSON array containing a list of objects returned by this endpoint.
type: array
items:
$ref: '#/components/schemas/OutputMetasender'
Total:
description: Indicates the number of objects in the `Data` array.
type: integer
format: int64
examples:
- 1
'400':
$ref: '#/components/responses/400'
'401':
$ref: '#/components/responses/401'
'403':
$ref: '#/components/responses/403'
'404':
$ref: '#/components/responses/404'
'429':
$ref: '#/components/responses/429'
'500':
$ref: '#/components/responses/500'
security:
- basicAuth: []
x-codeSamples:
- lang: curl
label: cURL
source: "curl -s \\\n\t-X POST \\\n\t--user \"$MJ_APIKEY_PUBLIC:$MJ_APIKEY_PRIVATE\" \\\n\thttps://api.mailjet.com/v3/REST/metasender \\\n\t-H 'Content-Type: application/json' \\\n\t-d '{\n \"Description\":\"Metasender 1 - used for Promo emails\",\n \"Email\":\"pilot@mailjet.com\"\n\t}'"
- lang: PHP
label: PHP
source: " 'v3']);\n$body = [\n 'Description' => \"Metasender 1 - used for Promo emails\",\n 'Email' => \"pilot@mailjet.com\"\n];\n$response = $mj->post(Resources::$Metasender, ['body' => $body]);\n$response->success() && var_dump($response->getData());\n?>"
- lang: Node.js
label: Node
source: "const mailjet = require ('node-mailjet')\n\t.connect(process.env.MJ_APIKEY_PUBLIC, process.env.MJ_APIKEY_PRIVATE)\nconst request = mailjet\n\t.post(\"metasender\", {'version': 'v3'})\n\t.request({\n \"Description\":\"Metasender 1 - used for Promo emails\",\n \"Email\":\"pilot@mailjet.com\"\n })\nrequest\n\t.then((result) => {\n\t\tconsole.log(result.body)\n\t})\n\t.catch((err) => {\n\t\tconsole.log(err.statusCode)\n\t})"
- lang: Ruby
label: Ruby
source: "require 'mailjet'\nMailjet.configure do |config|\n config.api_key = ENV['MJ_APIKEY_PUBLIC']\n config.secret_key = ENV['MJ_APIKEY_PRIVATE']\n config.api_version = \"v3\"\nend\nvariable = Mailjet::Metasender.create(\n description: \"Metasender 1 - used for Promo emails\",\n email: \"pilot@mailjet.com\"\n)\np variable.attributes['Data']"
- lang: Python
label: Python
source: "from mailjet_rest import Client\nimport os\napi_key = os.environ['MJ_APIKEY_PUBLIC']\napi_secret = os.environ['MJ_APIKEY_PRIVATE']\nmailjet = Client(auth=(api_key, api_secret), version='v3')\ndata = {\n 'Description': \"Metasender 1 - used for Promo emails\",\n 'Email': \"pilot@mailjet.com\"\n}\nresult = mailjet.metasender.create(data=data)\nprint result.status_code\nprint result.json()"
- lang: Java
label: Java
source: "package com.my.project;\nimport com.mailjet.client.errors.MailjetException;\nimport com.mailjet.client.errors.MailjetSocketTimeoutException;\nimport com.mailjet.client.MailjetClient;\nimport com.mailjet.client.MailjetRequest;\nimport com.mailjet.client.MailjetResponse;\nimport com.mailjet.client.ClientOptions;\nimport com.mailjet.client.resource.Metasender;\nimport org.json.JSONArray;\nimport org.json.JSONObject;\npublic class MyClass {\n public static void main(String[] args) throws MailjetException, MailjetSocketTimeoutException {\n MailjetClient client;\n MailjetRequest request;\n MailjetResponse response;\n client = new MailjetClient(System.getenv(\"MJ_APIKEY_PUBLIC\"), System.getenv(\"MJ_APIKEY_PRIVATE\"), new ClientOptions(\"v3\"));\n request = new MailjetRequest(Metasender.resource)\n .property(Metasender.DESCRIPTION, \"Metasender 1 - used for Promo emails\")\n .property(Metasender.EMAIL, \"pilot@mailjet.com\")\n );\n response = client.post(request);\n System.out.println(response.getStatus());\n System.out.println(response.getData());\n }\n}"
- lang: Go
label: Go
source: "package main\nimport (\n\t\"fmt\"\n\t\"log\"\n\t\"os\"\n\tmailjet \"github.com/mailjet/mailjet-apiv3-go\"\n\t\"github.com/mailjet/mailjet-apiv3-go/resources\"\n)\nfunc main () {\n\tmailjetClient := NewMailjetClient(os.Getenv(\"MJ_APIKEY_PUBLIC\"), os.Getenv(\"MJ_APIKEY_PRIVATE\"))\n\tvar data []resources.Metasender\n\tmr := &Request{\n\t Resource: \"metasender\",\n\t}\n\tfmr := &FullRequest{\n\t Info: mr,\n\t Payload: &resources.Metasender { \n\t Description:\"Metasender 1 - used for Promo emails\",\n\t Email:\"pilot@mailjet.com\"\n }\n\t}\n\terr := mailjetClient.Post(fmr, &data)\n\tif err != nil {\n\t fmt.Println(err)\n\t}\n\tfmt.Printf(\"Data array: %+v\\n\", data)\n}"
- lang: C#
label: C#
source: "using Mailjet.Client;\nusing Mailjet.Client.Resources;\nusing System;\nusing Newtonsoft.Json.Linq;\nnamespace Mailjet.ConsoleApplication\n{\n class Program\n {\n static void Main(string[] args)\n {\n RunAsync().Wait();\n }\n static async Task RunAsync()\n {\n MailjetClient client = new MailjetClient(Environment.GetEnvironmentVariable(\"MJ_APIKEY_PUBLIC\"), Environment.GetEnvironmentVariable(\"MJ_APIKEY_PRIVATE\"))\n {\n Version = ApiVersion.V3,\n };\n MailjetRequest request = new MailjetRequest\n {\n Resource = Metasender.Resource,\n }\n .Property(Metasender.Description, \"Metasender 1 - used for Promo emails\")\n .Property(Metasender.Email, \"pilot@mailjet.com\");\n MailjetResponse response = await client.PostAsync(request);\n if (response.IsSuccessStatusCode)\n {\n Console.WriteLine(string.Format(\"Total: {0}, Count: {1}\\n\", response.GetTotal(), response.GetCount()));\n Console.WriteLine(response.GetData());\n }\n else\n {\n Console.WriteLine(string.Format(\"StatusCode: {0}\\n\", response.StatusCode));\n Console.WriteLine(string.Format(\"ErrorInfo: {0}\\n\", response.GetErrorInfo()));\n Console.WriteLine(response.GetData());\n Console.WriteLine(string.Format(\"ErrorMessage: {0}\\n\", response.GetErrorMessage()));\n }\n }\n }\n}"
"/v3/REST/metasender/{metasender_ID}":
get:
x-seo:
title: "Meta Sender by ID"
description: "Meta Sender by ID in the Mailjet Email API. Retrieve an existing metasender object and its configuration settings."
tags:
- Sender Addresses and Domains
summary: Meta Sender by ID
description: Retrieve an existing metasender object and its configuration settings. To obtain a valid `metasender_ID`, first call `GET /v3/REST/metasender` to list your metasenders.
operationId: get_v3_metasender_id
parameters:
- name: metasender_ID
in: path
schema:
$ref: '#/components/schemas/get_v3_metasender_id_PathParams/properties/metasender_ID'
required: true
example: 15000
responses:
'200':
description: Default OK response for `/metasender`
content:
application/json:
schema:
type: object
properties:
Count:
description: Indicates the number of objects in the `Data` array.
type: integer
format: int64
examples:
- 1
Data:
description: A JSON array containing a list of objects returned by this endpoint.
type: array
items:
$ref: '#/components/schemas/OutputMetasender'
Total:
description: Indicates the number of objects in the `Data` array.
type: integer
format: int64
examples:
- 1
'400':
$ref: '#/components/responses/400'
'401':
$ref: '#/components/responses/401'
'403':
$ref: '#/components/responses/403'
'404':
$ref: '#/components/responses/404'
'429':
$ref: '#/components/responses/429'
'500':
$ref: '#/components/responses/500'
security:
- basicAuth: []
x-codeSamples:
- lang: curl
label: cURL
source: "curl -s \\\n\t-X GET \\\n\t--user \"$MJ_APIKEY_PUBLIC:$MJ_APIKEY_PRIVATE\" \\\n\thttps://api.mailjet.com/v3/REST/metasender/$metasender_ID \\"
- lang: PHP
label: PHP
source: " 'v3']);\n$response = $mj->get(Resources::$Metasender, ['id' => $id]);\n$response->success() && var_dump($response->getData());\n?>"
- lang: Node.js
label: Node
source: "const mailjet = require ('node-mailjet')\n\t.connect(process.env.MJ_APIKEY_PUBLIC, process.env.MJ_APIKEY_PRIVATE)\nconst request = mailjet\n\t.get(\"metasender\", {'version': 'v3'})\n\t.id($metasender_ID)\n\t.request()\nrequest\n\t.then((result) => {\n\t\tconsole.log(result.body)\n\t})\n\t.catch((err) => {\n\t\tconsole.log(err.statusCode)\n\t})"
- lang: Ruby
label: Ruby
source: "require 'mailjet'\nMailjet.configure do |config|\n config.api_key = ENV['MJ_APIKEY_PUBLIC']\n config.secret_key = ENV['MJ_APIKEY_PRIVATE']\n config.api_version = \"v3\"\nend\nvariable = Mailjet::Metasender.find($metasender_ID\n)\np variable.attributes['Data']"
- lang: Python
label: Python
source: "from mailjet_rest import Client\nimport os\napi_key = os.environ['MJ_APIKEY_PUBLIC']\napi_secret = os.environ['MJ_APIKEY_PRIVATE']\nmailjet = Client(auth=(api_key, api_secret), version='v3')\nid = '$metasender_ID'\nresult = mailjet.metasender.get(id=id)\nprint result.status_code\nprint result.json()"
- lang: Java
label: Java
source: "package com.my.project;\nimport com.mailjet.client.errors.MailjetException;\nimport com.mailjet.client.errors.MailjetSocketTimeoutException;\nimport com.mailjet.client.MailjetClient;\nimport com.mailjet.client.MailjetRequest;\nimport com.mailjet.client.MailjetResponse;\nimport com.mailjet.client.ClientOptions;\nimport com.mailjet.client.resource.Metasender;\nimport org.json.JSONArray;\nimport org.json.JSONObject;\npublic class MyClass {\n public static void main(String[] args) throws MailjetException, MailjetSocketTimeoutException {\n MailjetClient client;\n MailjetRequest request;\n MailjetResponse response;\n client = new MailjetClient(System.getenv(\"MJ_APIKEY_PUBLIC\"), System.getenv(\"MJ_APIKEY_PRIVATE\"), new ClientOptions(\"v3\"));\n request = new MailjetRequest(Metasender.resource, ID);\n response = client.get(request);\n System.out.println(response.getStatus());\n System.out.println(response.getData());\n }\n}"
- lang: Go
label: Go
source: "package main\nimport (\n\t\"fmt\"\n\t\"log\"\n\t\"os\"\n\tmailjet \"github.com/mailjet/mailjet-apiv3-go\"\n\t\"github.com/mailjet/mailjet-apiv3-go/resources\"\n)\nfunc main () {\n\tmailjetClient := NewMailjetClient(os.Getenv(\"MJ_APIKEY_PUBLIC\"), os.Getenv(\"MJ_APIKEY_PRIVATE\"))\n\tvar data []resources.Metasender\n\tmr := &Request{\n\t Resource: \"metasender\",\n\t ID: RESOURCE_ID,\n\t}\n\terr := mailjetClient.Get(mr, &data)\n\tif err != nil {\n\t fmt.Println(err)\n\t}\n\tfmt.Printf(\"Data array: %+v\\n\", data)\n}"
- lang: C#
label: C#
source: "using Mailjet.Client;\nusing Mailjet.Client.Resources;\nusing System;\nusing Newtonsoft.Json.Linq;\nnamespace Mailjet.ConsoleApplication\n{\n class Program\n {\n static void Main(string[] args)\n {\n RunAsync().Wait();\n }\n static async Task RunAsync()\n {\n MailjetClient client = new MailjetClient(Environment.GetEnvironmentVariable(\"MJ_APIKEY_PUBLIC\"), Environment.GetEnvironmentVariable(\"MJ_APIKEY_PRIVATE\"))\n {\n Version = ApiVersion.V3,\n };\n MailjetRequest request = new MailjetRequest\n {\n Resource = Metasender.Resource,\n ResourceId = ResourceId.Numeric(ID)\n }\n MailjetResponse response = await client.GetAsync(request);\n if (response.IsSuccessStatusCode)\n {\n Console.WriteLine(string.Format(\"Total: {0}, Count: {1}\\n\", response.GetTotal(), response.GetCount()));\n Console.WriteLine(response.GetData());\n }\n else\n {\n Console.WriteLine(string.Format(\"StatusCode: {0}\\n\", response.StatusCode));\n Console.WriteLine(string.Format(\"ErrorInfo: {0}\\n\", response.GetErrorInfo()));\n Console.WriteLine(response.GetData());\n Console.WriteLine(string.Format(\"ErrorMessage: {0}\\n\", response.GetErrorMessage()));\n }\n }\n }\n}"
put:
x-seo:
title: "Update Metasender"
description: "Update and existing metasender email address or domain. Only the email address and description can be updated."
tags:
- Sender Addresses and Domains
summary: Update Metasender
description: Update and existing metasender email address or domain. Only the email address and description can be updated. To obtain a valid `metasender_ID`, first call `GET /v3/REST/metasender` to list your metasenders.
operationId: put_v3_metasender_id
parameters:
- name: metasender_ID
in: path
schema:
$ref: '#/components/schemas/put_v3_metasender_id_PathParams/properties/metasender_ID'
required: true
example: 15000
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/UpdateMetasender'
example:
Description: Metasender 1 - used for Promo emails
responses:
'200':
description: Default OK response for `/metasender`
content:
application/json:
schema:
type: object
properties:
Count:
description: Indicates the number of objects in the `Data` array.
type: integer
format: int64
examples:
- 1
Data:
description: A JSON array containing a list of objects returned by this endpoint.
type: array
items:
$ref: '#/components/schemas/OutputMetasender'
Total:
description: Indicates the number of objects in the `Data` array.
type: integer
format: int64
examples:
- 1
'400':
$ref: '#/components/responses/400'
'401':
$ref: '#/components/responses/401'
'403':
$ref: '#/components/responses/403'
'404':
$ref: '#/components/responses/404'
'429':
$ref: '#/components/responses/429'
'500':
$ref: '#/components/responses/500'
security:
- basicAuth: []
x-codeSamples:
- lang: curl
label: cURL
source: "curl -s \\\n\t-X PUT \\\n\t--user \"$MJ_APIKEY_PUBLIC:$MJ_APIKEY_PRIVATE\" \\\n\thttps://api.mailjet.com/v3/REST/metasender/$metasender_ID \\\n\t-H 'Content-Type: application/json' \\\n\t-d '{\n \"Description\":\"Metasender 1 - used for Promo emails\"\n\t}'"
- lang: PHP
label: PHP
source: " 'v3']);\n$body = [\n 'Description' => \"Metasender 1 - used for Promo emails\"\n];\n$response = $mj->put(Resources::$Metasender, ['id' => $id, 'body' => $body]);\n$response->success() && var_dump($response->getData());\n?>"
- lang: Node.js
label: Node
source: "const mailjet = require ('node-mailjet')\n\t.connect(process.env.MJ_APIKEY_PUBLIC, process.env.MJ_APIKEY_PRIVATE)\nconst request = mailjet\n\t.put(\"metasender\", {'version': 'v3'})\n\t.id($metasender_ID)\n\t.request({\n \"Description\":\"Metasender 1 - used for Promo emails\"\n })\nrequest\n\t.then((result) => {\n\t\tconsole.log(result.body)\n\t})\n\t.catch((err) => {\n\t\tconsole.log(err.statusCode)\n\t})"
- lang: Ruby
label: Ruby
source: "require 'mailjet'\nMailjet.configure do |config|\n config.api_key = ENV['MJ_APIKEY_PUBLIC']\n config.secret_key = ENV['MJ_APIKEY_PRIVATE']\n config.api_version = \"v3\"\nend\ntarget = Mailjet::Metasender.find($metasender_ID)\ntarget.update_attributes(\n description: \"Metasender 1 - used for Promo emails\"\n)\np variable.attributes['Data']"
- lang: Python
label: Python
source: "from mailjet_rest import Client\nimport os\napi_key = os.environ['MJ_APIKEY_PUBLIC']\napi_secret = os.environ['MJ_APIKEY_PRIVATE']\nmailjet = Client(auth=(api_key, api_secret), version='v3')\nid = '$metasender_ID'\ndata = {\n 'Description': \"Metasender 1 - used for Promo emails\"\n}\nresult = mailjet.metasender.update(id=id, data=data)\nprint result.status_code\nprint result.json()"
- lang: Java
label: Java
source: "package com.my.project;\nimport com.mailjet.client.errors.MailjetException;\nimport com.mailjet.client.errors.MailjetSocketTimeoutException;\nimport com.mailjet.client.MailjetClient;\nimport com.mailjet.client.MailjetRequest;\nimport com.mailjet.client.MailjetResponse;\nimport com.mailjet.client.ClientOptions;\nimport com.mailjet.client.resource.Metasender;\nimport org.json.JSONArray;\nimport org.json.JSONObject;\npublic class MyClass {\n public static void main(String[] args) throws MailjetException, MailjetSocketTimeoutException {\n MailjetClient client;\n MailjetRequest request;\n MailjetResponse response;\n client = new MailjetClient(System.getenv(\"MJ_APIKEY_PUBLIC\"), System.getenv(\"MJ_APIKEY_PRIVATE\"), new ClientOptions(\"v3\"));\n request = new MailjetRequest(Metasender.resource, ID)\n .property(Metasender.DESCRIPTION, \"Metasender 1 - used for Promo emails\")\n );\n response = client.put(request);\n System.out.println(response.getStatus());\n System.out.println(response.getData());\n }\n}"
- lang: Go
label: Go
source: "package main\nimport (\n\t\"fmt\"\n\t\"log\"\n\t\"os\"\n\tmailjet \"github.com/mailjet/mailjet-apiv3-go\"\n\t\"github.com/mailjet/mailjet-apiv3-go/resources\"\n)\nfunc main () {\n\tmailjetClient := NewMailjetClient(os.Getenv(\"MJ_APIKEY_PUBLIC\"), os.Getenv(\"MJ_APIKEY_PRIVATE\"))\n\tmr := &Request{\n\t Resource: \"metasender\",\n\t ID: RESOURCE_ID,\n\t}\n\tfmr := &FullRequest{\n\t Info: mr,\n\t Payload: &resources.Metasender { \n\t Description:\"Metasender 1 - used for Promo emails\"\n }\n\t}\n\terr := mailjetClient.Put(fmr)\n\tif err != nil {\n\t fmt.Println(err)\n\t}\n}"
- lang: C#
label: C#
source: "using Mailjet.Client;\nusing Mailjet.Client.Resources;\nusing System;\nusing Newtonsoft.Json.Linq;\nnamespace Mailjet.ConsoleApplication\n{\n class Program\n {\n static void Main(string[] args)\n {\n RunAsync().Wait();\n }\n static async Task RunAsync()\n {\n MailjetClient client = new MailjetClient(Environment.GetEnvironmentVariable(\"MJ_APIKEY_PUBLIC\"), Environment.GetEnvironmentVariable(\"MJ_APIKEY_PRIVATE\"))\n {\n Version = ApiVersion.V3,\n };\n MailjetRequest request = new MailjetRequest\n {\n Resource = Metasender.Resource,\n ResourceId = ResourceId.Numeric(ID)\n }\n .Property(Metasender.Description, \"Metasender 1 - used for Promo emails\");\n MailjetResponse response = await client.PutAsync(request);\n if (response.IsSuccessStatusCode)\n {\n Console.WriteLine(string.Format(\"Total: {0}, Count: {1}\\n\", response.GetTotal(), response.GetCount()));\n Console.WriteLine(response.GetData());\n }\n else\n {\n Console.WriteLine(string.Format(\"StatusCode: {0}\\n\", response.StatusCode));\n Console.WriteLine(string.Format(\"ErrorInfo: {0}\\n\", response.GetErrorInfo()));\n Console.WriteLine(response.GetData());\n Console.WriteLine(string.Format(\"ErrorMessage: {0}\\n\", response.GetErrorMessage()));\n }\n }\n }\n}"
"/v3/REST/apikey":
get:
x-seo:
title: "API Key List"
description: "Retrieve a list of all API Keys and their configuration settings. API Keys are used as credentials to access the API and SMTP server."
tags:
- Settings
summary: API Key List
description: Retrieve a list of all API Keys and their configuration settings. API Keys are used as credentials to access the API and SMTP server.
operationId: get_v3_apikey
parameters:
- name: APIKey
in: query
schema:
$ref: '#/components/schemas/get_v3_apikey_QueryParams/properties/APIKey'
- name: IsActive
in: query
schema:
$ref: '#/components/schemas/get_v3_apikey_QueryParams/properties/IsActive'
- name: IsMaster
in: query
schema:
$ref: '#/components/schemas/get_v3_apikey_QueryParams/properties/IsMaster'
- name: Name
in: query
schema:
$ref: '#/components/schemas/get_v3_apikey_QueryParams/properties/Name'
responses:
'200':
description: Default OK response for `/apikey`
content:
application/json:
schema:
type: object
properties:
Count:
description: Indicates the number of objects in the `Data` array.
type: integer
format: int64
examples:
- 1
Data:
description: A JSON array containing a list of objects returned by this endpoint.
type: array
items:
$ref: '#/components/schemas/OutputApikey'
Total:
description: Indicates the number of objects in the `Data` array.
type: integer
format: int64
examples:
- 1
'400':
$ref: '#/components/responses/400'
'401':
$ref: '#/components/responses/401'
'403':
$ref: '#/components/responses/403'
'404':
$ref: '#/components/responses/404'
'429':
$ref: '#/components/responses/429'
'500':
$ref: '#/components/responses/500'
security:
- basicAuth: []
x-codeSamples:
- lang: curl
label: cURL
source: "curl -s \\\n\t-X GET \\\n\t--user \"$MJ_APIKEY_PUBLIC:$MJ_APIKEY_PRIVATE\" \\\n\thttps://api.mailjet.com/v3/REST/apikey \\"
- lang: PHP
label: PHP
source: " 'v3']);\n$response = $mj->get(Resources::$Apikey);\n$response->success() && var_dump($response->getData());\n?>"
- lang: Node.js
label: Node
source: "const mailjet = require ('node-mailjet')\n\t.connect(process.env.MJ_APIKEY_PUBLIC, process.env.MJ_APIKEY_PRIVATE)\nconst request = mailjet\n\t.get(\"apikey\", {'version': 'v3'})\n\t.request()\nrequest\n\t.then((result) => {\n\t\tconsole.log(result.body)\n\t})\n\t.catch((err) => {\n\t\tconsole.log(err.statusCode)\n\t})"
- lang: Ruby
label: Ruby
source: "require 'mailjet'\nMailjet.configure do |config|\n config.api_key = ENV['MJ_APIKEY_PUBLIC']\n config.secret_key = ENV['MJ_APIKEY_PRIVATE']\n config.api_version = \"v3\"\nend\nvariable = Mailjet::Apikey.all(\n)\np variable.attributes['Data']"
- lang: Python
label: Python
source: "from mailjet_rest import Client\nimport os\napi_key = os.environ['MJ_APIKEY_PUBLIC']\napi_secret = os.environ['MJ_APIKEY_PRIVATE']\nmailjet = Client(auth=(api_key, api_secret), version='v3')\nresult = mailjet.apikey.get()\nprint result.status_code\nprint result.json()"
- lang: Java
label: Java
source: "package com.my.project;\nimport com.mailjet.client.errors.MailjetException;\nimport com.mailjet.client.errors.MailjetSocketTimeoutException;\nimport com.mailjet.client.MailjetClient;\nimport com.mailjet.client.MailjetRequest;\nimport com.mailjet.client.MailjetResponse;\nimport com.mailjet.client.ClientOptions;\nimport com.mailjet.client.resource.Apikey;\nimport org.json.JSONArray;\nimport org.json.JSONObject;\npublic class MyClass {\n public static void main(String[] args) throws MailjetException, MailjetSocketTimeoutException {\n MailjetClient client;\n MailjetRequest request;\n MailjetResponse response;\n client = new MailjetClient(System.getenv(\"MJ_APIKEY_PUBLIC\"), System.getenv(\"MJ_APIKEY_PRIVATE\"), new ClientOptions(\"v3\"));\n request = new MailjetRequest(Apikey.resource);\n response = client.get(request);\n System.out.println(response.getStatus());\n System.out.println(response.getData());\n }\n}"
- lang: Go
label: Go
source: "package main\nimport (\n\t\"fmt\"\n\t\"log\"\n\t\"os\"\n\tmailjet \"github.com/mailjet/mailjet-apiv3-go\"\n\t\"github.com/mailjet/mailjet-apiv3-go/resources\"\n)\nfunc main () {\n\tmailjetClient := NewMailjetClient(os.Getenv(\"MJ_APIKEY_PUBLIC\"), os.Getenv(\"MJ_APIKEY_PRIVATE\"))\n\tvar data []resources.Apikey\n\t_, _, err := mailjetClient.List(\"apikey\", &data)\n\tif err != nil {\n\t fmt.Println(err)\n\t}\n\tfmt.Printf(\"Data array: %+v\\n\", data)\n}"
- lang: C#
label: C#
source: "using Mailjet.Client;\nusing Mailjet.Client.Resources;\nusing System;\nusing Newtonsoft.Json.Linq;\nnamespace Mailjet.ConsoleApplication\n{\n class Program\n {\n static void Main(string[] args)\n {\n RunAsync().Wait();\n }\n static async Task RunAsync()\n {\n MailjetClient client = new MailjetClient(Environment.GetEnvironmentVariable(\"MJ_APIKEY_PUBLIC\"), Environment.GetEnvironmentVariable(\"MJ_APIKEY_PRIVATE\"))\n {\n Version = ApiVersion.V3,\n };\n MailjetRequest request = new MailjetRequest\n {\n Resource = Apikey.Resource,\n }\n MailjetResponse response = await client.GetAsync(request);\n if (response.IsSuccessStatusCode)\n {\n Console.WriteLine(string.Format(\"Total: {0}, Count: {1}\\n\", response.GetTotal(), response.GetCount()));\n Console.WriteLine(response.GetData());\n }\n else\n {\n Console.WriteLine(string.Format(\"StatusCode: {0}\\n\", response.StatusCode));\n Console.WriteLine(string.Format(\"ErrorInfo: {0}\\n\", response.GetErrorInfo()));\n Console.WriteLine(response.GetData());\n Console.WriteLine(string.Format(\"ErrorMessage: {0}\\n\", response.GetErrorMessage()));\n }\n }\n }\n}"
post:
x-seo:
title: "Create API Key"
description: "Create a sub-account with a new Public and Secret API Key. API Keys are used as credentials to access the API and SMTP server."
tags:
- Settings
summary: Create API Key
description: Create a sub-account with a new Public and Secret API Key. API Keys are used as credentials to access the API and SMTP server.
operationId: post_v3_apikey
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/NewApikey'
example:
IsActive: true
Name: API Key 1
responses:
'201':
description: Default OK response for `/apikey`
content:
application/json:
schema:
type: object
properties:
Count:
description: Indicates the number of objects in the `Data` array.
type: integer
format: int64
examples:
- 1
Data:
description: A JSON array containing a list of objects returned by this endpoint.
type: array
items:
$ref: '#/components/schemas/OutputApikey'
Total:
description: Indicates the number of objects in the `Data` array.
type: integer
format: int64
examples:
- 1
'400':
$ref: '#/components/responses/400'
'401':
$ref: '#/components/responses/401'
'403':
$ref: '#/components/responses/403'
'404':
$ref: '#/components/responses/404'
'429':
$ref: '#/components/responses/429'
'500':
$ref: '#/components/responses/500'
security:
- basicAuth: []
x-codeSamples:
- lang: curl
label: cURL
source: "curl -s \\\n\t-X POST \\\n\t--user \"$MJ_APIKEY_PUBLIC:$MJ_APIKEY_PRIVATE\" \\\n\thttps://api.mailjet.com/v3/REST/apikey \\\n\t-H 'Content-Type: application/json' \\\n\t-d '{\n \"ACL\":\"\",\n \"IsActive\":true,\n \"Name\":\"API Key 1\"\n\t}'"
- lang: PHP
label: PHP
source: " 'v3']);\n$body = [\n 'ACL' => \"\",\n 'IsActive' => true,\n 'Name' => \"API Key 1\"\n];\n$response = $mj->post(Resources::$Apikey, ['body' => $body]);\n$response->success() && var_dump($response->getData());\n?>"
- lang: Node.js
label: Node
source: "const mailjet = require ('node-mailjet')\n\t.connect(process.env.MJ_APIKEY_PUBLIC, process.env.MJ_APIKEY_PRIVATE)\nconst request = mailjet\n\t.post(\"apikey\", {'version': 'v3'})\n\t.request({\n \"ACL\":\"\",\n \"IsActive\":true,\n \"Name\":\"API Key 1\"\n })\nrequest\n\t.then((result) => {\n\t\tconsole.log(result.body)\n\t})\n\t.catch((err) => {\n\t\tconsole.log(err.statusCode)\n\t})"
- lang: Ruby
label: Ruby
source: "require 'mailjet'\nMailjet.configure do |config|\n config.api_key = ENV['MJ_APIKEY_PUBLIC']\n config.secret_key = ENV['MJ_APIKEY_PRIVATE']\n config.api_version = \"v3\"\nend\nvariable = Mailjet::Apikey.create(\n acl: \"\",\n is_active: true,\n name: \"API Key 1\"\n)\np variable.attributes['Data']"
- lang: Python
label: Python
source: "from mailjet_rest import Client\nimport os\napi_key = os.environ['MJ_APIKEY_PUBLIC']\napi_secret = os.environ['MJ_APIKEY_PRIVATE']\nmailjet = Client(auth=(api_key, api_secret), version='v3')\ndata = {\n 'ACL': \"\",\n 'IsActive': True,\n 'Name': \"API Key 1\"\n}\nresult = mailjet.apikey.create(data=data)\nprint result.status_code\nprint result.json()"
- lang: Java
label: Java
source: "package com.my.project;\nimport com.mailjet.client.errors.MailjetException;\nimport com.mailjet.client.errors.MailjetSocketTimeoutException;\nimport com.mailjet.client.MailjetClient;\nimport com.mailjet.client.MailjetRequest;\nimport com.mailjet.client.MailjetResponse;\nimport com.mailjet.client.ClientOptions;\nimport com.mailjet.client.resource.Apikey;\nimport org.json.JSONArray;\nimport org.json.JSONObject;\npublic class MyClass {\n public static void main(String[] args) throws MailjetException, MailjetSocketTimeoutException {\n MailjetClient client;\n MailjetRequest request;\n MailjetResponse response;\n client = new MailjetClient(System.getenv(\"MJ_APIKEY_PUBLIC\"), System.getenv(\"MJ_APIKEY_PRIVATE\"), new ClientOptions(\"v3\"));\n request = new MailjetRequest(Apikey.resource)\n .property(Apikey.ACL, )\n .property(Apikey.ISACTIVE, true)\n .property(Apikey.NAME, \"API Key 1\")\n );\n response = client.post(request);\n System.out.println(response.getStatus());\n System.out.println(response.getData());\n }\n}"
- lang: Go
label: Go
source: "package main\nimport (\n\t\"fmt\"\n\t\"log\"\n\t\"os\"\n\tmailjet \"github.com/mailjet/mailjet-apiv3-go\"\n\t\"github.com/mailjet/mailjet-apiv3-go/resources\"\n)\nfunc main () {\n\tmailjetClient := NewMailjetClient(os.Getenv(\"MJ_APIKEY_PUBLIC\"), os.Getenv(\"MJ_APIKEY_PRIVATE\"))\n\tvar data []resources.Apikey\n\tmr := &Request{\n\t Resource: \"apikey\",\n\t}\n\tfmr := &FullRequest{\n\t Info: mr,\n\t Payload: &resources.Apikey { \n\t ACL:\"\",\n\t IsActive:true,\n\t Name:\"API Key 1\"\n }\n\t}\n\terr := mailjetClient.Post(fmr, &data)\n\tif err != nil {\n\t fmt.Println(err)\n\t}\n\tfmt.Printf(\"Data array: %+v\\n\", data)\n}"
- lang: C#
label: C#
source: "using Mailjet.Client;\nusing Mailjet.Client.Resources;\nusing System;\nusing Newtonsoft.Json.Linq;\nnamespace Mailjet.ConsoleApplication\n{\n class Program\n {\n static void Main(string[] args)\n {\n RunAsync().Wait();\n }\n static async Task RunAsync()\n {\n MailjetClient client = new MailjetClient(Environment.GetEnvironmentVariable(\"MJ_APIKEY_PUBLIC\"), Environment.GetEnvironmentVariable(\"MJ_APIKEY_PRIVATE\"))\n {\n Version = ApiVersion.V3,\n };\n MailjetRequest request = new MailjetRequest\n {\n Resource = Apikey.Resource,\n }\n .Property(Apikey.ACL, )\n .Property(Apikey.IsActive, true)\n .Property(Apikey.Name, \"API Key 1\");\n MailjetResponse response = await client.PostAsync(request);\n if (response.IsSuccessStatusCode)\n {\n Console.WriteLine(string.Format(\"Total: {0}, Count: {1}\\n\", response.GetTotal(), response.GetCount()));\n Console.WriteLine(response.GetData());\n }\n else\n {\n Console.WriteLine(string.Format(\"StatusCode: {0}\\n\", response.StatusCode));\n Console.WriteLine(string.Format(\"ErrorInfo: {0}\\n\", response.GetErrorInfo()));\n Console.WriteLine(response.GetData());\n Console.WriteLine(string.Format(\"ErrorMessage: {0}\\n\", response.GetErrorMessage()));\n }\n }\n }\n}"
"/v3/REST/apikey/{apikey_ID}":
get:
x-seo:
title: "API Key by ID"
description: "Retrieve the configuration settings of a specific API Key. API Keys are used as credentials to access the API and SMTP server."
tags:
- Settings
summary: API Key by ID
description: Retrieve the configuration settings of a specific API Key. API Keys are used as credentials to access the API and SMTP server. To obtain a valid `apikey_ID`, first call `GET /v3/REST/apikey` to list your API keys.
operationId: get_v3_apikey_id
parameters:
- name: apikey_ID
in: path
schema:
$ref: '#/components/schemas/get_v3_apikey_id_PathParams/properties/apikey_ID'
required: true
example: 19000
responses:
'200':
description: Default OK response for `/apikey`
content:
application/json:
schema:
type: object
properties:
Count:
description: Indicates the number of objects in the `Data` array.
type: integer
format: int64
examples:
- 1
Data:
description: A JSON array containing a list of objects returned by this endpoint.
type: array
items:
$ref: '#/components/schemas/OutputApikey'
Total:
description: Indicates the number of objects in the `Data` array.
type: integer
format: int64
examples:
- 1
'400':
$ref: '#/components/responses/400'
'401':
$ref: '#/components/responses/401'
'403':
$ref: '#/components/responses/403'
'404':
$ref: '#/components/responses/404'
'429':
$ref: '#/components/responses/429'
'500':
$ref: '#/components/responses/500'
security:
- basicAuth: []
x-codeSamples:
- lang: curl
label: cURL
source: "curl -s \\\n\t-X GET \\\n\t--user \"$MJ_APIKEY_PUBLIC:$MJ_APIKEY_PRIVATE\" \\\n\thttps://api.mailjet.com/v3/REST/apikey/$apikey_ID \\"
- lang: PHP
label: PHP
source: " 'v3']);\n$response = $mj->get(Resources::$Apikey, ['id' => $id]);\n$response->success() && var_dump($response->getData());\n?>"
- lang: Node.js
label: Node
source: "const mailjet = require ('node-mailjet')\n\t.connect(process.env.MJ_APIKEY_PUBLIC, process.env.MJ_APIKEY_PRIVATE)\nconst request = mailjet\n\t.get(\"apikey\", {'version': 'v3'})\n\t.id($apikey_ID)\n\t.request()\nrequest\n\t.then((result) => {\n\t\tconsole.log(result.body)\n\t})\n\t.catch((err) => {\n\t\tconsole.log(err.statusCode)\n\t})"
- lang: Ruby
label: Ruby
source: "require 'mailjet'\nMailjet.configure do |config|\n config.api_key = ENV['MJ_APIKEY_PUBLIC']\n config.secret_key = ENV['MJ_APIKEY_PRIVATE']\n config.api_version = \"v3\"\nend\nvariable = Mailjet::Apikey.find($apikey_ID\n)\np variable.attributes['Data']"
- lang: Python
label: Python
source: "from mailjet_rest import Client\nimport os\napi_key = os.environ['MJ_APIKEY_PUBLIC']\napi_secret = os.environ['MJ_APIKEY_PRIVATE']\nmailjet = Client(auth=(api_key, api_secret), version='v3')\nid = '$apikey_ID'\nresult = mailjet.apikey.get(id=id)\nprint result.status_code\nprint result.json()"
- lang: Java
label: Java
source: "package com.my.project;\nimport com.mailjet.client.errors.MailjetException;\nimport com.mailjet.client.errors.MailjetSocketTimeoutException;\nimport com.mailjet.client.MailjetClient;\nimport com.mailjet.client.MailjetRequest;\nimport com.mailjet.client.MailjetResponse;\nimport com.mailjet.client.ClientOptions;\nimport com.mailjet.client.resource.Apikey;\nimport org.json.JSONArray;\nimport org.json.JSONObject;\npublic class MyClass {\n public static void main(String[] args) throws MailjetException, MailjetSocketTimeoutException {\n MailjetClient client;\n MailjetRequest request;\n MailjetResponse response;\n client = new MailjetClient(System.getenv(\"MJ_APIKEY_PUBLIC\"), System.getenv(\"MJ_APIKEY_PRIVATE\"), new ClientOptions(\"v3\"));\n request = new MailjetRequest(Apikey.resource, ID);\n response = client.get(request);\n System.out.println(response.getStatus());\n System.out.println(response.getData());\n }\n}"
- lang: Go
label: Go
source: "package main\nimport (\n\t\"fmt\"\n\t\"log\"\n\t\"os\"\n\tmailjet \"github.com/mailjet/mailjet-apiv3-go\"\n\t\"github.com/mailjet/mailjet-apiv3-go/resources\"\n)\nfunc main () {\n\tmailjetClient := NewMailjetClient(os.Getenv(\"MJ_APIKEY_PUBLIC\"), os.Getenv(\"MJ_APIKEY_PRIVATE\"))\n\tvar data []resources.Apikey\n\tmr := &Request{\n\t Resource: \"apikey\",\n\t ID: RESOURCE_ID,\n\t}\n\terr := mailjetClient.Get(mr, &data)\n\tif err != nil {\n\t fmt.Println(err)\n\t}\n\tfmt.Printf(\"Data array: %+v\\n\", data)\n}"
- lang: C#
label: C#
source: "using Mailjet.Client;\nusing Mailjet.Client.Resources;\nusing System;\nusing Newtonsoft.Json.Linq;\nnamespace Mailjet.ConsoleApplication\n{\n class Program\n {\n static void Main(string[] args)\n {\n RunAsync().Wait();\n }\n static async Task RunAsync()\n {\n MailjetClient client = new MailjetClient(Environment.GetEnvironmentVariable(\"MJ_APIKEY_PUBLIC\"), Environment.GetEnvironmentVariable(\"MJ_APIKEY_PRIVATE\"))\n {\n Version = ApiVersion.V3,\n };\n MailjetRequest request = new MailjetRequest\n {\n Resource = Apikey.Resource,\n ResourceId = ResourceId.Numeric(ID)\n }\n MailjetResponse response = await client.GetAsync(request);\n if (response.IsSuccessStatusCode)\n {\n Console.WriteLine(string.Format(\"Total: {0}, Count: {1}\\n\", response.GetTotal(), response.GetCount()));\n Console.WriteLine(response.GetData());\n }\n else\n {\n Console.WriteLine(string.Format(\"StatusCode: {0}\\n\", response.StatusCode));\n Console.WriteLine(string.Format(\"ErrorInfo: {0}\\n\", response.GetErrorInfo()));\n Console.WriteLine(response.GetData());\n Console.WriteLine(string.Format(\"ErrorMessage: {0}\\n\", response.GetErrorMessage()));\n }\n }\n }\n}"
put:
x-seo:
title: "Update API Key"
description: "Update the settings of an existing API Key. You can use this to deactivate an API Key as well. API Keys are used as credentials to access the API and\u2026"
tags:
- Settings
summary: Update API Key
description: Update the settings of an existing API Key. You can use this to deactivate an API Key as well. API Keys are used as credentials to access the API and SMTP server. To obtain a valid `apikey_ID`, first call `GET /v3/REST/apikey` to list your API keys.
operationId: put_v3_apikey_id
parameters:
- name: apikey_ID
in: path
schema:
$ref: '#/components/schemas/put_v3_apikey_id_PathParams/properties/apikey_ID'
required: true
example: 19000
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/UpdateApikey'
example:
IsActive: true
Name: API Key 1
responses:
'200':
description: Default OK response for `/apikey`
content:
application/json:
schema:
type: object
properties:
Count:
description: Indicates the number of objects in the `Data` array.
type: integer
format: int64
examples:
- 1
Data:
description: A JSON array containing a list of objects returned by this endpoint.
type: array
items:
$ref: '#/components/schemas/OutputApikey'
Total:
description: Indicates the number of objects in the `Data` array.
type: integer
format: int64
examples:
- 1
'400':
$ref: '#/components/responses/400'
'401':
$ref: '#/components/responses/401'
'403':
$ref: '#/components/responses/403'
'404':
$ref: '#/components/responses/404'
'429':
$ref: '#/components/responses/429'
'500':
$ref: '#/components/responses/500'
security:
- basicAuth: []
x-codeSamples:
- lang: curl
label: cURL
source: "curl -s \\\n\t-X PUT \\\n\t--user \"$MJ_APIKEY_PUBLIC:$MJ_APIKEY_PRIVATE\" \\\n\thttps://api.mailjet.com/v3/REST/apikey/$apikey_ID \\\n\t-H 'Content-Type: application/json' \\\n\t-d '{\n \"ACL\":\"\",\n \"IsActive\":true,\n \"Name\":\"API Key 1\"\n\t}'"
- lang: PHP
label: PHP
source: " 'v3']);\n$body = [\n 'ACL' => \"\",\n 'IsActive' => true,\n 'Name' => \"API Key 1\"\n];\n$response = $mj->put(Resources::$Apikey, ['id' => $id, 'body' => $body]);\n$response->success() && var_dump($response->getData());\n?>"
- lang: Node.js
label: Node
source: "const mailjet = require ('node-mailjet')\n\t.connect(process.env.MJ_APIKEY_PUBLIC, process.env.MJ_APIKEY_PRIVATE)\nconst request = mailjet\n\t.put(\"apikey\", {'version': 'v3'})\n\t.id($apikey_ID)\n\t.request({\n \"ACL\":\"\",\n \"IsActive\":true,\n \"Name\":\"API Key 1\"\n })\nrequest\n\t.then((result) => {\n\t\tconsole.log(result.body)\n\t})\n\t.catch((err) => {\n\t\tconsole.log(err.statusCode)\n\t})"
- lang: Ruby
label: Ruby
source: "require 'mailjet'\nMailjet.configure do |config|\n config.api_key = ENV['MJ_APIKEY_PUBLIC']\n config.secret_key = ENV['MJ_APIKEY_PRIVATE']\n config.api_version = \"v3\"\nend\ntarget = Mailjet::Apikey.find($apikey_ID)\ntarget.update_attributes(\n acl: \"\",\n is_active: true,\n name: \"API Key 1\"\n)\np variable.attributes['Data']"
- lang: Python
label: Python
source: "from mailjet_rest import Client\nimport os\napi_key = os.environ['MJ_APIKEY_PUBLIC']\napi_secret = os.environ['MJ_APIKEY_PRIVATE']\nmailjet = Client(auth=(api_key, api_secret), version='v3')\nid = '$apikey_ID'\ndata = {\n 'ACL': \"\",\n 'IsActive': True,\n 'Name': \"API Key 1\"\n}\nresult = mailjet.apikey.update(id=id, data=data)\nprint result.status_code\nprint result.json()"
- lang: Java
label: Java
source: "package com.my.project;\nimport com.mailjet.client.errors.MailjetException;\nimport com.mailjet.client.errors.MailjetSocketTimeoutException;\nimport com.mailjet.client.MailjetClient;\nimport com.mailjet.client.MailjetRequest;\nimport com.mailjet.client.MailjetResponse;\nimport com.mailjet.client.ClientOptions;\nimport com.mailjet.client.resource.Apikey;\nimport org.json.JSONArray;\nimport org.json.JSONObject;\npublic class MyClass {\n public static void main(String[] args) throws MailjetException, MailjetSocketTimeoutException {\n MailjetClient client;\n MailjetRequest request;\n MailjetResponse response;\n client = new MailjetClient(System.getenv(\"MJ_APIKEY_PUBLIC\"), System.getenv(\"MJ_APIKEY_PRIVATE\"), new ClientOptions(\"v3\"));\n request = new MailjetRequest(Apikey.resource, ID)\n .property(Apikey.ACL, )\n .property(Apikey.ISACTIVE, true)\n .property(Apikey.NAME, \"API Key 1\")\n );\n response = client.put(request);\n System.out.println(response.getStatus());\n System.out.println(response.getData());\n }\n}"
- lang: Go
label: Go
source: "package main\nimport (\n\t\"fmt\"\n\t\"log\"\n\t\"os\"\n\tmailjet \"github.com/mailjet/mailjet-apiv3-go\"\n\t\"github.com/mailjet/mailjet-apiv3-go/resources\"\n)\nfunc main () {\n\tmailjetClient := NewMailjetClient(os.Getenv(\"MJ_APIKEY_PUBLIC\"), os.Getenv(\"MJ_APIKEY_PRIVATE\"))\n\tmr := &Request{\n\t Resource: \"apikey\",\n\t ID: RESOURCE_ID,\n\t}\n\tfmr := &FullRequest{\n\t Info: mr,\n\t Payload: &resources.Apikey { \n\t ACL:\"\",\n\t IsActive:true,\n\t Name:\"API Key 1\"\n }\n\t}\n\terr := mailjetClient.Put(fmr)\n\tif err != nil {\n\t fmt.Println(err)\n\t}\n}"
- lang: C#
label: C#
source: "using Mailjet.Client;\nusing Mailjet.Client.Resources;\nusing System;\nusing Newtonsoft.Json.Linq;\nnamespace Mailjet.ConsoleApplication\n{\n class Program\n {\n static void Main(string[] args)\n {\n RunAsync().Wait();\n }\n static async Task RunAsync()\n {\n MailjetClient client = new MailjetClient(Environment.GetEnvironmentVariable(\"MJ_APIKEY_PUBLIC\"), Environment.GetEnvironmentVariable(\"MJ_APIKEY_PRIVATE\"))\n {\n Version = ApiVersion.V3,\n };\n MailjetRequest request = new MailjetRequest\n {\n Resource = Apikey.Resource,\n ResourceId = ResourceId.Numeric(ID)\n }\n .Property(Apikey.ACL, )\n .Property(Apikey.IsActive, true)\n .Property(Apikey.Name, \"API Key 1\");\n MailjetResponse response = await client.PutAsync(request);\n if (response.IsSuccessStatusCode)\n {\n Console.WriteLine(string.Format(\"Total: {0}, Count: {1}\\n\", response.GetTotal(), response.GetCount()));\n Console.WriteLine(response.GetData());\n }\n else\n {\n Console.WriteLine(string.Format(\"StatusCode: {0}\\n\", response.StatusCode));\n Console.WriteLine(string.Format(\"ErrorInfo: {0}\\n\", response.GetErrorInfo()));\n Console.WriteLine(response.GetData());\n Console.WriteLine(string.Format(\"ErrorMessage: {0}\\n\", response.GetErrorMessage()));\n }\n }\n }\n}"
"/v3/REST/myprofile":
get:
x-seo:
title: "My Profile"
description: "My Profile using the Mailjet Email API. Manage your user profile data such as address, payment information etc."
tags:
- Settings
summary: My Profile
description: Manage your user profile data such as address, payment information etc.
operationId: get_v3_myprofile
parameters:
- name: User
in: query
schema:
$ref: '#/components/schemas/get_v3_myprofile_QueryParams/properties/User'
responses:
'200':
description: Default OK response for `/myprofile`
content:
application/json:
schema:
type: object
properties:
Count:
description: Indicates the number of objects in the `Data` array.
type: integer
format: int64
examples:
- 1
Data:
description: A JSON array containing a list of objects returned by this endpoint.
type: array
items:
$ref: '#/components/schemas/OutputMyprofile'
Total:
description: Indicates the number of objects in the `Data` array.
type: integer
format: int64
examples:
- 1
'400':
$ref: '#/components/responses/400'
'401':
$ref: '#/components/responses/401'
'403':
$ref: '#/components/responses/403'
'404':
$ref: '#/components/responses/404'
'429':
$ref: '#/components/responses/429'
'500':
$ref: '#/components/responses/500'
security:
- basicAuth: []
x-codeSamples:
- lang: curl
label: cURL
source: "curl -s \\\n\t-X GET \\\n\t--user \"$MJ_APIKEY_PUBLIC:$MJ_APIKEY_PRIVATE\" \\\n\thttps://api.mailjet.com/v3/REST/myprofile \\"
- lang: PHP
label: PHP
source: " 'v3']);\n$response = $mj->get(Resources::$Myprofile);\n$response->success() && var_dump($response->getData());\n?>"
- lang: Node.js
label: Node
source: "const mailjet = require ('node-mailjet')\n\t.connect(process.env.MJ_APIKEY_PUBLIC, process.env.MJ_APIKEY_PRIVATE)\nconst request = mailjet\n\t.get(\"myprofile\", {'version': 'v3'})\n\t.request()\nrequest\n\t.then((result) => {\n\t\tconsole.log(result.body)\n\t})\n\t.catch((err) => {\n\t\tconsole.log(err.statusCode)\n\t})"
- lang: Ruby
label: Ruby
source: "require 'mailjet'\nMailjet.configure do |config|\n config.api_key = ENV['MJ_APIKEY_PUBLIC']\n config.secret_key = ENV['MJ_APIKEY_PRIVATE']\n config.api_version = \"v3\"\nend\nvariable = Mailjet::Myprofile.all(\n)\np variable.attributes['Data']"
- lang: Python
label: Python
source: "from mailjet_rest import Client\nimport os\napi_key = os.environ['MJ_APIKEY_PUBLIC']\napi_secret = os.environ['MJ_APIKEY_PRIVATE']\nmailjet = Client(auth=(api_key, api_secret), version='v3')\nresult = mailjet.myprofile.get()\nprint result.status_code\nprint result.json()"
- lang: Java
label: Java
source: "package com.my.project;\nimport com.mailjet.client.errors.MailjetException;\nimport com.mailjet.client.errors.MailjetSocketTimeoutException;\nimport com.mailjet.client.MailjetClient;\nimport com.mailjet.client.MailjetRequest;\nimport com.mailjet.client.MailjetResponse;\nimport com.mailjet.client.ClientOptions;\nimport com.mailjet.client.resource.Myprofile;\nimport org.json.JSONArray;\nimport org.json.JSONObject;\npublic class MyClass {\n public static void main(String[] args) throws MailjetException, MailjetSocketTimeoutException {\n MailjetClient client;\n MailjetRequest request;\n MailjetResponse response;\n client = new MailjetClient(System.getenv(\"MJ_APIKEY_PUBLIC\"), System.getenv(\"MJ_APIKEY_PRIVATE\"), new ClientOptions(\"v3\"));\n request = new MailjetRequest(Myprofile.resource);\n response = client.get(request);\n System.out.println(response.getStatus());\n System.out.println(response.getData());\n }\n}"
- lang: Go
label: Go
source: "package main\nimport (\n\t\"fmt\"\n\t\"log\"\n\t\"os\"\n\tmailjet \"github.com/mailjet/mailjet-apiv3-go\"\n\t\"github.com/mailjet/mailjet-apiv3-go/resources\"\n)\nfunc main () {\n\tmailjetClient := NewMailjetClient(os.Getenv(\"MJ_APIKEY_PUBLIC\"), os.Getenv(\"MJ_APIKEY_PRIVATE\"))\n\tvar data []resources.Myprofile\n\t_, _, err := mailjetClient.List(\"myprofile\", &data)\n\tif err != nil {\n\t fmt.Println(err)\n\t}\n\tfmt.Printf(\"Data array: %+v\\n\", data)\n}"
- lang: C#
label: C#
source: "using Mailjet.Client;\nusing Mailjet.Client.Resources;\nusing System;\nusing Newtonsoft.Json.Linq;\nnamespace Mailjet.ConsoleApplication\n{\n class Program\n {\n static void Main(string[] args)\n {\n RunAsync().Wait();\n }\n static async Task RunAsync()\n {\n MailjetClient client = new MailjetClient(Environment.GetEnvironmentVariable(\"MJ_APIKEY_PUBLIC\"), Environment.GetEnvironmentVariable(\"MJ_APIKEY_PRIVATE\"))\n {\n Version = ApiVersion.V3,\n };\n MailjetRequest request = new MailjetRequest\n {\n Resource = Myprofile.Resource,\n }\n MailjetResponse response = await client.GetAsync(request);\n if (response.IsSuccessStatusCode)\n {\n Console.WriteLine(string.Format(\"Total: {0}, Count: {1}\\n\", response.GetTotal(), response.GetCount()));\n Console.WriteLine(response.GetData());\n }\n else\n {\n Console.WriteLine(string.Format(\"StatusCode: {0}\\n\", response.StatusCode));\n Console.WriteLine(string.Format(\"ErrorInfo: {0}\\n\", response.GetErrorInfo()));\n Console.WriteLine(response.GetData());\n Console.WriteLine(string.Format(\"ErrorMessage: {0}\\n\", response.GetErrorMessage()));\n }\n }\n }\n}"
put:
x-seo:
title: "Update My Profile"
description: "Update My Profile in the Mailjet Email API. Update your profile information - personal and organization settings."
tags:
- Settings
summary: Update My Profile
description: Update your profile information - personal and organization settings.
operationId: put_v3_myprofile
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/UpdateMyprofile'
example:
AddressCity: Paris
AddressCountry: FR
AddressPostalCode: '75002'
AddressState: New York
AddressStreet: 37 bis, rue de Sentier
BillingEmail: billing@example.com
BirthdayAt: '2018-01-01T00:00:00'
CompanyName: Ma société
CompanyNumOfEmployees: '51'
ContactPhone: FR|600000000
EstimatedVolume: 10000
Firstname: Marie
Industry: 240
JobTitle: Marketer
Lastname: Jean
VATNumber: '1234567890'
Website: https://www.example.com/
responses:
'200':
description: Default OK response for `/myprofile`
content:
application/json:
schema:
type: object
properties:
Count:
description: Indicates the number of objects in the `Data` array.
type: integer
format: int64
examples:
- 1
Data:
description: A JSON array containing a list of objects returned by this endpoint.
type: array
items:
$ref: '#/components/schemas/OutputMyprofile'
Total:
description: Indicates the number of objects in the `Data` array.
type: integer
format: int64
examples:
- 1
'400':
$ref: '#/components/responses/400'
'401':
$ref: '#/components/responses/401'
'403':
$ref: '#/components/responses/403'
'404':
$ref: '#/components/responses/404'
'429':
$ref: '#/components/responses/429'
'500':
$ref: '#/components/responses/500'
security:
- basicAuth: []
x-codeSamples:
- lang: curl
label: cURL
source: "curl -s \\\n\t-X PUT \\\n\t--user \"$MJ_APIKEY_PUBLIC:$MJ_APIKEY_PRIVATE\" \\\n\thttps://api.mailjet.com/v3/REST/myprofile \\\n\t-H 'Content-Type: application/json' \\\n\t-d '{\n \"AddressCity\":\"Paris\",\n \"AddressCountry\":\"FR\",\n \"AddressPostalCode\":\"75002\",\n \"AddressState\":\"New York\",\n \"AddressStreet\":\"37 bis, rue de Sentier\",\n \"BillingEmail\":\"billing@example.com\",\n \"BirthdayAt\":\"2018-01-01T00:00:00\",\n \"CompanyName\":\"Ma société\",\n \"CompanyNumOfEmployees\":\"51\",\n \"ContactPhone\":\"FR|600000000\",\n \"EstimatedVolume\":10000,\n \"Features\":\"\",\n \"Firstname\":\"Marie\",\n \"Industry\":240,\n \"JobTitle\":\"Marketer\",\n \"Lastname\":\"Jean\",\n \"VATNumber\":\"1234567890\",\n \"Website\":\"https://www.example.com/\"\n\t}'"
- lang: PHP
label: PHP
source: " 'v3']);\n$body = [\n 'AddressCity' => \"Paris\",\n 'AddressCountry' => \"FR\",\n 'AddressPostalCode' => \"75002\",\n 'AddressState' => \"New York\",\n 'AddressStreet' => \"37 bis, rue de Sentier\",\n 'BillingEmail' => \"billing@example.com\",\n 'BirthdayAt' => \"2018-01-01T00:00:00\",\n 'CompanyName' => \"Ma société\",\n 'CompanyNumOfEmployees' => \"51\",\n 'ContactPhone' => \"FR|600000000\",\n 'EstimatedVolume' => 10000,\n 'Features' => \"\",\n 'Firstname' => \"Marie\",\n 'Industry' => 240,\n 'JobTitle' => \"Marketer\",\n 'Lastname' => \"Jean\",\n 'VATNumber' => \"1234567890\",\n 'Website' => \"https://www.example.com/\"\n];\n$response = $mj->put(Resources::$Myprofile, ['body' => $body]);\n$response->success() && var_dump($response->getData());\n?>"
- lang: Node.js
label: Node
source: "const mailjet = require ('node-mailjet')\n\t.connect(process.env.MJ_APIKEY_PUBLIC, process.env.MJ_APIKEY_PRIVATE)\nconst request = mailjet\n\t.put(\"myprofile\", {'version': 'v3'})\n\t.request({\n \"AddressCity\":\"Paris\",\n \"AddressCountry\":\"FR\",\n \"AddressPostalCode\":\"75002\",\n \"AddressState\":\"New York\",\n \"AddressStreet\":\"37 bis, rue de Sentier\",\n \"BillingEmail\":\"billing@example.com\",\n \"BirthdayAt\":\"2018-01-01T00:00:00\",\n \"CompanyName\":\"Ma société\",\n \"CompanyNumOfEmployees\":\"51\",\n \"ContactPhone\":\"FR|600000000\",\n \"EstimatedVolume\":10000,\n \"Features\":\"\",\n \"Firstname\":\"Marie\",\n \"Industry\":240,\n \"JobTitle\":\"Marketer\",\n \"Lastname\":\"Jean\",\n \"VATNumber\":\"1234567890\",\n \"Website\":\"https://www.example.com/\"\n })\nrequest\n\t.then((result) => {\n\t\tconsole.log(result.body)\n\t})\n\t.catch((err) => {\n\t\tconsole.log(err.statusCode)\n\t})"
- lang: Ruby
label: Ruby
source: "require 'mailjet'\nMailjet.configure do |config|\n config.api_key = ENV['MJ_APIKEY_PUBLIC']\n config.secret_key = ENV['MJ_APIKEY_PRIVATE']\n config.api_version = \"v3\"\nend\ntarget = Mailjet::Myprofile.find()\ntarget.update_attributes(\n address_city: \"Paris\",\n address_country: \"FR\",\n address_postal_code: \"75002\",\n address_state: \"New York\",\n address_street: \"37 bis, rue de Sentier\",\n billing_email: \"billing@example.com\",\n birthday_at: \"2018-01-01T00:00:00\",\n company_name: \"Ma société\",\n company_num_of_employees: \"51\",\n contact_phone: \"FR|600000000\",\n estimated_volume: 10000,\n features: \"\",\n firstname: \"Marie\",\n industry: 240,\n job_title: \"Marketer\",\n lastname: \"Jean\",\n vatnumber: \"1234567890\",\n website: \"https://www.example.com/\"\n)\np variable.attributes['Data']"
- lang: Python
label: Python
source: "from mailjet_rest import Client\nimport os\napi_key = os.environ['MJ_APIKEY_PUBLIC']\napi_secret = os.environ['MJ_APIKEY_PRIVATE']\nmailjet = Client(auth=(api_key, api_secret), version='v3')\ndata = {\n 'AddressCity': \"Paris\",\n 'AddressCountry': \"FR\",\n 'AddressPostalCode': \"75002\",\n 'AddressState': \"New York\",\n 'AddressStreet': \"37 bis, rue de Sentier\",\n 'BillingEmail': \"billing@example.com\",\n 'BirthdayAt': \"2018-01-01T00:00:00\",\n 'CompanyName': \"Ma société\",\n 'CompanyNumOfEmployees': \"51\",\n 'ContactPhone': \"FR|600000000\",\n 'EstimatedVolume': 10000,\n 'Features': \"\",\n 'Firstname': \"Marie\",\n 'Industry': 240,\n 'JobTitle': \"Marketer\",\n 'Lastname': \"Jean\",\n 'VATNumber': \"1234567890\",\n 'Website': \"https://www.example.com/\"\n}\nresult = mailjet.myprofile.update(data=data)\nprint result.status_code\nprint result.json()"
- lang: Java
label: Java
source: "package com.my.project;\nimport com.mailjet.client.errors.MailjetException;\nimport com.mailjet.client.errors.MailjetSocketTimeoutException;\nimport com.mailjet.client.MailjetClient;\nimport com.mailjet.client.MailjetRequest;\nimport com.mailjet.client.MailjetResponse;\nimport com.mailjet.client.ClientOptions;\nimport com.mailjet.client.resource.Myprofile;\nimport org.json.JSONArray;\nimport org.json.JSONObject;\npublic class MyClass {\n public static void main(String[] args) throws MailjetException, MailjetSocketTimeoutException {\n MailjetClient client;\n MailjetRequest request;\n MailjetResponse response;\n client = new MailjetClient(System.getenv(\"MJ_APIKEY_PUBLIC\"), System.getenv(\"MJ_APIKEY_PRIVATE\"), new ClientOptions(\"v3\"));\n request = new MailjetRequest(Myprofile.resource)\n .property(Myprofile.ADDRESSCITY, \"Paris\")\n .property(Myprofile.ADDRESSCOUNTRY, \"FR\")\n .property(Myprofile.ADDRESSPOSTALCODE, \"75002\")\n .property(Myprofile.ADDRESSSTATE, \"New York\")\n .property(Myprofile.ADDRESSSTREET, \"37 bis, rue de Sentier\")\n .property(Myprofile.BILLINGEMAIL, \"billing@example.com\")\n .property(Myprofile.BIRTHDAYAT, \"2018-01-01T00:00:00\")\n .property(Myprofile.COMPANYNAME, \"Ma société\")\n .property(Myprofile.COMPANYNUMOFEMPLOYEES, \"51\")\n .property(Myprofile.CONTACTPHONE, \"FR|600000000\")\n .property(Myprofile.ESTIMATEDVOLUME, 10000)\n .property(Myprofile.FEATURES, )\n .property(Myprofile.FIRSTNAME, \"Marie\")\n .property(Myprofile.INDUSTRY, 240)\n .property(Myprofile.JOBTITLE, \"Marketer\")\n .property(Myprofile.LASTNAME, \"Jean\")\n .property(Myprofile.VATNUMBER, \"1234567890\")\n .property(Myprofile.WEBSITE, \"https://www.example.com/\")\n );\n response = client.put(request);\n System.out.println(response.getStatus());\n System.out.println(response.getData());\n }\n}"
- lang: Go
label: Go
source: "package main\nimport (\n\t\"fmt\"\n\t\"log\"\n\t\"os\"\n\tmailjet \"github.com/mailjet/mailjet-apiv3-go\"\n\t\"github.com/mailjet/mailjet-apiv3-go/resources\"\n)\nfunc main () {\n\tmailjetClient := NewMailjetClient(os.Getenv(\"MJ_APIKEY_PUBLIC\"), os.Getenv(\"MJ_APIKEY_PRIVATE\"))\n\tmr := &Request{\n\t Resource: \"myprofile\",\n\t}\n\tfmr := &FullRequest{\n\t Info: mr,\n\t Payload: &resources.Myprofile { \n\t AddressCity:\"Paris\",\n\t AddressCountry:\"FR\",\n\t AddressPostalCode:\"75002\",\n\t AddressState:\"New York\",\n\t AddressStreet:\"37 bis, rue de Sentier\",\n\t BillingEmail:\"billing@example.com\",\n\t BirthdayAt:\"2018-01-01T00:00:00\",\n\t CompanyName:\"Ma société\",\n\t CompanyNumOfEmployees:\"51\",\n\t ContactPhone:\"FR|600000000\",\n\t EstimatedVolume:10000,\n\t Features:\"\",\n\t Firstname:\"Marie\",\n\t Industry:240,\n\t JobTitle:\"Marketer\",\n\t Lastname:\"Jean\",\n\t VATNumber:\"1234567890\",\n\t Website:\"https://www.example.com/\"\n }\n\t}\n\terr := mailjetClient.Put(fmr)\n\tif err != nil {\n\t fmt.Println(err)\n\t}\n}"
- lang: C#
label: C#
source: "using Mailjet.Client;\nusing Mailjet.Client.Resources;\nusing System;\nusing Newtonsoft.Json.Linq;\nnamespace Mailjet.ConsoleApplication\n{\n class Program\n {\n static void Main(string[] args)\n {\n RunAsync().Wait();\n }\n static async Task RunAsync()\n {\n MailjetClient client = new MailjetClient(Environment.GetEnvironmentVariable(\"MJ_APIKEY_PUBLIC\"), Environment.GetEnvironmentVariable(\"MJ_APIKEY_PRIVATE\"))\n {\n Version = ApiVersion.V3,\n };\n MailjetRequest request = new MailjetRequest\n {\n Resource = Myprofile.Resource,\n }\n .Property(Myprofile.AddressCity, \"Paris\")\n .Property(Myprofile.AddressCountry, \"FR\")\n .Property(Myprofile.AddressPostalCode, \"75002\")\n .Property(Myprofile.AddressState, \"New York\")\n .Property(Myprofile.AddressStreet, \"37 bis, rue de Sentier\")\n .Property(Myprofile.BillingEmail, \"billing@example.com\")\n .Property(Myprofile.BirthdayAt, \"2018-01-01T00:00:00\")\n .Property(Myprofile.CompanyName, \"Ma société\")\n .Property(Myprofile.CompanyNumOfEmployees, \"51\")\n .Property(Myprofile.ContactPhone, \"FR|600000000\")\n .Property(Myprofile.EstimatedVolume, 10000)\n .Property(Myprofile.Features, )\n .Property(Myprofile.Firstname, \"Marie\")\n .Property(Myprofile.Industry, 240)\n .Property(Myprofile.JobTitle, \"Marketer\")\n .Property(Myprofile.Lastname, \"Jean\")\n .Property(Myprofile.VATNumber, \"1234567890\")\n .Property(Myprofile.Website, \"https://www.example.com/\");\n MailjetResponse response = await client.PutAsync(request);\n if (response.IsSuccessStatusCode)\n {\n Console.WriteLine(string.Format(\"Total: {0}, Count: {1}\\n\", response.GetTotal(), response.GetCount()));\n Console.WriteLine(response.GetData());\n }\n else\n {\n Console.WriteLine(string.Format(\"StatusCode: {0}\\n\", response.StatusCode));\n Console.WriteLine(string.Format(\"ErrorInfo: {0}\\n\", response.GetErrorInfo()));\n Console.WriteLine(response.GetData());\n Console.WriteLine(string.Format(\"ErrorMessage: {0}\\n\", response.GetErrorMessage()));\n }\n }\n }\n}"
"/v3/REST/user":
get:
x-seo:
title: "User List"
description: "User List using the Mailjet Email API. Get general information on your user settings and activity."
tags:
- Settings
summary: User List
description: Get general information on your user settings and activity.
operationId: get_v3_user
parameters:
- name: IsActivated
in: query
schema:
$ref: '#/components/schemas/get_v3_user_QueryParams/properties/IsActivated'
- name: NewEmail
in: query
schema:
$ref: '#/components/schemas/get_v3_user_QueryParams/properties/NewEmail'
- name: UserName
in: query
schema:
$ref: '#/components/schemas/get_v3_user_QueryParams/properties/UserName'
responses:
'200':
description: Default OK response for `/user`
content:
application/json:
schema:
type: object
properties:
Count:
description: Indicates the number of objects in the `Data` array.
type: integer
format: int64
examples:
- 1
Data:
description: A JSON array containing a list of objects returned by this endpoint.
type: array
items:
$ref: '#/components/schemas/OutputUser'
Total:
description: Indicates the number of objects in the `Data` array.
type: integer
format: int64
examples:
- 1
'400':
$ref: '#/components/responses/400'
'401':
$ref: '#/components/responses/401'
'403':
$ref: '#/components/responses/403'
'404':
$ref: '#/components/responses/404'
'429':
$ref: '#/components/responses/429'
'500':
$ref: '#/components/responses/500'
security:
- basicAuth: []
x-codeSamples:
- lang: curl
label: cURL
source: "curl -s \\\n\t-X GET \\\n\t--user \"$MJ_APIKEY_PUBLIC:$MJ_APIKEY_PRIVATE\" \\\n\thttps://api.mailjet.com/v3/REST/user \\"
- lang: PHP
label: PHP
source: " 'v3']);\n$response = $mj->get(Resources::$User);\n$response->success() && var_dump($response->getData());\n?>"
- lang: Node.js
label: Node
source: "const mailjet = require ('node-mailjet')\n\t.connect(process.env.MJ_APIKEY_PUBLIC, process.env.MJ_APIKEY_PRIVATE)\nconst request = mailjet\n\t.get(\"user\", {'version': 'v3'})\n\t.request()\nrequest\n\t.then((result) => {\n\t\tconsole.log(result.body)\n\t})\n\t.catch((err) => {\n\t\tconsole.log(err.statusCode)\n\t})"
- lang: Ruby
label: Ruby
source: "require 'mailjet'\nMailjet.configure do |config|\n config.api_key = ENV['MJ_APIKEY_PUBLIC']\n config.secret_key = ENV['MJ_APIKEY_PRIVATE']\n config.api_version = \"v3\"\nend\nvariable = Mailjet::User.all(\n)\np variable.attributes['Data']"
- lang: Python
label: Python
source: "from mailjet_rest import Client\nimport os\napi_key = os.environ['MJ_APIKEY_PUBLIC']\napi_secret = os.environ['MJ_APIKEY_PRIVATE']\nmailjet = Client(auth=(api_key, api_secret), version='v3')\nresult = mailjet.user.get()\nprint result.status_code\nprint result.json()"
- lang: Java
label: Java
source: "package com.my.project;\nimport com.mailjet.client.errors.MailjetException;\nimport com.mailjet.client.errors.MailjetSocketTimeoutException;\nimport com.mailjet.client.MailjetClient;\nimport com.mailjet.client.MailjetRequest;\nimport com.mailjet.client.MailjetResponse;\nimport com.mailjet.client.ClientOptions;\nimport com.mailjet.client.resource.User;\nimport org.json.JSONArray;\nimport org.json.JSONObject;\npublic class MyClass {\n public static void main(String[] args) throws MailjetException, MailjetSocketTimeoutException {\n MailjetClient client;\n MailjetRequest request;\n MailjetResponse response;\n client = new MailjetClient(System.getenv(\"MJ_APIKEY_PUBLIC\"), System.getenv(\"MJ_APIKEY_PRIVATE\"), new ClientOptions(\"v3\"));\n request = new MailjetRequest(User.resource);\n response = client.get(request);\n System.out.println(response.getStatus());\n System.out.println(response.getData());\n }\n}"
- lang: Go
label: Go
source: "package main\nimport (\n\t\"fmt\"\n\t\"log\"\n\t\"os\"\n\tmailjet \"github.com/mailjet/mailjet-apiv3-go\"\n\t\"github.com/mailjet/mailjet-apiv3-go/resources\"\n)\nfunc main () {\n\tmailjetClient := NewMailjetClient(os.Getenv(\"MJ_APIKEY_PUBLIC\"), os.Getenv(\"MJ_APIKEY_PRIVATE\"))\n\tvar data []resources.User\n\t_, _, err := mailjetClient.List(\"user\", &data)\n\tif err != nil {\n\t fmt.Println(err)\n\t}\n\tfmt.Printf(\"Data array: %+v\\n\", data)\n}"
- lang: C#
label: C#
source: "using Mailjet.Client;\nusing Mailjet.Client.Resources;\nusing System;\nusing Newtonsoft.Json.Linq;\nnamespace Mailjet.ConsoleApplication\n{\n class Program\n {\n static void Main(string[] args)\n {\n RunAsync().Wait();\n }\n static async Task RunAsync()\n {\n MailjetClient client = new MailjetClient(Environment.GetEnvironmentVariable(\"MJ_APIKEY_PUBLIC\"), Environment.GetEnvironmentVariable(\"MJ_APIKEY_PRIVATE\"))\n {\n Version = ApiVersion.V3,\n };\n MailjetRequest request = new MailjetRequest\n {\n Resource = User.Resource,\n }\n MailjetResponse response = await client.GetAsync(request);\n if (response.IsSuccessStatusCode)\n {\n Console.WriteLine(string.Format(\"Total: {0}, Count: {1}\\n\", response.GetTotal(), response.GetCount()));\n Console.WriteLine(response.GetData());\n }\n else\n {\n Console.WriteLine(string.Format(\"StatusCode: {0}\\n\", response.StatusCode));\n Console.WriteLine(string.Format(\"ErrorInfo: {0}\\n\", response.GetErrorInfo()));\n Console.WriteLine(response.GetData());\n Console.WriteLine(string.Format(\"ErrorMessage: {0}\\n\", response.GetErrorMessage()));\n }\n }\n }\n}"
put:
x-seo:
title: "Update User"
description: "Update User in the Mailjet Email API. Update the settings of your User ID - username, registered email, language and time zone settings."
tags:
- Settings
summary: Update User
description: Update the settings of your User ID - username, registered email, language and time zone settings.
operationId: put_v3_user
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/UpdateUser'
example:
Email: contact@example.com
Locale: en_US
Timezone: Europe/Paris
Username: John Doe
responses:
'200':
description: Default OK response for `/user`
content:
application/json:
schema:
type: object
properties:
Count:
description: Indicates the number of objects in the `Data` array.
type: integer
format: int64
examples:
- 1
Data:
description: A JSON array containing a list of objects returned by this endpoint.
type: array
items:
$ref: '#/components/schemas/OutputUser'
Total:
description: Indicates the number of objects in the `Data` array.
type: integer
format: int64
examples:
- 1
'400':
$ref: '#/components/responses/400'
'401':
$ref: '#/components/responses/401'
'403':
$ref: '#/components/responses/403'
'404':
$ref: '#/components/responses/404'
'429':
$ref: '#/components/responses/429'
'500':
$ref: '#/components/responses/500'
security:
- basicAuth: []
x-codeSamples:
- lang: curl
label: cURL
source: "curl -s \\\n\t-X PUT \\\n\t--user \"$MJ_APIKEY_PUBLIC:$MJ_APIKEY_PRIVATE\" \\\n\thttps://api.mailjet.com/v3/REST/user \\\n\t-H 'Content-Type: application/json' \\\n\t-d '{\n \"ACL\":\"\",\n \"Email\":\"user@example.com\",\n \"LastLoginAt\":\"2018-01-01T00:00:00\",\n \"Locale\":\"en_US\",\n \"Timezone\":\"Europe/Paris\",\n \"LastIp\":\"127.0.0.1\",\n \"Username\":\"John Doe\"\n\t}'"
- lang: PHP
label: PHP
source: " 'v3']);\n$body = [\n 'ACL' => \"\",\n 'Email' => \"user@example.com\",\n 'LastLoginAt' => \"2018-01-01T00:00:00\",\n 'Locale' => \"en_US\",\n 'Timezone' => \"Europe/Paris\",\n 'LastIp' => \"127.0.0.1\",\n 'Username' => \"John Doe\"\n];\n$response = $mj->put(Resources::$User, ['body' => $body]);\n$response->success() && var_dump($response->getData());\n?>"
- lang: Node.js
label: Node
source: "const mailjet = require ('node-mailjet')\n\t.connect(process.env.MJ_APIKEY_PUBLIC, process.env.MJ_APIKEY_PRIVATE)\nconst request = mailjet\n\t.put(\"user\", {'version': 'v3'})\n\t.request({\n \"ACL\":\"\",\n \"Email\":\"user@example.com\",\n \"LastLoginAt\":\"2018-01-01T00:00:00\",\n \"Locale\":\"en_US\",\n \"Timezone\":\"Europe/Paris\",\n \"LastIp\":\"127.0.0.1\",\n \"Username\":\"John Doe\"\n })\nrequest\n\t.then((result) => {\n\t\tconsole.log(result.body)\n\t})\n\t.catch((err) => {\n\t\tconsole.log(err.statusCode)\n\t})"
- lang: Ruby
label: Ruby
source: "require 'mailjet'\nMailjet.configure do |config|\n config.api_key = ENV['MJ_APIKEY_PUBLIC']\n config.secret_key = ENV['MJ_APIKEY_PRIVATE']\n config.api_version = \"v3\"\nend\ntarget = Mailjet::User.find()\ntarget.update_attributes(\n acl: \"\",\n email: \"user@example.com\",\n last_login_at: \"2018-01-01T00:00:00\",\n locale: \"en_US\",\n timezone: \"Europe/Paris\",\n last_ip: \"127.0.0.1\",\n username: \"John Doe\"\n)\np variable.attributes['Data']"
- lang: Python
label: Python
source: "from mailjet_rest import Client\nimport os\napi_key = os.environ['MJ_APIKEY_PUBLIC']\napi_secret = os.environ['MJ_APIKEY_PRIVATE']\nmailjet = Client(auth=(api_key, api_secret), version='v3')\ndata = {\n 'ACL': \"\",\n 'Email': \"user@example.com\",\n 'LastLoginAt': \"2018-01-01T00:00:00\",\n 'Locale': \"en_US\",\n 'Timezone': \"Europe/Paris\",\n 'LastIp': \"127.0.0.1\",\n 'Username': \"John Doe\"\n}\nresult = mailjet.user.update(data=data)\nprint result.status_code\nprint result.json()"
- lang: Java
label: Java
source: "package com.my.project;\nimport com.mailjet.client.errors.MailjetException;\nimport com.mailjet.client.errors.MailjetSocketTimeoutException;\nimport com.mailjet.client.MailjetClient;\nimport com.mailjet.client.MailjetRequest;\nimport com.mailjet.client.MailjetResponse;\nimport com.mailjet.client.ClientOptions;\nimport com.mailjet.client.resource.User;\nimport org.json.JSONArray;\nimport org.json.JSONObject;\npublic class MyClass {\n public static void main(String[] args) throws MailjetException, MailjetSocketTimeoutException {\n MailjetClient client;\n MailjetRequest request;\n MailjetResponse response;\n client = new MailjetClient(System.getenv(\"MJ_APIKEY_PUBLIC\"), System.getenv(\"MJ_APIKEY_PRIVATE\"), new ClientOptions(\"v3\"));\n request = new MailjetRequest(User.resource)\n .property(User.ACL, )\n .property(User.EMAIL, \"user@example.com\")\n .property(User.LASTLOGINAT, \"2018-01-01T00:00:00\")\n .property(User.LOCALE, \"en_US\")\n .property(User.TIMEZONE, \"Europe/Paris\")\n .property(User.LASTIP, \"127.0.0.1\")\n .property(User.USERNAME, \"John Doe\")\n );\n response = client.put(request);\n System.out.println(response.getStatus());\n System.out.println(response.getData());\n }\n}"
- lang: Go
label: Go
source: "package main\nimport (\n\t\"fmt\"\n\t\"log\"\n\t\"os\"\n\tmailjet \"github.com/mailjet/mailjet-apiv3-go\"\n\t\"github.com/mailjet/mailjet-apiv3-go/resources\"\n)\nfunc main () {\n\tmailjetClient := NewMailjetClient(os.Getenv(\"MJ_APIKEY_PUBLIC\"), os.Getenv(\"MJ_APIKEY_PRIVATE\"))\n\tmr := &Request{\n\t Resource: \"user\",\n\t}\n\tfmr := &FullRequest{\n\t Info: mr,\n\t Payload: &resources.User { \n\t ACL:\"\",\n\t Email:\"user@example.com\",\n\t LastLoginAt:\"2018-01-01T00:00:00\",\n\t Locale:\"en_US\",\n\t Timezone:\"Europe/Paris\",\n\t LastIp:\"127.0.0.1\",\n\t Username:\"John Doe\"\n }\n\t}\n\terr := mailjetClient.Put(fmr)\n\tif err != nil {\n\t fmt.Println(err)\n\t}\n}"
- lang: C#
label: C#
source: "using Mailjet.Client;\nusing Mailjet.Client.Resources;\nusing System;\nusing Newtonsoft.Json.Linq;\nnamespace Mailjet.ConsoleApplication\n{\n class Program\n {\n static void Main(string[] args)\n {\n RunAsync().Wait();\n }\n static async Task RunAsync()\n {\n MailjetClient client = new MailjetClient(Environment.GetEnvironmentVariable(\"MJ_APIKEY_PUBLIC\"), Environment.GetEnvironmentVariable(\"MJ_APIKEY_PRIVATE\"))\n {\n Version = ApiVersion.V3,\n };\n MailjetRequest request = new MailjetRequest\n {\n Resource = User.Resource,\n }\n .Property(User.ACL, )\n .Property(User.Email, \"user@example.com\")\n .Property(User.LastLoginAt, \"2018-01-01T00:00:00\")\n .Property(User.Locale, \"en_US\")\n .Property(User.Timezone, \"Europe/Paris\")\n .Property(User.LastIp, \"127.0.0.1\")\n .Property(User.Username, \"John Doe\");\n MailjetResponse response = await client.PutAsync(request);\n if (response.IsSuccessStatusCode)\n {\n Console.WriteLine(string.Format(\"Total: {0}, Count: {1}\\n\", response.GetTotal(), response.GetCount()));\n Console.WriteLine(response.GetData());\n }\n else\n {\n Console.WriteLine(string.Format(\"StatusCode: {0}\\n\", response.StatusCode));\n Console.WriteLine(string.Format(\"ErrorInfo: {0}\\n\", response.GetErrorInfo()));\n Console.WriteLine(response.GetData());\n Console.WriteLine(string.Format(\"ErrorMessage: {0}\\n\", response.GetErrorMessage()));\n }\n }\n }\n}"
"/v3/REST/newsletter":
get:
x-seo:
title: "Newsletter List"
description: "Retrieve details on the configuration of all newsletters. Newsletter and CampaignDraft objects are differentiated by the EditMode values. We recommend\u2026"
deprecated: true
tags:
- Deprecated Endpoints
summary: Newsletter List
description: Retrieve details on the configuration of all newsletters. `Newsletter` and `CampaignDraft` objects are differentiated by the `EditMode` values. We recommend using `CampaignDraft`, as `Newsletter` objects are ones created using the legacy Mailjet template builder.
operationId: get_v3_newsletter
parameters:
- name: AXTesting
in: query
schema:
$ref: '#/components/schemas/get_v3_newsletter_QueryParams/properties/AXTesting'
- name: Campaign
in: query
schema:
$ref: '#/components/schemas/get_v3_newsletter_QueryParams/properties/Campaign'
- name: ContactsList
in: query
schema:
$ref: '#/components/schemas/get_v3_newsletter_QueryParams/properties/ContactsList'
- name: DeliveredAt
in: query
schema:
$ref: '#/components/schemas/get_v3_newsletter_QueryParams/properties/DeliveredAt'
- name: EditMode
in: query
schema:
$ref: '#/components/schemas/get_v3_newsletter_QueryParams/properties/EditMode'
- name: IsArchived
in: query
schema:
$ref: '#/components/schemas/get_v3_newsletter_QueryParams/properties/IsArchived'
- name: IsCampaign
in: query
schema:
$ref: '#/components/schemas/get_v3_newsletter_QueryParams/properties/IsCampaign'
- name: IsDeleted
in: query
schema:
$ref: '#/components/schemas/get_v3_newsletter_QueryParams/properties/IsDeleted'
- name: IsHandled
in: query
schema:
$ref: '#/components/schemas/get_v3_newsletter_QueryParams/properties/IsHandled'
- name: IsStarred
in: query
schema:
$ref: '#/components/schemas/get_v3_newsletter_QueryParams/properties/IsStarred'
- name: Modified
in: query
schema:
$ref: '#/components/schemas/get_v3_newsletter_QueryParams/properties/Modified'
- name: NewsLetterTemplate
in: query
schema:
$ref: '#/components/schemas/get_v3_newsletter_QueryParams/properties/NewsLetterTemplate'
- name: Segmentation
in: query
schema:
$ref: '#/components/schemas/get_v3_newsletter_QueryParams/properties/Segmentation'
- name: Status
in: query
schema:
$ref: '#/components/schemas/get_v3_newsletter_QueryParams/properties/Status'
- name: Subject
in: query
schema:
$ref: '#/components/schemas/get_v3_newsletter_QueryParams/properties/Subject'
responses:
'200':
description: Default OK response for `/newsletter`
content:
application/json:
schema:
type: object
properties:
Count:
description: Indicates the number of objects in the `Data` array.
type: integer
format: int64
examples:
- 1
Data:
description: A JSON array containing a list of objects returned by this endpoint.
type: array
items:
$ref: '#/components/schemas/OutputNewsletter'
Total:
description: Indicates the number of objects in the `Data` array.
type: integer
format: int64
examples:
- 1
'400':
$ref: '#/components/responses/400'
'401':
$ref: '#/components/responses/401'
'403':
$ref: '#/components/responses/403'
'404':
$ref: '#/components/responses/404'
'429':
$ref: '#/components/responses/429'
'500':
$ref: '#/components/responses/500'
security:
- basicAuth: []
x-codeSamples:
- lang: curl
label: cURL
source: "curl -s \\\n\t-X GET \\\n\t--user \"$MJ_APIKEY_PUBLIC:$MJ_APIKEY_PRIVATE\" \\\n\thttps://api.mailjet.com/v3/REST/newsletter \\"
- lang: PHP
label: PHP
source: " 'v3']);\n$response = $mj->get(Resources::$Newsletter);\n$response->success() && var_dump($response->getData());\n?>"
- lang: Node.js
label: Node
source: "const mailjet = require ('node-mailjet')\n\t.connect(process.env.MJ_APIKEY_PUBLIC, process.env.MJ_APIKEY_PRIVATE)\nconst request = mailjet\n\t.get(\"newsletter\", {'version': 'v3'})\n\t.request()\nrequest\n\t.then((result) => {\n\t\tconsole.log(result.body)\n\t})\n\t.catch((err) => {\n\t\tconsole.log(err.statusCode)\n\t})"
- lang: Ruby
label: Ruby
source: "require 'mailjet'\nMailjet.configure do |config|\n config.api_key = ENV['MJ_APIKEY_PUBLIC']\n config.secret_key = ENV['MJ_APIKEY_PRIVATE']\n config.api_version = \"v3\"\nend\nvariable = Mailjet::Newsletter.all(\n)\np variable.attributes['Data']"
- lang: Python
label: Python
source: "from mailjet_rest import Client\nimport os\napi_key = os.environ['MJ_APIKEY_PUBLIC']\napi_secret = os.environ['MJ_APIKEY_PRIVATE']\nmailjet = Client(auth=(api_key, api_secret), version='v3')\nresult = mailjet.newsletter.get()\nprint result.status_code\nprint result.json()"
- lang: Java
label: Java
source: "package com.my.project;\nimport com.mailjet.client.errors.MailjetException;\nimport com.mailjet.client.errors.MailjetSocketTimeoutException;\nimport com.mailjet.client.MailjetClient;\nimport com.mailjet.client.MailjetRequest;\nimport com.mailjet.client.MailjetResponse;\nimport com.mailjet.client.ClientOptions;\nimport com.mailjet.client.resource.Newsletter;\nimport org.json.JSONArray;\nimport org.json.JSONObject;\npublic class MyClass {\n public static void main(String[] args) throws MailjetException, MailjetSocketTimeoutException {\n MailjetClient client;\n MailjetRequest request;\n MailjetResponse response;\n client = new MailjetClient(System.getenv(\"MJ_APIKEY_PUBLIC\"), System.getenv(\"MJ_APIKEY_PRIVATE\"), new ClientOptions(\"v3\"));\n request = new MailjetRequest(Newsletter.resource);\n response = client.get(request);\n System.out.println(response.getStatus());\n System.out.println(response.getData());\n }\n}"
- lang: Go
label: Go
source: "package main\nimport (\n\t\"fmt\"\n\t\"log\"\n\t\"os\"\n\tmailjet \"github.com/mailjet/mailjet-apiv3-go\"\n\t\"github.com/mailjet/mailjet-apiv3-go/resources\"\n)\nfunc main () {\n\tmailjetClient := NewMailjetClient(os.Getenv(\"MJ_APIKEY_PUBLIC\"), os.Getenv(\"MJ_APIKEY_PRIVATE\"))\n\tvar data []resources.Newsletter\n\t_, _, err := mailjetClient.List(\"newsletter\", &data)\n\tif err != nil {\n\t fmt.Println(err)\n\t}\n\tfmt.Printf(\"Data array: %+v\\n\", data)\n}"
- lang: C#
label: C#
source: "using Mailjet.Client;\nusing Mailjet.Client.Resources;\nusing System;\nusing Newtonsoft.Json.Linq;\nnamespace Mailjet.ConsoleApplication\n{\n class Program\n {\n static void Main(string[] args)\n {\n RunAsync().Wait();\n }\n static async Task RunAsync()\n {\n MailjetClient client = new MailjetClient(Environment.GetEnvironmentVariable(\"MJ_APIKEY_PUBLIC\"), Environment.GetEnvironmentVariable(\"MJ_APIKEY_PRIVATE\"))\n {\n Version = ApiVersion.V3,\n };\n MailjetRequest request = new MailjetRequest\n {\n Resource = Newsletter.Resource,\n }\n MailjetResponse response = await client.GetAsync(request);\n if (response.IsSuccessStatusCode)\n {\n Console.WriteLine(string.Format(\"Total: {0}, Count: {1}\\n\", response.GetTotal(), response.GetCount()));\n Console.WriteLine(response.GetData());\n }\n else\n {\n Console.WriteLine(string.Format(\"StatusCode: {0}\\n\", response.StatusCode));\n Console.WriteLine(string.Format(\"ErrorInfo: {0}\\n\", response.GetErrorInfo()));\n Console.WriteLine(response.GetData());\n Console.WriteLine(string.Format(\"ErrorMessage: {0}\\n\", response.GetErrorMessage()));\n }\n }\n }\n}"
post:
x-seo:
title: "Create Newsletter"
description: "Create a new newsletter. CampaignDraft and Newsletter objects are differentiated by the EditMode values - we recommend using CampaignDraft , as\u2026"
deprecated: true
tags:
- Deprecated Endpoints
summary: Create Newsletter
description: Create a new newsletter. `CampaignDraft` and `Newsletter` objects are differentiated by the `EditMode` values - we recommend using `CampaignDraft`, as `Newsletter` objects are ones created using the legacy Mailjet template builder.
operationId: post_v3_newsletter
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/NewNewsletter'
example:
Locale: en_US
Sender: Example Sender
SenderEmail: no-reply@example.com
Subject: Your email flight plan!
Title: My Newsletter
EditMode: tool
IsTextPartIncluded: true
ReplyEmail: no-reply@example.com
responses:
'201':
description: Default ОК response for `/newsletter`
content:
application/json:
schema:
type: object
properties:
Count:
description: Indicates the number of objects in the `Data` array.
type: integer
format: int64
examples:
- 1
Data:
description: A JSON array containing a list of objects returned by this endpoint.
type: array
items:
$ref: '#/components/schemas/OutputNewsletter'
Total:
description: Indicates the number of objects in the `Data` array.
type: integer
format: int64
examples:
- 1
'400':
$ref: '#/components/responses/400'
'401':
$ref: '#/components/responses/401'
'403':
$ref: '#/components/responses/403'
'404':
$ref: '#/components/responses/404'
'429':
$ref: '#/components/responses/429'
'500':
$ref: '#/components/responses/500'
security:
- basicAuth: []
x-codeSamples:
- lang: curl
label: cURL
source: "curl -s \\\n\t-X POST \\\n\t--user \"$MJ_APIKEY_PUBLIC:$MJ_APIKEY_PRIVATE\" \\\n\thttps://api.mailjet.com/v3/REST/newsletter \\\n\t-H 'Content-Type: application/json' \\\n\t-d '{\n \"AXFraction\":0,\n \"AXFractionName\":\"Version1\",\n \"AXTesting\":\"123456\",\n \"Callback\":\"https://www.example.com/123/\",\n \"EditMode\":\"tool\",\n \"EditType\":\"full\",\n \"Footer\":\"default\",\n \"FooterAddress\":\"All Rights Reserved, My Company, 123 Main Street, New York, New York\",\n \"FooterWYSIWYGType\":2,\n \"HeaderFilename\":\"https://r.mailjet.com/E_5Au.png\",\n \"HeaderLink\":\"https://www.example.com/\",\n \"HeaderText\":\"Insert Header Text Here\",\n \"HeaderUrl\":\"https://www.example.com/\",\n \"Ip\":\"127.0.0.1\",\n \"IsStarred\":false,\n \"IsTextPartIncluded\":true,\n \"Permalink\":\"default\",\n \"PermalinkHost\":\"\",\n \"PermalinkWYSIWYGType\":1,\n \"PolitenessMode\":1,\n \"ReplyEmail\":\"copilot@mailjet.com\",\n \"SenderName\":\"Your Mailjet Pilot\",\n \"Status\":2,\n \"TemplateID\":1234,\n \"TestAddress\":\"tester@mailjet.com\",\n \"Title\":\"My Newsletter\",\n \"Url\":\"https://123h45y.mjt.lu/123uso/ia834.html\",\n \"ContactsListID\":123456,\n \"ContactsListAlt\":\"abcdef123\",\n \"Locale\":\"en_US\",\n \"SegmentationID\":123,\n \"SegmentationAlt\":\"Customers under 35\",\n \"Sender\":\"1234\",\n \"SenderEmail\":\"pilot@mailjet.com\",\n \"Subject\":\"Your email flight plan!\"\n\t}'"
- lang: PHP
label: PHP
source: " 'v3']);\n$body = [\n 'AXFraction' => 0,\n 'AXFractionName' => \"Version1\",\n 'AXTesting' => \"123456\",\n 'Callback' => \"https://www.example.com/123/\",\n 'EditMode' => \"tool\",\n 'EditType' => \"full\",\n 'Footer' => \"default\",\n 'FooterAddress' => \"All Rights Reserved, My Company, 123 Main Street, New York, New York\",\n 'FooterWYSIWYGType' => 2,\n 'HeaderFilename' => \"https://r.mailjet.com/E_5Au.png\",\n 'HeaderLink' => \"https://www.example.com/\",\n 'HeaderText' => \"Insert Header Text Here\",\n 'HeaderUrl' => \"https://www.example.com/\",\n 'Ip' => \"127.0.0.1\",\n 'IsStarred' => false,\n 'IsTextPartIncluded' => true,\n 'Permalink' => \"default\",\n 'PermalinkHost' => \"\",\n 'PermalinkWYSIWYGType' => 1,\n 'PolitenessMode' => 1,\n 'ReplyEmail' => \"copilot@mailjet.com\",\n 'SenderName' => \"Your Mailjet Pilot\",\n 'Status' => 2,\n 'TemplateID' => 1234,\n 'TestAddress' => \"tester@mailjet.com\",\n 'Title' => \"My Newsletter\",\n 'Url' => \"https://123h45y.mjt.lu/123uso/ia834.html\",\n 'ContactsListID' => 123456,\n 'ContactsListAlt' => \"abcdef123\",\n 'Locale' => \"en_US\",\n 'SegmentationID' => 123,\n 'SegmentationAlt' => \"Customers under 35\",\n 'Sender' => \"1234\",\n 'SenderEmail' => \"pilot@mailjet.com\",\n 'Subject' => \"Your email flight plan!\"\n];\n$response = $mj->post(Resources::$Newsletter, ['body' => $body]);\n$response->success() && var_dump($response->getData());\n?>"
- lang: Node.js
label: Node
source: "const mailjet = require ('node-mailjet')\n\t.connect(process.env.MJ_APIKEY_PUBLIC, process.env.MJ_APIKEY_PRIVATE)\nconst request = mailjet\n\t.post(\"newsletter\", {'version': 'v3'})\n\t.request({\n \"AXFraction\":0,\n \"AXFractionName\":\"Version1\",\n \"AXTesting\":\"123456\",\n \"Callback\":\"https://www.example.com/123/\",\n \"EditMode\":\"tool\",\n \"EditType\":\"full\",\n \"Footer\":\"default\",\n \"FooterAddress\":\"All Rights Reserved, My Company, 123 Main Street, New York, New York\",\n \"FooterWYSIWYGType\":2,\n \"HeaderFilename\":\"https://r.mailjet.com/E_5Au.png\",\n \"HeaderLink\":\"https://www.example.com/\",\n \"HeaderText\":\"Insert Header Text Here\",\n \"HeaderUrl\":\"https://www.example.com/\",\n \"Ip\":\"127.0.0.1\",\n \"IsStarred\":false,\n \"IsTextPartIncluded\":true,\n \"Permalink\":\"default\",\n \"PermalinkHost\":\"\",\n \"PermalinkWYSIWYGType\":1,\n \"PolitenessMode\":1,\n \"ReplyEmail\":\"copilot@mailjet.com\",\n \"SenderName\":\"Your Mailjet Pilot\",\n \"Status\":2,\n \"TemplateID\":1234,\n \"TestAddress\":\"tester@mailjet.com\",\n \"Title\":\"My Newsletter\",\n \"Url\":\"https://123h45y.mjt.lu/123uso/ia834.html\",\n \"ContactsListID\":123456,\n \"ContactsListAlt\":\"abcdef123\",\n \"Locale\":\"en_US\",\n \"SegmentationID\":123,\n \"SegmentationAlt\":\"Customers under 35\",\n \"Sender\":\"1234\",\n \"SenderEmail\":\"pilot@mailjet.com\",\n \"Subject\":\"Your email flight plan!\"\n })\nrequest\n\t.then((result) => {\n\t\tconsole.log(result.body)\n\t})\n\t.catch((err) => {\n\t\tconsole.log(err.statusCode)\n\t})"
- lang: Ruby
label: Ruby
source: "require 'mailjet'\nMailjet.configure do |config|\n config.api_key = ENV['MJ_APIKEY_PUBLIC']\n config.secret_key = ENV['MJ_APIKEY_PRIVATE']\n config.api_version = \"v3\"\nend\nvariable = Mailjet::Newsletter.create(\n axfraction: 0,\n axfraction_name: \"Version1\",\n axtesting: \"123456\",\n callback: \"https://www.example.com/123/\",\n edit_mode: \"tool\",\n edit_type: \"full\",\n footer: \"default\",\n footer_address: \"All Rights Reserved, My Company, 123 Main Street, New York, New York\",\n footer_wysiwygtype: 2,\n header_filename: \"https://r.mailjet.com/E_5Au.png\",\n header_link: \"https://www.example.com/\",\n header_text: \"Insert Header Text Here\",\n header_url: \"https://www.example.com/\",\n ip: \"127.0.0.1\",\n is_starred: false,\n is_text_part_included: true,\n permalink: \"default\",\n permalink_host: \"\",\n permalink_wysiwygtype: 1,\n politeness_mode: 1,\n reply_email: \"copilot@mailjet.com\",\n sender_name: \"Your Mailjet Pilot\",\n status: 2,\n template_id: 1234,\n test_address: \"tester@mailjet.com\",\n title: \"My Newsletter\",\n url: \"https://123h45y.mjt.lu/123uso/ia834.html\",\n contacts_list_id: 123456,\n contacts_list_alt: \"abcdef123\",\n locale: \"en_US\",\n segmentation_id: 123,\n segmentation_alt: \"Customers under 35\",\n sender: \"1234\",\n sender_email: \"pilot@mailjet.com\",\n subject: \"Your email flight plan!\"\n)\np variable.attributes['Data']"
- lang: Python
label: Python
source: "from mailjet_rest import Client\nimport os\napi_key = os.environ['MJ_APIKEY_PUBLIC']\napi_secret = os.environ['MJ_APIKEY_PRIVATE']\nmailjet = Client(auth=(api_key, api_secret), version='v3')\ndata = {\n 'AXFraction': 0,\n 'AXFractionName': \"Version1\",\n 'AXTesting': \"123456\",\n 'Callback': \"https://www.example.com/123/\",\n 'EditMode': \"tool\",\n 'EditType': \"full\",\n 'Footer': \"default\",\n 'FooterAddress': \"All Rights Reserved, My Company, 123 Main Street, New York, New York\",\n 'FooterWYSIWYGType': 2,\n 'HeaderFilename': \"https://r.mailjet.com/E_5Au.png\",\n 'HeaderLink': \"https://www.example.com/\",\n 'HeaderText': \"Insert Header Text Here\",\n 'HeaderUrl': \"https://www.example.com/\",\n 'Ip': \"127.0.0.1\",\n 'IsStarred': False,\n 'IsTextPartIncluded': True,\n 'Permalink': \"default\",\n 'PermalinkHost': \"\",\n 'PermalinkWYSIWYGType': 1,\n 'PolitenessMode': 1,\n 'ReplyEmail': \"copilot@mailjet.com\",\n 'SenderName': \"Your Mailjet Pilot\",\n 'Status': 2,\n 'TemplateID': 1234,\n 'TestAddress': \"tester@mailjet.com\",\n 'Title': \"My Newsletter\",\n 'Url': \"https://123h45y.mjt.lu/123uso/ia834.html\",\n 'ContactsListID': 123456,\n 'ContactsListAlt': \"abcdef123\",\n 'Locale': \"en_US\",\n 'SegmentationID': 123,\n 'SegmentationAlt': \"Customers under 35\",\n 'Sender': \"1234\",\n 'SenderEmail': \"pilot@mailjet.com\",\n 'Subject': \"Your email flight plan!\"\n}\nresult = mailjet.newsletter.create(data=data)\nprint result.status_code\nprint result.json()"
- lang: Java
label: Java
source: "package com.my.project;\nimport com.mailjet.client.errors.MailjetException;\nimport com.mailjet.client.errors.MailjetSocketTimeoutException;\nimport com.mailjet.client.MailjetClient;\nimport com.mailjet.client.MailjetRequest;\nimport com.mailjet.client.MailjetResponse;\nimport com.mailjet.client.ClientOptions;\nimport com.mailjet.client.resource.Newsletter;\nimport org.json.JSONArray;\nimport org.json.JSONObject;\npublic class MyClass {\n public static void main(String[] args) throws MailjetException, MailjetSocketTimeoutException {\n MailjetClient client;\n MailjetRequest request;\n MailjetResponse response;\n client = new MailjetClient(System.getenv(\"MJ_APIKEY_PUBLIC\"), System.getenv(\"MJ_APIKEY_PRIVATE\"), new ClientOptions(\"v3\"));\n request = new MailjetRequest(Newsletter.resource)\n .property(Newsletter.AXFRACTION, 0)\n .property(Newsletter.AXFRACTIONNAME, \"Version1\")\n .property(Newsletter.AXTESTING, \"123456\")\n .property(Newsletter.CALLBACK, \"https://www.example.com/123/\")\n .property(Newsletter.EDITMODE, \"tool\")\n .property(Newsletter.EDITTYPE, \"full\")\n .property(Newsletter.FOOTER, \"default\")\n .property(Newsletter.FOOTERADDRESS, \"All Rights Reserved, My Company, 123 Main Street, New York, New York\")\n .property(Newsletter.FOOTERWYSIWYGTYPE, 2)\n .property(Newsletter.HEADERFILENAME, \"https://r.mailjet.com/E_5Au.png\")\n .property(Newsletter.HEADERLINK, \"https://www.example.com/\")\n .property(Newsletter.HEADERTEXT, \"Insert Header Text Here\")\n .property(Newsletter.HEADERURL, \"https://www.example.com/\")\n .property(Newsletter.IP, \"127.0.0.1\")\n .property(Newsletter.ISSTARRED, false)\n .property(Newsletter.ISTEXTPARTINCLUDED, true)\n .property(Newsletter.PERMALINK, \"default\")\n .property(Newsletter.PERMALINKHOST, )\n .property(Newsletter.PERMALINKWYSIWYGTYPE, 1)\n .property(Newsletter.POLITENESSMODE, 1)\n .property(Newsletter.REPLYEMAIL, \"copilot@mailjet.com\")\n .property(Newsletter.SENDERNAME, \"Your Mailjet Pilot\")\n .property(Newsletter.STATUS, 2)\n .property(Newsletter.TEMPLATEID, 1234)\n .property(Newsletter.TESTADDRESS, \"tester@mailjet.com\")\n .property(Newsletter.TITLE, \"My Newsletter\")\n .property(Newsletter.URL, \"https://123h45y.mjt.lu/123uso/ia834.html\")\n .property(Newsletter.CONTACTSLISTID, 123456)\n .property(Newsletter.CONTACTSLISTALT, \"abcdef123\")\n .property(Newsletter.LOCALE, \"en_US\")\n .property(Newsletter.SEGMENTATIONID, 123)\n .property(Newsletter.SEGMENTATIONALT, \"Customers under 35\")\n .property(Newsletter.SENDER, \"1234\")\n .property(Newsletter.SENDEREMAIL, \"pilot@mailjet.com\")\n .property(Newsletter.SUBJECT, \"Your email flight plan!\")\n );\n response = client.post(request);\n System.out.println(response.getStatus());\n System.out.println(response.getData());\n }\n}"
- lang: Go
label: Go
source: "package main\nimport (\n\t\"fmt\"\n\t\"log\"\n\t\"os\"\n\tmailjet \"github.com/mailjet/mailjet-apiv3-go\"\n\t\"github.com/mailjet/mailjet-apiv3-go/resources\"\n)\nfunc main () {\n\tmailjetClient := NewMailjetClient(os.Getenv(\"MJ_APIKEY_PUBLIC\"), os.Getenv(\"MJ_APIKEY_PRIVATE\"))\n\tvar data []resources.Newsletter\n\tmr := &Request{\n\t Resource: \"newsletter\",\n\t}\n\tfmr := &FullRequest{\n\t Info: mr,\n\t Payload: &resources.Newsletter { \n\t AXFraction:0,\n\t AXFractionName:\"Version1\",\n\t AXTesting:\"123456\",\n\t Callback:\"https://www.example.com/123/\",\n\t EditMode:\"tool\",\n\t EditType:\"full\",\n\t Footer:\"default\",\n\t FooterAddress:\"All Rights Reserved, My Company, 123 Main Street, New York, New York\",\n\t FooterWYSIWYGType:2,\n\t HeaderFilename:\"https://r.mailjet.com/E_5Au.png\",\n\t HeaderLink:\"https://www.example.com/\",\n\t HeaderText:\"Insert Header Text Here\",\n\t HeaderUrl:\"https://www.example.com/\",\n\t Ip:\"127.0.0.1\",\n\t IsStarred:false,\n\t IsTextPartIncluded:true,\n\t Permalink:\"default\",\n\t PermalinkHost:\"\",\n\t PermalinkWYSIWYGType:1,\n\t PolitenessMode:1,\n\t ReplyEmail:\"copilot@mailjet.com\",\n\t SenderName:\"Your Mailjet Pilot\",\n\t Status:2,\n\t TemplateID:1234,\n\t TestAddress:\"tester@mailjet.com\",\n\t Title:\"My Newsletter\",\n\t Url:\"https://123h45y.mjt.lu/123uso/ia834.html\",\n\t ContactsListID:123456,\n\t ContactsListAlt:\"abcdef123\",\n\t Locale:\"en_US\",\n\t SegmentationID:123,\n\t SegmentationAlt:\"Customers under 35\",\n\t Sender:\"1234\",\n\t SenderEmail:\"pilot@mailjet.com\",\n\t Subject:\"Your email flight plan!\"\n }\n\t}\n\terr := mailjetClient.Post(fmr, &data)\n\tif err != nil {\n\t fmt.Println(err)\n\t}\n\tfmt.Printf(\"Data array: %+v\\n\", data)\n}"
- lang: C#
label: C#
source: "using Mailjet.Client;\nusing Mailjet.Client.Resources;\nusing System;\nusing Newtonsoft.Json.Linq;\nnamespace Mailjet.ConsoleApplication\n{\n class Program\n {\n static void Main(string[] args)\n {\n RunAsync().Wait();\n }\n static async Task RunAsync()\n {\n MailjetClient client = new MailjetClient(Environment.GetEnvironmentVariable(\"MJ_APIKEY_PUBLIC\"), Environment.GetEnvironmentVariable(\"MJ_APIKEY_PRIVATE\"))\n {\n Version = ApiVersion.V3,\n };\n MailjetRequest request = new MailjetRequest\n {\n Resource = Newsletter.Resource,\n }\n .Property(Newsletter.AXFraction, 0)\n .Property(Newsletter.AXFractionName, \"Version1\")\n .Property(Newsletter.AXTesting, \"123456\")\n .Property(Newsletter.Callback, \"https://www.example.com/123/\")\n .Property(Newsletter.EditMode, \"tool\")\n .Property(Newsletter.EditType, \"full\")\n .Property(Newsletter.Footer, \"default\")\n .Property(Newsletter.FooterAddress, \"All Rights Reserved, My Company, 123 Main Street, New York, New York\")\n .Property(Newsletter.FooterWYSIWYGType, 2)\n .Property(Newsletter.HeaderFilename, \"https://r.mailjet.com/E_5Au.png\")\n .Property(Newsletter.HeaderLink, \"https://www.example.com/\")\n .Property(Newsletter.HeaderText, \"Insert Header Text Here\")\n .Property(Newsletter.HeaderUrl, \"https://www.example.com/\")\n .Property(Newsletter.Ip, \"127.0.0.1\")\n .Property(Newsletter.IsStarred, false)\n .Property(Newsletter.IsTextPartIncluded, true)\n .Property(Newsletter.Permalink, \"default\")\n .Property(Newsletter.PermalinkHost, )\n .Property(Newsletter.PermalinkWYSIWYGType, 1)\n .Property(Newsletter.PolitenessMode, 1)\n .Property(Newsletter.ReplyEmail, \"copilot@mailjet.com\")\n .Property(Newsletter.SenderName, \"Your Mailjet Pilot\")\n .Property(Newsletter.Status, 2)\n .Property(Newsletter.TemplateID, 1234)\n .Property(Newsletter.TestAddress, \"tester@mailjet.com\")\n .Property(Newsletter.Title, \"My Newsletter\")\n .Property(Newsletter.Url, \"https://123h45y.mjt.lu/123uso/ia834.html\")\n .Property(Newsletter.ContactsListID, 123456)\n .Property(Newsletter.ContactsListAlt, \"abcdef123\")\n .Property(Newsletter.Locale, \"en_US\")\n .Property(Newsletter.SegmentationID, 123)\n .Property(Newsletter.SegmentationAlt, \"Customers under 35\")\n .Property(Newsletter.Sender, \"1234\")\n .Property(Newsletter.SenderEmail, \"pilot@mailjet.com\")\n .Property(Newsletter.Subject, \"Your email flight plan!\");\n MailjetResponse response = await client.PostAsync(request);\n if (response.IsSuccessStatusCode)\n {\n Console.WriteLine(string.Format(\"Total: {0}, Count: {1}\\n\", response.GetTotal(), response.GetCount()));\n Console.WriteLine(response.GetData());\n }\n else\n {\n Console.WriteLine(string.Format(\"StatusCode: {0}\\n\", response.StatusCode));\n Console.WriteLine(string.Format(\"ErrorInfo: {0}\\n\", response.GetErrorInfo()));\n Console.WriteLine(response.GetData());\n Console.WriteLine(string.Format(\"ErrorMessage: {0}\\n\", response.GetErrorMessage()));\n }\n }\n }\n}"
"/v3/REST/newsletter/{newsletter_ID}":
get:
x-seo:
title: "Newsletter by ID"
description: "Retrieve details on the configuration of a specific newsletter. CampaignDraft and Newsletter objects are differentiated by the EditMode values - we\u2026"
deprecated: true
tags:
- Deprecated Endpoints
summary: Newsletter by ID
description: Retrieve details on the configuration of a specific newsletter. `CampaignDraft` and `Newsletter` objects are differentiated by the `EditMode` values - we recommend using `CampaignDraft`, as `Newsletter` objects are ones created using the legacy Mailjet template builder. To obtain a valid `newsletter_ID`, first call `GET /v3/REST/newsletter` to list your newsletters.
operationId: get_v3_newsletter_id
parameters:
- name: newsletter_ID
in: path
schema:
$ref: '#/components/schemas/get_v3_newsletter_id_PathParams/properties/newsletter_ID'
required: true
example: 5000
responses:
'200':
description: Default OK response for `/newsletter`
content:
application/json:
schema:
type: object
properties:
Count:
description: Indicates the number of objects in the `Data` array.
type: integer
format: int64
examples:
- 1
Data:
description: A JSON array containing a list of objects returned by this endpoint.
type: array
items:
$ref: '#/components/schemas/OutputNewsletter'
Total:
description: Indicates the number of objects in the `Data` array.
type: integer
format: int64
examples:
- 1
'400':
$ref: '#/components/responses/400'
'401':
$ref: '#/components/responses/401'
'403':
$ref: '#/components/responses/403'
'404':
$ref: '#/components/responses/404'
'429':
$ref: '#/components/responses/429'
'500':
$ref: '#/components/responses/500'
security:
- basicAuth: []
x-codeSamples:
- lang: curl
label: cURL
source: "curl -s \\\n\t-X GET \\\n\t--user \"$MJ_APIKEY_PUBLIC:$MJ_APIKEY_PRIVATE\" \\\n\thttps://api.mailjet.com/v3/REST/newsletter/$newsletter_ID \\"
- lang: PHP
label: PHP
source: " 'v3']);\n$response = $mj->get(Resources::$Newsletter, ['id' => $id]);\n$response->success() && var_dump($response->getData());\n?>"
- lang: Node.js
label: Node
source: "const mailjet = require ('node-mailjet')\n\t.connect(process.env.MJ_APIKEY_PUBLIC, process.env.MJ_APIKEY_PRIVATE)\nconst request = mailjet\n\t.get(\"newsletter\", {'version': 'v3'})\n\t.id($newsletter_ID)\n\t.request()\nrequest\n\t.then((result) => {\n\t\tconsole.log(result.body)\n\t})\n\t.catch((err) => {\n\t\tconsole.log(err.statusCode)\n\t})"
- lang: Ruby
label: Ruby
source: "require 'mailjet'\nMailjet.configure do |config|\n config.api_key = ENV['MJ_APIKEY_PUBLIC']\n config.secret_key = ENV['MJ_APIKEY_PRIVATE']\n config.api_version = \"v3\"\nend\nvariable = Mailjet::Newsletter.find($newsletter_ID\n)\np variable.attributes['Data']"
- lang: Python
label: Python
source: "from mailjet_rest import Client\nimport os\napi_key = os.environ['MJ_APIKEY_PUBLIC']\napi_secret = os.environ['MJ_APIKEY_PRIVATE']\nmailjet = Client(auth=(api_key, api_secret), version='v3')\nid = '$newsletter_ID'\nresult = mailjet.newsletter.get(id=id)\nprint result.status_code\nprint result.json()"
- lang: Java
label: Java
source: "package com.my.project;\nimport com.mailjet.client.errors.MailjetException;\nimport com.mailjet.client.errors.MailjetSocketTimeoutException;\nimport com.mailjet.client.MailjetClient;\nimport com.mailjet.client.MailjetRequest;\nimport com.mailjet.client.MailjetResponse;\nimport com.mailjet.client.ClientOptions;\nimport com.mailjet.client.resource.Newsletter;\nimport org.json.JSONArray;\nimport org.json.JSONObject;\npublic class MyClass {\n public static void main(String[] args) throws MailjetException, MailjetSocketTimeoutException {\n MailjetClient client;\n MailjetRequest request;\n MailjetResponse response;\n client = new MailjetClient(System.getenv(\"MJ_APIKEY_PUBLIC\"), System.getenv(\"MJ_APIKEY_PRIVATE\"), new ClientOptions(\"v3\"));\n request = new MailjetRequest(Newsletter.resource, ID);\n response = client.get(request);\n System.out.println(response.getStatus());\n System.out.println(response.getData());\n }\n}"
- lang: Go
label: Go
source: "package main\nimport (\n\t\"fmt\"\n\t\"log\"\n\t\"os\"\n\tmailjet \"github.com/mailjet/mailjet-apiv3-go\"\n\t\"github.com/mailjet/mailjet-apiv3-go/resources\"\n)\nfunc main () {\n\tmailjetClient := NewMailjetClient(os.Getenv(\"MJ_APIKEY_PUBLIC\"), os.Getenv(\"MJ_APIKEY_PRIVATE\"))\n\tvar data []resources.Newsletter\n\tmr := &Request{\n\t Resource: \"newsletter\",\n\t ID: RESOURCE_ID,\n\t}\n\terr := mailjetClient.Get(mr, &data)\n\tif err != nil {\n\t fmt.Println(err)\n\t}\n\tfmt.Printf(\"Data array: %+v\\n\", data)\n}"
- lang: C#
label: C#
source: "using Mailjet.Client;\nusing Mailjet.Client.Resources;\nusing System;\nusing Newtonsoft.Json.Linq;\nnamespace Mailjet.ConsoleApplication\n{\n class Program\n {\n static void Main(string[] args)\n {\n RunAsync().Wait();\n }\n static async Task RunAsync()\n {\n MailjetClient client = new MailjetClient(Environment.GetEnvironmentVariable(\"MJ_APIKEY_PUBLIC\"), Environment.GetEnvironmentVariable(\"MJ_APIKEY_PRIVATE\"))\n {\n Version = ApiVersion.V3,\n };\n MailjetRequest request = new MailjetRequest\n {\n Resource = Newsletter.Resource,\n ResourceId = ResourceId.Numeric(ID)\n }\n MailjetResponse response = await client.GetAsync(request);\n if (response.IsSuccessStatusCode)\n {\n Console.WriteLine(string.Format(\"Total: {0}, Count: {1}\\n\", response.GetTotal(), response.GetCount()));\n Console.WriteLine(response.GetData());\n }\n else\n {\n Console.WriteLine(string.Format(\"StatusCode: {0}\\n\", response.StatusCode));\n Console.WriteLine(string.Format(\"ErrorInfo: {0}\\n\", response.GetErrorInfo()));\n Console.WriteLine(response.GetData());\n Console.WriteLine(string.Format(\"ErrorMessage: {0}\\n\", response.GetErrorMessage()));\n }\n }\n }\n}"
put:
x-seo:
title: "Update Newsletter"
description: "Update the configuration settings of a specific newsletter. Newsletter and CampaignDraft objects are differentiated by the EditMode values - we recommend\u2026"
deprecated: true
tags:
- Deprecated Endpoints
summary: Update Newsletter
description: Update the configuration settings of a specific newsletter. `Newsletter` and `CampaignDraft` objects are differentiated by the `EditMode` values - we recommend using `CampaignDraft`, as `Newsletter` objects are ones created using the legacy Mailjet template builder. To obtain a valid `newsletter_ID`, first call `GET /v3/REST/newsletter` to list your newsletters.
operationId: put_v3_newsletter_id
parameters:
- name: newsletter_ID
in: path
schema:
$ref: '#/components/schemas/put_v3_newsletter_id_PathParams/properties/newsletter_ID'
required: true
example: 5000
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/UpdateNewsletter'
example:
Locale: en_US
Sender: Example Sender
SenderEmail: no-reply@example.com
Subject: Your email flight plan!
Title: My Newsletter
EditMode: tool
IsTextPartIncluded: true
ReplyEmail: no-reply@example.com
responses:
'200':
description: Default OK response for `/newsletter`
content:
application/json:
schema:
type: object
properties:
Count:
description: Indicates the number of objects in the `Data` array.
type: integer
format: int64
examples:
- 1
Data:
description: A JSON array containing a list of objects returned by this endpoint.
type: array
items:
$ref: '#/components/schemas/OutputNewsletter'
Total:
description: Indicates the number of objects in the `Data` array.
type: integer
format: int64
examples:
- 1
'400':
$ref: '#/components/responses/400'
'401':
$ref: '#/components/responses/401'
'403':
$ref: '#/components/responses/403'
'404':
$ref: '#/components/responses/404'
'429':
$ref: '#/components/responses/429'
'500':
$ref: '#/components/responses/500'
security:
- basicAuth: []
x-codeSamples:
- lang: curl
label: cURL
source: "curl -s \\\n\t-X PUT \\\n\t--user \"$MJ_APIKEY_PUBLIC:$MJ_APIKEY_PRIVATE\" \\\n\thttps://api.mailjet.com/v3/REST/newsletter/$newsletter_ID \\\n\t-H 'Content-Type: application/json' \\\n\t-d '{\n \"AXFraction\":0,\n \"AXFractionName\":\"Version1\",\n \"AXTesting\":\"123456\",\n \"Callback\":\"https://www.example.com/123/\",\n \"EditMode\":\"tool\",\n \"EditType\":\"full\",\n \"Footer\":\"default\",\n \"FooterAddress\":\"All Rights Reserved, My Company, 123 Main Street, New York, New York\",\n \"FooterWYSIWYGType\":2,\n \"HeaderFilename\":\"https://r.mailjet.com/E_5Au.png\",\n \"HeaderLink\":\"https://www.example.com/\",\n \"HeaderText\":\"Insert Header Text Here\",\n \"HeaderUrl\":\"https://www.example.com/\",\n \"Ip\":\"127.0.0.1\",\n \"IsStarred\":false,\n \"IsTextPartIncluded\":true,\n \"Permalink\":\"default\",\n \"PermalinkHost\":\"\",\n \"PermalinkWYSIWYGType\":1,\n \"PolitenessMode\":1,\n \"ReplyEmail\":\"copilot@mailjet.com\",\n \"SenderName\":\"Your Mailjet Pilot\",\n \"Status\":2,\n \"TemplateID\":1234,\n \"TestAddress\":\"tester@mailjet.com\",\n \"Title\":\"My Newsletter\",\n \"Url\":\"https://123h45y.mjt.lu/123uso/ia834.html\",\n \"ContactsListID\":123456,\n \"Locale\":\"en_US\",\n \"SegmentationID\":123,\n \"SegmentationAlt\":\"Customers under 35\",\n \"Sender\":\"1234\",\n \"SenderEmail\":\"pilot@mailjet.com\",\n \"Subject\":\"Your email flight plan!\"\n\t}'"
- lang: PHP
label: PHP
source: " 'v3']);\n$body = [\n 'AXFraction' => 0,\n 'AXFractionName' => \"Version1\",\n 'AXTesting' => \"123456\",\n 'Callback' => \"https://www.example.com/123/\",\n 'EditMode' => \"tool\",\n 'EditType' => \"full\",\n 'Footer' => \"default\",\n 'FooterAddress' => \"All Rights Reserved, My Company, 123 Main Street, New York, New York\",\n 'FooterWYSIWYGType' => 2,\n 'HeaderFilename' => \"https://r.mailjet.com/E_5Au.png\",\n 'HeaderLink' => \"https://www.example.com/\",\n 'HeaderText' => \"Insert Header Text Here\",\n 'HeaderUrl' => \"https://www.example.com/\",\n 'Ip' => \"127.0.0.1\",\n 'IsStarred' => false,\n 'IsTextPartIncluded' => true,\n 'Permalink' => \"default\",\n 'PermalinkHost' => \"\",\n 'PermalinkWYSIWYGType' => 1,\n 'PolitenessMode' => 1,\n 'ReplyEmail' => \"copilot@mailjet.com\",\n 'SenderName' => \"Your Mailjet Pilot\",\n 'Status' => 2,\n 'TemplateID' => 1234,\n 'TestAddress' => \"tester@mailjet.com\",\n 'Title' => \"My Newsletter\",\n 'Url' => \"https://123h45y.mjt.lu/123uso/ia834.html\",\n 'ContactsListID' => 123456,\n 'Locale' => \"en_US\",\n 'SegmentationID' => 123,\n 'SegmentationAlt' => \"Customers under 35\",\n 'Sender' => \"1234\",\n 'SenderEmail' => \"pilot@mailjet.com\",\n 'Subject' => \"Your email flight plan!\"\n];\n$response = $mj->put(Resources::$Newsletter, ['id' => $id, 'body' => $body]);\n$response->success() && var_dump($response->getData());\n?>"
- lang: Node.js
label: Node
source: "const mailjet = require ('node-mailjet')\n\t.connect(process.env.MJ_APIKEY_PUBLIC, process.env.MJ_APIKEY_PRIVATE)\nconst request = mailjet\n\t.put(\"newsletter\", {'version': 'v3'})\n\t.id($newsletter_ID)\n\t.request({\n \"AXFraction\":0,\n \"AXFractionName\":\"Version1\",\n \"AXTesting\":\"123456\",\n \"Callback\":\"https://www.example.com/123/\",\n \"EditMode\":\"tool\",\n \"EditType\":\"full\",\n \"Footer\":\"default\",\n \"FooterAddress\":\"All Rights Reserved, My Company, 123 Main Street, New York, New York\",\n \"FooterWYSIWYGType\":2,\n \"HeaderFilename\":\"https://r.mailjet.com/E_5Au.png\",\n \"HeaderLink\":\"https://www.example.com/\",\n \"HeaderText\":\"Insert Header Text Here\",\n \"HeaderUrl\":\"https://www.example.com/\",\n \"Ip\":\"127.0.0.1\",\n \"IsStarred\":false,\n \"IsTextPartIncluded\":true,\n \"Permalink\":\"default\",\n \"PermalinkHost\":\"\",\n \"PermalinkWYSIWYGType\":1,\n \"PolitenessMode\":1,\n \"ReplyEmail\":\"copilot@mailjet.com\",\n \"SenderName\":\"Your Mailjet Pilot\",\n \"Status\":2,\n \"TemplateID\":1234,\n \"TestAddress\":\"tester@mailjet.com\",\n \"Title\":\"My Newsletter\",\n \"Url\":\"https://123h45y.mjt.lu/123uso/ia834.html\",\n \"ContactsListID\":123456,\n \"Locale\":\"en_US\",\n \"SegmentationID\":123,\n \"SegmentationAlt\":\"Customers under 35\",\n \"Sender\":\"1234\",\n \"SenderEmail\":\"pilot@mailjet.com\",\n \"Subject\":\"Your email flight plan!\"\n })\nrequest\n\t.then((result) => {\n\t\tconsole.log(result.body)\n\t})\n\t.catch((err) => {\n\t\tconsole.log(err.statusCode)\n\t})"
- lang: Ruby
label: Ruby
source: "require 'mailjet'\nMailjet.configure do |config|\n config.api_key = ENV['MJ_APIKEY_PUBLIC']\n config.secret_key = ENV['MJ_APIKEY_PRIVATE']\n config.api_version = \"v3\"\nend\ntarget = Mailjet::Newsletter.find($newsletter_ID)\ntarget.update_attributes(\n axfraction: 0,\n axfraction_name: \"Version1\",\n axtesting: \"123456\",\n callback: \"https://www.example.com/123/\",\n edit_mode: \"tool\",\n edit_type: \"full\",\n footer: \"default\",\n footer_address: \"All Rights Reserved, My Company, 123 Main Street, New York, New York\",\n footer_wysiwygtype: 2,\n header_filename: \"https://r.mailjet.com/E_5Au.png\",\n header_link: \"https://www.example.com/\",\n header_text: \"Insert Header Text Here\",\n header_url: \"https://www.example.com/\",\n ip: \"127.0.0.1\",\n is_starred: false,\n is_text_part_included: true,\n permalink: \"default\",\n permalink_host: \"\",\n permalink_wysiwygtype: 1,\n politeness_mode: 1,\n reply_email: \"copilot@mailjet.com\",\n sender_name: \"Your Mailjet Pilot\",\n status: 2,\n template_id: 1234,\n test_address: \"tester@mailjet.com\",\n title: \"My Newsletter\",\n url: \"https://123h45y.mjt.lu/123uso/ia834.html\",\n contacts_list_id: 123456,\n locale: \"en_US\",\n segmentation_id: 123,\n segmentation_alt: \"Customers under 35\",\n sender: \"1234\",\n sender_email: \"pilot@mailjet.com\",\n subject: \"Your email flight plan!\"\n)\np variable.attributes['Data']"
- lang: Python
label: Python
source: "from mailjet_rest import Client\nimport os\napi_key = os.environ['MJ_APIKEY_PUBLIC']\napi_secret = os.environ['MJ_APIKEY_PRIVATE']\nmailjet = Client(auth=(api_key, api_secret), version='v3')\nid = '$newsletter_ID'\ndata = {\n 'AXFraction': 0,\n 'AXFractionName': \"Version1\",\n 'AXTesting': \"123456\",\n 'Callback': \"https://www.example.com/123/\",\n 'EditMode': \"tool\",\n 'EditType': \"full\",\n 'Footer': \"default\",\n 'FooterAddress': \"All Rights Reserved, My Company, 123 Main Street, New York, New York\",\n 'FooterWYSIWYGType': 2,\n 'HeaderFilename': \"https://r.mailjet.com/E_5Au.png\",\n 'HeaderLink': \"https://www.example.com/\",\n 'HeaderText': \"Insert Header Text Here\",\n 'HeaderUrl': \"https://www.example.com/\",\n 'Ip': \"127.0.0.1\",\n 'IsStarred': False,\n 'IsTextPartIncluded': True,\n 'Permalink': \"default\",\n 'PermalinkHost': \"\",\n 'PermalinkWYSIWYGType': 1,\n 'PolitenessMode': 1,\n 'ReplyEmail': \"copilot@mailjet.com\",\n 'SenderName': \"Your Mailjet Pilot\",\n 'Status': 2,\n 'TemplateID': 1234,\n 'TestAddress': \"tester@mailjet.com\",\n 'Title': \"My Newsletter\",\n 'Url': \"https://123h45y.mjt.lu/123uso/ia834.html\",\n 'ContactsListID': 123456,\n 'Locale': \"en_US\",\n 'SegmentationID': 123,\n 'SegmentationAlt': \"Customers under 35\",\n 'Sender': \"1234\",\n 'SenderEmail': \"pilot@mailjet.com\",\n 'Subject': \"Your email flight plan!\"\n}\nresult = mailjet.newsletter.update(id=id, data=data)\nprint result.status_code\nprint result.json()"
- lang: Java
label: Java
source: "package com.my.project;\nimport com.mailjet.client.errors.MailjetException;\nimport com.mailjet.client.errors.MailjetSocketTimeoutException;\nimport com.mailjet.client.MailjetClient;\nimport com.mailjet.client.MailjetRequest;\nimport com.mailjet.client.MailjetResponse;\nimport com.mailjet.client.ClientOptions;\nimport com.mailjet.client.resource.Newsletter;\nimport org.json.JSONArray;\nimport org.json.JSONObject;\npublic class MyClass {\n public static void main(String[] args) throws MailjetException, MailjetSocketTimeoutException {\n MailjetClient client;\n MailjetRequest request;\n MailjetResponse response;\n client = new MailjetClient(System.getenv(\"MJ_APIKEY_PUBLIC\"), System.getenv(\"MJ_APIKEY_PRIVATE\"), new ClientOptions(\"v3\"));\n request = new MailjetRequest(Newsletter.resource, ID)\n .property(Newsletter.AXFRACTION, 0)\n .property(Newsletter.AXFRACTIONNAME, \"Version1\")\n .property(Newsletter.AXTESTING, \"123456\")\n .property(Newsletter.CALLBACK, \"https://www.example.com/123/\")\n .property(Newsletter.EDITMODE, \"tool\")\n .property(Newsletter.EDITTYPE, \"full\")\n .property(Newsletter.FOOTER, \"default\")\n .property(Newsletter.FOOTERADDRESS, \"All Rights Reserved, My Company, 123 Main Street, New York, New York\")\n .property(Newsletter.FOOTERWYSIWYGTYPE, 2)\n .property(Newsletter.HEADERFILENAME, \"https://r.mailjet.com/E_5Au.png\")\n .property(Newsletter.HEADERLINK, \"https://www.example.com/\")\n .property(Newsletter.HEADERTEXT, \"Insert Header Text Here\")\n .property(Newsletter.HEADERURL, \"https://www.example.com/\")\n .property(Newsletter.IP, \"127.0.0.1\")\n .property(Newsletter.ISSTARRED, false)\n .property(Newsletter.ISTEXTPARTINCLUDED, true)\n .property(Newsletter.PERMALINK, \"default\")\n .property(Newsletter.PERMALINKHOST, )\n .property(Newsletter.PERMALINKWYSIWYGTYPE, 1)\n .property(Newsletter.POLITENESSMODE, 1)\n .property(Newsletter.REPLYEMAIL, \"copilot@mailjet.com\")\n .property(Newsletter.SENDERNAME, \"Your Mailjet Pilot\")\n .property(Newsletter.STATUS, 2)\n .property(Newsletter.TEMPLATEID, 1234)\n .property(Newsletter.TESTADDRESS, \"tester@mailjet.com\")\n .property(Newsletter.TITLE, \"My Newsletter\")\n .property(Newsletter.URL, \"https://123h45y.mjt.lu/123uso/ia834.html\")\n .property(Newsletter.CONTACTSLISTID, 123456)\n .property(Newsletter.LOCALE, \"en_US\")\n .property(Newsletter.SEGMENTATIONID, 123)\n .property(Newsletter.SEGMENTATIONALT, \"Customers under 35\")\n .property(Newsletter.SENDER, \"1234\")\n .property(Newsletter.SENDEREMAIL, \"pilot@mailjet.com\")\n .property(Newsletter.SUBJECT, \"Your email flight plan!\")\n );\n response = client.put(request);\n System.out.println(response.getStatus());\n System.out.println(response.getData());\n }\n}"
- lang: Go
label: Go
source: "package main\nimport (\n\t\"fmt\"\n\t\"log\"\n\t\"os\"\n\tmailjet \"github.com/mailjet/mailjet-apiv3-go\"\n\t\"github.com/mailjet/mailjet-apiv3-go/resources\"\n)\nfunc main () {\n\tmailjetClient := NewMailjetClient(os.Getenv(\"MJ_APIKEY_PUBLIC\"), os.Getenv(\"MJ_APIKEY_PRIVATE\"))\n\tmr := &Request{\n\t Resource: \"newsletter\",\n\t ID: RESOURCE_ID,\n\t}\n\tfmr := &FullRequest{\n\t Info: mr,\n\t Payload: &resources.Newsletter { \n\t AXFraction:0,\n\t AXFractionName:\"Version1\",\n\t AXTesting:\"123456\",\n\t Callback:\"https://www.example.com/123/\",\n\t EditMode:\"tool\",\n\t EditType:\"full\",\n\t Footer:\"default\",\n\t FooterAddress:\"All Rights Reserved, My Company, 123 Main Street, New York, New York\",\n\t FooterWYSIWYGType:2,\n\t HeaderFilename:\"https://r.mailjet.com/E_5Au.png\",\n\t HeaderLink:\"https://www.example.com/\",\n\t HeaderText:\"Insert Header Text Here\",\n\t HeaderUrl:\"https://www.example.com/\",\n\t Ip:\"127.0.0.1\",\n\t IsStarred:false,\n\t IsTextPartIncluded:true,\n\t Permalink:\"default\",\n\t PermalinkHost:\"\",\n\t PermalinkWYSIWYGType:1,\n\t PolitenessMode:1,\n\t ReplyEmail:\"copilot@mailjet.com\",\n\t SenderName:\"Your Mailjet Pilot\",\n\t Status:2,\n\t TemplateID:1234,\n\t TestAddress:\"tester@mailjet.com\",\n\t Title:\"My Newsletter\",\n\t Url:\"https://123h45y.mjt.lu/123uso/ia834.html\",\n\t ContactsListID:123456,\n\t Locale:\"en_US\",\n\t SegmentationID:123,\n\t SegmentationAlt:\"Customers under 35\",\n\t Sender:\"1234\",\n\t SenderEmail:\"pilot@mailjet.com\",\n\t Subject:\"Your email flight plan!\"\n }\n\t}\n\terr := mailjetClient.Put(fmr)\n\tif err != nil {\n\t fmt.Println(err)\n\t}\n}"
- lang: C#
label: C#
source: "using Mailjet.Client;\nusing Mailjet.Client.Resources;\nusing System;\nusing Newtonsoft.Json.Linq;\nnamespace Mailjet.ConsoleApplication\n{\n class Program\n {\n static void Main(string[] args)\n {\n RunAsync().Wait();\n }\n static async Task RunAsync()\n {\n MailjetClient client = new MailjetClient(Environment.GetEnvironmentVariable(\"MJ_APIKEY_PUBLIC\"), Environment.GetEnvironmentVariable(\"MJ_APIKEY_PRIVATE\"))\n {\n Version = ApiVersion.V3,\n };\n MailjetRequest request = new MailjetRequest\n {\n Resource = Newsletter.Resource,\n ResourceId = ResourceId.Numeric(ID)\n }\n .Property(Newsletter.AXFraction, 0)\n .Property(Newsletter.AXFractionName, \"Version1\")\n .Property(Newsletter.AXTesting, \"123456\")\n .Property(Newsletter.Callback, \"https://www.example.com/123/\")\n .Property(Newsletter.EditMode, \"tool\")\n .Property(Newsletter.EditType, \"full\")\n .Property(Newsletter.Footer, \"default\")\n .Property(Newsletter.FooterAddress, \"All Rights Reserved, My Company, 123 Main Street, New York, New York\")\n .Property(Newsletter.FooterWYSIWYGType, 2)\n .Property(Newsletter.HeaderFilename, \"https://r.mailjet.com/E_5Au.png\")\n .Property(Newsletter.HeaderLink, \"https://www.example.com/\")\n .Property(Newsletter.HeaderText, \"Insert Header Text Here\")\n .Property(Newsletter.HeaderUrl, \"https://www.example.com/\")\n .Property(Newsletter.Ip, \"127.0.0.1\")\n .Property(Newsletter.IsStarred, false)\n .Property(Newsletter.IsTextPartIncluded, true)\n .Property(Newsletter.Permalink, \"default\")\n .Property(Newsletter.PermalinkHost, )\n .Property(Newsletter.PermalinkWYSIWYGType, 1)\n .Property(Newsletter.PolitenessMode, 1)\n .Property(Newsletter.ReplyEmail, \"copilot@mailjet.com\")\n .Property(Newsletter.SenderName, \"Your Mailjet Pilot\")\n .Property(Newsletter.Status, 2)\n .Property(Newsletter.TemplateID, 1234)\n .Property(Newsletter.TestAddress, \"tester@mailjet.com\")\n .Property(Newsletter.Title, \"My Newsletter\")\n .Property(Newsletter.Url, \"https://123h45y.mjt.lu/123uso/ia834.html\")\n .Property(Newsletter.ContactsListID, 123456)\n .Property(Newsletter.Locale, \"en_US\")\n .Property(Newsletter.SegmentationID, 123)\n .Property(Newsletter.SegmentationAlt, \"Customers under 35\")\n .Property(Newsletter.Sender, \"1234\")\n .Property(Newsletter.SenderEmail, \"pilot@mailjet.com\")\n .Property(Newsletter.Subject, \"Your email flight plan!\");\n MailjetResponse response = await client.PutAsync(request);\n if (response.IsSuccessStatusCode)\n {\n Console.WriteLine(string.Format(\"Total: {0}, Count: {1}\\n\", response.GetTotal(), response.GetCount()));\n Console.WriteLine(response.GetData());\n }\n else\n {\n Console.WriteLine(string.Format(\"StatusCode: {0}\\n\", response.StatusCode));\n Console.WriteLine(string.Format(\"ErrorInfo: {0}\\n\", response.GetErrorInfo()));\n Console.WriteLine(response.GetData());\n Console.WriteLine(string.Format(\"ErrorMessage: {0}\\n\", response.GetErrorMessage()));\n }\n }\n }\n}"
/v3/REST/newsletter/{newsletter_ID}/detailcontent:
get:
x-seo:
title: "Get Newsletter: Detail Content"
description: "Get Newsletter: Detail Content in the Mailjet Email API. Retrieve the content of your newsletter email. It will be splin between a Text part and an HTML\u2026"
deprecated: true
tags:
- Deprecated Endpoints
summary: 'Get Newsletter: Detail Content'
description: Retrieve the content of your newsletter email. It will be splin between a Text part and an HTML part. To obtain a valid `newsletter_ID`, first call `GET /v3/REST/newsletter` to list your newsletters.
operationId: get_v3_newsletter_id_detailcontent
parameters:
- name: newsletter_ID
in: path
schema:
$ref: '#/components/schemas/get_v3_newsletter_id_detailcontent_PathParams/properties/newsletter_ID'
required: true
example: 5000
responses:
'200':
description: Default OK response for /newsletter action :detailcontent
content:
application/json:
schema:
type: object
properties:
Count:
description: Indicates the number of objects in the `Data` array.
type: integer
format: int64
examples:
- 1
Data:
description: A JSON array containing a list of objects returned by this endpoint.
type: array
items:
$ref: '#/components/schemas/OutputNewsletterDetailcontent'
Total:
description: Indicates the number of objects in the `Data` array.
type: integer
format: int64
examples:
- 1
'400':
$ref: '#/components/responses/400'
'401':
$ref: '#/components/responses/401'
'403':
$ref: '#/components/responses/403'
'404':
$ref: '#/components/responses/404'
'429':
$ref: '#/components/responses/429'
'500':
$ref: '#/components/responses/500'
security:
- basicAuth: []
x-codeSamples:
- lang: curl
label: cURL
source: "curl -s \\\n\t-X GET \\\n\t--user \"$MJ_APIKEY_PUBLIC:$MJ_APIKEY_PRIVATE\" \\\n\thttps://api.mailjet.com/v3/REST/newsletter/$newsletter_ID \\"
- lang: PHP
label: PHP
source: " 'v3']);\n$response = $mj->get(Resources::$Newsletter, ['id' => $id]);\n$response->success() && var_dump($response->getData());\n?>"
- lang: Node.js
label: Node
source: "const mailjet = require ('node-mailjet')\n\t.connect(process.env.MJ_APIKEY_PUBLIC, process.env.MJ_APIKEY_PRIVATE)\nconst request = mailjet\n\t.get(\"newsletter\", {'version': 'v3'})\n\t.id($newsletter_ID)\n\t.request()\nrequest\n\t.then((result) => {\n\t\tconsole.log(result.body)\n\t})\n\t.catch((err) => {\n\t\tconsole.log(err.statusCode)\n\t})"
- lang: Ruby
label: Ruby
source: "require 'mailjet'\nMailjet.configure do |config|\n config.api_key = ENV['MJ_APIKEY_PUBLIC']\n config.secret_key = ENV['MJ_APIKEY_PRIVATE']\n config.api_version = \"v3\"\nend\nvariable = Mailjet::Newsletter.find($newsletter_ID\n)\np variable.attributes['Data']"
- lang: Python
label: Python
source: "from mailjet_rest import Client\nimport os\napi_key = os.environ['MJ_APIKEY_PUBLIC']\napi_secret = os.environ['MJ_APIKEY_PRIVATE']\nmailjet = Client(auth=(api_key, api_secret), version='v3')\nid = '$newsletter_ID'\nresult = mailjet.newsletter.get(id=id)\nprint result.status_code\nprint result.json()"
- lang: Java
label: Java
source: "package com.my.project;\nimport com.mailjet.client.errors.MailjetException;\nimport com.mailjet.client.errors.MailjetSocketTimeoutException;\nimport com.mailjet.client.MailjetClient;\nimport com.mailjet.client.MailjetRequest;\nimport com.mailjet.client.MailjetResponse;\nimport com.mailjet.client.ClientOptions;\nimport com.mailjet.client.resource.Newsletter;\nimport org.json.JSONArray;\nimport org.json.JSONObject;\npublic class MyClass {\n public static void main(String[] args) throws MailjetException, MailjetSocketTimeoutException {\n MailjetClient client;\n MailjetRequest request;\n MailjetResponse response;\n client = new MailjetClient(System.getenv(\"MJ_APIKEY_PUBLIC\"), System.getenv(\"MJ_APIKEY_PRIVATE\"), new ClientOptions(\"v3\"));\n request = new MailjetRequest(Newsletter.resource, ID);\n response = client.get(request);\n System.out.println(response.getStatus());\n System.out.println(response.getData());\n }\n}"
- lang: Go
label: Go
source: "package main\nimport (\n\t\"fmt\"\n\t\"log\"\n\t\"os\"\n\tmailjet \"github.com/mailjet/mailjet-apiv3-go\"\n\t\"github.com/mailjet/mailjet-apiv3-go/resources\"\n)\nfunc main () {\n\tmailjetClient := NewMailjetClient(os.Getenv(\"MJ_APIKEY_PUBLIC\"), os.Getenv(\"MJ_APIKEY_PRIVATE\"))\n\tvar data []resources.Newsletter\n\tmr := &Request{\n\t Resource: \"newsletter\",\n\t ID: RESOURCE_ID,\n\t}\n\terr := mailjetClient.Get(mr, &data)\n\tif err != nil {\n\t fmt.Println(err)\n\t}\n\tfmt.Printf(\"Data array: %+v\\n\", data)\n}"
- lang: C#
label: C#
source: "using Mailjet.Client;\nusing Mailjet.Client.Resources;\nusing System;\nusing Newtonsoft.Json.Linq;\nnamespace Mailjet.ConsoleApplication\n{\n class Program\n {\n static void Main(string[] args)\n {\n RunAsync().Wait();\n }\n static async Task RunAsync()\n {\n MailjetClient client = new MailjetClient(Environment.GetEnvironmentVariable(\"MJ_APIKEY_PUBLIC\"), Environment.GetEnvironmentVariable(\"MJ_APIKEY_PRIVATE\"))\n {\n Version = ApiVersion.V3,\n };\n MailjetRequest request = new MailjetRequest\n {\n Resource = Newsletter.Resource,\n ResourceId = ResourceId.Numeric(ID)\n }\n MailjetResponse response = await client.GetAsync(request);\n if (response.IsSuccessStatusCode)\n {\n Console.WriteLine(string.Format(\"Total: {0}, Count: {1}\\n\", response.GetTotal(), response.GetCount()));\n Console.WriteLine(response.GetData());\n }\n else\n {\n Console.WriteLine(string.Format(\"StatusCode: {0}\\n\", response.StatusCode));\n Console.WriteLine(string.Format(\"ErrorInfo: {0}\\n\", response.GetErrorInfo()));\n Console.WriteLine(response.GetData());\n Console.WriteLine(string.Format(\"ErrorMessage: {0}\\n\", response.GetErrorMessage()));\n }\n }\n }\n}"
post:
x-seo:
title: "Newsletter: Detail Content"
description: "Create, update or delete the content of your newsletter email. You can select a Text part and/or HTML part. Each POST request overwrites any content\u2026"
deprecated: true
tags:
- Deprecated Endpoints
summary: 'Newsletter: Detail Content'
description: "Create, update or delete the content of your newsletter email. You can select a Text part and/or HTML part.\n\nEach POST request overwrites any content previously added - e.g. if you have submitted HTML content on the initial `POST`, and on the next you only submit Text content, the previously saved value of `Html-part` will be deleted.\n To obtain a valid `newsletter_ID`, first call `GET /v3/REST/newsletter` to list your newsletters."
operationId: post_v3_newsletter_id_detailcontent
parameters:
- name: newsletter_ID
in: path
schema:
$ref: '#/components/schemas/post_v3_newsletter_id_detailcontent_PathParams/properties/newsletter_ID'
required: true
example: 5000
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/NewNewsletterDetailcontent'
example:
Html-part: Dear passenger, welcome to Mailjet!
May the delivery force be with you!
Text-part: Dear passenger, welcome to Mailjet! May the delivery force be with you!
responses:
'201':
description: Default OK response for `/newsletter` action `/detailcontent`
content:
application/json:
schema:
type: object
properties:
Count:
description: Indicates the number of objects in the `Data` array.
type: integer
format: int64
examples:
- 1
Data:
description: A JSON array containing a list of objects returned by this endpoint.
type: array
items:
$ref: '#/components/schemas/OutputNewsletterDetailcontent'
Total:
description: Indicates the number of objects in the `Data` array.
type: integer
format: int64
examples:
- 1
'400':
$ref: '#/components/responses/400'
'401':
$ref: '#/components/responses/401'
'403':
$ref: '#/components/responses/403'
'404':
$ref: '#/components/responses/404'
'429':
$ref: '#/components/responses/429'
'500':
$ref: '#/components/responses/500'
security:
- basicAuth: []
x-codeSamples:
- lang: curl
label: cURL
source: "curl -s \\\n\t-X POST \\\n\t--user \"$MJ_APIKEY_PUBLIC:$MJ_APIKEY_PRIVATE\" \\\n\thttps://api.mailjet.com/v3/REST/newsletter/$newsletter_ID \\\n\t-H 'Content-Type: application/json' \\\n\t-d '{\n \"Html-part\":\"Dear passenger, welcome to Mailjet!
May the delivery force be with you!\",\n \"Text-part\":\"Dear passenger, welcome to Mailjet! May the delivery force be with you!\"\n\t}'"
- lang: PHP
label: PHP
source: " 'v3']);\n$body = [\n 'Html-part' => \"Dear passenger, welcome to Mailjet!
May the delivery force be with you!\",\n 'Text-part' => \"Dear passenger, welcome to Mailjet! May the delivery force be with you!\"\n];\n$response = $mj->post(Resources::$Newsletter, ['id' => $id, 'body' => $body]);\n$response->success() && var_dump($response->getData());\n?>"
- lang: Node.js
label: Node
source: "const mailjet = require ('node-mailjet')\n\t.connect(process.env.MJ_APIKEY_PUBLIC, process.env.MJ_APIKEY_PRIVATE)\nconst request = mailjet\n\t.post(\"newsletter\", {'version': 'v3'})\n\t.id($newsletter_ID)\n\t.request({\n \"Html-part\":\"Dear passenger, welcome to Mailjet!
May the delivery force be with you!\",\n \"Text-part\":\"Dear passenger, welcome to Mailjet! May the delivery force be with you!\"\n })\nrequest\n\t.then((result) => {\n\t\tconsole.log(result.body)\n\t})\n\t.catch((err) => {\n\t\tconsole.log(err.statusCode)\n\t})"
- lang: Ruby
label: Ruby
source: "require 'mailjet'\nMailjet.configure do |config|\n config.api_key = ENV['MJ_APIKEY_PUBLIC']\n config.secret_key = ENV['MJ_APIKEY_PRIVATE']\n config.api_version = \"v3\"\nend\nvariable = Mailjet::Newsletter.create(id: $newsletter_ID,\n html_part: \"Dear passenger, welcome to Mailjet!
May the delivery force be with you!\",\n text_part: \"Dear passenger, welcome to Mailjet! May the delivery force be with you!\"\n)\np variable.attributes['Data']"
- lang: Python
label: Python
source: "from mailjet_rest import Client\nimport os\napi_key = os.environ['MJ_APIKEY_PUBLIC']\napi_secret = os.environ['MJ_APIKEY_PRIVATE']\nmailjet = Client(auth=(api_key, api_secret), version='v3')\nid = '$newsletter_ID'\ndata = {\n 'Html-part': \"Dear passenger, welcome to Mailjet!
May the delivery force be with you!\",\n 'Text-part': \"Dear passenger, welcome to Mailjet! May the delivery force be with you!\"\n}\nresult = mailjet.newsletter.create(id=id, data=data)\nprint result.status_code\nprint result.json()"
- lang: Java
label: Java
source: "package com.my.project;\nimport com.mailjet.client.errors.MailjetException;\nimport com.mailjet.client.errors.MailjetSocketTimeoutException;\nimport com.mailjet.client.MailjetClient;\nimport com.mailjet.client.MailjetRequest;\nimport com.mailjet.client.MailjetResponse;\nimport com.mailjet.client.ClientOptions;\nimport com.mailjet.client.resource.Newsletter;\nimport org.json.JSONArray;\nimport org.json.JSONObject;\npublic class MyClass {\n public static void main(String[] args) throws MailjetException, MailjetSocketTimeoutException {\n MailjetClient client;\n MailjetRequest request;\n MailjetResponse response;\n client = new MailjetClient(System.getenv(\"MJ_APIKEY_PUBLIC\"), System.getenv(\"MJ_APIKEY_PRIVATE\"), new ClientOptions(\"v3\"));\n request = new MailjetRequest(Newsletter.resource, ID)\n .property(Newsletter.HTMLPART, \"Dear passenger, welcome to Mailjet!
May the delivery force be with you!\")\n .property(Newsletter.TEXTPART, \"Dear passenger, welcome to Mailjet! May the delivery force be with you!\")\n );\n response = client.post(request);\n System.out.println(response.getStatus());\n System.out.println(response.getData());\n }\n}"
- lang: Go
label: Go
source: "package main\nimport (\n\t\"fmt\"\n\t\"log\"\n\t\"os\"\n\tmailjet \"github.com/mailjet/mailjet-apiv3-go\"\n\t\"github.com/mailjet/mailjet-apiv3-go/resources\"\n)\nfunc main () {\n\tmailjetClient := NewMailjetClient(os.Getenv(\"MJ_APIKEY_PUBLIC\"), os.Getenv(\"MJ_APIKEY_PRIVATE\"))\n\tvar data []resources.Newsletter\n\tmr := &Request{\n\t Resource: \"newsletter\",\n\t ID: RESOURCE_ID,\n\t}\n\tfmr := &FullRequest{\n\t Info: mr,\n\t Payload: &resources.Newsletter { \n\t Html-part:\"Dear passenger, welcome to Mailjet!
May the delivery force be with you!\",\n\t Text-part:\"Dear passenger, welcome to Mailjet! May the delivery force be with you!\"\n }\n\t}\n\terr := mailjetClient.Post(fmr, &data)\n\tif err != nil {\n\t fmt.Println(err)\n\t}\n\tfmt.Printf(\"Data array: %+v\\n\", data)\n}"
- lang: C#
label: C#
source: "using Mailjet.Client;\nusing Mailjet.Client.Resources;\nusing System;\nusing Newtonsoft.Json.Linq;\nnamespace Mailjet.ConsoleApplication\n{\n class Program\n {\n static void Main(string[] args)\n {\n RunAsync().Wait();\n }\n static async Task RunAsync()\n {\n MailjetClient client = new MailjetClient(Environment.GetEnvironmentVariable(\"MJ_APIKEY_PUBLIC\"), Environment.GetEnvironmentVariable(\"MJ_APIKEY_PRIVATE\"))\n {\n Version = ApiVersion.V3,\n };\n MailjetRequest request = new MailjetRequest\n {\n Resource = Newsletter.Resource,\n ResourceId = ResourceId.Numeric(ID)\n }\n .Property(Newsletter.Htmlpart, \"Dear passenger, welcome to Mailjet!
May the delivery force be with you!\")\n .Property(Newsletter.Textpart, \"Dear passenger, welcome to Mailjet! May the delivery force be with you!\");\n MailjetResponse response = await client.PostAsync(request);\n if (response.IsSuccessStatusCode)\n {\n Console.WriteLine(string.Format(\"Total: {0}, Count: {1}\\n\", response.GetTotal(), response.GetCount()));\n Console.WriteLine(response.GetData());\n }\n else\n {\n Console.WriteLine(string.Format(\"StatusCode: {0}\\n\", response.StatusCode));\n Console.WriteLine(string.Format(\"ErrorInfo: {0}\\n\", response.GetErrorInfo()));\n Console.WriteLine(response.GetData());\n Console.WriteLine(string.Format(\"ErrorMessage: {0}\\n\", response.GetErrorMessage()));\n }\n }\n }\n}"
put:
x-seo:
title: "Update Newsletter: Detail Content"
description: "Update Newsletter: Detail Content using the Mailjet Email API. Update the contents of a newsletter email."
deprecated: true
tags:
- Deprecated Endpoints
summary: 'Update Newsletter: Detail Content'
description: Update the contents of a newsletter email. To obtain a valid `newsletter_ID`, first call `GET /v3/REST/newsletter` to list your newsletters.
operationId: put_v3_newsletter_id_detailcontent
parameters:
- name: newsletter_ID
in: path
schema:
$ref: '#/components/schemas/put_v3_newsletter_id_detailcontent_PathParams/properties/newsletter_ID'
required: true
example: 5000
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/UpdateNewsletterDetailcontent'
example:
Html-part: Dear passenger, welcome to Mailjet!
May the delivery force be with you!
Text-part: Dear passenger, welcome to Mailjet! May the delivery force be with you!
responses:
'200':
description: Default OK response for `/newsletter` action `/detailcontent`
content:
application/json:
schema:
type: object
properties:
Count:
description: Indicates the number of objects in the `Data` array.
type: integer
format: int64
examples:
- 1
Data:
description: A JSON array containing a list of objects returned by this endpoint.
type: array
items:
$ref: '#/components/schemas/OutputNewsletterDetailcontent'
Total:
description: Indicates the number of objects in the `Data` array.
type: integer
format: int64
examples:
- 1
'400':
$ref: '#/components/responses/400'
'401':
$ref: '#/components/responses/401'
'403':
$ref: '#/components/responses/403'
'404':
$ref: '#/components/responses/404'
'429':
$ref: '#/components/responses/429'
'500':
$ref: '#/components/responses/500'
security:
- basicAuth: []
x-codeSamples:
- lang: curl
label: cURL
source: "curl -s \\\n\t-X PUT \\\n\t--user \"$MJ_APIKEY_PUBLIC:$MJ_APIKEY_PRIVATE\" \\\n\thttps://api.mailjet.com/v3/REST/newsletter/$newsletter_ID \\\n\t-H 'Content-Type: application/json' \\\n\t-d '{\n \"Html-part\":\"Dear passenger, welcome to Mailjet!
May the delivery force be with you!\",\n \"Text-part\":\"Dear passenger, welcome to Mailjet! May the delivery force be with you!\"\n\t}'"
- lang: PHP
label: PHP
source: " 'v3']);\n$body = [\n 'Html-part' => \"Dear passenger, welcome to Mailjet!
May the delivery force be with you!\",\n 'Text-part' => \"Dear passenger, welcome to Mailjet! May the delivery force be with you!\"\n];\n$response = $mj->put(Resources::$Newsletter, ['id' => $id, 'body' => $body]);\n$response->success() && var_dump($response->getData());\n?>"
- lang: Node.js
label: Node
source: "const mailjet = require ('node-mailjet')\n\t.connect(process.env.MJ_APIKEY_PUBLIC, process.env.MJ_APIKEY_PRIVATE)\nconst request = mailjet\n\t.put(\"newsletter\", {'version': 'v3'})\n\t.id($newsletter_ID)\n\t.request({\n \"Html-part\":\"Dear passenger, welcome to Mailjet!
May the delivery force be with you!\",\n \"Text-part\":\"Dear passenger, welcome to Mailjet! May the delivery force be with you!\"\n })\nrequest\n\t.then((result) => {\n\t\tconsole.log(result.body)\n\t})\n\t.catch((err) => {\n\t\tconsole.log(err.statusCode)\n\t})"
- lang: Ruby
label: Ruby
source: "require 'mailjet'\nMailjet.configure do |config|\n config.api_key = ENV['MJ_APIKEY_PUBLIC']\n config.secret_key = ENV['MJ_APIKEY_PRIVATE']\n config.api_version = \"v3\"\nend\ntarget = Mailjet::Newsletter.find($newsletter_ID)\ntarget.update_attributes(\n html_part: \"Dear passenger, welcome to Mailjet!
May the delivery force be with you!\",\n text_part: \"Dear passenger, welcome to Mailjet! May the delivery force be with you!\"\n)\np variable.attributes['Data']"
- lang: Python
label: Python
source: "from mailjet_rest import Client\nimport os\napi_key = os.environ['MJ_APIKEY_PUBLIC']\napi_secret = os.environ['MJ_APIKEY_PRIVATE']\nmailjet = Client(auth=(api_key, api_secret), version='v3')\nid = '$newsletter_ID'\ndata = {\n 'Html-part': \"Dear passenger, welcome to Mailjet!
May the delivery force be with you!\",\n 'Text-part': \"Dear passenger, welcome to Mailjet! May the delivery force be with you!\"\n}\nresult = mailjet.newsletter.update(id=id, data=data)\nprint result.status_code\nprint result.json()"
- lang: Java
label: Java
source: "package com.my.project;\nimport com.mailjet.client.errors.MailjetException;\nimport com.mailjet.client.errors.MailjetSocketTimeoutException;\nimport com.mailjet.client.MailjetClient;\nimport com.mailjet.client.MailjetRequest;\nimport com.mailjet.client.MailjetResponse;\nimport com.mailjet.client.ClientOptions;\nimport com.mailjet.client.resource.Newsletter;\nimport org.json.JSONArray;\nimport org.json.JSONObject;\npublic class MyClass {\n public static void main(String[] args) throws MailjetException, MailjetSocketTimeoutException {\n MailjetClient client;\n MailjetRequest request;\n MailjetResponse response;\n client = new MailjetClient(System.getenv(\"MJ_APIKEY_PUBLIC\"), System.getenv(\"MJ_APIKEY_PRIVATE\"), new ClientOptions(\"v3\"));\n request = new MailjetRequest(Newsletter.resource, ID)\n .property(Newsletter.HTMLPART, \"Dear passenger, welcome to Mailjet!
May the delivery force be with you!\")\n .property(Newsletter.TEXTPART, \"Dear passenger, welcome to Mailjet! May the delivery force be with you!\")\n );\n response = client.put(request);\n System.out.println(response.getStatus());\n System.out.println(response.getData());\n }\n}"
- lang: Go
label: Go
source: "package main\nimport (\n\t\"fmt\"\n\t\"log\"\n\t\"os\"\n\tmailjet \"github.com/mailjet/mailjet-apiv3-go\"\n\t\"github.com/mailjet/mailjet-apiv3-go/resources\"\n)\nfunc main () {\n\tmailjetClient := NewMailjetClient(os.Getenv(\"MJ_APIKEY_PUBLIC\"), os.Getenv(\"MJ_APIKEY_PRIVATE\"))\n\tmr := &Request{\n\t Resource: \"newsletter\",\n\t ID: RESOURCE_ID,\n\t}\n\tfmr := &FullRequest{\n\t Info: mr,\n\t Payload: &resources.Newsletter { \n\t Html-part:\"Dear passenger, welcome to Mailjet!
May the delivery force be with you!\",\n\t Text-part:\"Dear passenger, welcome to Mailjet! May the delivery force be with you!\"\n }\n\t}\n\terr := mailjetClient.Put(fmr)\n\tif err != nil {\n\t fmt.Println(err)\n\t}\n}"
- lang: C#
label: C#
source: "using Mailjet.Client;\nusing Mailjet.Client.Resources;\nusing System;\nusing Newtonsoft.Json.Linq;\nnamespace Mailjet.ConsoleApplication\n{\n class Program\n {\n static void Main(string[] args)\n {\n RunAsync().Wait();\n }\n static async Task RunAsync()\n {\n MailjetClient client = new MailjetClient(Environment.GetEnvironmentVariable(\"MJ_APIKEY_PUBLIC\"), Environment.GetEnvironmentVariable(\"MJ_APIKEY_PRIVATE\"))\n {\n Version = ApiVersion.V3,\n };\n MailjetRequest request = new MailjetRequest\n {\n Resource = Newsletter.Resource,\n ResourceId = ResourceId.Numeric(ID)\n }\n .Property(Newsletter.Htmlpart, \"Dear passenger, welcome to Mailjet!
May the delivery force be with you!\")\n .Property(Newsletter.Textpart, \"Dear passenger, welcome to Mailjet! May the delivery force be with you!\");\n MailjetResponse response = await client.PutAsync(request);\n if (response.IsSuccessStatusCode)\n {\n Console.WriteLine(string.Format(\"Total: {0}, Count: {1}\\n\", response.GetTotal(), response.GetCount()));\n Console.WriteLine(response.GetData());\n }\n else\n {\n Console.WriteLine(string.Format(\"StatusCode: {0}\\n\", response.StatusCode));\n Console.WriteLine(string.Format(\"ErrorInfo: {0}\\n\", response.GetErrorInfo()));\n Console.WriteLine(response.GetData());\n Console.WriteLine(string.Format(\"ErrorMessage: {0}\\n\", response.GetErrorMessage()));\n }\n }\n }\n}"
delete:
x-seo:
title: "Delete Newsletter: Detail Content"
description: "Delete Newsletter: Detail Content using the Mailjet Email API. Delete the contents of a newsletter email."
deprecated: true
tags:
- Deprecated Endpoints
summary: 'Delete Newsletter: Detail Content'
description: Delete the contents of a newsletter email.
operationId: delete_v3_newsletter_id_detailcontent
parameters:
- name: newsletter_ID
in: path
schema:
$ref: '#/components/schemas/delete_v3_newsletter_id_detailcontent_PathParams/properties/newsletter_ID'
required: true
responses:
'204':
$ref: '#/components/responses/204'
'400':
$ref: '#/components/responses/400'
'401':
$ref: '#/components/responses/401'
'403':
$ref: '#/components/responses/403'
'404':
$ref: '#/components/responses/404'
'429':
$ref: '#/components/responses/429'
'500':
$ref: '#/components/responses/500'
security:
- basicAuth: []
x-codeSamples:
- lang: curl
label: cURL
source: "curl -s \\\n\t-X DELETE \\\n\t--user \"$MJ_APIKEY_PUBLIC:$MJ_APIKEY_PRIVATE\" \\\n\thttps://api.mailjet.com/v3/REST/newsletter/$newsletter_ID \\\n\t-H 'Content-Type: application/json' \\\n\t-d '{\n\t}'"
- lang: PHP
label: PHP
source: " 'v3']);\n$response = $mj->delete(Resources::$Newsletter, ['id' => $id]);\n$response->success() && var_dump($response->getData());\n?>"
- lang: Node.js
label: Node
source: "const mailjet = require ('node-mailjet')\n\t.connect(process.env.MJ_APIKEY_PUBLIC, process.env.MJ_APIKEY_PRIVATE)\nconst request = mailjet\n\t.delete(\"newsletter\", {'version': 'v3'})\n\t.id($newsletter_ID)\n\t.request()\nrequest\n\t.then((result) => {\n\t\tconsole.log(result.body)\n\t})\n\t.catch((err) => {\n\t\tconsole.log(err.statusCode)\n\t})"
- lang: Ruby
label: Ruby
source: "require 'mailjet'\nMailjet.configure do |config|\n config.api_key = ENV['MJ_APIKEY_PUBLIC']\n config.secret_key = ENV['MJ_APIKEY_PRIVATE']\n config.api_version = \"v3\"\nend\ntarget = Mailjet::Newsletter.find($newsletter_ID)\ntarget.delete(\n)\np variable.attributes['Data']"
- lang: Python
label: Python
source: "from mailjet_rest import Client\nimport os\napi_key = os.environ['MJ_APIKEY_PUBLIC']\napi_secret = os.environ['MJ_APIKEY_PRIVATE']\nmailjet = Client(auth=(api_key, api_secret), version='v3')\nid = '$newsletter_ID'\nresult = mailjet.newsletter.delete(id=id)\nprint result.status_code\nprint result.json()"
- lang: Java
label: Java
source: "package com.my.project;\nimport com.mailjet.client.errors.MailjetException;\nimport com.mailjet.client.errors.MailjetSocketTimeoutException;\nimport com.mailjet.client.MailjetClient;\nimport com.mailjet.client.MailjetRequest;\nimport com.mailjet.client.MailjetResponse;\nimport com.mailjet.client.ClientOptions;\nimport com.mailjet.client.resource.Newsletter;\nimport org.json.JSONArray;\nimport org.json.JSONObject;\npublic class MyClass {\n public static void main(String[] args) throws MailjetException, MailjetSocketTimeoutException {\n MailjetClient client;\n MailjetRequest request;\n MailjetResponse response;\n client = new MailjetClient(System.getenv(\"MJ_APIKEY_PUBLIC\"), System.getenv(\"MJ_APIKEY_PRIVATE\"), new ClientOptions(\"v3\"));\n request = new MailjetRequest(Newsletter.resource, ID);\n response = client.delete(request);\n System.out.println(response.getStatus());\n System.out.println(response.getData());\n }\n}"
- lang: Go
label: Go
source: "package main\nimport (\n\t\"fmt\"\n\t\"log\"\n\t\"os\"\n\tmailjet \"github.com/mailjet/mailjet-apiv3-go\"\n\t\"github.com/mailjet/mailjet-apiv3-go/resources\"\n)\nfunc main () {\n\tmailjetClient := NewMailjetClient(os.Getenv(\"MJ_APIKEY_PUBLIC\"), os.Getenv(\"MJ_APIKEY_PRIVATE\"))\n\tmr := &Request{\n\t Resource: \"newsletter\",\n\t ID: RESOURCE_ID,\n\t}\n\terr := mailjetClient.Delete(mr)\n\tif err != nil {\n\t fmt.Println(err)\n\t}\n}"
- lang: C#
label: C#
source: "using Mailjet.Client;\nusing Mailjet.Client.Resources;\nusing System;\nusing Newtonsoft.Json.Linq;\nnamespace Mailjet.ConsoleApplication\n{\n class Program\n {\n static void Main(string[] args)\n {\n RunAsync().Wait();\n }\n static async Task RunAsync()\n {\n MailjetClient client = new MailjetClient(Environment.GetEnvironmentVariable(\"MJ_APIKEY_PUBLIC\"), Environment.GetEnvironmentVariable(\"MJ_APIKEY_PRIVATE\"))\n {\n Version = ApiVersion.V3,\n };\n MailjetRequest request = new MailjetRequest\n {\n Resource = Newsletter.Resource,\n ResourceId = ResourceId.Numeric(ID)\n }\n MailjetResponse response = await client.DeleteAsync(request);\n if (response.IsSuccessStatusCode)\n {\n Console.WriteLine(string.Format(\"Total: {0}, Count: {1}\\n\", response.GetTotal(), response.GetCount()));\n Console.WriteLine(response.GetData());\n }\n else\n {\n Console.WriteLine(string.Format(\"StatusCode: {0}\\n\", response.StatusCode));\n Console.WriteLine(string.Format(\"ErrorInfo: {0}\\n\", response.GetErrorInfo()));\n Console.WriteLine(response.GetData());\n Console.WriteLine(string.Format(\"ErrorMessage: {0}\\n\", response.GetErrorMessage()));\n }\n }\n }\n}"
/v3/REST/newsletter/{newsletter_ID}/test:
post:
x-seo:
title: "Newsletter: Test"
description: "Test a created newsletter by sending it to a selection of recipients. The status of the campaign draft will not be affected by the test."
deprecated: true
tags:
- Deprecated Endpoints
summary: 'Newsletter: Test'
description: Test a created newsletter by sending it to a selection of recipients. The status of the campaign draft will not be affected by the test. To obtain a valid `newsletter_ID`, first call `GET /v3/REST/newsletter` to list your newsletters.
operationId: post_v3_newsletter_id_test
parameters:
- name: newsletter_ID
in: path
schema:
$ref: '#/components/schemas/post_v3_newsletter_id_test_PathParams/properties/newsletter_ID'
required: true
example: 5000
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/NewNewsletterTest'
example:
Recipients:
- Email: contact@example.com
Name: Example Contact
responses:
'201':
description: Default OK response for `/newsletter` action `/test`
content:
application/json:
schema:
type: object
properties:
Count:
description: Indicates the number of objects in the `Data` array.
type: integer
format: int64
examples:
- 1
Data:
description: A JSON array containing a list of objects returned by this endpoint.
type: array
items:
$ref: '#/components/schemas/ActionStatusNewsletterTest'
Total:
description: Indicates the number of objects in the `Data` array.
type: integer
format: int64
examples:
- 1
'400':
$ref: '#/components/responses/400'
'401':
$ref: '#/components/responses/401'
'403':
$ref: '#/components/responses/403'
'404':
$ref: '#/components/responses/404'
'429':
$ref: '#/components/responses/429'
'500':
$ref: '#/components/responses/500'
security:
- basicAuth: []
x-codeSamples:
- lang: curl
label: cURL
source: "curl -s \\\n\t-X POST \\\n\t--user \"$MJ_APIKEY_PUBLIC:$MJ_APIKEY_PRIVATE\" \\\n\thttps://api.mailjet.com/v3/REST/newsletter/$newsletter_ID/test \\\n\t-H 'Content-Type: application/json' \\\n\t-d '{\n \"Recipients\":[\n {\n \"Email\":\"passenger@mailjet.com\",\n \"Name\":\"Passenger 1\"\n }\n ]\n\t}'"
- lang: PHP
label: PHP
source: " 'v3']);\n$body = [\n 'Recipients' => [\n [\n 'Email' => \"passenger@mailjet.com\",\n 'Name' => \"Passenger 1\"\n ]\n ]\n];\n$response = $mj->post(Resources::$NewsletterTest, ['id' => $id, 'body' => $body]);\n$response->success() && var_dump($response->getData());\n?>"
- lang: Node.js
label: Node
source: "const mailjet = require ('node-mailjet')\n\t.connect(process.env.MJ_APIKEY_PUBLIC, process.env.MJ_APIKEY_PRIVATE)\nconst request = mailjet\n\t.post(\"newsletter\", {'version': 'v3'})\n\t.id($newsletter_ID)\n\t.action(\"test\")\n\t.request({\n \"Recipients\":[\n {\n \"Email\":\"passenger@mailjet.com\",\n \"Name\":\"Passenger 1\"\n }\n ]\n })\nrequest\n\t.then((result) => {\n\t\tconsole.log(result.body)\n\t})\n\t.catch((err) => {\n\t\tconsole.log(err.statusCode)\n\t})"
- lang: Ruby
label: Ruby
source: "require 'mailjet'\nMailjet.configure do |config|\n config.api_key = ENV['MJ_APIKEY_PUBLIC']\n config.secret_key = ENV['MJ_APIKEY_PRIVATE']\n config.api_version = \"v3\"\nend\nvariable = Mailjet::Newsletter_test.create(id: $newsletter_ID,\n recipients: [\n {\n 'email' => \"passenger@mailjet.com\",\n 'name' => \"Passenger 1\"\n }\n ]\n)\np variable.attributes['Data']"
- lang: Python
label: Python
source: "from mailjet_rest import Client\nimport os\napi_key = os.environ['MJ_APIKEY_PUBLIC']\napi_secret = os.environ['MJ_APIKEY_PRIVATE']\nmailjet = Client(auth=(api_key, api_secret), version='v3')\nid = '$newsletter_ID'\ndata = {\n 'Recipients': [\n {\n \"Email\": \"passenger@mailjet.com\",\n \"Name\": \"Passenger 1\"\n }\n ]\n}\nresult = mailjet.newsletter_test.create(id=id, data=data)\nprint result.status_code\nprint result.json()"
- lang: Java
label: Java
source: "package com.my.project;\nimport com.mailjet.client.errors.MailjetException;\nimport com.mailjet.client.errors.MailjetSocketTimeoutException;\nimport com.mailjet.client.MailjetClient;\nimport com.mailjet.client.MailjetRequest;\nimport com.mailjet.client.MailjetResponse;\nimport com.mailjet.client.ClientOptions;\nimport com.mailjet.client.resource.NewsletterTest;\nimport org.json.JSONArray;\nimport org.json.JSONObject;\npublic class MyClass {\n public static void main(String[] args) throws MailjetException, MailjetSocketTimeoutException {\n MailjetClient client;\n MailjetRequest request;\n MailjetResponse response;\n client = new MailjetClient(System.getenv(\"MJ_APIKEY_PUBLIC\"), System.getenv(\"MJ_APIKEY_PRIVATE\"), new ClientOptions(\"v3\"));\n request = new MailjetRequest(NewsletterTest.resource, ID)\n .property(NewsletterTest.RECIPIENTS, new JSONArray()\n .put(new JSONObject()\n .put(\"Email\", \"passenger@mailjet.com\")\n .put(\"Name\", \"Passenger 1\")\n )\n )\n );\n response = client.post(request);\n System.out.println(response.getStatus());\n System.out.println(response.getData());\n }\n}"
- lang: Go
label: Go
source: "package main\nimport (\n\t\"fmt\"\n\t\"log\"\n\t\"os\"\n\tmailjet \"github.com/mailjet/mailjet-apiv3-go\"\n\t\"github.com/mailjet/mailjet-apiv3-go/resources\"\n)\nfunc main () {\n\tmailjetClient := NewMailjetClient(os.Getenv(\"MJ_APIKEY_PUBLIC\"), os.Getenv(\"MJ_APIKEY_PRIVATE\"))\n\tvar data []resources.NewsletterTest\n\tmr := &Request{\n\t Resource: \"newsletter\",\n\t ID: RESOURCE_ID,\n\t Action: \"test\",\n\t}\n\tfmr := &FullRequest{\n\t Info: mr,\n\t Payload: &resources.NewsletterTest { \n Recipients: []MailjetRecipient {\n MailjetRecipient {\n Email:\"passenger@mailjet.com\",\n Name:\"Passenger 1\"\n }\n }\n }\n\t}\n\terr := mailjetClient.Post(fmr, &data)\n\tif err != nil {\n\t fmt.Println(err)\n\t}\n\tfmt.Printf(\"Data array: %+v\\n\", data)\n}"
- lang: C#
label: C#
source: "using Mailjet.Client;\nusing Mailjet.Client.Resources;\nusing System;\nusing Newtonsoft.Json.Linq;\nnamespace Mailjet.ConsoleApplication\n{\n class Program\n {\n static void Main(string[] args)\n {\n RunAsync().Wait();\n }\n static async Task RunAsync()\n {\n MailjetClient client = new MailjetClient(Environment.GetEnvironmentVariable(\"MJ_APIKEY_PUBLIC\"), Environment.GetEnvironmentVariable(\"MJ_APIKEY_PRIVATE\"))\n {\n Version = ApiVersion.V3,\n };\n MailjetRequest request = new MailjetRequest\n {\n Resource = NewsletterTest.Resource,\n ResourceId = ResourceId.Numeric(ID)\n }\n .Property(NewsletterTest.Recipients, new JArray {\n new JObject {\n {\"Email\", \"passenger@mailjet.com\"},\n {\"Name\", \"Passenger 1\"}\n }\n });\n MailjetResponse response = await client.PostAsync(request);\n if (response.IsSuccessStatusCode)\n {\n Console.WriteLine(string.Format(\"Total: {0}, Count: {1}\\n\", response.GetTotal(), response.GetCount()));\n Console.WriteLine(response.GetData());\n }\n else\n {\n Console.WriteLine(string.Format(\"StatusCode: {0}\\n\", response.StatusCode));\n Console.WriteLine(string.Format(\"ErrorInfo: {0}\\n\", response.GetErrorInfo()));\n Console.WriteLine(response.GetData());\n Console.WriteLine(string.Format(\"ErrorMessage: {0}\\n\", response.GetErrorMessage()));\n }\n }\n }\n}"
/v3/REST/newsletter/{newsletter_ID}/schedule:
get:
x-seo:
title: "Get Newsletter: Schedule"
description: "Get Newsletter: Schedule using the Mailjet Email API. Retrieve the sending schedule of a newsletter."
deprecated: true
tags:
- Deprecated Endpoints
summary: 'Get Newsletter: Schedule'
description: Retrieve the sending schedule of a newsletter. To obtain a valid `newsletter_ID`, first call `GET /v3/REST/newsletter` to list your newsletters.
operationId: get_v3_newsletter_id_schedule
parameters:
- name: newsletter_ID
in: path
schema:
$ref: '#/components/schemas/get_v3_newsletter_id_schedule_PathParams/properties/newsletter_ID'
required: true
example: 5000
responses:
'200':
description: Default OK response for `/newsletter` action `/schedule`
content:
application/json:
schema:
type: object
properties:
Count:
description: Indicates the number of objects in the `Data` array.
type: integer
format: int64
examples:
- 1
Data:
description: A JSON array containing a list of objects returned by this endpoint.
type: array
items:
$ref: '#/components/schemas/OutputNewsletterSchedule'
Total:
description: Indicates the number of objects in the `Data` array.
type: integer
format: int64
examples:
- 1
'400':
$ref: '#/components/responses/400'
'401':
$ref: '#/components/responses/401'
'403':
$ref: '#/components/responses/403'
'404':
$ref: '#/components/responses/404'
'429':
$ref: '#/components/responses/429'
'500':
$ref: '#/components/responses/500'
security:
- basicAuth: []
x-codeSamples:
- lang: curl
label: cURL
source: "curl -s \\\n\t-X GET \\\n\t--user \"$MJ_APIKEY_PUBLIC:$MJ_APIKEY_PRIVATE\" \\\n\thttps://api.mailjet.com/v3/REST/newsletter/$newsletter_ID/schedule \\"
- lang: PHP
label: PHP
source: " 'v3']);\n$response = $mj->get(Resources::$NewsletterSchedule, ['id' => $id]);\n$response->success() && var_dump($response->getData());\n?>"
- lang: Node.js
label: Node
source: "const mailjet = require ('node-mailjet')\n\t.connect(process.env.MJ_APIKEY_PUBLIC, process.env.MJ_APIKEY_PRIVATE)\nconst request = mailjet\n\t.get(\"newsletter\", {'version': 'v3'})\n\t.id($newsletter_ID)\n\t.action(\"schedule\")\n\t.request()\nrequest\n\t.then((result) => {\n\t\tconsole.log(result.body)\n\t})\n\t.catch((err) => {\n\t\tconsole.log(err.statusCode)\n\t})"
- lang: Ruby
label: Ruby
source: "require 'mailjet'\nMailjet.configure do |config|\n config.api_key = ENV['MJ_APIKEY_PUBLIC']\n config.secret_key = ENV['MJ_APIKEY_PRIVATE']\n config.api_version = \"v3\"\nend\nvariable = Mailjet::Newsletter_schedule.find($newsletter_ID\n)\np variable.attributes['Data']"
- lang: Python
label: Python
source: "from mailjet_rest import Client\nimport os\napi_key = os.environ['MJ_APIKEY_PUBLIC']\napi_secret = os.environ['MJ_APIKEY_PRIVATE']\nmailjet = Client(auth=(api_key, api_secret), version='v3')\nid = '$newsletter_ID'\nresult = mailjet.newsletter_schedule.get(id=id)\nprint result.status_code\nprint result.json()"
- lang: Java
label: Java
source: "package com.my.project;\nimport com.mailjet.client.errors.MailjetException;\nimport com.mailjet.client.errors.MailjetSocketTimeoutException;\nimport com.mailjet.client.MailjetClient;\nimport com.mailjet.client.MailjetRequest;\nimport com.mailjet.client.MailjetResponse;\nimport com.mailjet.client.ClientOptions;\nimport com.mailjet.client.resource.NewsletterSchedule;\nimport org.json.JSONArray;\nimport org.json.JSONObject;\npublic class MyClass {\n public static void main(String[] args) throws MailjetException, MailjetSocketTimeoutException {\n MailjetClient client;\n MailjetRequest request;\n MailjetResponse response;\n client = new MailjetClient(System.getenv(\"MJ_APIKEY_PUBLIC\"), System.getenv(\"MJ_APIKEY_PRIVATE\"), new ClientOptions(\"v3\"));\n request = new MailjetRequest(NewsletterSchedule.resource, ID);\n response = client.get(request);\n System.out.println(response.getStatus());\n System.out.println(response.getData());\n }\n}"
- lang: Go
label: Go
source: "package main\nimport (\n\t\"fmt\"\n\t\"log\"\n\t\"os\"\n\tmailjet \"github.com/mailjet/mailjet-apiv3-go\"\n\t\"github.com/mailjet/mailjet-apiv3-go/resources\"\n)\nfunc main () {\n\tmailjetClient := NewMailjetClient(os.Getenv(\"MJ_APIKEY_PUBLIC\"), os.Getenv(\"MJ_APIKEY_PRIVATE\"))\n\tvar data []resources.NewsletterSchedule\n\tmr := &Request{\n\t Resource: \"newsletter\",\n\t ID: RESOURCE_ID,\n\t Action: \"schedule\",\n\t}\n\terr := mailjetClient.Get(mr, &data)\n\tif err != nil {\n\t fmt.Println(err)\n\t}\n\tfmt.Printf(\"Data array: %+v\\n\", data)\n}"
- lang: C#
label: C#
source: "using Mailjet.Client;\nusing Mailjet.Client.Resources;\nusing System;\nusing Newtonsoft.Json.Linq;\nnamespace Mailjet.ConsoleApplication\n{\n class Program\n {\n static void Main(string[] args)\n {\n RunAsync().Wait();\n }\n static async Task RunAsync()\n {\n MailjetClient client = new MailjetClient(Environment.GetEnvironmentVariable(\"MJ_APIKEY_PUBLIC\"), Environment.GetEnvironmentVariable(\"MJ_APIKEY_PRIVATE\"))\n {\n Version = ApiVersion.V3,\n };\n MailjetRequest request = new MailjetRequest\n {\n Resource = NewsletterSchedule.Resource,\n ResourceId = ResourceId.Numeric(ID)\n }\n MailjetResponse response = await client.GetAsync(request);\n if (response.IsSuccessStatusCode)\n {\n Console.WriteLine(string.Format(\"Total: {0}, Count: {1}\\n\", response.GetTotal(), response.GetCount()));\n Console.WriteLine(response.GetData());\n }\n else\n {\n Console.WriteLine(string.Format(\"StatusCode: {0}\\n\", response.StatusCode));\n Console.WriteLine(string.Format(\"ErrorInfo: {0}\\n\", response.GetErrorInfo()));\n Console.WriteLine(response.GetData());\n Console.WriteLine(string.Format(\"ErrorMessage: {0}\\n\", response.GetErrorMessage()));\n }\n }\n }\n}"
post:
x-seo:
title: "Newsletter: Schedule"
description: "Newsletter: Schedule using the Mailjet Email API. Schedule the sending of a newsletter."
deprecated: true
tags:
- Deprecated Endpoints
summary: 'Newsletter: Schedule'
description: Schedule the sending of a newsletter.
operationId: post_v3_newsletter_id_schedule
parameters:
- name: newsletter_ID
in: path
schema:
$ref: '#/components/schemas/post_v3_newsletter_id_schedule_PathParams/properties/newsletter_ID'
required: true
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/NewNewsletterSchedule'
responses:
'201':
description: Default OK response for `/newsletter` action `/schedule`
content:
application/json:
schema:
type: object
properties:
Count:
description: Indicates the number of objects in the `Data` array.
type: integer
format: int64
examples:
- 1
Data:
description: A JSON array containing a list of objects returned by this endpoint.
type: array
items:
$ref: '#/components/schemas/OutputNewsletterSchedule'
Total:
description: Indicates the number of objects in the `Data` array.
type: integer
format: int64
examples:
- 1
'400':
$ref: '#/components/responses/400'
'401':
$ref: '#/components/responses/401'
'403':
$ref: '#/components/responses/403'
'404':
$ref: '#/components/responses/404'
'429':
$ref: '#/components/responses/429'
'500':
$ref: '#/components/responses/500'
security:
- basicAuth: []
x-codeSamples:
- lang: curl
label: cURL
source: "curl -s \\\n\t-X POST \\\n\t--user \"$MJ_APIKEY_PUBLIC:$MJ_APIKEY_PRIVATE\" \\\n\thttps://api.mailjet.com/v3/REST/newsletter/$newsletter_ID/schedule \\\n\t-H 'Content-Type: application/json' \\\n\t-d '{\n \"Date\":\"2018-01-01T00:00:00\"\n\t}'"
- lang: PHP
label: PHP
source: " 'v3']);\n$body = [\n 'Date' => \"2018-01-01T00:00:00\"\n];\n$response = $mj->post(Resources::$NewsletterSchedule, ['id' => $id, 'body' => $body]);\n$response->success() && var_dump($response->getData());\n?>"
- lang: Node.js
label: Node
source: "const mailjet = require ('node-mailjet')\n\t.connect(process.env.MJ_APIKEY_PUBLIC, process.env.MJ_APIKEY_PRIVATE)\nconst request = mailjet\n\t.post(\"newsletter\", {'version': 'v3'})\n\t.id($newsletter_ID)\n\t.action(\"schedule\")\n\t.request({\n \"Date\":\"2018-01-01T00:00:00\"\n })\nrequest\n\t.then((result) => {\n\t\tconsole.log(result.body)\n\t})\n\t.catch((err) => {\n\t\tconsole.log(err.statusCode)\n\t})"
- lang: Ruby
label: Ruby
source: "require 'mailjet'\nMailjet.configure do |config|\n config.api_key = ENV['MJ_APIKEY_PUBLIC']\n config.secret_key = ENV['MJ_APIKEY_PRIVATE']\n config.api_version = \"v3\"\nend\nvariable = Mailjet::Newsletter_schedule.create(id: $newsletter_ID,\n date: \"2018-01-01T00:00:00\"\n)\np variable.attributes['Data']"
- lang: Python
label: Python
source: "from mailjet_rest import Client\nimport os\napi_key = os.environ['MJ_APIKEY_PUBLIC']\napi_secret = os.environ['MJ_APIKEY_PRIVATE']\nmailjet = Client(auth=(api_key, api_secret), version='v3')\nid = '$newsletter_ID'\ndata = {\n 'Date': \"2018-01-01T00:00:00\"\n}\nresult = mailjet.newsletter_schedule.create(id=id, data=data)\nprint result.status_code\nprint result.json()"
- lang: Java
label: Java
source: "package com.my.project;\nimport com.mailjet.client.errors.MailjetException;\nimport com.mailjet.client.errors.MailjetSocketTimeoutException;\nimport com.mailjet.client.MailjetClient;\nimport com.mailjet.client.MailjetRequest;\nimport com.mailjet.client.MailjetResponse;\nimport com.mailjet.client.ClientOptions;\nimport com.mailjet.client.resource.NewsletterSchedule;\nimport org.json.JSONArray;\nimport org.json.JSONObject;\npublic class MyClass {\n public static void main(String[] args) throws MailjetException, MailjetSocketTimeoutException {\n MailjetClient client;\n MailjetRequest request;\n MailjetResponse response;\n client = new MailjetClient(System.getenv(\"MJ_APIKEY_PUBLIC\"), System.getenv(\"MJ_APIKEY_PRIVATE\"), new ClientOptions(\"v3\"));\n request = new MailjetRequest(NewsletterSchedule.resource, ID)\n .property(NewsletterSchedule.DATE, \"2018-01-01T00:00:00\")\n );\n response = client.post(request);\n System.out.println(response.getStatus());\n System.out.println(response.getData());\n }\n}"
- lang: Go
label: Go
source: "package main\nimport (\n\t\"fmt\"\n\t\"log\"\n\t\"os\"\n\tmailjet \"github.com/mailjet/mailjet-apiv3-go\"\n\t\"github.com/mailjet/mailjet-apiv3-go/resources\"\n)\nfunc main () {\n\tmailjetClient := NewMailjetClient(os.Getenv(\"MJ_APIKEY_PUBLIC\"), os.Getenv(\"MJ_APIKEY_PRIVATE\"))\n\tvar data []resources.NewsletterSchedule\n\tmr := &Request{\n\t Resource: \"newsletter\",\n\t ID: RESOURCE_ID,\n\t Action: \"schedule\",\n\t}\n\tfmr := &FullRequest{\n\t Info: mr,\n\t Payload: &resources.NewsletterSchedule { \n\t Date:\"2018-01-01T00:00:00\"\n }\n\t}\n\terr := mailjetClient.Post(fmr, &data)\n\tif err != nil {\n\t fmt.Println(err)\n\t}\n\tfmt.Printf(\"Data array: %+v\\n\", data)\n}"
- lang: C#
label: C#
source: "using Mailjet.Client;\nusing Mailjet.Client.Resources;\nusing System;\nusing Newtonsoft.Json.Linq;\nnamespace Mailjet.ConsoleApplication\n{\n class Program\n {\n static void Main(string[] args)\n {\n RunAsync().Wait();\n }\n static async Task RunAsync()\n {\n MailjetClient client = new MailjetClient(Environment.GetEnvironmentVariable(\"MJ_APIKEY_PUBLIC\"), Environment.GetEnvironmentVariable(\"MJ_APIKEY_PRIVATE\"))\n {\n Version = ApiVersion.V3,\n };\n MailjetRequest request = new MailjetRequest\n {\n Resource = NewsletterSchedule.Resource,\n ResourceId = ResourceId.Numeric(ID)\n }\n .Property(NewsletterSchedule.Date, \"2018-01-01T00:00:00\");\n MailjetResponse response = await client.PostAsync(request);\n if (response.IsSuccessStatusCode)\n {\n Console.WriteLine(string.Format(\"Total: {0}, Count: {1}\\n\", response.GetTotal(), response.GetCount()));\n Console.WriteLine(response.GetData());\n }\n else\n {\n Console.WriteLine(string.Format(\"StatusCode: {0}\\n\", response.StatusCode));\n Console.WriteLine(string.Format(\"ErrorInfo: {0}\\n\", response.GetErrorInfo()));\n Console.WriteLine(response.GetData());\n Console.WriteLine(string.Format(\"ErrorMessage: {0}\\n\", response.GetErrorMessage()));\n }\n }\n }\n}"
put:
x-seo:
title: "Update Newsletter: Schedule"
description: "Update Newsletter: Schedule using the Mailjet Email API. Update the schedule for sending a newsletter."
deprecated: true
tags:
- Deprecated Endpoints
summary: 'Update Newsletter: Schedule'
description: Update the schedule for sending a newsletter.
operationId: put_v3_newsletter_id_schedule
parameters:
- name: newsletter_ID
in: path
schema:
$ref: '#/components/schemas/put_v3_newsletter_id_schedule_PathParams/properties/newsletter_ID'
required: true
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/UpdateNewsletterSchedule'
responses:
'200':
description: Default OK response for `/newsletter` action `/schedule`
content:
application/json:
schema:
type: object
properties:
Count:
description: Indicates the number of objects in the `Data` array.
type: integer
format: int64
examples:
- 1
Data:
description: A JSON array containing a list of objects returned by this endpoint.
type: array
items:
$ref: '#/components/schemas/OutputNewsletterSchedule'
Total:
description: Indicates the number of objects in the `Data` array.
type: integer
format: int64
examples:
- 1
'400':
$ref: '#/components/responses/400'
'401':
$ref: '#/components/responses/401'
'403':
$ref: '#/components/responses/403'
'404':
$ref: '#/components/responses/404'
'429':
$ref: '#/components/responses/429'
'500':
$ref: '#/components/responses/500'
security:
- basicAuth: []
x-codeSamples:
- lang: curl
label: cURL
source: "curl -s \\\n\t-X PUT \\\n\t--user \"$MJ_APIKEY_PUBLIC:$MJ_APIKEY_PRIVATE\" \\\n\thttps://api.mailjet.com/v3/REST/newsletter/$newsletter_ID/schedule \\\n\t-H 'Content-Type: application/json' \\\n\t-d '{\n \"Date\":\"2018-01-01T00:00:00\"\n\t}'"
- lang: PHP
label: PHP
source: " 'v3']);\n$body = [\n 'Date' => \"2018-01-01T00:00:00\"\n];\n$response = $mj->put(Resources::$NewsletterSchedule, ['id' => $id, 'body' => $body]);\n$response->success() && var_dump($response->getData());\n?>"
- lang: Node.js
label: Node
source: "const mailjet = require ('node-mailjet')\n\t.connect(process.env.MJ_APIKEY_PUBLIC, process.env.MJ_APIKEY_PRIVATE)\nconst request = mailjet\n\t.put(\"newsletter\", {'version': 'v3'})\n\t.id($newsletter_ID)\n\t.action(\"schedule\")\n\t.request({\n \"Date\":\"2018-01-01T00:00:00\"\n })\nrequest\n\t.then((result) => {\n\t\tconsole.log(result.body)\n\t})\n\t.catch((err) => {\n\t\tconsole.log(err.statusCode)\n\t})"
- lang: Ruby
label: Ruby
source: "require 'mailjet'\nMailjet.configure do |config|\n config.api_key = ENV['MJ_APIKEY_PUBLIC']\n config.secret_key = ENV['MJ_APIKEY_PRIVATE']\n config.api_version = \"v3\"\nend\ntarget = Mailjet::Newsletter_schedule.find($newsletter_ID)\ntarget.update_attributes(\n date: \"2018-01-01T00:00:00\"\n)\np variable.attributes['Data']"
- lang: Python
label: Python
source: "from mailjet_rest import Client\nimport os\napi_key = os.environ['MJ_APIKEY_PUBLIC']\napi_secret = os.environ['MJ_APIKEY_PRIVATE']\nmailjet = Client(auth=(api_key, api_secret), version='v3')\nid = '$newsletter_ID'\ndata = {\n 'Date': \"2018-01-01T00:00:00\"\n}\nresult = mailjet.newsletter_schedule.update(id=id, data=data)\nprint result.status_code\nprint result.json()"
- lang: Java
label: Java
source: "package com.my.project;\nimport com.mailjet.client.errors.MailjetException;\nimport com.mailjet.client.errors.MailjetSocketTimeoutException;\nimport com.mailjet.client.MailjetClient;\nimport com.mailjet.client.MailjetRequest;\nimport com.mailjet.client.MailjetResponse;\nimport com.mailjet.client.ClientOptions;\nimport com.mailjet.client.resource.NewsletterSchedule;\nimport org.json.JSONArray;\nimport org.json.JSONObject;\npublic class MyClass {\n public static void main(String[] args) throws MailjetException, MailjetSocketTimeoutException {\n MailjetClient client;\n MailjetRequest request;\n MailjetResponse response;\n client = new MailjetClient(System.getenv(\"MJ_APIKEY_PUBLIC\"), System.getenv(\"MJ_APIKEY_PRIVATE\"), new ClientOptions(\"v3\"));\n request = new MailjetRequest(NewsletterSchedule.resource, ID)\n .property(NewsletterSchedule.DATE, \"2018-01-01T00:00:00\")\n );\n response = client.put(request);\n System.out.println(response.getStatus());\n System.out.println(response.getData());\n }\n}"
- lang: Go
label: Go
source: "package main\nimport (\n\t\"fmt\"\n\t\"log\"\n\t\"os\"\n\tmailjet \"github.com/mailjet/mailjet-apiv3-go\"\n\t\"github.com/mailjet/mailjet-apiv3-go/resources\"\n)\nfunc main () {\n\tmailjetClient := NewMailjetClient(os.Getenv(\"MJ_APIKEY_PUBLIC\"), os.Getenv(\"MJ_APIKEY_PRIVATE\"))\n\tmr := &Request{\n\t Resource: \"newsletter\",\n\t ID: RESOURCE_ID,\n\t Action: \"schedule\",\n\t}\n\tfmr := &FullRequest{\n\t Info: mr,\n\t Payload: &resources.NewsletterSchedule { \n\t Date:\"2018-01-01T00:00:00\"\n }\n\t}\n\terr := mailjetClient.Put(fmr)\n\tif err != nil {\n\t fmt.Println(err)\n\t}\n}"
- lang: C#
label: C#
source: "using Mailjet.Client;\nusing Mailjet.Client.Resources;\nusing System;\nusing Newtonsoft.Json.Linq;\nnamespace Mailjet.ConsoleApplication\n{\n class Program\n {\n static void Main(string[] args)\n {\n RunAsync().Wait();\n }\n static async Task RunAsync()\n {\n MailjetClient client = new MailjetClient(Environment.GetEnvironmentVariable(\"MJ_APIKEY_PUBLIC\"), Environment.GetEnvironmentVariable(\"MJ_APIKEY_PRIVATE\"))\n {\n Version = ApiVersion.V3,\n };\n MailjetRequest request = new MailjetRequest\n {\n Resource = NewsletterSchedule.Resource,\n ResourceId = ResourceId.Numeric(ID)\n }\n .Property(NewsletterSchedule.Date, \"2018-01-01T00:00:00\");\n MailjetResponse response = await client.PutAsync(request);\n if (response.IsSuccessStatusCode)\n {\n Console.WriteLine(string.Format(\"Total: {0}, Count: {1}\\n\", response.GetTotal(), response.GetCount()));\n Console.WriteLine(response.GetData());\n }\n else\n {\n Console.WriteLine(string.Format(\"StatusCode: {0}\\n\", response.StatusCode));\n Console.WriteLine(string.Format(\"ErrorInfo: {0}\\n\", response.GetErrorInfo()));\n Console.WriteLine(response.GetData());\n Console.WriteLine(string.Format(\"ErrorMessage: {0}\\n\", response.GetErrorMessage()));\n }\n }\n }\n}"
delete:
x-seo:
title: "Delete Newsletter: Schedule"
description: "Delete Newsletter: Schedule using the Mailjet Email API. Cancel the scheduled sending of a newsletter."
deprecated: true
tags:
- Deprecated Endpoints
summary: 'Delete Newsletter: Schedule'
description: Cancel the scheduled sending of a newsletter.
operationId: delete_v3_newsletter_id_schedule
parameters:
- name: newsletter_ID
in: path
schema:
$ref: '#/components/schemas/delete_v3_newsletter_id_schedule_PathParams/properties/newsletter_ID'
required: true
responses:
'204':
$ref: '#/components/responses/204'
'400':
$ref: '#/components/responses/400'
'401':
$ref: '#/components/responses/401'
'403':
$ref: '#/components/responses/403'
'404':
$ref: '#/components/responses/404'
'429':
$ref: '#/components/responses/429'
'500':
$ref: '#/components/responses/500'
security:
- basicAuth: []
x-codeSamples:
- lang: curl
label: cURL
source: "curl -s \\\n\t-X DELETE \\\n\t--user \"$MJ_APIKEY_PUBLIC:$MJ_APIKEY_PRIVATE\" \\\n\thttps://api.mailjet.com/v3/REST/newsletter/$newsletter_ID/schedule \\\n\t-H 'Content-Type: application/json' \\\n\t-d '{\n\t}'"
- lang: PHP
label: PHP
source: " 'v3']);\n$response = $mj->delete(Resources::$NewsletterSchedule, ['id' => $id]);\n$response->success() && var_dump($response->getData());\n?>"
- lang: Node.js
label: Node
source: "const mailjet = require ('node-mailjet')\n\t.connect(process.env.MJ_APIKEY_PUBLIC, process.env.MJ_APIKEY_PRIVATE)\nconst request = mailjet\n\t.delete(\"newsletter\", {'version': 'v3'})\n\t.id($newsletter_ID)\n\t.action(\"schedule\")\n\t.request()\nrequest\n\t.then((result) => {\n\t\tconsole.log(result.body)\n\t})\n\t.catch((err) => {\n\t\tconsole.log(err.statusCode)\n\t})"
- lang: Ruby
label: Ruby
source: "require 'mailjet'\nMailjet.configure do |config|\n config.api_key = ENV['MJ_APIKEY_PUBLIC']\n config.secret_key = ENV['MJ_APIKEY_PRIVATE']\n config.api_version = \"v3\"\nend\ntarget = Mailjet::Newsletter_schedule.find($newsletter_ID)\ntarget.delete(\n)\np variable.attributes['Data']"
- lang: Python
label: Python
source: "from mailjet_rest import Client\nimport os\napi_key = os.environ['MJ_APIKEY_PUBLIC']\napi_secret = os.environ['MJ_APIKEY_PRIVATE']\nmailjet = Client(auth=(api_key, api_secret), version='v3')\nid = '$newsletter_ID'\nresult = mailjet.newsletter_schedule.delete(id=id)\nprint result.status_code\nprint result.json()"
- lang: Java
label: Java
source: "package com.my.project;\nimport com.mailjet.client.errors.MailjetException;\nimport com.mailjet.client.errors.MailjetSocketTimeoutException;\nimport com.mailjet.client.MailjetClient;\nimport com.mailjet.client.MailjetRequest;\nimport com.mailjet.client.MailjetResponse;\nimport com.mailjet.client.ClientOptions;\nimport com.mailjet.client.resource.NewsletterSchedule;\nimport org.json.JSONArray;\nimport org.json.JSONObject;\npublic class MyClass {\n public static void main(String[] args) throws MailjetException, MailjetSocketTimeoutException {\n MailjetClient client;\n MailjetRequest request;\n MailjetResponse response;\n client = new MailjetClient(System.getenv(\"MJ_APIKEY_PUBLIC\"), System.getenv(\"MJ_APIKEY_PRIVATE\"), new ClientOptions(\"v3\"));\n request = new MailjetRequest(NewsletterSchedule.resource, ID);\n response = client.delete(request);\n System.out.println(response.getStatus());\n System.out.println(response.getData());\n }\n}"
- lang: Go
label: Go
source: "package main\nimport (\n\t\"fmt\"\n\t\"log\"\n\t\"os\"\n\tmailjet \"github.com/mailjet/mailjet-apiv3-go\"\n\t\"github.com/mailjet/mailjet-apiv3-go/resources\"\n)\nfunc main () {\n\tmailjetClient := NewMailjetClient(os.Getenv(\"MJ_APIKEY_PUBLIC\"), os.Getenv(\"MJ_APIKEY_PRIVATE\"))\n\tmr := &Request{\n\t Resource: \"newsletter\",\n\t ID: RESOURCE_ID,\n\t Action: \"schedule\",\n\t}\n\terr := mailjetClient.Delete(mr)\n\tif err != nil {\n\t fmt.Println(err)\n\t}\n}"
- lang: C#
label: C#
source: "using Mailjet.Client;\nusing Mailjet.Client.Resources;\nusing System;\nusing Newtonsoft.Json.Linq;\nnamespace Mailjet.ConsoleApplication\n{\n class Program\n {\n static void Main(string[] args)\n {\n RunAsync().Wait();\n }\n static async Task RunAsync()\n {\n MailjetClient client = new MailjetClient(Environment.GetEnvironmentVariable(\"MJ_APIKEY_PUBLIC\"), Environment.GetEnvironmentVariable(\"MJ_APIKEY_PRIVATE\"))\n {\n Version = ApiVersion.V3,\n };\n MailjetRequest request = new MailjetRequest\n {\n Resource = NewsletterSchedule.Resource,\n ResourceId = ResourceId.Numeric(ID)\n }\n MailjetResponse response = await client.DeleteAsync(request);\n if (response.IsSuccessStatusCode)\n {\n Console.WriteLine(string.Format(\"Total: {0}, Count: {1}\\n\", response.GetTotal(), response.GetCount()));\n Console.WriteLine(response.GetData());\n }\n else\n {\n Console.WriteLine(string.Format(\"StatusCode: {0}\\n\", response.StatusCode));\n Console.WriteLine(string.Format(\"ErrorInfo: {0}\\n\", response.GetErrorInfo()));\n Console.WriteLine(response.GetData());\n Console.WriteLine(string.Format(\"ErrorMessage: {0}\\n\", response.GetErrorMessage()));\n }\n }\n }\n}"
/v3/REST/newsletter/{newsletter_ID}/send:
post:
x-seo:
title: "Newsletter: Send"
description: "Newsletter: Send using the Mailjet Email API. Send a newsletter immediately."
deprecated: true
tags:
- Deprecated Endpoints
summary: 'Newsletter: Send'
description: Send a newsletter immediately.
operationId: post_v3_newsletter_id_send
parameters:
- name: newsletter_ID
in: path
schema:
$ref: '#/components/schemas/post_v3_newsletter_id_send_PathParams/properties/newsletter_ID'
required: true
responses:
'201':
description: Default OK response for `/newsletter` action `/send`
content:
application/json:
schema:
type: object
properties:
Count:
description: Indicates the number of objects in the `Data` array.
type: integer
format: int64
examples:
- 1
Data:
description: A JSON array containing a list of objects returned by this endpoint.
type: array
items:
$ref: '#/components/schemas/ActionStatusNewsletterSend'
Total:
description: Indicates the number of objects in the `Data` array.
type: integer
format: int64
examples:
- 1
'400':
$ref: '#/components/responses/400'
'401':
$ref: '#/components/responses/401'
'403':
$ref: '#/components/responses/403'
'404':
$ref: '#/components/responses/404'
'429':
$ref: '#/components/responses/429'
'500':
$ref: '#/components/responses/500'
security:
- basicAuth: []
x-codeSamples:
- lang: curl
label: cURL
source: "curl -s \\\n\t-X POST \\\n\t--user \"$MJ_APIKEY_PUBLIC:$MJ_APIKEY_PRIVATE\" \\\n\thttps://api.mailjet.com/v3/REST/newsletter/$newsletter_ID/send \\\n\t-H 'Content-Type: application/json' \\\n\t-d '{\n\t}'"
- lang: PHP
label: PHP
source: " 'v3']);\n$response = $mj->post(Resources::$NewsletterSend, ['id' => $id]);\n$response->success() && var_dump($response->getData());\n?>"
- lang: Node.js
label: Node
source: "const mailjet = require ('node-mailjet')\n\t.connect(process.env.MJ_APIKEY_PUBLIC, process.env.MJ_APIKEY_PRIVATE)\nconst request = mailjet\n\t.post(\"newsletter\", {'version': 'v3'})\n\t.id($newsletter_ID)\n\t.action(\"send\")\n\t.request()\nrequest\n\t.then((result) => {\n\t\tconsole.log(result.body)\n\t})\n\t.catch((err) => {\n\t\tconsole.log(err.statusCode)\n\t})"
- lang: Ruby
label: Ruby
source: "require 'mailjet'\nMailjet.configure do |config|\n config.api_key = ENV['MJ_APIKEY_PUBLIC']\n config.secret_key = ENV['MJ_APIKEY_PRIVATE']\n config.api_version = \"v3\"\nend\nvariable = Mailjet::Newsletter_send.create(id: $newsletter_ID,\n)\np variable.attributes['Data']"
- lang: Python
label: Python
source: "from mailjet_rest import Client\nimport os\napi_key = os.environ['MJ_APIKEY_PUBLIC']\napi_secret = os.environ['MJ_APIKEY_PRIVATE']\nmailjet = Client(auth=(api_key, api_secret), version='v3')\nid = '$newsletter_ID'\nresult = mailjet.newsletter_send.create(id=id)\nprint result.status_code\nprint result.json()"
- lang: Java
label: Java
source: "package com.my.project;\nimport com.mailjet.client.errors.MailjetException;\nimport com.mailjet.client.errors.MailjetSocketTimeoutException;\nimport com.mailjet.client.MailjetClient;\nimport com.mailjet.client.MailjetRequest;\nimport com.mailjet.client.MailjetResponse;\nimport com.mailjet.client.ClientOptions;\nimport com.mailjet.client.resource.NewsletterSend;\nimport org.json.JSONArray;\nimport org.json.JSONObject;\npublic class MyClass {\n public static void main(String[] args) throws MailjetException, MailjetSocketTimeoutException {\n MailjetClient client;\n MailjetRequest request;\n MailjetResponse response;\n client = new MailjetClient(System.getenv(\"MJ_APIKEY_PUBLIC\"), System.getenv(\"MJ_APIKEY_PRIVATE\"), new ClientOptions(\"v3\"));\n request = new MailjetRequest(NewsletterSend.resource, ID);\n response = client.post(request);\n System.out.println(response.getStatus());\n System.out.println(response.getData());\n }\n}"
- lang: Go
label: Go
source: "package main\nimport (\n\t\"fmt\"\n\t\"log\"\n\t\"os\"\n\tmailjet \"github.com/mailjet/mailjet-apiv3-go\"\n\t\"github.com/mailjet/mailjet-apiv3-go/resources\"\n)\nfunc main () {\n\tmailjetClient := NewMailjetClient(os.Getenv(\"MJ_APIKEY_PUBLIC\"), os.Getenv(\"MJ_APIKEY_PRIVATE\"))\n\tvar data []resources.NewsletterSend\n\tmr := &Request{\n\t Resource: \"newsletter\",\n\t ID: RESOURCE_ID,\n\t Action: \"send\",\n\t}\n\tfmr := &FullRequest{\n\t Info: mr,\n\t Payload: &resources.NewsletterSend { }\n\t}\n\terr := mailjetClient.Post(fmr, &data)\n\tif err != nil {\n\t fmt.Println(err)\n\t}\n\tfmt.Printf(\"Data array: %+v\\n\", data)\n}"
- lang: C#
label: C#
source: "using Mailjet.Client;\nusing Mailjet.Client.Resources;\nusing System;\nusing Newtonsoft.Json.Linq;\nnamespace Mailjet.ConsoleApplication\n{\n class Program\n {\n static void Main(string[] args)\n {\n RunAsync().Wait();\n }\n static async Task RunAsync()\n {\n MailjetClient client = new MailjetClient(Environment.GetEnvironmentVariable(\"MJ_APIKEY_PUBLIC\"), Environment.GetEnvironmentVariable(\"MJ_APIKEY_PRIVATE\"))\n {\n Version = ApiVersion.V3,\n };\n MailjetRequest request = new MailjetRequest\n {\n Resource = NewsletterSend.Resource,\n ResourceId = ResourceId.Numeric(ID)\n }\n MailjetResponse response = await client.PostAsync(request);\n if (response.IsSuccessStatusCode)\n {\n Console.WriteLine(string.Format(\"Total: {0}, Count: {1}\\n\", response.GetTotal(), response.GetCount()));\n Console.WriteLine(response.GetData());\n }\n else\n {\n Console.WriteLine(string.Format(\"StatusCode: {0}\\n\", response.StatusCode));\n Console.WriteLine(string.Format(\"ErrorInfo: {0}\\n\", response.GetErrorInfo()));\n Console.WriteLine(response.GetData());\n Console.WriteLine(string.Format(\"ErrorMessage: {0}\\n\", response.GetErrorMessage()));\n }\n }\n }\n}"
/v3/REST/newsletter/{newsletter_ID}/status:
get:
x-seo:
title: "Get Newsletter: Status"
description: "Get Newsletter: Status using the Mailjet Email API. View the sending status of a newsletter."
deprecated: true
tags:
- Deprecated Endpoints
summary: 'Get Newsletter: Status'
description: View the sending status of a newsletter. To obtain a valid `newsletter_ID`, first call `GET /v3/REST/newsletter` to list your newsletters.
operationId: get_v3_newsletter_id_status
parameters:
- name: newsletter_ID
in: path
schema:
$ref: '#/components/schemas/get_v3_newsletter_id_status_PathParams/properties/newsletter_ID'
required: true
example: 5000
responses:
'200':
description: Default OK response for `/newsletter` action `/status`
content:
application/json:
schema:
type: object
properties:
Count:
description: Indicates the number of objects in the `Data` array.
type: integer
format: int64
examples:
- 1
Data:
description: A JSON array containing a list of objects returned by this endpoint.
type: array
items:
$ref: '#/components/schemas/ActionStatusNewsletterStatus'
Total:
description: Indicates the number of objects in the `Data` array.
type: integer
format: int64
examples:
- 1
'400':
$ref: '#/components/responses/400'
'401':
$ref: '#/components/responses/401'
'403':
$ref: '#/components/responses/403'
'404':
$ref: '#/components/responses/404'
'429':
$ref: '#/components/responses/429'
'500':
$ref: '#/components/responses/500'
security:
- basicAuth: []
x-codeSamples:
- lang: curl
label: cURL
source: "curl -s \\\n\t-X GET \\\n\t--user \"$MJ_APIKEY_PUBLIC:$MJ_APIKEY_PRIVATE\" \\\n\thttps://api.mailjet.com/v3/REST/newsletter/$newsletter_ID/status \\"
- lang: PHP
label: PHP
source: " 'v3']);\n$response = $mj->get(Resources::$NewsletterStatus, ['id' => $id]);\n$response->success() && var_dump($response->getData());\n?>"
- lang: Node.js
label: Node
source: "const mailjet = require ('node-mailjet')\n\t.connect(process.env.MJ_APIKEY_PUBLIC, process.env.MJ_APIKEY_PRIVATE)\nconst request = mailjet\n\t.get(\"newsletter\", {'version': 'v3'})\n\t.id($newsletter_ID)\n\t.action(\"status\")\n\t.request()\nrequest\n\t.then((result) => {\n\t\tconsole.log(result.body)\n\t})\n\t.catch((err) => {\n\t\tconsole.log(err.statusCode)\n\t})"
- lang: Ruby
label: Ruby
source: "require 'mailjet'\nMailjet.configure do |config|\n config.api_key = ENV['MJ_APIKEY_PUBLIC']\n config.secret_key = ENV['MJ_APIKEY_PRIVATE']\n config.api_version = \"v3\"\nend\nvariable = Mailjet::Newsletter_status.find($newsletter_ID\n)\np variable.attributes['Data']"
- lang: Python
label: Python
source: "from mailjet_rest import Client\nimport os\napi_key = os.environ['MJ_APIKEY_PUBLIC']\napi_secret = os.environ['MJ_APIKEY_PRIVATE']\nmailjet = Client(auth=(api_key, api_secret), version='v3')\nid = '$newsletter_ID'\nresult = mailjet.newsletter_status.get(id=id)\nprint result.status_code\nprint result.json()"
- lang: Java
label: Java
source: "package com.my.project;\nimport com.mailjet.client.errors.MailjetException;\nimport com.mailjet.client.errors.MailjetSocketTimeoutException;\nimport com.mailjet.client.MailjetClient;\nimport com.mailjet.client.MailjetRequest;\nimport com.mailjet.client.MailjetResponse;\nimport com.mailjet.client.ClientOptions;\nimport com.mailjet.client.resource.NewsletterStatus;\nimport org.json.JSONArray;\nimport org.json.JSONObject;\npublic class MyClass {\n public static void main(String[] args) throws MailjetException, MailjetSocketTimeoutException {\n MailjetClient client;\n MailjetRequest request;\n MailjetResponse response;\n client = new MailjetClient(System.getenv(\"MJ_APIKEY_PUBLIC\"), System.getenv(\"MJ_APIKEY_PRIVATE\"), new ClientOptions(\"v3\"));\n request = new MailjetRequest(NewsletterStatus.resource, ID);\n response = client.get(request);\n System.out.println(response.getStatus());\n System.out.println(response.getData());\n }\n}"
- lang: Go
label: Go
source: "package main\nimport (\n\t\"fmt\"\n\t\"log\"\n\t\"os\"\n\tmailjet \"github.com/mailjet/mailjet-apiv3-go\"\n\t\"github.com/mailjet/mailjet-apiv3-go/resources\"\n)\nfunc main () {\n\tmailjetClient := NewMailjetClient(os.Getenv(\"MJ_APIKEY_PUBLIC\"), os.Getenv(\"MJ_APIKEY_PRIVATE\"))\n\tvar data []resources.NewsletterStatus\n\tmr := &Request{\n\t Resource: \"newsletter\",\n\t ID: RESOURCE_ID,\n\t Action: \"status\",\n\t}\n\terr := mailjetClient.Get(mr, &data)\n\tif err != nil {\n\t fmt.Println(err)\n\t}\n\tfmt.Printf(\"Data array: %+v\\n\", data)\n}"
- lang: C#
label: C#
source: "using Mailjet.Client;\nusing Mailjet.Client.Resources;\nusing System;\nusing Newtonsoft.Json.Linq;\nnamespace Mailjet.ConsoleApplication\n{\n class Program\n {\n static void Main(string[] args)\n {\n RunAsync().Wait();\n }\n static async Task RunAsync()\n {\n MailjetClient client = new MailjetClient(Environment.GetEnvironmentVariable(\"MJ_APIKEY_PUBLIC\"), Environment.GetEnvironmentVariable(\"MJ_APIKEY_PRIVATE\"))\n {\n Version = ApiVersion.V3,\n };\n MailjetRequest request = new MailjetRequest\n {\n Resource = NewsletterStatus.Resource,\n ResourceId = ResourceId.Numeric(ID)\n }\n MailjetResponse response = await client.GetAsync(request);\n if (response.IsSuccessStatusCode)\n {\n Console.WriteLine(string.Format(\"Total: {0}, Count: {1}\\n\", response.GetTotal(), response.GetCount()));\n Console.WriteLine(response.GetData());\n }\n else\n {\n Console.WriteLine(string.Format(\"StatusCode: {0}\\n\", response.StatusCode));\n Console.WriteLine(string.Format(\"ErrorInfo: {0}\\n\", response.GetErrorInfo()));\n Console.WriteLine(response.GetData());\n Console.WriteLine(string.Format(\"ErrorMessage: {0}\\n\", response.GetErrorMessage()));\n }\n }\n }\n}"
"/v3/REST/apikeytotals":
get:
x-seo:
title: "API Key Totals"
description: "Retrieve overall aggregated delivery and engagement statistics for the API Key used for authentication. Note: This is a legacy endpoint. We advise using\u2026"
deprecated: true
tags:
- Deprecated Endpoints
summary: API Key Totals
description: "Retrieve overall aggregated delivery and engagement statistics for the API Key used for authentication.\n\n> Note: This is a legacy endpoint. We advise using `/statcounters` to retrieve aggregated stats grouped by API Key.\n"
operationId: get_v3_apikeytotals
responses:
'200':
description: Default OK response for `/apikeytotals`
content:
application/json:
schema:
type: object
properties:
Count:
description: Indicates the number of objects in the `Data` array.
type: integer
format: int64
examples:
- 1
Data:
description: A JSON array containing a list of objects returned by this endpoint.
type: array
items:
$ref: '#/components/schemas/OutputApikeytotals'
Total:
description: Indicates the number of objects in the `Data` array.
type: integer
format: int64
examples:
- 1
'400':
$ref: '#/components/responses/400'
'401':
$ref: '#/components/responses/401'
'403':
$ref: '#/components/responses/403'
'404':
$ref: '#/components/responses/404'
'429':
$ref: '#/components/responses/429'
'500':
$ref: '#/components/responses/500'
security:
- basicAuth: []
x-codeSamples:
- lang: curl
label: cURL
source: "curl -s \\\n\t-X GET \\\n\t--user \"$MJ_APIKEY_PUBLIC:$MJ_APIKEY_PRIVATE\" \\\n\thttps://api.mailjet.com/v3/REST/apikeytotals \\"
- lang: PHP
label: PHP
source: " 'v3']);\n$response = $mj->get(Resources::$Apikeytotals);\n$response->success() && var_dump($response->getData());\n?>"
- lang: Node.js
label: Node
source: "const mailjet = require ('node-mailjet')\n\t.connect(process.env.MJ_APIKEY_PUBLIC, process.env.MJ_APIKEY_PRIVATE)\nconst request = mailjet\n\t.get(\"apikeytotals\", {'version': 'v3'})\n\t.request()\nrequest\n\t.then((result) => {\n\t\tconsole.log(result.body)\n\t})\n\t.catch((err) => {\n\t\tconsole.log(err.statusCode)\n\t})"
- lang: Ruby
label: Ruby
source: "require 'mailjet'\nMailjet.configure do |config|\n config.api_key = ENV['MJ_APIKEY_PUBLIC']\n config.secret_key = ENV['MJ_APIKEY_PRIVATE']\n config.api_version = \"v3\"\nend\nvariable = Mailjet::Apikeytotals.all(\n)\np variable.attributes['Data']"
- lang: Python
label: Python
source: "from mailjet_rest import Client\nimport os\napi_key = os.environ['MJ_APIKEY_PUBLIC']\napi_secret = os.environ['MJ_APIKEY_PRIVATE']\nmailjet = Client(auth=(api_key, api_secret), version='v3')\nresult = mailjet.apikeytotals.get()\nprint result.status_code\nprint result.json()"
- lang: Java
label: Java
source: "package com.my.project;\nimport com.mailjet.client.errors.MailjetException;\nimport com.mailjet.client.errors.MailjetSocketTimeoutException;\nimport com.mailjet.client.MailjetClient;\nimport com.mailjet.client.MailjetRequest;\nimport com.mailjet.client.MailjetResponse;\nimport com.mailjet.client.ClientOptions;\nimport com.mailjet.client.resource.Apikeytotals;\nimport org.json.JSONArray;\nimport org.json.JSONObject;\npublic class MyClass {\n public static void main(String[] args) throws MailjetException, MailjetSocketTimeoutException {\n MailjetClient client;\n MailjetRequest request;\n MailjetResponse response;\n client = new MailjetClient(System.getenv(\"MJ_APIKEY_PUBLIC\"), System.getenv(\"MJ_APIKEY_PRIVATE\"), new ClientOptions(\"v3\"));\n request = new MailjetRequest(Apikeytotals.resource);\n response = client.get(request);\n System.out.println(response.getStatus());\n System.out.println(response.getData());\n }\n}"
- lang: Go
label: Go
source: "package main\nimport (\n\t\"fmt\"\n\t\"log\"\n\t\"os\"\n\tmailjet \"github.com/mailjet/mailjet-apiv3-go\"\n\t\"github.com/mailjet/mailjet-apiv3-go/resources\"\n)\nfunc main () {\n\tmailjetClient := NewMailjetClient(os.Getenv(\"MJ_APIKEY_PUBLIC\"), os.Getenv(\"MJ_APIKEY_PRIVATE\"))\n\tvar data []resources.Apikeytotals\n\t_, _, err := mailjetClient.List(\"apikeytotals\", &data)\n\tif err != nil {\n\t fmt.Println(err)\n\t}\n\tfmt.Printf(\"Data array: %+v\\n\", data)\n}"
- lang: C#
label: C#
source: "using Mailjet.Client;\nusing Mailjet.Client.Resources;\nusing System;\nusing Newtonsoft.Json.Linq;\nnamespace Mailjet.ConsoleApplication\n{\n class Program\n {\n static void Main(string[] args)\n {\n RunAsync().Wait();\n }\n static async Task RunAsync()\n {\n MailjetClient client = new MailjetClient(Environment.GetEnvironmentVariable(\"MJ_APIKEY_PUBLIC\"), Environment.GetEnvironmentVariable(\"MJ_APIKEY_PRIVATE\"))\n {\n Version = ApiVersion.V3,\n };\n MailjetRequest request = new MailjetRequest\n {\n Resource = Apikeytotals.Resource,\n }\n MailjetResponse response = await client.GetAsync(request);\n if (response.IsSuccessStatusCode)\n {\n Console.WriteLine(string.Format(\"Total: {0}, Count: {1}\\n\", response.GetTotal(), response.GetCount()));\n Console.WriteLine(response.GetData());\n }\n else\n {\n Console.WriteLine(string.Format(\"StatusCode: {0}\\n\", response.StatusCode));\n Console.WriteLine(string.Format(\"ErrorInfo: {0}\\n\", response.GetErrorInfo()));\n Console.WriteLine(response.GetData());\n Console.WriteLine(string.Format(\"ErrorMessage: {0}\\n\", response.GetErrorMessage()));\n }\n }\n }\n}"
"/v3/REST/campaigngraphstatistics":
get:
x-seo:
title: "Campaign Graph Statistics"
description: "Retrieve information on Open, Click, Spam and / or Unsubscribe events for selected campaigns, evolving overtime with intervals of 15 or 30 minutes. At\u2026"
deprecated: true
tags:
- Deprecated Endpoints
summary: Campaign Graph Statistics
description: "Retrieve information on Open, Click, Spam and / or Unsubscribe events for selected campaigns, evolving overtime with intervals of 15 or 30 minutes. At least one of the event query parameters (`Click`, `Open`, `Spam`, `Unsub`) needs to be set to `true`.\n\n> Note: This is a legacy endpoint. We advise using `/statcounters` to retrieve event evolution stats.\n"
operationId: get_v3_campaigngraphstatistics
parameters:
- name: Click
in: query
schema:
$ref: '#/components/schemas/get_v3_campaigngraphstatistics_QueryParams/properties/Click'
- name: IDS
in: query
schema:
$ref: '#/components/schemas/get_v3_campaigngraphstatistics_QueryParams/properties/IDS'
required: true
example: 1,2,3
- name: Open
example: true
in: query
schema:
$ref: '#/components/schemas/get_v3_campaigngraphstatistics_QueryParams/properties/Open'
- name: Range
in: query
schema:
$ref: '#/components/schemas/get_v3_campaigngraphstatistics_QueryParams/properties/Range'
- name: Spam
in: query
schema:
$ref: '#/components/schemas/get_v3_campaigngraphstatistics_QueryParams/properties/Spam'
- name: Unsub
in: query
schema:
$ref: '#/components/schemas/get_v3_campaigngraphstatistics_QueryParams/properties/Unsub'
responses:
'200':
description: Default OK response for `/campaigngraphstatistics`
content:
application/json:
schema:
type: object
properties:
Count:
description: Indicates the number of objects in the `Data` array.
type: integer
format: int64
examples:
- 1
Data:
description: A JSON array containing a list of objects returned by this endpoint.
type: array
items:
$ref: '#/components/schemas/OutputCampaigngraphstatistics'
Total:
type: integer
format: int64
examples:
- 1
'400':
$ref: '#/components/responses/400'
'401':
$ref: '#/components/responses/401'
'403':
$ref: '#/components/responses/403'
'404':
$ref: '#/components/responses/404'
'429':
$ref: '#/components/responses/429'
'500':
$ref: '#/components/responses/500'
security:
- basicAuth: []
x-codeSamples:
- lang: curl
label: cURL
source: "curl -s \\\n\t-X GET \\\n\t--user \"$MJ_APIKEY_PUBLIC:$MJ_APIKEY_PRIVATE\" \\\n\thttps://api.mailjet.com/v3/REST/campaigngraphstatistics \\"
- lang: PHP
label: PHP
source: " 'v3']);\n$response = $mj->get(Resources::$Campaigngraphstatistics);\n$response->success() && var_dump($response->getData());\n?>"
- lang: Node.js
label: Node
source: "const mailjet = require ('node-mailjet')\n\t.connect(process.env.MJ_APIKEY_PUBLIC, process.env.MJ_APIKEY_PRIVATE)\nconst request = mailjet\n\t.get(\"campaigngraphstatistics\", {'version': 'v3'})\n\t.request()\nrequest\n\t.then((result) => {\n\t\tconsole.log(result.body)\n\t})\n\t.catch((err) => {\n\t\tconsole.log(err.statusCode)\n\t})"
- lang: Ruby
label: Ruby
source: "require 'mailjet'\nMailjet.configure do |config|\n config.api_key = ENV['MJ_APIKEY_PUBLIC']\n config.secret_key = ENV['MJ_APIKEY_PRIVATE']\n config.api_version = \"v3\"\nend\nvariable = Mailjet::Campaigngraphstatistics.all(\n)\np variable.attributes['Data']"
- lang: Python
label: Python
source: "from mailjet_rest import Client\nimport os\napi_key = os.environ['MJ_APIKEY_PUBLIC']\napi_secret = os.environ['MJ_APIKEY_PRIVATE']\nmailjet = Client(auth=(api_key, api_secret), version='v3')\nresult = mailjet.campaigngraphstatistics.get()\nprint result.status_code\nprint result.json()"
- lang: Java
label: Java
source: "package com.my.project;\nimport com.mailjet.client.errors.MailjetException;\nimport com.mailjet.client.errors.MailjetSocketTimeoutException;\nimport com.mailjet.client.MailjetClient;\nimport com.mailjet.client.MailjetRequest;\nimport com.mailjet.client.MailjetResponse;\nimport com.mailjet.client.ClientOptions;\nimport com.mailjet.client.resource.Campaigngraphstatistics;\nimport org.json.JSONArray;\nimport org.json.JSONObject;\npublic class MyClass {\n public static void main(String[] args) throws MailjetException, MailjetSocketTimeoutException {\n MailjetClient client;\n MailjetRequest request;\n MailjetResponse response;\n client = new MailjetClient(System.getenv(\"MJ_APIKEY_PUBLIC\"), System.getenv(\"MJ_APIKEY_PRIVATE\"), new ClientOptions(\"v3\"));\n request = new MailjetRequest(Campaigngraphstatistics.resource);\n response = client.get(request);\n System.out.println(response.getStatus());\n System.out.println(response.getData());\n }\n}"
- lang: Go
label: Go
source: "package main\nimport (\n\t\"fmt\"\n\t\"log\"\n\t\"os\"\n\tmailjet \"github.com/mailjet/mailjet-apiv3-go\"\n\t\"github.com/mailjet/mailjet-apiv3-go/resources\"\n)\nfunc main () {\n\tmailjetClient := NewMailjetClient(os.Getenv(\"MJ_APIKEY_PUBLIC\"), os.Getenv(\"MJ_APIKEY_PRIVATE\"))\n\tvar data []resources.Campaigngraphstatistics\n\t_, _, err := mailjetClient.List(\"campaigngraphstatistics\", &data)\n\tif err != nil {\n\t fmt.Println(err)\n\t}\n\tfmt.Printf(\"Data array: %+v\\n\", data)\n}"
- lang: C#
label: C#
source: "using Mailjet.Client;\nusing Mailjet.Client.Resources;\nusing System;\nusing Newtonsoft.Json.Linq;\nnamespace Mailjet.ConsoleApplication\n{\n class Program\n {\n static void Main(string[] args)\n {\n RunAsync().Wait();\n }\n static async Task RunAsync()\n {\n MailjetClient client = new MailjetClient(Environment.GetEnvironmentVariable(\"MJ_APIKEY_PUBLIC\"), Environment.GetEnvironmentVariable(\"MJ_APIKEY_PRIVATE\"))\n {\n Version = ApiVersion.V3,\n };\n MailjetRequest request = new MailjetRequest\n {\n Resource = Campaigngraphstatistics.Resource,\n }\n MailjetResponse response = await client.GetAsync(request);\n if (response.IsSuccessStatusCode)\n {\n Console.WriteLine(string.Format(\"Total: {0}, Count: {1}\\n\", response.GetTotal(), response.GetCount()));\n Console.WriteLine(response.GetData());\n }\n else\n {\n Console.WriteLine(string.Format(\"StatusCode: {0}\\n\", response.StatusCode));\n Console.WriteLine(string.Format(\"ErrorInfo: {0}\\n\", response.GetErrorInfo()));\n Console.WriteLine(response.GetData());\n Console.WriteLine(string.Format(\"ErrorMessage: {0}\\n\", response.GetErrorMessage()));\n }\n }\n }\n}"
/v3/REST/campaigngraphstatistics/{campaign_ID}:
get:
x-seo:
title: "Campaign Graph Statistics by ID"
description: "Retrieve information on Open, Click, Spam and / or Unsubscribe events for a specific campaign, evolving overtime with intervals of 15 or 30 minutes. At\u2026"
deprecated: true
tags:
- Deprecated Endpoints
summary: Campaign Graph Statistics by ID
description: "Retrieve information on Open, Click, Spam and / or Unsubscribe events for a specific campaign, evolving overtime with intervals of 15 or 30 minutes. At least one of the event query parameters (`Click`, `Open`, `Spam`, `Unsub`) needs to be set to `true`.\n\n> Note: This is a legacy endpoint. We advise using `/statcounters` to retrieve event evolution stats.\n To obtain a valid `campaign_ID`, first call `GET /v3/REST/campaign` to list your campaigns."
operationId: get_v3_campaigngraphstatistics_id
parameters:
- name: campaign_ID
in: path
schema:
$ref: '#/components/schemas/get_v3_campaigngraphstatistics_id_PathParams/properties/campaign_ID'
required: true
example: 6000
- name: Click
in: query
schema:
$ref: '#/components/schemas/get_v3_campaigngraphstatistics_id_QueryParams/properties/Click'
- name: Open
example: true
in: query
schema:
$ref: '#/components/schemas/get_v3_campaigngraphstatistics_id_QueryParams/properties/Open'
- name: Range
in: query
schema:
$ref: '#/components/schemas/get_v3_campaigngraphstatistics_id_QueryParams/properties/Range'
- name: Spam
in: query
schema:
$ref: '#/components/schemas/get_v3_campaigngraphstatistics_id_QueryParams/properties/Spam'
- name: Unsub
in: query
schema:
$ref: '#/components/schemas/get_v3_campaigngraphstatistics_id_QueryParams/properties/Unsub'
responses:
'200':
description: Default OK response for `/campaigngraphstatistics`
content:
application/json:
schema:
type: object
properties:
Count:
description: Indicates the number of objects in the `Data` array.
type: integer
format: int64
examples:
- 1
Data:
description: A JSON array containing a list of objects returned by this endpoint.
type: array
items:
$ref: '#/components/schemas/OutputCampaigngraphstatistics'
Total:
type: integer
format: int64
examples:
- 1
'400':
$ref: '#/components/responses/400'
'401':
$ref: '#/components/responses/401'
'403':
$ref: '#/components/responses/403'
'404':
$ref: '#/components/responses/404'
'429':
$ref: '#/components/responses/429'
'500':
$ref: '#/components/responses/500'
security:
- basicAuth: []
x-codeSamples:
- lang: curl
label: cURL
source: "curl -s \\\n\t-X GET \\\n\t--user \"$MJ_APIKEY_PUBLIC:$MJ_APIKEY_PRIVATE\" \\\n\thttps://api.mailjet.com/v3/REST/campaigngraphstatistics/$campaign_ID \\"
- lang: PHP
label: PHP
source: " 'v3']);\n$response = $mj->get(Resources::$Campaigngraphstatistics, ['id' => $id]);\n$response->success() && var_dump($response->getData());\n?>"
- lang: Node.js
label: Node
source: "const mailjet = require ('node-mailjet')\n\t.connect(process.env.MJ_APIKEY_PUBLIC, process.env.MJ_APIKEY_PRIVATE)\nconst request = mailjet\n\t.get(\"campaigngraphstatistics\", {'version': 'v3'})\n\t.id($campaign_ID)\n\t.request()\nrequest\n\t.then((result) => {\n\t\tconsole.log(result.body)\n\t})\n\t.catch((err) => {\n\t\tconsole.log(err.statusCode)\n\t})"
- lang: Ruby
label: Ruby
source: "require 'mailjet'\nMailjet.configure do |config|\n config.api_key = ENV['MJ_APIKEY_PUBLIC']\n config.secret_key = ENV['MJ_APIKEY_PRIVATE']\n config.api_version = \"v3\"\nend\nvariable = Mailjet::Campaigngraphstatistics.find($campaign_ID\n)\np variable.attributes['Data']"
- lang: Python
label: Python
source: "from mailjet_rest import Client\nimport os\napi_key = os.environ['MJ_APIKEY_PUBLIC']\napi_secret = os.environ['MJ_APIKEY_PRIVATE']\nmailjet = Client(auth=(api_key, api_secret), version='v3')\nid = '$campaign_ID'\nresult = mailjet.campaigngraphstatistics.get(id=id)\nprint result.status_code\nprint result.json()"
- lang: Java
label: Java
source: "package com.my.project;\nimport com.mailjet.client.errors.MailjetException;\nimport com.mailjet.client.errors.MailjetSocketTimeoutException;\nimport com.mailjet.client.MailjetClient;\nimport com.mailjet.client.MailjetRequest;\nimport com.mailjet.client.MailjetResponse;\nimport com.mailjet.client.ClientOptions;\nimport com.mailjet.client.resource.Campaigngraphstatistics;\nimport org.json.JSONArray;\nimport org.json.JSONObject;\npublic class MyClass {\n public static void main(String[] args) throws MailjetException, MailjetSocketTimeoutException {\n MailjetClient client;\n MailjetRequest request;\n MailjetResponse response;\n client = new MailjetClient(System.getenv(\"MJ_APIKEY_PUBLIC\"), System.getenv(\"MJ_APIKEY_PRIVATE\"), new ClientOptions(\"v3\"));\n request = new MailjetRequest(Campaigngraphstatistics.resource, ID);\n response = client.get(request);\n System.out.println(response.getStatus());\n System.out.println(response.getData());\n }\n}"
- lang: Go
label: Go
source: "package main\nimport (\n\t\"fmt\"\n\t\"log\"\n\t\"os\"\n\tmailjet \"github.com/mailjet/mailjet-apiv3-go\"\n\t\"github.com/mailjet/mailjet-apiv3-go/resources\"\n)\nfunc main () {\n\tmailjetClient := NewMailjetClient(os.Getenv(\"MJ_APIKEY_PUBLIC\"), os.Getenv(\"MJ_APIKEY_PRIVATE\"))\n\tvar data []resources.Campaigngraphstatistics\n\tmr := &Request{\n\t Resource: \"campaigngraphstatistics\",\n\t ID: RESOURCE_ID,\n\t}\n\terr := mailjetClient.Get(mr, &data)\n\tif err != nil {\n\t fmt.Println(err)\n\t}\n\tfmt.Printf(\"Data array: %+v\\n\", data)\n}"
- lang: C#
label: C#
source: "using Mailjet.Client;\nusing Mailjet.Client.Resources;\nusing System;\nusing Newtonsoft.Json.Linq;\nnamespace Mailjet.ConsoleApplication\n{\n class Program\n {\n static void Main(string[] args)\n {\n RunAsync().Wait();\n }\n static async Task RunAsync()\n {\n MailjetClient client = new MailjetClient(Environment.GetEnvironmentVariable(\"MJ_APIKEY_PUBLIC\"), Environment.GetEnvironmentVariable(\"MJ_APIKEY_PRIVATE\"))\n {\n Version = ApiVersion.V3,\n };\n MailjetRequest request = new MailjetRequest\n {\n Resource = Campaigngraphstatistics.Resource,\n ResourceId = ResourceId.Numeric(ID)\n }\n MailjetResponse response = await client.GetAsync(request);\n if (response.IsSuccessStatusCode)\n {\n Console.WriteLine(string.Format(\"Total: {0}, Count: {1}\\n\", response.GetTotal(), response.GetCount()));\n Console.WriteLine(response.GetData());\n }\n else\n {\n Console.WriteLine(string.Format(\"StatusCode: {0}\\n\", response.StatusCode));\n Console.WriteLine(string.Format(\"ErrorInfo: {0}\\n\", response.GetErrorInfo()));\n Console.WriteLine(response.GetData());\n Console.WriteLine(string.Format(\"ErrorMessage: {0}\\n\", response.GetErrorMessage()));\n }\n }\n }\n}"
"/v3/REST/campaignstatistics":
get:
x-seo:
title: "Campaign Statistics"
description: "Retrieve aggregated delivery and engagement statistics grouped by campaign. Note: This is a legacy endpoint. We advise using /statcounters to retrieve\u2026"
deprecated: true
tags:
- Deprecated Endpoints
summary: Campaign Statistics
description: "Retrieve aggregated delivery and engagement statistics grouped by campaign.\n\n> Note: This is a legacy endpoint. We advise using `/statcounters` to retrieve aggregated stats for campaigns.\n"
operationId: get_v3_campaignstatistics
parameters:
- name: AXTesting
in: query
schema:
$ref: '#/components/schemas/get_v3_campaignstatistics_QueryParams/properties/AXTesting'
- name: Blocked
in: query
schema:
$ref: '#/components/schemas/get_v3_campaignstatistics_QueryParams/properties/Blocked'
- name: Bounced
in: query
schema:
$ref: '#/components/schemas/get_v3_campaignstatistics_QueryParams/properties/Bounced'
- name: Click
in: query
schema:
$ref: '#/components/schemas/get_v3_campaignstatistics_QueryParams/properties/Click'
- name: ContactsList
in: query
schema:
$ref: '#/components/schemas/get_v3_campaignstatistics_QueryParams/properties/ContactsList'
- name: Deferred
in: query
schema:
$ref: '#/components/schemas/get_v3_campaignstatistics_QueryParams/properties/Deferred'
- name: FromTS
in: query
schema:
$ref: '#/components/schemas/get_v3_campaignstatistics_QueryParams/properties/FromTS'
- name: FromType
in: query
schema:
$ref: '#/components/schemas/get_v3_campaignstatistics_QueryParams/properties/FromType'
- name: GroupAX
in: query
schema:
$ref: '#/components/schemas/get_v3_campaignstatistics_QueryParams/properties/GroupAX'
- name: Hardbounced
in: query
schema:
$ref: '#/components/schemas/get_v3_campaignstatistics_QueryParams/properties/Hardbounced'
- name: IsDeleted
in: query
schema:
$ref: '#/components/schemas/get_v3_campaignstatistics_QueryParams/properties/IsDeleted'
- name: IsStarred
in: query
schema:
$ref: '#/components/schemas/get_v3_campaignstatistics_QueryParams/properties/IsStarred'
- name: LastActivityAt
in: query
schema:
$ref: '#/components/schemas/get_v3_campaignstatistics_QueryParams/properties/LastActivityAt'
- name: MaxLastActivityAt
in: query
schema:
$ref: '#/components/schemas/get_v3_campaignstatistics_QueryParams/properties/MaxLastActivityAt'
- name: MinLastActivityAt
in: query
schema:
$ref: '#/components/schemas/get_v3_campaignstatistics_QueryParams/properties/MinLastActivityAt'
- name: NewsLetter
in: query
schema:
$ref: '#/components/schemas/get_v3_campaignstatistics_QueryParams/properties/NewsLetter'
- name: Open
in: query
schema:
$ref: '#/components/schemas/get_v3_campaignstatistics_QueryParams/properties/Open'
- name: Queued
in: query
schema:
$ref: '#/components/schemas/get_v3_campaignstatistics_QueryParams/properties/Queued'
- name: Segmentation
in: query
schema:
$ref: '#/components/schemas/get_v3_campaignstatistics_QueryParams/properties/Segmentation'
- name: Sender
in: query
schema:
$ref: '#/components/schemas/get_v3_campaignstatistics_QueryParams/properties/Sender'
- name: Sent
in: query
schema:
$ref: '#/components/schemas/get_v3_campaignstatistics_QueryParams/properties/Sent'
- name: ShowExtraData
in: query
schema:
$ref: '#/components/schemas/get_v3_campaignstatistics_QueryParams/properties/ShowExtraData'
- name: Spam
in: query
schema:
$ref: '#/components/schemas/get_v3_campaignstatistics_QueryParams/properties/Spam'
- name: Softbounced
in: query
schema:
$ref: '#/components/schemas/get_v3_campaignstatistics_QueryParams/properties/Softbounced'
- name: Subject
in: query
schema:
$ref: '#/components/schemas/get_v3_campaignstatistics_QueryParams/properties/Subject'
- name: ToTS
in: query
schema:
$ref: '#/components/schemas/get_v3_campaignstatistics_QueryParams/properties/ToTS'
- name: Unsubscribed
in: query
schema:
$ref: '#/components/schemas/get_v3_campaignstatistics_QueryParams/properties/Unsubscribed'
- name: WorkflowID
in: query
schema:
$ref: '#/components/schemas/get_v3_campaignstatistics_QueryParams/properties/WorkflowID'
responses:
'200':
description: Default OK response for `/campaignstatistics`
content:
application/json:
schema:
type: object
properties:
Count:
description: Indicates the number of objects in the `Data` array.
type: integer
format: int64
examples:
- 1
Data:
description: A JSON array containing a list of objects returned by this endpoint.
type: array
items:
$ref: '#/components/schemas/OutputCampaignstatistics'
Total:
description: Indicates the number of objects in the `Data` array.
type: integer
format: int64
examples:
- 1
'400':
$ref: '#/components/responses/400'
'401':
$ref: '#/components/responses/401'
'403':
$ref: '#/components/responses/403'
'404':
$ref: '#/components/responses/404'
'429':
$ref: '#/components/responses/429'
'500':
$ref: '#/components/responses/500'
security:
- basicAuth: []
x-codeSamples:
- lang: curl
label: cURL
source: "curl -s \\\n\t-X GET \\\n\t--user \"$MJ_APIKEY_PUBLIC:$MJ_APIKEY_PRIVATE\" \\\n\thttps://api.mailjet.com/v3/REST/campaignstatistics \\"
- lang: PHP
label: PHP
source: " 'v3']);\n$response = $mj->get(Resources::$Campaignstatistics);\n$response->success() && var_dump($response->getData());\n?>"
- lang: Node.js
label: Node
source: "const mailjet = require ('node-mailjet')\n\t.connect(process.env.MJ_APIKEY_PUBLIC, process.env.MJ_APIKEY_PRIVATE)\nconst request = mailjet\n\t.get(\"campaignstatistics\", {'version': 'v3'})\n\t.request()\nrequest\n\t.then((result) => {\n\t\tconsole.log(result.body)\n\t})\n\t.catch((err) => {\n\t\tconsole.log(err.statusCode)\n\t})"
- lang: Ruby
label: Ruby
source: "require 'mailjet'\nMailjet.configure do |config|\n config.api_key = ENV['MJ_APIKEY_PUBLIC']\n config.secret_key = ENV['MJ_APIKEY_PRIVATE']\n config.api_version = \"v3\"\nend\nvariable = Mailjet::Campaignstatistics.all(\n)\np variable.attributes['Data']"
- lang: Python
label: Python
source: "from mailjet_rest import Client\nimport os\napi_key = os.environ['MJ_APIKEY_PUBLIC']\napi_secret = os.environ['MJ_APIKEY_PRIVATE']\nmailjet = Client(auth=(api_key, api_secret), version='v3')\nresult = mailjet.campaignstatistics.get()\nprint result.status_code\nprint result.json()"
- lang: Java
label: Java
source: "package com.my.project;\nimport com.mailjet.client.errors.MailjetException;\nimport com.mailjet.client.errors.MailjetSocketTimeoutException;\nimport com.mailjet.client.MailjetClient;\nimport com.mailjet.client.MailjetRequest;\nimport com.mailjet.client.MailjetResponse;\nimport com.mailjet.client.ClientOptions;\nimport com.mailjet.client.resource.Campaignstatistics;\nimport org.json.JSONArray;\nimport org.json.JSONObject;\npublic class MyClass {\n public static void main(String[] args) throws MailjetException, MailjetSocketTimeoutException {\n MailjetClient client;\n MailjetRequest request;\n MailjetResponse response;\n client = new MailjetClient(System.getenv(\"MJ_APIKEY_PUBLIC\"), System.getenv(\"MJ_APIKEY_PRIVATE\"), new ClientOptions(\"v3\"));\n request = new MailjetRequest(Campaignstatistics.resource);\n response = client.get(request);\n System.out.println(response.getStatus());\n System.out.println(response.getData());\n }\n}"
- lang: Go
label: Go
source: "package main\nimport (\n\t\"fmt\"\n\t\"log\"\n\t\"os\"\n\tmailjet \"github.com/mailjet/mailjet-apiv3-go\"\n\t\"github.com/mailjet/mailjet-apiv3-go/resources\"\n)\nfunc main () {\n\tmailjetClient := NewMailjetClient(os.Getenv(\"MJ_APIKEY_PUBLIC\"), os.Getenv(\"MJ_APIKEY_PRIVATE\"))\n\tvar data []resources.Campaignstatistics\n\t_, _, err := mailjetClient.List(\"campaignstatistics\", &data)\n\tif err != nil {\n\t fmt.Println(err)\n\t}\n\tfmt.Printf(\"Data array: %+v\\n\", data)\n}"
- lang: C#
label: C#
source: "using Mailjet.Client;\nusing Mailjet.Client.Resources;\nusing System;\nusing Newtonsoft.Json.Linq;\nnamespace Mailjet.ConsoleApplication\n{\n class Program\n {\n static void Main(string[] args)\n {\n RunAsync().Wait();\n }\n static async Task RunAsync()\n {\n MailjetClient client = new MailjetClient(Environment.GetEnvironmentVariable(\"MJ_APIKEY_PUBLIC\"), Environment.GetEnvironmentVariable(\"MJ_APIKEY_PRIVATE\"))\n {\n Version = ApiVersion.V3,\n };\n MailjetRequest request = new MailjetRequest\n {\n Resource = Campaignstatistics.Resource,\n }\n MailjetResponse response = await client.GetAsync(request);\n if (response.IsSuccessStatusCode)\n {\n Console.WriteLine(string.Format(\"Total: {0}, Count: {1}\\n\", response.GetTotal(), response.GetCount()));\n Console.WriteLine(response.GetData());\n }\n else\n {\n Console.WriteLine(string.Format(\"StatusCode: {0}\\n\", response.StatusCode));\n Console.WriteLine(string.Format(\"ErrorInfo: {0}\\n\", response.GetErrorInfo()));\n Console.WriteLine(response.GetData());\n Console.WriteLine(string.Format(\"ErrorMessage: {0}\\n\", response.GetErrorMessage()));\n }\n }\n }\n}"
/v3/REST/campaignstatistics/{campaign_ID}:
get:
x-seo:
title: "Campaign Statistics by ID"
description: "Retrieve general information, as well as aggregated delivery and engagement statistics for a specific campaign. Note: This is a legacy endpoint. We\u2026"
deprecated: true
tags:
- Deprecated Endpoints
summary: Campaign Statistics by ID
description: "Retrieve general information, as well as aggregated delivery and engagement statistics for a specific campaign.\n\n> Note: This is a legacy endpoint. We advise using `/statcounters` to retrieve aggregated stats for campaigns.\n To obtain a valid `campaign_ID`, first call `GET /v3/REST/campaign` to list your campaigns."
operationId: get_v3_campaignstatistics_id
parameters:
- name: campaign_ID
in: path
schema:
$ref: '#/components/schemas/get_v3_campaignstatistics_id_PathParams/properties/campaign_ID'
required: true
example: 6000
responses:
'200':
description: Default OK response for `/campaignstatistics`
content:
application/json:
schema:
type: object
properties:
Count:
description: Indicates the number of objects in the `Data` array.
type: integer
format: int64
examples:
- 1
Data:
description: A JSON array containing a list of objects returned by this endpoint.
type: array
items:
$ref: '#/components/schemas/OutputCampaignstatistics'
Total:
description: Indicates the number of objects in the `Data` array.
type: integer
format: int64
examples:
- 1
'400':
$ref: '#/components/responses/400'
'401':
$ref: '#/components/responses/401'
'403':
$ref: '#/components/responses/403'
'404':
$ref: '#/components/responses/404'
'429':
$ref: '#/components/responses/429'
'500':
$ref: '#/components/responses/500'
security:
- basicAuth: []
x-codeSamples:
- lang: curl
label: cURL
source: "curl -s \\\n\t-X GET \\\n\t--user \"$MJ_APIKEY_PUBLIC:$MJ_APIKEY_PRIVATE\" \\\n\thttps://api.mailjet.com/v3/REST/campaignstatistics/$campaign_ID \\"
- lang: PHP
label: PHP
source: " 'v3']);\n$response = $mj->get(Resources::$Campaignstatistics, ['id' => $id]);\n$response->success() && var_dump($response->getData());\n?>"
- lang: Node.js
label: Node
source: "const mailjet = require ('node-mailjet')\n\t.connect(process.env.MJ_APIKEY_PUBLIC, process.env.MJ_APIKEY_PRIVATE)\nconst request = mailjet\n\t.get(\"campaignstatistics\", {'version': 'v3'})\n\t.id($campaign_ID)\n\t.request()\nrequest\n\t.then((result) => {\n\t\tconsole.log(result.body)\n\t})\n\t.catch((err) => {\n\t\tconsole.log(err.statusCode)\n\t})"
- lang: Ruby
label: Ruby
source: "require 'mailjet'\nMailjet.configure do |config|\n config.api_key = ENV['MJ_APIKEY_PUBLIC']\n config.secret_key = ENV['MJ_APIKEY_PRIVATE']\n config.api_version = \"v3\"\nend\nvariable = Mailjet::Campaignstatistics.find($campaign_ID\n)\np variable.attributes['Data']"
- lang: Python
label: Python
source: "from mailjet_rest import Client\nimport os\napi_key = os.environ['MJ_APIKEY_PUBLIC']\napi_secret = os.environ['MJ_APIKEY_PRIVATE']\nmailjet = Client(auth=(api_key, api_secret), version='v3')\nid = '$campaign_ID'\nresult = mailjet.campaignstatistics.get(id=id)\nprint result.status_code\nprint result.json()"
- lang: Java
label: Java
source: "package com.my.project;\nimport com.mailjet.client.errors.MailjetException;\nimport com.mailjet.client.errors.MailjetSocketTimeoutException;\nimport com.mailjet.client.MailjetClient;\nimport com.mailjet.client.MailjetRequest;\nimport com.mailjet.client.MailjetResponse;\nimport com.mailjet.client.ClientOptions;\nimport com.mailjet.client.resource.Campaignstatistics;\nimport org.json.JSONArray;\nimport org.json.JSONObject;\npublic class MyClass {\n public static void main(String[] args) throws MailjetException, MailjetSocketTimeoutException {\n MailjetClient client;\n MailjetRequest request;\n MailjetResponse response;\n client = new MailjetClient(System.getenv(\"MJ_APIKEY_PUBLIC\"), System.getenv(\"MJ_APIKEY_PRIVATE\"), new ClientOptions(\"v3\"));\n request = new MailjetRequest(Campaignstatistics.resource, ID);\n response = client.get(request);\n System.out.println(response.getStatus());\n System.out.println(response.getData());\n }\n}"
- lang: Go
label: Go
source: "package main\nimport (\n\t\"fmt\"\n\t\"log\"\n\t\"os\"\n\tmailjet \"github.com/mailjet/mailjet-apiv3-go\"\n\t\"github.com/mailjet/mailjet-apiv3-go/resources\"\n)\nfunc main () {\n\tmailjetClient := NewMailjetClient(os.Getenv(\"MJ_APIKEY_PUBLIC\"), os.Getenv(\"MJ_APIKEY_PRIVATE\"))\n\tvar data []resources.Campaignstatistics\n\tmr := &Request{\n\t Resource: \"campaignstatistics\",\n\t ID: RESOURCE_ID,\n\t}\n\terr := mailjetClient.Get(mr, &data)\n\tif err != nil {\n\t fmt.Println(err)\n\t}\n\tfmt.Printf(\"Data array: %+v\\n\", data)\n}"
- lang: C#
label: C#
source: "using Mailjet.Client;\nusing Mailjet.Client.Resources;\nusing System;\nusing Newtonsoft.Json.Linq;\nnamespace Mailjet.ConsoleApplication\n{\n class Program\n {\n static void Main(string[] args)\n {\n RunAsync().Wait();\n }\n static async Task RunAsync()\n {\n MailjetClient client = new MailjetClient(Environment.GetEnvironmentVariable(\"MJ_APIKEY_PUBLIC\"), Environment.GetEnvironmentVariable(\"MJ_APIKEY_PRIVATE\"))\n {\n Version = ApiVersion.V3,\n };\n MailjetRequest request = new MailjetRequest\n {\n Resource = Campaignstatistics.Resource,\n ResourceId = ResourceId.Numeric(ID)\n }\n MailjetResponse response = await client.GetAsync(request);\n if (response.IsSuccessStatusCode)\n {\n Console.WriteLine(string.Format(\"Total: {0}, Count: {1}\\n\", response.GetTotal(), response.GetCount()));\n Console.WriteLine(response.GetData());\n }\n else\n {\n Console.WriteLine(string.Format(\"StatusCode: {0}\\n\", response.StatusCode));\n Console.WriteLine(string.Format(\"ErrorInfo: {0}\\n\", response.GetErrorInfo()));\n Console.WriteLine(response.GetData());\n Console.WriteLine(string.Format(\"ErrorMessage: {0}\\n\", response.GetErrorMessage()));\n }\n }\n }\n}"
"/v3/REST/domainstatistics":
get:
x-seo:
title: "Domain Statistics"
description: "Retrieve a list of overall aggregated delivery and engagement statistics, grouped by recipient domain. If no query parameters are used in the path URL\u2026"
deprecated: true
tags:
- Deprecated Endpoints
summary: Domain Statistics
description: "Retrieve a list of overall aggregated delivery and engagement statistics, grouped by recipient domain. If no query parameters are used in the path URL, only information about messages sent since 00:00 UTC on the current day will be returned.\n\n> Note: This is a legacy endpoint. We advise using `/statistics/recipient-esp` to retrieve aggregated domain stats.\n"
operationId: get_v3_domainstatistics
parameters:
- name: CampaignID
in: query
schema:
$ref: '#/components/schemas/get_v3_domainstatistics_QueryParams/properties/CampaignID'
- name: ContactsList
in: query
schema:
$ref: '#/components/schemas/get_v3_domainstatistics_QueryParams/properties/ContactsList'
- name: CustomCampaign
in: query
schema:
$ref: '#/components/schemas/get_v3_domainstatistics_QueryParams/properties/CustomCampaign'
- name: From
in: query
schema:
$ref: '#/components/schemas/get_v3_domainstatistics_QueryParams/properties/From'
- name: FromDomain
in: query
schema:
$ref: '#/components/schemas/get_v3_domainstatistics_QueryParams/properties/FromDomain'
- name: FromID
in: query
schema:
$ref: '#/components/schemas/get_v3_domainstatistics_QueryParams/properties/FromID'
- name: FromTS
in: query
schema:
$ref: '#/components/schemas/get_v3_domainstatistics_QueryParams/properties/FromTS'
- name: FromType
in: query
schema:
$ref: '#/components/schemas/get_v3_domainstatistics_QueryParams/properties/FromType'
- name: IsDeleted
in: query
schema:
$ref: '#/components/schemas/get_v3_domainstatistics_QueryParams/properties/IsDeleted'
- name: IsNewsletterTool
in: query
schema:
$ref: '#/components/schemas/get_v3_domainstatistics_QueryParams/properties/IsNewsletterTool'
- name: IsStarred
in: query
schema:
$ref: '#/components/schemas/get_v3_domainstatistics_QueryParams/properties/IsStarred'
- name: MessageStatus
in: query
schema:
$ref: '#/components/schemas/get_v3_domainstatistics_QueryParams/properties/MessageStatus'
- name: Period
in: query
schema:
$ref: '#/components/schemas/get_v3_domainstatistics_QueryParams/properties/Period'
- name: ToTS
in: query
schema:
$ref: '#/components/schemas/get_v3_domainstatistics_QueryParams/properties/ToTS'
responses:
'200':
description: Default OK response for `/domainstatistics`
content:
application/json:
schema:
type: object
properties:
Count:
description: Indicates the number of objects in the `Data` array.
type: integer
format: int64
examples:
- 1
Data:
description: A JSON array containing a list of objects returned by this endpoint.
type: array
items:
$ref: '#/components/schemas/OutputDomainstatistics'
Total:
description: Indicates the number of objects in the `Data` array.
type: integer
format: int64
examples:
- 1
'400':
$ref: '#/components/responses/400'
'401':
$ref: '#/components/responses/401'
'403':
$ref: '#/components/responses/403'
'404':
$ref: '#/components/responses/404'
'429':
$ref: '#/components/responses/429'
'500':
$ref: '#/components/responses/500'
security:
- basicAuth: []
x-codeSamples:
- lang: curl
label: cURL
source: "curl -s \\\n\t-X GET \\\n\t--user \"$MJ_APIKEY_PUBLIC:$MJ_APIKEY_PRIVATE\" \\\n\thttps://api.mailjet.com/v3/REST/domainstatistics \\"
- lang: PHP
label: PHP
source: " 'v3']);\n$response = $mj->get(Resources::$Domainstatistics);\n$response->success() && var_dump($response->getData());\n?>"
- lang: Node.js
label: Node
source: "const mailjet = require ('node-mailjet')\n\t.connect(process.env.MJ_APIKEY_PUBLIC, process.env.MJ_APIKEY_PRIVATE)\nconst request = mailjet\n\t.get(\"domainstatistics\", {'version': 'v3'})\n\t.request()\nrequest\n\t.then((result) => {\n\t\tconsole.log(result.body)\n\t})\n\t.catch((err) => {\n\t\tconsole.log(err.statusCode)\n\t})"
- lang: Ruby
label: Ruby
source: "require 'mailjet'\nMailjet.configure do |config|\n config.api_key = ENV['MJ_APIKEY_PUBLIC']\n config.secret_key = ENV['MJ_APIKEY_PRIVATE']\n config.api_version = \"v3\"\nend\nvariable = Mailjet::Domainstatistics.all(\n)\np variable.attributes['Data']"
- lang: Python
label: Python
source: "from mailjet_rest import Client\nimport os\napi_key = os.environ['MJ_APIKEY_PUBLIC']\napi_secret = os.environ['MJ_APIKEY_PRIVATE']\nmailjet = Client(auth=(api_key, api_secret), version='v3')\nresult = mailjet.domainstatistics.get()\nprint result.status_code\nprint result.json()"
- lang: Java
label: Java
source: "package com.my.project;\nimport com.mailjet.client.errors.MailjetException;\nimport com.mailjet.client.errors.MailjetSocketTimeoutException;\nimport com.mailjet.client.MailjetClient;\nimport com.mailjet.client.MailjetRequest;\nimport com.mailjet.client.MailjetResponse;\nimport com.mailjet.client.ClientOptions;\nimport com.mailjet.client.resource.Domainstatistics;\nimport org.json.JSONArray;\nimport org.json.JSONObject;\npublic class MyClass {\n public static void main(String[] args) throws MailjetException, MailjetSocketTimeoutException {\n MailjetClient client;\n MailjetRequest request;\n MailjetResponse response;\n client = new MailjetClient(System.getenv(\"MJ_APIKEY_PUBLIC\"), System.getenv(\"MJ_APIKEY_PRIVATE\"), new ClientOptions(\"v3\"));\n request = new MailjetRequest(Domainstatistics.resource);\n response = client.get(request);\n System.out.println(response.getStatus());\n System.out.println(response.getData());\n }\n}"
- lang: Go
label: Go
source: "package main\nimport (\n\t\"fmt\"\n\t\"log\"\n\t\"os\"\n\tmailjet \"github.com/mailjet/mailjet-apiv3-go\"\n\t\"github.com/mailjet/mailjet-apiv3-go/resources\"\n)\nfunc main () {\n\tmailjetClient := NewMailjetClient(os.Getenv(\"MJ_APIKEY_PUBLIC\"), os.Getenv(\"MJ_APIKEY_PRIVATE\"))\n\tvar data []resources.Domainstatistics\n\t_, _, err := mailjetClient.List(\"domainstatistics\", &data)\n\tif err != nil {\n\t fmt.Println(err)\n\t}\n\tfmt.Printf(\"Data array: %+v\\n\", data)\n}"
- lang: C#
label: C#
source: "using Mailjet.Client;\nusing Mailjet.Client.Resources;\nusing System;\nusing Newtonsoft.Json.Linq;\nnamespace Mailjet.ConsoleApplication\n{\n class Program\n {\n static void Main(string[] args)\n {\n RunAsync().Wait();\n }\n static async Task RunAsync()\n {\n MailjetClient client = new MailjetClient(Environment.GetEnvironmentVariable(\"MJ_APIKEY_PUBLIC\"), Environment.GetEnvironmentVariable(\"MJ_APIKEY_PRIVATE\"))\n {\n Version = ApiVersion.V3,\n };\n MailjetRequest request = new MailjetRequest\n {\n Resource = Domainstatistics.Resource,\n }\n MailjetResponse response = await client.GetAsync(request);\n if (response.IsSuccessStatusCode)\n {\n Console.WriteLine(string.Format(\"Total: {0}, Count: {1}\\n\", response.GetTotal(), response.GetCount()));\n Console.WriteLine(response.GetData());\n }\n else\n {\n Console.WriteLine(string.Format(\"StatusCode: {0}\\n\", response.StatusCode));\n Console.WriteLine(string.Format(\"ErrorInfo: {0}\\n\", response.GetErrorInfo()));\n Console.WriteLine(response.GetData());\n Console.WriteLine(string.Format(\"ErrorMessage: {0}\\n\", response.GetErrorMessage()));\n }\n }\n }\n}"
"/v3/REST/graphstatistics":
get:
x-seo:
title: "Graph Statistics"
description: "Retrieve information on the evolution of statistics by grouping them by time intervals. You need to specify the time intervals with the Scale query\u2026"
deprecated: true
tags:
- Deprecated Endpoints
summary: Graph Statistics
description: "Retrieve information on the evolution of statistics by grouping them by time intervals. You need to specify the time intervals with the `Scale` query parameter, as well as the overall time period with `Period` or `FromTS` and `ToTS`.\n\n> Note: This is a legacy endpoint. We advise using `/statcounters` to retrieve information on the evolution of statistics.\n"
operationId: get_v3_graphstatistics
parameters:
- name: CampaignID
in: query
schema:
$ref: '#/components/schemas/get_v3_graphstatistics_QueryParams/properties/CampaignID'
- name: ContactID
in: query
schema:
$ref: '#/components/schemas/get_v3_graphstatistics_QueryParams/properties/ContactID'
- name: ContactsList
in: query
schema:
$ref: '#/components/schemas/get_v3_graphstatistics_QueryParams/properties/ContactsList'
- name: CustomCampaign
in: query
schema:
$ref: '#/components/schemas/get_v3_graphstatistics_QueryParams/properties/CustomCampaign'
- name: From
in: query
schema:
$ref: '#/components/schemas/get_v3_graphstatistics_QueryParams/properties/From'
- name: FromDomain
in: query
schema:
$ref: '#/components/schemas/get_v3_graphstatistics_QueryParams/properties/FromDomain'
- name: FromID
in: query
schema:
$ref: '#/components/schemas/get_v3_graphstatistics_QueryParams/properties/FromID'
- name: FromTS
in: query
schema:
$ref: '#/components/schemas/get_v3_graphstatistics_QueryParams/properties/FromTS'
- name: FromType
in: query
schema:
$ref: '#/components/schemas/get_v3_graphstatistics_QueryParams/properties/FromType'
- name: IsDeleted
in: query
schema:
$ref: '#/components/schemas/get_v3_graphstatistics_QueryParams/properties/IsDeleted'
- name: IsNewsletterTool
in: query
schema:
$ref: '#/components/schemas/get_v3_graphstatistics_QueryParams/properties/IsNewsletterTool'
- name: IsStarred
in: query
schema:
$ref: '#/components/schemas/get_v3_graphstatistics_QueryParams/properties/IsStarred'
- name: MessageStatus
in: query
schema:
$ref: '#/components/schemas/get_v3_graphstatistics_QueryParams/properties/MessageStatus'
- name: Period
example: Day
in: query
schema:
$ref: '#/components/schemas/get_v3_graphstatistics_QueryParams/properties/Period'
- name: Scale
in: query
schema:
$ref: '#/components/schemas/get_v3_graphstatistics_QueryParams/properties/Scale'
required: true
example: Hour
- name: TimeShift
in: query
schema:
$ref: '#/components/schemas/get_v3_graphstatistics_QueryParams/properties/TimeShift'
- name: ToTS
in: query
schema:
$ref: '#/components/schemas/get_v3_graphstatistics_QueryParams/properties/ToTS'
- name: WorkflowID
in: query
schema:
$ref: '#/components/schemas/get_v3_graphstatistics_QueryParams/properties/WorkflowID'
responses:
'200':
description: Default OK response for `/graphstatistics`
content:
application/json:
schema:
type: object
properties:
Count:
description: Indicates the number of objects in the `Data` array.
type: integer
format: int64
examples:
- 1
Data:
description: A JSON array containing a list of objects returned by this endpoint.
type: array
items:
$ref: '#/components/schemas/OutputGraphstatistics'
Total:
description: Indicates the number of objects in the `Data` array.
type: integer
format: int64
examples:
- 1
'400':
$ref: '#/components/responses/400'
'401':
$ref: '#/components/responses/401'
'403':
$ref: '#/components/responses/403'
'404':
$ref: '#/components/responses/404'
'429':
$ref: '#/components/responses/429'
'500':
$ref: '#/components/responses/500'
security:
- basicAuth: []
x-codeSamples:
- lang: curl
label: cURL
source: "curl -s \\\n\t-X GET \\\n\t--user \"$MJ_APIKEY_PUBLIC:$MJ_APIKEY_PRIVATE\" \\\n\thttps://api.mailjet.com/v3/REST/graphstatistics \\"
- lang: PHP
label: PHP
source: " 'v3']);\n$response = $mj->get(Resources::$Graphstatistics);\n$response->success() && var_dump($response->getData());\n?>"
- lang: Node.js
label: Node
source: "const mailjet = require ('node-mailjet')\n\t.connect(process.env.MJ_APIKEY_PUBLIC, process.env.MJ_APIKEY_PRIVATE)\nconst request = mailjet\n\t.get(\"graphstatistics\", {'version': 'v3'})\n\t.request()\nrequest\n\t.then((result) => {\n\t\tconsole.log(result.body)\n\t})\n\t.catch((err) => {\n\t\tconsole.log(err.statusCode)\n\t})"
- lang: Ruby
label: Ruby
source: "require 'mailjet'\nMailjet.configure do |config|\n config.api_key = ENV['MJ_APIKEY_PUBLIC']\n config.secret_key = ENV['MJ_APIKEY_PRIVATE']\n config.api_version = \"v3\"\nend\nvariable = Mailjet::Graphstatistics.all(\n)\np variable.attributes['Data']"
- lang: Python
label: Python
source: "from mailjet_rest import Client\nimport os\napi_key = os.environ['MJ_APIKEY_PUBLIC']\napi_secret = os.environ['MJ_APIKEY_PRIVATE']\nmailjet = Client(auth=(api_key, api_secret), version='v3')\nresult = mailjet.graphstatistics.get()\nprint result.status_code\nprint result.json()"
- lang: Java
label: Java
source: "package com.my.project;\nimport com.mailjet.client.errors.MailjetException;\nimport com.mailjet.client.errors.MailjetSocketTimeoutException;\nimport com.mailjet.client.MailjetClient;\nimport com.mailjet.client.MailjetRequest;\nimport com.mailjet.client.MailjetResponse;\nimport com.mailjet.client.ClientOptions;\nimport com.mailjet.client.resource.Graphstatistics;\nimport org.json.JSONArray;\nimport org.json.JSONObject;\npublic class MyClass {\n public static void main(String[] args) throws MailjetException, MailjetSocketTimeoutException {\n MailjetClient client;\n MailjetRequest request;\n MailjetResponse response;\n client = new MailjetClient(System.getenv(\"MJ_APIKEY_PUBLIC\"), System.getenv(\"MJ_APIKEY_PRIVATE\"), new ClientOptions(\"v3\"));\n request = new MailjetRequest(Graphstatistics.resource);\n response = client.get(request);\n System.out.println(response.getStatus());\n System.out.println(response.getData());\n }\n}"
- lang: Go
label: Go
source: "package main\nimport (\n\t\"fmt\"\n\t\"log\"\n\t\"os\"\n\tmailjet \"github.com/mailjet/mailjet-apiv3-go\"\n\t\"github.com/mailjet/mailjet-apiv3-go/resources\"\n)\nfunc main () {\n\tmailjetClient := NewMailjetClient(os.Getenv(\"MJ_APIKEY_PUBLIC\"), os.Getenv(\"MJ_APIKEY_PRIVATE\"))\n\tvar data []resources.Graphstatistics\n\t_, _, err := mailjetClient.List(\"graphstatistics\", &data)\n\tif err != nil {\n\t fmt.Println(err)\n\t}\n\tfmt.Printf(\"Data array: %+v\\n\", data)\n}"
- lang: C#
label: C#
source: "using Mailjet.Client;\nusing Mailjet.Client.Resources;\nusing System;\nusing Newtonsoft.Json.Linq;\nnamespace Mailjet.ConsoleApplication\n{\n class Program\n {\n static void Main(string[] args)\n {\n RunAsync().Wait();\n }\n static async Task RunAsync()\n {\n MailjetClient client = new MailjetClient(Environment.GetEnvironmentVariable(\"MJ_APIKEY_PUBLIC\"), Environment.GetEnvironmentVariable(\"MJ_APIKEY_PRIVATE\"))\n {\n Version = ApiVersion.V3,\n };\n MailjetRequest request = new MailjetRequest\n {\n Resource = Graphstatistics.Resource,\n }\n MailjetResponse response = await client.GetAsync(request);\n if (response.IsSuccessStatusCode)\n {\n Console.WriteLine(string.Format(\"Total: {0}, Count: {1}\\n\", response.GetTotal(), response.GetCount()));\n Console.WriteLine(response.GetData());\n }\n else\n {\n Console.WriteLine(string.Format(\"StatusCode: {0}\\n\", response.StatusCode));\n Console.WriteLine(string.Format(\"ErrorInfo: {0}\\n\", response.GetErrorInfo()));\n Console.WriteLine(response.GetData());\n Console.WriteLine(string.Format(\"ErrorMessage: {0}\\n\", response.GetErrorMessage()));\n }\n }\n }\n}"
"/v3/REST/liststatistics":
get:
x-seo:
title: "List Statistics"
description: "Retrieve a list of overall aggregated delivery and engagement statistics, as well as general details and subscriber counts for all contact lists. Note\u2026"
deprecated: true
tags:
- Deprecated Endpoints
summary: List Statistics
description: "Retrieve a list of overall aggregated delivery and engagement statistics, as well as general details and subscriber counts for all contact lists.\n\n> Note: This is a legacy endpoint. We advise using `/statcounters` to retrieve aggregated statistics for contact lists.\n"
operationId: get_v3_liststatistics
parameters:
- name: Address
in: query
schema:
$ref: '#/components/schemas/get_v3_liststatistics_QueryParams/properties/Address'
- name: CalcExcludedSubscriber
in: query
schema:
$ref: '#/components/schemas/get_v3_liststatistics_QueryParams/properties/CalcExcludedSubscriber'
- name: ContactsListID
in: query
schema:
$ref: '#/components/schemas/get_v3_liststatistics_QueryParams/properties/ContactsListID'
- name: ExcludeID
in: query
schema:
$ref: '#/components/schemas/get_v3_liststatistics_QueryParams/properties/ExcludeID'
responses:
'200':
description: Default OK response for `/liststatistics`
content:
application/json:
schema:
type: object
properties:
Count:
description: Indicates the number of objects in the `Data` array.
type: integer
format: int64
examples:
- 1
Data:
description: A JSON array containing a list of objects returned by this endpoint.
type: array
items:
$ref: '#/components/schemas/OutputListstatistics'
Total:
description: Indicates the number of objects in the `Data` array.
type: integer
format: int64
examples:
- 1
'400':
$ref: '#/components/responses/400'
'401':
$ref: '#/components/responses/401'
'403':
$ref: '#/components/responses/403'
'404':
$ref: '#/components/responses/404'
'429':
$ref: '#/components/responses/429'
'500':
$ref: '#/components/responses/500'
security:
- basicAuth: []
x-codeSamples:
- lang: curl
label: cURL
source: "curl -s \\\n\t-X GET \\\n\t--user \"$MJ_APIKEY_PUBLIC:$MJ_APIKEY_PRIVATE\" \\\n\thttps://api.mailjet.com/v3/REST/liststatistics \\"
- lang: PHP
label: PHP
source: " 'v3']);\n$response = $mj->get(Resources::$Liststatistics);\n$response->success() && var_dump($response->getData());\n?>"
- lang: Node.js
label: Node
source: "const mailjet = require ('node-mailjet')\n\t.connect(process.env.MJ_APIKEY_PUBLIC, process.env.MJ_APIKEY_PRIVATE)\nconst request = mailjet\n\t.get(\"liststatistics\", {'version': 'v3'})\n\t.request()\nrequest\n\t.then((result) => {\n\t\tconsole.log(result.body)\n\t})\n\t.catch((err) => {\n\t\tconsole.log(err.statusCode)\n\t})"
- lang: Ruby
label: Ruby
source: "require 'mailjet'\nMailjet.configure do |config|\n config.api_key = ENV['MJ_APIKEY_PUBLIC']\n config.secret_key = ENV['MJ_APIKEY_PRIVATE']\n config.api_version = \"v3\"\nend\nvariable = Mailjet::Liststatistics.all(\n)\np variable.attributes['Data']"
- lang: Python
label: Python
source: "from mailjet_rest import Client\nimport os\napi_key = os.environ['MJ_APIKEY_PUBLIC']\napi_secret = os.environ['MJ_APIKEY_PRIVATE']\nmailjet = Client(auth=(api_key, api_secret), version='v3')\nresult = mailjet.liststatistics.get()\nprint result.status_code\nprint result.json()"
- lang: Java
label: Java
source: "package com.my.project;\nimport com.mailjet.client.errors.MailjetException;\nimport com.mailjet.client.errors.MailjetSocketTimeoutException;\nimport com.mailjet.client.MailjetClient;\nimport com.mailjet.client.MailjetRequest;\nimport com.mailjet.client.MailjetResponse;\nimport com.mailjet.client.ClientOptions;\nimport com.mailjet.client.resource.Liststatistics;\nimport org.json.JSONArray;\nimport org.json.JSONObject;\npublic class MyClass {\n public static void main(String[] args) throws MailjetException, MailjetSocketTimeoutException {\n MailjetClient client;\n MailjetRequest request;\n MailjetResponse response;\n client = new MailjetClient(System.getenv(\"MJ_APIKEY_PUBLIC\"), System.getenv(\"MJ_APIKEY_PRIVATE\"), new ClientOptions(\"v3\"));\n request = new MailjetRequest(Liststatistics.resource);\n response = client.get(request);\n System.out.println(response.getStatus());\n System.out.println(response.getData());\n }\n}"
- lang: Go
label: Go
source: "package main\nimport (\n\t\"fmt\"\n\t\"log\"\n\t\"os\"\n\tmailjet \"github.com/mailjet/mailjet-apiv3-go\"\n\t\"github.com/mailjet/mailjet-apiv3-go/resources\"\n)\nfunc main () {\n\tmailjetClient := NewMailjetClient(os.Getenv(\"MJ_APIKEY_PUBLIC\"), os.Getenv(\"MJ_APIKEY_PRIVATE\"))\n\tvar data []resources.Liststatistics\n\t_, _, err := mailjetClient.List(\"liststatistics\", &data)\n\tif err != nil {\n\t fmt.Println(err)\n\t}\n\tfmt.Printf(\"Data array: %+v\\n\", data)\n}"
- lang: C#
label: C#
source: "using Mailjet.Client;\nusing Mailjet.Client.Resources;\nusing System;\nusing Newtonsoft.Json.Linq;\nnamespace Mailjet.ConsoleApplication\n{\n class Program\n {\n static void Main(string[] args)\n {\n RunAsync().Wait();\n }\n static async Task RunAsync()\n {\n MailjetClient client = new MailjetClient(Environment.GetEnvironmentVariable(\"MJ_APIKEY_PUBLIC\"), Environment.GetEnvironmentVariable(\"MJ_APIKEY_PRIVATE\"))\n {\n Version = ApiVersion.V3,\n };\n MailjetRequest request = new MailjetRequest\n {\n Resource = Liststatistics.Resource,\n }\n MailjetResponse response = await client.GetAsync(request);\n if (response.IsSuccessStatusCode)\n {\n Console.WriteLine(string.Format(\"Total: {0}, Count: {1}\\n\", response.GetTotal(), response.GetCount()));\n Console.WriteLine(response.GetData());\n }\n else\n {\n Console.WriteLine(string.Format(\"StatusCode: {0}\\n\", response.StatusCode));\n Console.WriteLine(string.Format(\"ErrorInfo: {0}\\n\", response.GetErrorInfo()));\n Console.WriteLine(response.GetData());\n Console.WriteLine(string.Format(\"ErrorMessage: {0}\\n\", response.GetErrorMessage()));\n }\n }\n }\n}"
/v3/REST/liststatistics/{list_ID}:
get:
x-seo:
title: "List Statistics by ID"
description: "Retrieve a list of overall aggregated delivery and engagement statistics, as well as general details and subscriber count for a specific contact list\u2026"
deprecated: true
tags:
- Deprecated Endpoints
summary: List Statistics by ID
description: "Retrieve a list of overall aggregated delivery and engagement statistics, as well as general details and subscriber count for a specific contact list.\n\n> Note: This is a legacy endpoint. We advise using `/statcounters` to retrieve aggregated statistics for contact lists.\n To obtain a valid `list_ID`, first call `GET /v3/REST/contactslist` to list your contact lists."
operationId: get_v3_liststatistics_id
parameters:
- name: list_ID
in: path
schema:
$ref: '#/components/schemas/get_v3_liststatistics_id_PathParams/properties/list_ID'
required: true
example: 2000
responses:
'200':
description: Default OK response for `/liststatistics`
content:
application/json:
schema:
type: object
properties:
Count:
description: Indicates the number of objects in the `Data` array.
type: integer
format: int64
examples:
- 1
Data:
description: A JSON array containing a list of objects returned by this endpoint.
type: array
items:
$ref: '#/components/schemas/OutputListstatistics'
Total:
description: Indicates the number of objects in the `Data` array.
type: integer
format: int64
examples:
- 1
'400':
$ref: '#/components/responses/400'
'401':
$ref: '#/components/responses/401'
'403':
$ref: '#/components/responses/403'
'404':
$ref: '#/components/responses/404'
'429':
$ref: '#/components/responses/429'
'500':
$ref: '#/components/responses/500'
security:
- basicAuth: []
x-codeSamples:
- lang: curl
label: cURL
source: "curl -s \\\n\t-X GET \\\n\t--user \"$MJ_APIKEY_PUBLIC:$MJ_APIKEY_PRIVATE\" \\\n\thttps://api.mailjet.com/v3/REST/liststatistics/$list_ID \\"
- lang: PHP
label: PHP
source: " 'v3']);\n$response = $mj->get(Resources::$Liststatistics, ['id' => $id]);\n$response->success() && var_dump($response->getData());\n?>"
- lang: Node.js
label: Node
source: "const mailjet = require ('node-mailjet')\n\t.connect(process.env.MJ_APIKEY_PUBLIC, process.env.MJ_APIKEY_PRIVATE)\nconst request = mailjet\n\t.get(\"liststatistics\", {'version': 'v3'})\n\t.id($list_ID)\n\t.request()\nrequest\n\t.then((result) => {\n\t\tconsole.log(result.body)\n\t})\n\t.catch((err) => {\n\t\tconsole.log(err.statusCode)\n\t})"
- lang: Ruby
label: Ruby
source: "require 'mailjet'\nMailjet.configure do |config|\n config.api_key = ENV['MJ_APIKEY_PUBLIC']\n config.secret_key = ENV['MJ_APIKEY_PRIVATE']\n config.api_version = \"v3\"\nend\nvariable = Mailjet::Liststatistics.find($list_ID\n)\np variable.attributes['Data']"
- lang: Python
label: Python
source: "from mailjet_rest import Client\nimport os\napi_key = os.environ['MJ_APIKEY_PUBLIC']\napi_secret = os.environ['MJ_APIKEY_PRIVATE']\nmailjet = Client(auth=(api_key, api_secret), version='v3')\nid = '$list_ID'\nresult = mailjet.liststatistics.get(id=id)\nprint result.status_code\nprint result.json()"
- lang: Java
label: Java
source: "package com.my.project;\nimport com.mailjet.client.errors.MailjetException;\nimport com.mailjet.client.errors.MailjetSocketTimeoutException;\nimport com.mailjet.client.MailjetClient;\nimport com.mailjet.client.MailjetRequest;\nimport com.mailjet.client.MailjetResponse;\nimport com.mailjet.client.ClientOptions;\nimport com.mailjet.client.resource.Liststatistics;\nimport org.json.JSONArray;\nimport org.json.JSONObject;\npublic class MyClass {\n public static void main(String[] args) throws MailjetException, MailjetSocketTimeoutException {\n MailjetClient client;\n MailjetRequest request;\n MailjetResponse response;\n client = new MailjetClient(System.getenv(\"MJ_APIKEY_PUBLIC\"), System.getenv(\"MJ_APIKEY_PRIVATE\"), new ClientOptions(\"v3\"));\n request = new MailjetRequest(Liststatistics.resource, ID);\n response = client.get(request);\n System.out.println(response.getStatus());\n System.out.println(response.getData());\n }\n}"
- lang: Go
label: Go
source: "package main\nimport (\n\t\"fmt\"\n\t\"log\"\n\t\"os\"\n\tmailjet \"github.com/mailjet/mailjet-apiv3-go\"\n\t\"github.com/mailjet/mailjet-apiv3-go/resources\"\n)\nfunc main () {\n\tmailjetClient := NewMailjetClient(os.Getenv(\"MJ_APIKEY_PUBLIC\"), os.Getenv(\"MJ_APIKEY_PRIVATE\"))\n\tvar data []resources.Liststatistics\n\tmr := &Request{\n\t Resource: \"liststatistics\",\n\t ID: RESOURCE_ID,\n\t}\n\terr := mailjetClient.Get(mr, &data)\n\tif err != nil {\n\t fmt.Println(err)\n\t}\n\tfmt.Printf(\"Data array: %+v\\n\", data)\n}"
- lang: C#
label: C#
source: "using Mailjet.Client;\nusing Mailjet.Client.Resources;\nusing System;\nusing Newtonsoft.Json.Linq;\nnamespace Mailjet.ConsoleApplication\n{\n class Program\n {\n static void Main(string[] args)\n {\n RunAsync().Wait();\n }\n static async Task RunAsync()\n {\n MailjetClient client = new MailjetClient(Environment.GetEnvironmentVariable(\"MJ_APIKEY_PUBLIC\"), Environment.GetEnvironmentVariable(\"MJ_APIKEY_PRIVATE\"))\n {\n Version = ApiVersion.V3,\n };\n MailjetRequest request = new MailjetRequest\n {\n Resource = Liststatistics.Resource,\n ResourceId = ResourceId.Numeric(ID)\n }\n MailjetResponse response = await client.GetAsync(request);\n if (response.IsSuccessStatusCode)\n {\n Console.WriteLine(string.Format(\"Total: {0}, Count: {1}\\n\", response.GetTotal(), response.GetCount()));\n Console.WriteLine(response.GetData());\n }\n else\n {\n Console.WriteLine(string.Format(\"StatusCode: {0}\\n\", response.StatusCode));\n Console.WriteLine(string.Format(\"ErrorInfo: {0}\\n\", response.GetErrorInfo()));\n Console.WriteLine(response.GetData());\n Console.WriteLine(string.Format(\"ErrorMessage: {0}\\n\", response.GetErrorMessage()));\n }\n }\n }\n}"
"/v3/REST/messagestatistics":
get:
x-seo:
title: "Message Statistics"
description: "Retrieve message-based aggregated delivery and engagement statistics. Message-based stats link the delivery rates / contact engagement details to the\u2026"
deprecated: true
tags:
- Deprecated Endpoints
summary: Message Statistics
description: "Retrieve message-based aggregated delivery and engagement statistics. Message-based stats link the delivery rates / contact engagement details to the sending time of the messages. If no query parameters are used, the stats shown will be for messages sent since 00:00 UTC on the current day.\n\n> Note: This is a legacy endpoint. We advise using /statcounters to retrieve message-based aggregated stats.\n"
operationId: get_v3_messagestatistics
parameters:
- name: CampaignID
in: query
schema:
$ref: '#/components/schemas/get_v3_messagestatistics_QueryParams/properties/CampaignID'
- name: ContactEmail
in: query
schema:
$ref: '#/components/schemas/get_v3_messagestatistics_QueryParams/properties/ContactEmail'
- name: ContactID
in: query
schema:
$ref: '#/components/schemas/get_v3_messagestatistics_QueryParams/properties/ContactID'
- name: ContactListID
in: query
schema:
$ref: '#/components/schemas/get_v3_messagestatistics_QueryParams/properties/ContactListID'
- name: ContactsList
in: query
schema:
$ref: '#/components/schemas/get_v3_messagestatistics_QueryParams/properties/ContactsList'
- name: CustomCampaign
in: query
schema:
$ref: '#/components/schemas/get_v3_messagestatistics_QueryParams/properties/CustomCampaign'
- name: From
in: query
schema:
$ref: '#/components/schemas/get_v3_messagestatistics_QueryParams/properties/From'
- name: FromDomain
in: query
schema:
$ref: '#/components/schemas/get_v3_messagestatistics_QueryParams/properties/FromDomain'
- name: FromID
in: query
schema:
$ref: '#/components/schemas/get_v3_messagestatistics_QueryParams/properties/FromID'
- name: FromTS
in: query
schema:
$ref: '#/components/schemas/get_v3_messagestatistics_QueryParams/properties/FromTS'
- name: FromType
in: query
schema:
$ref: '#/components/schemas/get_v3_messagestatistics_QueryParams/properties/FromType'
- name: IsDeleted
in: query
schema:
$ref: '#/components/schemas/get_v3_messagestatistics_QueryParams/properties/IsDeleted'
- name: IsNewsletterTool
in: query
schema:
$ref: '#/components/schemas/get_v3_messagestatistics_QueryParams/properties/IsNewsletterTool'
- name: IsStarred
in: query
schema:
$ref: '#/components/schemas/get_v3_messagestatistics_QueryParams/properties/IsStarred'
- name: MessageStatus
in: query
schema:
$ref: '#/components/schemas/get_v3_messagestatistics_QueryParams/properties/MessageStatus'
- name: Period
in: query
schema:
$ref: '#/components/schemas/get_v3_messagestatistics_QueryParams/properties/Period'
- name: ProcessTotalClicksCount
in: query
schema:
$ref: '#/components/schemas/get_v3_messagestatistics_QueryParams/properties/ProcessTotalClicksCount'
- name: ProcessTotalOpensCount
in: query
schema:
$ref: '#/components/schemas/get_v3_messagestatistics_QueryParams/properties/ProcessTotalOpensCount'
- name: ToTS
in: query
schema:
$ref: '#/components/schemas/get_v3_messagestatistics_QueryParams/properties/ToTS'
responses:
'200':
description: Default OK response for `/messagestatistics`
content:
application/json:
schema:
type: object
properties:
Count:
description: Indicates the number of objects in the `Data` array.
type: integer
format: int64
examples:
- 1
Data:
description: A JSON array containing a list of objects returned by this endpoint.
type: array
items:
$ref: '#/components/schemas/OutputMessagestatistics'
Total:
description: Indicates the number of objects in the `Data` array.
type: integer
format: int64
examples:
- 1
'400':
$ref: '#/components/responses/400'
'401':
$ref: '#/components/responses/401'
'403':
$ref: '#/components/responses/403'
'404':
$ref: '#/components/responses/404'
'429':
$ref: '#/components/responses/429'
'500':
$ref: '#/components/responses/500'
security:
- basicAuth: []
x-codeSamples:
- lang: curl
label: cURL
source: "curl -s \\\n\t-X GET \\\n\t--user \"$MJ_APIKEY_PUBLIC:$MJ_APIKEY_PRIVATE\" \\\n\thttps://api.mailjet.com/v3/REST/messagestatistics \\"
- lang: PHP
label: PHP
source: " 'v3']);\n$response = $mj->get(Resources::$Messagestatistics);\n$response->success() && var_dump($response->getData());\n?>"
- lang: Node.js
label: Node
source: "const mailjet = require ('node-mailjet')\n\t.connect(process.env.MJ_APIKEY_PUBLIC, process.env.MJ_APIKEY_PRIVATE)\nconst request = mailjet\n\t.get(\"messagestatistics\", {'version': 'v3'})\n\t.request()\nrequest\n\t.then((result) => {\n\t\tconsole.log(result.body)\n\t})\n\t.catch((err) => {\n\t\tconsole.log(err.statusCode)\n\t})"
- lang: Ruby
label: Ruby
source: "require 'mailjet'\nMailjet.configure do |config|\n config.api_key = ENV['MJ_APIKEY_PUBLIC']\n config.secret_key = ENV['MJ_APIKEY_PRIVATE']\n config.api_version = \"v3\"\nend\nvariable = Mailjet::Messagestatistics.all(\n)\np variable.attributes['Data']"
- lang: Python
label: Python
source: "from mailjet_rest import Client\nimport os\napi_key = os.environ['MJ_APIKEY_PUBLIC']\napi_secret = os.environ['MJ_APIKEY_PRIVATE']\nmailjet = Client(auth=(api_key, api_secret), version='v3')\nresult = mailjet.messagestatistics.get()\nprint result.status_code\nprint result.json()"
- lang: Java
label: Java
source: "package com.my.project;\nimport com.mailjet.client.errors.MailjetException;\nimport com.mailjet.client.errors.MailjetSocketTimeoutException;\nimport com.mailjet.client.MailjetClient;\nimport com.mailjet.client.MailjetRequest;\nimport com.mailjet.client.MailjetResponse;\nimport com.mailjet.client.ClientOptions;\nimport com.mailjet.client.resource.Messagestatistics;\nimport org.json.JSONArray;\nimport org.json.JSONObject;\npublic class MyClass {\n public static void main(String[] args) throws MailjetException, MailjetSocketTimeoutException {\n MailjetClient client;\n MailjetRequest request;\n MailjetResponse response;\n client = new MailjetClient(System.getenv(\"MJ_APIKEY_PUBLIC\"), System.getenv(\"MJ_APIKEY_PRIVATE\"), new ClientOptions(\"v3\"));\n request = new MailjetRequest(Messagestatistics.resource);\n response = client.get(request);\n System.out.println(response.getStatus());\n System.out.println(response.getData());\n }\n}"
- lang: Go
label: Go
source: "package main\nimport (\n\t\"fmt\"\n\t\"log\"\n\t\"os\"\n\tmailjet \"github.com/mailjet/mailjet-apiv3-go\"\n\t\"github.com/mailjet/mailjet-apiv3-go/resources\"\n)\nfunc main () {\n\tmailjetClient := NewMailjetClient(os.Getenv(\"MJ_APIKEY_PUBLIC\"), os.Getenv(\"MJ_APIKEY_PRIVATE\"))\n\tvar data []resources.Messagestatistics\n\t_, _, err := mailjetClient.List(\"messagestatistics\", &data)\n\tif err != nil {\n\t fmt.Println(err)\n\t}\n\tfmt.Printf(\"Data array: %+v\\n\", data)\n}"
- lang: C#
label: C#
source: "using Mailjet.Client;\nusing Mailjet.Client.Resources;\nusing System;\nusing Newtonsoft.Json.Linq;\nnamespace Mailjet.ConsoleApplication\n{\n class Program\n {\n static void Main(string[] args)\n {\n RunAsync().Wait();\n }\n static async Task RunAsync()\n {\n MailjetClient client = new MailjetClient(Environment.GetEnvironmentVariable(\"MJ_APIKEY_PUBLIC\"), Environment.GetEnvironmentVariable(\"MJ_APIKEY_PRIVATE\"))\n {\n Version = ApiVersion.V3,\n };\n MailjetRequest request = new MailjetRequest\n {\n Resource = Messagestatistics.Resource,\n }\n MailjetResponse response = await client.GetAsync(request);\n if (response.IsSuccessStatusCode)\n {\n Console.WriteLine(string.Format(\"Total: {0}, Count: {1}\\n\", response.GetTotal(), response.GetCount()));\n Console.WriteLine(response.GetData());\n }\n else\n {\n Console.WriteLine(string.Format(\"StatusCode: {0}\\n\", response.StatusCode));\n Console.WriteLine(string.Format(\"ErrorInfo: {0}\\n\", response.GetErrorInfo()));\n Console.WriteLine(response.GetData());\n Console.WriteLine(string.Format(\"ErrorMessage: {0}\\n\", response.GetErrorMessage()));\n }\n }\n }\n}"
/v3/REST/messagestatistics/{message_ID}:
get:
x-seo:
title: "Message Statistics by ID"
description: "Retrieve delivery and engagement statistics for a specific message. Message-based stats link the delivery rates / contact engagement details to the\u2026"
deprecated: true
tags:
- Deprecated Endpoints
summary: Message Statistics by ID
description: Retrieve delivery and engagement statistics for a specific message. Message-based stats link the delivery rates / contact engagement details to the sending time of the messages. To obtain a valid `message_ID`, first call `GET /v3/REST/message` to list your messages. This endpoint does not support retrieval by individual message ID and always returns global statistics, regardless of the `message_ID` supplied.
operationId: get_v3_messagestatistics_id
parameters:
- name: message_ID
in: path
schema:
$ref: '#/components/schemas/get_v3_messagestatistics_id_PathParams/properties/message_ID'
required: true
example: 7000
responses:
'200':
description: Default OK response for `/messagestatistics`
content:
application/json:
schema:
type: object
properties:
Count:
description: Indicates the number of objects in the `Data` array.
type: integer
format: int64
examples:
- 1
Data:
description: A JSON array containing a list of objects returned by this endpoint.
type: array
items:
$ref: '#/components/schemas/OutputMessagestatistics'
Total:
description: Indicates the number of objects in the `Data` array.
type: integer
format: int64
examples:
- 1
'400':
$ref: '#/components/responses/400'
'401':
$ref: '#/components/responses/401'
'403':
$ref: '#/components/responses/403'
'404':
$ref: '#/components/responses/404'
'429':
$ref: '#/components/responses/429'
'500':
$ref: '#/components/responses/500'
security:
- basicAuth: []
x-codeSamples:
- lang: curl
label: cURL
source: "curl -s \\\n\t-X GET \\\n\t--user \"$MJ_APIKEY_PUBLIC:$MJ_APIKEY_PRIVATE\" \\\n\thttps://api.mailjet.com/v3/REST/messagestatistics/$message_ID \\"
- lang: PHP
label: PHP
source: " 'v3']);\n$response = $mj->get(Resources::$Messagestatistics, ['id' => $id]);\n$response->success() && var_dump($response->getData());\n?>"
- lang: Node.js
label: Node
source: "const mailjet = require ('node-mailjet')\n\t.connect(process.env.MJ_APIKEY_PUBLIC, process.env.MJ_APIKEY_PRIVATE)\nconst request = mailjet\n\t.get(\"messagestatistics\", {'version': 'v3'})\n\t.id($message_ID)\n\t.request()\nrequest\n\t.then((result) => {\n\t\tconsole.log(result.body)\n\t})\n\t.catch((err) => {\n\t\tconsole.log(err.statusCode)\n\t})"
- lang: Ruby
label: Ruby
source: "require 'mailjet'\nMailjet.configure do |config|\n config.api_key = ENV['MJ_APIKEY_PUBLIC']\n config.secret_key = ENV['MJ_APIKEY_PRIVATE']\n config.api_version = \"v3\"\nend\nvariable = Mailjet::Messagestatistics.find($message_ID\n)\np variable.attributes['Data']"
- lang: Python
label: Python
source: "from mailjet_rest import Client\nimport os\napi_key = os.environ['MJ_APIKEY_PUBLIC']\napi_secret = os.environ['MJ_APIKEY_PRIVATE']\nmailjet = Client(auth=(api_key, api_secret), version='v3')\nid = '$message_ID'\nresult = mailjet.messagestatistics.get(id=id)\nprint result.status_code\nprint result.json()"
- lang: Java
label: Java
source: "package com.my.project;\nimport com.mailjet.client.errors.MailjetException;\nimport com.mailjet.client.errors.MailjetSocketTimeoutException;\nimport com.mailjet.client.MailjetClient;\nimport com.mailjet.client.MailjetRequest;\nimport com.mailjet.client.MailjetResponse;\nimport com.mailjet.client.ClientOptions;\nimport com.mailjet.client.resource.Messagestatistics;\nimport org.json.JSONArray;\nimport org.json.JSONObject;\npublic class MyClass {\n public static void main(String[] args) throws MailjetException, MailjetSocketTimeoutException {\n MailjetClient client;\n MailjetRequest request;\n MailjetResponse response;\n client = new MailjetClient(System.getenv(\"MJ_APIKEY_PUBLIC\"), System.getenv(\"MJ_APIKEY_PRIVATE\"), new ClientOptions(\"v3\"));\n request = new MailjetRequest(Messagestatistics.resource, ID);\n response = client.get(request);\n System.out.println(response.getStatus());\n System.out.println(response.getData());\n }\n}"
- lang: Go
label: Go
source: "package main\nimport (\n\t\"fmt\"\n\t\"log\"\n\t\"os\"\n\tmailjet \"github.com/mailjet/mailjet-apiv3-go\"\n\t\"github.com/mailjet/mailjet-apiv3-go/resources\"\n)\nfunc main () {\n\tmailjetClient := NewMailjetClient(os.Getenv(\"MJ_APIKEY_PUBLIC\"), os.Getenv(\"MJ_APIKEY_PRIVATE\"))\n\tvar data []resources.Messagestatistics\n\tmr := &Request{\n\t Resource: \"messagestatistics\",\n\t ID: RESOURCE_ID,\n\t}\n\terr := mailjetClient.Get(mr, &data)\n\tif err != nil {\n\t fmt.Println(err)\n\t}\n\tfmt.Printf(\"Data array: %+v\\n\", data)\n}"
- lang: C#
label: C#
source: "using Mailjet.Client;\nusing Mailjet.Client.Resources;\nusing System;\nusing Newtonsoft.Json.Linq;\nnamespace Mailjet.ConsoleApplication\n{\n class Program\n {\n static void Main(string[] args)\n {\n RunAsync().Wait();\n }\n static async Task RunAsync()\n {\n MailjetClient client = new MailjetClient(Environment.GetEnvironmentVariable(\"MJ_APIKEY_PUBLIC\"), Environment.GetEnvironmentVariable(\"MJ_APIKEY_PRIVATE\"))\n {\n Version = ApiVersion.V3,\n };\n MailjetRequest request = new MailjetRequest\n {\n Resource = Messagestatistics.Resource,\n ResourceId = ResourceId.Numeric(ID)\n }\n MailjetResponse response = await client.GetAsync(request);\n if (response.IsSuccessStatusCode)\n {\n Console.WriteLine(string.Format(\"Total: {0}, Count: {1}\\n\", response.GetTotal(), response.GetCount()));\n Console.WriteLine(response.GetData());\n }\n else\n {\n Console.WriteLine(string.Format(\"StatusCode: {0}\\n\", response.StatusCode));\n Console.WriteLine(string.Format(\"ErrorInfo: {0}\\n\", response.GetErrorInfo()));\n Console.WriteLine(response.GetData());\n Console.WriteLine(string.Format(\"ErrorMessage: {0}\\n\", response.GetErrorMessage()));\n }\n }\n }\n}"
"/v3/REST/openstatistics":
get:
x-seo:
title: "Open Statistics"
description: "Retrieve aggregated statistics on emails opened at least once by their recipients. If no query parameters are used, the statistics shown will be for open\u2026"
deprecated: true
tags:
- Deprecated Endpoints
summary: Open Statistics
description: "Retrieve aggregated statistics on emails opened at least once by their recipients. If no query parameters are used, the statistics shown will be for open events since 00:00 UTC on the current day.\n\n> Note: This is a legacy endpoint. We advise using /statcounters to retrieve message-based aggregated stats.\n"
operationId: get_v3_openstatistics
parameters:
- name: CampaignID
in: query
schema:
$ref: '#/components/schemas/get_v3_openstatistics_QueryParams/properties/CampaignID'
- name: ContactsList
in: query
schema:
$ref: '#/components/schemas/get_v3_openstatistics_QueryParams/properties/ContactsList'
- name: CustomCampaign
in: query
schema:
$ref: '#/components/schemas/get_v3_openstatistics_QueryParams/properties/CustomCampaign'
- name: From
in: query
schema:
$ref: '#/components/schemas/get_v3_openstatistics_QueryParams/properties/From'
- name: FromDomain
in: query
schema:
$ref: '#/components/schemas/get_v3_openstatistics_QueryParams/properties/FromDomain'
- name: FromID
in: query
schema:
$ref: '#/components/schemas/get_v3_openstatistics_QueryParams/properties/FromID'
- name: FromTS
in: query
schema:
$ref: '#/components/schemas/get_v3_openstatistics_QueryParams/properties/FromTS'
- name: FromType
in: query
schema:
$ref: '#/components/schemas/get_v3_openstatistics_QueryParams/properties/FromType'
- name: IsDeleted
in: query
schema:
$ref: '#/components/schemas/get_v3_openstatistics_QueryParams/properties/IsDeleted'
- name: IsNewsletterTool
in: query
schema:
$ref: '#/components/schemas/get_v3_openstatistics_QueryParams/properties/IsNewsletterTool'
- name: IsStarred
in: query
schema:
$ref: '#/components/schemas/get_v3_openstatistics_QueryParams/properties/IsStarred'
- name: MessageStatus
in: query
schema:
$ref: '#/components/schemas/get_v3_openstatistics_QueryParams/properties/MessageStatus'
- name: Period
in: query
schema:
$ref: '#/components/schemas/get_v3_openstatistics_QueryParams/properties/Period'
- name: ToTS
in: query
schema:
$ref: '#/components/schemas/get_v3_openstatistics_QueryParams/properties/ToTS'
responses:
'200':
description: Default OK response for /openstatistics
content:
application/json:
schema:
type: object
properties:
Count:
description: Indicates the number of objects in the `Data` array.
type: integer
format: int64
examples:
- 1
Data:
description: A JSON array containing a list of objects returned by this endpoint.
type: array
items:
$ref: '#/components/schemas/OutputOpenstatistics'
Total:
description: Indicates the number of objects in the `Data` array.
type: integer
format: int64
examples:
- 1
'400':
$ref: '#/components/responses/400'
'401':
$ref: '#/components/responses/401'
'403':
$ref: '#/components/responses/403'
'404':
$ref: '#/components/responses/404'
'429':
$ref: '#/components/responses/429'
'500':
$ref: '#/components/responses/500'
security:
- basicAuth: []
x-codeSamples:
- lang: curl
label: cURL
source: "curl -s \\\n\t-X GET \\\n\t--user \"$MJ_APIKEY_PUBLIC:$MJ_APIKEY_PRIVATE\" \\\n\thttps://api.mailjet.com/v3/REST/openstatistics \\"
- lang: PHP
label: PHP
source: " 'v3']);\n$response = $mj->get(Resources::$Openstatistics);\n$response->success() && var_dump($response->getData());\n?>"
- lang: Node.js
label: Node
source: "const mailjet = require ('node-mailjet')\n\t.connect(process.env.MJ_APIKEY_PUBLIC, process.env.MJ_APIKEY_PRIVATE)\nconst request = mailjet\n\t.get(\"openstatistics\", {'version': 'v3'})\n\t.request()\nrequest\n\t.then((result) => {\n\t\tconsole.log(result.body)\n\t})\n\t.catch((err) => {\n\t\tconsole.log(err.statusCode)\n\t})"
- lang: Ruby
label: Ruby
source: "require 'mailjet'\nMailjet.configure do |config|\n config.api_key = ENV['MJ_APIKEY_PUBLIC']\n config.secret_key = ENV['MJ_APIKEY_PRIVATE']\n config.api_version = \"v3\"\nend\nvariable = Mailjet::Openstatistics.all(\n)\np variable.attributes['Data']"
- lang: Python
label: Python
source: "from mailjet_rest import Client\nimport os\napi_key = os.environ['MJ_APIKEY_PUBLIC']\napi_secret = os.environ['MJ_APIKEY_PRIVATE']\nmailjet = Client(auth=(api_key, api_secret), version='v3')\nresult = mailjet.openstatistics.get()\nprint result.status_code\nprint result.json()"
- lang: Java
label: Java
source: "package com.my.project;\nimport com.mailjet.client.errors.MailjetException;\nimport com.mailjet.client.errors.MailjetSocketTimeoutException;\nimport com.mailjet.client.MailjetClient;\nimport com.mailjet.client.MailjetRequest;\nimport com.mailjet.client.MailjetResponse;\nimport com.mailjet.client.ClientOptions;\nimport com.mailjet.client.resource.Openstatistics;\nimport org.json.JSONArray;\nimport org.json.JSONObject;\npublic class MyClass {\n public static void main(String[] args) throws MailjetException, MailjetSocketTimeoutException {\n MailjetClient client;\n MailjetRequest request;\n MailjetResponse response;\n client = new MailjetClient(System.getenv(\"MJ_APIKEY_PUBLIC\"), System.getenv(\"MJ_APIKEY_PRIVATE\"), new ClientOptions(\"v3\"));\n request = new MailjetRequest(Openstatistics.resource);\n response = client.get(request);\n System.out.println(response.getStatus());\n System.out.println(response.getData());\n }\n}"
- lang: Go
label: Go
source: "package main\nimport (\n\t\"fmt\"\n\t\"log\"\n\t\"os\"\n\tmailjet \"github.com/mailjet/mailjet-apiv3-go\"\n\t\"github.com/mailjet/mailjet-apiv3-go/resources\"\n)\nfunc main () {\n\tmailjetClient := NewMailjetClient(os.Getenv(\"MJ_APIKEY_PUBLIC\"), os.Getenv(\"MJ_APIKEY_PRIVATE\"))\n\tvar data []resources.Openstatistics\n\t_, _, err := mailjetClient.List(\"openstatistics\", &data)\n\tif err != nil {\n\t fmt.Println(err)\n\t}\n\tfmt.Printf(\"Data array: %+v\\n\", data)\n}"
- lang: C#
label: C#
source: "using Mailjet.Client;\nusing Mailjet.Client.Resources;\nusing System;\nusing Newtonsoft.Json.Linq;\nnamespace Mailjet.ConsoleApplication\n{\n class Program\n {\n static void Main(string[] args)\n {\n RunAsync().Wait();\n }\n static async Task RunAsync()\n {\n MailjetClient client = new MailjetClient(Environment.GetEnvironmentVariable(\"MJ_APIKEY_PUBLIC\"), Environment.GetEnvironmentVariable(\"MJ_APIKEY_PRIVATE\"))\n {\n Version = ApiVersion.V3,\n };\n MailjetRequest request = new MailjetRequest\n {\n Resource = Openstatistics.Resource,\n }\n MailjetResponse response = await client.GetAsync(request);\n if (response.IsSuccessStatusCode)\n {\n Console.WriteLine(string.Format(\"Total: {0}, Count: {1}\\n\", response.GetTotal(), response.GetCount()));\n Console.WriteLine(response.GetData());\n }\n else\n {\n Console.WriteLine(string.Format(\"StatusCode: {0}\\n\", response.StatusCode));\n Console.WriteLine(string.Format(\"ErrorInfo: {0}\\n\", response.GetErrorInfo()));\n Console.WriteLine(response.GetData());\n Console.WriteLine(string.Format(\"ErrorMessage: {0}\\n\", response.GetErrorMessage()));\n }\n }\n }\n}"
"/v3/REST/senderstatistics":
get:
x-seo:
title: "Sender Statistics"
description: "Retrieve a list of overall aggregated delivery and engagement statistics, grouped by sender ID. Note: This is a legacy endpoint. We advise using\u2026"
deprecated: true
tags:
- Deprecated Endpoints
summary: Sender Statistics
description: "Retrieve a list of overall aggregated delivery and engagement statistics, grouped by sender ID.\n\n> Note: This is a legacy endpoint. We advise using `/statcounters` to retrieve aggregated statistics for senders.\n"
operationId: get_v3_senderstatistics
parameters:
- name: Domain
in: query
schema:
$ref: '#/components/schemas/get_v3_senderstatistics_QueryParams/properties/Domain'
- name: Email
in: query
schema:
$ref: '#/components/schemas/get_v3_senderstatistics_QueryParams/properties/Email'
- name: Sender
in: query
schema:
$ref: '#/components/schemas/get_v3_senderstatistics_QueryParams/properties/Sender'
responses:
'200':
description: Default OK response for `/senderstatistics`
content:
application/json:
schema:
type: object
properties:
Count:
description: Indicates the number of objects in the `Data` array.
type: integer
format: int64
examples:
- 1
Data:
description: A JSON array containing a list of objects returned by this endpoint.
type: array
items:
$ref: '#/components/schemas/OutputSenderstatistics'
Total:
description: Indicates the number of objects in the `Data` array.
type: integer
format: int64
examples:
- 1
'400':
$ref: '#/components/responses/400'
'401':
$ref: '#/components/responses/401'
'403':
$ref: '#/components/responses/403'
'404':
$ref: '#/components/responses/404'
'429':
$ref: '#/components/responses/429'
'500':
$ref: '#/components/responses/500'
security:
- basicAuth: []
x-codeSamples:
- lang: curl
label: cURL
source: "curl -s \\\n\t-X GET \\\n\t--user \"$MJ_APIKEY_PUBLIC:$MJ_APIKEY_PRIVATE\" \\\n\thttps://api.mailjet.com/v3/REST/senderstatistics \\"
- lang: PHP
label: PHP
source: " 'v3']);\n$response = $mj->get(Resources::$Senderstatistics);\n$response->success() && var_dump($response->getData());\n?>"
- lang: Node.js
label: Node
source: "const mailjet = require ('node-mailjet')\n\t.connect(process.env.MJ_APIKEY_PUBLIC, process.env.MJ_APIKEY_PRIVATE)\nconst request = mailjet\n\t.get(\"senderstatistics\", {'version': 'v3'})\n\t.request()\nrequest\n\t.then((result) => {\n\t\tconsole.log(result.body)\n\t})\n\t.catch((err) => {\n\t\tconsole.log(err.statusCode)\n\t})"
- lang: Ruby
label: Ruby
source: "require 'mailjet'\nMailjet.configure do |config|\n config.api_key = ENV['MJ_APIKEY_PUBLIC']\n config.secret_key = ENV['MJ_APIKEY_PRIVATE']\n config.api_version = \"v3\"\nend\nvariable = Mailjet::Senderstatistics.all(\n)\np variable.attributes['Data']"
- lang: Python
label: Python
source: "from mailjet_rest import Client\nimport os\napi_key = os.environ['MJ_APIKEY_PUBLIC']\napi_secret = os.environ['MJ_APIKEY_PRIVATE']\nmailjet = Client(auth=(api_key, api_secret), version='v3')\nresult = mailjet.senderstatistics.get()\nprint result.status_code\nprint result.json()"
- lang: Java
label: Java
source: "package com.my.project;\nimport com.mailjet.client.errors.MailjetException;\nimport com.mailjet.client.errors.MailjetSocketTimeoutException;\nimport com.mailjet.client.MailjetClient;\nimport com.mailjet.client.MailjetRequest;\nimport com.mailjet.client.MailjetResponse;\nimport com.mailjet.client.ClientOptions;\nimport com.mailjet.client.resource.Senderstatistics;\nimport org.json.JSONArray;\nimport org.json.JSONObject;\npublic class MyClass {\n public static void main(String[] args) throws MailjetException, MailjetSocketTimeoutException {\n MailjetClient client;\n MailjetRequest request;\n MailjetResponse response;\n client = new MailjetClient(System.getenv(\"MJ_APIKEY_PUBLIC\"), System.getenv(\"MJ_APIKEY_PRIVATE\"), new ClientOptions(\"v3\"));\n request = new MailjetRequest(Senderstatistics.resource);\n response = client.get(request);\n System.out.println(response.getStatus());\n System.out.println(response.getData());\n }\n}"
- lang: Go
label: Go
source: "package main\nimport (\n\t\"fmt\"\n\t\"log\"\n\t\"os\"\n\tmailjet \"github.com/mailjet/mailjet-apiv3-go\"\n\t\"github.com/mailjet/mailjet-apiv3-go/resources\"\n)\nfunc main () {\n\tmailjetClient := NewMailjetClient(os.Getenv(\"MJ_APIKEY_PUBLIC\"), os.Getenv(\"MJ_APIKEY_PRIVATE\"))\n\tvar data []resources.Senderstatistics\n\t_, _, err := mailjetClient.List(\"senderstatistics\", &data)\n\tif err != nil {\n\t fmt.Println(err)\n\t}\n\tfmt.Printf(\"Data array: %+v\\n\", data)\n}"
- lang: C#
label: C#
source: "using Mailjet.Client;\nusing Mailjet.Client.Resources;\nusing System;\nusing Newtonsoft.Json.Linq;\nnamespace Mailjet.ConsoleApplication\n{\n class Program\n {\n static void Main(string[] args)\n {\n RunAsync().Wait();\n }\n static async Task RunAsync()\n {\n MailjetClient client = new MailjetClient(Environment.GetEnvironmentVariable(\"MJ_APIKEY_PUBLIC\"), Environment.GetEnvironmentVariable(\"MJ_APIKEY_PRIVATE\"))\n {\n Version = ApiVersion.V3,\n };\n MailjetRequest request = new MailjetRequest\n {\n Resource = Senderstatistics.Resource,\n }\n MailjetResponse response = await client.GetAsync(request);\n if (response.IsSuccessStatusCode)\n {\n Console.WriteLine(string.Format(\"Total: {0}, Count: {1}\\n\", response.GetTotal(), response.GetCount()));\n Console.WriteLine(response.GetData());\n }\n else\n {\n Console.WriteLine(string.Format(\"StatusCode: {0}\\n\", response.StatusCode));\n Console.WriteLine(string.Format(\"ErrorInfo: {0}\\n\", response.GetErrorInfo()));\n Console.WriteLine(response.GetData());\n Console.WriteLine(string.Format(\"ErrorMessage: {0}\\n\", response.GetErrorMessage()));\n }\n }\n }\n}"
/v3/REST/senderstatistics/{sender_ID}:
get:
x-seo:
title: "Sender Statistics by ID"
description: "Retrieve a list of overall aggregated delivery and engagement statistics for a specific sender ID. Note: This is a legacy endpoint. We advise using\u2026"
deprecated: true
tags:
- Deprecated Endpoints
summary: Sender Statistics by ID
description: "Retrieve a list of overall aggregated delivery and engagement statistics for a specific sender ID.\n\n> Note: This is a legacy endpoint. We advise using `/statcounters` to retrieve aggregated statistics for senders.\n To obtain a valid `sender_ID`, first call `GET /v3/REST/sender` to list your senders."
operationId: get_v3_senderstatistics_id
parameters:
- name: sender_ID
in: path
schema:
$ref: '#/components/schemas/get_v3_senderstatistics_id_PathParams/properties/sender_ID'
required: true
example: 8000
responses:
'200':
description: Default OK response for `/senderstatistics`
content:
application/json:
schema:
type: object
properties:
Count:
description: Indicates the number of objects in the `Data` array.
type: integer
format: int64
examples:
- 1
Data:
description: A JSON array containing a list of objects returned by this endpoint.
type: array
items:
$ref: '#/components/schemas/OutputSenderstatistics'
Total:
description: Indicates the number of objects in the `Data` array.
type: integer
format: int64
examples:
- 1
'400':
$ref: '#/components/responses/400'
'401':
$ref: '#/components/responses/401'
'403':
$ref: '#/components/responses/403'
'404':
$ref: '#/components/responses/404'
'429':
$ref: '#/components/responses/429'
'500':
$ref: '#/components/responses/500'
security:
- basicAuth: []
x-codeSamples:
- lang: curl
label: cURL
source: "curl -s \\\n\t-X GET \\\n\t--user \"$MJ_APIKEY_PUBLIC:$MJ_APIKEY_PRIVATE\" \\\n\thttps://api.mailjet.com/v3/REST/senderstatistics/$sender_ID \\"
- lang: PHP
label: PHP
source: " 'v3']);\n$response = $mj->get(Resources::$Senderstatistics, ['id' => $id]);\n$response->success() && var_dump($response->getData());\n?>"
- lang: Node.js
label: Node
source: "const mailjet = require ('node-mailjet')\n\t.connect(process.env.MJ_APIKEY_PUBLIC, process.env.MJ_APIKEY_PRIVATE)\nconst request = mailjet\n\t.get(\"senderstatistics\", {'version': 'v3'})\n\t.id($sender_ID)\n\t.request()\nrequest\n\t.then((result) => {\n\t\tconsole.log(result.body)\n\t})\n\t.catch((err) => {\n\t\tconsole.log(err.statusCode)\n\t})"
- lang: Ruby
label: Ruby
source: "require 'mailjet'\nMailjet.configure do |config|\n config.api_key = ENV['MJ_APIKEY_PUBLIC']\n config.secret_key = ENV['MJ_APIKEY_PRIVATE']\n config.api_version = \"v3\"\nend\nvariable = Mailjet::Senderstatistics.find($sender_ID\n)\np variable.attributes['Data']"
- lang: Python
label: Python
source: "from mailjet_rest import Client\nimport os\napi_key = os.environ['MJ_APIKEY_PUBLIC']\napi_secret = os.environ['MJ_APIKEY_PRIVATE']\nmailjet = Client(auth=(api_key, api_secret), version='v3')\nid = '$sender_ID'\nresult = mailjet.senderstatistics.get(id=id)\nprint result.status_code\nprint result.json()"
- lang: Java
label: Java
source: "package com.my.project;\nimport com.mailjet.client.errors.MailjetException;\nimport com.mailjet.client.errors.MailjetSocketTimeoutException;\nimport com.mailjet.client.MailjetClient;\nimport com.mailjet.client.MailjetRequest;\nimport com.mailjet.client.MailjetResponse;\nimport com.mailjet.client.ClientOptions;\nimport com.mailjet.client.resource.Senderstatistics;\nimport org.json.JSONArray;\nimport org.json.JSONObject;\npublic class MyClass {\n public static void main(String[] args) throws MailjetException, MailjetSocketTimeoutException {\n MailjetClient client;\n MailjetRequest request;\n MailjetResponse response;\n client = new MailjetClient(System.getenv(\"MJ_APIKEY_PUBLIC\"), System.getenv(\"MJ_APIKEY_PRIVATE\"), new ClientOptions(\"v3\"));\n request = new MailjetRequest(Senderstatistics.resource, ID);\n response = client.get(request);\n System.out.println(response.getStatus());\n System.out.println(response.getData());\n }\n}"
- lang: Go
label: Go
source: "package main\nimport (\n\t\"fmt\"\n\t\"log\"\n\t\"os\"\n\tmailjet \"github.com/mailjet/mailjet-apiv3-go\"\n\t\"github.com/mailjet/mailjet-apiv3-go/resources\"\n)\nfunc main () {\n\tmailjetClient := NewMailjetClient(os.Getenv(\"MJ_APIKEY_PUBLIC\"), os.Getenv(\"MJ_APIKEY_PRIVATE\"))\n\tvar data []resources.Senderstatistics\n\tmr := &Request{\n\t Resource: \"senderstatistics\",\n\t ID: RESOURCE_ID,\n\t}\n\terr := mailjetClient.Get(mr, &data)\n\tif err != nil {\n\t fmt.Println(err)\n\t}\n\tfmt.Printf(\"Data array: %+v\\n\", data)\n}"
- lang: C#
label: C#
source: "using Mailjet.Client;\nusing Mailjet.Client.Resources;\nusing System;\nusing Newtonsoft.Json.Linq;\nnamespace Mailjet.ConsoleApplication\n{\n class Program\n {\n static void Main(string[] args)\n {\n RunAsync().Wait();\n }\n static async Task RunAsync()\n {\n MailjetClient client = new MailjetClient(Environment.GetEnvironmentVariable(\"MJ_APIKEY_PUBLIC\"), Environment.GetEnvironmentVariable(\"MJ_APIKEY_PRIVATE\"))\n {\n Version = ApiVersion.V3,\n };\n MailjetRequest request = new MailjetRequest\n {\n Resource = Senderstatistics.Resource,\n ResourceId = ResourceId.Numeric(ID)\n }\n MailjetResponse response = await client.GetAsync(request);\n if (response.IsSuccessStatusCode)\n {\n Console.WriteLine(string.Format(\"Total: {0}, Count: {1}\\n\", response.GetTotal(), response.GetCount()));\n Console.WriteLine(response.GetData());\n }\n else\n {\n Console.WriteLine(string.Format(\"StatusCode: {0}\\n\", response.StatusCode));\n Console.WriteLine(string.Format(\"ErrorInfo: {0}\\n\", response.GetErrorInfo()));\n Console.WriteLine(response.GetData());\n Console.WriteLine(string.Format(\"ErrorMessage: {0}\\n\", response.GetErrorMessage()));\n }\n }\n }\n}"
components:
schemas:
get_v3_apikey_QueryParams:
type: object
properties:
APIKey:
type: string
description: Retrieves the selected API Key.
IsActive:
type: boolean
description: When true, only active API Keys will be retrieved. When false, active API Keys will be excluded from the result.
IsMaster:
type: boolean
description: When true, only the Primary API Key will be retrieved. When false, the Primary API Key will be excluded from the result.
Name:
type: string
description: Retrieves the API Key with the specified name.
Limit:
type: integer
description: "Limit the response to a select number of returned objects.\n\nDefault value: `10`. Maximum value: `1000`\n"
Offset:
type: integer
description: "Retrieve a list of objects starting from a certain offset. Combine this query parameter with `Limit` to retrieve a specific section of the list of objects.\n\nDefault value: `0`\n"
countOnly:
type: boolean
description: "Set the value of this query parameter to `1` to retrieve the overall number of objects returned by this request for your API Key. No list of results will be returned - the objects will simply be counted.\n\nDefault value: `0`\n\nNote: When you send a request without the `countOnly` query parameter, `Count` and `Total` will only return the number of extracted elements and not the overall number.\n"
Sort:
type: string
description: "Specify a property name for this query parameter to sort the objects in `Data`. By default the sorting is ascending. When a property name is postfixed with DESC (i.e. `property_name+DESC`), the sort order will be descending.\n\nNote: Both the `Sort` query parameter and the option to select a descending order are not available for every property.\n"
get_v3_apikey_id_PathParams:
type: object
required:
- apikey_ID
properties:
apikey_ID:
type: integer
description: Unique numeric ID for the API Key you want to retrieve.
APIKey:
type: string
description: The API Key you want to retrieve. Can be used as an alternative to `apikey_ID`.
get_v3_bouncestatistics_QueryParams:
type: object
properties:
CampaignID:
type: integer
description: Retrieves only bounce events linked to the specified campaign ID.
ContactsList:
type: integer
description: Retrieves only bounce events linked to contacts from this contact list ID.
EventFromTs:
type: string
description: Retrieves information only about bounce events that happened after the specified timestamp (`BouncedAt` >= `EventFromTs`). Can be used only if the `CampaignID` query parameter is specified as well. Both Unix timestamp (e.g. 1514764800) and RFC3339 (2018-01-01T00:00:00) formats are accepted.
EventToTs:
type: string
description: Retrieves information only about bounce events that happened before the specified timestamp (`BouncedAt` <= `EventFromTs`). Can be used only if the `CampaignID` query parameter is specified as well. Both Unix timestamp (e.g. 1514764800) and RFC3339 (2018-01-01T00:00:00) formats are accepted.
FromTS:
type: string
description: Retrieves information only about bounce events linked to campaigns sent after the specified timestamp. Both Unix timestamp (e.g. 1514764800) and RFC3339 (2018-01-01T00:00:00) formats are accepted.
Period:
type: string
description: "Retrieves information only about bounce events registered between the start of the selected period and the current timestamp.\n\nPossible values:\n\n- `Day` - since the start of the current day\n- `Week` - since the start of the current week\n- `Month` - since the start of the current month\n- `Year` - since the start of the current year\n"
ToTS:
type: string
description: Retrieves information only about bounce events linked to campaigns sent before the specified timestamp. Both Unix timestamp (e.g. 1514764800) and RFC3339 (2018-01-01T00:00:00) formats are accepted.
Limit:
type: integer
description: "Limit the response to a select number of returned objects.\n\nDefault value: `10`. Maximum value: `1000`\n"
Offset:
type: integer
description: "Retrieve a list of objects starting from a certain offset. Combine this query parameter with `Limit` to retrieve a specific section of the list of objects.\n\nDefault value: `0`\n"
countOnly:
type: boolean
description: "Set the value of this query parameter to `1` to retrieve the overall number of objects returned by this request for your API Key. No list of results will be returned - the objects will simply be counted.\n\nDefault value: `0`\n\nNote: When you send a request without the `countOnly` query parameter, `Count` and `Total` will only return the number of extracted elements and not the overall number.\n"
Sort:
type: string
description: "Specify a property name for this query parameter to sort the objects in `Data`. By default the sorting is ascending. When a property name is postfixed with DESC (i.e. `property_name+DESC`), the sort order will be descending.\n\nNote: Both the `Sort` query parameter and the option to select a descending order are not available for every property.\n"
get_v3_bouncestatistics_id_PathParams:
type: object
required:
- message_ID
properties:
message_ID:
type: integer
description: Unique numeric ID of the bounced message you want to retrieve information about.
get_v3_campaign_QueryParams:
type: object
properties:
CampaignID:
type: integer
description: Retrieves only the campaign details for the specified Campaign ID.
ContactsListID:
type: integer
description: Retrieves only details for campaigns sent to the specified Contact List ID.
CustomCampaign:
type: string
description: Retrieves only details for the campaign with the specified custom value assigned to it.
From:
type: string
description: Retrieves only details for campaigns, which used the specified sender email address.
FromDomain:
type: string
description: Retrieves only details for campaigns, which used the specified sender email domain.
FromID:
type: integer
description: Retrieve only details for campaigns, which used the specified sender ID.
FromTS:
type: string
description: Retrieves only details for campaigns sent after the specified timestamp. Both Unix timestamp (e.g. 1514764800) and RFC3339 (2018-01-01T00:00:00) formats are accepted.
FromType:
type: integer
description: "Retrieves only details for campaigns of the specified type:\n\n- `1` - Transactional\n- `2` - Marketing\n- `3` - Unknown\n"
IsDeleted:
type: boolean
description: When true, only details for deleted campaigns will be returned. When false, deleted campaigns will be excluded from the response.
IsNewsletterTool:
type: boolean
description: When true, will return only details for campaigns created by the Newsletter tool (legacy template builder). When false, newsletter campaigns will be excluded from the response.
IsStarred:
type: boolean
description: When true, will return only details for campaigns marked as starred. When false, starred campaigns will be excluded from the response.
Period:
type: string
description: "Retrieves only details for campaigns sent between the start of the selected period and the current timestamp.\n\n- `Day` - since the start of the current day\n- `Week` - since the start of the current week\n- `Month` - since the start of the current month\n- `Year` - since the start of the current year\n"
ToTS:
type: string
description: Retrieves only details for campaigns sent before this timestamp.
WorkflowID:
type: integer
description: Retrieves only details for campaigns that were triggered by this automation workflow ID.
Limit:
type: integer
description: "Limit the response to a select number of returned objects.\n\nDefault value: `10`. Maximum value: `1000`\n"
Offset:
type: integer
description: "Retrieve a list of objects starting from a certain offset. Combine this query parameter with `Limit` to retrieve a specific section of the list of objects.\n\nDefault value: `0`\n"
countOnly:
type: boolean
description: "Set the value of this query parameter to `1` to retrieve the overall number of objects returned by this request for your API Key. No list of results will be returned - the objects will simply be counted.\n\nDefault value: `0`\n\nNote: When you send a request without the `countOnly` query parameter, `Count` and `Total` will only return the number of extracted elements and not the overall number.\n"
Sort:
type: string
description: "Specify a property name for this query parameter to sort the objects in `Data`. By default the sorting is ascending. When a property name is postfixed with DESC (i.e. `property_name+DESC`), the sort order will be descending.\n\nNote: Both the `Sort` query parameter and the option to select a descending order are not available for every property.\n"
get_v3_campaign_id_PathParams:
type: object
required:
- campaign_ID
properties:
campaign_ID:
type: integer
description: Unique numeric ID of the campaign you want to retrieve.
CustomCampaign:
type: string
description: The `CustomValue` of the campaign you want to retrieve. Can be used as an alternative to `campaign_ID`.
get_v3_campaigndraft_QueryParams:
type: object
properties:
AXTesting:
type: integer
description: Retrieves only the campaign draft linked to the specified AXTesting ID.
Campaign:
type: integer
description: Retrieves only the campaign draft linked to the specified Campaign ID.
ContactsList:
type: integer
description: Retrieves only the campaign drafts linked to the specified contact list ID.
DeliveredAt:
type: string
description: Retrieves only the campaign drafts, which were delivered at the specified timestamp. Both Unix timestamp (e.g. 1514764800) and RFC3339 (2018-01-01T00:00:00) formats are accepted.
EditMode:
type: string
description: "Retrieves only campaign drafts, whose email templates were edited with the specified edit tool.\n\nPossible values:\n\n- `tool2` - Passport drag-and-drop template editor\n- `html2` - HTML editor in Passport\n- `mjml` - MJML editor in Passport\n"
IsArchived:
type: boolean
description: When true, will return only archived campaign drafts. When false, archived campaign drafts will be excluded from the response.
IsCampaign:
type: boolean
description: "Only retrieves campaigndraft resources for which IsCampaign equals\nthe specified value."
IsDeleted:
type: boolean
description: When true, will return only deleted campaign drafts. When false, deleted drafts will be excluded from the response.
IsHandled:
type: boolean
description: "Only retrieves campaigndraft resources for which IsHandled equals\nthe specified value."
IsStarred:
type: boolean
description: When true, will return only starred campaign drafts. When false, starred drafts will be excluded from the response.
Modified:
type: boolean
description: "When true, will return only campaign drafts that have been modified after their creation. When false, only non-modified drafts will be returned.\n\n> Note: All campaign drafts created within the Mailjet app are marked as Modified immediately after creation, while ones created via the API are not.\n"
NewsLetterTemplate:
type: integer
description: "Only retrieves `campaigndraft` resources for which `NewsLetterTemplate`\nequals the specified value."
Segmentation:
type: integer
description: Retrieves only campaign drafts, which use the specified segmentation ID.
Status:
type: integer
description: "Retrieves only campaign drafts with the specified campaign status ID.\n\nPossible values:\n\n- `-3` - AXCanceled\n- `-2` - Deleted\n- `-1` - Archived\n- `0` - Draft\n- `1` - Programmed (scheduled)\n- `2` - Sent\n- `3` - AXTested (AB Testing versions sent, but winning version not selected yet)\n- `4` - AXSelected (AB Testing winning version selected and sent)\n"
Subject:
type: string
description: Retrieves only campaign drafts with the specified Subject line.
Template:
type: integer
description: Retrieves only campaign drafts which use the specified Template ID.
Limit:
type: integer
description: "Limit the response to a select number of returned objects.\n\nDefault value: `10`. Maximum value: `1000`\n"
Offset:
type: integer
description: "Retrieve a list of objects starting from a certain offset. Combine this query parameter with `Limit` to retrieve a specific section of the list of objects.\n\nDefault value: `0`\n"
countOnly:
type: boolean
description: "Set the value of this query parameter to `1` to retrieve the overall number of objects returned by this request for your API Key. No list of results will be returned - the objects will simply be counted.\n\nDefault value: `0`\n\nNote: When you send a request without the `countOnly` query parameter, `Count` and `Total` will only return the number of extracted elements and not the overall number.\n"
Sort:
type: string
description: "Specify a property name for this query parameter to sort the objects in `Data`. By default the sorting is ascending. When a property name is postfixed with DESC (i.e. `property_name+DESC`), the sort order will be descending.\n\nNote: Both the `Sort` query parameter and the option to select a descending order are not available for every property.\n"
get_v3_campaigndraft_id_PathParams:
type: object
required:
- draft_ID
properties:
draft_ID:
type: integer
description: Unique numeric ID of the campaign draft you want to retrieve.
get_v3_campaigngraphstatistics_QueryParams:
type: object
properties:
Click:
type: boolean
description: "When true, will retrieve the number of clicked messages in `ClickedCount`. Otherwise the click count is not calculated and a `-1` value is returned instead.\n\nDefault value: `false`\n\n> Note: At least one of the `Open`, `Click`, `Unsub` or `Spam` query parameters must be set to `true`.\n"
IDS:
type: string
description: Retrieves only statistics for the specified campaign IDs. Multiple IDs can be separated with a comma.
Open:
type: boolean
description: "When true, will retrieve the number of opened messages in `OpenedCount`. Otherwise the open count is not calculated and a `-1` value is returned instead.\n\nDefault value: `false`\n\n> Note: At least one of the `Open`, `Click`, `Unsub` or `Spam` query parameters must be set to `true`.\n"
Range:
type: string
description: Selects a period of time since the start of the campaign, for which you want to retrieve evolution statistics. If you select `24h` (24 hours), the stat intervals will be 15 minutes long. If `7d` (7 days) is selected, the intervals will be 30 minutes long.
Spam:
type: boolean
description: "When true, will retrieve the number of messages marked as spam in `SpamCount`. Otherwise the spam count is not calculated and a `-1` value is returned instead.\n\nDefault value: `false`\n\n> Note: At least one of the `Open`, `Click`, `Unsub` or `Spam` query parameters must be set to `true`.\n"
Unsub:
type: boolean
description: "When true, will retrieve the number of unsubscribe events in `UnsubCount`. Otherwise the unsubscribe count is not calculated and a `-1` value is returned instead.\n\nDefault value: `false`\n\n> Note: At least one of the `Open`, `Click`, `Unsub` or `Spam` query parameters must be set to `true`.\n"
Limit:
type: integer
description: "Limit the response to a select number of returned objects.\n\nDefault value: `10`. Maximum value: `1000`\n"
Offset:
type: integer
description: "Retrieve a list of objects starting from a certain offset. Combine this query parameter with `Limit` to retrieve a specific section of the list of objects.\n\nDefault value: `0`\n"
countOnly:
type: boolean
description: "Set the value of this query parameter to `1` to retrieve the overall number of objects returned by this request for your API Key. No list of results will be returned - the objects will simply be counted.\n\nDefault value: `0`\n\nNote: When you send a request without the `countOnly` query parameter, `Count` and `Total` will only return the number of extracted elements and not the overall number.\n"
Sort:
type: string
description: "Specify a property name for this query parameter to sort the objects in `Data`. By default the sorting is ascending. When a property name is postfixed with DESC (i.e. `property_name+DESC`), the sort order will be descending.\n\nNote: Both the `Sort` query parameter and the option to select a descending order are not available for every property.\n"
get_v3_campaigngraphstatistics_id_PathParams:
type: object
required:
- campaign_ID
properties:
campaign_ID:
type: integer
description: Unique numeric ID for this campaign you want to retrieve the stats evolution for.
get_v3_campaignoverview_QueryParams:
type: object
properties:
All:
type: boolean
description: "When true, will retrieve all campaigns, drafts and AB Testing objects that are not deleted (`IsDeleted`!=`0`). When false, both deleted and non-deleted ones will be retrieved.\n\nDefault value: `false`\n\n> Note: You cannot set more than one status query parameter (`All`, `Archived`, `Drafts`, `Programmed`, `Sent`, `Starred`) to `True`.\n"
Archived:
type: boolean
description: "When true, will retrieve all archived campaigns, drafts and AB Testing objects. When false, archived ones are excluded from the response.\n\nDefault value: `false`\n\n> Note: You cannot set more than one status query parameter (`All`, `Archived`, `Drafts`, `Programmed`, `Sent`, `Starred`) to `True`.\n"
Drafts:
type: boolean
description: "When true, will retrieve all drafts (and AB Testing objects in Draft mode). When false, both drafts and sent campaigns / AB Testing objects will be retrieved.\n\nDefault value: `false`\n\n> Note: You cannot set more than one status query parameter (`All`, `Archived`, `Drafts`, `Programmed`, `Sent`, `Starred`) to `True`.\n"
ID:
type: integer
description: "Retrieves only the draft, sent campaign or AB testing object linked to this unique numeric ID.\n\n> Note: Mandatory, when the `ID` query parameter is used.\n"
IDType:
type: string
description: "Retrieves only objects of the specified type:\n\n- Campaign - Sent campaign\n- AX - AB Testing object\n- NL - Draft\n\n> Note: Mandatory, when the `ID` query parameter is used.\n"
Programmed:
type: boolean
description: "When true, will retrieve only drafts that are scheduled for sending - i.e. with `Programmed` status. When false, both programmed and draft / sent / deleted objects will be retrieved.\n\nDefault value: `false`\n\n> Note: You cannot set more than one status query parameter (`All`, `Archived`, `Drafts`, `Programmed`, `Sent`, `Starred`) to `True`.\n"
Sent:
type: boolean
description: "When true, will retrieve only sent campaigns. When false, both sent and not sent objects will be retrieved.\n\n> Note: You cannot set more than one status query parameter (`All`, `Archived`, `Drafts`, `Programmed`, `Sent`, `Starred`) to `True`.\n"
Starred:
type: boolean
description: "When true, will retrieve only starred campaigns, drafts and AB Testing objects. When false, both starred and non-starred ones will be retrieved.\n\nDefault value: `false`\n\n> Note: You cannot set more than one status query parameter (`All`, `Archived`, `Drafts`, `Programmed`, `Sent`, `Starred`) to `True`.\n"
Subject:
type: string
description: Retrieves only campaigns, drafts and AB Testing objects with the specified subject line.
Limit:
type: integer
description: "Limit the response to a select number of returned objects.\n\nDefault value: `10`. Maximum value: `1000`\n"
Offset:
type: integer
description: "Retrieve a list of objects starting from a certain offset. Combine this query parameter with `Limit` to retrieve a specific section of the list of objects.\n\nDefault value: `0`\n"
countOnly:
type: boolean
description: "Set the value of this query parameter to `1` to retrieve the overall number of objects returned by this request for your API Key. No list of results will be returned - the objects will simply be counted.\n\nDefault value: `0`\n\nNote: When you send a request without the `countOnly` query parameter, `Count` and `Total` will only return the number of extracted elements and not the overall number.\n"
Sort:
type: string
description: "Specify a property name for this query parameter to sort the objects in `Data`. By default the sorting is ascending. When a property name is postfixed with DESC (i.e. `property_name+DESC`), the sort order will be descending.\n\nNote: Both the `Sort` query parameter and the option to select a descending order are not available for every property.\n"
get_v3_campaignoverview_id_PathParams:
type: object
required:
- ID
properties:
ID:
type: string
description: "A combination of the `IDType` and the unique numeric ID of the object you want to retrieve, separated with a vertical line. E.g. `Campaign|1234`."
IDType:
type: string
description: "Indicates the type of object you want to retrieve:\n\n- Campaign - Sent campaign\n- AX - AB Testing object\n- NL - Draft\n"
get_v3_campaignstatistics_QueryParams:
type: object
properties:
AXTesting:
type: integer
description: Retrieves statistics only for the campaigns with the specified AX Testing ID.
Blocked:
type: boolean
description: When true, will retrieve statistics only for campaigns that have blocked messages. When false, campaigns with blocked messages will be excluded from the response.
Bounced:
type: boolean
description: When true, will retrieve statistics only for campaigns that have bounced messages. When false, campaigns with bounced messages will be excluded from the response.
Click:
type: boolean
description: When true, will retrieve statistics only for campaigns that have messages with registered clicks. When false, campaigns with clicked messages will be excluded from the response.
ContactsList:
type: integer
description: Retrieves statistics only for campaigns sent to the specified contact list ID.
Deferred:
type: boolean
description: When true, will retrieve statistics only for campaigns that have deferred messages. When false, campaigns with deferred messages will be excluded from the response.
FromTS:
type: string
description: Retrieves statistics only for campaigns sent after the specified timestamp. Both Unix timestamp (e.g. 1514764800) and RFC3339 (2018-01-01T00:00:00) formats are accepted.
FromType:
type: integer
description: "Retrieves campaign statistics only for a specific type of messages:\n\n- `1` - Transactional\n- `2` - Marketing\n- `3` - Unknown\n"
GroupAX:
type: boolean
description: When true, the different test and winning versions of AB Tesing campaigns will be grouped together as one campaign. When false, each AB version will be displayed with separate statistics.
Hardbounced:
type: boolean
description: When true, will retrieve statistics only for campaigns that have at least one hard-bounced message. When false, campaigns with hard-bounced messages will be excluded from the response.
IsDeleted:
type: boolean
description: When true, will retrieve statistics only for deleted campaigns. When false, stats for deleted campaigns will be excluded from the response.
IsStarred:
type: boolean
description: When true, will retrieve statistics only for starred campaigns. When false, starred campaigns will be excluded from the response.
LastActivityAt:
type: string
description: Retrieves statistics only for campaigns, for which `LastActivityAt` (their last received email, open, click etc.) equals the specified timestamp. Both Unix timestamp (e.g. 1514764800) and RFC3339 (2018-01-01T00:00:00) formats are accepted.
MaxLastActivityAt:
type: string
description: Retrieves statistics only for campaigns, for which `LastActivityAt` (their last received email, open, click etc.) is before the specified timestamp. Both Unix timestamp (e.g. 1514764800) and RFC3339 (2018-01-01T00:00:00) formats are accepted.
MinLastActivityAt:
type: string
description: Retrieves statistics only for campaigns, for which `LastActivityAt` (their last received email, open, click etc.) is after the specified timestamp. Both Unix timestamp (e.g. 1514764800) and RFC3339 (2018-01-01T00:00:00) formats are accepted.
NewsLetter:
type: integer
description: Retrieves statistics only for the campaign with the specified campaign draft ID.
Open:
type: boolean
description: When true, will retrieve statistics only for campaigns that have messages with registered opens. When false, campaigns with opened messages will be excluded from the response.
Queued:
type: boolean
description: When true, will retrieve statistics only for campaigns that have queued messages. When false, campaigns with queued messages will be excluded from the response.
Segmentation:
type: integer
description: Retrieves statistics only for campaigns that have used the this segment (`contactfilter`) ID when specifying their recipients.
Sender:
type: integer
description: Retrieves statistics only for campaigns which used the specified sender ID.
Sent:
type: boolean
description: When true, will retrieve statistics only for campaigns that have sent messages. When false, campaigns with sent messages will be excluded from the result.
ShowExtraData:
type: boolean
description: "When true, the contact list name and segment name will be returned in the response, in the `ContactListName` and `SegmentName` properties, respectively.\n\nDefault value: `false`\n"
Spam:
type: boolean
description: When true, will retrieve statistics only for campaigns that have messages marked as Spam. When false, campaigns with Spam messages will be excluded from the response.
Softbounced:
type: boolean
description: When true, will retrieve only statistics only for campaigns that have soft-bounced messages. When false, campaigns with soft-bounced messages will be excluded from the result.
Subject:
type: string
description: Retrieves statistics only for campaigns with the specified subject line.
ToTS:
type: string
description: Retrieves statistics only for campaigns sent before the specified timestamp. Both Unix timestamp (e.g. 1514764800) and RFC3339 (2018-01-01T00:00:00) formats are accepted.
Unsubscribed:
type: boolean
description: When true, will retrieve statistics only for campaigns that have unsubscribed from a list at least once. When false, campaigns with unsubscribe events will be excluded from the response.
WorkflowID:
type: integer
description: Retrieves statistics only for campaigns started by the specified automation workflow ID.
Limit:
type: integer
description: "Limit the response to a select number of returned objects.\n\nDefault value: `10`. Maximum value: `1000`\n"
Offset:
type: integer
description: "Retrieve a list of objects starting from a certain offset. Combine this query parameter with `Limit` to retrieve a specific section of the list of objects.\n\nDefault value: `0`\n"
countOnly:
type: boolean
description: "Set the value of this query parameter to `1` to retrieve the overall number of objects returned by this request for your API Key. No list of results will be returned - the objects will simply be counted.\n\nDefault value: `0`\n\nNote: When you send a request without the `countOnly` query parameter, `Count` and `Total` will only return the number of extracted elements and not the overall number.\n"
Sort:
type: string
description: "Specify a property name for this query parameter to sort the objects in `Data`. By default the sorting is ascending. When a property name is postfixed with DESC (i.e. `property_name+DESC`), the sort order will be descending.\n\nNote: Both the `Sort` query parameter and the option to select a descending order are not available for every property.\n"
get_v3_clickstatistics_QueryParams:
type: object
properties:
CampaignID:
type: integer
description: Retrieves only click events linked to the specified campaign ID.
ContactsList:
type: integer
description: Retrieves only click events linked to contacts from this contact list ID.
CustomCampaign:
type: string
description: Retrieves only click event details for the campaign with the specified custom value.
EventFromTs:
type: string
description: Retrieves information only about click events that happened after the specified timestamp (`ClickedAt` >= `EventFromTs`). Can be used only if `CampaignID` query parameter is specified as well. Both Unix timestamp (e.g. 1514764800) and RFC3339 (2018-01-01T00:00:00) formats are accepted.
EventToTs:
type: string
description: Retrieves information only about click events that happened before the specified timestamp (`ClickedAt` <= `EventFromTs`). Can be used only if `CampaignID` query parameter is specified as well. Both Unix timestamp (e.g. 1514764800) and RFC3339 (2018-01-01T00:00:00) formats are accepted.
FromTS:
type: string
description: Retrieves information only about click events linked to campaigns sent after the specified timestamp. Both Unix timestamp (e.g. 1514764800) and RFC3339 (2018-01-01T00:00:00) formats are accepted.
From:
type: string
description: Retrieves click event details only for the campaigns, which used the specified sender email address.
FromDomain:
type: string
description: Retrieves click event details only for the campaigns, which used the specified sender email domain.
FromID:
type: integer
description: Retrieves click event details only for the campaign, which used the specified sender ID.
FromType:
type: integer
description: "Retrieves click event details only for messages of the specified type:\n\n- `1` - Transactional\n- `2` - Marketing\n- `3` - Unknown\n"
IsDeleted:
type: boolean
description: When true, only click event details for deleted campaigns will be returned. When false, deleted campaigns will be excluded from the response.
IsNewsletterTool:
type: boolean
description: When true, will return only click event details for campaigns created by the Newsletter tool (legacy template builder). When false, newsletter campaigns will be excluded.
MessageID:
type: integer
description: Retrieves only click events linked to this message ID.
MessageStatus:
type: integer
description: "Retrieves only click events linked to messages with the specified status:\n\n- `0` (Processed)\n- `1` (Queued)\n- `2` (Sent)\n- `3` (Opened)\n- `4` (Clicked)\n- `5` (Bounce)\n- `6` (Spam)\n- `7` (Unsub)\n- `8` (Blocked)\n- `9` (SoftBounce)\n- `10` (HardBounce)\n- `11` (Deferred)\n"
Period:
type: string
description: "Retrieves only information about click events registered between the start of the selected period and the current timestamp.\n\n- `Day` - since the start of the current day\n- `Week` - since the start of the current week\n- `Month` - since the start of the current month\n- `Year` - since the start of the current year\n"
ToTS:
type: string
description: Retrieves only information about click events linked to campaigns sent before the specified timestamp. Both Unix timestamp (e.g. 1514764800) and RFC3339 (2018-01-01T00:00:00) formats are accepted.
Limit:
type: integer
description: "Limit the response to a select number of returned objects.\n\nDefault value: `10`. Maximum value: `1000`\n"
Offset:
type: integer
description: "Retrieve a list of objects starting from a certain offset. Combine this query parameter with `Limit` to retrieve a specific section of the list of objects.\n\nDefault value: `0`\n"
countOnly:
type: boolean
description: "Set the value of this query parameter to `1` to retrieve the overall number of objects returned by this request for your API Key. No list of results will be returned - the objects will simply be counted.\n\nDefault value: `0`\n\nNote: When you send a request without the `countOnly` query parameter, `Count` and `Total` will only return the number of extracted elements and not the overall number.\n"
Sort:
type: string
description: "Specify a property name for this query parameter to sort the objects in `Data`. By default the sorting is ascending. When a property name is postfixed with DESC (i.e. `property_name+DESC`), the sort order will be descending.\n\nNote: Both the `Sort` query parameter and the option to select a descending order are not available for every property.\n"
get_v3_contact_QueryParams:
type: object
properties:
Campaign:
type: integer
description: Retrieves only contacts targeted by this Campaign ID.
ContactsList:
type: integer
description: Retrieves only contacts that are part of this Contact List ID.
IsExcludedFromCampaigns:
type: boolean
description: When true, will retrieve only contacts that have been added to the exclusion list for marketing emails. When false, those contacts will be excluded from the response.
LastActivityAt:
type: string
deprecated: true
description: Retrieves only contacts, whose last activity happened at the specified time. Both Unix timestamp (e.g. 1514764800) and RFC3339 (2018-01-01T00:00:00) formats are accepted.
Limit:
type: integer
description: "Limit the response to a select number of returned objects.\n\nDefault value: `10`. Maximum value: `1000`\n"
Offset:
type: integer
description: "Retrieve a list of objects starting from a certain offset. Combine this query parameter with `Limit` to retrieve a specific section of the list of objects.\n\nDefault value: `0`\n"
countOnly:
type: boolean
description: "Set the value of this query parameter to `1` to retrieve the overall number of objects returned by this request for your API Key. No list of results will be returned - the objects will simply be counted.\n\nDefault value: `0`\n\nNote: When you send a request without the `countOnly` query parameter, `Count` and `Total` will only return the number of extracted elements and not the overall number.\n"
Sort:
type: string
description: "Specify a property name for this query parameter to sort the objects in `Data`. By default the sorting is ascending. When a property name is postfixed with DESC (i.e. `property_name+DESC`), the sort order will be descending.\n\nNote: Both the `Sort` query parameter and the option to select a descending order are not available for every property.\n"
get_v3_contact_id_PathParams:
type: object
required:
- contact_ID
properties:
contact_ID:
type: integer
description: Unique numeric ID of the contact you want to retrieve.
contact_email:
type: string
description: The email address of the contact your want to retrieve. Must be URL encoded. Can be used as an alternative to `contact_ID`.
get_v3_contactdata_QueryParams:
type: object
properties:
Campaign:
type: integer
description: Retrieves a list of contact property values only for the contacts, which received emails from this Campaign ID.
ContactEmail:
type: string
description: Retrieves a list of contact property values only for the contact with this email address.
ContactsList:
type: integer
description: Retrieves a list of contact property values only for the contacts that are part of this contact list ID.
Fields:
type: string
description: Only retrieves the information from the contact properties with the specified names. Empty values will be returned as well. Multiple properties can be specified by separating them with commas.
LastActivityAt:
type: string
description: Retrieves a list of contact property values only for the contacts, whose last activity was at the specified time. Both Unix timestamp (e.g. 1514764800) and RFC3339 (2018-01-01T00:00:00) formats are accepted.
Limit:
type: integer
description: "Limit the response to a select number of returned objects.\n\nDefault value: `10`. Maximum value: `1000`\n"
Offset:
type: integer
description: "Retrieve a list of objects starting from a certain offset. Combine this query parameter with `Limit` to retrieve a specific section of the list of objects.\n\nDefault value: `0`\n"
countOnly:
type: boolean
description: "Set the value of this query parameter to `1` to retrieve the overall number of objects returned by this request for your API Key. No list of results will be returned - the objects will simply be counted.\n\nDefault value: `0`\n\nNote: When you send a request without the `countOnly` query parameter, `Count` and `Total` will only return the number of extracted elements and not the overall number.\n"
Sort:
type: string
description: "Specify a property name for this query parameter to sort the objects in `Data`. By default the sorting is ascending. When a property name is postfixed with DESC (i.e. `property_name+DESC`), the sort order will be descending.\n\nNote: Both the `Sort` query parameter and the option to select a descending order are not available for every property.\n"
get_v3_contactdata_id_PathParams:
type: object
required:
- contact_ID
properties:
contact_ID:
type: integer
description: Unique numeric ID for the contact, whose properties you want to retrieve.
contact_email:
type: string
description: The email address of the contact, whose properties you want to retrieve. Must be URL encoded. Can be used as an alternative to `contact_ID`.
get_v3_contactfilter_QueryParams:
type: object
properties:
ShowDeleted:
type: boolean
description: "When true, will retrieve all segments, including deleted ones. When false, will exclude deleted segments from the response.\n\nDefault value: `false`\n"
Status:
type: string
description: "Retrieves only segments with the specified status. The status indicates whether a segment is being used for sending or not, or if it was deleted.\n\nPossible values:\n\n- `used`\n- `unused`\n- `deleted`\n"
Limit:
type: integer
description: "Limit the response to a select number of returned objects.\n\nDefault value: `10`. Maximum value: `1000`\n"
Offset:
type: integer
description: "Retrieve a list of objects starting from a certain offset. Combine this query parameter with `Limit` to retrieve a specific section of the list of objects.\n\nDefault value: `0`\n"
countOnly:
type: boolean
description: "Set the value of this query parameter to `1` to retrieve the overall number of objects returned by this request for your API Key. No list of results will be returned - the objects will simply be counted.\n\nDefault value: `0`\n\nNote: When you send a request without the `countOnly` query parameter, `Count` and `Total` will only return the number of extracted elements and not the overall number.\n"
Sort:
type: string
description: "Specify a property name for this query parameter to sort the objects in `Data`. By default the sorting is ascending. When a property name is postfixed with DESC (i.e. `property_name+DESC`), the sort order will be descending.\n\nNote: Both the `Sort` query parameter and the option to select a descending order are not available for every property.\n"
get_v3_contactfilter_id_PathParams:
type: object
required:
- contactfilter_ID
properties:
contactfilter_ID:
type: integer
description: Unique numeric ID for the segment you want to retrieve.
contactfilter_name:
type: string
description: The user-selected name of the segment you want to retrieve. Can be used as an alternative to `contactfilter_ID`.
get_v3_contactmetadata_QueryParams:
type: object
properties:
DataType:
type: string
description: "Retrieves only properties with the respective data type:\n\n- `str` - string\n- `int` - integer\n- `float` - float / number\n- `bool` - boolean\n- `datetime` - datetime (Unix Timestamp or RFC 3339)\n"
Namespace:
type: string
description: "Retrieves only properties with the respective namespace:\n\n- `static` - Can keep only 1 value. Each change to the value of the property for a contact overwrites the previously selected value. The values are saved in a `contactdata` object.\n- `historic` - Each change to the value of the property creates a record in a new `contacthistorydata` object, saving the property value and a timestamp of when it was submitted.\n"
Limit:
type: integer
description: "Limit the response to a select number of returned objects.\n\nDefault value: `10`. Maximum value: `1000`\n"
Offset:
type: integer
description: "Retrieve a list of objects starting from a certain offset. Combine this query parameter with `Limit` to retrieve a specific section of the list of objects.\n\nDefault value: `0`\n"
countOnly:
type: boolean
description: "Set the value of this query parameter to `1` to retrieve the overall number of objects returned by this request for your API Key. No list of results will be returned - the objects will simply be counted.\n\nDefault value: `0`\n\nNote: When you send a request without the `countOnly` query parameter, `Count` and `Total` will only return the number of extracted elements and not the overall number.\n"
Sort:
type: string
description: "Specify a property name for this query parameter to sort the objects in `Data`. By default the sorting is ascending. When a property name is postfixed with DESC (i.e. `property_name+DESC`), the sort order will be descending.\n\nNote: Both the `Sort` query parameter and the option to select a descending order are not available for every property.\n"
get_v3_contactmetadata_id_PathParams:
type: object
required:
- contactmetadata_ID
properties:
contactmetadata_ID:
type: integer
description: Unique numeric ID for the metadata object you want to retrieve.
NameSpace|contactmetadata_name:
type: string
description: A combination of the `NameSpace` and user-selected name for the metadata object you want to retrieve, separated with a vertial line. E.g. `static|age`. Can be used as an alternative to `contactmetadata_ID`.
get_v3_contactslist_QueryParams:
type: object
properties:
Address:
type: string
description: Retrieves only the contact list with the specified unique address created by Mailjet. This address which can be used only via Mailjet's SMTP server to reach all contacts in it. It is displayed in the `Address` property of the list. The full email will be `{Address}@lists.mailjet.com`.
ExcludeID:
type: integer
description: Excludes the contact list with specified ID from the response.
IsDeleted:
type: boolean
description: When true, will retrieve only deleted lists. When false, will retrieve lists that are not deleted.
Name:
type: string
description: Retrieves only the list with the specified user-selected Name.
Limit:
type: integer
description: "Limit the response to a select number of returned objects.\n\nDefault value: `10`. Maximum value: `1000`\n"
Offset:
type: integer
description: "Retrieve a list of objects starting from a certain offset. Combine this query parameter with `Limit` to retrieve a specific section of the list of objects.\n\nDefault value: `0`\n"
countOnly:
type: boolean
description: "Set the value of this query parameter to `1` to retrieve the overall number of objects returned by this request for your API Key. No list of results will be returned - the objects will simply be counted.\n\nDefault value: `0`\n\nNote: When you send a request without the `countOnly` query parameter, `Count` and `Total` will only return the number of extracted elements and not the overall number.\n"
Sort:
type: string
description: "Specify a property name for this query parameter to sort the objects in `Data`. By default the sorting is ascending. When a property name is postfixed with DESC (i.e. `property_name+DESC`), the sort order will be descending.\n\nNote: Both the `Sort` query parameter and the option to select a descending order are not available for every property.\n"
get_v3_contactslist_id_PathParams:
type: object
required:
- list_ID
properties:
list_ID:
type: integer
description: Unique numeric ID assigned to this contact list.
list_address:
type: string
description: Unique email address generated by Mailjet for this list. This address which can be used only via Mailjet's SMTP server to reach all contacts in it. It is displayed in the `Address` property of the list. The full email address will be `{list_address}@lists.mailjet.com`. Can be used as an alternative to `list_ID`.
get_v3_contactslistsignup_QueryParams:
type: object
properties:
Contact:
type: integer
description: Retrieves only signup requests for a given contact ID.
ContactsList:
type: integer
description: Retrieves only signup requests to a given contact list ID.
Domain:
type: string
description: Retrieves only signup requests for contacts with the specified domain. Required, if the `LocalPart` query parameter is used as well.
Email:
type: string
description: Retrieves only signup requests for the specified email address.
LocalPart:
type: string
description: Retrieves only signup requests for emails with the specified local part. If this query parameter is used, the `Domain` query parameter is required as well.
MaxConfirmAt:
type: integer
description: Retrieves only signup requests, where the subscription confirmation was done earlier than the specified timestamp. Both Unix timestamp (e.g. 1514764800) and RFC3339 (2018-01-01T00:00:00) formats are accepted.
MaxSignupAt:
type: integer
description: Retrieves only signup requests, where the request was done before the specified timestamp. Both Unix timestamp (e.g. 1514764800) and RFC3339 (2018-01-01T00:00:00) formats are accepted.
MinConfirmAt:
type: integer
description: Retrieves only signup requests, where the subscription confirmation was done after the specified timestamp. Both Unix timestamp (e.g. 1514764800) and RFC3339 (2018-01-01T00:00:00) formats are accepted.
MinSignupAt:
type: integer
description: Retrieves only signup requests, where the request was done after the specified timestamp. Both Unix timestamp (e.g. 1514764800) and RFC3339 (2018-01-01T00:00:00) formats are accepted.
SignupIp:
type: string
description: Retrieves only signup requests, which were done from the specified IP address.
Source:
type: string
description: Retrieves only signup requests, which were done from the specified source type.
SourceID:
type: integer
description: Retrieves only signup requests done via the respective source ID. This would be the ID of the widget used for the request.
Limit:
type: integer
description: "Limit the response to a select number of returned objects.\n\nDefault value: `10`. Maximum value: `1000`\n"
Offset:
type: integer
description: "Retrieve a list of objects starting from a certain offset. Combine this query parameter with `Limit` to retrieve a specific section of the list of objects.\n\nDefault value: `0`\n"
countOnly:
type: boolean
description: "Set the value of this query parameter to `1` to retrieve the overall number of objects returned by this request for your API Key. No list of results will be returned - the objects will simply be counted.\n\nDefault value: `0`\n\nNote: When you send a request without the `countOnly` query parameter, `Count` and `Total` will only return the number of extracted elements and not the overall number.\n"
Sort:
type: string
description: "Specify a property name for this query parameter to sort the objects in `Data`. By default the sorting is ascending. When a property name is postfixed with DESC (i.e. `property_name+DESC`), the sort order will be descending.\n\nNote: Both the `Sort` query parameter and the option to select a descending order are not available for every property.\n"
get_v3_contactslistsignup_id_PathParams:
type: object
required:
- signuprequest_ID
properties:
signuprequest_ID:
type: integer
description: Unique numeric ID assigned to this subscription request.
get_v3_contactstatistics_QueryParams:
type: object
properties:
Blocked:
type: boolean
description: When true, will retrieve statistics only for contacts that have at least one blocked message. When false, contacts with blocked messages will be excluded from the response.
Bounced:
type: boolean
description: When true, will retrieve statistics only for contacts that have at least one bounced message. When false, contacts with bounced messages will be excluded from the response.
Click:
type: boolean
description: When true, will retrieve statistics only for contacts that have at least one message with a registered click. When false, contacts with clicked messages will be excluded from the response.
Deferred:
type: boolean
description: When true, will retrieve statistics only for contacts that have at least one deferred message. When false, contacts with deferred messages will be excluded from the response.
Hardbounced:
type: boolean
description: When true, will retrieve statistics only for contacts that have at least one hard-bounced message. When false, contacts with hard-bounced messages will be excluded from the response.
LastActivityAt:
type: string
description: Retrieves statistics only for contacts, for which `LastActivityAt` (their last received email, open, click etc.) equals the specified timestamp. Both Unix timestamp (e.g. 1514764800) and RFC3339 (2018-01-01T00:00:00) formats are accepted.
MaxLastActivityAt:
type: string
description: Retrieves statistics only for contacts, for which `LastActivityAt` (their last received email, open, click etc.) is before the specified timestamp. Both Unix timestamp (e.g. 1514764800) and RFC3339 (2018-01-01T00:00:00) formats are accepted.
MinLastActivityAt:
type: string
description: Retrieves statistics only for contacts, for which `LastActivityAt` (their last received email, open, click etc.) is after the specified timestamp. Both Unix timestamp (e.g. 1514764800) and RFC3339 (2018-01-01T00:00:00) formats are accepted.
Open:
type: boolean
description: When true, will retrieve statistics only for contacts that have messages with registered opens. When false, contacts with opened messages will be excluded from the response.
Queued:
type: boolean
description: When true, will retrieve statistics only for contacts that have queued messages. When false, contacts with queued messages will be excluded from the response.
Recalculate:
type: boolean
deprecated: true
description: "When true, will reload all data from the database.\n\n> Note: Deprecated for accounts created after April 5th, 2018.\n"
Sent:
type: boolean
description: When true, will retrieve statistics only for contacts that have sent messages. When false, contacts with sent messages will be excluded from the response.
Spam:
type: boolean
description: When true, will retrieve statistics for only contacts that have messages marked as Spam. When false, contacts with Spam messages will be excluded from the response.
Softbounced:
type: boolean
description: When true, will retrieve statistics only for contacts that have soft-bounced messages. When false, contacts with soft-bounced messages will be excluded from the response.
Unsubscribed:
type: boolean
description: When true, will retrieve statistics only for contacts that have unsubscribed from a list at least once. When false, contacts with unsubscribe events will be excluded from the response.
Limit:
type: integer
description: "Limit the response to a select number of returned objects.\n\nDefault value: `10`. Maximum value: `1000`\n"
Offset:
type: integer
description: "Retrieve a list of objects starting from a certain offset. Combine this query parameter with `Limit` to retrieve a specific section of the list of objects.\n\nDefault value: `0`\n"
countOnly:
type: boolean
description: "Set the value of this query parameter to `1` to retrieve the overall number of objects returned by this request for your API Key. No list of results will be returned - the objects will simply be counted.\n\nDefault value: `0`\n\nNote: When you send a request without the `countOnly` query parameter, `Count` and `Total` will only return the number of extracted elements and not the overall number.\n"
Sort:
type: string
description: "Specify a property name for this query parameter to sort the objects in `Data`. By default the sorting is ascending. When a property name is postfixed with DESC (i.e. `property_name+DESC`), the sort order will be descending.\n\nNote: Both the `Sort` query parameter and the option to select a descending order are not available for every property.\n"
get_v3_csvimport_id_PathParams:
type: object
required:
- importjob_ID
properties:
importjob_ID:
type: integer
description: Unique numeric ID of the import job you want to retrieve.
get_v3_dns_QueryParams:
type: object
properties:
IsCheckInProgress:
type: boolean
description: When true, will retrieve only DNS records, where a validation check was initiated and is in progress. When false, DNS records where a check is in progress will be excluded from the response.
IsSenderIdentified:
type: boolean
description: Retrieves DNS records where IsSenderIdentified matches the specified value.
IsYahooFBL:
type: boolean
description: Retrieves only DNS records where a Yahoo Feedback loop has been setup. Contact the Mailjet Support team to set up the feedback loop.
MaxLastCheckAt:
type: string
description: Retrieves only DNS records where the last check was performed before this timestamp. Both Unix timestamp (e.g. 1514764800) and RFC3339 (2018-01-01T00:00:00) formats are accepted.
MinLastCheckAt:
type: string
description: Retrieves only DNS records where the last check was performed after this timestamp. Both Unix timestamp (e.g. 1514764800) and RFC3339 (2018-01-01T00:00:00) formats are accepted.
SPFStatus:
type: string
description: "Retrieves only DNS records where the last domain SPF configuration check resulted in the specified status.\n\nPossible values:\n\n- `OK`\n- `Error`\n- `Not checked`\n- `Not found`\n"
Limit:
type: integer
description: "Limit the response to a select number of returned objects.\n\nDefault value: `10`. Maximum value: `1000`\n"
Offset:
type: integer
description: "Retrieve a list of objects starting from a certain offset. Combine this query parameter with `Limit` to retrieve a specific section of the list of objects.\n\nDefault value: `0`\n"
countOnly:
type: boolean
description: "Set the value of this query parameter to `1` to retrieve the overall number of objects returned by this request for your API Key. No list of results will be returned - the objects will simply be counted.\n\nDefault value: `0`\n\nNote: When you send a request without the `countOnly` query parameter, `Count` and `Total` will only return the number of extracted elements and not the overall number.\n"
Sort:
type: string
description: "Specify a property name for this query parameter to sort the objects in `Data`. By default the sorting is ascending. When a property name is postfixed with DESC (i.e. `property_name+DESC`), the sort order will be descending.\n\nNote: Both the `Sort` query parameter and the option to select a descending order are not available for every property.\n"
get_v3_dns_id_PathParams:
type: object
required:
- dns_ID
properties:
dns_ID:
type: integer
description: Unique numeric ID of the domain settings object you want to retrieve.
dns_domain:
type: string
description: The name of the domain settings object you want to retrieve - e.g. `mailjet.com`. Can be used as an alternative to `dns_ID`.
get_v3_domainstatistics_QueryParams:
type: object
properties:
CampaignID:
type: integer
description: Retrieves recipient domain statistics only for the specified Campaign ID.
ContactsList:
type: integer
description: Retrieves recipient domain statistics only for the specified contact list ID.
CustomCampaign:
type: string
description: Retrieves recipient domain statistics only for the campaign with the specified Custom Value.
From:
type: string
description: Retrieves recipient domain statistics only for messages sent from the specified Sender Email address.
FromDomain:
type: string
description: Retrieves recipient domain statistics only for messages sent from the specified domain.
FromID:
type: integer
description: Retrieves recipient domain statistics only for messages sent from the sender address with the specified ID.
FromTS:
type: string
description: Retrieves recipient domain statistics only for messages sent after the specified timestamp. Both Unix timestamp (e.g. 1514764800) and RFC3339 (2018-01-01T00:00:00) formats are accepted.
FromType:
type: integer
description: "Retrieves recipient domain statistics only for a specific type of messages:\n\n- `1` - Transactional\n- `2` - Marketing\n- `3` - Unknown\n"
IsDeleted:
type: boolean
description: When true, will retrieve recipient domain statistics only for deleted campaigns. When false, stats for deleted campaigns will be excluded from the response.
IsNewsletterTool:
type: boolean
description: When true, will retrieve recipient domain statistics only for campaigns created with the Legacy template builder. When false, campaigns created with the Legacy builder will be excluded from the response.
IsStarred:
type: boolean
description: When true, will retrieve recipient domain statistics only for starred campaigns. When false, starred campaigns will be excluded from the response.
MessageStatus:
type: integer
description: "Retrieves recipient domain statistics only for messages with the specified status:\n\n- `0` (Processed)\n- `1` (Queued)\n- `2` (Sent)\n- `3` (Opened)\n- `4` (Clicked)\n- `5` (Bounce)\n- `6` (Spam)\n- `7` (Unsub)\n- `8` (Blocked)\n- `9` (SoftBounce)\n- `10` (HardBounce)\n- `11` (Deferred)\n"
Period:
type: string
description: "Retrieves recipient domain statistics only for messages sent between the start of the selected period and the current timestamp.\n\n- `Day` - since the start of the current day\n- `Week` - since the start of the current week\n- `Month` - since the start of the current month\n- `Year` - since the start of the current year\n"
ToTS:
type: string
description: Retrieves recipient domain statistics only for messages sent before the specified timestamp. Both Unix timestamp (e.g. 1514764800) and RFC3339 (2018-01-01T00:00:00) formats are accepted.
Limit:
type: integer
description: "Limit the response to a select number of returned objects.\n\nDefault value: `10`. Maximum value: `1000`\n"
Offset:
type: integer
description: "Retrieve a list of objects starting from a certain offset. Combine this query parameter with `Limit` to retrieve a specific section of the list of objects.\n\nDefault value: `0`\n"
countOnly:
type: boolean
description: "Set the value of this query parameter to `1` to retrieve the overall number of objects returned by this request for your API Key. No list of results will be returned - the objects will simply be counted.\n\nDefault value: `0`\n\nNote: When you send a request without the `countOnly` query parameter, `Count` and `Total` will only return the number of extracted elements and not the overall number.\n"
Sort:
type: string
description: "Specify a property name for this query parameter to sort the objects in `Data`. By default the sorting is ascending. When a property name is postfixed with DESC (i.e. `property_name+DESC`), the sort order will be descending.\n\nNote: Both the `Sort` query parameter and the option to select a descending order are not available for every property.\n"
get_v3_eventcallbackurl_QueryParams:
type: object
properties:
Backup:
type: boolean
description: When true, will retrieve only backup callback URLs. When false, backup callback URLs will be excluded from the response.
EventType:
type: integer
description: "Retrieves only callback URL objects linked to the specified event type:\n\n- `1` - click\n- `2` - bounce\n- `3` - spam\n- `4` - blocked\n- `5` - unsubscribe\n- `6` - open\n- `7` - sent\n"
Status:
type: string
description: Retrieves only callback URL objects with the specified status.
Version:
type: integer
description: "Retrieves only callback URL objects with the specified Version.\n\nPossible values:\n\n- `1` - The events are not grouped and a callback is received for each event individually.\n- `2` - The events are grouped. A callback for the grouped events is received with a maximum frequency of once per second. Important to use to avoid reaching API rate limits.\n"
Limit:
type: integer
description: "Limit the response to a select number of returned objects.\n\nDefault value: `10`. Maximum value: `1000`\n"
Offset:
type: integer
description: "Retrieve a list of objects starting from a certain offset. Combine this query parameter with `Limit` to retrieve a specific section of the list of objects.\n\nDefault value: `0`\n"
countOnly:
type: boolean
description: "Set the value of this query parameter to `1` to retrieve the overall number of objects returned by this request for your API Key. No list of results will be returned - the objects will simply be counted.\n\nDefault value: `0`\n\nNote: When you send a request without the `countOnly` query parameter, `Count` and `Total` will only return the number of extracted elements and not the overall number.\n"
Sort:
type: string
description: "Specify a property name for this query parameter to sort the objects in `Data`. By default the sorting is ascending. When a property name is postfixed with DESC (i.e. `property_name+DESC`), the sort order will be descending.\n\nNote: Both the `Sort` query parameter and the option to select a descending order are not available for every property.\n"
get_v3_eventcallbackurl_id_PathParams:
type: object
required:
- url_ID
properties:
url_ID:
type: integer
description: Unique numeric ID for the callback URL you want to retrieve.
get_v3_graphstatistics_QueryParams:
type: object
properties:
CampaignID:
type: integer
description: Retrieves stats evolution only for the specified Campaign ID.
ContactID:
type: integer
description: Retrieves stats evolution only for messages sent to the specified contact ID.
ContactsList:
type: integer
description: Retrieves stats evolution only for the specified contact list ID.
CustomCampaign:
type: string
description: Retrieves stats evolution only for the campaign with the specified Custom Value.
From:
type: string
description: Retrieves stats evolution only for messages sent from the specified Sender Email address.
FromDomain:
type: string
description: Retrieves stats evolution only for messages sent from the specified domain.
FromID:
type: integer
description: Retrieves stats evolution only for messages sent from the sender address with the specified ID.
FromTS:
type: string
description: Retrieves stats evolution only for messages sent after the specified timestamp. Mandatory along with `ToTS`, unless `Period` is specified instead. Both Unix timestamp (e.g. 1514764800) and RFC3339 (2018-01-01T00:00:00) formats are accepted.
FromType:
type: integer
description: "Retrieves stats evolution only for a specific type of messages:\n\n- `1` - Transactional\n- `2` - Marketing\n- `3` - Unknown\n"
IsDeleted:
type: boolean
description: When true, will retrieve stats evolution only for deleted campaigns. When false, stats for deleted campaigns will be excluded from the response.
IsNewsletterTool:
type: boolean
description: When true, will retrieve stats evolution only for campaigns created with the Legacy template builder. When false, campaigns created with the Legacy builder will be excluded from the response.
IsStarred:
type: boolean
description: When true, will retrieve stats evolution only for starred campaigns. When false, starred campaigns will be excluded from the response.
MessageStatus:
type: integer
description: "Retrieves stats evolution only for messages with the specified status:\n\n- `0` (Processed)\n- `1` (Queued)\n- `2` (Sent)\n- `3` (Opened)\n- `4` (Clicked)\n- `5` (Bounce)\n- `6` (Spam)\n- `7` (Unsub)\n- `8` (Blocked)\n- `9` (SoftBounce)\n- `10` (HardBounce)\n- `11` (Deferred)\n"
Period:
type: string
description: "Retrieves stats evolution only for messages sent between the start of the selected period and the current timestamp. Mandatory, unless FromTS and ToTS are specified instead.\n\n- `Day` - since the start of the current day\n- `Week` - since the start of the current week\n- `Month` - since the start of the current month\n- `Year` - since the start of the current year\n"
Scale:
type: string
description: "Scale of the time intervals for the statistics:\n\n- `Hour`\n- `Day`\n- `Week`\n- `Month`\n- `Year`\n"
TimeShift:
type: integer
description: "Timeshift for the `RefTimeStamp` in seconds. Used to convert the timestamp from its initial value to a different time zone. Submitted as a multiple of 3600 (negative values are accepted).\n\nExample: a `TimeShift=7200` will convert a `RefTimeStamp` from `2018-02-01T00:00:00` to `2018-01-31T22:00:00-2:00`\n"
ToTS:
type: string
description: Retrieves stats evolution only for messages sent before the specified timestamp. Mandatory along with `FromTS`, unless `Period` is specified instead. Both Unix timestamp (e.g. 1514764800) and RFC3339 (2018-01-01T00:00:00) formats are accepted.
WorkflowID:
type: integer
description: Retrieves stats evolution only for messages triggered by the specified automation workflow.
Limit:
type: integer
description: "Limit the response to a select number of returned objects.\n\nDefault value: `10`. Maximum value: `1000`\n"
Offset:
type: integer
description: "Retrieve a list of objects starting from a certain offset. Combine this query parameter with `Limit` to retrieve a specific section of the list of objects.\n\nDefault value: `0`\n"
countOnly:
type: boolean
description: "Set the value of this query parameter to `1` to retrieve the overall number of objects returned by this request for your API Key. No list of results will be returned - the objects will simply be counted.\n\nDefault value: `0`\n\nNote: When you send a request without the `countOnly` query parameter, `Count` and `Total` will only return the number of extracted elements and not the overall number.\n"
Sort:
type: string
description: "Specify a property name for this query parameter to sort the objects in `Data`. By default the sorting is ascending. When a property name is postfixed with DESC (i.e. `property_name+DESC`), the sort order will be descending.\n\nNote: Both the `Sort` query parameter and the option to select a descending order are not available for every property.\n"
get_v3_listrecipient_QueryParams:
type: object
properties:
Active:
type: boolean
deprecated: true
description: Retrieves only list recipients with the respective active subscription status (`IsActive` value).
Blocked:
type: boolean
description: "When true, will retrieve only recipients that have email block events linked to them. When false, blocked recipients will be excluded from the response.\n\n> Note: Available only for accounts created before April 5th, 2018.\n"
Contact:
type: integer
description: Retrieves only list recipients linked to this Contact ID.
ContactEmail:
type: string
description: Retrieves only list recipients linked to this contact email address.
ContactsList:
type: integer
description: Retrieves only list recipients linked to this contact list ID.
IgnoreDeleted:
type: boolean
description: "When true, will exclude recipients linked to deleted contact lists from the response. When false, recipients linked to deleted lists will also be retrieved.\n\nDefault value: `true`\n"
IsExcludedFromCampaigns:
type: boolean
description: When true, will retrieve only list recipients that have been added to the exclusion list for marketing emails. When false, those recipients will be excluded from the response.
LastActivityAt:
type: string
description: Retrieves only list recipients, whose last registered activity was detected at the specified timestamp. Both Unix timestamp (e.g. 1514764800) and RFC3339 (2018-01-01T00:00:00) formats are accepted.
ListName:
type: string
description: Retrieve only the list recipients linked to this contact list name.
Opened:
type: boolean
description: When true, will retrieve only recipients that have opened at least one email. When false, recipients with open events will be excluded from the response.
Unsub:
type: boolean
description: When true, will retrieve only unsubscribed list recipients (`IsUnsubscribed=true`). When false, unsubscribed recipients will be excluded from the response.
Limit:
type: integer
description: "Limit the response to a select number of returned objects.\n\nDefault value: `10`. Maximum value: `1000`\n"
Offset:
type: integer
description: "Retrieve a list of objects starting from a certain offset. Combine this query parameter with `Limit` to retrieve a specific section of the list of objects.\n\nDefault value: `0`\n"
countOnly:
type: boolean
description: "Set the value of this query parameter to `1` to retrieve the overall number of objects returned by this request for your API Key. No list of results will be returned - the objects will simply be counted.\n\nDefault value: `0`\n\nNote: When you send a request without the `countOnly` query parameter, `Count` and `Total` will only return the number of extracted elements and not the overall number.\n"
Sort:
type: string
description: "Specify a property name for this query parameter to sort the objects in `Data`. By default the sorting is ascending. When a property name is postfixed with DESC (i.e. `property_name+DESC`), the sort order will be descending.\n\nNote: Both the `Sort` query parameter and the option to select a descending order are not available for every property.\n"
get_v3_listrecipient_id_PathParams:
type: object
required:
- listrecipient_ID
properties:
listrecipient_ID:
type: integer
description: Unique numeric ID of the list recipient.
get_v3_listrecipientstatistics_QueryParams:
type: object
properties:
Blocked:
type: boolean
description: When true, will retrieve statistics only for list recipients that have blocked messages. When false, contacts with blocked messages will be excluded from the response.
Bounced:
type: boolean
description: When true, will retrieve statistics only for list recipients that have bounced messages. When false, contacts with bounced messages will be excluded from the response.
Click:
type: boolean
description: When true, will retrieve statistics only for list recipients that have messages with registered clicks. When false, contacts with clicked messages will be excluded from the response.
Contact:
type: integer
description: Retrieves only list recipient statistics for the specified contact ID.
ContactsList:
type: integer
description: Retrieves statistics only for list recipients that are part of the specified contact list ID.
IsExcludedFromCampaigns:
type: boolean
description: When true, will retrieve statistics only for recipients linked to contacts that have been excluded from campaigns. When false, only recipients who are not linked to excluded contacts will be part of the response.
IsUnsubscribed:
type: boolean
description: When true, will retrieve statistics only for unsubscribed list recipients. When false, unsubscribed recipients will be excluded from the response.
LastActivityAt:
type: string
description: Retrieves statistics only for list recipients, for which `LastActivityAt` (their last received email, open, click etc.) equals the specified timestamp. Both Unix timestamp (e.g. 1514764800) and RFC3339 (2018-01-01T00:00:00) formats are accepted.
MaxLastActivityAt:
type: string
description: Retrieves statistics only for list recipients, for which `LastActivityAt` (their last received email, open, click etc.) is before the specified timestamp. Both Unix timestamp (e.g. 1514764800) and RFC3339 (2018-01-01T00:00:00) formats are accepted.
MaxUnsubscribedAt:
type: string
description: Retrieves statistics only for list recipients, for which `UnsubscribedAt` (the time they unsubscribed) is before the specified timestamp. Both Unix timestamp (e.g. 1514764800) and RFC3339 (2018-01-01T00:00:00) formats are accepted.
MinLastActivityAt:
type: string
description: Retrieves statistics only for list recipients, for which `LastActivityAt` (their last received email, open, click etc.) is after the specified timestamp. Both Unix timestamp (e.g. 1514764800) and RFC3339 (2018-01-01T00:00:00) formats are accepted.
MinUnsubscribedAt:
type: string
description: Retrieves statistics only for list recipients, for which `UnsubscribedAt` (the time they unsubscribed) is after the specified timestamp. Both Unix timestamp (e.g. 1514764800) and RFC3339 (2018-01-01T00:00:00) formats are accepted.
Open:
type: boolean
description: When true, will retrieve statistics only for list recipients that have messages with registered opens. When false, contacts with opened messages will be excluded from the response.
Queued:
type: boolean
description: When true, will retrieve statistics only for contacts that have queued messages. When false, contacts with queued messages will be excluded from the response.
Sent:
type: boolean
description: When true, will retrieve statistics only for list recipients that have sent messages. When false, contacts with sent messages will be excluded from the response.
ShowExtraData:
type: boolean
description: "When true, will display the contact properties associated with this list recipient in the \"Data\" array object in the response.\n\nDefault value: `false`\n"
Spam:
type: boolean
description: When true, will retrieve statistics only for list recipients that have messages marked as Spam. When false, contacts with Spam messages will be excluded from the response.
TimeZone:
type: string
description: Selects the time zone for this user.
Unsubscribed:
type: boolean
description: When true, will retrieve statistics only for list recipients that have unsubscribed from a list at least once. When false, contacts with unsubscribe events will be excluded from the response.
Limit:
type: integer
description: "Limit the response to a select number of returned objects.\n\nDefault value: `10`. Maximum value: `1000`\n"
Offset:
type: integer
description: "Retrieve a list of objects starting from a certain offset. Combine this query parameter with `Limit` to retrieve a specific section of the list of objects.\n\nDefault value: `0`\n"
countOnly:
type: boolean
description: "Set the value of this query parameter to `1` to retrieve the overall number of objects returned by this request for your API Key. No list of results will be returned - the objects will simply be counted.\n\nDefault value: `0`\n\nNote: When you send a request without the `countOnly` query parameter, `Count` and `Total` will only return the number of extracted elements and not the overall number.\n"
Sort:
type: string
description: "Specify a property name for this query parameter to sort the objects in `Data`. By default the sorting is ascending. When a property name is postfixed with DESC (i.e. `property_name+DESC`), the sort order will be descending.\n\nNote: Both the `Sort` query parameter and the option to select a descending order are not available for every property.\n"
get_v3_liststatistics_QueryParams:
type: object
properties:
Address:
type: string
description: Retrieves statistics only for the contact list linked to the specified email address generated by Mailjet.
CalcExcludedSubscriber:
type: boolean
description: "When true, will return the number of list members that are excluded from campaigns in `ExcludedSubscriberCount`.\n\nDefault value: `false`\n"
ContactsListID:
type: integer
description: Retrieves statistics only for the specified contact list ID.
ExcludeID:
type: integer
description: Unique numeric ID for this object.
Limit:
type: integer
description: "Limit the response to a select number of returned objects.\n\nDefault value: `10`. Maximum value: `1000`\n"
Offset:
type: integer
description: "Retrieve a list of objects starting from a certain offset. Combine this query parameter with `Limit` to retrieve a specific section of the list of objects.\n\nDefault value: `0`\n"
countOnly:
type: boolean
description: "Set the value of this query parameter to `1` to retrieve the overall number of objects returned by this request for your API Key. No list of results will be returned - the objects will simply be counted.\n\nDefault value: `0`\n\nNote: When you send a request without the `countOnly` query parameter, `Count` and `Total` will only return the number of extracted elements and not the overall number.\n"
Sort:
type: string
description: "Specify a property name for this query parameter to sort the objects in `Data`. By default the sorting is ascending. When a property name is postfixed with DESC (i.e. `property_name+DESC`), the sort order will be descending.\n\nNote: Both the `Sort` query parameter and the option to select a descending order are not available for every property.\n"
get_v3_liststatistics_id_PathParams:
type: object
required:
- list_ID
properties:
list_ID:
type: integer
description: Unique numeric ID assigned to this contact list.
get_v3_message_QueryParams:
type: object
properties:
Campaign:
type: integer
description: Retrieves only messages sent as part of the specified Campaign ID.
Contact:
type: integer
description: Retrieves only messages sent to the specified Contact ID.
CustomID:
type: string
description: Retrieves only messages tagged with the specified `CustomID`.
Destination:
type: integer
description: Retrieves only messages sent to the specified Destination ID (ID for a specific domain name).
FromTS:
type: string
description: Retrieves only messages sent after the specified timestamp. Both Unix timestamp (e.g. 1514764800) and RFC3339 (2018-01-01T00:00:00) formats are accepted.
FromType:
type: integer
description: "Retrieves only messages of the specified type:\n\n- `1` - Transactional\n- `2` - Marketing\n- `3` - Unknown\n"
MessageState:
type: integer
description: "Retrieves only non-delivered messages with the respective State ID. The MessageState ID explains why a message was not delivered successfully to the recipient:\n\n- `1` = user unknown (recipient)\n- `2` = mailbox inactive (recipient)\n- `3` = quota exceeded (recipient)\n- `4` = invalid domain (domain)\n- `5` = no mail host (domain)\n- `6` = relay/access denied (domain)\n- `7` = sender blocked (spam)\n- `8` = content blocked (spam)\n- `9` = policy issue (spam)\n- `10` = system issue (system)\n- `11` = protocol issue (system)\n- `12` = connection issue (system)\n- `13` = greylisted (domain)\n- `14` = preblocked (Mailjet)\n- `15` = duplicate in campaign (Mailjet)\n- `16` = spam preblocked (Mailjet)\n- `17` = bad or empty template (content)\n- `18` = error in template language (content)\n- `19` = typofix (domain)\n- `20` = blacklisted (recipient)\n- `21` = spam reporter (recipient)\n"
MessageStatus:
type: integer
description: "Retrieves only messages with the specified status:\n\n- `0` (Processed)\n- `1` (Queued)\n- `2` (Sent)\n- `3` (Opened)\n- `4` (Clicked)\n- `5` (Bounce)\n- `6` (Spam)\n- `7` (Unsub)\n- `8` (Blocked)\n- `9` (SoftBounce)\n- `10` (HardBounce)\n- `11` (Deferred)\n"
PlanSubscription:
type: integer
description: Retrieves only messages with the specified PlanSubscription ID.
SenderID:
type: integer
description: Retrieves only messages sent using a sender address with the specified ID.
ShowContactAlt:
type: boolean
description: "When true, the recipient's email address will be displayed in the message object under `ContactAlt`.\n\nDefault value: `false`\n"
ShowCustomID:
type: boolean
description: "When true, the `CustomID` attached to the message will be displayed in the message object under `CustomID`.\n\nDefault value: `false`\n"
ShowSubject:
type: boolean
description: "When true, the subject of the message will be displayed under `Subject`.\n\nDefault value: `false`\n"
ToTS:
type: string
description: Retrieves only messages sent before the specified timestamp. Both Unix timestamp (e.g. 1514764800) and RFC3339 (2018-01-01T00:00:00) formats are accepted.
Limit:
type: integer
description: "Limit the response to a select number of returned objects.\n\nDefault value: `10`. Maximum value: `1000`\n"
Offset:
type: integer
description: "Retrieve a list of objects starting from a certain offset. Combine this query parameter with `Limit` to retrieve a specific section of the list of objects.\n\nDefault value: `0`\n"
countOnly:
type: boolean
description: "Set the value of this query parameter to `1` to retrieve the overall number of objects returned by this request for your API Key. No list of results will be returned - the objects will simply be counted.\n\nDefault value: `0`\n\nNote: When you send a request without the `countOnly` query parameter, `Count` and `Total` will only return the number of extracted elements and not the overall number.\n"
Sort:
type: string
description: "Specify a property name for this query parameter to sort the objects in `Data`. By default the sorting is ascending. When a property name is postfixed with DESC (i.e. `property_name+DESC`), the sort order will be descending.\n\nNote: Both the `Sort` query parameter and the option to select a descending order are not available for every property.\n"
get_v3_message_id_PathParams:
type: object
required:
- message_ID
properties:
message_ID:
type: integer
description: Unique numeric ID of the message you want to retrieve.
get_v3_messageinformation_QueryParams:
type: object
properties:
CampaignID:
type: integer
description: Retrieves information only about messages that are part of this campaign.
ContactsList:
type: integer
description: Retrieves information only about messages that were sent to this contact list.
CustomCampaign:
type: string
description: Retrieves information only about messages that are part of a campaign with the specified Custom ID.
From:
type: string
description: Retrieves information only about messages sent from the specified sender email address.
FromDomain:
type: string
description: Retrieves information only about messages sent from the specified sender domain.
FromID:
type: integer
description: Retrieves information only about messages sent from the specified sender ID.
FromTS:
type: string
description: Retrieves information only about messages sent after the specified timestamp. Both Unix timestamp (e.g. 1514764800) and RFC3339 (2018-01-01T00:00:00) formats are accepted.
FromType:
type: integer
description: "Retrieves information only for a specific type of messages:\n\n- `1` - Transactional\n- `2` - Marketing\n- `3` - Unknown\n"
IsDeleted:
type: boolean
description: When true, will retrieve information only for messages that are part of deleted campaigns. When false, messages from deleted campaigns will be excluded from the response.
IsNewsletterTool:
type: boolean
description: When true, will retrieve information only for campaigns created with the Legacy template builder. When false, campaigns created with the Legacy builder will be excluded from the response.
IsStarred:
type: boolean
description: When true, will retrieve information only for messages that are part of starred campaigns. When false, messages from starred campaigns will be excluded from the response.
MessageStatus:
type: integer
description: "Retrieves information only for messages with the specified status:\n\n- `0` (Processed)\n- `1` (Queued)\n- `2` (Sent)\n- `3` (Opened)\n- `4` (Clicked)\n- `5` (Bounce)\n- `6` (Spam)\n- `7` (Unsub)\n- `8` (Blocked)\n- `9` (SoftBounce)\n- `10` (HardBounce)\n- `11` (Deferred)\n"
Period:
type: string
description: "Retrieves information only for messages sent between the start of the selected period and the current timestamp.\n\n- `Day` - since the start of the current day\n- `Week` - since the start of the current week\n- `Month` - since the start of the current month\n- `Year` - since the start of the current year\n"
ToTS:
type: string
description: Retrieves information only for messages sent before the specified timestamp. Both Unix timestamp (e.g. 1514764800) and RFC3339 (2018-01-01T00:00:00) formats are accepted.
Limit:
type: integer
description: "Limit the response to a select number of returned objects.\n\nDefault value: `10`. Maximum value: `1000`\n"
Offset:
type: integer
description: "Retrieve a list of objects starting from a certain offset. Combine this query parameter with `Limit` to retrieve a specific section of the list of objects.\n\nDefault value: `0`\n"
countOnly:
type: boolean
description: "Set the value of this query parameter to `1` to retrieve the overall number of objects returned by this request for your API Key. No list of results will be returned - the objects will simply be counted.\n\nDefault value: `0`\n\nNote: When you send a request without the `countOnly` query parameter, `Count` and `Total` will only return the number of extracted elements and not the overall number.\n"
Sort:
type: string
description: "Specify a property name for this query parameter to sort the objects in `Data`. By default the sorting is ascending. When a property name is postfixed with DESC (i.e. `property_name+DESC`), the sort order will be descending.\n\nNote: Both the `Sort` query parameter and the option to select a descending order are not available for every property.\n"
get_v3_messageinformation_id_PathParams:
type: object
required:
- message_ID
properties:
message_ID:
type: integer
description: Unique numeric ID of the message you want to retrieve information about.
get_v3_messagestatistics_QueryParams:
type: object
properties:
CampaignID:
type: integer
description: Retrieves statistics only for the specified Campaign ID.
ContactEmail:
type: string
description: Retrieves statistics only for this contact email address.
ContactID:
type: integer
description: Retrieves statistics only for this contact ID.
ContactListID:
type: integer
description: Retrieves statistics only for this contact list ID.
ContactsList:
type: integer
description: Retrieves statistics only for this contact list ID.
CustomCampaign:
type: string
description: Retrieves statistics only for the campaign with the specified Custom Value.
From:
type: string
description: Retrieves statistics only for messages sent from the specified Sender Email address.
FromDomain:
type: string
description: Retrieves statistics only for messages sent from the specified sender domain.
FromID:
type: integer
description: Retrieves statistics only for messages sent from the sender address with the specified ID.
FromTS:
type: string
description: Retrieves statistics only for messages sent after the specified timestamp. Both Unix timestamp (e.g. 1514764800) and RFC3339 (2018-01-01T00:00:00) formats are accepted.
FromType:
type: integer
description: "Retrieves statistics only for a specific type of messages:\n\n- `1` - Transactional\n- `2` - Marketing\n- `3` - Unknown\n"
IsDeleted:
type: boolean
description: When true, will retrieve statistics only for deleted campaigns. When false, stats for deleted campaigns will be excluded from the response.
IsNewsletterTool:
type: boolean
description: When true, will retrieve statistics only for campaigns created with the Legacy template builder. When false, campaigns created with the Legacy builder will be excluded from the response.
IsStarred:
type: boolean
description: When true, will retrieve statistics only for starred campaigns. When false, starred campaigns will be excluded from the response.
MessageStatus:
type: integer
description: "Retrieves statistics only for messages with the specified status:\n\n- `0` (Processed)\n- `1` (Queued)\n- `2` (Sent)\n- `3` (Opened)\n- `4` (Clicked)\n- `5` (Bounce)\n- `6` (Spam)\n- `7` (Unsub)\n- `8` (Blocked)\n- `9` (SoftBounce)\n- `10` (HardBounce)\n- `11` (Deferred)\n"
Period:
type: string
description: "Retrieves statistics only for messages sent between the start of the selected period and the current timestamp.\n\n- `Day` - since the start of the current day\n- `Week` - since the start of the current week\n- `Month` - since the start of the current month\n- `Year` - since the start of the current year\n"
ProcessTotalClicksCount:
type: boolean
description: "When true, will calculate and return the total number of click events in the `TotalClicksCount` property.\n\nDefault value: `false`\n"
ProcessTotalOpensCount:
type: boolean
description: "When true, will calculate and return the total number of open events in the `TotalOpensCount` property.\n\nDefault value: `false`\n"
ToTS:
type: string
description: Retrieves statistics only for messages sent before the specified timestamp. Both Unix timestamp (e.g. 1514764800) and RFC3339 (2018-01-01T00:00:00) formats are accepted.
Limit:
type: integer
description: "Limit the response to a select number of returned objects.\n\nDefault value: `10`. Maximum value: `1000`\n"
Offset:
type: integer
description: "Retrieve a list of objects starting from a certain offset. Combine this query parameter with `Limit` to retrieve a specific section of the list of objects.\n\nDefault value: `0`\n"
countOnly:
type: boolean
description: "Set the value of this query parameter to `1` to retrieve the overall number of objects returned by this request for your API Key. No list of results will be returned - the objects will simply be counted.\n\nDefault value: `0`\n\nNote: When you send a request without the `countOnly` query parameter, `Count` and `Total` will only return the number of extracted elements and not the overall number.\n"
Sort:
type: string
description: "Specify a property name for this query parameter to sort the objects in `Data`. By default the sorting is ascending. When a property name is postfixed with DESC (i.e. `property_name+DESC`), the sort order will be descending.\n\nNote: Both the `Sort` query parameter and the option to select a descending order are not available for every property.\n"
get_v3_metasender_QueryParams:
type: object
properties:
DNS:
type: integer
description: Retrieves only metasender objects linked to this DNS ID.
Limit:
type: integer
description: "Limit the response to a select number of returned objects.\n\nDefault value: `10`. Maximum value: `1000`\n"
Offset:
type: integer
description: "Retrieve a list of objects starting from a certain offset. Combine this query parameter with `Limit` to retrieve a specific section of the list of objects.\n\nDefault value: `0`\n"
countOnly:
type: boolean
description: "Set the value of this query parameter to `1` to retrieve the overall number of objects returned by this request for your API Key. No list of results will be returned - the objects will simply be counted.\n\nDefault value: `0`\n\nNote: When you send a request without the `countOnly` query parameter, `Count` and `Total` will only return the number of extracted elements and not the overall number.\n"
Sort:
type: string
description: "Specify a property name for this query parameter to sort the objects in `Data`. By default the sorting is ascending. When a property name is postfixed with DESC (i.e. `property_name+DESC`), the sort order will be descending.\n\nNote: Both the `Sort` query parameter and the option to select a descending order are not available for every property.\n"
get_v3_metasender_id_PathParams:
type: object
required:
- metasender_ID
properties:
metasender_ID:
type: integer
description: Unique numeric ID of the metasender object you want to retrieve.
metasender_email:
type: string
description: The email address of the metasender object you want to retrieve. Can be used as an alternative to `metasender_ID`.
get_v3_myprofile_QueryParams:
type: object
additionalProperties: false
properties:
User:
type: integer
description: Reference to the associated user.
Limit:
type: integer
description: "Limit the response to a select number of returned objects.\n\nDefault value: `10`. Maximum value: `1000`\n"
Offset:
type: integer
description: "Retrieve a list of objects starting from a certain offset. Combine this query parameter with `Limit` to retrieve a specific section of the list of objects.\n\nDefault value: `0`\n"
countOnly:
type: boolean
description: "Set the value of this query parameter to `1` to retrieve the overall number of objects returned by this request for your API Key. No list of results will be returned - the objects will simply be counted.\n\nDefault value: `0`\n\nNote: When you send a request without the `countOnly` query parameter, `Count` and `Total` will only return the number of extracted elements and not the overall number.\n"
Sort:
type: string
description: "Specify a property name for this query parameter to sort the objects in `Data`. By default the sorting is ascending. When a property name is postfixed with DESC (i.e. `property_name+DESC`), the sort order will be descending.\n\nNote: Both the `Sort` query parameter and the option to select a descending order are not available for every property.\n"
get_v3_newsletter_QueryParams:
type: object
properties:
AXTesting:
type: integer
description: Retrieves only the newsletters linked to the specified AXTesting ID.
Campaign:
type: integer
description: Retrieves only the newsletter linked to the specified Campaign ID.
ContactsList:
type: integer
description: Retrieves only the newsletters linked to the specified contact list ID.
DeliveredAt:
type: string
description: Retrieves only the newsletters, which were delivered at the specified timestamp. Both Unix timestamp (e.g. 1514764800) and RFC3339 (2018-01-01T00:00:00) formats are accepted.
EditMode:
type: string
description: "Retrieves only the newsletters, whose email templates were edited with the specified edit tools:\n\n - `tool` - Legacy drag-and-drop template editor\n - `html` - Legacy HTML editor\n"
IsArchived:
type: boolean
description: When true, will return only archived newsletters. When false, archived newsletters will be excluded from the response.
IsCampaign:
type: boolean
description: Only retrieve newsletter objects which already have a corresponding campaign
IsDeleted:
type: boolean
description: When true, will return only deleted newsletters. When false, deleted newsletters will be excluded from the response.
IsHandled:
type: boolean
description: When true, will return only newsletters which have been sent out, or where a test email was sent out. When false, handled newsletters will be excluded from the response.
IsStarred:
type: boolean
description: When true, will return only starred newsletters. When false, starred newsletters will be excluded from the response.
Modified:
type: boolean
description: "When true, will return only newsletters that have been modified after their creation. When false, only non-modified newsletters will be returned.\n\n> Note: All newsletters created within the Mailjet app are marked as Modified immediately after creation, while ones created via the API are not.\n"
NewsLetterTemplate:
type: integer
description: Retrieves only the newsletters based on this template.
Segmentation:
type: integer
description: Retrieves only the newsletters, which use the specified segmentation ID.
Status:
type: string
description: "Retrieves only the newsletters with with the specified status ID:\n\n - `-3` - AXCanceled\n - `-2` - Deleted\n - `-1` - Archived\n - `0` - Draft\n - `1` - Programmed (scheduled)\n - `2` - Sent\n - `3` - AXTested (AB Testing versions sent, but winning version not selected yet)\n - `4` - AXSelected (AB Testing winning version selected and sent)\n"
Subject:
type: string
description: Retrieves only the newsletters with the specified Subject line.
Limit:
type: integer
description: "Limit the response to a select number of returned objects.\n\nDefault value: `10`. Maximum value: `1000`\n"
Offset:
type: integer
description: "Retrieve a list of objects starting from a certain offset. Combine this query parameter with `Limit` to retrieve a specific section of the list of objects.\n\nDefault value: `0`\n"
countOnly:
type: boolean
description: "Set the value of this query parameter to `1` to retrieve the overall number of objects returned by this request for your API Key. No list of results will be returned - the objects will simply be counted.\n\nDefault value: `0`\n\nNote: When you send a request without the `countOnly` query parameter, `Count` and `Total` will only return the number of extracted elements and not the overall number.\n"
Sort:
type: string
description: "Specify a property name for this query parameter to sort the objects in `Data`. By default the sorting is ascending. When a property name is postfixed with DESC (i.e. `property_name+DESC`), the sort order will be descending.\n\nNote: Both the `Sort` query parameter and the option to select a descending order are not available for every property.\n"
get_v3_newsletter_id_PathParams:
type: object
required:
- newsletter_ID
properties:
newsletter_ID:
type: integer
description: Unique numeric ID of the newsletter you want to retrieve.
get_v3_openinformation_QueryParams:
type: object
properties:
CampaignID:
type: integer
description: Retrieves only open events linked to the specified campaign ID.
ContactsList:
type: integer
description: Retrieves only open events linked to contacts from this contact list ID.
CustomCampaign:
type: string
description: Retrieves only open event details for the campaign with the specified custom value.
EventFromTs:
type: string
description: Retrieves information only about open events that happened after the specified timestamp (`OpenedAt` >= `EventFromTs`). Can be used only if the `CampaignID` query parameter is specified as well. Both Unix timestamp (e.g. 1514764800) and RFC3339 (2018-01-01T00:00:00) formats are accepted.
EventToTs:
type: string
description: Retrieves information only about open events that happened before the specified timestamp (`OpenedAt` <= `EventFromTs`). Can be used only if the `CampaignID` query parameter is specified as well. Both Unix timestamp (e.g. 1514764800) and RFC3339 (2018-01-01T00:00:00) formats are accepted.
FromTS:
type: string
description: "Retrieves information only about open events linked to campaigns sent after the specified timestamp. Both Unix timestamp (e.g. 1514764800) and RFC3339 (2018-01-01T00:00:00) formats are accepted.\n\n> If no query parameters are used, `FromTS` defaults to the current day at 00:00 UTC.\n"
From:
type: string
description: Retrieves only open event details for the campaigns, which used the specified sender email address.
FromDomain:
type: string
description: Retrieves only open event details for the campaigns, which used the specified sender email domain.
FromID:
type: integer
description: Retrieves only open event details for the campaign, which used the specified sender ID.
FromType:
type: integer
description: "Retrieves only open event details for the messages of the specified type:\n\n- `1` - Transactional\n- `2` - Marketing\n- `3` - Unknown\n"
IsDeleted:
type: boolean
description: When true, only open event details for deleted campaigns will be returned. When false, deleted campaigns will be excluded from the response.
MessageStatus:
type: integer
description: "Retrieves only open events linked to messages with the specified status:\n\n- `0` (Processed)\n- `1` (Queued)\n- `2` (Sent)\n- `3` (Opened)\n- `4` (Clicked)\n- `5` (Bounce)\n- `6` (Spam)\n- `7` (Unsub)\n- `8` (Blocked)\n- `9` (SoftBounce)\n- `10` (HardBounce)\n- `11` (Deferred)\n"
Period:
type: string
description: "Retrieves information only about open events registered between the start of the selected period and the current timestamp.\n\n- `Day` - since the start of the current day\n- `Week` - since the start of the current week\n- `Month` - since the start of the current month\n- `Year` - since the start of the current year\n"
ToTS:
type: string
description: Retrieves information only about open events linked to campaigns sent before the specified timestamp. Both Unix timestamp (e.g. 1514764800) and RFC3339 (2018-01-01T00:00:00) formats are accepted.
Limit:
type: integer
description: "Limit the response to a select number of returned objects.\n\nDefault value: `10`. Maximum value: `1000`\n"
Offset:
type: integer
description: "Retrieve a list of objects starting from a certain offset. Combine this query parameter with `Limit` to retrieve a specific section of the list of objects.\n\nDefault value: `0`\n"
countOnly:
type: boolean
description: "Set the value of this query parameter to `1` to retrieve the overall number of objects returned by this request for your API Key. No list of results will be returned - the objects will simply be counted.\n\nDefault value: `0`\n\nNote: When you send a request without the `countOnly` query parameter, `Count` and `Total` will only return the number of extracted elements and not the overall number.\n"
Sort:
type: string
description: "Specify a property name for this query parameter to sort the objects in `Data`. By default the sorting is ascending. When a property name is postfixed with DESC (i.e. `property_name+DESC`), the sort order will be descending.\n\nNote: Both the `Sort` query parameter and the option to select a descending order are not available for every property.\n"
get_v3_openinformation_id_PathParams:
type: object
required:
- message_ID
properties:
message_ID:
type: integer
description: Unique numeric ID of the message you want to retrieve the open event information about.
get_v3_openstatistics_QueryParams:
type: object
properties:
CampaignID:
type: integer
description: Retrieves open statistics only for the specified Campaign ID.
ContactsList:
type: integer
description: Retrieves open statistics only for the specified contact list ID.
CustomCampaign:
type: string
description: Retrieves open statistics only for the campaign with the specified Custom Value.
From:
type: string
description: Retrieves open statistics only for messages sent from the specified Sender Email address.
FromDomain:
type: string
description: Retrieves open statistics only for messages sent from the specified domain.
FromID:
type: integer
description: Retrieves open statistics only for messages sent from the sender address with the specified ID.
FromTS:
type: string
description: "Retrieves open statistics only for messages sent after the specified timestamp. Both Unix timestamp (e.g. 1514764800) and RFC3339 (2018-01-01T00:00:00) formats are accepted.\n\n> If no query parameters are used, `FromTS` defaults to the current day at 00:00 UTC.\n"
FromType:
type: integer
description: "Retrieves open statistics only for a specific type of messages:\n\n- `1` - Transactional\n- `2` - Marketing\n- `3` - Unknown\n"
IsDeleted:
type: boolean
description: When true, will retrieve open statistics only for deleted campaigns. When false, stats for deleted campaigns will be excluded from the response.
IsNewsletterTool:
type: boolean
description: When true, will retrieve open statistics only for campaigns created with the Legacy template builder. When false, campaigns created with the Legacy builder will be excluded from the response.
IsStarred:
type: boolean
description: When true, will retrieve open statistics only for starred campaigns. When false, starred campaigns will be excluded from the response.
MessageStatus:
type: integer
description: "Retrieves open statistics only for messages with the specified status:\n\n- `0` (Processed)\n- `1` (Queued)\n- `2` (Sent)\n- `3` (Opened)\n- `4` (Clicked)\n- `5` (Bounce)\n- `6` (Spam)\n- `7` (Unsub)\n- `8` (Blocked)\n- `9` (SoftBounce)\n- `10` (HardBounce)\n- `11` (Deferred)\n"
Period:
type: string
description: "Retrieves open statistics only for messages sent between the start of the selected period and the current timestamp.\n\n- `Day` - since the start of the current day\n- `Week` - since the start of the current week\n- `Month` - since the start of the current month\n- `Year` - since the start of the current year\n"
ToTS:
type: string
description: Retrieves open statistics only for messages sent before the specified timestamp. Both Unix timestamp (e.g. 1514764800) and RFC3339 (2018-01-01T00:00:00) formats are accepted.
Limit:
type: integer
description: "Limit the response to a select number of returned objects.\n\nDefault value: `10`. Maximum value: `1000`\n"
Offset:
type: integer
description: "Retrieve a list of objects starting from a certain offset. Combine this query parameter with `Limit` to retrieve a specific section of the list of objects.\n\nDefault value: `0`\n"
countOnly:
type: boolean
description: "Set the value of this query parameter to `1` to retrieve the overall number of objects returned by this request for your API Key. No list of results will be returned - the objects will simply be counted.\n\nDefault value: `0`\n\nNote: When you send a request without the `countOnly` query parameter, `Count` and `Total` will only return the number of extracted elements and not the overall number.\n"
Sort:
type: string
description: "Specify a property name for this query parameter to sort the objects in `Data`. By default the sorting is ascending. When a property name is postfixed with DESC (i.e. `property_name+DESC`), the sort order will be descending.\n\nNote: Both the `Sort` query parameter and the option to select a descending order are not available for every property.\n"
get_v3_parseroute_id_PathParams:
type: object
required:
- parseroute_ID
properties:
parseroute_ID:
type: integer
description: Unique numeric ID for this parseroute object. Alternatively, you can use the email address associated with this object. Keep in mind that the email address needs to be URL encoded.
get_v3_sender_QueryParams:
type: object
properties:
DnsID:
type: integer
description: Retrieves only senders linked to this DNS ID.
Domain:
type: string
description: Retrieves only senders with the specified domain in their Email.
Email:
type: string
description: Retrieves only senders with the specified Email address.
IsDomainSender:
type: boolean
description: When true, will retrieve only domain sender objects. When false, domain senders are excluded from the response.
LocalPart:
type: string
description: Retrieves only senders with the specified local part in their Email address. Since the local part of domains is an asterisk, you can use this query parameter with * as its value to return only sender domains.
ShowDeleted:
type: boolean
description: "When true, will retrieve deleted sender objects along with non-deleted ones. When false, deleted senders will be excluded from the response.\n\nDefault value: `false`\n"
Status:
type: string
description: "Retrieves only senders with the specified status.\n\nPossible values:\n\n- `Inactive`\n- `Active`\n- `Deleted`\n"
Limit:
type: integer
description: "Limit the response to a select number of returned objects.\n\nDefault value: `10`. Maximum value: `1000`\n"
Offset:
type: integer
description: "Retrieve a list of objects starting from a certain offset. Combine this query parameter with `Limit` to retrieve a specific section of the list of objects.\n\nDefault value: `0`\n"
countOnly:
type: boolean
description: "Set the value of this query parameter to `1` to retrieve the overall number of objects returned by this request for your API Key. No list of results will be returned - the objects will simply be counted.\n\nDefault value: `0`\n\nNote: When you send a request without the `countOnly` query parameter, `Count` and `Total` will only return the number of extracted elements and not the overall number.\n"
Sort:
type: string
description: "Specify a property name for this query parameter to sort the objects in `Data`. By default the sorting is ascending. When a property name is postfixed with DESC (i.e. `property_name+DESC`), the sort order will be descending.\n\nNote: Both the `Sort` query parameter and the option to select a descending order are not available for every property.\n"
get_v3_sender_id_PathParams:
type: object
required:
- sender_ID
properties:
sender_ID:
type: integer
description: Unique numeric ID of the sender you want to retrieve details about.
sender_email:
type: string
description: The email address of the sender object you want to retrieve. Can be used as an alternative to `sender_ID`.
get_v3_senderstatistics_QueryParams:
type: object
properties:
Domain:
type: string
description: Retrieves statistics only for senders where the domain name of the email address or domain matches the specified value - e.g. `mailjet.com`.
Email:
type: string
description: Retrieves statistics only for senders where the local part of the email matches the specified value - e.g. `example@`.
Sender:
type: integer
description: Retrieve statistics only for the specified sender ID.
Limit:
type: integer
description: "Limit the response to a select number of returned objects.\n\nDefault value: `10`. Maximum value: `1000`\n"
Offset:
type: integer
description: "Retrieve a list of objects starting from a certain offset. Combine this query parameter with `Limit` to retrieve a specific section of the list of objects.\n\nDefault value: `0`\n"
countOnly:
type: boolean
description: "Set the value of this query parameter to `1` to retrieve the overall number of objects returned by this request for your API Key. No list of results will be returned - the objects will simply be counted.\n\nDefault value: `0`\n\nNote: When you send a request without the `countOnly` query parameter, `Count` and `Total` will only return the number of extracted elements and not the overall number.\n"
Sort:
type: string
description: "Specify a property name for this query parameter to sort the objects in `Data`. By default the sorting is ascending. When a property name is postfixed with DESC (i.e. `property_name+DESC`), the sort order will be descending.\n\nNote: Both the `Sort` query parameter and the option to select a descending order are not available for every property.\n"
get_v3_statcounters_QueryParams:
type: object
properties:
CounterSource:
type: string
description: "Defines the scope of aggregation for your statistics.\n\nPossible values:\n\n- `Campaign`\n- `APIKey`\n- `List` : Contact list. Can only be used with `CounterTiming=Message&CounterResolution=Lifetime`.\n- `Sender` : Sender email address. Can only be used with `CounterTiming=Message`\n"
CounterResolution:
type: string
description: "Defines the timescale of aggregation for your statistics.\n\nPossible values:\n\n- `Highest` (5-minute intervals)\n- `Hour`\n- `Day`\n- `Lifetime` : cannot be used with `CounterTiming=Event`.\n"
CounterTiming:
type: string
description: "Defines the reference timestamp for aggregation of statistics. [More information](/docs/email-api/statistics/key-performance-stats)\n\nPossible values:\n\n- `Message`\n- `Event`\n\n> Note: If you select `CounterTiming=Event`, you will not be able to choose `CounterResolution=Lifetime`, as retrieving statistics with event-based timings needs a specific timescale to illustrate the evolution of the stats.\n"
FromTS:
type: string
description: "Retrieve statistics for messages sent after the specified timestamp. Mandatory when `CounterResolution` is different from `Lifetime`. Both Unix timestamp (e.g. 1514764800) and RFC3339 (2018-01-01T00:00:00) formats are accepted.\n\n> Note: The maximum time period that can be selected between `FromTS`and `ToTS` equals 100 times the timescale selected for `CounterResolution`. So if `CounterResolution=Highest`, the period will be 500 minutes (8 hours and 20 minutes); if `CounterResolution=Hour`, it's 100 hours (4 days and 4 hours); if `CounterResolution=Day`, it's 100 days.\n"
SourceID:
type: integer
description: List of either Campaign IDs or ContactsList IDs (separated by commas). Mandatory when `CounterSource` indicates `Campaign`, `List` or `Sender`.
ToTS:
type: string
description: "Retrieve statistics for messages sent before the specified timestamp. Both Unix timestamp (e.g. 1514764800) and RFC3339 (2018-01-01T00:00:00) formats are accepted.\n\n> Note: The maximum time period that can be selected between `FromTS`and `ToTS` equals 100 times the timescale selected for `CounterResolution`. So if `CounterResolution=Highest`, the period will be 500 minutes (8 hours and 20 minutes); if `CounterResolution=Hour`, it's 100 hours (4 days and 4 hours); if `CounterResolution=Day`, it's 100 days.\n"
Limit:
type: integer
description: "Limit the response to a select number of returned objects.\n\nDefault value: `10`. Maximum value: `1000`\n"
Offset:
type: integer
description: "Retrieve a list of objects starting from a certain offset. Combine this query parameter with `Limit` to retrieve a specific section of the list of objects.\n\nDefault value: `0`\n"
countOnly:
type: boolean
description: "Set the value of this query parameter to `1` to retrieve the overall number of objects returned by this request for your API Key. No list of results will be returned - the objects will simply be counted.\n\nDefault value: `0`\n\nNote: When you send a request without the `countOnly` query parameter, `Count` and `Total` will only return the number of extracted elements and not the overall number.\n"
Sort:
type: string
description: "Specify a property name for this query parameter to sort the objects in `Data`. By default the sorting is ascending. When a property name is postfixed with DESC (i.e. `property_name+DESC`), the sort order will be descending.\n\nNote: Both the `Sort` query parameter and the option to select a descending order are not available for every property.\n"
get_v3_template_QueryParams:
type: object
properties:
Categories:
type: string
description: Retrieves information only about templates, which have the respective categories assigned. You can separate multiple categories with a comma. When selecting multiple categories, use the `CategoriesSelectionMethod` to specify the relation between between the selected ones and the template's list of categories.
CategoriesSelectionMethod:
type: string
description: "Describes the relation between the value of the `Categories` query parameter and the template's list of categories.\n\nPossible values:\n\n- `containsany`\n- `containsall`\n- `issubset`\n\nDefault value: `containsany`\n"
EditMode:
type: integer
description: "Retrieves information only about templates with the specified mode of editing:\n\n- `1` - Passport drag-and-drop builder\n- `2` - Passport HTML builder\n- `3` - Passport Saved Section (snippet) builder\n- `4` - Passport MJML builder\n"
Name:
type: string
description: Retrieves information only about templates with the specified name.
OwnerType:
type: string
description: "Retrieves information only about templates with the specified owner type.\n\nPossible values:\n\n- `apikey` - Templates and their content can be retrieved, edited and used only by the API Key they were created from.\n- `user` - Templates created by the Primary API Key. Templates and their content can be retrieved by the Primary API Key, as well as all subaccount API Keys. However, they can be edited and used only by the Primary API Key.\n- `global` - Generic templates created by Mailjet visible in the Passport Template Gallery.\n"
Purposes:
type: string
description: "Retrieves information only about templates, which have the respective purposes assigned. You can separate multiple purposes with a comma. When selecting multiple purposes, use the `PurposesSelectionMethod` to specify the relation between between the selected ones and the template's list of purposes.\n\nPossible values:\n\n- `marketing`\n- `transactional`\n- `automation`\n"
PurposesSelectionMethod:
type: string
description: "Describes the relation between the value of the `Purposes` query parameter and the template's list of purposes.\n\nPossible values:\n\n- `containsany`\n- `containsall`\n- `issubset`\n"
Limit:
type: integer
description: "Limit the response to a select number of returned objects.\n\nDefault value: `10`. Maximum value: `1000`\n"
Offset:
type: integer
description: "Retrieve a list of objects starting from a certain offset. Combine this query parameter with `Limit` to retrieve a specific section of the list of objects.\n\nDefault value: `0`\n"
countOnly:
type: boolean
description: "Set the value of this query parameter to `1` to retrieve the overall number of objects returned by this request for your API Key. No list of results will be returned - the objects will simply be counted.\n\nDefault value: `0`\n\nNote: When you send a request without the `countOnly` query parameter, `Count` and `Total` will only return the number of extracted elements and not the overall number.\n"
Sort:
type: string
description: "Specify a property name for this query parameter to sort the objects in `Data`. By default the sorting is ascending. When a property name is postfixed with DESC (i.e. `property_name+DESC`), the sort order will be descending.\n\nNote: Both the `Sort` query parameter and the option to select a descending order are not available for every property.\n"
get_v3_template_id_PathParams:
type: object
required:
- template_ID
properties:
template_ID:
type: integer
description: Unique numeric ID for the template you want to retrieve.
Owner_Type|Template_Name:
type: string
description: A combination of the `OwnerType` and user-selected name for the template you want to retrieve, separated with a vertial line. E.g. `user|Weekly Newsletter`. Can be used as an alternative to `template_ID`.
get_v3_toplinkclicked_QueryParams:
type: object
properties:
ActualClicks:
type: boolean
description: "When true, will retrieve statistics for the total number of click events. When false, will retrieve a count of unique (deduplicated) clicks.\n\nDefault value: `false`\n"
CampaignID:
type: integer
description: Retrieves link click statistics only for the specified Campaign ID.
Contact:
type: integer
description: Retrieves link click statistics only for the specified contact ID.
ContactsList:
type: integer
description: Retrieves link click statistics only for the specified contact list ID.
CustomCampaign:
type: string
description: Retrieves link click statistics only for the campaign with the specified Custom Value.
From:
type: string
description: Retrieves link click statistics only for messages sent from the specified Sender Email address.
FromDomain:
type: string
description: Retrieves link click statistics only for messages sent from the specified domain.
FromID:
type: integer
description: Retrieves link click statistics only for messages sent from the sender address with the specified ID.
FromTS:
type: string
description: Retrieves link click statistics only for messages sent after the specified timestamp. Both Unix timestamp (e.g. 1514764800) and RFC3339 (2018-01-01T00:00:00) formats are accepted.
FromType:
type: integer
description: "Retrieves link click statistics only for a specific type of messages:\n\n- `1` - Transactional\n- `2` - Marketing\n- `3` - Unknown\n"
IsDeleted:
type: boolean
description: When true, will retrieve link click statistics only for deleted campaigns. When false, stats for deleted campaigns will be excluded from the response.
IsNewsletterTool:
type: boolean
description: When true, will retrieve link click statistics only for campaigns created with the Legacy template builder. When false, campaigns created with the Legacy builder will be excluded from the response.
IsStarred:
type: boolean
description: When true, will retrieve link click statistics only for starred campaigns. When false, starred campaigns will be excluded from the response.
Message:
type: integer
description: Retrieves link click statistics only for the specified message ID.
Period:
type: string
description: "Retrieves link click statistics only for messages sent between the start of the selected period and the current timestamp.\n\n- `Day` - since the start of the current day\n- `Week` - since the start of the current week\n- `Month` - since the start of the current month\n- `Year` - since the start of the current year\n"
ToTS:
type: string
description: Retrieves link click statistics only for messages sent before the specified timestamp. Both Unix timestamp (e.g. 1514764800) and RFC3339 (2018-01-01T00:00:00) formats are accepted.
Limit:
type: integer
description: "Limit the response to a select number of returned objects.\n\nDefault value: `10`. Maximum value: `1000`\n"
Offset:
type: integer
description: "Retrieve a list of objects starting from a certain offset. Combine this query parameter with `Limit` to retrieve a specific section of the list of objects.\n\nDefault value: `0`\n"
countOnly:
type: boolean
description: "Set the value of this query parameter to `1` to retrieve the overall number of objects returned by this request for your API Key. No list of results will be returned - the objects will simply be counted.\n\nDefault value: `0`\n\nNote: When you send a request without the `countOnly` query parameter, `Count` and `Total` will only return the number of extracted elements and not the overall number.\n"
Sort:
type: string
description: "Specify a property name for this query parameter to sort the objects in `Data`. By default the sorting is ascending. When a property name is postfixed with DESC (i.e. `property_name+DESC`), the sort order will be descending.\n\nNote: Both the `Sort` query parameter and the option to select a descending order are not available for every property.\n"
get_v3_user_QueryParams:
type: object
additionalProperties: false
properties:
IsActivated:
type: boolean
description: Only retrieve user resources for which IsActivated equals the specified value.
NewEmail:
type: string
description: New email address pending confirmation.
UserName:
type: string
description: Only retrieve users where Username matches the specified value.
Limit:
type: integer
description: "Limit the response to a select number of returned objects.\n\nDefault value: `10`. Maximum value: `1000`\n"
Offset:
type: integer
description: "Retrieve a list of objects starting from a certain offset. Combine this query parameter with `Limit` to retrieve a specific section of the list of objects.\n\nDefault value: `0`\n"
countOnly:
type: boolean
description: "Set the value of this query parameter to `1` to retrieve the overall number of objects returned by this request for your API Key. No list of results will be returned - the objects will simply be counted.\n\nDefault value: `0`\n\nNote: When you send a request without the `countOnly` query parameter, `Count` and `Total` will only return the number of extracted elements and not the overall number.\n"
Sort:
type: string
description: "Specify a property name for this query parameter to sort the objects in `Data`. By default the sorting is ascending. When a property name is postfixed with DESC (i.e. `property_name+DESC`), the sort order will be descending.\n\nNote: Both the `Sort` query parameter and the option to select a descending order are not available for every property.\n"
get_v3_useragentstatistics_QueryParams:
type: object
properties:
CampaignID:
type: integer
description: Retrieves statistics only for the specified Campaign ID.
ContactsList:
type: integer
description: Retrieves statistics only for the specified contact list ID.
CustomCampaign:
type: string
description: Retrieves statistics only for the campaign with the specified Custom Value.
Event:
type: string
description: "Type of event you want the count for.\n\nPossible values:\n\n- `open`\n- `click`\n\nDefault value: `click`\n"
ExcludePlatform:
type: string
description: Exclude browsers / email clients running on this platform from response.
From:
type: string
description: Retrieves statistics only for messages sent from the specified Sender Email address.
FromDomain:
type: string
description: Retrieves statistics only for messages sent from the specified domain.
FromID:
type: integer
description: Retrieves statistics only for messages sent from the sender address with the specified ID.
FromTS:
type: string
description: Retrieves statistics only for messages sent after the specified timestamp. Both Unix timestamp (e.g. 1514764800) and RFC3339 (2018-01-01T00:00:00) formats are accepted.
FromType:
type: integer
description: "Retrieves statistics only for a specific type of messages:\n\n- `1` - Transactional\n- `2` - Marketing\n- `3` - Unknown\n"
IsDeleted:
type: boolean
description: When true, will retrieve statistics only for deleted campaigns. When false, stats for deleted campaigns will be excluded from the response.
IsNewsletterTool:
type: boolean
description: When true, will retrieve statistics only for campaigns created with the Legacy template builder. When false, campaigns created with the Legacy builder will be excluded from the response.
IsStarred:
type: boolean
description: When true, will retrieve statistics only for starred campaigns. When false, starred campaigns will be excluded from the response.
Period:
type: string
description: "Retrieves statistics only for messages sent between the start of the selected period and the current timestamp.\n\n- `Day` - since the start of the current day\n- `Week` - since the start of the current week\n- `Month` - since the start of the current month\n- `Year` - since the start of the current year\n"
Platform:
type: string
description: Retrieves statistics only for the specified platform.
ToTS:
type: string
description: Retrieves statistics only for messages sent before the specified timestamp. Both Unix timestamp (e.g. 1514764800) and RFC3339 (2018-01-01T00:00:00) formats are accepted.
Limit:
type: integer
description: "Limit the response to a select number of returned objects.\n\nDefault value: `10`. Maximum value: `1000`\n"
Offset:
type: integer
description: "Retrieve a list of objects starting from a certain offset. Combine this query parameter with `Limit` to retrieve a specific section of the list of objects.\n\nDefault value: `0`\n"
countOnly:
type: boolean
description: "Set the value of this query parameter to `1` to retrieve the overall number of objects returned by this request for your API Key. No list of results will be returned - the objects will simply be counted.\n\nDefault value: `0`\n\nNote: When you send a request without the `countOnly` query parameter, `Count` and `Total` will only return the number of extracted elements and not the overall number.\n"
Sort:
type: string
description: "Specify a property name for this query parameter to sort the objects in `Data`. By default the sorting is ascending. When a property name is postfixed with DESC (i.e. `property_name+DESC`), the sort order will be descending.\n\nNote: Both the `Sort` query parameter and the option to select a descending order are not available for every property.\n"
delete_v3_contactdata_id_PathParams:
type: object
required:
- contact_ID
properties:
contact_ID:
type: integer
description: Unique numeric ID for the contact, whose properties you want to delete.
contact_email:
type: string
description: The email address of the contact, whose properties you want to delete. Must be URL encoded. Can be used as an alternative to `contact_ID`.
delete_v3_contactfilter_id_PathParams:
type: object
required:
- contactfilter_ID
properties:
contactfilter_ID:
type: integer
description: Unique numeric ID for the segment you want to delete.
contactfilter_name:
type: string
description: The user-selected name of the segment you want to delete. Can be used as an alternative to `contactfilter_ID`.
delete_v3_contactmetadata_id_PathParams:
type: object
required:
- contactmetadata_ID
properties:
contactmetadata_ID:
type: integer
description: Unique numeric ID for the metadata object you want to delete.
NameSpace|contactmetadata_name:
type: string
description: A combination of the `NameSpace` and user-selected name for the metadata object you want to delete, separated with a vertial line. E.g. `static|age`. Can be used as an alternative to `contactmetadata_ID`.
delete_v3_contactslist_id_PathParams:
type: object
required:
- list_ID
properties:
list_ID:
type: integer
description: Unique numeric ID assigned to this contact list.
list_address:
type: string
description: Unique email address generated by Mailjet for this list. This address which can be used only via Mailjet's SMTP server to reach all contacts in it. It is displayed in the `Address` property of the list. The full email address will be `{list_address}@lists.mailjet.com`. Can be used as an alternative to `list_ID`.
delete_v3_eventcallbackurl_id_PathParams:
type: object
required:
- url_ID
properties:
url_ID:
type: integer
description: Unique numeric ID for the callback URL you want to delete.
delete_v3_listrecipient_id_PathParams:
type: object
required:
- listrecipient_ID
properties:
listrecipient_ID:
type: integer
description: Unique numeric ID of the list recipient.
delete_v3_parseroute_id_PathParams:
type: object
required:
- parseroute_ID
properties:
parseroute_ID:
type: integer
description: Unique numeric ID for this parseroute object. Alternatively, you can use the email address associated with this object. Keep in mind that the email address needs to be URL encoded.
delete_v3_sender_id_PathParams:
type: object
required:
- sender_ID
properties:
sender_ID:
type: integer
description: Unique numeric ID for the sender you want to delete.
sender_email:
type: string
description: The email address of the sender object you want to delete. Can be used as an alternative to `sender_ID`.
delete_v3_template_id_PathParams:
type: object
required:
- template_ID
properties:
template_ID:
type: integer
description: Unique numeric ID for the template you want to delete.
Owner_Type|Template_Name:
type: string
description: A combination of the `OwnerType` and user-selected name for the template you want to delete, separated with a vertial line. E.g. `user|Weekly Newsletter`. Can be used as an alternative to `template_ID`.
get_v3_messagehistory_id_PathParams:
type: object
required:
- message_ID
properties:
message_ID:
type: integer
description: Unique numeric ID of the message, whose event history you want to retrieve.
OutputMessagehistory:
type: object
properties:
Comment:
type: string
description: A comment providing additional details in case of issues with the message delivery.
EventAt:
type: integer
description: Unix timestamp indicating when the event was registered.
examples:
- 1514764800
EventType:
type: string
description: "The type of this event.\n\nPossible values:\n\n- `sent`\n- `opened`\n- `clicked`\n- `bounced`\n- `blocked`\n- `unsub`\n- `spam`\n"
examples:
- opened
State:
type: string
description: When the message is not successfully delivered, will display the reason for non-delivery.
Useragent:
type: string
description: User agent (browser) used to trigger the event (when applicable).
examples:
- Mozilla/5.0 (Windows NT 5.1; rv:11.0) Gecko Firefox/11.0 (via ggpht.com GoogleImageProxy)
UseragentID:
type: integer
description: Unique numeric ID of the user agent (browser) used to trigger this event.
examples:
- 1234
put_v3_apikey_id_PathParams:
type: object
required:
- apikey_ID
properties:
apikey_ID:
type: integer
description: Unique numeric ID for the API Key you want to update.
APIKey:
type: string
description: The API Key you want to update. Can be used as an alternative to `apikey_ID`.
UpdateApikey:
type: object
properties:
Name:
type: string
description: Unique user-selected name for this API Key.
examples:
- API Key 1
allOf:
- $ref: '#/components/schemas/BaseApikey'
BaseApikey:
type: object
properties:
ACL:
type: string
description: Access Control List. Indicates permissions attached to a resource.
IsActive:
type: boolean
description: Indicates whether this API Key is active or not.
examples:
- true
OutputApikey:
type: object
properties:
APIKey:
type: string
description: The unique alphanumeric API Key itself.
examples:
- 123456a9b01234c56789de01fg234hi
CreatedAt:
type: string
description: Timestamp indicating when the API Key was created.
examples:
- '2018-01-01T00:00:00'
ID:
type: integer
description: Unique numeric ID for this API Key.
examples:
- 123456789
IsMaster:
type: boolean
description: Indicates whether this is the Primary API Key or not.
examples:
- true
Name:
type: string
description: Unique user-selected name for this API Key.
examples:
- API Key 1
QuarantineValue:
type: integer
description: Indicates the sending limitation applied on this API Key in terms of messages per hour, when the API Key is under quarantine. `0` means no limitation is applied.
examples:
- 0
Runlevel:
type: object
description: "Runlevel, used to indicate data is migrated and reduced performance is expected..\n\nPossible values:\n\n- `Normal`\n- `Softlock`\n- `Hardlock`\n\nDefault value: `Normal`\n"
examples:
- Normal
SecretKey:
type: string
description: The unique alphanumeric Secret Key (password) linked to this API Key.
examples:
- 98765z43y2x10w9vu98tsrq7p6on5m4l
Skipspamd:
type: boolean
description: Deprecated property.
deprecated: true
TrackHost:
type: string
description: "Host to be used when tracking clicks, opens, unsubscribe requests for this API Key.\n\nDefault value: `r.mailjet.com`\n"
examples:
- r.mailjet.com
UserID:
type: integer
description: User ID. The Primary API Key and all sub-account API Keys will have the same user ID.
examples:
- 123456
allOf:
- $ref: '#/components/schemas/BaseApikey'
put_v3_campaign_id_PathParams:
type: object
required:
- campaign_ID
properties:
campaign_ID:
type: integer
description: Unique numeric ID of the campaign you want to update.
CustomCampaign:
type: string
description: The `CustomValue` of the campaign you want to update. Can be used as an alternative to `campaign_ID`.
UpdateCampaign:
type: object
allOf:
- $ref: '#/components/schemas/BaseCampaign'
BaseCampaign:
type: object
properties:
IsDeleted:
type: boolean
description: Indicates whether this campaign is deleted or not.
examples:
- false
IsStarred:
type: boolean
description: Indicates whether this campaign is marked as starred or not.
examples:
- false
OutputCampaign:
type: object
properties:
CampaignType:
type: integer
description: "Type of campaign:\n\n- `1` - Transactional\n- `2` - Marketing\n- `3` - Unknown\n"
examples:
- 2
ClickTracked:
type: integer
description: Indicates whether click tracking has been enabled for this campaign (1) or not (2).
examples:
- 1
deprecated: true
CreatedAt:
type: string
description: Timestamp indicating when the campaign was created.
examples:
- '2018-01-01T00:00:00'
CustomValue:
type: string
description: Custom unique tag for this campaign.
examples:
- CustomTag
FirstMessageID:
type: integer
description: Unique numeric ID of the first sent message for this campaign.
examples:
- 1234567890987654321
FromEmail:
type: string
description: Sender email address for this campaign.
examples:
- pilot@mailjet.com
FromID:
type: integer
description: Unique numeric ID for the sender email address.
examples:
- 123456
FromName:
type: string
description: Sender name selected for this campaign.
examples:
- Your Mailjet Pilot
HasHtmlCount:
type: integer
description: Indicates whether the emails in this campaign have HTML content (1) or not (0).
examples:
- 1
HasTxtCount:
type: integer
description: Indicates whether the emails in this campaign have plain text content (1) or not (0).
examples:
- 1
ID:
type: integer
description: Unique numeric ID of this campaign.
examples:
- 987654321234567890
ListID:
type: integer
description: Unique numeric ID of the contact list, to which this campaign was sent.
examples:
- 567890
NewsLetterID:
type: integer
description: Unique numeric ID of this campaign draft object linked to this campaign.
examples:
- 3456789
OpenTracked:
type: integer
description: Indicates whether click tracking has been enabled for this campaign (1) or not (2).
examples:
- 1
deprecated: true
SegmentationID:
type: integer
description: Unique numeric ID for the segmentation used for this campaign (see `/contactfilter`). Returned only if a segmentation is used for the campaign.
examples:
- 123
SendEndAt:
type: string
description: Timestamp indicating when last message in this campaign was sent.
examples:
- '2018-01-01T00:00:00'
SendStartAt:
type: string
description: Timestamp indicating when first message in this campaign was sent.
examples:
- '2018-01-01T00:00:00'
SpamassScore:
type: number
description: SpamAssassin score for this campaign.
examples:
- 0
Status:
type: integer
description: Status of this campaign.
examples:
- 0
deprecated: true
Subject:
type: string
description: Subject line used for the emails in this campaign.
examples:
- Your email flight plan!
UnsubscribeTrackedCount:
type: integer
description: Indicates whether unsubscribe tracking has been enabled for this campaign (1) or not (0).
examples:
- 0
deprecated: true
WorkflowID:
type: integer
description: Unique numeric ID of the automation workflow that triggered this campaign. Returned only if a workflow is used for the campaign.
examples:
- 1234
allOf:
- $ref: '#/components/schemas/BaseCampaign'
put_v3_campaigndraft_id_PathParams:
type: object
required:
- draft_ID
properties:
draft_ID:
type: integer
description: Unique numeric ID of the campaign draft you want to update.
UpdateCampaigndraft:
type: object
properties:
ContactsListID:
type: integer
description: Unique numeric ID for the contact list linked to this draft. Required for successful sending of the campaign.
examples:
- 123456
Locale:
type: string
description: Locale, in which the information is saved.
examples:
- en_US
SegmentationID:
type: integer
description: ID of the segment configuration (contactfilter) used for this campaign draft. Interchangeable with `SegmentationAlt`.
examples:
- 123
SegmentationAlt:
type: string
description: The user-selected name of the segment configuration (contactfilter) used for this campaign draft. Interchangeable with `SegmentationID`.
examples:
- Customers under 35
Sender:
type: string
description: ID of the sender email address. Required for successful sending of the campaign.
examples:
- '1234'
SenderEmail:
type: string
description: The email address of the sender. Required for successful sending of the campaign.
examples:
- pilot@mailjet.com
Status:
type: string
description: The status of this campaign draft. You can only modify its value only if the status is Draft (`0`, can be changed to `-1` or `-2`) or Archived (`-1`, can be changed to `-2` or `0`).
Subject:
type: string
description: Subject line for the campaign emails.
examples:
- Your email flight plan!
allOf:
- $ref: '#/components/schemas/BaseCampaigndraft'
BaseCampaigndraft:
type: object
properties:
AXFraction:
type: number
description: Fraction of an AB Testing campaign as a percentage of the total emails. Zero indicates the remainder.
examples:
- 0
AXFractionName:
type: string
description: Name of the AB Testing fraction.
examples:
- Version A
AXTesting:
type: object
description: An ID reference to the respective AXTesting object.
examples:
- '123456'
Current:
type: integer
description: Data ID of the current content.
examples:
- 345678
EditMode:
type: string
description: "Edit mode for the campaign draft.\n\nPossible values:\n\n- `tool2` - Passport drag-and-drop template editor\n- `html2` - HTML editor in Passport\n- `mjml` - MJML editor in Passport\n"
examples:
- tool2
IsStarred:
type: boolean
description: Indicates whether the campaign draft is marked as Starred or not.
examples:
- false
IsTextPartIncluded:
type: boolean
description: Indicates whether the draft email contains a text version or not.
examples:
- true
ReplyEmail:
type: string
description: Reply-to email address for the campaign. Returned only if a reply-to email was specified.
examples:
- replyto@mailjet.com
SenderName:
type: string
description: Name of the sender, which will be visible to recipients.
examples:
- Your Mailjet Pilot
TemplateID:
type: integer
description: Unique numeric ID of the template the `CampaignDraft` was generated from, or as which it was last saved. Changing the template ID will not update the content of the CampaignDraft.
examples:
- 123456
Title:
type: string
description: Internal title for this campaign draft.
examples:
- My Mailjet Campaign
OutputCampaigndraft:
type: object
properties:
CampaignID:
type: integer
description: Unique numeric ID of the campaign linked to this campaign draft. Will only be returned if the draft is already sent.
examples:
- 123456789
ContactsListID:
type: integer
description: Unique numeric ID for the contact list linked to this draft. Required for successful sending of the campaign.
examples:
- 123456
CreatedAt:
type: string
description: Timestamp indicating when the campaigndraft was created.
examples:
- '2018-01-01T00:00:00'
DeliveredAt:
type: string
description: Timestamp indicating when the campaigndraft was delivered.
examples:
- '2018-01-01T00:00:00'
ID:
type: integer
description: Unique numeric ID for this campaign draft.
examples:
- 987654321
Locale:
type: string
description: Locale, in which the information is saved.
examples:
- en_US
ModifiedAt:
type: string
description: Timestamp indicating when the campaign draft was last modified.
examples:
- '2018-01-01T00:00:00'
Preset:
type: string
description: String, representing a JSON array of styles for this campaign draft. The API does not interpret the styles.
examples:
- array
SegmentationID:
type: integer
description: ID of the segment configuration (contactfilter) used for this campaign draft.
examples:
- 123
Sender:
type: string
description: Unique numeric ID of the sender email address.
examples:
- '1234'
SenderEmail:
type: string
description: Email address of the sender.
examples:
- pilot@mailjet.com
Status:
type: integer
description: "Status of the campaign draft. Only campaign drafts in status Draft or Programmed can be scheduled and sent out via `/campaigndraft/{draft_id}/schedule` or `/campaigndraft/{draft_id}/send`.\n\nPossible values:\n\n- `-3` - AXCanceled\n- `-2` - Deleted\n- `-1` - Archived\n- `0` - Draft\n- `1` - Programmed (scheduled)\n- `2` - Sent\n- `3` - AXTested (AB Testing versions sent, but winning version not selected yet)\n- `4` - AXSelected (AB Testing winning version selected and sent)\n"
examples:
- 0
Subject:
type: string
description: Subject line for the campaign emails.
examples:
- Your email flight plan!
Url:
type: string
description: The URL, where an online version of the template can be found. A URL is automatically generated by Mailjet for marketing templates, after the campaign draft is sent.
examples:
- https://123h45y.mjt.lu/123uso/ia834.html
Used:
type: boolean
description: Indicates whether the campaign draft (or a test email of it) has been sent or not.
examples:
- true
allOf:
- $ref: '#/components/schemas/BaseCampaigndraft'
put_v3_contact_id_PathParams:
type: object
required:
- contact_ID
properties:
contact_ID:
type: integer
description: Unique numeric ID of the contact you want to update.
contact_email:
type: string
description: The email address of the contact your want to update. Must be URL encoded. Can be used as an alternative to `contact_ID`.
UpdateContact:
type: object
allOf:
- $ref: '#/components/schemas/BaseContact'
BaseContact:
type: object
properties:
IsExcludedFromCampaigns:
type: boolean
description: Indicates whether the contact is added to the exclusion list for campaigns or not. An excluded contact will not be receiving any marketing emails.
examples:
- false
Name:
type: string
description: User-selected name for this contact.
examples:
- New Contact
OutputContact:
type: object
properties:
CreatedAt:
type: string
description: Indicates when the contact was added to the global contact list.
examples:
- '2018-01-01T00:00:00'
DeliveredCount:
type: integer
description: Number of messages delivered to this contact.
examples:
- 10
Email:
type: string
description: Contact email address.
examples:
- passenger@mailjet.com
ExclusionFromCampaignsUpdatedAt:
type: string
description: Timestamp of the last time the exclusion status of this contact has changed.
examples:
- '2018-01-01T00:00:00'
ID:
type: integer
description: Unique numeric ID of this contact.
examples:
- 123456789
IsOptInPending:
type: boolean
description: Indicates whether the contact's subscription to a contact list is pending or not.
examples:
- false
IsSpamComplaining:
type: boolean
description: Indicates whether any spam complaints have been received for this contact or not.
examples:
- false
LastActivityAt:
type: string
description: Timestamp of last registered activity for this contact - receiving an email, open, click, unsubscribe etc.
examples:
- '2018-01-01T00:00:00'
LastUpdateAt:
type: string
description: Timestamp of the last time this contact's name or exclusion status was changed.
examples:
- '2018-01-01T00:00:00'
UnsubscribedAt:
type: string
description: Timestamp of the last request to unsubscribe from all lists.
examples:
- '2018-01-01T00:00:00'
deprecated: true
UnsubscribedBy:
type: string
description: "Description of who initiated the request to unsubscribe from\nall lists."
examples:
- '2018-01-01T00:00:00'
deprecated: true
allOf:
- $ref: '#/components/schemas/BaseContact'
put_v3_contactdata_id_PathParams:
type: object
required:
- contact_ID
properties:
contact_ID:
type: integer
description: Unique numeric ID for the contact, whose properties you want to update.
contact_email:
type: string
description: The email address of the contact, whose properties you want to update. Must be URL encoded. Can be used as an alternative to `contact_ID`.
UpdateContactdata:
type: object
allOf:
- $ref: '#/components/schemas/BaseContactdata'
BaseContactdata:
type: object
properties:
Data:
type: array
description: A JSON array containing contact properties and their values. The properties must have been created beforehand (refer to `/contactmetadata`).
items:
$ref: '#/components/schemas/ArrayContactdataData'
ArrayContactdataData:
type: object
properties:
Name:
type: string
description: The name of the contact property.
examples:
- first_name
Value:
type: string
description: The value of the contact property for this contact. The type of values accepted depends on the respective `contactmetadata`'s type.
examples:
- John
OutputContactdata:
type: object
properties:
ContactID:
type: integer
description: Unique numeric ID for this contact.
examples:
- 123456
ID:
type: integer
description: Unique numeric ID for this contact's Data object. ID value will always equal the value of `ContactID`.
examples:
- 123456
allOf:
- $ref: '#/components/schemas/BaseContactdata'
put_v3_contactfilter_id_PathParams:
type: object
required:
- contactfilter_ID
properties:
contactfilter_ID:
type: integer
description: Unique numeric ID for the segment you want to update.
contactfilter_name:
type: string
description: The user-selected name of the segment you want to update. Can be used as an alternative to `contactfilter_ID`.
UpdateContactfilter:
type: object
properties:
Status:
type: string
description: "Status of this segment. Indicates whether a segment was used for sending or not, or if it was deleted. The only status that can be updated manually is that of a `deleted` segment - to `unused`. This way you can reactivate an already deleted segment.\n\nPossible values:\n\n- `used`\n- `unused`\n- `deleted`\n"
examples:
- unused
allOf:
- $ref: '#/components/schemas/BaseContactfilter'
BaseContactfilter:
type: object
properties:
Description:
type: string
description: A description of the segment you can add for convenience, or to easier understand its functionality.
examples:
- Will send only to contacts under 35 years of age.
Expression:
type: string
description: The rule, based on which the segment is calculated. Refer to our [Segmentation Guide](/docs/email-api/segmentation/segmentation-overview) for detailed information on the syntax.
examples:
- (age<35)
Name:
type: string
description: User-selected name for this segment.
examples:
- Customers under 35
OutputContactfilter:
type: object
properties:
ID:
type: integer
description: Unique numeric ID for this segment.
examples:
- 123
Status:
type: string
description: "Status of this segment. Indicates whether a segment was used for sending or not, or if it was deleted.\n\nPossible values:\n\n- `used`\n- `unused`\n- `deleted`\n"
examples:
- unused
allOf:
- $ref: '#/components/schemas/BaseContactfilter'
put_v3_contactmetadata_id_PathParams:
type: object
required:
- contactmetadata_ID
properties:
contactmetadata_ID:
type: integer
description: Unique numeric ID for the metadata object you want to update.
NameSpace|contactmetadata_name:
type: string
description: A combination of the `NameSpace` and user-selected name for the metadata object you want to update, separated with a vertial line. E.g. `static|age`. Can be used as an alternative to `contactmetadata_ID`.
UpdateContactmetadata:
type: object
properties:
Datatype:
type: string
description: "Indicates the type of data accepted for this contact property:\n\n- `str` - string\n- `int` - integer\n- `float` - float / number\n- `bool` - boolean\n- `datetime` - datetime (Unix Timestamp or RFC 3339)\n\nDefault value: `str`\n"
examples:
- str
Name:
type: string
description: Name of the contact property. The name must be unique for the respective namespace.
examples:
- first_name
OutputContactmetadata:
type: object
properties:
Datatype:
type: string
description: "Indicates the type of data accepted for this contact property:\n\n- `str` - string\n- `int` - integer\n- `float` - float / number\n- `bool` - boolean\n- `datetime` - datetime (Unix Timestamp or RFC 3339)\n\nDefault value: `str`\n"
examples:
- str
ID:
type: integer
description: Unique numeric ID for the contact property.
examples:
- 4321
Name:
type: string
description: Name of the contact property. The name must be unique for the respective namespace.
examples:
- first_name
NameSpace:
type: string
description: "Indicates the namespace of this contact property:\n\n- `static` - Can keep only 1 value. Each change to the value of the property for a contact overwrites the previously selected value. The values are saved in a `contactdata` object.\n- `historic` - Each change to the value of the property creates a record in a new `contacthistorydata` object, saving the property value and a timestamp of when it was submitted.\n\nDefault value: `static`\n"
examples:
- static
put_v3_contactslist_id_PathParams:
type: object
required:
- list_ID
properties:
list_ID:
type: integer
description: Unique numeric ID assigned to this contact list.
list_address:
type: string
description: Unique email address generated by Mailjet for this list. This address which can be used only via Mailjet's SMTP server to reach all contacts in it. It is displayed in the `Address` property of the list. The full email address will be `{list_address}@lists.mailjet.com`. Can be used as an alternative to `list_ID`.
UpdateContactslist:
type: object
allOf:
- $ref: '#/components/schemas/BaseContactslist'
BaseContactslist:
type: object
properties:
IsDeleted:
type: boolean
description: When true, the contact list will be marked as `Deleted`. Deleted lists can later be reinstated by updating this value to `False`.
examples:
- false
Name:
type: string
description: User-specified name for this contact list (must be unique).
examples:
- my_contactslist
OutputContactslist:
type: object
properties:
Address:
type: string
description: Unique email address generated by Mailjet, which can be used only via Mailjet's SMTP server to reach all contacts in the list. The full address will be `{address}@lists.mailjet.com`.
examples:
- abcdef123
CreatedAt:
type: string
description: Timestamp of when the contact list was created.
examples:
- '2018-01-01T00:00:00'
ID:
type: integer
description: Unique numeric ID assigned to this contact list.
examples:
- 123456
SubscriberCount:
type: integer
description: Number of contacts registered in this contact list. Includes contacts that were unsubscribed from the list, as well as excluded ones.
examples:
- 111
allOf:
- $ref: '#/components/schemas/BaseContactslist'
put_v3_csvimport_id_PathParams:
type: object
required:
- importjob_ID
properties:
importjob_ID:
type: integer
description: Unique numeric ID of the import job you want to update.
UpdateCsvimport:
type: object
properties:
ContactsListID:
type: integer
description: Unique numeric ID of the list, where you want to use the uploaded CSV data.
examples:
- 123456
DataID:
type: integer
description: Unique numeric ID of the CSV data you want to use.
examples:
- 987654
Status:
type: string
description: "Current status of this import job. During `POST`, the only allowed value is `Upload`. During PUT, the only allowed value is `Abort`.\n\nPossible values:\n\n- `Upload`\n- `Completed`\n- `Abort`\n"
examples:
- Upload
allOf:
- $ref: '#/components/schemas/BaseCsvimport'
BaseCsvimport:
type: object
properties:
ErrTreshold:
type: integer
description: Maximum number of errors allowed during the processing of the contacts, before the import job is aborted.
examples:
- 1
ImportOptions:
type: string
description: A string with a JSON structure describing the import options in effect. Used to specify date format, when `datetime` contact properties are included in the CSV content. See our [API Guide](/docs/email-api/contact-management/manage-contacts-csv) for detailed information.
Method:
type: string
description: "Action to be performed on the contacts in the CSV data for this list:\n\n- `addforce` - Add the contacts to this list and subscribe all of them. If the contact is already present in the list as unsubscribed, it will be forcibly subscribed once again.\n- `addnoforce` - Add the contacts to this list and subscribe them to it. If the contact is already present, it will retain its subscription status, i.e. if a contact is part of the list, but unsubscribed, it will not be forcibly subscribed again.\n- `remove` - Remove the contacts from this list.\n- `unsub` - Unsubscribe the contacts from this list.\n- `excludemarketing` - Add the contacts to the campaign exclusion list (they will be blocked from receiving marketing campaigns).\n- `includemarketing` - Remove the contacts from the campaign exlcusion list (they will be allowed to receive marketing campaigns).\n"
examples:
- addnoforce
OutputCsvimport:
type: object
properties:
AliveAt:
type: string
description: Timestamp indicating when the CSV import background job reported a status. Returns an empty value upon initial `POST` request.
examples:
- '2018-01-01T00:00:00'
ContactsListID:
type: integer
description: Unique numeric ID of the list, where you want to use the uploaded CSV data.
examples:
- 123456
Count:
type: integer
description: Number of contacts detected in the CSV file. Returns 0 value upon initial `POST` request.
examples:
- 12
Current:
type: integer
description: Number of processed contacts so far. Returns 0 value upon initial `POST` request.
examples:
- 10
DataID:
type: integer
description: Unique numeric ID of the CSV data used for this request.
examples:
- 98765432123456789
Errcount:
type: integer
description: Number of errors encountered while processing the contacts in the CSV file. Returns 0 value upon initial `POST` request.
examples:
- 0
ID:
type: integer
description: Unique numeric ID of this import job.
examples:
- 987654
JobEnd:
type: string
description: Timestamp indicating when the import job has ended. Returns an empty value upon initial `POST` request.
examples:
- '2018-01-01T00:00:00'
JobStart:
type: string
description: Timestamp indicating when the import job was started. Returns an empty value upon initial `POST` request.
examples:
- '2018-01-01T00:00:00'
RequestAt:
type: string
description: Timestamp indicating when the import job was requested. Returns an empty value upon initial `POST` request.
examples:
- '2018-01-01T00:00:00'
Status:
type: string
description: "Current status of this import job. During `POST`, the only allowed value is `Upload`. During PUT, the only allowed value is `Abort`.\n\nPossible values:\n\n- `Upload`\n- `Completed`\n- `Abort`\n"
examples:
- Upload
allOf:
- $ref: '#/components/schemas/BaseCsvimport'
put_v3_eventcallbackurl_id_PathParams:
type: object
required:
- url_ID
properties:
url_ID:
type: integer
description: Unique numeric ID for the callback URL you want to update.
UpdateEventcallbackurl:
type: object
properties:
Url:
type: string
description: "The URL used for this object.\n\n> Note: The URL provided cannot be a root URL.\n"
examples:
- https://www.example.com/123/
allOf:
- $ref: '#/components/schemas/BaseEventcallbackurl'
BaseEventcallbackurl:
type: object
properties:
EventType:
type: string
description: "The type of event that is being tracked.\n\nPossible values:\n\n- `open`\n- `click`\n- `bounce`\n- `spam`\n- `blocked`\n- `unsub`\n- `sent`\n\nDefault value: `open`\n"
examples:
- open
IsBackup:
type: boolean
description: Indicates whether this is a backup URL or not. The backup URL will be used in case the primary one is suspended.
examples:
- false
Status:
type: string
description: "Defines whether the callback URL is active or not.\n\nPossible values:\n\n- `dead`\n- `alive`\n"
examples:
- alive
OutputEventcallbackurl:
type: object
properties:
APIKeyID:
type: integer
description: Unique numeric ID for the API Key this callback URL is assigned to.
examples:
- 123456
ID:
type: integer
description: Unique numeric ID for this callback URL.
examples:
- 987654
Version:
type: integer
description: "Indicates whether the events are sent one at a time to the callback URL, or are grouped.\n\nPossible values:\n\n- `1` - The events are not grouped and a callback is received for each event individually.\n- `2` - The events are grouped. A callback for the grouped events is received with a maximum frequency of once per second. We advise to use this value to avoid reaching the API rate limits.\n"
examples:
- 2
Url:
type: string
description: "The URL used for this object.\n\n> Note: The URL provided cannot be a root URL.\n"
examples:
- https://www.example.com/123/
allOf:
- $ref: '#/components/schemas/BaseEventcallbackurl'
put_v3_listrecipient_id_PathParams:
type: object
required:
- listrecipient_ID
properties:
listrecipient_ID:
type: integer
description: Unique numeric ID of the list recipient.
UpdateListrecipient:
type: object
allOf:
- $ref: '#/components/schemas/BaseListrecipient'
BaseListrecipient:
type: object
properties:
IsUnsubscribed:
type: boolean
description: "Indicates whether the list recipient is unsubscribed from this List ID or not.\n\nDefault value: `false`\n"
examples:
- true
OutputListrecipient:
type: object
properties:
ContactID:
type: integer
description: Unique numeric ID for the contact the list recipient is linked to.
examples:
- 987654321
ID:
type: integer
description: Unique numeric ID assigned to this list recipient.
examples:
- 1234567890
IsActive:
type: boolean
description: "Legacy Property - indicates whether the subscription for this contact is active or not. Please use `IsUnsubscribed` instead.\n\nDefault value: `true`\n"
examples:
- true
deprecated: true
ListID:
type: integer
description: Unique numeric ID of the contact list, to which the list recipient was subscribed.
examples:
- 123456
ListName:
type: string
description: The name of the contact list, to which the list recipient was subscribed.
examples:
- abcdef123
SubscribedAt:
type: string
description: Timestamp indicating when the list recipient was subscribed to the list.
examples:
- '2018-01-01T00:00:00'
UnsubscribedAt:
type: string
description: Timestamp indicating when the list recipient was unsubscribed from the list.
examples:
- '2018-01-01T00:00:00'
allOf:
- $ref: '#/components/schemas/BaseListrecipient'
put_v3_metasender_id_PathParams:
type: object
required:
- metasender_ID
properties:
metasender_ID:
type: integer
description: Unique numeric ID of the metasender object you want to update.
metasender_email:
type: string
description: The email address of the metasender object you want to update. Can be used as an alternative to `metasender_ID`.
UpdateMetasender:
type: object
allOf:
- $ref: '#/components/schemas/BaseMetasender'
BaseMetasender:
type: object
properties:
Description:
type: string
description: User-provided readable description of the domain.
examples:
- Metasender 1 - used for Promo emails
OutputMetasender:
type: object
properties:
CreatedAt:
type: string
description: Timestamp indicating when this metasender object was created.
examples:
- '2018-01-01T00:00:00'
Email:
type: string
description: The email address for this metasender. Domains are registered with an asterisk in place of the local part - e.g. `*@domain.com`.
examples:
- pilot@mailjet.com
Filename:
type: string
description: Filename expected on the domain name webserver. Used to validate the metasender via the `/sender/{sender_id}/validate` resource.
examples:
- a12345b67c123456ab1ca12345b1234b5.txt
ID:
type: integer
description: Unique numeric ID for this metasender.
examples:
- 123
IsEnabled:
type: boolean
description: Indicates whether the metasender was activated or not.
examples:
- true
allOf:
- $ref: '#/components/schemas/BaseMetasender'
put_v3_newsletter_id_PathParams:
type: object
required:
- newsletter_ID
properties:
newsletter_ID:
type: integer
description: Unique numeric ID of the newsletter you want to update.
UpdateNewsletter:
type: object
properties:
ContactsListID:
type: integer
description: Unique numeric ID for the contact list linked to this newsletter. Required for successful sending of the campaign.
examples:
- 123456
Locale:
type: string
description: Locale, in which the information is saved.
examples:
- en_US
SegmentationID:
type: integer
description: ID of the segment configuration (contactfilter) used for this newsletter. Interchangeable with `SegmentationAlt`.
examples:
- 123
SegmentationAlt:
type: string
description: The user-selected name of the segment configuration (contactfilter) used for this newsletter. Interchangeable with `SegmentationID`.
examples:
- Customers under 35
Sender:
type: string
description: ID of the sender email address. Required for successful sending of the newsletter.
examples:
- '1234'
SenderEmail:
type: string
description: The email address of the sender. Required for successful sending of the newsletter.
examples:
- pilot@mailjet.com
Subject:
type: string
description: Subject line for the newsletter emails.
examples:
- Your email flight plan!
allOf:
- $ref: '#/components/schemas/BaseNewsletter'
BaseNewsletter:
type: object
properties:
AXFraction:
type: number
description: Fraction of an AB Testing newsletter as a percentage of the total emails. Zero indicates the remainder.
examples:
- 0
AXFractionName:
type: string
description: Name of the AB Testing fraction.
examples:
- Version1
AXTesting:
type: object
description: An ID reference to the respective AXTesting object.
examples:
- '123456'
Callback:
type: string
description: The callback URL used for this newsletter.
examples:
- https://www.example.com/123/
EditMode:
type: string
description: "Edit mode for newsletter.\n\n - `tool` - Legacy drag-and-drop template editor\n - `html` - Legacy HTML editor\n\n Default value: `tool`\n"
examples:
- tool
EditType:
type: string
description: "Edit type.\n\nDefault value: `full`\n"
examples:
- full
Footer:
type: string
description: "Specifies the footer type that will be generated - either the `default` one, or `none`.\n\nDefault value: `default`\n"
examples:
- default
FooterAddress:
type: string
description: The address that will be used in the footer.
examples:
- All Rights Reserved, My Company, 123 Main Street, New York, New York
FooterWYSIWYGType:
type: integer
description: Specifies what type of footer is used, based on selections available in the legacy drag-and-drop template builder.
examples:
- 2
HeaderFilename:
type: string
description: Indicates the URL link to where the file used in the header is located, if you have added one.
examples:
- https://r.mailjet.com/E_5Au.png
HeaderLink:
type: string
description: Indicates the URL link used in the header.
examples:
- https://www.example.com/
HeaderText:
type: string
description: The text content in the header.
examples:
- Insert Header Text Here
HeaderUrl:
type: string
description: URL used in header.
examples:
- https://www.example.com/
Ip:
type: string
description: The IP address used to create the newsletter.
examples:
- 127.0.0.1
IsStarred:
type: boolean
description: Indicates whether the newsletter is marked as Starred or not.
examples:
- false
IsTextPartIncluded:
type: boolean
description: Indicates whether the newsletter email contains a plain text version or not.
examples:
- true
Permalink:
type: string
description: "Type of permalink that should be added to the newsletter. The default permalink allows recipients to view an online version of the newsletter template online.\n\nDefault value: `default`\n"
examples:
- default
PermalinkHost:
type: string
description: Host for the permalink.
PermalinkWYSIWYGType:
type: integer
description: Deprecated property.
examples:
- 1
PolitenessMode:
type: integer
description: Deprecated property.
examples:
- 1
ReplyEmail:
type: string
description: Reply-to email address for the campaign.
examples:
- copilot@mailjet.com
SenderName:
type: string
description: Name of the sender, which will be visible to recipients.
examples:
- Your Mailjet Pilot
Status:
type: integer
description: "Status of the newsletter. Only newsletters in status newsletter or `Programmed` can be scheduled and sent out via `/newsletter/{newsletter_id}/schedule` or `/newsletter/{newsletter_id}/send`.\n\n- `-3` - AXCancelled\n- `-2`- Deleted\n- `-1` - Archived\n- `0` - Draft\n- `1` - Programmed (scheduled)\n- `2` - Sent\n- `3` - AXTested (AB Testing versions sent, but winning version not selected yet)\n- `4` - AXSelected (AB Testing winning version selected and sent)\n"
examples:
- 2
TemplateID:
type: integer
description: ID reference to the template the newsletter was generated from, or as which it was last saved. Changing the template ID will not update the content of the newsletter.
examples:
- 1234
TestAddress:
type: string
description: Email address used as a sender for test emails of this newsletter.
examples:
- tester@mailjet.com
Title:
type: string
description: Internal title for this newsletter.
examples:
- My Newsletter
Url:
type: string
description: URL where an online version of the newsletter can be found.
examples:
- https://123h45y.mjt.lu/123uso/ia834.html
OutputNewsletter:
type: object
properties:
CampaignID:
type: integer
description: Unique numeric ID for this newsletter.
examples:
- 123456789
ContactsListID:
type: integer
description: Unique numeric ID for the contact list linked to this newsletter. Required for successful sending of the campaign.
examples:
- 123456
CreatedAt:
type: string
description: Timestamp of when the newsletter was created.
examples:
- '2018-01-01T00:00:00'
DeliveredAt:
type: string
description: Timestamp of when the newsletter was delivered to the campaign's recipients.
examples:
- '2018-01-01T00:00:00'
ID:
type: integer
description: Unique numeric ID for this newsletter.
examples:
- 987654321
IsHandled:
type: boolean
description: Indicates whether the newsletter has been sent out, or a test email was sent out, or not.
examples:
- true
Locale:
type: string
description: Locale, in which the information is saved.
examples:
- en_US
ModifiedAt:
type: string
description: Timestamp of when the newsletter was last modified.
examples:
- '2018-01-01T00:00:00'
SegmentationID:
type: integer
description: ID of the segment configuration (contactfilter) used for this newsletter.
examples:
- 123
Sender:
type: string
description: Unique numeric ID of the sender email address.
examples:
- '1234'
SenderEmail:
type: string
description: Email address of the sender.
examples:
- pilot@mailjet.com
Subject:
type: string
description: Subject line for the newsletter emails.
examples:
- Your email flight plan!
allOf:
- $ref: '#/components/schemas/BaseNewsletter'
put_v3_parseroute_id_PathParams:
type: object
required:
- parseroute_ID
properties:
parseroute_ID:
type: integer
description: Unique numeric ID for this parseroute object. Alternatively, you can use the email address associated with this object. Keep in mind that the email address needs to be URL encoded.
UpdateParseroute:
type: object
properties:
APIKeyID:
type: integer
description: Unique numeric API Key ID to whom this object belongs.
examples:
- 123456
Email:
type: string
description: The email address you want to use. Emails sent to this address will be parsed and the information passed on to the webhook URL in JSON format.
examples:
- parseroute@example.com
Url:
type: string
description: "The webhook URL you want to use.\n\n> Note: The URL provided cannot be a root URL.\n"
examples:
- https://www.example.com/123/
OutputParseroute:
type: object
properties:
APIKeyID:
type: integer
description: Unique numeric API Key ID to whom this object belongs.
examples:
- 123456
Email:
type: string
description: The email address you need to use. Emails sent to this address will be parsed and the information passed on to the webhook URL in JSON format. If no email address is specified in the `POST` payload, Mailjet will create a custom one.
examples:
- parseroute@example.com
ID:
type: integer
description: Unique numeric ID for this parseroute object.
examples:
- 654321
Url:
type: string
description: The webhook URL, where you want to receive the parsed email information.
examples:
- https://www.example.com/123/
put_v3_sender_id_PathParams:
type: object
required:
- sender_ID
properties:
sender_ID:
type: integer
description: Unique numeric ID for the sender you want to update.
sender_email:
type: string
description: The email address of the sender object you want to update. Can be used as an alternative to `sender_ID`.
UpdateSender:
type: object
allOf:
- $ref: '#/components/schemas/BaseSender'
BaseSender:
type: object
properties:
EmailType:
type: string
description: "Type of emails this sender will send. This is for purely informative purposes - the values do not place any sending restrictions on the sender email or domain.\n\n- `transactional` - transactional emails\n- `bulk` - campaign emails\n- `unknown` - both\n"
examples:
- bulk
IsDefaultSender:
type: boolean
description: Indicates whether this is the default sender or not.
examples:
- false
Name:
type: string
description: User-provided name for this sender.
examples:
- Marketing sender
OutputSender:
type: object
properties:
CreatedAt:
type: string
description: Timestamp indicating when this sender object was created.
examples:
- '2018-01-01T00:00:00'
DNSID:
type: integer
description: Unique numeric ID of the DNS domain to which sender belongs. When the sender is inactive, the DNSID will return a `-1` value.
examples:
- 1234567890
Email:
type: string
description: The email address or domain for this sender.
examples:
- pilot@mailjet.com
Filename:
type: string
description: Filename expected on the domain name webserver. Will only return a value when a sender domain is registered. Used to validate the sender via the `/sender/{sender_id}/validate` resource.
examples:
- a12345b67c123456ab1ca12345b1234b5.txt
ID:
type: integer
description: Unique numeric ID of this sender.
examples:
- 1234
Status:
type: string
description: "The status of this sender.\n\nPossible values:\n\n- `Inactive`\n- `Active`\n- `Deleted`\n"
examples:
- Inactive
allOf:
- $ref: '#/components/schemas/BaseSender'
put_v3_template_id_PathParams:
type: object
required:
- template_ID
properties:
template_ID:
type: integer
description: Unique numeric ID for the template you want to update.
Owner_Type|Template_Name:
type: string
description: A combination of the `OwnerType` and user-selected name for the template you want to update, separated with a vertial line. E.g. `user|Weekly Newsletter`. Can be used as an alternative to `template_ID`.
UpdateTemplate:
type: object
allOf:
- $ref: '#/components/schemas/BaseTemplate'
BaseTemplate:
type: object
properties:
Author:
type: string
description: The name of the template author.
examples:
- John Doe
Categories:
type: string
description: An array containing a list of strings indicating the categories, to which the template is associated. Accepted values are `full`, `basic`, `newsletter`, `e-commerce`, `events`, `travel`, `sports`, `welcome`, `contact-property-update`, `support`, `invoice`, `anniversary`, `account`, `activation`.
examples:
- array
Copyright:
type: string
description: The Copyright message.
examples:
- Mailjet
Description:
type: string
description: Free text used as a description for this template.
examples:
- Used to send out promo codes.
EditMode:
type: integer
description: "Edit mode for this template:\n\n- `1` - Passport drag-and-drop builder\n- `2` - Passport HTML builder\n- `3` - Passport Saved Section (snippet) builder\n- `4` - Passport MJML builder\n\nWhen a template is created through the API, the value has to be set by the caller - there is no fallback. Templates created in the Mailjet app are always `1` - Passport drag-and-drop builder.\n"
examples:
- 1
IsStarred:
type: boolean
description: "Indicates whether this campaign is marked as starred or not.\n\nDefault value: `false`\n"
examples:
- false
IsTextPartGenerationEnabled:
type: boolean
description: "Indicates whether the generation of a text version of the template will be enabled or not.\n\nDefault value: `false`\n"
examples:
- true
Locale:
type: string
description: "The locale for this template (AnsiString).\n\nDefault value: `en_US`\n"
examples:
- en_US
Name:
type: string
description: Internal name for this template.
examples:
- Promo Codes
OwnerType:
type: string
description: "Indicates the type of the template owner.\n\nPossible values:\n\n- `apikey` - Templates and their content can be retrieved, edited and used only by the API Key they were created from.\n- `user` - Templates created by the Primary API Key. Templates and their content can be retrieved by the Primary API Key, as well as all subaccount API Keys. However, they can be edited and used only by the Primary API Key.\n- `global` - Generic templates created by Mailjet visible in the Passport Template Gallery.\n\nFor templates created in the Mailjet app, the value depends on the account that created them - `user` for the Primary API Key, `apikey` for a subaccount API Key.\n"
examples:
- user
Presets:
type: string
description: A JSON string containing the different pre-defined styles for this template.
examples:
- string
Purposes:
type: array
items:
type: string
enum:
- marketing
- transactional
- automation
description: "An array indicating whether the template is a marketing, transactional or automation one. Upon `POST` request only the first value in the array is taken into account.\n\nPossible values:\n\n- `marketing`\n- `transactional`\n- `automation`\n\nIf no value is set, the template will not be visible in the Mailjet app, as there is no tab under which to display it.\n"
OutputTemplate:
type: object
properties:
ID:
type: integer
description: Unique numeric ID for this template.
examples:
- 123456
OwnerId:
type: integer
description: The `UserID` associated with the owner of this template.
examples:
- 123456
Previews:
type: object
description: A JSON array containing Data ID's for the previews.
examples:
- array
CreatedAt:
type: string
description: Timestamp indicating when the template was created.
examples:
- '2018-01-01T00:00:00'
LastUpdatedAt:
type: string
description: Timestamp indicating when the template was last updated.
examples:
- '2018-01-01T00:00:00'
allOf:
- $ref: '#/components/schemas/BaseTemplate'
delete_v3_campaigndraft_id_schedule_PathParams:
type: object
required:
- draft_ID
properties:
draft_ID:
type: integer
description: Unique numeric ID for the campaign draft you want to cancel the scheduling of.
delete_v3_newsletter_id_detailcontent_PathParams:
type: object
required:
- newsletter_ID
properties:
newsletter_ID:
type: integer
description: Unique numeric ID for the newsletter you want to delete the content of.
delete_v3_newsletter_id_schedule_PathParams:
type: object
required:
- newsletter_ID
properties:
newsletter_ID:
type: integer
description: Unique numeric ID for the newsletter you want to cancel the scheduled sending of.
get_v3_campaigndraft_id_detailcontent_PathParams:
type: object
required:
- draft_ID
properties:
draft_ID:
type: integer
description: Unique numeric ID for the campaign draft you want to retrieve the content for.
OutputCampaigndraftDetailcontent:
type: object
allOf:
- $ref: '#/components/schemas/BaseCampaigndraftDetailcontent'
BaseCampaigndraftDetailcontent:
type: object
properties:
Headers:
type: object
description: "A JSON object, where you can list all main headers. The header values override\nproperties such as `Subject` if specified."
examples:
- Subject: Your email flight plan!
Reply-To: copilot@mailjet.com
Html-part:
type: string
description: The HTML-formatted part of the message.
examples:
- Dear passenger, welcome to Mailjet!
May the delivery force be with you!
MJMLContent:
type: string
description: "The content of the message in MJML.\n\n> Note: Any update of the MJMLContent property of the `/campaigndraft/{draft_ID}/detailcontent` resource will not automatically generate the Html-part version of the content. In this case, you should regenerate the Html-part with the MJML tools.\n"
Text-part:
type: string
description: The plain text part of the message.
examples:
- Dear passenger, welcome to Mailjet! May the delivery force be with you!
get_v3_campaigndraft_id_schedule_PathParams:
type: object
required:
- draft_ID
properties:
draft_ID:
type: integer
description: Unique numeric ID of the campaign draft you want to retrieve the sending schedule of.
OutputCampaigndraftSchedule:
type: object
properties:
Date:
type: string
description: The timestamp, when the campaign draft will be sent out. When the campaign is scheduled for immediate sending, an empty value will be returned.
examples:
- '2018-01-01T00:00:00'
Status:
type: string
description: The status of the campaign draft. Upon successful scheduling the status will be set to `Programmed`.
examples:
- Programmed
get_v3_campaigndraft_id_status_PathParams:
type: object
required:
- draft_ID
properties:
draft_ID:
type: integer
description: Unique numeric ID of the campaign draft you want to send.
ActionStatusCampaigndraftStatus:
type: object
properties:
Status:
type: string
description: "The status of the campaign draft.\n\nPossible values:\n\n- `AXCancelled`\n- `Deleted`\n- `Archived`\n- `Draft`\n- `Programmed` (scheduled)\n- `Sent`\n- `AXTested` (AB Testing versions sent, but winning version not selected yet)\n- `AXSelected` (AB Testing winning version selected and sent)\n"
examples:
- Programmed
get_v3_campaignstatistics_id_PathParams:
type: object
required:
- campaign_ID
properties:
campaign_ID:
type: integer
description: Unique numeric ID of the campaign you want to retrieve statistics for.
CustomCampaign:
type: string
description: The `CustomValue` of the campaign you want to retrieve statistics for. Can be used as an alternative to `campaign_ID`.
OutputCampaignstatistics:
type: object
properties:
AXTestingID:
type: object
description: Unique numeric ID of the AX Testing object this campaign is linked to.
examples:
- '123123'
BlockedCount:
type: integer
description: Number of blocked messages.
examples:
- 1
BouncedCount:
type: integer
description: Number of bounced messages.
examples:
- 0
CampaignID:
type: integer
description: Unique numeric ID of this campaign.
examples:
- 123456789
CampaignIsStarred:
type: boolean
description: Indicates whether this campaign is marked as Starred or not.
examples:
- false
CampaignSendStartAt:
type: string
description: Timestamp indicating when the first message in this campaign was sent out.
examples:
- '2018-01-01T00:00:00'
CampaignSubject:
type: string
description: The email subject line used for this campaign.
examples:
- Your email flight plan!
ClickedCount:
type: integer
description: Number of clicked messages.
examples:
- 3
ContactListName:
type: string
description: The name of the contact list, to whic the campaign was sent. Only returned when the `ShowExtraData` query parameter is `True`.
examples:
- my_contactslist
DeferredCount:
type: integer
description: Number of deferred messages.
examples:
- 0
DeliveredCount:
type: integer
description: Number of delivered messages.
examples:
- 13
HardbouncedCount:
type: integer
description: Number of hard-bounced messages.
examples:
- 1
LastActivityAt:
type: string
description: Timestamp indicating the last registered activity for this Campaign.
examples:
- '2018-01-01T00:00:00'
NewsLetterID:
type: integer
description: Unique numeric ID of the draft linked to this campaign.
examples:
- 123321
OpenedCount:
type: integer
description: Number of opened messages.
examples:
- 9
PreQueuedCount:
type: integer
description: Number of pre-queued messages.
examples:
- 0
ProcessedCount:
type: integer
description: Total number of messages processed by Mailjet.
examples:
- 13
QueuedCount:
type: integer
description: Number of queued messages.
examples:
- 0
SegmentName:
type: string
description: The name of Unique the segmentation used for this campaign (see `/contactfilter`). Only returned when the `ShowExtraData` query parameter is `True`.
examples:
- Customers under 35
SoftbouncedCount:
type: integer
description: Number of soft-bounced messages.
examples:
- 0
SpamComplaintCount:
type: integer
description: Number of messages marked as spam.
examples:
- 0
UnsubscribedCount:
type: integer
description: Number of registered unsubscribe requests.
examples:
- 1
WorkFlowExitedCount:
type: integer
description: Number of registered automation workflow exits.
examples:
- 0
WorkflowID:
type: integer
description: Unique numeric ID of the automation workflow that triggered this campaign.
examples:
- 34567
get_v3_contact_managemanycontacts_id_PathParams:
type: object
required:
- job_ID
properties:
job_ID:
type: integer
description: Unique numeric `JobID` returned after a `POST /contact/managemanycontacts` request. Use it to monitor the progress and success of the request.
OutputContactManagemanycontacts:
type: object
properties:
ContactsLists:
type: array
description: A JSON array, containing information about the contact lists and the actions performed for each list.
items:
properties:
ListID:
type: integer
format: int64
description: Unique numeric ID of the contact list.
examples:
- 987654321
Action:
enum:
- addforce
- addnoforce
- remove
- unsub
type: string
description: "Action to be performed on the contacts for this list:\n\n * `addforce` - Add the contacts to this list and subscribe all of them. Any contacts already present in the list and unsubscribed from it will be forcibly subscribed once again.\n\n * `addnoforce` - Add the contacts to this list and subscribe them to it. Any contacts already present will retain their subscription status, i.e. if a contact is part of the list, but unsubscribed, it will not be forcibly subscribed again.\n\n * `remove` - Remove the contacts from this list.\n\n * `unsub` - Unsubscribe the contacts from this list.\n"
examples:
- addnoforce
Count:
type: integer
description: Number of contacts processed by this request.
examples:
- 1
Error:
type: string
description: Indicates what kind of errors came up during the processing of this job, if any.
ErrorFile:
type: string
description: URL link to the file describing the the types of errors that came up during this job, if any.
JobEnd:
type: string
description: Timestamp indicating when this job request was completed.
examples:
- '2018-01-01T00:00:00'
JobStart:
type: string
description: Timestamp indicating when this job request was started.
examples:
- '2018-01-01T00:00:00'
Status:
type: string
description: "The status of this job request:\n\n * Completed\n * In Progress\n * Error\n"
examples:
- Completed
get_v3_contact_id_getcontactslists_PathParams:
type: object
required:
- contact_ID
properties:
contact_ID:
type: integer
description: Unique numeric ID of the contact you want to retrieve the contact lists for.
contact_email:
type: string
description: The email address of the contact your want to retrieve the contact lists for. Must be URL encoded. Can be used as an alternative to `contact_ID`.
OutputContactGetcontactslists:
type: object
allOf:
- $ref: '#/components/schemas/BaseContactGetcontactslists'
BaseContactGetcontactslists:
type: object
properties:
ListID:
type: integer
description: Unique numeric ID assigned to this contact list.
examples:
- 123456789
IsUnsub:
type: boolean
description: Indicates whether the contact is unsubscribed from this List ID or not.
examples:
- false
IsActive:
type: boolean
description: Legacy Property - Inidcates whether the subscription for this contact is active or not. Please use `IsUnsub` instead.
examples:
- true
deprecated: true
SubscribedAt:
type: string
description: "Indicates when the contact was subscribed to this list ID.\n\n> Note: Returns values only for accounts created after April 5th, 2018.\n"
examples:
- '2018-01-01T00:00:00'
get_v3_contactslist_id_importlist_id_PathParams:
type: object
required:
- list_ID
- job_ID
properties:
list_ID:
type: integer
description: Unique numeric ID assigned to the destination contact list.
job_ID:
type: integer
description: Job ID assigned to a `POST /contactslist/{list_id}/importlist` request. Use it to monitor the progress and success of the request.
list_address:
type: string
description: Unique email address generated by Mailjet for the destination list. This address which can be used only via Mailjet's SMTP server to reach all contacts in it. It is displayed in the `Address` property of the list. The full email address will be `{list_address}@lists.mailjet.com`. Can be used as an alternative to `list_ID`.
OutputContactslistImportList:
type: object
properties:
JobID:
type: integer
description: Job ID assigned to a `POST /contactslist/{list_id}/importlist` request. Use it to monitor the progress and success of the request.
examples:
- 54321
Action:
type: string
description: "Action performed on the destination list:\n\n- `addforce` - Add the contacts to this list and subscribe all of them. If the contact is already present in the list as unsubscribed, it will be forcibly subscribed once again.\n- `addnoforce` - Add the contacts to this list and subscribe them to it. If the contact is already present, it will retain its subscription status, i.e. if a contact is part of the list, but unsubscribed, it will not be forcibly subscribed again.\n- `unsub` - Unsubscribe the contacts from the destination list\n- `duplicate-override` - Add the contacts and duplicate their subscription status from the source list to the destination list. E.g. if in the source list a contact is unsubscribed and in the destination list the same contact is subscribed, the contact will be marked as unsubscribed in the destination list.\n- `duplicate-no-override` - Add the contacts without duplicating their subscription status. E.g. if in the source list a contact is unsubscribed and in the destination list the same contact is subscribed, the contact will remain subscribed in the destination list.\n"
examples:
- addnoforce
ListID:
type: integer
description: Unique numeric ID of the source contact list.
examples:
- 123456
get_v3_contactslist_id_managemanycontacts_id_PathParams:
type: object
required:
- list_ID
- job_ID
properties:
list_ID:
type: integer
description: Unique numeric ID assigned to this contact list.
job_ID:
type: integer
description: Job ID assigned to a `POST /contactslist/{list_id}/managemanycontacts` request. Use it to monitor the progress and success of the request.
list_address:
type: string
description: Unique email address generated by Mailjet for this list. This address which can be used only via Mailjet's SMTP server to reach all contacts in it. It is displayed in the `Address` property of the list. The full email address will be `{list_address}@lists.mailjet.com`. Can be used as an alternative to `list_ID`.
OutputContactslistManageManyContacts:
type: object
properties:
ContactsLists:
type: array
description: A JSON array, containing information about the contact list and the actions performed for it.
items:
properties:
ListID:
type: integer
format: int64
description: Unique numeric ID of the contact list.
examples:
- 987654321
Action:
enum:
- addforce
- addnoforce
- remove
- unsub
type: string
description: "Action to be performed on the contacts for this list:\n\n * `addforce` - Add the contacts to this list and subscribe all of them. Any contacts already present in the list and unsubscribed from it will be forcibly subscribed once again.\n\n * `addnoforce` - Add the contacts to this list and subscribe them to it. Any contacts already present will retain their subscription status, i.e. if a contact is part of the list, but unsubscribed, it will not be forcibly subscribed again.\n\n * `remove` - Remove the contacts from this list.\n\n * `unsub` - Unsubscribe the contacts from this list.\n"
examples:
- addnoforce
Count:
type: integer
description: Number of contacts processed by this request.
examples:
- 1
Error:
type: string
description: Indicates what kind of errors came up during the processing of this job, if any.
ErrorFile:
type: string
description: URL link to the file describing the the types of errors that came up during this job, if any.
JobEnd:
type: string
description: Timestamp indicating when this job request was completed.
examples:
- '2018-01-01T00:00:00'
JobStart:
type: string
description: Timestamp indicating when this job request was started.
examples:
- '2018-01-01T00:00:00'
Status:
type: string
description: "The status of this job request:\n\n * Completed\n * In Progress\n * Error\n"
examples:
- Completed
get_v3_contactslist_id_verify_id_PathParams:
type: object
required:
- list_ID
- job_ID
properties:
list_ID:
type: integer
description: Unique numeric ID assigned to this contact list.
job_ID:
type: integer
description: Job ID assigned to a `POST /contactslist/{list_id}/verify` request. Use it to monitor the progress and success of the request.
OutputContactslistVerifyData:
type: object
properties:
Akid:
type: integer
description: The api key id associated with the verification request job.
examples:
- 1
ContactListID:
type: integer
description: The contact list id with contacts to be verified in the request.
examples:
- 1
Count:
type: integer
description: The number of contacts in the verification job that have thus far been processed.
examples:
- 1
Error:
type: string
description: A resulting error message to provide context for non-success jobs.
examples:
- BV01 Account authorization failed.
ID:
type: integer
description: The job id associated with the verification request.
examples:
- 1
JobEnd:
type: string
description: The time at which the job completed processing.
examples:
- '2022-06-10T18:43:34Z'
JobStart:
type: string
description: The time at which the job started processing.
examples:
- '2022-06-10T18:41:47Z'
Method:
type: string
description: The requested method of verification to perform on the list.
examples:
- fulllist
ResponseURL:
type: string
description: A url where detailed responses can be downloaded.
examples:
- https://mailjet.com
Status:
type: string
description: The current status of the job.
examples:
- Completed
Summary:
type: object
description: Aggregated results from the outcome of the verification job processing. This will update as the job processes.
properties:
result:
type: object
risk:
type: object
get_v3_contactstatistics_id_PathParams:
type: object
required:
- contact_ID
properties:
contact_ID:
type: integer
description: Unique numeric ID of the contact you want to retrieve the statistics for.
contact_email:
type: string
description: The email address of the contact you want to retrieve statistics for. Can be used as an alternative to `contact_ID`.
OutputContactstatistics:
type: object
properties:
BlockedCount:
type: integer
description: Number of blocked messages.
examples:
- 1
BouncedCount:
type: integer
description: Number of bounced messages.
examples:
- 0
ClickedCount:
type: integer
description: Number of clicked messages.
examples:
- 3
ContactID:
type: integer
description: Unique numeric ID for this contact.
examples:
- 123456789
DeferredCount:
type: integer
description: Number of deferred messages - ones that could not be delivered and the system is retrying to send. If after 3 days the sending is unsuccessful, those messages become soft-bounced.
examples:
- 0
DeliveredCount:
type: integer
description: Number of messages delivered to their destination.
examples:
- 13
HardbouncedCount:
type: integer
description: Number of hard-bounced messages.
examples:
- 1
LastActivityAt:
type: string
description: Timestamp indicating the last registered activity for this contact.
examples:
- '2018-01-01T00:00:00'
MarketingContacts:
type: integer
description: Number of marketing contacts.
examples:
- 0
OpenedCount:
type: integer
description: Number of opened messages (This does not represent unique opens).
examples:
- 9
ProcessedCount:
type: integer
description: Number of processed messages.
examples:
- 15
QueuedCount:
type: integer
description: Number of queued messages.
examples:
- 0
SoftbouncedCount:
type: integer
description: Number of soft-bounced messages.
examples:
- 0
SpamComplaintCount:
type: integer
description: Number of messages marked as Spam by the recipients.
examples:
- 0
UnsubscribedCount:
type: integer
description: Number of registered unsubscribe requests.
examples:
- 1
UserMarketingContacts:
type: integer
description: Number of marketing contacts.
examples:
- 0
WorkFlowExitedCount:
type: integer
description: Number of registered automation workflow exits.
examples:
- 0
get_v3_listrecipientstatistics_id_PathParams:
type: object
required:
- listrecipient_ID
properties:
listrecipient_ID:
type: integer
description: Unique numeric ID of this list recipient.
OutputListrecipientstatistics:
type: object
properties:
BlockedCount:
type: integer
description: Number of blocked messages.
examples:
- 0
BouncedCount:
type: integer
description: Number of bounced messages.
examples:
- 1
ClickedCount:
type: integer
description: Number of clicked messages.
examples:
- 3
Data:
type: array
description: A JSON array containing contact properties and their values. Data information will be shown if the `ShowExtraData` query parameter is set to true.
items:
$ref: '#/components/schemas/ArrayListrecipientstatisticsData'
DeferredCount:
type: integer
description: Number of deferred messages - ones that could not be delivered and the system is retrying to send. If after 3 days the sending is unsuccessful, those messages become soft-bounced.
examples:
- 0
DeliveredCount:
type: integer
description: Number of messages delivered to their destination.
examples:
- 13
HardbouncedCount:
type: integer
description: Number of hard-bounced messages.
examples:
- 1
LastActivityAt:
type: string
description: Timestamp indicating the last registered activity for this list recipient.
examples:
- '2018-01-01T00:00:00'
ListRecipientID:
type: integer
description: Unique numeric ID for this list recipient.
examples:
- 1234567890
OpenedCount:
type: integer
description: Number of opened messages.
examples:
- 9
PreQueuedCount:
type: integer
description: Number of pre-queued messages.
examples:
- 0
ProcessedCount:
type: integer
description: Number of processed messages.
examples:
- 14
QueuedCount:
type: integer
description: Number of queued messages.
examples:
- 0
SoftbouncedCount:
type: integer
description: Number of soft-bounced messages.
examples:
- 0
SpamComplaintCount:
type: integer
description: Number of messages marked as Spam by the recipients.
examples:
- 0
UnsubscribedCount:
type: integer
description: Number of registered unsubscribe requests.
examples:
- 1
WorkFlowExitedCount:
type: integer
description: Number of registered automation workflow exits.
examples:
- 0
ArrayListrecipientstatisticsData:
type: object
properties:
Name:
type: string
description: Name of this contact property.
examples:
- age
Value:
type: string
description: Value of this contact property for this contact.
examples:
- '35'
get_v3_messagestatistics_id_PathParams:
type: object
required:
- message_ID
properties:
message_ID:
type: integer
description: Unique numeric ID of the message you want to retrieve the statistics for.
OutputMessagestatistics:
type: object
properties:
AverageClickDelay:
type: number
description: Average delay (in seconds) between the first open and first click event for a message.
examples:
- 20.1234
AverageClickedCount:
type: number
description: Average number of times a click was registered for a message.
examples:
- 1.23
AverageOpenDelay:
type: number
description: Average delay (in seconds) between the message delivery and the first message open.
examples:
- 9.8765
AverageOpenedCount:
type: number
description: Average number of times a recipient opens the message.
examples:
- 1.43
BlockedCount:
type: integer
description: Number of blocked messages.
examples:
- 0
BouncedCount:
type: integer
description: Number of bounced messages.
examples:
- 1
CampaignCount:
type: integer
description: Number of distinct campaigns that are part of these stats.
examples:
- 3
ClickedCount:
type: integer
description: Number of clicked messages.
examples:
- 3
DeferredCount:
type: integer
description: Number of deferred messages - ones that could not be delivered and the system is retrying to send. If after 3 days the sending is unsuccessful, those messages become soft-bounced.
examples:
- 0
DeliveredCount:
type: integer
description: Number of messages delivered to their destination.
examples:
- 13
HardbouncedCount:
type: integer
description: Number of hard-bounced messages.
examples:
- 1
OpenedCount:
type: integer
description: Number of opened messages.
examples:
- 9
ProcessedCount:
type: integer
description: Number of processed messages.
examples:
- 14
QueuedCount:
type: integer
description: Number of messages that are in the queue to be sent out.
examples:
- 0
SoftbouncedCount:
type: integer
description: Number of soft-bounced messages.
examples:
- 0
SpamComplaintCount:
type: integer
description: Number of messages marked as Spam by the recipients.
examples:
- 0
TotalClicksCount:
type: integer
description: Total number of registered open events. Calculated only when the `ProcessTotalOpensCount` query parameter is set as `true`, otherwise 0 is returned.
examples:
- 4
TotalOpensCount:
type: integer
description: Total number of registered click events. Calculated only when the `ProcessTotalClicksCount` query parameter is set as `true`, otherwise 0 is returned.
examples:
- 14
TransactionalCount:
type: integer
description: Number of transactional messages.
examples:
- 1
UnsubscribedCount:
type: integer
description: Number of registered unsubscribe requests.
examples:
- 1
get_v3_newsletter_id_detailcontent_PathParams:
type: object
required:
- newsletter_ID
properties:
newsletter_ID:
type: integer
description: Unique numeric ID for the newsletter you want to retrieve the content of.
OutputNewsletterDetailcontent:
type: object
allOf:
- $ref: '#/components/schemas/BaseNewsletterDetailcontent'
BaseNewsletterDetailcontent:
type: object
properties:
Html-part:
type: string
description: The HTML-formatted part of the message.
examples:
- Dear passenger, welcome to Mailjet!
May the delivery force be with you!
Text-part:
type: string
description: The plain text part of the message.
examples:
- Dear passenger, welcome to Mailjet! May the delivery force be with you!
get_v3_newsletter_id_schedule_PathParams:
type: object
required:
- newsletter_ID
properties:
newsletter_ID:
type: integer
description: Unique numeric ID for the newsletter you want to retrieve the sending schedule of.
OutputNewsletterSchedule:
type: object
properties:
Date:
type: string
description: The timestamp, when the newsletter draft will be sent out. When the newsletter is scheduled for immediate sending, an empty value will be returned.
examples:
- '2018-01-01T00:00:00'
get_v3_newsletter_id_status_PathParams:
type: object
required:
- newsletter_ID
properties:
newsletter_ID:
type: integer
description: Unique numeric ID for the newsletter you want to view the sending status of.
ActionStatusNewsletterStatus:
type: object
properties:
Status:
type: string
description: "The status of the campaign draft:\n\n - `AXCancelled`\n - `Deleted`\n - `Archived`\n - `Draft`\n - `Programmed` (scheduled)\n - `Sent`\n - `AXTested` (AB Testing versions sent, but winning version not selected yet)\n - `AXSelected` (AB Testing winning version selected and sent)\n"
examples:
- Programmed
get_v3_senderstatistics_id_PathParams:
type: object
required:
- sender_ID
properties:
sender_ID:
type: integer
description: Unique numeric ID of the sender you want to retrieve statistics for.
OutputSenderstatistics:
type: object
properties:
BlockedCount:
type: integer
description: Number of blocked messages.
examples:
- 0
BouncedCount:
type: integer
description: Number of bounced messages.
examples:
- 1
ClickedCount:
type: integer
description: Number of clicked messages.
examples:
- 3
DeferredCount:
type: integer
description: Number of deferred messages - ones that could not be delivered and the system is retrying to send. If after 3 days the sending is unsuccessful, those messages become soft-bounced.
examples:
- 0
DeliveredCount:
type: integer
description: Number of messages delivered to their destination.
examples:
- 13
LastActivityAt:
type: string
description: Timestamp indicating the last registered activity linked to messages sent by this sender.
examples:
- '2018-01-01T00:00:00'
HardBouncedCount:
type: integer
description: Number of hard-bounced messages.
examples:
- 1
OpenedCount:
type: integer
description: Number of opened messages.
examples:
- 9
PreQueuedCount:
type: integer
description: Number of pre-queued messages.
examples:
- 0
ProcessedCount:
type: integer
description: Number of processed messages.
examples:
- 14
QueuedCount:
type: integer
description: Number of queued messages.
examples:
- 0
SenderID:
type: integer
description: Unique numeric ID for this sender.
examples:
- 1234
SoftbouncedCount:
type: integer
description: Number of soft-bounced messages.
examples:
- 0
SpamComplaintCount:
type: integer
description: Number of messages marked as Spam by the recipients.
examples:
- 0
UnsubscribedCount:
type: integer
description: Number of registered unsubscribe requests.
examples:
- 1
WorkFlowExitedCount:
type: integer
description: Number of registered automation workflow exits.
examples:
- 0
get_v3_template_id_detailcontent_PathParams:
type: object
required:
- template_ID
properties:
template_ID:
type: integer
description: Unique numeric ID for the template you want to update the contents of.
Owner_Type|Template_Name:
type: string
description: A combination of the `OwnerType` and user-selected name for the template you want to update the contents of, separated with a vertial line. E.g. `user|Weekly Newsletter`. Can be used as an alternative to `template_ID`.
OutputTemplateDetailcontent:
type: object
allOf:
- $ref: '#/components/schemas/BaseTemplateDetailcontent'
BaseTemplateDetailcontent:
type: object
properties:
Headers:
type: object
description: List of default headers as `{header_name}:{header_value}` pairs.
properties:
From:
description: Value should include the sender name and/or email address in the following formats - `john@example.com` or `` or `"John Doe" `.
type: string
readOnly: false
examples:
- john@example.com
Subject:
description: The subject line for this template.
type: string
readOnly: false
examples:
- Your email flight plan!
Reply-to:
description: The reply-to email address for this template.
type: string
readOnly: false
examples:
- copilot@mailjet.com
Html-part:
type: string
description: The HTML-formatted content of the template with Mustache-like logic.
examples:
- Dear passenger, welcome to Mailjet!
May the delivery force be with you!
MJMLContent:
type: string
description: The content of the template in MJML.
Text-part:
type: string
description: The plain text content of the template with Mustache-like logic.
examples:
- Dear passenger, welcome to Mailjet! May the delivery force be with you!
post_v3_campaigndraft_id_detailcontent_PathParams:
type: object
required:
- draft_ID
properties:
draft_ID:
type: integer
description: Unique numeric ID for the campaign draft you want to manage the content for.
NewCampaigndraftDetailcontent:
type: object
allOf:
- $ref: '#/components/schemas/BaseCampaigndraftDetailcontent'
post_v3_campaigndraft_id_schedule_PathParams:
type: object
required:
- draft_ID
properties:
draft_ID:
type: integer
description: Unique numeric ID for the campaign draft you want to schedule.
NewCampaigndraftSchedule:
type: object
properties:
Date:
type: string
description: The timestamp, when the campaign draft will be sent out. Use `Now` to send immediately. Both Unix timestamp (e.g. 1514764800) and RFC3339 (2018-01-01T00:00:00) formats are accepted.
examples:
- '2018-01-01T00:00:00'
required:
- Date
post_v3_campaigndraft_id_send_PathParams:
type: object
required:
- draft_ID
properties:
draft_ID:
type: integer
description: Unique numeric ID of the campaign draft you want to send.
ActionStatusCampaigndraftSend:
type: object
properties:
Status:
type: string
description: Sending status of the campaign draft. Once the `POST` request is successfully processed, the draft will be set as `Programmed` and sent immediately afterwards.
examples:
- Programmed
post_v3_campaigndraft_id_test_PathParams:
type: object
required:
- draft_ID
properties:
draft_ID:
type: integer
description: Unique numeric ID of the campaign draft you want to test.
NewCampaigndraftTest:
type: object
properties:
Recipients:
type: array
description: A JSON array of recipient objects containing `Email` and `Name`. Including the recipient `Name` is optional.
items:
$ref: '#/components/schemas/ArrayCampaigndraftTestRecipients'
required:
- Email
required:
- Recipients
ArrayCampaigndraftTestRecipients:
type: object
properties:
Email:
type: string
description: Email address of the recipient.
examples:
- passenger@mailjet.com
Name:
type: string
description: User-selected name for this recipient. The name will be visible to the recipient.
examples:
- Passenger 1
required:
- Email
ActionStatusCampaigndraftTest:
type: object
properties:
Status:
type: string
description: "The status of the campaign draft. The status is not affected by the test.\n\nPossible values:\n\n- `AXCancelled`\n- `Deleted`\n- `Archived`\n- `Draft`\n- `Programmed` (scheduled)\n- `Sent`\n- `AXTested` (AB Testing versions sent, but winning version not selected yet)\n- `AXSelected` (AB Testing winning version selected and sent)\n"
examples:
- Draft
NewContactManagemanycontacts:
type: object
properties:
Contacts:
type: array
description: A JSON array, containing information about the contacts. Each contact is represented by its `Email`, `Name`, optional campaign exclusion state and `Properties`.
items:
required:
- Email
properties:
Email:
type: string
description: The email address for the contact.
examples:
- passenger@mailjet.com
Name:
type: string
description: User-selected name for the contact.
examples:
- Passenger 1
IsExcludedFromCampaigns:
type: boolean
description: "When true, the contact will be added to the exclusion list and will not be receiving any marketing emails.\n\nDefault value: `false`\n"
examples:
- false
Properties:
type: object
description: A JSON object containing contact properties and their values. Each property is listed with its name as the parameter name, and the property value as the parameter value. The property objects must have been created beforehand via the `/contactmetadata` resource.
examples:
- Name: Passenger 1
Age: 30
ContactsLists:
type: array
description: A JSON array, containing information about the contact lists and the actions performed for each list.
items:
required:
- ListID
- Action
properties:
ListID:
type: integer
format: int64
description: Unique numeric ID of the contact list.
examples:
- 987654321
Action:
enum:
- addforce
- addnoforce
- remove
- unsub
type: string
description: "Action to be performed on the contacts for this list:\n\n * `addforce` - Add the contacts to this list and subscribe all of them. Any contacts already present in the list and unsubscribed from it will be forcibly subscribed once again.\n\n * `addnoforce` - Add the contacts to this list and subscribe them to it. Any contacts already present will retain their subscription status, i.e. if a contact is part of the list, but unsubscribed, it will not be forcibly subscribed again.\n\n * `remove` - Remove the contacts from this list.\n\n * `unsub` - Unsubscribe the contacts from this list.\n"
examples:
- addnoforce
required:
- Contacts
ActionIDContactManagemanycontacts:
type: object
properties:
JobID:
type: integer
description: Unique numeric Job ID returned after a `POST /contact/managemanycontacts` request. Use it to monitor the progress and success of the request.
examples:
- 123456
post_v3_contact_id_managecontactslists_PathParams:
type: object
required:
- contact_ID
properties:
contact_ID:
type: integer
description: Unique numeric ID of the contact you want to manage the subscription status of.
contact_email:
type: string
description: The email address of the contact your want to manage the subscription status of. Must be URL encoded. Can be used as an alternative to `contact_ID`.
NewContactManagecontactslists:
type: object
properties:
ContactsLists:
type: array
description: A JSON array, containing information about the contact lists and the actions performed for each list.
items:
required:
- ListID
- Action
properties:
ListID:
type: integer
format: int64
description: Unique numeric ID of the contact list.
examples:
- 987654321
Action:
enum:
- addforce
- addnoforce
- remove
- unsub
type: string
description: "Action to be performed on the contacts for this list:\n\n * `addforce` - Add the contacts to this list and subscribe all of them. Any contacts already present in the list and unsubscribed from it will be forcibly subscribed once again.\n\n * `addnoforce` - Add the contacts to this list and subscribe them to it. Any contacts already present will retain their subscription status, i.e. if a contact is part of the list, but unsubscribed, it will not be forcibly subscribed again.\n\n * `remove` - Remove the contacts from this list.\n\n * `unsub` - Unsubscribe the contacts from this list.\n"
examples:
- addnoforce
required:
- ContactsLists
OutputContactManagecontactslists:
type: object
properties:
ContactsLists:
type: array
description: A JSON array, containing information about the contact lists and the actions performed for each list.
items:
properties:
ListID:
type: integer
format: int64
description: Unique numeric ID of the contact list.
examples:
- 987654321
Action:
enum:
- addforce
- addnoforce
- remove
- unsub
type: string
description: "Action to be performed on the contacts for this list:\n\n * `addforce` - Add the contacts to this list and subscribe all of them. Any contacts already present in the list and unsubscribed from it will be forcibly subscribed once again.\n\n * `addnoforce` - Add the contacts to this list and subscribe them to it. Any contacts already present will retain their subscription status, i.e. if a contact is part of the list, but unsubscribed, it will not be forcibly subscribed again.\n\n * `remove` - Remove the contacts from this list.\n\n * `unsub` - Unsubscribe the contacts from this list.\n"
examples:
- addnoforce
post_v3_contactslist_id_importlist_PathParams:
type: object
required:
- list_ID
properties:
list_ID:
type: integer
description: Unique numeric ID assigned to the destination contact list.
list_address:
type: string
description: Unique email address generated by Mailjet for the destination list. This address which can be used only via Mailjet's SMTP server to reach all contacts in it. It is displayed in the `Address` property of the list. The full email address will be `{list_address}@lists.mailjet.com`. Can be used as an alternative to `list_ID`.
NewContactslistImportList:
type: object
properties:
Action:
type: string
description: "Action to be performed on the destination list:\n\n- `addforce` - Add the contacts to this list and subscribe all of them. If the contact is already present in the list as unsubscribed, it will be forcibly subscribed once again.\n- `addnoforce` - Add the contacts to this list and subscribe them to it. If the contact is already present, it will retain its subscription status, i.e. if a contact is part of the list, but unsubscribed, it will not be forcibly subscribed again.\n- `unsub` - Unsubscribe the contacts from this list\n- `duplicate-override` - Add the contacts and duplicate their subscription status from the source list to the destination list. E.g. if in the source list a contact is unsubscribed and in the destination list the same contact is subscribed, the contact will be marked as unsubscribed in the destination list.\n- `duplicate-no-override` - Add the contacts without duplicating their subscription status. E.g. if in the source list a contact is unsubscribed and in the destination list the same contact is subscribed, the contact will remain subscribed in the destination list.\n"
examples:
- addnoforce
ListID:
type: integer
description: Unique numeric ID of the source contact list.
examples:
- 123456
required:
- Action
- ListID
ActionIDContactslistImportList:
type: object
properties:
JobID:
type: integer
description: Job ID assigned to a `POST /contactslist/{list_id}/importlist` request. Use it to monitor the progress and success of the request.
examples:
- 54321
post_v3_contactslist_id_managecontact_PathParams:
type: object
required:
- list_ID
properties:
list_ID:
type: integer
description: Unique numeric ID assigned to this contact list.
list_address:
type: string
description: Unique email address generated by Mailjet for this list. This address which can be used only via Mailjet's SMTP server to reach all contacts in it. It is displayed in the `Address` property of the list. The full email address will be `{list_address}@lists.mailjet.com`. Can be used as an alternative to `list_ID`.
NewContactslistManageContact:
type: object
properties:
Action:
type: string
description: "Action to be performed on the contact for this list:\n\n- `addforce` - Add the contact to this list and subscribe all of them. If the contact is already present in the list as unsubscribed, it will be forcibly subscribed once again.\n- `addnoforce` - Add the contact to this list and subscribe them to it. If the contact is already present, it will retain its subscription status, i.e. if a contact is part of the list, but unsubscribed, it will not be forcibly subscribed again.\n- `remove` - Remove the contact from this list\n- `unsub` - Unsubscribe the contact from this list\n"
examples:
- addnoforce
Email:
type: string
description: The email address of this contact.
examples:
- passenger@mailjet.com
required:
- Email
- Action
allOf:
- $ref: '#/components/schemas/BaseContactslistManageContact'
BaseContactslistManageContact:
type: object
properties:
Name:
type: string
description: User-defined name for the contact.
examples:
- John Smith
Properties:
type: object
description: A JSON object containing contact properties and their values. Each property is listed with its name as the parameter name, and the property value as the parameter value. The properties must have been created beforehand.
examples:
- Name: John Smith
Age: 30
OutputContactslistManageContact:
type: object
properties:
Action:
type: string
description: "Action performed on the contact for this list:\n\n- `addforce` - Add the contact to this list and subscribe all of them. If the contact is already present in the list as unsubscribed, it will be forcibly subscribed once again.\n- `addnoforce` - Add the contact to this list and subscribe them to it. If the contact is already present, it will retain its subscription status, i.e. if a contact is part of the list, but unsubscribed, it will not be forcibly subscribed again.\n- `remove` - Remove the contact from this list\n- `unsub` - Unsubscribe the contact from this list\n"
examples:
- addnoforce
Email:
type: string
description: The email address of this contact.
examples:
- passenger@mailjet.com
allOf:
- $ref: '#/components/schemas/BaseContactslistManageContact'
post_v3_contactslist_id_managemanycontacts_PathParams:
type: object
required:
- list_ID
properties:
list_ID:
type: integer
description: Unique numeric ID assigned to this contact list.
list_address:
type: string
description: Unique email address generated by Mailjet for this contact list. This address which can be used only via Mailjet's SMTP server to reach all contacts in it. It is displayed in the `Address` property of the list. The full email address will be `{list_address}@lists.mailjet.com`. Can be used as an alternative to `list_ID`.
NewContactslistManageManyContacts:
type: object
properties:
Action:
type: string
description: "Action to be performed on the contacts for this list:\n\n- `addforce` - Add the contacts to this list and subscribe all of them. If the contact is already present in the list as unsubscribed, it will be forcibly subscribed once again.\n- `addnoforce` - Add the contacts to this list and subscribe them to it. If the contact is already present, it will retain its subscription status, i.e. if a contact is part of the list, but unsubscribed, it will not be forcibly subscribed again.\n- `remove` - Remove the contacts from this list\n- `unsub` - Unsubscribe the contacts from this list\n"
examples:
- addnoforce
Contacts:
type: array
description: A JSON array, containing information about the contacts. Each contact is represented by its `Email`, `Name`, exclusion state and `Properties`.
items:
required:
- Email
properties:
Email:
type: string
description: The email address for the contact.
examples:
- passenger@mailjet.com
Name:
type: string
description: User-selected name for the contact.
examples:
- Passenger 1
IsExcludedFromCampaigns:
type: boolean
description: "When true, the contact will be added to the exclusion list and will not be receiving any marketing emails.\n\nDefault value: `false`\n"
examples:
- false
Properties:
type: object
description: A JSON object containing contact properties and their values. Each property is listed with its name as the parameter name, and the property value as the parameter value. The property objects must have been created beforehand via the `/contactmetadata` resource.
examples:
- Name: Passenger 1
Age: 30
required:
- Action
- Contacts
ActionIDContactslistManageManyContacts:
type: object
properties:
JobID:
type: integer
description: Job ID assigned to a `POST /contactslist/{list_id}/managemanycontacts` request. Use it to monitor the progress and success of the request.
examples:
- 54321
post_v3_contactslist_id_verify_PathParams:
type: object
required:
- list_ID
properties:
list_ID:
type: integer
description: Unique numeric ID assigned to this contact list.
NewContactslistVerify:
type: object
properties:
Method:
type: string
description: "Type of contact list verfication to run:\n- `fulllist` - Verify the entire contact list\n"
examples:
- fulllist
ActionIDContactslistVerify:
type: object
properties:
JobID:
type: integer
description: Job ID assigned to a `POST /contactslist/{list_id}/verify` request. Use it to monitor the progress and success of the request.
examples:
- 54321
post_v3_dns_id_check_PathParams:
type: object
required:
- dns_ID
properties:
dns_ID:
type: integer
description: Unique numeric ID of the DNS settings of the sender domain you want to validate.
dns_domain:
type: string
description: The name of the sender domain you want to validate - e.g. `mailjet.com`. Can be used as an alternative to `dns_ID`.
OutputDnsCheck:
type: object
properties:
DKIMErrors:
type: string
description: DKIM configuration errors found for this domain.
DKIMRecordCurrentValue:
type: string
description: Mailjet's DKIM record found for this domain.
DKIMStatus:
type: string
description: "DKIM configuration status.\n\nPossible values:\n\n- `OK`\n- `Error`\n"
examples:
- Error
SPFErrors:
type: string
description: SPF configuration errors found for this domain.
SPFRecordCurrentValue:
type: string
description: Mailjet's SPF record found for this domain.
SPFStatus:
type: string
description: "SPF configuration status.\n\nPossible values:\n\n- `OK`\n- `Error`\n"
examples:
- OK
post_v3_newsletter_id_detailcontent_PathParams:
type: object
required:
- newsletter_ID
properties:
newsletter_ID:
type: integer
description: Unique numeric ID for the newsletter you want to manage the content of.
NewNewsletterDetailcontent:
type: object
allOf:
- $ref: '#/components/schemas/BaseNewsletterDetailcontent'
post_v3_newsletter_id_schedule_PathParams:
type: object
required:
- newsletter_ID
properties:
newsletter_ID:
type: integer
description: Unique numeric ID for the newsletter you want to schedule.
NewNewsletterSchedule:
type: object
properties:
Date:
type: string
description: The timestamp, when the newsletter will be sent out. Use `Now` to send immediately.
examples:
- '2018-01-01T00:00:00'
required:
- Date
post_v3_newsletter_id_send_PathParams:
type: object
required:
- newsletter_ID
properties:
newsletter_ID:
type: integer
description: Unique numeric ID for the newsletter you want to send.
ActionStatusNewsletterSend:
type: object
properties:
Status:
type: string
description: Sending status of the newsletter. Once the `POST` request is successfully processed, the newsletter will be set as `Programmed` and sent immediately afterwards.
examples:
- Programmed
post_v3_newsletter_id_test_PathParams:
type: object
required:
- newsletter_ID
properties:
newsletter_ID:
type: integer
description: Unique numeric ID for the newsletter you want to test.
NewNewsletterTest:
type: object
properties:
Recipients:
type: array
description: A JSON array of recipient objects containing `Email` and `Name`. Including the recipient Name is optional.
items:
$ref: '#/components/schemas/ArrayNewsletterTestRecipients'
required:
- Recipients
ArrayNewsletterTestRecipients:
type: object
properties:
Email:
type: string
description: The email address for the contact.
examples:
- passenger@mailjet.com
Name:
type: string
description: User-selected name for the contact.
examples:
- Passenger 1
required:
- Email
ActionStatusNewsletterTest:
type: object
properties:
Status:
type: string
description: "The status of the newsletter. The status is not affected by the test:\n\n - `AXCancelled`\n - `Deleted`\n - `Archived`\n - `Draft`\n - `Programmed` (scheduled)\n - `Sent`\n - `AXTested` (AB Testing versions sent, but winning version not selected yet)\n - `AXSelected` (AB Testing winning version selected and sent)\n"
examples:
- Draft
post_v3_sender_id_validate_PathParams:
type: object
required:
- sender_ID
properties:
sender_ID:
type: integer
description: Unique numeric ID for the sender you want to validate.
sender_email:
type: string
description: The email address of the sender object you want to validate. Can be used as an alternative to `sender_ID`.
OutputSenderValidate:
type: object
properties:
ValidationMethod:
type: string
description: Indicates the method of validation that needs to be completed, before this sender is activated.
Errors:
type: string
description: A JSON array containing the error message in case of a failed File or DNS validation.
GlobalError:
type: string
description: Will display a global error message in case of a failed validation.
post_v3_template_id_detailcontent_PathParams:
type: object
required:
- template_ID
properties:
template_ID:
type: integer
description: Unique numeric ID for the template you want to create contents for.
Owner_Type|Template_Name:
type: string
description: A combination of the `OwnerType` and user-selected name for the template you want to create the contents of, separated with a vertial line. E.g. `user|Weekly Newsletter`. Can be used as an alternative to `template_ID`.
NewTemplateDetailcontent:
type: object
allOf:
- $ref: '#/components/schemas/BaseTemplateDetailcontent'
put_v3_campaigndraft_id_schedule_PathParams:
type: object
required:
- draft_ID
properties:
draft_ID:
type: integer
description: Unique numeric ID of the campaign draft you want to update the sending schedule of.
UpdateCampaigndraftSchedule:
type: object
properties:
Date:
type: string
description: The timestamp, when the campaign draft will be sent out. Use `Now` to send immediately.
examples:
- '2018-01-01T00:00:00'
put_v3_newsletter_id_detailcontent_PathParams:
type: object
required:
- newsletter_ID
properties:
newsletter_ID:
type: integer
description: Unique numeric ID for the newsletter you want to update the content of.
UpdateNewsletterDetailcontent:
type: object
allOf:
- $ref: '#/components/schemas/BaseNewsletterDetailcontent'
put_v3_newsletter_id_schedule_PathParams:
type: object
required:
- newsletter_ID
properties:
newsletter_ID:
type: integer
description: Unique numeric ID for the newsletter you want to update the scheduled sending of.
UpdateNewsletterSchedule:
type: object
properties:
Date:
type: string
description: The timestamp, when the newsletter will be sent out. Use `Now` to send immediately.
examples:
- '2018-01-01T00:00:00'
put_v3_template_id_detailcontent_PathParams:
type: object
required:
- template_ID
properties:
template_ID:
type: integer
description: Unique numeric ID for the template you want to update the contents of.
Owner_Type|Template_Name:
type: string
description: A combination of the `OwnerType` and user-selected name for the template you want to update the contents of, separated with a vertial line. E.g. `user|Weekly Newsletter`. Can be used as an alternative to `template_ID`.
OutputApikeytotals:
type: object
properties:
BlockedCount:
type: integer
description: Number of blocked messages.
examples:
- 1
BouncedCount:
type: integer
description: Number of bounced messages.
examples:
- 2
ClickedCount:
type: integer
description: Number of clicked messages.
examples:
- 3
DeferredCount:
type: integer
description: Number of deferred messages - ones that could not be delivered and the system is retrying to send. If after 3 days the sending is unsuccessful, those messages become soft-bounced.
examples:
- 0
DeliveredCount:
type: integer
description: Number of messages delivered to their destination.
examples:
- 13
HardbouncedCount:
type: integer
description: Number of hard-bounced messages.
examples:
- 0
LastActivity:
type: integer
description: "Unix timestamp of the last registered activity for this API Key.\n\n> Note: only returned for accounts created before April 5th, 2018.\n"
examples:
- 1514764800
OpenedCount:
type: integer
description: Number of opened messages.
examples:
- 9
ProcessedCount:
type: integer
description: Number of processed messages.
examples:
- 11
QueuedCount:
type: integer
description: Number of messages waiting in the send queue.
examples:
- 0
SoftbouncedCount:
type: integer
description: Number of soft-bounced messages.
examples:
- 1
SpamcomplaintCount:
type: integer
description: Number of messages marked as Spam by the recipients.
examples:
- 0
UnsubscribedCount:
type: integer
description: Number of registered unsubscribe requests.
examples:
- 1
WorkFlowExitedCount:
type: integer
description: Number of registered automation workflow exits.
examples:
- 0
OutputBouncestatistics:
type: object
properties:
BouncedAt:
type: string
description: Timestamp indicating when the bounce event occurred.
examples:
- '2018-01-01T00:00:00'
CampaignID:
type: integer
description: Unique numeric ID of the campaign this bounce event is linked to.
examples:
- 1234567890
ContactID:
type: integer
description: Unique numeric ID of the contact this bounce event is linked to.
examples:
- 123123123
ID:
type: integer
description: Unique numeric ID of the bounced message.
examples:
- 9876543210123456789
IsBlocked:
type: boolean
description: Indicates whether the contact was blocked as a result of this bounce or not.
examples:
- true
IsStatePermanent:
type: boolean
description: Indicates whether this is a permanent (hard) bounce or not.
examples:
- true
StateID:
type: integer
description: "State of the message after the bounce event:\n\n- `1` = user unknown (recipient)\n- `2` = mailbox inactive (recipient)\n- `3` = quota exceeded (recipient)\n- `4` = invalid domain (domain)\n- `5` = no mail host (domain)\n- `6` = relay/access denied (domain)\n- `7` = sender blocked (spam)\n- `8` = content blocked (spam)\n- `9` = policy issue (spam)\n- `10` = system issue (system)\n- `11` = protocol issue (system)\n- `12` = connection issue (system)\n- `13` = greylisted (domain)\n- `14` = preblocked (Mailjet)\n- `15` = duplicate in campaign (Mailjet)\n- `16` = spam preblocked (Mailjet)\n- `17` = bad or empty template (content)\n- `18` = error in template language (content)\n- `19` = typofix (domain)\n- `20` = blacklisted (recipient)\n- `21` = spam reporter (recipient)\n"
examples:
- 7
OutputCampaigngraphstatistics:
type: object
properties:
Clickcount:
type: integer
description: Number of clicked messages for this time interval. The proper count is returned if the `Click` parameter is set as true. Otherwise the click count will not be calculated and a `-1` value will be returned instead.
examples:
- 123
ID:
type: integer
description: Unique numeric ID for the campaign.
examples:
- 123456789
Opencount:
type: integer
description: Number of opened messages for this time interval. The proper count is returned if the `Open` parameter is set as true. Otherwise the open count will not be calculated and a `-1` value will be returned instead.
examples:
- 321
Spamcount:
type: integer
description: Number of messages marked as spam for this time interval. The proper count is returned if the `Spam` parameter is set as true. Otherwise will the spam count will not be calculated and a `-1` value will be returned instead.
examples:
- 0
Tick:
type: integer
description: The time lapsed since the start of the campaigns, in seconds.
examples:
- 900
Unsubcount:
type: integer
description: Number of unsubscribe events for this time interval. The proper count is returned if the `Unsub` parameter is set as true. Otherwise will the unsubscribe count will not be calculated and a `-1` value will be returned instead.
examples:
- 5
get_v3_campaigngraphstatistics_id_QueryParams:
type: object
properties:
Click:
type: boolean
description: "When true, will retrieve the number of clicked messages in `ClickedCount`. Otherwise the click count is not calculated and a `-1` value is returned instead.\n\nDefault value: `false`\n\n> Note: At least one of the `Open`, `Click`, `Unsub` or `Spam` query parameters must be set to `true`.\n"
Open:
type: boolean
description: "When true, will retrieve the number of opened messages in `OpenedCount`. Otherwise the open count is not calculated and a `-1` value is returned instead.\n\nDefault value: `false`\n\n> Note: At least one of the `Open`, `Click`, `Unsub` or `Spam` query parameters must be set to `true`.\n"
Range:
type: string
description: Selects a period of time since the start of the campaign, for which you want to retrieve evolution statistics. If you select `24h` (24 hours), the stat intervals will be 15 minutes long. If `7d` (7 days) is selected, the intervals will be 30 minutes long.
Spam:
type: boolean
description: "When true, will retrieve the number of messages marked as spam in `SpamCount`. Otherwise the spam count is not calculated and a `-1` value is returned instead.\n\nDefault value: `false`\n\n> Note: At least one of the `Open`, `Click`, `Unsub` or `Spam` query parameters must be set to `true`.\n"
Unsub:
type: boolean
description: "When true, will retrieve the number of unsubscribe events in `UnsubCount`. Otherwise the unsubscribe count is not calculated and a `-1` value is returned instead.\n\nDefault value: `false`\n\n> Note: At least one of the `Open`, `Click`, `Unsub` or `Spam` query parameters must be set to `true`.\n"
OutputCampaignoverview:
type: object
properties:
ClickedCount:
type: integer
description: Indicates the number of clicked messages for this object.
examples:
- 9
DeliveredCount:
type: integer
description: Indicates the number of delivered messages for this object.
examples:
- 13
EditMode:
type: string
description: "Indicates the type of template editor used for this campaign / draft / AB Testing object:\n\n- `tool` - Legacy drag-and-drop template editor\n- `html` - Legacy HTML editor\n- `tool2` - Passport drag-and-drop template editor\n- `html2` - HTML editor in Passport\n- `mjml` - MJML editor in Passport\n"
examples:
- '3'
EditType:
type: string
description: "Indicates the edit type used for this object:\n\n- `full`\n- `unknown`\n"
examples:
- full
ID:
type: integer
description: Unique numeric ID of this campaign / draft / AB Testing object.
examples:
- 123456789
IDType:
type: string
description: "Indicates the type of the object:\n\n- `Campaign` - Sent campaign\n- `AX` - AB Testing object\n- `NL` - Draft\n"
examples:
- Campaign
OpenedCount:
type: integer
description: Indicates the number of opened messages for this object.
examples:
- 3
ProcessedCount:
type: integer
description: Indicates the number of processed messages for this object.
examples:
- 13
SendTimeStart:
type: integer
description: For drafts, this will show the creation time of the draft. For sent campaigns, it will display the sending time. Format - Unix timestamp.
examples:
- 1514764800
Starred:
type: boolean
description: Indicates whether this object is marked as starred or not.
examples:
- false
Status:
type: integer
description: The status of the campaign or draft.
examples:
- 2
deprecated: true
Subject:
type: string
description: Subject line for this campaign / draft / AB Testing object.
examples:
- Your email flight plan!
Title:
type: string
description: Internal user-selected title for this campaign / draft / AB Testing object.
examples:
- My Mailjet Campaign
OutputClickstatistics:
type: object
properties:
ClickedAt:
type: string
description: Timestamp indicating when the click event occurred.
examples:
- '2018-01-01T00:00:00'
ClickedDelay:
type: integer
description: Delay (in seconds) between the message being opened and the URL link being clicked.
examples:
- 123
ContactID:
type: integer
description: Unique numeric ID of the contact this click event is linked to.
examples:
- 987654
ID:
type: integer
description: Unique numeric ID for this click event.
examples:
- 1234567890
MessageID:
type: integer
description: Unique numeric ID of the message this click event is linked to.
examples:
- 987654321234567890
Url:
type: string
description: The URL that generated this click event.
examples:
- https://www.example.com/
UserAgentID:
type: integer
description: Unique numeric ID for the user agent (browser) used for this click event.
examples:
- 154
OutputContactslistsignup:
type: object
properties:
ConfirmAt:
type: integer
description: Unix timestamp indicating when the contact completed the subscription confirmation.
examples:
- 1514764800
ConfirmIp:
type: string
description: The IP address detected during the subscription confirmation.
examples:
- 127.0.0.1
ContactID:
type: integer
description: Unique numeric ID of the contact that made the subscription request.
examples:
- 123456789
Email:
type: string
description: Email address of the contact that made the subscription request.
examples:
- passenger@mailjet.com
ID:
type: integer
description: Unique numeric ID assigned to this subscription request.
examples:
- 987654
ListID:
type: integer
description: Unique numeric ID of the contact list, to which the contact was subscribed.
examples:
- 123456
SignupAt:
type: integer
description: Unix timestamp indicating when the contact made the subscription request.
examples:
- 1514764800
SignupIp:
type: string
description: IP address detected when making the subscription request.
examples:
- 127.0.0.1
SignupKey:
type: string
description: Unique confirmation key, which will be added to the URL the contact will receive in their subscription confirmation email.
examples:
- 987654321a0bc9876d5432109e87fg65
SourceId:
type: integer
description: The ID of the widget used for the subscription request.
examples:
- 654321
Source:
type: string
description: Indicates the source, from which the signup request came.
examples:
- mj_widget
OutputDns:
type: object
properties:
DKIMRecordName:
type: string
description: Name of the DNS DKIM record to insert for this domain.
examples:
- mailjet._domainkey.example.com.
DKIMRecordValue:
type: string
description: Value to insert in the DNS DKIM record for this domain.
examples:
- k=rsa; p=MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCqGKukO1De7zhZj6+H0qtjTkVxwTCpvKe4eCZ0FPqri0cb2JZfXJ/DgYSF6vUpwmJG8wVQZKjeGcjDOL5UlsuusFncCzWBQ7RKNUSesmQRMSGkVb1/3j+skZ6UtW+5u09lHNsj6tQ51s1SPrCBkedbNf0Tp0GbMJDyR4e9T04ZZwIDAQAB
DKIMStatus:
type: string
description: "The status of the last domain DKIM configuration check.\n\nPossible values:\n\n- `OK`\n- `Error`\n- `Not checked`\n"
examples:
- OK
Domain:
type: string
description: The name of the domain linked to this DNS record.
examples:
- example.com
ID:
type: integer
description: Unique numeric ID for this DNS record.
examples:
- 1234
IsCheckInProgress:
type: boolean
description: Indicates whether there is a check in progress for this domain or not.
examples:
- false
LastCheckAt:
type: string
description: Timestamp for the last check performed for this domain.
examples:
- '2018-01-01T00:00:00'
OwnerShipToken:
type: string
description: Value of the token to verify the ownership of the domain.
examples:
- 123a4bc56d7890efg123h4ijk56l78mn
OwnerShipTokenRecordName:
type: string
description: Value to use when configuring the TXT record (DNS) verification for the domain.
examples:
- mailjet._123a4bc56.example.com.
SPFRecordValue:
type: string
description: Value to insert in the DNS SPF record for this domain.
examples:
- v=spf1 include:spf.mailjet.com ?all
SPFStatus:
type: string
description: "SPF status.\n\nPossible values:\n\n- `OK`\n- `Error`\n- `Not checked`\n- `Not found`\n"
examples:
- OK
OutputDomainstatistics:
type: object
properties:
BlockedCount:
type: integer
description: Number of blocked messages.
examples:
- 1
BouncedCount:
type: integer
description: Number of bounced messages.
examples:
- 0
ClickedCount:
type: integer
description: Number of registered clicks.
examples:
- 3
DeliveredCount:
type: integer
description: Number of messages delivered to their destination.
examples:
- 13
Domain:
type: string
description: The name of the recipient domain.
examples:
- gmail.com
ID:
type: integer
description: Unique numeric ID for this domain name. Currently not returned by this endpoint.
examples:
- -1
OpenedCount:
type: integer
description: Number of opened messages.
examples:
- 9
ProcessedCount:
type: integer
description: Number of processed messages.
examples:
- 14
QueuedCount:
type: integer
description: Number of queued messages.
examples:
- 0
SpamComplaintCount:
type: integer
description: Number of messages marked as Spam by the recipients.
examples:
- 0
UnsubscribedCount:
type: integer
description: Number of registered unsubscribe requests.
examples:
- 1
OutputGraphstatistics:
type: object
properties:
BlockedCount:
type: integer
description: Number of blocked messages.
examples:
- 0
BouncedCount:
type: integer
description: Number of bounced messages.
examples:
- 1
ClickedCount:
type: integer
description: Number of registered clicks.
examples:
- 3
DeferredCount:
type: integer
description: Number of deferred messages - ones that could not be delivered and the system is retrying to send. If after 3 days the sending is unsuccessful, those messages become soft-bounced.
examples:
- 0
DeliveredCount:
type: integer
description: Number of messages delivered to their destination.
examples:
- 13
HardbouncedCount:
type: integer
description: Number of hard-bounced messages.
examples:
- 1
OpenedCount:
type: integer
description: Number of opened messages.
examples:
- 9
ProcessedCount:
type: integer
description: Number of processed messages.
examples:
- 14
QueuedCount:
type: integer
description: Number of queued messages.
examples:
- 0
RefTimestamp:
type: string
description: Timestamp indicating the start of the time interval for this stats object. The end of the time interval depends on the selected `Scale`.
examples:
- '2018-01-01'
SendtimeStart:
type: integer
description: Unix timestamp indicating the starting time of this interval.
examples:
- 1514764800
SoftbouncedCount:
type: integer
description: Number of soft-bounced messages.
examples:
- 0
SpamcomplaintCount:
type: integer
description: Number of messages marked as Spam by the recipients.
examples:
- 0
UnsubscribedCount:
type: integer
description: Number of registered unsubscribe requests.
examples:
- 1
OutputListstatistics:
type: object
properties:
ActiveCount:
type: integer
description: Deprecated - Number of active list members.
examples:
- 0
deprecated: true
ActiveExcludedSubscriberCount:
type: integer
description: Deprecated - Total number of active contacts excluded from campaigns.
examples:
- 0
deprecated: true
ActiveUnsubscribedCount:
type: integer
description: Deprecated - Number of registered unsubscribe requests.
examples:
- 0
deprecated: true
BlockedCount:
type: integer
description: Number of blocked messages.
examples:
- 0
BouncedCount:
type: integer
description: Number of bounced messages.
examples:
- 1
ClickedCount:
type: integer
description: Number of clicked messages.
examples:
- 3
CreatedAt:
type: string
description: Timestamp indicating when the contact list was created.
examples:
- '2018-01-01T00:00:00'
DeferredCount:
type: integer
description: Number of deferred messages - ones that could not be delivered and the system is retrying to send. If after 3 days the sending is unsuccessful, those messages become soft-bounced.
examples:
- 0
DeliveredCount:
type: integer
description: Number of messages delivered to their destination.
examples:
- 13
ExcludedSubscriberCount:
type: integer
description: Number of list members that have been excluded from campaigns. Only calculated when `CalcExcludedSubscriber` is specified as `True` in the query.
examples:
- 1
HardbouncedCount:
type: integer
description: Number of hard-bounced messages.
examples:
- 1
ID:
type: integer
description: Unique numeric ID assigned to this contact list.
examples:
- 123456
IsDeleted:
type: boolean
description: Indicates whether this list is deleted or not.
examples:
- false
LastActivityAt:
type: string
description: Timestamp indicating the last registered activity for this contact list.
examples:
- '2018-01-01T00:00:00'
Name:
type: string
description: User-specified name for this contact list (must be unique).
examples:
- my_contactlist
OpenedCount:
type: integer
description: Number of opened messages.
examples:
- 9
PreQueuedCount:
type: integer
description: Number of pre-queued messages.
examples:
- 0
ProcessedCount:
type: integer
description: Number of processed messages.
examples:
- 14
QueuedCount:
type: integer
description: Number of queued messages.
examples:
- 0
SoftbouncedCount:
type: integer
description: Number of soft-bounced messages.
examples:
- 0
SpamComplaintCount:
type: integer
description: Number of messages marked as Spam by the recipients.
examples:
- 0
SubscriberCount:
type: integer
description: Number of subscribers.
examples:
- 14
UnsubscribedCount:
type: integer
description: Number of contacts registered in this contact list. Includes contacts that were unsubscribed from the list, as well as ones that are excluded from campaigns.
examples:
- 1
WorkFlowExitedCount:
type: integer
description: Number of registered automation workflow exits.
examples:
- 0
OutputMessage:
type: object
properties:
ArrivedAt:
type: string
description: Timestamp indicating when the message arrived in the recipient's mailbox.
examples:
- '2018-01-01T00:00:00'
AttachmentCount:
type: integer
description: Number of attachments detected for this message.
examples:
- 1
AttemptCount:
type: integer
description: Number of attempts made to deliver this message.
examples:
- 1
CampaignID:
type: integer
description: Unique numeric ID for the campaign this message is part of.
examples:
- 123456789
ContactAlt:
type: string
description: The email address of the contact, to which the message was sent. Displayed only when ShowContactAlt=true.
examples:
- passenger@mailjet.com
ContactID:
type: integer
description: Unique numeric ID for the contact, to which the message was sent.
examples:
- 987654
Delay:
type: number
description: Delay between the message being processed and it being delivered (in milliseconds).
examples:
- 0
DestinationID:
type: integer
description: Unique numeric ID of the recipient email's domain.
examples:
- 10
FilterTime:
type: integer
description: Time spent processing the text of the message (in milliseconds).
examples:
- 111
ID:
type: integer
description: Unique numeric ID of this message.
examples:
- 1234567890987654321
IsClickTracked:
type: boolean
description: Indicates whether clicks are tracked for this message or not.
examples:
- true
IsHTMLPartIncluded:
type: boolean
description: Indicates whether the message includes any HTML content (Html-part!=null) or not.
examples:
- true
IsOpenTracked:
type: boolean
description: Indicates whether opens are tracked for this message or not.
examples:
- true
IsTextPartIncluded:
type: boolean
description: Indicates whether the message includes a plain text part (`Text-part`!=`null`) or not.
examples:
- true
IsUnsubTracked:
type: boolean
description: Indicates whether unsubscriptions are tracked for this message or not.
examples:
- true
MessageSize:
type: integer
description: Indicates the message size (in bytes).
examples:
- 1234
SenderID:
type: integer
description: Unique numeric ID of the sender email address.
examples:
- 4321
SpamassassinScore:
type: number
description: SpamAssassin score for this message.
examples:
- 0
SpamassRules:
type: string
description: Matched SpamAssassin rules.
StateID:
type: integer
description: "Unique numeric ID explaining why the message was not delivered successfully to the recipient. Only returned if the message was not delivered successfully.\n\nPossible values:\n\n- `1` = user unknown (recipient)\n- `2` = mailbox inactive (recipient)\n- `3` = quota exceeded (recipient)\n- `4` = invalid domain (domain)\n- `5` = no mail host (domain)\n- `6` = relay/access denied (domain)\n- `7` = sender blocked (spam)\n- `8` = content blocked (spam)\n- `9` = policy issue (spam)\n- `10` = system issue (system)\n- `11` = protocol issue (system)\n- `12` = connection issue (system)\n- `13` = greylisted (domain)\n- `14` = preblocked (Mailjet)\n- `15` = duplicate in campaign (Mailjet)\n- `16` = spam preblocked (Mailjet)\n- `17` = bad or empty template (content)\n- `18` = error in template language (content)\n- `19` = typofix (domain)\n- `20` = blacklisted (recipient)\n- `21` = spam reporter (recipient)\n"
StatePermanent:
type: boolean
description: Indicates whether the current state of the message is permanent (i.e. cannot be changed anymore) or not.
examples:
- true
Status:
type: string
description: "Current message status.\n\nPossible values:\n\n- `unknown`\n- `queued`\n- `sent`\n- `opened`\n- `clicked`\n- `bounce`\n- `spam`\n- `unsub`\n- `blocked`\n- `hardbounced`\n- `softbounced`\n- `deferred`\n"
examples:
- clicked
Subject:
type: string
description: The subject line for this message. Displayed only when ShowSubject=true.
examples:
- Your email flight plan!
UUID:
type: string
description: "Unique 128-bit ID for this message.\n\n> Note: Returns values only for accounts created after April 5th, 2018.\n"
examples:
- 1ab23cd4-e567-8901-2345-6789f0gh1i2j
OutputMessageinformation:
type: object
properties:
CampaignID:
type: integer
description: Unique numeric ID of the campaign this message is part of.
examples:
- 123456789
ClickTrackedCount:
type: integer
description: Number of messages, for which click tracking is enabled.
examples:
- 1
ContactID:
type: integer
description: Unique numeric ID of the contact, to which the message was sent.
examples:
- 987654
CreatedAt:
type: string
description: Timestamp indicating when the message was created.
examples:
- '2018-01-01T00:00:00'
ID:
type: integer
description: Unique numeric ID of this message.
examples:
- 1234567890987654321
MessageSize:
type: integer
description: Size of the message (in bytes).
examples:
- 1234
OpenTrackedCount:
type: integer
description: Number of messages, for which open tracking is enabled.
examples:
- 1
QueuedCount:
type: integer
description: Number of messages waiting in the send queue.
examples:
- 0
SendEndAt:
type: string
description: Timestamp indicating when last message was sent for the campaign.
examples:
- '2018-01-01T00:00:00'
SentCount:
type: integer
description: Number of actual sent attempts.
examples:
- 1
SpamAssassinRules:
type: object
description: Matched SpamAssassin rules.
SpamAssassinScore:
type: number
description: SpamAssassin score for this message.
examples:
- 0
OutputMyprofile:
type: object
properties:
ID:
type: integer
description: Unique numeric ID for this profile.
examples:
- 123456
VAT:
type: number
description: The VAT percentage applicable for the registered country.
examples:
- 19
UserID:
type: integer
description: The User ID linked to this profile.
examples:
- 987654
allOf:
- $ref: '#/components/schemas/BaseMyprofile'
BaseMyprofile:
type: object
properties:
AddressCity:
type: string
description: The "City" part of your organization's address.
examples:
- Paris
AddressCountry:
type: string
description: The "Country" part of your organization's address.
examples:
- FR
AddressPostalCode:
type: string
description: The "Postal Code" (or ZIP code) part of your organization's address.
examples:
- '75002'
AddressState:
type: string
description: The "State" part of your organization's address. Applicable only for addresses within the USA.
examples:
- New York
AddressStreet:
type: string
description: The "Street" part of your organization's address.
examples:
- 37 bis, rue de Sentier
BillingEmail:
type: string
description: Email address used for billing.
examples:
- billing@example.com
BirthdayAt:
type: string
description: Timestamp for the user's birthday.
examples:
- '2018-01-01T00:00:00'
CompanyName:
type: string
description: The name of your company.
examples:
- Ma société
CompanyNumOfEmployees:
type: string
description: The number of employees in the company.
examples:
- '51'
ContactPhone:
type: string
description: The company phone number. The proper format is a 2-letter country code followed by the phone number, separated by a vertical bar - e.g. `FR|123456789` or `US|123123123`.
examples:
- FR|600000000
EstimatedVolume:
type: integer
description: Estimated volume of email messages this user will send.
examples:
- 10000
Features:
type: string
description: Allowed features.
Firstname:
type: string
description: The first name of the contact person.
examples:
- Marie
Industry:
type: integer
description: Numeric ID for the industry selected.
examples:
- 240
JobTitle:
type: string
description: The contact person's position within the organization.
examples:
- Marketer
Lastname:
type: string
description: The last name of the contact person.
examples:
- Jean
VATNumber:
type: string
description: The VAT number supplied by the user.
examples:
- '1234567890'
Website:
type: string
description: The organization's website.
examples:
- https://www.example.com/
OutputOpeninformation:
type: object
properties:
ArrivedAt:
type: string
description: Timestamp indicating when the message arrived in the recipient's mailbox.
examples:
- '2018-01-01T00:00:00'
CampaignID:
type: integer
description: Unique numeric ID of the campaign this open event is linked to.
examples:
- 1234567890
ContactID:
type: integer
description: Unique numeric ID of the contact this open event is linked to.
examples:
- 987654
ID:
type: integer
description: Unique numeric ID for this open event. Not returned by the API.
examples:
- -1
deprecated: true
MessageID:
type: integer
description: Unique numeric ID of the message this open event is linked to.
examples:
- 1234567890987654321
OpenedAt:
type: string
description: Timestamp indicating when the message was opened by the reader for the first time.
examples:
- '2018-01-01T00:00:00'
UserAgentFull:
type: string
description: Original User Agent String used to view this message.
examples:
- Mozilla/5.0 (Windows NT 5.1; rv:11.0) Gecko Firefox/11.0 (via ggpht.com GoogleImageProxy)
UserAgentID:
type: integer
description: Unique numeric ID for the user agent (browser) used for this click event.
examples:
- 1234
OutputOpenstatistics:
type: object
properties:
OpenedCount:
type: integer
description: Number of opened messages.
examples:
- 123
OpenedDelay:
type: number
description: Average delay (in seconds) between the sending of the message and the open event.
examples:
- 321.123
ProcessedCount:
type: integer
description: Number of processed messages.
examples:
- 345
OutputStatcounters:
type: object
properties:
APIKeyID:
type: integer
description: Unique numeric ID for this API Key.
examples:
- 123456
EventClickDelay:
type: integer
description: Total click delay (in seconds). Equals the sum of delays between the sending timestamp and click timestamp for all clicked messages (only taking into account the first click).
examples:
- 45
EventClickedCount:
type: integer
description: Total number of click events.
examples:
- 5
EventOpenDelay:
type: integer
description: Total Open delay (in seconds). Equals the sum of delays between the sending timestamp and open timestamp for all opened messages (only taking into account the first open).
examples:
- 12
EventOpenedCount:
type: integer
description: Total number of open events.
examples:
- 13
EventSpamCount:
type: integer
description: Total number of spam reports.
examples:
- 0
EventUnsubscribedCount:
type: integer
description: Total number of unsubscriptions.
examples:
- 1
EventWorkflowExitedCount:
type: integer
description: Total number of workflow exits.
examples:
- 0
MessageBlockedCount:
type: integer
description: Number of blocked messages.
examples:
- 0
MessageClickedCount:
type: integer
description: Number of clicked messages.
examples:
- 3
MessageDeferredCount:
type: integer
description: Number of deferred messages.
examples:
- 0
MessageHardBouncedCount:
type: integer
description: Number of hard-bounced messages.
examples:
- 1
MessageOpenedCount:
type: integer
description: Number of opened messages.
examples:
- 9
MessageQueuedCount:
type: integer
description: Number of queued messages.
examples:
- 0
MessageSentCount:
type: integer
description: Number of sent messages.
examples:
- 14
MessageSoftBouncedCount:
type: integer
description: Number of soft-bounced messages.
examples:
- 0
MessageSpamCount:
type: integer
description: Number of messages marked as spam.
examples:
- 0
MessageUnsubscribedCount:
type: integer
description: Number of messages with unsubscribe requests.
examples:
- 1
MessageWorkFlowExitedCount:
type: integer
description: Number of contacts that exited a workflow.
examples:
- 0
SourceID:
type: integer
description: Unique numeric ID for a campaign, contact list or sender email address. Will indicate a campaign ID when `CounterSource=Campaign`, a list ID when `CounterSource=List` or a sender ID when `CounterSource=Sender`.
examples:
- 1234567890
Timeslice:
type: string
description: Timestamp for when the count was registered. Depends on the value selected for `CounterResolution`.
examples:
- '2018-01-01T00:00:00Z'
Total:
type: integer
description: Total number of processed messages.
examples:
- 14
get_v3_statistics_link_click_QueryParams:
type: object
properties:
CampaignID:
type: integer
description: Retrieves statistics only for the specified campaign ID.
Limit:
type: integer
description: "Limit the response to a select number of returned objects.\n\nDefault value: `10`. Maximum value: `1000`\n"
Offset:
type: integer
description: "Retrieve a list of objects starting from a certain offset. Combine this query parameter with `Limit` to retrieve a specific section of the list of objects.\n\nDefault value: `0`\n"
countOnly:
type: boolean
description: "Set the value of this query parameter to `1` to retrieve the overall number of objects returned by this request for your API Key. No list of results will be returned - the objects will simply be counted.\n\nDefault value: `0`\n\nNote: When you send a request without the `countOnly` query parameter, `Count` and `Total` will only return the number of extracted elements and not the overall number.\n"
Sort:
type: string
description: "Specify a property name for this query parameter to sort the objects in `Data`. By default the sorting is ascending. When a property name is postfixed with DESC (i.e. `property_name+DESC`), the sort order will be descending.\n\nNote: Both the `Sort` query parameter and the option to select a descending order are not available for every property.\n"
OutputLinkClick:
type: object
properties:
ClickedEventsCount:
type: integer
description: Total number of click events for this link.
examples:
- 10
ClickedMessagesCount:
type: integer
description: Total number of messages, where this link was clicked at least once.
examples:
- 8
PositionIndex:
type: integer
description: The position index of the URL link within the HTML content.
examples:
- 2
URL:
type: string
description: The URL, as originally inserted in the campaign HTML content.
examples:
- https://www.mailjet.com/
get_v3_statistics_recipient_esp_QueryParams:
type: object
properties:
CampaignID:
type: integer
description: Retrieves statistics only for the specified campaign ID.
ESP_Name:
type: integer
description: "Retrieves statistics for the given ESPs only. Multiple ESPs can be separated with commas. The list of recognized ESPs you can enter as values is:\n\n- `gmail`\n- `gsuite (gmail for pro)`\n- `orange`\n- `yahoo`\n- `microsoft`\n- `free`\n- `sfr`\n- `laposte`\n- `aol`\n- `comcast`\n- `gmx`\n- `web.de`\n- `t-online`\n- `freenet`\n- `movistar`\n- `vodafone`\n- `jazztel`\n- `ono`\n- `euskaltel`\n- `mundo-r`\n- `sapo`\n- `zoho`\n- `ovh`\n- `kpn`\n- `telenet`\n- `swisscom`\n- `bnet`\n- `messagelabs (symantec)`\n- `mailjet`\n- `btinternet`\n- `icloud`\n- `mail.ru`\n- `ziggo`\n- `wp.pl`\n- `libero`\n- `seznam`\n- `bluewin`\n- `bbox`\n- `qq.com`\n- `skynet`\n- `o2`\n- `gandi`\n- `yandex`\n- `ionos`\n\nWhen entered, the ESP names should be URL-encoded.\n"
Limit:
type: integer
description: "Limit the response to a select number of returned objects.\n\nDefault value: `10`. Maximum value: `1000`\n"
Offset:
type: integer
description: "Retrieve a list of objects starting from a certain offset. Combine this query parameter with `Limit` to retrieve a specific section of the list of objects.\n\nDefault value: `0`\n"
countOnly:
type: boolean
description: "Set the value of this query parameter to `1` to retrieve the overall number of objects returned by this request for your API Key. No list of results will be returned - the objects will simply be counted.\n\nDefault value: `0`\n\nNote: When you send a request without the `countOnly` query parameter, `Count` and `Total` will only return the number of extracted elements and not the overall number.\n"
Sort:
type: string
description: "Specify a property name for this query parameter to sort the objects in `Data`. By default the sorting is ascending. When a property name is postfixed with DESC (i.e. `property_name+DESC`), the sort order will be descending.\n\nNote: Both the `Sort` query parameter and the option to select a descending order are not available for every property.\n"
OutputRecipientEsp:
type: object
properties:
AttemptedMessagesCount:
type: integer
description: Total number of messages, which Mailjet attempted to send to the given recipient ESP. Blocked messages are not included in this count.
examples:
- 15
ClickedMessagesCount:
type: integer
description: Total number of clicked messages for this recipient ESP.
examples:
- 3
DeferredMessagesCount:
type: integer
description: Number of messages which were deferred from the given recipient ESP. Mailjet will continue trying to send those messages for 3 days, after which they will become soft-bounced.
examples:
- 0
DeliveredMessagesCount:
type: integer
description: Total number of messages, which Mailjet delivered to the given recipient ESP.
examples:
- 13
HardBouncedMessagesCount:
type: integer
description: Total number of messages, which were hard-bounced from this recipient ESP.
examples:
- 1
ESPName:
type: string
description: Name of the recipient's Email Service Provider (ESP). "Others" will display stats for messages sent to all ESPs that are not in the list of recognizable ones (see the `ESP_Name` query parameter).
examples:
- Gsuite (gmail for pro)
OpenedMessagesCount:
type: integer
description: Total number of messages opened by a recipient for this ESP.
examples:
- 9
SoftBouncedMessagesCount:
type: integer
description: Total number of messages, which were soft-bounced from this recipient ESP.
examples:
- 0
SpamReportsCount:
type: integer
description: Number of messages, marked as spam by recipients from this ESP.
examples:
- 0
UnsubscribedMessagesCount:
type: integer
description: Number of mNumber of messages that a recipient unsubscribed from for this ESP.
examples:
- 1
OpenRate:
type: number
description: Email open rate, based on delivered messages, for this ESP.
examples:
- 0.69
ClickThroughRate:
type: number
description: Email click-through rate, based on opened messages, for this ESP.
examples:
- 0.23
SoftBouncedRate:
type: number
description: Email soft-bounce rate, based on attempted messages, for this ESP.
examples:
- 0
HardBouncedRate:
type: number
description: Email hard-bounce rate, based on attempted messages, for this ESP.
examples:
- 0.08
UnsubscribedRate:
type: number
description: Email unsubscribe rate, based on delivered messages, for this ESP.
examples:
- 0.08
SpamReportsRate:
type: number
description: Rate of spam reports, based on delivered messages, for this ESP.
examples:
- 0
DeferredRate:
type: number
description: Deferred email rate, based on attempted messages, for this ESP.
examples:
- 0
OutputToplinkclicked:
type: object
properties:
ClickedCount:
type: integer
description: Number of unique (deduplicated) clicks for this link. When `ActualClicks=true`, will return the total number of clicks instead.
examples:
- 10
LinkId:
type: integer
description: Unique numeric ID for this link.
examples:
- 12345
Url:
type: string
description: The URL of the clicked link.
examples:
- https://www.example.com/
OutputUser:
type: object
properties:
CreatedAt:
type: string
description: Timestamp indicating when this user was created.
examples:
- '2018-01-01T00:00:00'
FirstIp:
type: string
description: The IP address first used to access this user.
examples:
- 127.0.0.1
ID:
type: integer
description: Unique numeric User ID.
examples:
- 123456
LastIp:
type: string
description: The IP address last used to access this user.
examples:
- 127.0.0.1
MaxAllowedAPIKeys:
type: integer
description: The maximum allowed number of API Keys that can be created for this user.
examples:
- 2
Username:
type: string
description: This user's username. By default the username will be a combination of the first and last name registered in the user's profile - e.g. "John Smith".
examples:
- John Doe
WarnedRatelimitAt:
type: string
description: Timestamp indicating when this user was last warned about hitting their rate limit.
examples:
- '2018-01-01T00:00:00'
allOf:
- $ref: '#/components/schemas/BaseUser'
BaseUser:
type: object
properties:
ACL:
type: string
description: Access Control List. Indicates permissions attached to a resource.
Email:
type: string
description: This user's email address.
examples:
- user@example.com
LastLoginAt:
type: string
description: Timestamp indicating when this user was last logged into.
examples:
- '2018-01-01T00:00:00'
Locale:
type: string
description: "Language settings for this user.\n\nPossible values:\n\n- `en_US`\n- `en_GB`\n- `en_EU`\n- `de_DE`\n- `fr_FR`\n- `es_ES`\n- `it_IT`\n- `pt_PT`\n- `pt_BR`\n- `da_DK`\n- `sv_SE`\n- `nl_NL`\n\nDefault value: `en_US`\n"
examples:
- en_US
Timezone:
type: string
description: "Time zone selected for this user.\n\nDefault value: `etc/UTC`\n"
examples:
- Europe/Paris
OutputUseragentstatistics:
type: object
properties:
Count:
type: integer
description: Number of clicks using this browser / email client.
examples:
- 10
DistinctCount:
type: integer
description: User of messages clicked using this browser / email client.
examples:
- 5
Platform:
type: string
description: Platform on which the browser / email client runs.
examples:
- Windows
UserAgent:
type: string
description: Description of the user agent.
examples:
- Chrome 11
NewSendAPIv31Send:
type: object
properties:
SandboxMode:
type: boolean
description: "When true, the API call will be run in Sandbox mode. This will disable the delivery of the message, but the API will still perform all necessary validations. You will still receive success or error messages related to the processing of the message. If the message is processed successfully, you will receive the standard response payload but without the Message ID and UUID.\n\nDefault value: `false`\n"
examples:
- true
AdvanceErrorHandling:
type: boolean
description: When true, enables additional error checks relating to the Send API v3.1 payload. Keep in mind that For a list of all error checks enabled by this, please see the [Send API errors](/docs/email-api/send-api-v31/send-api-errors) section in the Email API Guides.
Globals:
type: object
description: "An object containing properties that will be applied to all message objects (). Use this whenever you have property values that are the same across multiple messages in the payload.\n\nIn `Globals` you can specify any of the message properties __except `To`__.\n\nIf the properties are specified in both `Globals` and in a message object:\n\n - String, integer and boolean properties will be overwritten by the message properties of the same name.\n - Object type properties (`From`, `Sender`, `ReplyTo`, `TemplateErrorReporting`, `Headers`, `Variables`) will be merged with the message property, overwriting any concurrent property.\n - Array type properties (`Cc`, `Bcc`, `Attachments`, `InlineAttachments`) will be appended.\n\nFor more information and examples click [here](/docs/email-api/send-api-v31/set-global-payload-properties).\n"
Messages:
type: array
description: A JSON array containing message objects.
items:
required:
- From
- To
properties:
From:
type: object
description: "A JSON object containing 2 properties - `Email` and `Name`. Specifies the sender name and email address:\n\n1. When `Sender` is not specified, the email address will be used to send the message. In such cases, it must be a valid, activated sender for this account. See the `/sender` and `/metasender` resources for more info.\n\n2. When `Sender` is specified, the `Sender` email address will be used to send the message, while the `From` email address will be displayed in the recipient's inbox. In such cases, it is not necessary for the `From` address to be validated. When the `Sender` and `From` domains differ, the information will be displayed in the inbox as `From {from_email} via / sent on behalf of {sender_domain}`.\n\n> Note: If the `From` domain has a DMARC policy in effect (e.g. Yahoo, AOL), the message will not be delivered. Instead, it will either bounce or be considered as Spam.\n"
required:
- Email
properties:
Email:
type: string
format: email
description: The `From` email address.
readOnly: false
examples:
- pilot@mailjet.com
Name:
type: string
description: The name of the sender. Will be displayed next to the sender email in the recipient's mailbox.
readOnly: false
examples:
- Your Mailjet Pilot
Sender:
type: object
description: "A JSON object containing 2 properties - `Email` and `Name`. Specifies the sender name and email address. Used when you want to send emails on behalf of a different email address. Must be a valid, activated sender for this account. See the `/sender` and `/metasender` resources for more info. Only `Email` is a mandatory property within this object.\n\nThe `Sender` email address will be used to send the message, while the `From` email address will be displayed in the recipient's inbox. In such cases, it is not necessary for the `From` address to be verified. However, the information will be displayed in the inbox as `From {from_email} via / sent on behalf of {sender_domain}`.\n\n> Note: This option is disabled by default and is no longer available for new setups. Existing Default Sender configurations continue to work, but Mailjet no longer enables this functionality on new requests.\n"
required:
- Email
properties:
Email:
type: string
format: email
description: The email address used to send the message.
readOnly: false
examples:
- copilot@mailjet.com
Name:
type: string
description: User-selected name for the `Sender` email address.
readOnly: false
examples:
- Your Mailjet Co-pilot
To:
type: array
description: A JSON array of recipients. Each recipient object within the array may contain the name, but must always contain the recipient email.
items:
required:
- Email
properties:
Email:
type: string
format: email
description: The email address of the recipient.
readOnly: false
examples:
- passenger@mailjet.com
Name:
type: string
description: The name of the recipient. Will be displayed next to the recipient's email in their mailbox.
readOnly: false
examples:
- Passenger 1
Cc:
type: array
description: A JSON array of recipients who are supposed to receive a carbon copy (cc) of this message. Used together with `To` and `Bcc` (optional). Each recipient object within the array may contain the name, but must always contain the recipient email.
items:
required:
- Email
properties:
Email:
type: string
format: email
description: The email address of the recipient.
readOnly: false
examples:
- passenger2@mailjet.com
Name:
type: string
description: The name of the recipient. Will be displayed next to the recipient's email in their mailbox.
readOnly: false
examples:
- Passenger 2
Bcc:
type: array
description: A JSON array recipients who are supposed to receive a blind carbon copy (bcc) of this message. Use this when you do not want your other recipients to see that you are sending a copy of the message to this email address. Used together with `To` and `Cc` (optional). Each recipient object within the array may contain the name, but must always contain the recipient email.
items:
required:
- Email
properties:
Email:
type: string
format: email
description: The email address of the recipient.
readOnly: false
examples:
- passenger3@mailjet.com
Name:
type: string
description: The name of the recipient. Will be displayed next to the recipient's email in their mailbox.
readOnly: false
examples:
- Passenger 3
ReplyTo:
type: object
description: An object containing the email address and name (optional), to which replies to this message will go.
required:
- Email
properties:
Email:
type: string
format: email
description: The reply-to email address.
readOnly: false
examples:
- copilot@mailjet.com
Name:
type: string
description: The name of the reply-to contact. Will be displayed next to the reply-to email in the respective mailbox.
readOnly: false
examples:
- Your Mailjet Co-pilot
Subject:
maxLength: 255
type: string
description: The email subject line.
readOnly: false
examples:
- Your email flight plan!
TextPart:
type: string
description: Provides the Text part of the message. Mandatory, if the `HTMLPart` and `TemplateID` parameters are not specified.
readOnly: false
examples:
- Dear passenger, welcome to Mailjet! May the delivery force be with you!
HTMLPart:
type: string
description: Provides the HTML part of the message. Mandatory, if the `TextPart` and `TemplateID` parameters are not specified.
readOnly: false
examples:
- Dear passenger, welcome to Mailjet!
May the delivery force be with you!
TemplateID:
type: integer
description: Unique numeric ID of the template to be used as email content. If the HTML/Text parts are specified, `TemplateID` will overwrite them. Equivalent to using the `X-MJ-TemplateID` header through SMTP.
readOnly: false
examples:
- 12345
TemplateLanguage:
type: boolean
description: "When true, activates the template language processing. Equivalent to using the `X-MJ-TemplateLanguage` header through SMTP.\n\nDefault value: `false`\n"
readOnly: false
examples:
- false
TemplateErrorReporting:
type: object
description: An object containing the email address and name of the recipient, to whom a carbon copy with the error message is sent to in case of sending issues. Can only be used when `TemplateLanguage=true`. Equivalent to using the `X-MJ-TemplateErrorReporting` header through SMTP.
required:
- Email
properties:
Email:
type: string
format: email
description: The email address, to which the carbon copy of the email with the error message will be sent.
readOnly: false
examples:
- errors@mailjet.com
Name:
type: string
description: The name of the recipient, to whom the carbon copy of the email with the error message will be sent.
readOnly: false
examples:
- Error Email
TemplateErrorDeliver:
type: boolean
description: "When true, the message delivery will proceed if an error is discovered in the templating language. When false, the message delivery will be stopped. Can only be used when `TemplateLanguage=true`. Equivalent to using the `X-MJ-TemplateErrorDeliver` header through SMTP.\n\nDefault value: `false`\n"
readOnly: false
examples:
- true
Attachments:
type: array
description: A JSON array containing descriptions of the files attached to this message. The array contains the Filename, Content type and Base64 encoded content of the file. The total size of the API call payload - including all attachments, inline attachments and message content - should not exceed 15 MB.
items:
required:
- Filename
- ContentType
- Base64Content
properties:
Filename:
type: string
description: The full name of the file (including the file extension).
readOnly: false
examples:
- test.txt
ContentType:
type: string
description: Defines the type of content being sent out using a MIME type. See the [official MIME type](https://www.iana.org/assignments/media-types/media-types.xhtml) list for additional information.
readOnly: false
examples:
- text/plain
Base64Content:
type: string
format: Base64 encoded content
description: Base64 encoded content of the attached file.
readOnly: false
examples:
- VGhpcyBpcyB5b3VyIGF0dGFjaGVkIGZpbGUhISEK
InlinedAttachments:
type: array
description: A JSON array containing descriptions of the files attached to this message, that are available for inline use. Inline attachments can be visible directly in the body of the message, depending on the email client support. Insert the file into the HTML code of the email by using `cid:Filename`, or, if you have specified `ContentID`, by using `cid:ContentID`. The total size of the API call payload - including all attachments, inline attachments and message content - should not exceed 15 MB.
items:
required:
- Filename
- ContentType
- Base64Content
properties:
Filename:
type: string
description: The full name of the file (including the file extension).
readOnly: false
examples:
- logo.gif
ContentType:
type: string
description: Defines the type of content being sent out using a MIME type. See the [official MIME type](https://www.iana.org/assignments/media-types/media-types.xhtml) list for additional information.
readOnly: false
examples:
- image/gif
Base64Content:
type: string
format: Base64 encoded content
description: Base64 encoded content of the attached file.
readOnly: false
examples:
- R0lGODlhEAAQAOYAAP////748v39/Pvq1vr6+lJSVeqlK/zqyv7+/unKjJ+emv78+fb29pucnfrlwvTCi9ra2vTCa6urrWdoaurr6/Pz8uHh4vn49PO7QqGfmumaN+2uS1ZWWfr27uyuLnBxd/z8+0pLTvHAWvjar/zr2Z6cl+jal+2kKmhqcEJETvHQbPb07lBRVPv6+cjJycXFxn1+f//+/f337nF0efO/Mf306NfW0fjHSJOTk/TKlfTp0Prlx/XNj83HuPfEL+/v8PbJgueXJOzp4MG8qUNES9fQqN3d3vTJa/vq1f317P769f/8+gAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACH/C1hNUCBEYXRhWE1QPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgNS4wLWMwNjAgNjEuMTM0Nzc3LCAyMDEwLzAyLzEyLTE3OjMyOjAwICAgICAgICAiPiA8cmRmOlJERiB4bWxuczpyZGY9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkvMDIvMjItcmRmLXN5bnRheC1ucyMiPiA8cmRmOkRlc2NyaXB0aW9uIHJkZjphYm91dD0iIiB4bWxuczp4bXA9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC8iIHhtbG5zOnhtcE1NPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvbW0vIiB4bWxuczpzdFJlZj0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL3NUeXBlL1Jlc291cmNlUmVmIyIgeG1wOkNyZWF0b3JUb29sPSJBZG9iZSBQaG90b3Nob3AgQ1M1IFdpbmRvd3MiIHhtcE1NOkluc3RhbmNlSUQ9InhtcC5paWQ6MjY5ODYxMzYzMkJCMTFFMDkzQkFFMkFENzVGN0JGRkYiIHhtcE1NOkRvY3VtZW50SUQ9InhtcC5kaWQ6MjY5ODYxMzczMkJCMTFFMDkzQkFFMkFENzVGN0JGRkYiPiA8eG1wTU06RGVyaXZlZEZyb20gc3RSZWY6aW5zdGFuY2VJRD0ieG1wLmlpZDoyNjk4NjEzNDMyQkIxMUUwOTNCQUUyQUQ3NUY3QkZGRiIgc3RSZWY6ZG9jdW1lbnRJRD0ieG1wLmRpZDoyNjk4NjEzNTMyQkIxMUUwOTNCQUUyQUQ3NUY3QkZGRiIvPiA8L3JkZjpEZXNjcmlwdGlvbj4gPC9yZGY6UkRGPiA8L3g6eG1wbWV0YT4gPD94cGFja2V0IGVuZD0iciI/PgH//v38+/r5+Pf29fTz8vHw7+7t7Ovq6ejn5uXk4+Lh4N/e3dzb2tnY19bV1NPS0dDPzs3My8rJyMfGxcTDwsHAv769vLu6ubi3trW0s7KxsK+urayrqqmop6alpKOioaCfnp2cm5qZmJeWlZSTkpGQj46NjIuKiYiHhoWEg4KBgH9+fXx7enl4d3Z1dHNycXBvbm1sa2ppaGdmZWRjYmFgX15dXFtaWVhXVlVUU1JRUE9OTUxLSklIR0ZFRENCQUA/Pj08Ozo5ODc2NTQzMjEwLy4tLCsqKSgnJiUkIyIhIB8eHRwbGhkYFxYVFBMSERAPDg0MCwoJCAcGBQQDAgEAACH5BAEAAAAALAAAAAAQABAAAAdUgACCg4SFhoeIiYRGLhaKhA0TMDgSLxAUiEIZHAUsIUQpKAo9Og6FNh8zJUNFJioYQIgJRzc+NBEkiAcnBh4iO4o8QRsjj0gaOY+CDwPKzs/Q0YSBADs=
ContentID:
type: string
description: Name of the `cid` to be inserted in the HTML content of the message. The value must be unique across all inline attachments in the message.
readOnly: false
examples:
- logo
Priority:
type: integer
description: "Indicates the processing priority inside your account (API Key) scheduling queue. Equivalent of using the `X-Mailjet-Prio` header through SMTP.\n\nThere are two queues - low priority (`0`, `1`) and high priority (`2`, `3`):\n\n- `0` - low priority queue, processed first in, first out\n- `1` - goes before the low priority queue, processed last in, first out\n- `2` - high priority queue, processed first in, first out\n- `3` - goes before the high priority queue, processed last in, first out\n\nSend transactional messages with `2` and marketing messages with `0`. Codes `1` and `3` are intended for narrow cases where tight control of the email flow is necessary - `3` can block messages sent with `2`, so it is not advised for large volumes. Whether high or low priority, the processing speed is the same - only the order changes.\n\n[More information](https://documentation.mailjet.com/hc/en-us/articles/360043571894-Email-Priority-Management).\n\nDefault value: `2`\n"
readOnly: false
examples:
- 2
CustomCampaign:
type: string
description: Specifies a custom campaign name, to which all messages with this property value will be assigned. If the campaign doesn't already exist it will be automatically created in the Mailjet system. API users are allowed to send multiple emails from the same campaign name to the same contacts. To block this feature, use the `DeduplicateCampaign` property. Equivalent of using `X-Mailjet-Campaign` header through SMTP.
readOnly: false
examples:
- SendAPI_campaign
DeduplicateCampaign:
type: boolean
description: "Enables or disables the option to send messages from the same campaign to the same contact multiple times. Equivalent of using `X-Mailjet-DeduplicateCampaign` header through SMTP.\n\nWhen set to `true`, a contact that has already received a message carrying a particular `CustomCampaign` value will not receive another message from that same campaign. When `false`, the same contact can receive multiple messages from the same grouped campaign.\n\nDefault value: `false`\n"
readOnly: false
examples:
- true
TrackOpens:
enum:
- account_default
- disabled
- enabled
- anon
type: string
description: "Enable or disable open tracking on this message. This property will overwrite the preferences selected in the [Mailjet account](https://app.mailjet.com/account/settings). Equivalent of using `X-Mailjet-TrackOpen` header through SMTP.\n\nAllowed Values:\n - `account_default` = use the values specified in the [Mailjet account](https://app.mailjet.com/account/settings)\n - `disabled` = disable tracking for this message\n - `enabled` = enable tracking for this message\n - `anon` = record opens without linking them to the individual recipient\n\nThis property is set per message object, so a single request can carry different values for different recipients - for example `enabled` for contacts who consented to tracking and `disabled` or `anon` for those who did not. Use `CustomCampaign` to keep those messages grouped under one campaign for reporting.\n\nDefault value: `account_default`\n"
readOnly: false
examples:
- account_default
TrackClicks:
enum:
- account_default
- disabled
- enabled
- anon
type: string
description: "Enable or disable click tracking on this message. This property will overwrite the preferences selected in the [Mailjet account](https://app.mailjet.com/account/settings). Equivalent of using `X-Mailjet-TrackClick` header through SMTP.\n\nAllowed Values:\n - `account_default` = use the values specified in the [Mailjet account](https://app.mailjet.com/account/settings)\n - `disabled` = disable tracking for this message\n - `enabled` = enable tracking for this message\n - `anon` = record clicks without linking them to the individual recipient\n\nThis property is set per message object, so a single request can carry different values for different recipients - for example `enabled` for contacts who consented to tracking and `disabled` or `anon` for those who did not. Use `CustomCampaign` to keep those messages grouped under one campaign for reporting.\n\nDefault value: `account_default`\n"
readOnly: false
examples:
- account_default
CustomID:
type: string
description: Select a user-defined custom ID.
readOnly: false
examples:
- CustomValue
EventPayload:
type: string
description: Defines a payload attached to the message. The Parse API will return the values in the payload. Any standard format can be used - XML, JSON, CSV etc. Equivalent of using `X-MJ-EventPayload` header through SMTP.
readOnly: false
examples:
- Eticket,1234,row,15,seat,B
URLTags:
type: string
description: URL tags to append every URL link in the message. The user needs to provide the query between the `?` and `#` characters in the URL. The URLTags value needs to be URL-encoded.
examples:
- utm_source=newsletter&utm_medium=email&utm_campaign=sale1
Headers:
type: object
description: "A JSON object containing additional email headers. Specified as `{header_name}:{header_value}` pairs.\n"
readOnly: false
examples:
- X-my-custom-header: Custom text
Variables:
type: object
description: A JSON object containing variables used to modify the content of your email. Specified as `{var_name}:{var_value}` pairs. Enter the information in the template text / HTML part by using the `[[var:{var_name}]]` format. Equivalent of using `X-MJ-Vars` header through SMTP.
readOnly: false
examples:
- day: Monday
personalmessage: Happy birthday!
required:
- Messages
OutputSendAPIv31Send:
properties:
Status:
type: string
description: "Indicates the sending status of the message.\n\nPossible values:\n\n- `success`\n- `error`\n"
examples:
- success
Errors:
type: array
description: A JSON array containing information about any errors with the processing of this message. Will be displayed only if processing errors occur. Each error will generate a separate error object with the below properties.
items:
properties:
ErrorIdentifier:
type: string
format: UUID
description: A 128-bit universally unique identifier (UUID) for this error.
readOnly: true
examples:
- 1ab23cd4-e567-8901-2345-6789f0gh1i2j
ErrorCode:
type: string
description: An internal Mailjet error code for this error. See [Send API Errors](/docs/email-api/send-api-v31/send-api-errors) for more information.
readOnly: true
examples:
- send-0010
StatusCode:
type: integer
description: The error status code. See [Send API Errors](/docs/email-api/send-api-v31/send-api-errors) for more information.
readOnly: true
examples:
- 400
ErrorMessage:
type: string
description: An error message informing the user what the issue is.
readOnly: true
examples:
- Template ID "123456789" doesn't exist for your account.
ErrorRelatedTo:
type: object
description: Indicates which part of the payload this error is related to.
readOnly: true
examples:
- TemplateID
CustomID:
type: string
description: A user-defined custom ID.
examples:
- CustomValue
To:
type: array
description: A JSON array containing information about the messages sent to recipients in To.
items:
properties:
Email:
type: string
format: email
description: The email address of this recipient.
readOnly: true
examples:
- passenger@mailjet.com
MessageUUID:
type: string
format: UUID
description: A 128-bit universally unique identifier (UUID) for this message.
readOnly: true
examples:
- 1ab23cd4-e567-8901-2345-6789f0gh1i2j
MessageID:
type: integer
format: int64
description: Unique numeric ID of this message.
readOnly: true
examples:
- 1234567890987654321
MessageHref:
type: string
description: URL link that can be used for an API call to retrieve more information about this message.
readOnly: true
examples:
- https://api.mailjet.com/v3/message/1234567890987654321
Cc:
type: array
description: A JSON array containing information about the messages sent to recipients in Cc.
items:
properties:
Email:
type: string
format: email
description: The email address of this recipient.
readOnly: true
examples:
- passenger2@mailjet.com
MessageUUID:
type: string
format: UUID
description: A 128-bit universally unique identifier (UUID) for this message.
readOnly: true
examples:
- 9ab87cd6-e567-8901-2345-6789f0gh1i2j
MessageID:
type: integer
format: int64
description: Unique numeric ID for this message.
readOnly: true
examples:
- 9876543210987654321
MessageHref:
type: string
description: URL link that can be used for an API call to retrieve more information about this message.
readOnly: true
examples:
- https://api.mailjet.com/v3/message/9876543210987654321
Bcc:
type: array
description: A JSON array containing information about the messages sent to recipients in Bcc.
items:
properties:
Email:
type: string
format: email
description: The email address of this recipient.
readOnly: true
examples:
- passenger3@mailjet.com
MessageUUID:
type: string
format: UUID
description: A 128-bit universally unique identifier (UUID) for this message.
readOnly: true
examples:
- 9ab87cd6-e567-8901-2345-1234ab4321ba
MessageID:
type: integer
format: int64
description: Unique numeric ID for this message.
readOnly: true
examples:
- 123123123321321321
MessageHref:
type: string
description: URL link that can be used for an API call to retrieve more information about this message.
readOnly: true
examples:
- https://api.mailjet.com/v3/message/123123123321321321
NewApikey:
type: object
properties:
Name:
type: string
description: User readable name for this API Key.
examples:
- API Key 1
required:
- Name
allOf:
- $ref: '#/components/schemas/BaseApikey'
NewCampaigndraft:
type: object
properties:
ContactsListID:
type: integer
description: Unique numeric ID for the contact list linked to this draft. Required for successful sending of the campaign. Interchangeable with `ContactsListAlt`.
examples:
- 123456
ContactsListAlt:
type: string
description: A unique contact list email address generated by Mailjet, which is linked to this campaign draft. Required for successful sending of the campaign. Interchangeable with `ContactsListID`.
examples:
- abcdef123
Locale:
type: string
description: Locale, in which the information is saved.
examples:
- en_US
SegmentationID:
type: integer
description: ID of the segment configuration (contactfilter) used for this campaign draft. Interchangeable with `SegmentationAlt`.
examples:
- 123
SegmentationAlt:
type: string
description: The user-selected name of the segment configuration (contactfilter) used for this campaign draft. Interchangeable with `SegmentationID`.
examples:
- Customers under 35
Sender:
type: string
description: ID of the sender email address. Required for successful sending of the campaign.
examples:
- '1234'
SenderEmail:
type: string
description: The email address of the sender. Required for successful sending of the campaign.
examples:
- pilot@mailjet.com
Subject:
type: string
description: Subject line for the campaign emails.
examples:
- Your email flight plan!
required:
- Locale
- Subject
allOf:
- $ref: '#/components/schemas/BaseCampaigndraft'
NewContact:
type: object
properties:
Email:
type: string
description: Contact email address. Must be unique (not present already in the global contact list).
examples:
- passenger@mailjet.com
required:
- Email
allOf:
- $ref: '#/components/schemas/BaseContact'
NewContactfilter:
type: object
required:
- Name
- Expression
allOf:
- $ref: '#/components/schemas/BaseContactfilter'
NewContactmetadata:
type: object
properties:
Datatype:
type: string
description: "Indicates the type of data accepted for this contact property:\n\n- `str` - string\n- `int` - integer\n- `float` - float / number\n- `bool` - boolean\n- `datetime` - datetime (Unix Timestamp or RFC 3339)\n\nDefault value: `str`\n"
examples:
- str
Name:
type: string
description: Name of the contact property. The name must be unique for the respective namespace.
examples:
- first_name
NameSpace:
type: string
description: "Indicates the namespace of this contact property:\n\n- `static` - Can keep only 1 value. Each change to the value of the property for a contact overwrites the previously selected value. The values are saved in a `contactdata` object.\n- `historic` - Each change to the value of the property creates a record in a new `contacthistorydata` object, saving the property value and a timestamp of when it was submitted.\n\nDefault value: `static`\n"
examples:
- static
required:
- Name
NewContactslist:
type: object
required:
- Name
allOf:
- $ref: '#/components/schemas/BaseContactslist'
NewCsvimport:
type: object
properties:
ContactsListID:
type: integer
description: "Unique numeric ID of the list, where you want to use the uploaded CSV data. Interchangeable with ContactsListAlt.\n\n> Note: `ContactsListID` should **not** be added to the input payload, if `Method` is set to `includemarketing` or `excludemarketing`.\n"
examples:
- 123456
DataID:
type: integer
description: Unique numeric ID of the CSV data you want to use.
examples:
- 98765432123456789
required:
- ContactsListID
- DataID
allOf:
- $ref: '#/components/schemas/BaseCsvimport'
NewEventcallbackurl:
type: object
properties:
Url:
type: string
description: "The URL used for this object.\n\n> Note: The URL provided cannot be a root URL.\n"
examples:
- https://www.example.com/123/
required:
- Url
allOf:
- $ref: '#/components/schemas/BaseEventcallbackurl'
NewListrecipient:
type: object
properties:
ContactID:
type: integer
description: Unique numeric ID for the contact the list recipient is linked to. Interchangeable with `ContactAlt`.
examples:
- 987654321
ContactAlt:
type: string
description: The email address of the contact the list recipient is linked to. Interchangeable with `ContactID`.
examples:
- passenger@mailjet.com
ListID:
type: integer
description: Unique numeric ID of the contact list, for which to create the new recipient. Interchangeable with `ListAlt`.
examples:
- 123456
ListAlt:
type: string
description: A unique contact list email address generated by Mailjet, for which to create the new recipient. Interchangeable with `ListID`.
examples:
- abcdef123
required:
- ContactID
- ListID
allOf:
- $ref: '#/components/schemas/BaseListrecipient'
NewMetasender:
type: object
properties:
Email:
type: string
description: The email address for this metasender. To register a domain instead of a single email address, use an asterisk for the local part - e.g. `*@domain.com`.
examples:
- pilot@mailjet.com
required:
- Email
allOf:
- $ref: '#/components/schemas/BaseMetasender'
NewNewsletter:
type: object
properties:
ContactsListID:
type: integer
description: Unique numeric ID for the contact list linked to this newsletter. Required for successful sending of the campaign. Interchangeable with `ContactsListAlt`.
examples:
- 123456
ContactsListAlt:
type: string
description: A unique contact list email address generated by Mailjet, which is linked to this newsletter. Required for successful sending of the campaign. Interchangeable with `ContactsListID`.
examples:
- abcdef123
Locale:
type: string
description: Locale, in which the information is saved.
examples:
- en_US
SegmentationID:
type: integer
description: ID of the segment configuration (contactfilter) used for this newsletter. Interchangeable with `SegmentationAlt`.
examples:
- 123
SegmentationAlt:
type: string
description: The user-selected name of the segment configuration (contactfilter) used for this newsletter. Interchangeable with `SegmentationID`.
examples:
- Customers under 35
Sender:
type: string
description: ID of the sender email address. Required for successful sending of the newsletter.
examples:
- '1234'
SenderEmail:
type: string
description: The email address of the sender. Required for successful sending of the newsletter.
examples:
- pilot@mailjet.com
Subject:
type: string
description: Subject line for the newsletter emails.
examples:
- Your email flight plan!
required:
- Locale
- Subject
allOf:
- $ref: '#/components/schemas/BaseNewsletter'
NewParseroute:
type: object
properties:
APIKeyID:
type: integer
description: Unique numeric API Key ID to whom this object belongs.
examples:
- 123456
Email:
type: string
description: The email address you want to use. Emails sent to this address will be parsed and the information passed on to the webhook URL in JSON format. If not selected, an email address will automatically be generated by Mailjet.
examples:
- parseroute@example.com
Url:
type: string
description: "The webhook URL, where you want to receive the parsed email information.\n\n> Note: The URL provided cannot be a root URL.\n"
examples:
- https://www.example.com/123/
required:
- Url
NewSender:
type: object
properties:
Email:
type: string
description: The email address or domain for this sender.
examples:
- pilot@mailjet.com
required:
- Email
allOf:
- $ref: '#/components/schemas/BaseSender'
NewTemplate:
type: object
required:
- Name
allOf:
- $ref: '#/components/schemas/BaseTemplate'
NewMessageSendAPIv3Send:
type: object
properties:
FromEmail:
type: string
description: "Specifies the sender email address:\n\n1. When `Sender` is not specified, the email address will be used to send the message. In such cases, it must be a valid, activated sender for this account. See the `/sender` and `/metasender` resources for more info.\n\n2. When `Sender` is specified as `True`, your default sender email address will be used to send the message instead, while the `FromEmail` will be displayed in the recipient's inbox. In such cases, it is not necessary for the `FromEmail` to be validated. When the default sender and `FromEmail` domains differ, the information will be displayed in the inbox as `From {FromEmail} via / sent on behalf of {default_sender_domain}`.\n\n> Note: If the `FromEmail` domain has a DMARC policy in effect (e.g. Yahoo, AOL), the message will not be delivered. Instead, it will either bounce or be considered as Spam.\n"
examples:
- pilot@mailjet.com
FromName:
type: string
description: Sender name that will be displayed in the recipient's mailbox.
examples:
- Your Mailjet Pilot
Sender:
type: boolean
description: "When true, default sender email address will be used to send the message, while the `FromEmail` will be displayed in the recipient's inbox. In such cases, it is not necessary for the `FromEmail` to be verified. However, the information will be displayed in the inbox as `From {from_email} via / sent on behalf of {sender_domain}`.\n\nDefault value: `false`\n\n> Note: This option is disabled by default and is no longer available for new setups. Existing Default Sender configurations continue to work, but Mailjet no longer enables this functionality on new requests.\n"
examples:
- true
Recipients:
type: array
description: A JSON array containing the list of recipients. Must include at least an `Email` property in each element. Required, unless `To` is specified. Cannot be used together with `Cc` and `Bcc`.
items:
required:
- Email
properties:
Email:
type: string
format: email
description: The email address of the recipient.
readOnly: false
examples:
- passenger@mailjet.com
Name:
type: string
description: The name of the recipient. Will be displayed next to the email in the recipient's mailbox.
readOnly: false
examples:
- Passenger 1
Vars:
type: string
description: "Variables used in the message content for this recipient. Specified as a JSON array of `var_name:var_value`. Inserted in the text and/or HTML part of the message as `[[var: var_value]]`.\n"
examples:
- array
To:
type: string
description: The email address (and name, optionally) of the recipients. Interchangeable with `Recipients`. Acceptable formats are `john@example.com` or `` or `"John Doe" `. Can include multiple contacts, which should be separated by commas. Can be used together with `Cc` and `Bcc`.
examples:
- Passenger 1
Cc:
type: string
description: The email address (and name, optionally) of a recipient who is supposed to receive a carbon copy (cc) of this message. Used together with `To` and `Bcc` (optional). Acceptable formats are `john@example.com` or `` or `"John Doe" `. Can include multiple contacts, which should be separated by commas.
examples:
- Passenger 2
Bcc:
type: string
description: The email address (and name, optionally) of a recipient who is supposed to receive a blind carbon copy (bcc) of this message. Use this when you do not want your other recipients to see that you are sending a copy of the message to this email address. Used together with `To` and `Cc` (optional). Acceptable formats are `john@example.com` or `` or `"John Doe" `. Can include multiple contacts, which should be separated by commas.
examples:
- Passenger 3
Subject:
type: string
description: The email subject line.
examples:
- Your email flight plan!
Text-part:
type: string
description: Provides the Text part of the message. Mandatory, if the `Html-part` parameter is not specified.
examples:
- Dear passenger, welcome to Mailjet! May the delivery force be with you!
Html-part:
type: string
description: Provides the HTML part of the message. Mandatory, if the `Text-part` parameter is not specified.
examples:
- Dear passenger, welcome to Mailjet!
May the delivery force be with you!
Mj-TemplateID:
type: integer
description: The Template ID or Name to use as this email content. If the HTML/Text parts are specified, `Mj-TemplateID` will overwrite them. Equivalent to using the `X-MJ-TemplateID` header through SMTP.
examples:
- 123456
Mj-TemplateLanguage:
type: boolean
description: "When true, activates the template language processing. Equivalent to using the `X-MJ-TemplateLanguage` header through SMTP.\n\nDefault value: `false`\n"
examples:
- false
Mj-TemplateErrorReporting:
type: string
description: An email address, where a carbon copy with the error message is sent to in case of sending issues. Can only be used when `Mj-TemplateLanguage=true`. Equivalent to using the `X-MJ-TemplateErrorReporting` header through SMTP.
examples:
- reports@example.com
Mj-TemplateErrorDeliver:
type: string
description: "Defines if the message will be delivered if an error is discovered in the templating language. Can only be used when `Mj-TemplateLanguage=true`. Equivalent to using the `X-MJ-TemplateErrorDeliver` header through SMTP.\n\nPossible values:\n\n- `deliver`\n- `0`\n\nDefault value: `0`\n"
examples:
- '0'
Attachments:
type: array
description: A JSON object containing descriptions of the files attached to this message. Contains the Filename, Content type and Base64 encoded content of the file. The total size of the API call payload - including all attachments, inline attachments and message content - should not exceed 15 MB.
items:
required:
- Filename
- Content-type
- Content
properties:
Filename:
type: string
description: The full name of the file (including the file extension).
readOnly: false
examples:
- test.txt
Content-type:
type: string
description: Defines the type of content being sent out using a MIME type. See the [official MIME type](https://www.iana.org/assignments/media-types/media-types.xhtml) list for additional information.
readOnly: false
examples:
- text/plain
Content:
type: string
format: Base64 encoded content
description: Base64 encoded content of the attached file.
readOnly: false
examples:
- VGhpcyBpcyB5b3VyIGF0dGFjaGVkIGZpbGUhISEK
Inline_attachments:
type: array
description: A JSON object containing descriptions of the files attached to this message, that are available for inline use. Inline attachments can be visible directly in the body of the message, depending on the email client support. Insert the file into the HTML code of the email by using `cid:Filename`. The total size of the API call payload - including all attachments, inline attachments and message content - should not exceed 15 MB.
items:
required:
- Filename
- Content-type
- Content
properties:
Filename:
type: string
description: The full name of the file (including the file extension).
readOnly: false
examples:
- logo.gif
Content-type:
type: string
description: Defines the type of content being sent out using a MIME type. See the [official MIME type](https://www.iana.org/assignments/media-types/media-types.xhtml) list for additional information.
readOnly: false
examples:
- image/gif
Content:
type: string
format: Base64 encoded content
description: Base64 encoded content of the attached file.
readOnly: false
examples:
- R0lGODlhEAAQAOYAAP////748v39/Pvq1vr6+lJSVeqlK/zqyv7+/unKjJ+emv78+fb29pucnfrlwvTCi9ra2vTCa6urrWdoaurr6/Pz8uHh4vn49PO7QqGfmumaN+2uS1ZWWfr27uyuLnBxd/z8+0pLTvHAWvjar/zr2Z6cl+jal+2kKmhqcEJETvHQbPb07lBRVPv6+cjJycXFxn1+f//+/f337nF0efO/Mf306NfW0fjHSJOTk/TKlfTp0Prlx/XNj83HuPfEL+/v8PbJgueXJOzp4MG8qUNES9fQqN3d3vTJa/vq1f317P769f/8+gAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACH/C1hNUCBEYXRhWE1QPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgNS4wLWMwNjAgNjEuMTM0Nzc3LCAyMDEwLzAyLzEyLTE3OjMyOjAwICAgICAgICAiPiA8cmRmOlJERiB4bWxuczpyZGY9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkvMDIvMjItcmRmLXN5bnRheC1ucyMiPiA8cmRmOkRlc2NyaXB0aW9uIHJkZjphYm91dD0iIiB4bWxuczp4bXA9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC8iIHhtbG5zOnhtcE1NPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvbW0vIiB4bWxuczpzdFJlZj0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL3NUeXBlL1Jlc291cmNlUmVmIyIgeG1wOkNyZWF0b3JUb29sPSJBZG9iZSBQaG90b3Nob3AgQ1M1IFdpbmRvd3MiIHhtcE1NOkluc3RhbmNlSUQ9InhtcC5paWQ6MjY5ODYxMzYzMkJCMTFFMDkzQkFFMkFENzVGN0JGRkYiIHhtcE1NOkRvY3VtZW50SUQ9InhtcC5kaWQ6MjY5ODYxMzczMkJCMTFFMDkzQkFFMkFENzVGN0JGRkYiPiA8eG1wTU06RGVyaXZlZEZyb20gc3RSZWY6aW5zdGFuY2VJRD0ieG1wLmlpZDoyNjk4NjEzNDMyQkIxMUUwOTNCQUUyQUQ3NUY3QkZGRiIgc3RSZWY6ZG9jdW1lbnRJRD0ieG1wLmRpZDoyNjk4NjEzNTMyQkIxMUUwOTNCQUUyQUQ3NUY3QkZGRiIvPiA8L3JkZjpEZXNjcmlwdGlvbj4gPC9yZGY6UkRGPiA8L3g6eG1wbWV0YT4gPD94cGFja2V0IGVuZD0iciI/PgH//v38+/r5+Pf29fTz8vHw7+7t7Ovq6ejn5uXk4+Lh4N/e3dzb2tnY19bV1NPS0dDPzs3My8rJyMfGxcTDwsHAv769vLu6ubi3trW0s7KxsK+urayrqqmop6alpKOioaCfnp2cm5qZmJeWlZSTkpGQj46NjIuKiYiHhoWEg4KBgH9+fXx7enl4d3Z1dHNycXBvbm1sa2ppaGdmZWRjYmFgX15dXFtaWVhXVlVUU1JRUE9OTUxLSklIR0ZFRENCQUA/Pj08Ozo5ODc2NTQzMjEwLy4tLCsqKSgnJiUkIyIhIB8eHRwbGhkYFxYVFBMSERAPDg0MCwoJCAcGBQQDAgEAACH5BAEAAAAALAAAAAAQABAAAAdUgACCg4SFhoeIiYRGLhaKhA0TMDgSLxAUiEIZHAUsIUQpKAo9Og6FNh8zJUNFJioYQIgJRzc+NBEkiAcnBh4iO4o8QRsjj0gaOY+CDwPKzs/Q0YSBADs=
Mj-prio:
type: integer
description: "Indicates the processing priority inside your account (API Key) scheduling queue. Equivalent of using the `X-Mailjet-Prio` header through SMTP.\n\nThere are two queues - low priority (`0`, `1`) and high priority (`2`, `3`):\n\n- `0` - low priority queue, processed first in, first out\n- `1` - goes before the low priority queue, processed last in, first out\n- `2` - high priority queue, processed first in, first out\n- `3` - goes before the high priority queue, processed last in, first out\n\nSend transactional messages with `2` and marketing messages with `0`. Codes `1` and `3` are intended for narrow cases where tight control of the email flow is necessary - `3` can block messages sent with `2`, so it is not advised for large volumes. Whether high or low priority, the processing speed is the same - only the order changes.\n\n[More information](https://documentation.mailjet.com/hc/en-us/articles/360043571894-Email-Priority-Management).\n\nDefault value: `2`\n"
examples:
- 2
Mj-campaign:
type: string
description: Specifies a custom campaign name, to which all messages with this property value will be assigned. If the campaign doesn't already exist it will be automatically created in the Mailjet system. API users are allowed to send multiple emails from the same campaign name to the same contacts. To block this feature, use the `Mj-deduplicatecampaign` property. Equivalent of using `X-Mailjet-Campaign` header through SMTP.
examples:
- SendAPI_campaign
Mj-deduplicatecampaign:
type: integer
description: "Enables or disables the option to send messages from the same campaign to the same contact multiple times. Equivalent of using `X-Mailjet-DeduplicateCampaign` header through SMTP.\n\nWhen set to `1`, a contact that has already received a message carrying a particular `Mj-campaign` value will not receive another message from that same campaign. When `0`, the same contact can receive multiple messages from the same grouped campaign.\n\nPossible values:\n\n- `0`\n- `1`\n\nDefault value: `0`\n"
examples:
- 1
Mj-trackopen:
type: integer
description: "Enable or disable open tracking on this message. This property will overwrite the preferences selected in the [Mailjet account](https://app.mailjet.com/account/settings). Equivalent of using `X-Mailjet-TrackOpen` header through SMTP.\n\nAllowed Values:\n\n- `0` = use the values specified in the [Mailjet account](https://app.mailjet.com/account/settings)\n- `1` = disable tracking for this message\n- `2` = enable tracking for this message\n- `3` = anonymous tracking - opens are recorded without linking them to the individual recipient\n\nThis property is set per message object, so a single request can carry different values for different recipients. Use `Mj-campaign` to keep those messages grouped under one campaign for reporting.\n\nDefault value: `0`\n"
examples:
- 0
Mj-trackclick:
type: integer
description: "Enable or disable click tracking on this message. This property will overwrite the preferences selected in the [Mailjet account](https://app.mailjet.com/account/settings). Equivalent of using `X-Mailjet-TrackClick` header through SMTP.\n\nAllowed Values:\n\n- `0` = use the values specified in the [Mailjet account](https://app.mailjet.com/account/settings)\n- `1` = disable tracking for this message\n- `2` = enable tracking for this message\n- `3` = anonymous tracking - clicks are recorded without linking them to the individual recipient\n\nThis property is set per message object, so a single request can carry different values for different recipients. Use `Mj-campaign` to keep those messages grouped under one campaign for reporting.\n\nDefault value: `0`\n"
examples:
- 0
Mj-CustomID:
type: string
description: Select a user-defined custom ID.
examples:
- CustomValue
Mj-EventPayload:
type: string
description: Defines a payload attached to the message. The Parse API will return the values in the payload. Any standard format can be used - XML, JSON, CSV etc. Equivalent of using `X-MJ-EventPayload` header through SMTP.
examples:
- Eticket,1234,row,15,seat,B
Headers:
type: object
description: "A JSON object containing additional email headers. Specified as `{header_name}:{header_value}` pairs.\n"
examples:
- X-my-custom-header: Custom text
Vars:
type: object
description: "A JSON object containing variables used to modify the content of your email. Specified as `{var_name}:{var_value}` pairs. Enter the information in the template text / HTML part by using the `[[var:{var_name}]]` format. Equivalent of using `X-MJ-Vars` header through SMTP.\n"
examples:
- day: Monday
personalmessage: Happy birthday!
OutputSendAPIv3Send:
properties:
Email:
type: string
description: The email address for the recipient of this message.
examples:
- passenger@mailjet.com
MessageID:
type: integer
description: Unique numeric ID of this message.
examples:
- 1234567890987654321
MessageUUID:
type: string
description: A 128-bit universally unique identifier (UUID) for this message.
examples:
- 1ab23cd4-e567-8901-2345-6789f0gh1i2j
UpdateMyprofile:
type: object
allOf:
- $ref: '#/components/schemas/BaseMyprofile'
UpdateUser:
type: object
properties:
LastIp:
type: string
description: The IP address last used to access this user.
examples:
- 127.0.0.1
Username:
type: string
description: This user's username. By default the username will be a combination of the first and last name registered in the user's profile - e.g. "John Smith".
examples:
- John Doe
allOf:
- $ref: '#/components/schemas/BaseUser'
responses:
'204':
description: No content found or expected to return. Returned when a `DELETE` request was successful.
'400':
description: One or more parameters are missing or maybe misspelled (unknown resource or action).
'401':
description: You have specified an incorrect API Key / API Secret Key pair. You may be unauthorized to access the API or your API key may be inactive. Visit API keys Management section to check your keys.
'403':
description: You are not authorized to access this resource.
'404':
description: The resource with the specified ID you are trying to reach does not exist.
'429':
description: You have reached the maximum number of calls allowed per minute by our API. Please review your integration to reduce the number of calls issued by your system.
'500':
description: An unexpected error occurred on the server. Please contact our support team, providing the error identifier (`ErrorIdentifier`) and we will do our best to help.
securitySchemes:
basicAuth:
type: http
description: Endpoints requests are authenticated using HTTPS Basic Auth. See the [authentication documentation](/docs/email-api/email-api-overview/authentication)
scheme: basic
tags:
- name: Send Emails
description: Send Emails resources of the Mailjet Email API.
- name: Messages
description: Messages resources of the Mailjet Email API.
- name: Message Events
description: Message Events resources of the Mailjet Email API.
- name: Webhook
description: Webhook resources of the Mailjet Email API.
- name: Parse
description: Parse resources of the Mailjet Email API.
- name: Statistics
description: Statistics resources of the Mailjet Email API.
- name: Contacts
description: Contacts resources of the Mailjet Email API.
- name: Segmentation
description: Segmentation resources of the Mailjet Email API.
- name: Templates
description: Templates resources of the Mailjet Email API.
- name: Campaigns
description: Campaigns resources of the Mailjet Email API.
- name: Sender Addresses and Domains
description: Sender Addresses and Domains resources of the Mailjet Email API.
- name: Settings
description: Settings resources of the Mailjet Email API.
- name: Deprecated Endpoints
description: |-
Deprecated resources of the Mailjet Email API. While they may still be functional for
legacy purposes, they are no longer supported and could be removed in the future. We
strongly recommend migrating to the current recommended endpoints to ensure continued
functionality and access to the latest features.
externalDocs:
url: https://dev.mailjet.com/
description: Mailjet documentation website