diff --git a/.claude/skills/gitbook-assistant/.SKILL.md b/.claude/skills/gitbook-assistant/.SKILL.md
index b71374f..d904fe5 100644
--- a/.claude/skills/gitbook-assistant/.SKILL.md
+++ b/.claude/skills/gitbook-assistant/.SKILL.md
@@ -244,8 +244,7 @@ Only load the full reference when user asks specific questions about advanced fe
# OpenAPI specs
- Use SDKs for language-specific client libraries examples
-- Prioritize such languages in this order: PHP, Node.js, Python, Ruby, .NET, Java, cURL, HTTP
-- Gitbook generated cURL and HTTP examples automatically from the specs, don't hardcode those code examples into x-code-samples.
+- Prioritize such languages in this order: cURL, Node.js, PHP, Python, Ruby, .NET, Java
- If some API method isn't covered with Node.JS SDK and Python SDK - let Gitbook generate those examples
- Use code samples based on Mailtrap SDK examples
- Use Context7 MCP to query info about SDK capabilities
@@ -254,4 +253,4 @@ Only load the full reference when user asks specific questions about advanced fe
- Add reference to features in the OpenAPI spec and build relative links to them to the relevant sections of the documentation
- Build OpenAPI specs file(s) in /openapi/ directory
- They or one for all will be imported into the Gitbook documentation
-- If SDK doesn't support some method - mention it in code sample
\ No newline at end of file
+- If SDK doesn't support some method - mention it in code sample
diff --git a/CLAUDE.md b/CLAUDE.md
index 1608d71..ac586e2 100644
--- a/CLAUDE.md
+++ b/CLAUDE.md
@@ -138,13 +138,13 @@ description: |
### SDK Priority Order
Include code samples in this order:
-1. Node.js (JavaScript)
-2. PHP
-3. Python
-4. Ruby
-5. .NET (C#)
-6. Java
-7. cURL (shell)
+1. cURL (shell)
+2. Node.js (JavaScript)
+3. PHP
+4. Python
+5. Ruby
+6. .NET (C#)
+7. Java
### Code Sample Format
@@ -171,7 +171,6 @@ x-codeSamples:
### Code Sample Guidelines
- **Use official Mailtrap SDKs** for language-specific examples
-- **GitBook auto-generates cURL and HTTP** examples - don't hardcode these unless necessary
- **If SDK doesn't support a method**, either let GitBook generate the example or add a comment noting SDK limitations
- **Use environment variables** for API keys (e.g., `process.env.MAILTRAP_API_KEY`)
- **Use Context7 MCP** to query SDK capabilities when unsure
diff --git a/specs/contacts.openapi.yml b/specs/contacts.openapi.yml
index 50ee026..16de56b 100644
--- a/specs/contacts.openapi.yml
+++ b/specs/contacts.openapi.yml
@@ -101,6 +101,17 @@ paths:
tags:
- Contacts
x-codeSamples:
+ - lang: shell
+ label: 'cURL'
+ source: |
+ curl -X POST https://mailtrap.io/api/accounts/{account_id}/contacts \
+ -H 'Authorization: Bearer YOUR_API_TOKEN' \
+ -H 'Content-Type: application/json' \
+ -d '{
+ "email": "john.smith@example.com",
+ "fields": {"first_name": "John", "last_name": "Smith", "company": "Example Inc"},
+ "list_ids": [1, 2, 3]
+ }'
- lang: javascript
label: Node.js
source: |
@@ -302,6 +313,11 @@ paths:
tags:
- Contacts
x-codeSamples:
+ - lang: shell
+ label: 'cURL'
+ source: |
+ curl -X GET https://mailtrap.io/api/accounts/{account_id}/contacts/{contact_identifier} \
+ -H 'Authorization: Bearer YOUR_API_TOKEN'
- lang: javascript
label: Node.js
source: |
@@ -450,6 +466,13 @@ paths:
description: Update contact using UUID or email (URL encoded)
operationId: updateContact
x-codeSamples:
+ - lang: shell
+ label: 'cURL'
+ source: |
+ curl -X PATCH https://mailtrap.io/api/accounts/{account_id}/contacts/{contact_identifier} \
+ -H 'Authorization: Bearer YOUR_API_TOKEN' \
+ -H 'Content-Type: application/json' \
+ -d '{"email": "new@example.com", "fields": {"first_name": "John"}}'
- lang: javascript
label: Node.js
source: |
@@ -583,6 +606,11 @@ paths:
description: Delete contact using UUID or email (URL encoded)
operationId: deleteContact
x-codeSamples:
+ - lang: shell
+ label: 'cURL'
+ source: |
+ curl -X DELETE https://mailtrap.io/api/accounts/{account_id}/contacts/{contact_identifier} \
+ -H 'Authorization: Bearer YOUR_API_TOKEN'
- lang: javascript
label: Node.js
source: |
@@ -665,6 +693,13 @@ paths:
tags:
- Contact Events
x-codeSamples:
+ - lang: shell
+ label: 'cURL'
+ source: |
+ curl -X POST https://mailtrap.io/api/accounts/{account_id}/contacts/{contact_identifier}/events \
+ -H 'Authorization: Bearer YOUR_API_TOKEN' \
+ -H 'Content-Type: application/json' \
+ -d '{"name": "UserLogin", "params": {"user_id": 101, "is_active": true}}'
- lang: javascript
label: Node.js
source: |
@@ -784,6 +819,13 @@ paths:
tags:
- Contact Exports
x-codeSamples:
+ - lang: shell
+ label: 'cURL'
+ source: |
+ curl -X POST https://mailtrap.io/api/accounts/{account_id}/contacts/exports \
+ -H 'Authorization: Bearer YOUR_API_TOKEN' \
+ -H 'Content-Type: application/json' \
+ -d '{"filters": [{"name": "list_id", "operator": "equal", "value": [1, 2]}]}'
- lang: javascript
label: Node.js
source: |
@@ -897,6 +939,11 @@ paths:
tags:
- Contact Exports
x-codeSamples:
+ - lang: shell
+ label: 'cURL'
+ source: |
+ curl -X GET https://mailtrap.io/api/accounts/{account_id}/contacts/exports/{export_id} \
+ -H 'Authorization: Bearer YOUR_API_TOKEN'
- lang: javascript
label: Node.js
source: |
@@ -990,6 +1037,13 @@ paths:
tags:
- Contact Imports
x-codeSamples:
+ - lang: shell
+ label: 'cURL'
+ source: |
+ curl -X POST https://mailtrap.io/api/accounts/{account_id}/contacts/imports \
+ -H 'Authorization: Bearer YOUR_API_TOKEN' \
+ -H 'Content-Type: application/json' \
+ -d '{"contacts": [{"email": "user1@example.com", "fields": {"first_name": "John"}, "list_ids_included": [1, 2]}]}'
- lang: javascript
label: Node.js
source: |
@@ -1128,6 +1182,11 @@ paths:
tags:
- Contact Imports
x-codeSamples:
+ - lang: shell
+ label: 'cURL'
+ source: |
+ curl -X GET https://mailtrap.io/api/accounts/{account_id}/contacts/imports/{import_id} \
+ -H 'Authorization: Bearer YOUR_API_TOKEN'
- lang: javascript
label: Node.js
source: |
@@ -1222,6 +1281,11 @@ paths:
tags:
- Contact Lists
x-codeSamples:
+ - lang: shell
+ label: 'cURL'
+ source: |
+ curl -X GET https://mailtrap.io/api/accounts/{account_id}/contacts/lists \
+ -H 'Authorization: Bearer YOUR_API_TOKEN'
- lang: javascript
label: Node.js
source: |
@@ -1308,6 +1372,13 @@ paths:
tags:
- Contact Lists
x-codeSamples:
+ - lang: shell
+ label: 'cURL'
+ source: |
+ curl -X POST https://mailtrap.io/api/accounts/{account_id}/contacts/lists \
+ -H 'Authorization: Bearer YOUR_API_TOKEN' \
+ -H 'Content-Type: application/json' \
+ -d '{"name": "Customers"}'
- lang: javascript
label: Node.js
source: |
@@ -1403,6 +1474,11 @@ paths:
tags:
- Contact Lists
x-codeSamples:
+ - lang: shell
+ label: 'cURL'
+ source: |
+ curl -X GET https://mailtrap.io/api/accounts/{account_id}/contacts/lists/{list_id} \
+ -H 'Authorization: Bearer YOUR_API_TOKEN'
- lang: javascript
label: Node.js
source: |
@@ -1482,6 +1558,13 @@ paths:
tags:
- Contact Lists
x-codeSamples:
+ - lang: shell
+ label: 'cURL'
+ source: |
+ curl -X PATCH https://mailtrap.io/api/accounts/{account_id}/contacts/lists/{list_id} \
+ -H 'Authorization: Bearer YOUR_API_TOKEN' \
+ -H 'Content-Type: application/json' \
+ -d '{"name": "Former Customers"}'
- lang: javascript
label: Node.js
source: |
@@ -1579,6 +1662,11 @@ paths:
tags:
- Contact Lists
x-codeSamples:
+ - lang: shell
+ label: 'cURL'
+ source: |
+ curl -X DELETE https://mailtrap.io/api/accounts/{account_id}/contacts/lists/{list_id} \
+ -H 'Authorization: Bearer YOUR_API_TOKEN'
- lang: javascript
label: Node.js
source: |
@@ -1657,6 +1745,11 @@ paths:
tags:
- Contact Fields
x-codeSamples:
+ - lang: shell
+ label: 'cURL'
+ source: |
+ curl -X GET https://mailtrap.io/api/accounts/{account_id}/contacts/fields \
+ -H 'Authorization: Bearer YOUR_API_TOKEN'
- lang: javascript
label: Node.js
source: |
@@ -1748,6 +1841,13 @@ paths:
tags:
- Contact Fields
x-codeSamples:
+ - lang: shell
+ label: 'cURL'
+ source: |
+ curl -X POST https://mailtrap.io/api/accounts/{account_id}/contacts/fields \
+ -H 'Authorization: Bearer YOUR_API_TOKEN' \
+ -H 'Content-Type: application/json' \
+ -d '{"name": "Company", "data_type": "text", "merge_tag": "company"}'
- lang: javascript
label: Node.js
source: |
@@ -1877,6 +1977,11 @@ paths:
tags:
- Contact Fields
x-codeSamples:
+ - lang: shell
+ label: 'cURL'
+ source: |
+ curl -X GET https://mailtrap.io/api/accounts/{account_id}/contacts/fields/{field_id} \
+ -H 'Authorization: Bearer YOUR_API_TOKEN'
- lang: javascript
label: Node.js
source: |
@@ -1960,6 +2065,13 @@ paths:
tags:
- Contact Fields
x-codeSamples:
+ - lang: shell
+ label: 'cURL'
+ source: |
+ curl -X PATCH https://mailtrap.io/api/accounts/{account_id}/contacts/fields/{field_id} \
+ -H 'Authorization: Bearer YOUR_API_TOKEN' \
+ -H 'Content-Type: application/json' \
+ -d '{"name": "Updated Name", "merge_tag": "updated_name"}'
- lang: javascript
label: Node.js
source: |
@@ -2079,6 +2191,11 @@ paths:
tags:
- Contact Fields
x-codeSamples:
+ - lang: shell
+ label: 'cURL'
+ source: |
+ curl -X DELETE https://mailtrap.io/api/accounts/{account_id}/contacts/fields/{field_id} \
+ -H 'Authorization: Bearer YOUR_API_TOKEN'
- lang: javascript
label: Node.js
source: |
diff --git a/specs/email-api.openapi.yml b/specs/email-api.openapi.yml
index 1102853..e20fd35 100644
--- a/specs/email-api.openapi.yml
+++ b/specs/email-api.openapi.yml
@@ -62,6 +62,17 @@ paths:
tags:
- domains
x-codeSamples:
+ - lang: shell
+ label: 'cURL'
+ source: |
+ curl -X POST https://mailtrap.io/api/accounts/{account_id}/sending_domains \
+ -H 'Authorization: Bearer YOUR_API_KEY' \
+ -H 'Content-Type: application/json' \
+ -d '{
+ "sending_domain": {
+ "domain_name": "example.com"
+ }
+ }'
- lang: javascript
label: Node.js
source: |
@@ -149,17 +160,6 @@ paths:
.create(YOUR_ACCOUNT_ID, request);
System.out.println(domain);
- - lang: shell
- label: 'cURL'
- source: |
- curl -X POST https://mailtrap.io/api/accounts/{account_id}/sending_domains \
- -H 'Authorization: Bearer YOUR_API_KEY' \
- -H 'Content-Type: application/json' \
- -d '{
- "sending_domain": {
- "domain_name": "example.com"
- }
- }'
parameters:
- $ref: '#/components/parameters/account_id'
requestBody:
@@ -201,6 +201,11 @@ paths:
tags:
- domains
x-codeSamples:
+ - lang: shell
+ label: 'cURL'
+ source: |
+ curl -X GET https://mailtrap.io/api/accounts/{account_id}/sending_domains \
+ -H 'Authorization: Bearer YOUR_API_KEY'
- lang: javascript
label: Node.js
source: |
@@ -284,11 +289,6 @@ paths:
domains.forEach(domain ->
System.out.println("Domain: " + domain.getDomainName())
);
- - lang: shell
- label: 'cURL'
- source: |
- curl -X GET https://mailtrap.io/api/accounts/{account_id}/sending_domains \
- -H 'Authorization: Bearer YOUR_API_KEY'
parameters:
- $ref: '#/components/parameters/account_id'
responses:
@@ -307,6 +307,11 @@ paths:
tags:
- domains
x-codeSamples:
+ - lang: shell
+ label: 'cURL'
+ source: |
+ curl -X GET https://mailtrap.io/api/accounts/{account_id}/sending_domains/{sending_domain_id} \
+ -H 'Authorization: Bearer YOUR_API_KEY'
- lang: javascript
label: Node.js
source: |
@@ -388,11 +393,6 @@ paths:
.getSendingDomain(YOUR_ACCOUNT_ID, domainId);
System.out.println("Domain: " + domain.getDomainName());
- - lang: shell
- label: 'cURL'
- source: |
- curl -X GET https://mailtrap.io/api/accounts/{account_id}/sending_domains/{sending_domain_id} \
- -H 'Authorization: Bearer YOUR_API_KEY'
parameters:
- $ref: '#/components/parameters/account_id'
- $ref: '#/components/parameters/sending_domain_id'
@@ -413,6 +413,11 @@ paths:
tags:
- domains
x-codeSamples:
+ - lang: shell
+ label: 'cURL'
+ source: |
+ curl -X DELETE https://mailtrap.io/api/accounts/{account_id}/sending_domains/{sending_domain_id} \
+ -H 'Authorization: Bearer YOUR_API_KEY'
- lang: javascript
label: Node.js
source: |
@@ -492,11 +497,6 @@ paths:
.deleteSendingDomain(YOUR_ACCOUNT_ID, domainId);
System.out.println("Domain deleted successfully");
- - lang: shell
- label: 'cURL'
- source: |
- curl -X DELETE https://mailtrap.io/api/accounts/{account_id}/sending_domains/{sending_domain_id} \
- -H 'Authorization: Bearer YOUR_API_KEY'
parameters:
- $ref: '#/components/parameters/account_id'
- $ref: '#/components/parameters/sending_domain_id'
@@ -518,6 +518,15 @@ paths:
tags:
- domains
x-codeSamples:
+ - lang: shell
+ label: 'cURL'
+ source: |
+ curl -X POST https://mailtrap.io/api/accounts/{account_id}/sending_domains/{sending_domain_id}/send_setup_instructions \
+ -H 'Authorization: Bearer YOUR_API_KEY' \
+ -H 'Content-Type: application/json' \
+ -d '{
+ "email": "devops@example.com"
+ }'
- lang: javascript
label: Node.js
source: |
@@ -620,15 +629,6 @@ paths:
);
System.out.println("Setup instructions sent");
- - lang: shell
- label: 'cURL'
- source: |
- curl -X POST https://mailtrap.io/api/accounts/{account_id}/sending_domains/{sending_domain_id}/send_setup_instructions \
- -H 'Authorization: Bearer YOUR_API_KEY' \
- -H 'Content-Type: application/json' \
- -d '{
- "email": "devops@example.com"
- }'
parameters:
- $ref: '#/components/parameters/account_id'
- $ref: '#/components/parameters/sending_domain_id'
@@ -670,6 +670,16 @@ paths:
tags:
- suppressions
x-codeSamples:
+ - lang: shell
+ label: 'cURL'
+ source: |
+ # Get all suppressions
+ curl -X GET https://mailtrap.io/api/accounts/{account_id}/suppressions \
+ -H 'Authorization: Bearer YOUR_API_KEY'
+
+ # Search for specific email
+ curl -X GET 'https://mailtrap.io/api/accounts/{account_id}/suppressions?email=suppressed@example.com' \
+ -H 'Authorization: Bearer YOUR_API_KEY'
- lang: javascript
label: Node.js
source: |
@@ -805,16 +815,6 @@ paths:
filtered.forEach(filteredSuppression ->
System.out.println("Email: " + filteredSuppression.getEmail())
);
- - lang: shell
- label: 'cURL'
- source: |
- # Get all suppressions
- curl -X GET https://mailtrap.io/api/accounts/{account_id}/suppressions \
- -H 'Authorization: Bearer YOUR_API_KEY'
-
- # Search for specific email
- curl -X GET 'https://mailtrap.io/api/accounts/{account_id}/suppressions?email=suppressed@example.com' \
- -H 'Authorization: Bearer YOUR_API_KEY'
parameters:
- $ref: '#/components/parameters/account_id'
- name: email
@@ -858,6 +858,11 @@ paths:
tags:
- suppressions
x-codeSamples:
+ - lang: shell
+ label: 'cURL'
+ source: |
+ curl -X DELETE https://mailtrap.io/api/accounts/{account_id}/suppressions/{suppression_id} \
+ -H 'Authorization: Bearer YOUR_API_KEY'
- lang: javascript
label: Node.js
source: |
@@ -953,11 +958,6 @@ paths:
.deleteSuppression(YOUR_ACCOUNT_ID, suppressionId);
System.out.println("Suppression removed: " + result.getEmail());
- - lang: shell
- label: 'cURL'
- source: |
- curl -X DELETE https://mailtrap.io/api/accounts/{account_id}/suppressions/{suppression_id} \
- -H 'Authorization: Bearer YOUR_API_KEY'
parameters:
- $ref: '#/components/parameters/account_id'
- $ref: '#/components/parameters/suppression_id'
@@ -979,6 +979,11 @@ paths:
tags:
- templates
x-codeSamples:
+ - lang: shell
+ label: 'cURL'
+ source: |
+ curl -X GET "https://mailtrap.io/api/accounts/{account_id}/email_templates" \
+ -H "Api-Token: YOUR_API_KEY"
- lang: javascript
label: Node.js
source: |
@@ -1045,11 +1050,6 @@ paths:
var client = MailtrapClientFactory.createMailtrapClient(config);
var response = client.emailTemplatesApi().emailTemplates().getAllTemplates(accountId);
- - lang: shell
- label: cURL
- source: |
- curl -X GET "https://mailtrap.io/api/accounts/{account_id}/email_templates" \
- -H "Api-Token: YOUR_API_KEY"
responses:
'200':
description: OK.
@@ -1070,6 +1070,21 @@ paths:
tags:
- templates
x-codeSamples:
+ - lang: shell
+ label: 'cURL'
+ source: |
+ curl -X POST "https://mailtrap.io/api/accounts/{account_id}/email_templates" \
+ -H "Api-Token: YOUR_API_KEY" \
+ -H "Content-Type: application/json" \
+ -d '{
+ "email_template": {
+ "name": "Welcome Email",
+ "subject": "Welcome to {{company_name}}!",
+ "category": "onboarding",
+ "body_html": "
Welcome {{user_name}}!
",
+ "body_text": "Welcome {{user_name}}!"
+ }
+ }'
- lang: javascript
label: Node.js
source: |
@@ -1173,21 +1188,6 @@ paths:
"Welcome {{user_name}}!", "Welcome {{user_name}}!
")
);
var template = client.emailTemplatesApi().emailTemplates().createEmailTemplate(accountId, request);
- - lang: shell
- label: cURL
- source: |
- curl -X POST "https://mailtrap.io/api/accounts/{account_id}/email_templates" \
- -H "Api-Token: YOUR_API_KEY" \
- -H "Content-Type: application/json" \
- -d '{
- "email_template": {
- "name": "Welcome Email",
- "subject": "Welcome to {{company_name}}!",
- "category": "onboarding",
- "body_html": "Welcome {{user_name}}!
",
- "body_text": "Welcome {{user_name}}!"
- }
- }'
requestBody:
content:
application/json:
@@ -1217,6 +1217,11 @@ paths:
tags:
- templates
x-codeSamples:
+ - lang: shell
+ label: 'cURL'
+ source: |
+ curl -X GET "https://mailtrap.io/api/accounts/{account_id}/email_templates/{email_template_id}" \
+ -H "Api-Token: YOUR_API_KEY"
- lang: javascript
label: Node.js
source: |
@@ -1231,17 +1236,6 @@ paths:
}
getTemplate();
- - lang: ruby
- label: Ruby
- source: |
- require 'mailtrap'
-
- client = Mailtrap::Client.new(api_key: 'YOUR_API_KEY')
- templates = Mailtrap::EmailTemplatesAPI.new(
- YOUR_ACCOUNT_ID,
- client
- )
- template = templates.get(template_id)
- lang: php
label: PHP
source: |
@@ -1269,11 +1263,17 @@ paths:
template_id = 12345
template = client.email_templates_api.templates.get_by_id(template_id)
print(f"Template: {template.name} (ID: {template.id})")
- - lang: shell
- label: cURL
+ - lang: ruby
+ label: Ruby
source: |
- curl -X GET "https://mailtrap.io/api/accounts/{account_id}/email_templates/{email_template_id}" \
- -H "Api-Token: YOUR_API_KEY"
+ require 'mailtrap'
+
+ client = Mailtrap::Client.new(api_key: 'YOUR_API_KEY')
+ templates = Mailtrap::EmailTemplatesAPI.new(
+ YOUR_ACCOUNT_ID,
+ client
+ )
+ template = templates.get(template_id)
responses:
'200':
description: Returns attributes of the email template.
@@ -1294,6 +1294,18 @@ paths:
tags:
- templates
x-codeSamples:
+ - lang: shell
+ label: 'cURL'
+ source: |
+ curl -X PATCH "https://mailtrap.io/api/accounts/{account_id}/email_templates/{email_template_id}" \
+ -H "Api-Token: YOUR_API_KEY" \
+ -H "Content-Type: application/json" \
+ -d '{
+ "email_template": {
+ "name": "Updated Template",
+ "subject": "New Subject"
+ }
+ }'
- lang: javascript
label: Node.js
source: |
@@ -1308,17 +1320,6 @@ paths:
}
updateTemplate();
- - lang: ruby
- label: Ruby
- source: |
- require 'mailtrap'
-
- client = Mailtrap::Client.new(api_key: 'YOUR_API_KEY')
- templates = Mailtrap::EmailTemplatesAPI.new(
- YOUR_ACCOUNT_ID,
- client
- )
- templates.update(EMAIL_TEMPLATE_ID, name: 'Welcome Updated')
- lang: php
label: PHP
source: |
@@ -1364,18 +1365,17 @@ paths:
body_text="Edited Welcome {{user_name}}!"
)
)
- - lang: shell
- label: cURL
+ - lang: ruby
+ label: Ruby
source: |
- curl -X PATCH "https://mailtrap.io/api/accounts/{account_id}/email_templates/{email_template_id}" \
- -H "Api-Token: YOUR_API_KEY" \
- -H "Content-Type: application/json" \
- -d '{
- "email_template": {
- "name": "Updated Template",
- "subject": "New Subject"
- }
- }'
+ require 'mailtrap'
+
+ client = Mailtrap::Client.new(api_key: 'YOUR_API_KEY')
+ templates = Mailtrap::EmailTemplatesAPI.new(
+ YOUR_ACCOUNT_ID,
+ client
+ )
+ templates.update(EMAIL_TEMPLATE_ID, name: 'Welcome Updated')
requestBody:
content:
application/json:
@@ -1403,6 +1403,11 @@ paths:
tags:
- templates
x-codeSamples:
+ - lang: shell
+ label: 'cURL'
+ source: |
+ curl -X DELETE "https://mailtrap.io/api/accounts/{account_id}/email_templates/{email_template_id}" \
+ -H "Api-Token: YOUR_API_KEY"
- lang: javascript
label: Node.js
source: |
@@ -1417,17 +1422,6 @@ paths:
}
deleteTemplate();
- - lang: ruby
- label: Ruby
- source: |
- require 'mailtrap'
-
- client = Mailtrap::Client.new(api_key: 'YOUR_API_KEY')
- templates = Mailtrap::EmailTemplatesAPI.new(
- YOUR_ACCOUNT_ID,
- client
- )
- templates.delete(EMAIL_TEMPLATE_ID)
- lang: php
label: PHP
source: |
@@ -1455,11 +1449,17 @@ paths:
deleted_template = client.email_templates_api.templates.delete(
template_id=email_template_id
)
- - lang: shell
- label: cURL
+ - lang: ruby
+ label: Ruby
source: |
- curl -X DELETE "https://mailtrap.io/api/accounts/{account_id}/email_templates/{email_template_id}" \
- -H "Api-Token: YOUR_API_KEY"
+ require 'mailtrap'
+
+ client = Mailtrap::Client.new(api_key: 'YOUR_API_KEY')
+ templates = Mailtrap::EmailTemplatesAPI.new(
+ YOUR_ACCOUNT_ID,
+ client
+ )
+ templates.delete(EMAIL_TEMPLATE_ID)
responses:
'204':
description: No Content
@@ -1480,6 +1480,12 @@ paths:
description: Get account sending stats. Use filters to get specific stats.
tags:
- stats
+ x-codeSamples:
+ - lang: shell
+ label: 'cURL'
+ source: |
+ curl -X GET 'https://mailtrap.io/api/accounts/{account_id}/stats?start_date=2025-01-01&end_date=2025-12-31' \
+ -H 'Authorization: Bearer YOUR_API_KEY'
parameters:
- $ref: '#/components/parameters/account_id'
- $ref: '#/components/parameters/StartDateQueryFilter'
@@ -1510,6 +1516,12 @@ paths:
description: Get account sending stats by domains. Use filters to get specific stats.
tags:
- stats
+ x-codeSamples:
+ - lang: shell
+ label: 'cURL'
+ source: |
+ curl -X GET 'https://mailtrap.io/api/accounts/{account_id}/stats/domains?start_date=2025-01-01&end_date=2025-12-31' \
+ -H 'Authorization: Bearer YOUR_API_KEY'
parameters:
- $ref: '#/components/parameters/account_id'
- $ref: '#/components/parameters/StartDateQueryFilter'
@@ -1551,6 +1563,12 @@ paths:
description: Get account sending stats by categories. Use filters to get specific stats.
tags:
- stats
+ x-codeSamples:
+ - lang: shell
+ label: 'cURL'
+ source: |
+ curl -X GET 'https://mailtrap.io/api/accounts/{account_id}/stats/categories?start_date=2025-01-01&end_date=2025-12-31' \
+ -H 'Authorization: Bearer YOUR_API_KEY'
parameters:
- $ref: '#/components/parameters/account_id'
- $ref: '#/components/parameters/StartDateQueryFilter'
@@ -1591,6 +1609,12 @@ paths:
description: Get account sending stats by email service providers. Use filters to get specific stats.
tags:
- stats
+ x-codeSamples:
+ - lang: shell
+ label: 'cURL'
+ source: |
+ curl -X GET 'https://mailtrap.io/api/accounts/{account_id}/stats/email_service_providers?start_date=2025-01-01&end_date=2025-12-31' \
+ -H 'Authorization: Bearer YOUR_API_KEY'
parameters:
- $ref: '#/components/parameters/account_id'
- $ref: '#/components/parameters/StartDateQueryFilter'
@@ -1631,6 +1655,12 @@ paths:
description: Get account sending stats by date. Use filters to get specific stats.
tags:
- stats
+ x-codeSamples:
+ - lang: shell
+ label: 'cURL'
+ source: |
+ curl -X GET 'https://mailtrap.io/api/accounts/{account_id}/stats/date?start_date=2025-01-01&end_date=2025-12-31' \
+ -H 'Authorization: Bearer YOUR_API_KEY'
parameters:
- $ref: '#/components/parameters/account_id'
- $ref: '#/components/parameters/StartDateQueryFilter'
diff --git a/specs/email-sending-bulk.openapi.yml b/specs/email-sending-bulk.openapi.yml
index a2fb795..cd3aad0 100644
--- a/specs/email-sending-bulk.openapi.yml
+++ b/specs/email-sending-bulk.openapi.yml
@@ -50,6 +50,19 @@ paths:
tags:
- send-email
x-codeSamples:
+ - lang: shell
+ label: 'cURL'
+ source: |
+ curl -X POST https://bulk.api.mailtrap.io/api/send \
+ -H 'Authorization: Bearer YOUR_API_KEY' \
+ -H 'Content-Type: application/json' \
+ -d '{
+ "from": {"email": "marketing@example.com"},
+ "to": [{"email": "subscriber@example.com"}],
+ "subject": "Monthly Newsletter",
+ "html": "Our Latest Updates
",
+ "category": "newsletter"
+ }'
- lang: javascript
label: Node.js
source: |
@@ -198,19 +211,6 @@ paths:
.build();
client.bulkSendingApi().emails().send(mail);
- - lang: shell
- label: 'cURL'
- source: |
- curl -X POST https://bulk.api.mailtrap.io/api/send \
- -H 'Authorization: Bearer YOUR_API_KEY' \
- -H 'Content-Type: application/json' \
- -d '{
- "from": {"email": "marketing@example.com"},
- "to": [{"email": "subscriber@example.com"}],
- "subject": "Monthly Newsletter",
- "html": "Our Latest Updates
",
- "category": "newsletter"
- }'
requestBody:
required: true
content:
@@ -251,6 +251,23 @@ paths:
tags:
- send-email
x-codeSamples:
+ - lang: shell
+ label: 'cURL'
+ source: |
+ curl -X POST https://bulk.api.mailtrap.io/api/batch \
+ -H 'Authorization: Bearer YOUR_API_KEY' \
+ -H 'Content-Type: application/json' \
+ -d '{
+ "base": {
+ "from": {"email": "sender@example.com"},
+ "subject": "Monthly Newsletter"
+ },
+ "requests": [
+ {"to": [{"email": "user1@example.com"}]},
+ {"to": [{"email": "user2@example.com"}]},
+ {"to": [{"email": "user3@example.com"}]}
+ ]
+ }'
- lang: javascript
label: Node.js
source: |
@@ -429,23 +446,6 @@ paths:
.build();
client.bulkSendingApi().emails().batchSend(batchMail);
- - lang: shell
- label: 'cURL'
- source: |
- curl -X POST https://bulk.api.mailtrap.io/api/batch \
- -H 'Authorization: Bearer YOUR_API_KEY' \
- -H 'Content-Type: application/json' \
- -d '{
- "base": {
- "from": {"email": "sender@example.com"},
- "subject": "Monthly Newsletter"
- },
- "requests": [
- {"to": [{"email": "user1@example.com"}]},
- {"to": [{"email": "user2@example.com"}]},
- {"to": [{"email": "user3@example.com"}]}
- ]
- }'
requestBody:
required: true
content:
diff --git a/specs/email-sending-transactional.openapi.yml b/specs/email-sending-transactional.openapi.yml
index 9222166..2b02947 100644
--- a/specs/email-sending-transactional.openapi.yml
+++ b/specs/email-sending-transactional.openapi.yml
@@ -51,6 +51,18 @@ paths:
tags:
- send-email
x-codeSamples:
+ - lang: shell
+ label: 'cURL'
+ source: |
+ curl -X POST https://send.api.mailtrap.io/api/send \
+ -H 'Authorization: Bearer YOUR_API_KEY' \
+ -H 'Content-Type: application/json' \
+ -d '{
+ "from": {"email": "sender@example.com"},
+ "to": [{"email": "recipient@example.com"}],
+ "subject": "Hello from Mailtrap",
+ "text": "Welcome to Mailtrap!"
+ }'
- lang: javascript
label: Node.js
source: |
@@ -169,18 +181,6 @@ paths:
.build();
client.sendingApi().emails().send(mail);
- - lang: shell
- label: 'cURL'
- source: |
- curl -X POST https://send.api.mailtrap.io/api/send \
- -H 'Authorization: Bearer YOUR_API_KEY' \
- -H 'Content-Type: application/json' \
- -d '{
- "from": {"email": "sender@example.com"},
- "to": [{"email": "recipient@example.com"}],
- "subject": "Hello from Mailtrap",
- "text": "Welcome to Mailtrap!"
- }'
requestBody:
required: true
content:
@@ -225,6 +225,23 @@ paths:
tags:
- send-email
x-codeSamples:
+ - lang: shell
+ label: 'cURL'
+ source: |
+ curl -X POST https://send.api.mailtrap.io/api/batch \
+ -H 'Authorization: Bearer YOUR_API_KEY' \
+ -H 'Content-Type: application/json' \
+ -d '{
+ "base": {
+ "from": {"email": "sender@example.com"},
+ "subject": "Monthly Newsletter"
+ },
+ "requests": [
+ {"to": [{"email": "user1@example.com"}]},
+ {"to": [{"email": "user2@example.com"}]},
+ {"to": [{"email": "user3@example.com"}]}
+ ]
+ }'
- lang: javascript
label: Node.js
source: |
@@ -398,23 +415,6 @@ paths:
.build();
client.sendingApi().emails().batchSend(batchMail);
- - lang: shell
- label: 'cURL'
- source: |
- curl -X POST https://send.api.mailtrap.io/api/batch \
- -H 'Authorization: Bearer YOUR_API_KEY' \
- -H 'Content-Type: application/json' \
- -d '{
- "base": {
- "from": {"email": "sender@example.com"},
- "subject": "Monthly Newsletter"
- },
- "requests": [
- {"to": [{"email": "user1@example.com"}]},
- {"to": [{"email": "user2@example.com"}]},
- {"to": [{"email": "user3@example.com"}]}
- ]
- }'
requestBody:
required: true
content:
diff --git a/specs/general.openapi.yml b/specs/general.openapi.yml
index e7e44f7..8362404 100644
--- a/specs/general.openapi.yml
+++ b/specs/general.openapi.yml
@@ -98,6 +98,12 @@ paths:
description: Get a list of sub accounts for the specified organization. You must have sub account management permissions for this organization.
tags:
- Organizations
+ x-codeSamples:
+ - lang: shell
+ label: 'cURL'
+ source: |
+ curl -X GET https://mailtrap.io/api/organizations/{organization_id}/sub_accounts \
+ -H 'Authorization: Bearer YOUR_API_TOKEN'
responses:
'200':
description: Returns the list of sub accounts belonging to the organization.
@@ -122,6 +128,18 @@ paths:
description: Create a new sub account under the specified organization. You must have sub account management permissions for this organization.
tags:
- Organizations
+ x-codeSamples:
+ - lang: shell
+ label: 'cURL'
+ source: |
+ curl -X POST https://mailtrap.io/api/organizations/{organization_id}/sub_accounts \
+ -H 'Authorization: Bearer YOUR_API_TOKEN' \
+ -H 'Content-Type: application/json' \
+ -d '{
+ "account": {
+ "name": "New Team Account"
+ }
+ }'
requestBody:
required: true
content:
@@ -176,6 +194,11 @@ paths:
tags:
- Accounts
x-codeSamples:
+ - lang: shell
+ label: 'cURL'
+ source: |
+ curl -X GET https://mailtrap.io/api/accounts \
+ -H 'Authorization: Bearer YOUR_API_TOKEN'
- lang: javascript
label: Node.js
source: |
@@ -292,6 +315,11 @@ paths:
tags:
- Account Accesses
x-codeSamples:
+ - lang: shell
+ label: 'cURL'
+ source: |
+ curl -X GET https://mailtrap.io/api/accounts/{account_id}/account_accesses \
+ -H 'Authorization: Bearer YOUR_API_TOKEN'
- lang: javascript
label: Node.js
source: |
@@ -402,6 +430,11 @@ paths:
tags:
- Account Accesses
x-codeSamples:
+ - lang: shell
+ label: 'cURL'
+ source: |
+ curl -X DELETE https://mailtrap.io/api/accounts/{account_id}/account_accesses/{account_access_id} \
+ -H 'Authorization: Bearer YOUR_API_TOKEN'
- lang: javascript
label: Node.js
source: |
@@ -494,6 +527,17 @@ paths:
tags:
- Permissions
x-codeSamples:
+ - lang: shell
+ label: 'cURL'
+ source: |
+ curl -X PUT https://mailtrap.io/api/accounts/{account_id}/account_accesses/{account_access_id}/permissions/bulk \
+ -H 'Authorization: Bearer YOUR_API_TOKEN' \
+ -H 'Content-Type: application/json' \
+ -d '{
+ "permissions": [
+ {"resource_id": "3281", "resource_type": "account", "access_level": "viewer"}
+ ]
+ }'
- lang: javascript
label: Node.js
source: |
@@ -668,6 +712,11 @@ paths:
tags:
- Permissions
x-codeSamples:
+ - lang: shell
+ label: 'cURL'
+ source: |
+ curl -X GET https://mailtrap.io/api/accounts/{account_id}/permissions/resources \
+ -H 'Authorization: Bearer YOUR_API_TOKEN'
- lang: javascript
label: Node.js
source: |
@@ -784,6 +833,11 @@ paths:
tags:
- Billing
x-codeSamples:
+ - lang: shell
+ label: 'cURL'
+ source: |
+ curl -X GET https://mailtrap.io/api/accounts/{account_id}/billing/usage \
+ -H 'Authorization: Bearer YOUR_API_TOKEN'
- lang: javascript
label: Node.js
source: |
diff --git a/specs/sandbox.openapi.yml b/specs/sandbox.openapi.yml
index bbc9fd8..e7d51cc 100644
--- a/specs/sandbox.openapi.yml
+++ b/specs/sandbox.openapi.yml
@@ -114,6 +114,17 @@ paths:
$ref: '#/components/responses/PERMISSION_DENIED'
operationId: createProject
x-codeSamples:
+ - lang: shell
+ label: 'cURL'
+ source: |
+ curl -X POST https://mailtrap.io/api/accounts/{account_id}/projects \
+ -H 'Authorization: Bearer YOUR_API_KEY' \
+ -H 'Content-Type: application/json' \
+ -d '{
+ "project": {
+ "name": "My New Project"
+ }
+ }'
- lang: javascript
label: Node.js
source: |
@@ -215,17 +226,6 @@ paths:
.createProject(accountId, request);
System.out.println(project);
- - lang: shell
- label: 'cURL'
- source: |
- curl -X POST https://mailtrap.io/api/accounts/{account_id}/projects \
- -H 'Authorization: Bearer YOUR_API_KEY' \
- -H 'Content-Type: application/json' \
- -d '{
- "project": {
- "name": "My New Project"
- }
- }'
get:
summary: Get a list of projects
description: List projects and their inboxes to which the API token has access.
@@ -240,6 +240,11 @@ paths:
$ref: '#/components/responses/PERMISSION_DENIED'
operationId: getProjects
x-codeSamples:
+ - lang: shell
+ label: 'cURL'
+ source: |
+ curl -X GET https://mailtrap.io/api/accounts/{account_id}/projects \
+ -H 'Authorization: Bearer YOUR_API_KEY'
- lang: javascript
label: Node.js
source: |
@@ -337,11 +342,6 @@ paths:
System.out.println("Project: " + project.getName() +
", ID: " + project.getId());
}
- - lang: shell
- label: 'cURL'
- source: |
- curl -X GET https://mailtrap.io/api/accounts/{account_id}/projects \
- -H 'Authorization: Bearer YOUR_API_KEY'
parameters:
- $ref: '#/components/parameters/account_id'
'/api/accounts/{account_id}/projects/{project_id}':
@@ -361,6 +361,11 @@ paths:
$ref: '#/components/responses/NOT_FOUND'
operationId: getProject
x-codeSamples:
+ - lang: shell
+ label: 'cURL'
+ source: |
+ curl -X GET https://mailtrap.io/api/accounts/{account_id}/projects/{project_id} \
+ -H 'Authorization: Bearer YOUR_API_KEY'
- lang: javascript
label: Node.js
source: |
@@ -459,17 +464,23 @@ paths:
.getProject(accountId, projectId);
System.out.println("Project: " + project.getName());
- - lang: shell
- label: 'cURL'
- source: |
- curl -X GET https://mailtrap.io/api/accounts/{account_id}/projects/{project_id} \
- -H 'Authorization: Bearer YOUR_API_KEY'
patch:
summary: Update project
description: Update project name. The project name is min 2 characters and max 100 characters long.
tags:
- Projects
x-codeSamples:
+ - lang: shell
+ label: 'cURL'
+ source: |
+ curl -X PATCH https://mailtrap.io/api/accounts/{account_id}/projects/{project_id} \
+ -H 'Authorization: Bearer YOUR_API_KEY' \
+ -H 'Content-Type: application/json' \
+ -d '{
+ "project": {
+ "name": "Updated Project Name"
+ }
+ }'
- lang: javascript
label: Node.js
source: |
@@ -585,17 +596,6 @@ paths:
.updateProject(accountId, projectId, request);
System.out.println("Project updated: " + updatedProject.getName());
- - lang: shell
- label: 'cURL'
- source: |
- curl -X PATCH https://mailtrap.io/api/accounts/{account_id}/projects/{project_id} \
- -H 'Authorization: Bearer YOUR_API_KEY' \
- -H 'Content-Type: application/json' \
- -d '{
- "project": {
- "name": "Updated Project Name"
- }
- }'
requestBody:
content:
application/json:
@@ -626,6 +626,11 @@ paths:
tags:
- Projects
x-codeSamples:
+ - lang: shell
+ label: 'cURL'
+ source: |
+ curl -X DELETE https://mailtrap.io/api/accounts/{account_id}/projects/{project_id} \
+ -H 'Authorization: Bearer YOUR_API_KEY'
- lang: javascript
label: Node.js
source: |
@@ -723,11 +728,6 @@ paths:
.deleteProject(accountId, projectId);
System.out.println("Project deleted: " + deletedProject.getId());
- - lang: shell
- label: 'cURL'
- source: |
- curl -X DELETE https://mailtrap.io/api/accounts/{account_id}/projects/{project_id} \
- -H 'Authorization: Bearer YOUR_API_KEY'
responses:
'200':
description: Returns id of the deleted project.
@@ -781,6 +781,17 @@ paths:
$ref: '#/components/responses/NOT_FOUND'
operationId: createInbox
x-codeSamples:
+ - lang: shell
+ label: 'cURL'
+ source: |
+ curl -X POST https://mailtrap.io/api/accounts/{account_id}/projects/{project_id}/inboxes \
+ -H 'Authorization: Bearer YOUR_API_KEY' \
+ -H 'Content-Type: application/json' \
+ -d '{
+ "inbox": {
+ "name": "My Test Inbox"
+ }
+ }'
- lang: javascript
label: Node.js
source: |
@@ -881,17 +892,6 @@ paths:
System.out.println("Inbox created: " + inbox.getName());
System.out.println("SMTP credentials - User: " + inbox.getUsername());
- - lang: shell
- label: 'cURL'
- source: |
- curl -X POST https://mailtrap.io/api/accounts/{account_id}/projects/{project_id}/inboxes \
- -H 'Authorization: Bearer YOUR_API_KEY' \
- -H 'Content-Type: application/json' \
- -d '{
- "inbox": {
- "name": "My Test Inbox"
- }
- }'
parameters:
- $ref: '#/components/parameters/account_id'
- $ref: '#/components/parameters/project_id'
@@ -911,6 +911,11 @@ paths:
'404':
$ref: '#/components/responses/NOT_FOUND'
x-codeSamples:
+ - lang: shell
+ label: 'cURL'
+ source: |
+ curl -X GET https://mailtrap.io/api/accounts/{account_id}/inboxes/{inbox_id} \
+ -H 'Authorization: Bearer YOUR_API_KEY'
- lang: javascript
label: Node.js
source: |
@@ -993,11 +998,6 @@ paths:
.getInboxAttributes(accountId, inboxId);
System.out.println(inboxAttributes);
- - lang: shell
- label: 'cURL'
- source: |
- curl -X GET https://mailtrap.io/api/accounts/{account_id}/inboxes/{inbox_id} \
- -H 'Authorization: Bearer YOUR_API_KEY'
operationId: getInboxAttributes
delete:
summary: Delete an inbox
@@ -1014,6 +1014,11 @@ paths:
'404':
$ref: '#/components/responses/NOT_FOUND'
x-codeSamples:
+ - lang: shell
+ label: 'cURL'
+ source: |
+ curl -X DELETE https://mailtrap.io/api/accounts/{account_id}/inboxes/{inbox_id} \
+ -H 'Authorization: Bearer YOUR_API_KEY'
- lang: javascript
label: Node.js
source: |
@@ -1095,11 +1100,6 @@ paths:
.deleteInbox(ACCOUNT_ID, inboxId);
System.out.println(deletedInbox);
- - lang: shell
- label: 'cURL'
- source: |
- curl -X DELETE https://mailtrap.io/api/accounts/{account_id}/inboxes/{inbox_id} \
- -H 'Authorization: Bearer YOUR_API_KEY'
operationId: deleteInbox
patch:
summary: Update an inbox
@@ -1133,6 +1133,18 @@ paths:
'404':
$ref: '#/components/responses/NOT_FOUND'
x-codeSamples:
+ - lang: shell
+ label: 'cURL'
+ source: |
+ curl -X PATCH https://mailtrap.io/api/accounts/{account_id}/inboxes/{inbox_id} \
+ -H 'Authorization: Bearer YOUR_API_KEY' \
+ -H 'Content-Type: application/json' \
+ -d '{
+ "inbox": {
+ "name": "Updated Inbox Name",
+ "email_username": "new-username"
+ }
+ }'
- lang: javascript
label: Node.js
source: |
@@ -1237,18 +1249,6 @@ paths:
.updateInbox(accountId, inboxId, updateRequest);
System.out.println(updatedInbox);
- - lang: shell
- label: 'cURL'
- source: |
- curl -X PATCH https://mailtrap.io/api/accounts/{account_id}/inboxes/{inbox_id} \
- -H 'Authorization: Bearer YOUR_API_KEY' \
- -H 'Content-Type: application/json' \
- -d '{
- "inbox": {
- "name": "Updated Inbox Name",
- "email_username": "new-username"
- }
- }'
operationId: updateInbox
parameters:
- $ref: '#/components/parameters/account_id'
@@ -1269,6 +1269,11 @@ paths:
'404':
$ref: '#/components/responses/NOT_FOUND'
x-codeSamples:
+ - lang: shell
+ label: 'cURL'
+ source: |
+ curl -X PATCH https://mailtrap.io/api/accounts/{account_id}/inboxes/{inbox_id}/clean \
+ -H 'Authorization: Bearer YOUR_API_KEY'
- lang: javascript
label: Node.js
source: |
@@ -1352,11 +1357,6 @@ paths:
.cleanInbox(accountId, inboxId);
System.out.println(cleanedInbox);
- - lang: shell
- label: 'cURL'
- source: |
- curl -X PATCH https://mailtrap.io/api/accounts/{account_id}/inboxes/{inbox_id}/clean \
- -H 'Authorization: Bearer YOUR_API_KEY'
operationId: cleanInbox
parameters:
- $ref: '#/components/parameters/account_id'
@@ -1377,6 +1377,11 @@ paths:
'404':
$ref: '#/components/responses/NOT_FOUND'
x-codeSamples:
+ - lang: shell
+ label: 'cURL'
+ source: |
+ curl -X PATCH https://mailtrap.io/api/accounts/{account_id}/inboxes/{inbox_id}/all_read \
+ -H 'Authorization: Bearer YOUR_API_KEY'
- lang: javascript
label: Node.js
source: |
@@ -1460,11 +1465,6 @@ paths:
.markAsRead(accountId, inboxId);
System.out.println(markedInbox);
- - lang: shell
- label: 'cURL'
- source: |
- curl -X PATCH https://mailtrap.io/api/accounts/{account_id}/inboxes/{inbox_id}/all_read \
- -H 'Authorization: Bearer YOUR_API_KEY'
operationId: markAsReadInbox
parameters:
- $ref: '#/components/parameters/account_id'
@@ -1485,6 +1485,11 @@ paths:
'404':
$ref: '#/components/responses/NOT_FOUND'
x-codeSamples:
+ - lang: shell
+ label: 'cURL'
+ source: |
+ curl -X PATCH https://mailtrap.io/api/accounts/{account_id}/inboxes/{inbox_id}/reset_credentials \
+ -H 'Authorization: Bearer YOUR_API_KEY'
- lang: javascript
label: Node.js
source: |
@@ -1568,11 +1573,6 @@ paths:
.resetCredentials(accountId, inboxId);
System.out.println(updatedInbox);
- - lang: shell
- label: 'cURL'
- source: |
- curl -X PATCH https://mailtrap.io/api/accounts/{account_id}/inboxes/{inbox_id}/reset_credentials \
- -H 'Authorization: Bearer YOUR_API_KEY'
operationId: resetInboxCredentials
parameters:
- $ref: '#/components/parameters/account_id'
@@ -1593,6 +1593,11 @@ paths:
'404':
$ref: '#/components/responses/NOT_FOUND'
x-codeSamples:
+ - lang: shell
+ label: 'cURL'
+ source: |
+ curl -X PATCH https://mailtrap.io/api/accounts/{account_id}/inboxes/{inbox_id}/toggle_email_username \
+ -H 'Authorization: Bearer YOUR_API_KEY'
- lang: javascript
label: Node.js
source: |
@@ -1676,11 +1681,6 @@ paths:
.enableEmailAddress(accountId, inboxId);
System.out.println(updatedInbox);
- - lang: shell
- label: 'cURL'
- source: |
- curl -X PATCH https://mailtrap.io/api/accounts/{account_id}/inboxes/{inbox_id}/toggle_email_username \
- -H 'Authorization: Bearer YOUR_API_KEY'
operationId: enableInboxEmailAddresses
parameters:
- $ref: '#/components/parameters/account_id'
@@ -1701,6 +1701,11 @@ paths:
'404':
$ref: '#/components/responses/NOT_FOUND'
x-codeSamples:
+ - lang: shell
+ label: 'cURL'
+ source: |
+ curl -X PATCH https://mailtrap.io/api/accounts/{account_id}/inboxes/{inbox_id}/reset_email_username \
+ -H 'Authorization: Bearer YOUR_API_KEY'
- lang: javascript
label: Node.js
source: |
@@ -1785,11 +1790,6 @@ paths:
.resetEmailAddresses(accountId, inboxId);
System.out.println(updatedInbox);
- - lang: shell
- label: 'cURL'
- source: |
- curl -X PATCH https://mailtrap.io/api/accounts/{account_id}/inboxes/{inbox_id}/reset_email_username \
- -H 'Authorization: Bearer YOUR_API_KEY'
operationId: resetEmailUserNamePerInbox
parameters:
- $ref: '#/components/parameters/account_id'
@@ -1808,6 +1808,11 @@ paths:
'403':
$ref: '#/components/responses/PERMISSION_DENIED'
x-codeSamples:
+ - lang: shell
+ label: 'cURL'
+ source: |
+ curl -X GET https://mailtrap.io/api/accounts/{account_id}/inboxes \
+ -H 'Authorization: Bearer YOUR_API_KEY'
- lang: javascript
label: Node.js
source: |
@@ -1883,11 +1888,6 @@ paths:
.getInboxes(accountId);
System.out.println(inboxes);
- - lang: shell
- label: 'cURL'
- source: |
- curl -X GET https://mailtrap.io/api/accounts/{account_id}/inboxes \
- -H 'Authorization: Bearer YOUR_API_KEY'
operationId: getInboxes
parameters:
- $ref: '#/components/parameters/account_id'
@@ -1902,6 +1902,18 @@ paths:
tags:
- Test Emails
x-codeSamples:
+ - lang: shell
+ label: 'cURL'
+ source: |
+ curl -X POST https://sandbox.api.mailtrap.io/api/send/{inbox_id} \
+ -H 'Authorization: Bearer YOUR_API_KEY' \
+ -H 'Content-Type: application/json' \
+ -d '{
+ "from": {"email": "sender@example.com"},
+ "to": [{"email": "recipient@example.com"}],
+ "subject": "Test Email",
+ "text": "This is a test email sent to sandbox"
+ }'
- lang: javascript
label: Node.js
source: |
@@ -2043,18 +2055,6 @@ paths:
.build();
client.testingApi().emails().send(mail, config.getInboxId());
- - lang: shell
- label: 'cURL'
- source: |
- curl -X POST https://sandbox.api.mailtrap.io/api/send/{inbox_id} \
- -H 'Authorization: Bearer YOUR_API_KEY' \
- -H 'Content-Type: application/json' \
- -d '{
- "from": {"email": "sender@example.com"},
- "to": [{"email": "recipient@example.com"}],
- "subject": "Test Email",
- "text": "This is a test email sent to sandbox"
- }'
requestBody:
content:
application/json:
@@ -2109,6 +2109,16 @@ paths:
tags:
- Test Emails
x-codeSamples:
+ - lang: shell
+ label: 'cURL'
+ source: |
+ curl -X POST https://sandbox.api.mailtrap.io/api/batch/{inbox_id} \
+ -H 'Authorization: Bearer YOUR_API_KEY' \
+ -H 'Content-Type: application/json' \
+ -d '{
+ "base": {"from": {"email": "sender@example.com"}, "subject": "Batch Email"},
+ "requests": [{"to": [{"email": "recipient1@example.com"}]}, {"to": [{"email": "recipient2@example.com"}]}]
+ }'
- lang: javascript
label: Node.js
source: |
@@ -2392,6 +2402,11 @@ paths:
'404':
$ref: '#/components/responses/NOT_FOUND'
x-codeSamples:
+ - lang: shell
+ label: 'cURL'
+ source: |
+ curl -X GET https://mailtrap.io/api/accounts/{account_id}/inboxes/{inbox_id}/messages/{message_id} \
+ -H 'Authorization: Bearer YOUR_API_KEY'
- lang: javascript
label: Node.js
source: |
@@ -2607,6 +2622,13 @@ paths:
'404':
$ref: '#/components/responses/NOT_FOUND'
x-codeSamples:
+ - lang: shell
+ label: 'cURL'
+ source: |
+ curl -X PATCH https://mailtrap.io/api/accounts/{account_id}/inboxes/{inbox_id}/messages/{message_id} \
+ -H 'Authorization: Bearer YOUR_API_KEY' \
+ -H 'Content-Type: application/json' \
+ -d '{"message": {"is_read": "true"}}'
- lang: javascript
label: Node.js
source: |
@@ -2818,6 +2840,11 @@ paths:
'404':
$ref: '#/components/responses/NOT_FOUND'
x-codeSamples:
+ - lang: shell
+ label: 'cURL'
+ source: |
+ curl -X DELETE https://mailtrap.io/api/accounts/{account_id}/inboxes/{inbox_id}/messages/{message_id} \
+ -H 'Authorization: Bearer YOUR_API_KEY'
- lang: javascript
label: Node.js
source: |
@@ -3027,6 +3054,11 @@ paths:
example: Inbox is not active or you have insufficient permissions
operationId: getInboxEmailMessage
x-codeSamples:
+ - lang: shell
+ label: 'cURL'
+ source: |
+ curl -X GET https://mailtrap.io/api/accounts/{account_id}/inboxes/{inbox_id}/messages \
+ -H 'Authorization: Bearer YOUR_API_KEY'
- lang: javascript
label: Node.js
source: |
@@ -3123,11 +3155,6 @@ paths:
System.out.println("Subject: " + message.getSubject());
System.out.println("Received: " + message.getCreatedAt());
}
- - lang: shell
- label: 'cURL'
- source: |
- curl -X GET https://mailtrap.io/api/accounts/{account_id}/inboxes/{inbox_id}/messages \
- -H 'Authorization: Bearer YOUR_API_KEY'
parameters:
- schema:
type: string
@@ -3194,6 +3221,13 @@ paths:
'404':
$ref: '#/components/responses/NOT_FOUND'
x-codeSamples:
+ - lang: shell
+ label: 'cURL'
+ source: |
+ curl -X POST https://mailtrap.io/api/accounts/{account_id}/inboxes/{inbox_id}/messages/{message_id}/forward \
+ -H 'Authorization: Bearer YOUR_API_KEY' \
+ -H 'Content-Type: application/json' \
+ -d '{"email": "recipient@example.com"}'
- lang: javascript
label: Node.js
source: |
@@ -3376,6 +3410,11 @@ paths:
'404':
$ref: '#/components/responses/NOT_FOUND'
x-codeSamples:
+ - lang: shell
+ label: 'cURL'
+ source: |
+ curl -X GET https://mailtrap.io/api/accounts/{account_id}/inboxes/{inbox_id}/messages/{message_id}/spam_report \
+ -H 'Authorization: Bearer YOUR_API_KEY'
- lang: javascript
label: Node.js
source: |
@@ -3545,6 +3584,11 @@ paths:
'404':
$ref: '#/components/responses/NOT_FOUND'
x-codeSamples:
+ - lang: shell
+ label: 'cURL'
+ source: |
+ curl -X GET https://mailtrap.io/api/accounts/{account_id}/inboxes/{inbox_id}/messages/{message_id}/analyze \
+ -H 'Authorization: Bearer YOUR_API_KEY'
- lang: javascript
label: Node.js
source: |
@@ -3663,6 +3707,11 @@ paths:
type: string
example: Conflict
x-codeSamples:
+ - lang: shell
+ label: 'cURL'
+ source: |
+ curl -X GET https://mailtrap.io/api/accounts/{account_id}/inboxes/{inbox_id}/messages/{message_id}/body.txt \
+ -H 'Authorization: Bearer YOUR_API_KEY'
- lang: javascript
label: Node.js
source: |
@@ -3825,6 +3874,11 @@ paths:
type: string
example: Conflict
x-codeSamples:
+ - lang: shell
+ label: 'cURL'
+ source: |
+ curl -X GET https://mailtrap.io/api/accounts/{account_id}/inboxes/{inbox_id}/messages/{message_id}/body.raw \
+ -H 'Authorization: Bearer YOUR_API_KEY'
- lang: javascript
label: Node.js
source: |
@@ -3966,6 +4020,11 @@ paths:
type: string
example: Conflict
x-codeSamples:
+ - lang: shell
+ label: 'cURL'
+ source: |
+ curl -X GET https://mailtrap.io/api/accounts/{account_id}/inboxes/{inbox_id}/messages/{message_id}/body.htmlsource \
+ -H 'Authorization: Bearer YOUR_API_KEY'
- lang: javascript
label: Node.js
source: |
@@ -4101,6 +4160,11 @@ paths:
type: string
example: Conflict
x-codeSamples:
+ - lang: shell
+ label: 'cURL'
+ source: |
+ curl -X GET https://mailtrap.io/api/accounts/{account_id}/inboxes/{inbox_id}/messages/{message_id}/body.html \
+ -H 'Authorization: Bearer YOUR_API_KEY'
- lang: javascript
label: Node.js
source: |
@@ -4265,6 +4329,11 @@ paths:
type: string
example: Conflict
x-codeSamples:
+ - lang: shell
+ label: 'cURL'
+ source: |
+ curl -X GET https://mailtrap.io/api/accounts/{account_id}/inboxes/{inbox_id}/messages/{message_id}/body.eml \
+ -H 'Authorization: Bearer YOUR_API_KEY'
- lang: javascript
label: Node.js
source: |
@@ -4380,6 +4449,11 @@ paths:
'404':
$ref: '#/components/responses/NOT_FOUND'
x-codeSamples:
+ - lang: shell
+ label: 'cURL'
+ source: |
+ curl -X GET https://mailtrap.io/api/accounts/{account_id}/inboxes/{inbox_id}/messages/{message_id}/mail_headers \
+ -H 'Authorization: Bearer YOUR_API_KEY'
- lang: javascript
label: Node.js
source: |
@@ -4530,6 +4604,11 @@ paths:
$ref: '#/components/responses/NOT_FOUND'
operationId: getInboxMessageAttachments
x-codeSamples:
+ - lang: shell
+ label: 'cURL'
+ source: |
+ curl -X GET https://mailtrap.io/api/accounts/{account_id}/inboxes/{inbox_id}/messages/{message_id}/attachments \
+ -H 'Authorization: Bearer YOUR_API_KEY'
- lang: javascript
label: Node.js
source: |
@@ -4670,6 +4749,11 @@ paths:
$ref: '#/components/responses/NOT_FOUND'
operationId: getInboxMessageAttachment
x-codeSamples:
+ - lang: shell
+ label: 'cURL'
+ source: |
+ curl -X GET https://mailtrap.io/api/accounts/{account_id}/inboxes/{inbox_id}/messages/{message_id}/attachments/{attachment_id} \
+ -H 'Authorization: Bearer YOUR_API_KEY'
- lang: javascript
label: Node.js
source: |