{"templateId":"markdown","sharedDataIds":{"sidebar":"sidebar-docs/email-api/sidebars.yaml"},"props":{"metadata":{"markdoc":{"tagList":["admonition","tabs","tab"]},"type":"markdown"},"seo":{"title":"GDPR Delete contacts","siteUrl":"https://dev.mailjet.com/","projectTitle":"Mailjet Developer Documentation","description":"Permanently delete a Mailjet contact for GDPR compliance: retrieve the contact ID by email, then erase all personal data and tracking history via the API.","image":"https://dev.mailjet.com/og-image.png","lang":"en-US","keywords":["Mailjet API","Email API","Content API","SMTP Relay","transactional email","email delivery","Send API","email templates","developer documentation"],"meta":[{"name":"og:type","content":"website"},{"name":"og:site_name","content":"Mailjet Developer Documentation"},{"name":"twitter:card","content":"summary_large_image"},{"name":"robots","content":"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1"},{"name":"googlebot","content":"index, follow, max-snippet:-1, max-image-preview:large"}],"jsonLd":{"@context":"https://schema.org","@graph":[{"@type":"Organization","@id":"https://dev.mailjet.com/#organization","name":"Mailjet","alternateName":"Sinch Mailjet","url":"https://www.mailjet.com","logo":"https://assets.mailjet.com/lib/images/mailjetLogo/mj_logo_with_text_color.png","parentOrganization":{"@type":"Organization","name":"Sinch","url":"https://www.sinch.com"}},{"@type":"WebSite","@id":"https://dev.mailjet.com/#website","name":"Mailjet Developer Documentation","description":"Official developer documentation for the Mailjet Email API, Content API and SMTP Relay.","url":"https://dev.mailjet.com/","inLanguage":"en-US","publisher":{"@id":"https://dev.mailjet.com/#organization"},"potentialAction":{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://dev.mailjet.com/search?q={search_term_string}"},"query-input":"required name=search_term_string"}}]},"llmstxt":{"hide":false,"title":"Mailjet Developer Documentation","description":"Developer documentation for the Mailjet Email API, Content API and SMTP Relay - guides, API references and code samples for sending, templating and tracking email at scale.","details":{"content":"Mailjet (part of Sinch) provides APIs for sending and managing email.\n\nThis documentation covers four main areas:\n\n- **Email API** - the Send API (v3 and v3.1) for transactional and marketing email,\n  plus contact management, segmentation, campaigns, statistics, webhooks, the Parse API\n  and the Mailjet Templating Language.\n- **Content API** - programmatic management of email templates, template contents,\n  images, labels and authentication tokens (v1).\n- **SMTP Relay** - sending through Mailjet's SMTP servers, including custom headers.\n- **API Reference** - the complete, generated reference for every endpoint, built directly\n  from the OpenAPI specifications.\n\nBase URL for all REST APIs: `https://api.mailjet.com`.\nAuthentication uses HTTP Basic auth with an API key and secret key.\n\n## Machine-readable entry points\n\nPrefer these when you need the API surface in as few requests as possible:\n\n- `/openapi/openapi-mailjet.md` - the **complete** Email API reference (every endpoint,\n  grouped by resource) as a single Markdown document.\n- `/openapi/openapi-passport.md` - the **complete** Content API reference as a single\n  Markdown document.\n- `/_bundle/openapi/openapi-mailjet.yaml` - the raw, fully bundled OpenAPI 3 description\n  of the Email API.\n- `/_bundle/openapi/openapi-passport.yaml` - the raw, fully bundled OpenAPI 3 description\n  of the Content API.\n- `/sitemap.xml` - every indexable URL on this site.\n\nEvery page on this site is also available as clean Markdown by appending `.md` to its URL."},"sections":[{"title":"Email API","description":"Sending, contacts, campaigns, statistics, webhooks and templating.","includeFiles":["docs/email-api/**/*.md"],"excludeFiles":[]},{"title":"Content API","description":"Manage templates, template contents, images, labels and tokens.","includeFiles":["docs/content-api/**/*.md","docs/content-api.md"],"excludeFiles":[]},{"title":"SMTP Relay","description":"Send email through Mailjet's SMTP servers.","includeFiles":["docs/smtp-relay/**/*.md"],"excludeFiles":[]},{"title":"API Reference","description":"Complete generated reference for every Mailjet API endpoint.","includeFiles":["openapi/openapi-mailjet.yaml","openapi/openapi-passport.yaml","docs/api-reference/**/*.md"],"excludeFiles":[]},{"title":"Migrating from Mandrill","description":"Guides for switching from Mandrill to Mailjet.","includeFiles":["docs/mandrill/**/*.md"],"excludeFiles":[]}],"excludeFiles":[]}},"dynamicMarkdocComponents":[],"compilationErrors":[],"ast":{"$$mdtype":"Tag","name":"article","attributes":{},"children":[{"$$mdtype":"Tag","name":"Heading","attributes":{"level":1,"id":"gdpr-delete-contacts","__idx":0},"children":["GDPR Delete contacts"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Under the European Union's ",{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"https://gdpr-info.eu/"},"children":["General Data Protection Regulation (GDPR)"]},", recipients in your Mailjet contacts database have the right to request the deletion of all their personal data stored on your end. In such cases, the GDPR requires the permanent removal of their contact record from your database, including contact properties, email tracking history and other engagement data. You’ll typically need to respond to these requests within 30 days."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["With the Mailjet API you are able to comply with the GDPR policy and delete a specific contact on a specific API Key."]},{"$$mdtype":"Tag","name":"Admonition","attributes":{"type":"info","name":"Info"},"children":[{"$$mdtype":"Tag","name":"p","attributes":{},"children":["To perform a GDPR-compliant deletion, you must remove the contacts from all accounts / subaccounts you currently own."]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["You must complete the following steps to successfully delete a contact:"]},{"$$mdtype":"Tag","name":"ol","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Identify the presence of this contact in your Mailjet account."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Save the Mailjet {contact_ID} related to this recipient."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Proceed with the deletion using the {contact_ID} you retrieved."]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"retrieve-a-contact","__idx":1},"children":["Retrieve a Contact"]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"example","__idx":2},"children":["Example"]},{"$$mdtype":"Tag","name":"Tabs","attributes":{"size":"medium"},"children":[{"$$mdtype":"Tag","name":"TabItemFragment","attributes":{"label":"cURL","disable":false},"children":[{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"shell","header":{"controls":{"copy":{}}},"source":"# View : Retrieve details for a contact (including contact ID) by using the contact email.\ncurl -s \\\n\t-X GET \\\n\t--user \"$MJ_APIKEY_PUBLIC:$MJ_APIKEY_PRIVATE\" \\\n\thttps://api.mailjet.com/v3/REST/contact/$CONTACT_EMAIL\n","lang":"shell"},"children":[]}]},{"$$mdtype":"Tag","name":"TabItemFragment","attributes":{"label":"PHP","disable":false},"children":[{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"php","header":{"controls":{"copy":{}}},"source":"<?php\n/*\nView : Retrieve details for a contact (including contact ID) by using the contact email.\n*/\nrequire 'vendor/autoload.php';\nuse \\Mailjet\\Resources;\n$mj = new \\Mailjet\\Client(getenv('MJ_APIKEY_PUBLIC'), getenv('MJ_APIKEY_PRIVATE'));\n$response = $mj->get(Resources::$Contact, ['id' => $id]);\n$response->success() && var_dump($response->getData());\n?>\n","lang":"php"},"children":[]}]},{"$$mdtype":"Tag","name":"TabItemFragment","attributes":{"label":"Node.js","disable":false},"children":[{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"javascript","header":{"controls":{"copy":{}}},"source":"/**\n *\n * View : Retrieve details for a contact (including contact ID) by using the contact email.\n *\n */\nconst mailjet = require ('node-mailjet')\n\t.connect(process.env.MJ_APIKEY_PUBLIC, process.env.MJ_APIKEY_PRIVATE)\nconst request = mailjet\n\t.get(\"contact\")\n\t.id($CONTACT_EMAIL)\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})\n","lang":"javascript"},"children":[]}]},{"$$mdtype":"Tag","name":"TabItemFragment","attributes":{"label":"Ruby","disable":false},"children":[{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"ruby","header":{"controls":{"copy":{}}},"source":"# View : Retrieve details for a contact (including contact ID) by using the contact email.\nrequire 'mailjet'\nMailjet.configure do |config|\n  config.api_key = ENV['MJ_APIKEY_PUBLIC']\n  config.secret_key = ENV['MJ_APIKEY_PRIVATE']  \nend\nvariable = Mailjet::Contact.find($CONTACT_EMAIL)\np variable.attributes['Data']\n","lang":"ruby"},"children":[]}]},{"$$mdtype":"Tag","name":"TabItemFragment","attributes":{"label":"Python","disable":false},"children":[{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"python","header":{"controls":{"copy":{}}},"source":"\"\"\"\nView : Retrieve details for a contact (including contact ID) by using the contact email.\n\"\"\"\nfrom 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))\nid = '$CONTACT_EMAIL'\nresult = mailjet.contact.get(id=id)\nprint result.status_code\nprint result.json()\n","lang":"python"},"children":[]}]},{"$$mdtype":"Tag","name":"TabItemFragment","attributes":{"label":"Java","disable":false},"children":[{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"java","header":{"controls":{"copy":{}}},"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.resource.Contact;\nimport org.json.JSONArray;\nimport org.json.JSONObject;\npublic class MyClass {\n    /**\n     * View : Retrieve details for a contact (including contact ID) by using the contact email.\n     */\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\"));\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}\n","lang":"java"},"children":[]}]},{"$$mdtype":"Tag","name":"TabItemFragment","attributes":{"label":"Go","disable":false},"children":[{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"go","header":{"controls":{"copy":{}}},"source":"/*\nView : Retrieve details for a contact (including contact ID) by using the contact email.\n*/\npackage 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}\n","lang":"go"},"children":[]}]},{"$$mdtype":"Tag","name":"TabItemFragment","attributes":{"label":"C#","disable":false},"children":[{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"csharp","header":{"controls":{"copy":{}}},"source":"using Mailjet.Client;\nusing Mailjet.Client.Resources;\nusing System;\nusing Newtonsoft.Json.Linq;\nnamespace Mailjet.ConsoleApplication\n{\n   class Program\n   {\n      /// <summary>\n      /// View : Retrieve details for a contact (including contact ID) by using the contact email.\n      /// </summary>\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         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}\n","lang":"csharp"},"children":[]}]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"api-response","__idx":3},"children":["API Response"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"header":{"controls":{"copy":{}}},"source":"{\n\t\"Count\": 1,\n\t\"Data\": [\n\t\t{\n\t\t\t\"CreatedAt\": \"2018-01-01T00:01:02Z\",\n\t\t\t\"DeliveredCount\": \"3\",\n\t\t\t\"Email\": \"Mister@mailjet.com\",\n\t\t\t\"ExclusionFromCampaignsUpdatedAt\": \"\",\n\t\t\t\"ID\": \"12345678\",\n\t\t\t\"IsExcludedFromCampaigns\": \"false\",\n\t\t\t\"IsOptInPending\": \"false\",\n\t\t\t\"IsSpamComplaining\": \"false\",\n\t\t\t\"LastActivityAt\": \"2018-01-01T01:02:03Z\",\n\t\t\t\"LastUpdateAt\": \"\",\n\t\t\t\"Name\": \"MisterMailjet\",\n\t\t\t\"UnsubscribedAt\": \"\",\n\t\t\t\"UnsubscribedBy\": \"\"\n\t\t}\n\t],\n\t\"Total\": 1\n}\n"},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["To delete a contact, you must first identify its presence in the contact database of your account."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Use ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["GET /contact/$CONTACT_EMAIL"]}," to do that."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Save the contact ID - you need it to complete the deletion process."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"delete-the-contact","__idx":4},"children":["Delete the Contact"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Use the ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["{contact_ID}"]}," you retrieved to ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["DELETE"]}," the contact with the ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["/v4/contacts/{contact_ID}"]}," endpoint. When the deletion is successful, the API will return a ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["200 OK"]}," status. Any other response will indicate that the deletion was not successfully processed."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"b","attributes":{},"children":["Available only with CURL:"]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"example-1","__idx":5},"children":["Example"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"header":{"controls":{"copy":{}}},"source":"curl -s \\\n-X DELETE \\\n--user \"$MJ_APIKEY_PUBLIC:$MJ_APIKEY_PRIVATE\" \\\nhttps://api.mailjet.com/v4/contacts/{contact_ID} \\\n"},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"api-response-1","__idx":6},"children":["API Response"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"header":{"controls":{"copy":{}}},"source":"{\n  \"Count\": 1,\n  \"Data\": [\n    {\n      \"CreatedAt\": \"2017-09-26T14:12:32Z\",\n      \"DeliveredCount\": 0,\n      \"Email\": \"\\\\xae872d762f67cc4fc5d4bfe04e607256579928ac@domain.invalid\",\n      \"ExclusionFromCampaignsUpdatedAt\": \"\",\n      \"ID\": 21339837,\n      \"IsExcludedFromCampaigns\": false,\n      \"IsOptInPending\": false,\n      \"IsSpamComplaining\": false,\n      \"LastActivityAt\": \"2017-09-26T14:12:32Z\",\n      \"LastUpdateAt\": \"2018-07-12T09:04:23Z\",\n      \"Name\": \"Anonymized\",\n      \"UnsubscribedAt\": \"\",\n      \"UnsubscribedBy\": \"\"\n    }\n  ],\n  \"Total\": 1\n}\n"},"children":[]},{"$$mdtype":"Tag","name":"Admonition","attributes":{"type":"info","name":"Info"},"children":[{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Contact details are immediately anonymized and all records will be deleted after 30 days. This process cannot be reversed. The anonymized contact will retain its contact ID and general configuration settings until it is removed when the 30-day period ends."]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["The deletion of a contact does not prevent you from re-uploading the same contact in the future. If you are using an external database to sync contacts with your Mailjet contact database, please make sure to simultaneously remove the contacts from it as well."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["This way you will be completely GDPR-compliant and will ensure that the contacts won’t be added by mistake later on."]}]},"headings":[{"value":"GDPR Delete contacts","id":"gdpr-delete-contacts","depth":1},{"value":"Retrieve a Contact","id":"retrieve-a-contact","depth":2},{"value":"Example","id":"example","depth":3},{"value":"API Response","id":"api-response","depth":3},{"value":"Delete the Contact","id":"delete-the-contact","depth":2},{"value":"Example","id":"example-1","depth":3},{"value":"API Response","id":"api-response-1","depth":3}],"frontmatter":{"title":"Mailjet Send Contact Management","seo":{"description":"Permanently delete a Mailjet contact for GDPR compliance: retrieve the contact ID by email, then erase all personal data and tracking history via the API.","title":"GDPR Delete contacts"}},"lastModified":"2026-08-26T10:53:57.000Z","pagePropGetterError":{"message":"","name":""}},"slug":"/docs/email-api/contact-management/gdpr-delete-contacts","userData":{"isAuthenticated":false,"teams":["anonymous"]},"isPublic":true}