Skip to content

Latest commit

 

History

History
1583 lines (1151 loc) · 53.6 KB

TransactionalEmailsApi.md

File metadata and controls

1583 lines (1151 loc) · 53.6 KB

Brevo::TransactionalEmailsApi

All URIs are relative to https://api.brevo.com/v3

Method HTTP request Description
block_new_domain POST /smtp/blockedDomains Add a new domain to the list of blocked domains
create_smtp_template POST /smtp/templates Create an email template
delete_blocked_domain DELETE /smtp/blockedDomains/{domain} Unblock an existing domain from the list of blocked domains
delete_hardbounces POST /smtp/deleteHardbounces Delete hardbounces
delete_scheduled_email_by_id DELETE /smtp/email/{identifier} Delete scheduled emails by batchId or messageId
delete_smtp_template DELETE /smtp/templates/{templateId} Delete an inactive email template
get_aggregated_smtp_report GET /smtp/statistics/aggregatedReport Get your transactional email activity aggregated over a period of time
get_blocked_domains GET /smtp/blockedDomains Get the list of blocked domains
get_email_event_report GET /smtp/statistics/events Get all your transactional email activity (unaggregated events)
get_scheduled_email_by_id GET /smtp/emailStatus/{identifier} Fetch scheduled emails by batchId or messageId
get_smtp_report GET /smtp/statistics/reports Get your transactional email activity aggregated per day
get_smtp_template GET /smtp/templates/{templateId} Returns the template information
get_smtp_templates GET /smtp/templates Get the list of email templates
get_transac_blocked_contacts GET /smtp/blockedContacts Get the list of blocked or unsubscribed transactional contacts
get_transac_email_content GET /smtp/emails/{uuid} Get the personalized content of a sent transactional email
get_transac_emails_list GET /smtp/emails Get the list of transactional emails on the basis of allowed filters
send_test_template POST /smtp/templates/{templateId}/sendTest Send a template to your test list
send_transac_email POST /smtp/email Send a transactional email
smtp_blocked_contacts_email_delete DELETE /smtp/blockedContacts/{email} Unblock or resubscribe a transactional contact
smtp_log_identifier_delete DELETE /smtp/log/{identifier} Delete an SMTP transactional log
update_smtp_template PUT /smtp/templates/{templateId} Update an email template

block_new_domain

block_new_domain(block_domain)

Add a new domain to the list of blocked domains

Blocks a new domain in order to avoid messages being sent to the same

Examples

require 'time'
require 'brevo'
# setup authorization
Brevo.configure do |config|
  # Configure API key authorization: api-key
  config.api_key['api-key'] = 'YOUR API KEY'
  # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
  # config.api_key_prefix['api-key'] = 'Bearer'
end

api_instance = Brevo::TransactionalEmailsApi.new
block_domain = Brevo::BlockDomain.new({domain: 'example.com'}) # BlockDomain | Name of the domain to be blocked

begin
  # Add a new domain to the list of blocked domains
  api_instance.block_new_domain(block_domain)
rescue Brevo::ApiError => e
  puts "Error when calling TransactionalEmailsApi->block_new_domain: #{e}"
end

Using the block_new_domain_with_http_info variant

This returns an Array which contains the response data (nil in this case), status code and headers.

<Array(nil, Integer, Hash)> block_new_domain_with_http_info(block_domain)

begin
  # Add a new domain to the list of blocked domains
  data, status_code, headers = api_instance.block_new_domain_with_http_info(block_domain)
  p status_code # => 2xx
  p headers # => { ... }
  p data # => nil
rescue Brevo::ApiError => e
  puts "Error when calling TransactionalEmailsApi->block_new_domain_with_http_info: #{e}"
end

Parameters

Name Type Description Notes
block_domain BlockDomain Name of the domain to be blocked

Return type

nil (empty response body)

Authorization

api-key

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

create_smtp_template

create_smtp_template(create_smtp_template)

Create an email template

Examples

require 'time'
require 'brevo'
# setup authorization
Brevo.configure do |config|
  # Configure API key authorization: api-key
  config.api_key['api-key'] = 'YOUR API KEY'
  # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
  # config.api_key_prefix['api-key'] = 'Bearer'
end

api_instance = Brevo::TransactionalEmailsApi.new
create_smtp_template = Brevo::CreateSmtpTemplate.new({sender: Brevo::CreateSmtpTemplateSender.new, template_name: 'Order Confirmation - EN', subject: 'Thanks for your purchase !'}) # CreateSmtpTemplate | values to update in transactional email template

begin
  # Create an email template
  result = api_instance.create_smtp_template(create_smtp_template)
  p result
rescue Brevo::ApiError => e
  puts "Error when calling TransactionalEmailsApi->create_smtp_template: #{e}"
end

Using the create_smtp_template_with_http_info variant

This returns an Array which contains the response data, status code and headers.

<Array(, Integer, Hash)> create_smtp_template_with_http_info(create_smtp_template)

begin
  # Create an email template
  data, status_code, headers = api_instance.create_smtp_template_with_http_info(create_smtp_template)
  p status_code # => 2xx
  p headers # => { ... }
  p data # => <CreateModel>
rescue Brevo::ApiError => e
  puts "Error when calling TransactionalEmailsApi->create_smtp_template_with_http_info: #{e}"
end

Parameters

Name Type Description Notes
create_smtp_template CreateSmtpTemplate values to update in transactional email template

Return type

CreateModel

Authorization

api-key

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

delete_blocked_domain

delete_blocked_domain(domain)

Unblock an existing domain from the list of blocked domains

Unblocks an existing domain from the list of blocked domains

Examples

require 'time'
require 'brevo'
# setup authorization
Brevo.configure do |config|
  # Configure API key authorization: api-key
  config.api_key['api-key'] = 'YOUR API KEY'
  # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
  # config.api_key_prefix['api-key'] = 'Bearer'
end

api_instance = Brevo::TransactionalEmailsApi.new
domain = 'domain_example' # String | The name of the domain to be deleted

begin
  # Unblock an existing domain from the list of blocked domains
  api_instance.delete_blocked_domain(domain)
rescue Brevo::ApiError => e
  puts "Error when calling TransactionalEmailsApi->delete_blocked_domain: #{e}"
end

Using the delete_blocked_domain_with_http_info variant

This returns an Array which contains the response data (nil in this case), status code and headers.

<Array(nil, Integer, Hash)> delete_blocked_domain_with_http_info(domain)

begin
  # Unblock an existing domain from the list of blocked domains
  data, status_code, headers = api_instance.delete_blocked_domain_with_http_info(domain)
  p status_code # => 2xx
  p headers # => { ... }
  p data # => nil
rescue Brevo::ApiError => e
  puts "Error when calling TransactionalEmailsApi->delete_blocked_domain_with_http_info: #{e}"
end

Parameters

Name Type Description Notes
domain String The name of the domain to be deleted

Return type

nil (empty response body)

Authorization

api-key

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

delete_hardbounces

delete_hardbounces(opts)

Delete hardbounces

Delete hardbounces. To use carefully (e.g. in case of temporary ISP failures)

Examples

require 'time'
require 'brevo'
# setup authorization
Brevo.configure do |config|
  # Configure API key authorization: api-key
  config.api_key['api-key'] = 'YOUR API KEY'
  # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
  # config.api_key_prefix['api-key'] = 'Bearer'
end

api_instance = Brevo::TransactionalEmailsApi.new
opts = {
  delete_hardbounces: Brevo::DeleteHardbounces.new # DeleteHardbounces | values to delete hardbounces
}

begin
  # Delete hardbounces
  api_instance.delete_hardbounces(opts)
rescue Brevo::ApiError => e
  puts "Error when calling TransactionalEmailsApi->delete_hardbounces: #{e}"
end

Using the delete_hardbounces_with_http_info variant

This returns an Array which contains the response data (nil in this case), status code and headers.

<Array(nil, Integer, Hash)> delete_hardbounces_with_http_info(opts)

begin
  # Delete hardbounces
  data, status_code, headers = api_instance.delete_hardbounces_with_http_info(opts)
  p status_code # => 2xx
  p headers # => { ... }
  p data # => nil
rescue Brevo::ApiError => e
  puts "Error when calling TransactionalEmailsApi->delete_hardbounces_with_http_info: #{e}"
end

Parameters

Name Type Description Notes
delete_hardbounces DeleteHardbounces values to delete hardbounces [optional]

Return type

nil (empty response body)

Authorization

api-key

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

delete_scheduled_email_by_id

delete_scheduled_email_by_id(identifier)

Delete scheduled emails by batchId or messageId

Delete scheduled batch of emails by batchId or single scheduled email by messageId

Examples

require 'time'
require 'brevo'
# setup authorization
Brevo.configure do |config|
  # Configure API key authorization: api-key
  config.api_key['api-key'] = 'YOUR API KEY'
  # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
  # config.api_key_prefix['api-key'] = 'Bearer'
end

api_instance = Brevo::TransactionalEmailsApi.new
identifier = '4320f270-a4e3-4a2e-b591-edfe30a5e627' # String | The `batchId` of scheduled emails batch (Should be a valid UUIDv4) or the `messageId` of scheduled email.

begin
  # Delete scheduled emails by batchId or messageId
  api_instance.delete_scheduled_email_by_id(identifier)
rescue Brevo::ApiError => e
  puts "Error when calling TransactionalEmailsApi->delete_scheduled_email_by_id: #{e}"
end

Using the delete_scheduled_email_by_id_with_http_info variant

This returns an Array which contains the response data (nil in this case), status code and headers.

<Array(nil, Integer, Hash)> delete_scheduled_email_by_id_with_http_info(identifier)

begin
  # Delete scheduled emails by batchId or messageId
  data, status_code, headers = api_instance.delete_scheduled_email_by_id_with_http_info(identifier)
  p status_code # => 2xx
  p headers # => { ... }
  p data # => nil
rescue Brevo::ApiError => e
  puts "Error when calling TransactionalEmailsApi->delete_scheduled_email_by_id_with_http_info: #{e}"
end

Parameters

Name Type Description Notes
identifier String The `batchId` of scheduled emails batch (Should be a valid UUIDv4) or the `messageId` of scheduled email.

Return type

nil (empty response body)

Authorization

api-key

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

delete_smtp_template

delete_smtp_template(template_id)

Delete an inactive email template

Examples

require 'time'
require 'brevo'
# setup authorization
Brevo.configure do |config|
  # Configure API key authorization: api-key
  config.api_key['api-key'] = 'YOUR API KEY'
  # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
  # config.api_key_prefix['api-key'] = 'Bearer'
end

api_instance = Brevo::TransactionalEmailsApi.new
template_id = 789 # Integer | id of the template

begin
  # Delete an inactive email template
  api_instance.delete_smtp_template(template_id)
rescue Brevo::ApiError => e
  puts "Error when calling TransactionalEmailsApi->delete_smtp_template: #{e}"
end

Using the delete_smtp_template_with_http_info variant

This returns an Array which contains the response data (nil in this case), status code and headers.

<Array(nil, Integer, Hash)> delete_smtp_template_with_http_info(template_id)

begin
  # Delete an inactive email template
  data, status_code, headers = api_instance.delete_smtp_template_with_http_info(template_id)
  p status_code # => 2xx
  p headers # => { ... }
  p data # => nil
rescue Brevo::ApiError => e
  puts "Error when calling TransactionalEmailsApi->delete_smtp_template_with_http_info: #{e}"
end

Parameters

Name Type Description Notes
template_id Integer id of the template

Return type

nil (empty response body)

Authorization

api-key

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

get_aggregated_smtp_report

get_aggregated_smtp_report(opts)

Get your transactional email activity aggregated over a period of time

This endpoint will show the aggregated stats for past 90 days by default if startDate and endDate OR days is not passed. The date range can not exceed 90 days

Examples

require 'time'
require 'brevo'
# setup authorization
Brevo.configure do |config|
  # Configure API key authorization: api-key
  config.api_key['api-key'] = 'YOUR API KEY'
  # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
  # config.api_key_prefix['api-key'] = 'Bearer'
end

api_instance = Brevo::TransactionalEmailsApi.new
opts = {
  start_date: 'start_date_example', # String | **Mandatory if endDate is used.** Starting date of the report (YYYY-MM-DD). Must be lower than equal to endDate 
  end_date: 'end_date_example', # String | **Mandatory if startDate is used.** Ending date of the report (YYYY-MM-DD). Must be greater than equal to startDate 
  days: 789, # Integer | Number of days in the past including today (positive integer). _Not compatible with 'startDate' and 'endDate'_ 
  tag: 'tag_example' # String | Tag of the emails
}

begin
  # Get your transactional email activity aggregated over a period of time
  result = api_instance.get_aggregated_smtp_report(opts)
  p result
rescue Brevo::ApiError => e
  puts "Error when calling TransactionalEmailsApi->get_aggregated_smtp_report: #{e}"
end

Using the get_aggregated_smtp_report_with_http_info variant

This returns an Array which contains the response data, status code and headers.

<Array(, Integer, Hash)> get_aggregated_smtp_report_with_http_info(opts)

begin
  # Get your transactional email activity aggregated over a period of time
  data, status_code, headers = api_instance.get_aggregated_smtp_report_with_http_info(opts)
  p status_code # => 2xx
  p headers # => { ... }
  p data # => <GetAggregatedReport>
rescue Brevo::ApiError => e
  puts "Error when calling TransactionalEmailsApi->get_aggregated_smtp_report_with_http_info: #{e}"
end

Parameters

Name Type Description Notes
start_date String Mandatory if endDate is used. Starting date of the report (YYYY-MM-DD). Must be lower than equal to endDate [optional]
end_date String Mandatory if startDate is used. Ending date of the report (YYYY-MM-DD). Must be greater than equal to startDate [optional]
days Integer Number of days in the past including today (positive integer). Not compatible with 'startDate' and 'endDate' [optional]
tag String Tag of the emails [optional]

Return type

GetAggregatedReport

Authorization

api-key

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

get_blocked_domains

get_blocked_domains

Get the list of blocked domains

Get the list of blocked domains

Examples

require 'time'
require 'brevo'
# setup authorization
Brevo.configure do |config|
  # Configure API key authorization: api-key
  config.api_key['api-key'] = 'YOUR API KEY'
  # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
  # config.api_key_prefix['api-key'] = 'Bearer'
end

api_instance = Brevo::TransactionalEmailsApi.new

begin
  # Get the list of blocked domains
  result = api_instance.get_blocked_domains
  p result
rescue Brevo::ApiError => e
  puts "Error when calling TransactionalEmailsApi->get_blocked_domains: #{e}"
end

Using the get_blocked_domains_with_http_info variant

This returns an Array which contains the response data, status code and headers.

<Array(, Integer, Hash)> get_blocked_domains_with_http_info

begin
  # Get the list of blocked domains
  data, status_code, headers = api_instance.get_blocked_domains_with_http_info
  p status_code # => 2xx
  p headers # => { ... }
  p data # => <GetBlockedDomains>
rescue Brevo::ApiError => e
  puts "Error when calling TransactionalEmailsApi->get_blocked_domains_with_http_info: #{e}"
end

Parameters

This endpoint does not need any parameter.

Return type

GetBlockedDomains

Authorization

api-key

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

get_email_event_report

get_email_event_report(opts)

Get all your transactional email activity (unaggregated events)

This endpoint will show the aggregated stats for past 30 days by default if startDate and endDate OR days is not passed. The date range can not exceed 90 days

Examples

require 'time'
require 'brevo'
# setup authorization
Brevo.configure do |config|
  # Configure API key authorization: api-key
  config.api_key['api-key'] = 'YOUR API KEY'
  # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
  # config.api_key_prefix['api-key'] = 'Bearer'
end

api_instance = Brevo::TransactionalEmailsApi.new
opts = {
  limit: 789, # Integer | Number limitation for the result returned
  offset: 789, # Integer | Beginning point in the list to retrieve from.
  start_date: 'start_date_example', # String | **Mandatory if endDate is used.** Starting date of the report (YYYY-MM-DD). Must be lower than equal to endDate 
  end_date: 'end_date_example', # String | **Mandatory if startDate is used.** Ending date of the report (YYYY-MM-DD). Must be greater than equal to startDate 
  days: 789, # Integer | Number of days in the past including today (positive integer). _Not compatible with 'startDate' and 'endDate'_ 
  email: 'email_example', # String | Filter the report for a specific email addresses
  event: 'bounces', # String | Filter the report for a specific event type
  tags: 'tags_example', # String | Filter the report for tags (serialized and urlencoded array)
  message_id: 'message_id_example', # String | Filter on a specific message id
  template_id: 789, # Integer | Filter on a specific template id
  sort: 'asc' # String | Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed
}

begin
  # Get all your transactional email activity (unaggregated events)
  result = api_instance.get_email_event_report(opts)
  p result
rescue Brevo::ApiError => e
  puts "Error when calling TransactionalEmailsApi->get_email_event_report: #{e}"
end

Using the get_email_event_report_with_http_info variant

This returns an Array which contains the response data, status code and headers.

<Array(, Integer, Hash)> get_email_event_report_with_http_info(opts)

begin
  # Get all your transactional email activity (unaggregated events)
  data, status_code, headers = api_instance.get_email_event_report_with_http_info(opts)
  p status_code # => 2xx
  p headers # => { ... }
  p data # => <GetEmailEventReport>
rescue Brevo::ApiError => e
  puts "Error when calling TransactionalEmailsApi->get_email_event_report_with_http_info: #{e}"
end

Parameters

Name Type Description Notes
limit Integer Number limitation for the result returned [optional][default to 2500]
offset Integer Beginning point in the list to retrieve from. [optional][default to 0]
start_date String Mandatory if endDate is used. Starting date of the report (YYYY-MM-DD). Must be lower than equal to endDate [optional]
end_date String Mandatory if startDate is used. Ending date of the report (YYYY-MM-DD). Must be greater than equal to startDate [optional]
days Integer Number of days in the past including today (positive integer). Not compatible with 'startDate' and 'endDate' [optional]
email String Filter the report for a specific email addresses [optional]
event String Filter the report for a specific event type [optional]
tags String Filter the report for tags (serialized and urlencoded array) [optional]
message_id String Filter on a specific message id [optional]
template_id Integer Filter on a specific template id [optional]
sort String Sort the results in the ascending/descending order of record creation. Default order is descending if `sort` is not passed [optional][default to 'desc']

Return type

GetEmailEventReport

Authorization

api-key

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

get_scheduled_email_by_id

get_scheduled_email_by_id(identifier, opts)

Fetch scheduled emails by batchId or messageId

Fetch scheduled batch of emails by batchId or single scheduled email by messageId (Can retrieve data upto 30 days old)

Examples

require 'time'
require 'brevo'
# setup authorization
Brevo.configure do |config|
  # Configure API key authorization: api-key
  config.api_key['api-key'] = 'YOUR API KEY'
  # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
  # config.api_key_prefix['api-key'] = 'Bearer'
end

api_instance = Brevo::TransactionalEmailsApi.new
identifier = '4320f270-a4e3-4a2e-b591-edfe30a5e627' # String | The `batchId` of scheduled emails batch (Should be a valid UUIDv4) or the `messageId` of scheduled email.
opts = {
  start_date: Date.parse('2022-02-02'), # Date | Mandatory if `endDate` is used. Starting date (YYYY-MM-DD) from which you want to fetch the list. Can be maximum 30 days older tha current date.
  end_date: Date.parse('2022-03-02'), # Date | Mandatory if `startDate` is used. Ending date (YYYY-MM-DD) till which you want to fetch the list. Maximum time period that can be selected is one month.
  sort: 'asc', # String | Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed. Not valid when identifier is `messageId`.
  status: 'processed', # String | Filter the records by `status` of the scheduled email batch or message. Not valid when identifier is `messageId`.
  limit: 100, # Integer | Number of documents returned per page. Not valid when identifier is `messageId`.
  offset: 0 # Integer | Index of the first document on the page.  Not valid when identifier is `messageId`.
}

begin
  # Fetch scheduled emails by batchId or messageId
  result = api_instance.get_scheduled_email_by_id(identifier, opts)
  p result
rescue Brevo::ApiError => e
  puts "Error when calling TransactionalEmailsApi->get_scheduled_email_by_id: #{e}"
end

Using the get_scheduled_email_by_id_with_http_info variant

This returns an Array which contains the response data, status code and headers.

<Array(, Integer, Hash)> get_scheduled_email_by_id_with_http_info(identifier, opts)

begin
  # Fetch scheduled emails by batchId or messageId
  data, status_code, headers = api_instance.get_scheduled_email_by_id_with_http_info(identifier, opts)
  p status_code # => 2xx
  p headers # => { ... }
  p data # => <GetScheduledEmailById200Response>
rescue Brevo::ApiError => e
  puts "Error when calling TransactionalEmailsApi->get_scheduled_email_by_id_with_http_info: #{e}"
end

Parameters

Name Type Description Notes
identifier String The `batchId` of scheduled emails batch (Should be a valid UUIDv4) or the `messageId` of scheduled email.
start_date Date Mandatory if `endDate` is used. Starting date (YYYY-MM-DD) from which you want to fetch the list. Can be maximum 30 days older tha current date. [optional]
end_date Date Mandatory if `startDate` is used. Ending date (YYYY-MM-DD) till which you want to fetch the list. Maximum time period that can be selected is one month. [optional]
sort String Sort the results in the ascending/descending order of record creation. Default order is descending if `sort` is not passed. Not valid when identifier is `messageId`. [optional][default to 'desc']
status String Filter the records by `status` of the scheduled email batch or message. Not valid when identifier is `messageId`. [optional]
limit Integer Number of documents returned per page. Not valid when identifier is `messageId`. [optional][default to 100]
offset Integer Index of the first document on the page. Not valid when identifier is `messageId`. [optional][default to 0]

Return type

GetScheduledEmailById200Response

Authorization

api-key

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

get_smtp_report

get_smtp_report(opts)

Get your transactional email activity aggregated per day

Examples

require 'time'
require 'brevo'
# setup authorization
Brevo.configure do |config|
  # Configure API key authorization: api-key
  config.api_key['api-key'] = 'YOUR API KEY'
  # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
  # config.api_key_prefix['api-key'] = 'Bearer'
end

api_instance = Brevo::TransactionalEmailsApi.new
opts = {
  limit: 789, # Integer | Number of documents returned per page
  offset: 789, # Integer | Index of the first document on the page
  start_date: 'start_date_example', # String | **Mandatory if endDate is used.** Starting date of the report (YYYY-MM-DD) 
  end_date: 'end_date_example', # String | **Mandatory if startDate is used.** Ending date of the report (YYYY-MM-DD) 
  days: 789, # Integer | Number of days in the past including today (positive integer). _Not compatible with 'startDate' and 'endDate'_ 
  tag: 'tag_example', # String | Tag of the emails
  sort: 'asc' # String | Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed
}

begin
  # Get your transactional email activity aggregated per day
  result = api_instance.get_smtp_report(opts)
  p result
rescue Brevo::ApiError => e
  puts "Error when calling TransactionalEmailsApi->get_smtp_report: #{e}"
end

Using the get_smtp_report_with_http_info variant

This returns an Array which contains the response data, status code and headers.

<Array(, Integer, Hash)> get_smtp_report_with_http_info(opts)

begin
  # Get your transactional email activity aggregated per day
  data, status_code, headers = api_instance.get_smtp_report_with_http_info(opts)
  p status_code # => 2xx
  p headers # => { ... }
  p data # => <GetReports>
rescue Brevo::ApiError => e
  puts "Error when calling TransactionalEmailsApi->get_smtp_report_with_http_info: #{e}"
end

Parameters

Name Type Description Notes
limit Integer Number of documents returned per page [optional][default to 10]
offset Integer Index of the first document on the page [optional][default to 0]
start_date String Mandatory if endDate is used. Starting date of the report (YYYY-MM-DD) [optional]
end_date String Mandatory if startDate is used. Ending date of the report (YYYY-MM-DD) [optional]
days Integer Number of days in the past including today (positive integer). Not compatible with 'startDate' and 'endDate' [optional]
tag String Tag of the emails [optional]
sort String Sort the results in the ascending/descending order of record creation. Default order is descending if `sort` is not passed [optional][default to 'desc']

Return type

GetReports

Authorization

api-key

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

get_smtp_template

get_smtp_template(template_id)

Returns the template information

Examples

require 'time'
require 'brevo'
# setup authorization
Brevo.configure do |config|
  # Configure API key authorization: api-key
  config.api_key['api-key'] = 'YOUR API KEY'
  # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
  # config.api_key_prefix['api-key'] = 'Bearer'
end

api_instance = Brevo::TransactionalEmailsApi.new
template_id = 789 # Integer | id of the template

begin
  # Returns the template information
  result = api_instance.get_smtp_template(template_id)
  p result
rescue Brevo::ApiError => e
  puts "Error when calling TransactionalEmailsApi->get_smtp_template: #{e}"
end

Using the get_smtp_template_with_http_info variant

This returns an Array which contains the response data, status code and headers.

<Array(, Integer, Hash)> get_smtp_template_with_http_info(template_id)

begin
  # Returns the template information
  data, status_code, headers = api_instance.get_smtp_template_with_http_info(template_id)
  p status_code # => 2xx
  p headers # => { ... }
  p data # => <GetSmtpTemplateOverview>
rescue Brevo::ApiError => e
  puts "Error when calling TransactionalEmailsApi->get_smtp_template_with_http_info: #{e}"
end

Parameters

Name Type Description Notes
template_id Integer id of the template

Return type

GetSmtpTemplateOverview

Authorization

api-key

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

get_smtp_templates

get_smtp_templates(opts)

Get the list of email templates

Examples

require 'time'
require 'brevo'
# setup authorization
Brevo.configure do |config|
  # Configure API key authorization: api-key
  config.api_key['api-key'] = 'YOUR API KEY'
  # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
  # config.api_key_prefix['api-key'] = 'Bearer'
end

api_instance = Brevo::TransactionalEmailsApi.new
opts = {
  template_status: true, # Boolean | Filter on the status of the template. Active = true, inactive = false
  limit: 789, # Integer | Number of documents returned per page
  offset: 789, # Integer | Index of the first document in the page
  sort: 'asc' # String | Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed
}

begin
  # Get the list of email templates
  result = api_instance.get_smtp_templates(opts)
  p result
rescue Brevo::ApiError => e
  puts "Error when calling TransactionalEmailsApi->get_smtp_templates: #{e}"
end

Using the get_smtp_templates_with_http_info variant

This returns an Array which contains the response data, status code and headers.

<Array(, Integer, Hash)> get_smtp_templates_with_http_info(opts)

begin
  # Get the list of email templates
  data, status_code, headers = api_instance.get_smtp_templates_with_http_info(opts)
  p status_code # => 2xx
  p headers # => { ... }
  p data # => <GetSmtpTemplates>
rescue Brevo::ApiError => e
  puts "Error when calling TransactionalEmailsApi->get_smtp_templates_with_http_info: #{e}"
end

Parameters

Name Type Description Notes
template_status Boolean Filter on the status of the template. Active = true, inactive = false [optional]
limit Integer Number of documents returned per page [optional][default to 50]
offset Integer Index of the first document in the page [optional][default to 0]
sort String Sort the results in the ascending/descending order of record creation. Default order is descending if `sort` is not passed [optional][default to 'desc']

Return type

GetSmtpTemplates

Authorization

api-key

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

get_transac_blocked_contacts

get_transac_blocked_contacts(opts)

Get the list of blocked or unsubscribed transactional contacts

Examples

require 'time'
require 'brevo'
# setup authorization
Brevo.configure do |config|
  # Configure API key authorization: api-key
  config.api_key['api-key'] = 'YOUR API KEY'
  # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
  # config.api_key_prefix['api-key'] = 'Bearer'
end

api_instance = Brevo::TransactionalEmailsApi.new
opts = {
  start_date: 'start_date_example', # String | **Mandatory if endDate is used.** Starting date (YYYY-MM-DD) from which you want to fetch the blocked or unsubscribed contacts 
  end_date: 'end_date_example', # String | **Mandatory if startDate is used.** Ending date (YYYY-MM-DD) till which you want to fetch the blocked or unsubscribed contacts 
  limit: 789, # Integer | Number of documents returned per page
  offset: 789, # Integer | Index of the first document on the page
  senders: ['inner_example'], # Array<String> | Comma separated list of emails of the senders from which contacts are blocked or unsubscribed
  sort: 'asc' # String | Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed
}

begin
  # Get the list of blocked or unsubscribed transactional contacts
  result = api_instance.get_transac_blocked_contacts(opts)
  p result
rescue Brevo::ApiError => e
  puts "Error when calling TransactionalEmailsApi->get_transac_blocked_contacts: #{e}"
end

Using the get_transac_blocked_contacts_with_http_info variant

This returns an Array which contains the response data, status code and headers.

<Array(, Integer, Hash)> get_transac_blocked_contacts_with_http_info(opts)

begin
  # Get the list of blocked or unsubscribed transactional contacts
  data, status_code, headers = api_instance.get_transac_blocked_contacts_with_http_info(opts)
  p status_code # => 2xx
  p headers # => { ... }
  p data # => <GetTransacBlockedContacts>
rescue Brevo::ApiError => e
  puts "Error when calling TransactionalEmailsApi->get_transac_blocked_contacts_with_http_info: #{e}"
end

Parameters

Name Type Description Notes
start_date String Mandatory if endDate is used. Starting date (YYYY-MM-DD) from which you want to fetch the blocked or unsubscribed contacts [optional]
end_date String Mandatory if startDate is used. Ending date (YYYY-MM-DD) till which you want to fetch the blocked or unsubscribed contacts [optional]
limit Integer Number of documents returned per page [optional][default to 50]
offset Integer Index of the first document on the page [optional][default to 0]
senders Array<String> Comma separated list of emails of the senders from which contacts are blocked or unsubscribed [optional]
sort String Sort the results in the ascending/descending order of record creation. Default order is descending if `sort` is not passed [optional][default to 'desc']

Return type

GetTransacBlockedContacts

Authorization

api-key

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

get_transac_email_content

get_transac_email_content(uuid)

Get the personalized content of a sent transactional email

Examples

require 'time'
require 'brevo'
# setup authorization
Brevo.configure do |config|
  # Configure API key authorization: api-key
  config.api_key['api-key'] = 'YOUR API KEY'
  # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
  # config.api_key_prefix['api-key'] = 'Bearer'
end

api_instance = Brevo::TransactionalEmailsApi.new
uuid = 'uuid_example' # String | Unique id of the transactional email that has been sent to a particular contact

begin
  # Get the personalized content of a sent transactional email
  result = api_instance.get_transac_email_content(uuid)
  p result
rescue Brevo::ApiError => e
  puts "Error when calling TransactionalEmailsApi->get_transac_email_content: #{e}"
end

Using the get_transac_email_content_with_http_info variant

This returns an Array which contains the response data, status code and headers.

<Array(, Integer, Hash)> get_transac_email_content_with_http_info(uuid)

begin
  # Get the personalized content of a sent transactional email
  data, status_code, headers = api_instance.get_transac_email_content_with_http_info(uuid)
  p status_code # => 2xx
  p headers # => { ... }
  p data # => <GetTransacEmailContent>
rescue Brevo::ApiError => e
  puts "Error when calling TransactionalEmailsApi->get_transac_email_content_with_http_info: #{e}"
end

Parameters

Name Type Description Notes
uuid String Unique id of the transactional email that has been sent to a particular contact

Return type

GetTransacEmailContent

Authorization

api-key

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

get_transac_emails_list

get_transac_emails_list(opts)

Get the list of transactional emails on the basis of allowed filters

This endpoint will show the list of emails for past 30 days by default. To retrieve emails before that time, please pass startDate and endDate in query filters.

Examples

require 'time'
require 'brevo'
# setup authorization
Brevo.configure do |config|
  # Configure API key authorization: api-key
  config.api_key['api-key'] = 'YOUR API KEY'
  # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
  # config.api_key_prefix['api-key'] = 'Bearer'
end

api_instance = Brevo::TransactionalEmailsApi.new
opts = {
  email: 'email_example', # String | **Mandatory if templateId and messageId are not passed in query filters.** Email address to which transactional email has been sent. 
  template_id: 789, # Integer | **Mandatory if email and messageId are not passed in query filters.** Id of the template that was used to compose transactional email. 
  message_id: 'message_id_example', # String | **Mandatory if templateId and email are not passed in query filters.** Message ID of the transactional email sent. 
  start_date: 'start_date_example', # String | **Mandatory if endDate is used.** Starting date (YYYY-MM-DD) from which you want to fetch the list. **Maximum time period that can be selected is one month**. 
  end_date: 'end_date_example', # String | **Mandatory if startDate is used.** Ending date (YYYY-MM-DD) till which you want to fetch the list. **Maximum time period that can be selected is one month.** 
  sort: 'asc', # String | Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed
  limit: 789, # Integer | Number of documents returned per page
  offset: 789 # Integer | Index of the first document in the page
}

begin
  # Get the list of transactional emails on the basis of allowed filters
  result = api_instance.get_transac_emails_list(opts)
  p result
rescue Brevo::ApiError => e
  puts "Error when calling TransactionalEmailsApi->get_transac_emails_list: #{e}"
end

Using the get_transac_emails_list_with_http_info variant

This returns an Array which contains the response data, status code and headers.

<Array(, Integer, Hash)> get_transac_emails_list_with_http_info(opts)

begin
  # Get the list of transactional emails on the basis of allowed filters
  data, status_code, headers = api_instance.get_transac_emails_list_with_http_info(opts)
  p status_code # => 2xx
  p headers # => { ... }
  p data # => <GetTransacEmailsList>
rescue Brevo::ApiError => e
  puts "Error when calling TransactionalEmailsApi->get_transac_emails_list_with_http_info: #{e}"
end

Parameters

Name Type Description Notes
email String Mandatory if templateId and messageId are not passed in query filters. Email address to which transactional email has been sent. [optional]
template_id Integer Mandatory if email and messageId are not passed in query filters. Id of the template that was used to compose transactional email. [optional]
message_id String Mandatory if templateId and email are not passed in query filters. Message ID of the transactional email sent. [optional]
start_date String Mandatory if endDate is used. Starting date (YYYY-MM-DD) from which you want to fetch the list. Maximum time period that can be selected is one month. [optional]
end_date String Mandatory if startDate is used. Ending date (YYYY-MM-DD) till which you want to fetch the list. Maximum time period that can be selected is one month. [optional]
sort String Sort the results in the ascending/descending order of record creation. Default order is descending if `sort` is not passed [optional][default to 'desc']
limit Integer Number of documents returned per page [optional][default to 500]
offset Integer Index of the first document in the page [optional][default to 0]

Return type

GetTransacEmailsList

Authorization

api-key

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

send_test_template

send_test_template(template_id, send_test_email)

Send a template to your test list

Examples

require 'time'
require 'brevo'
# setup authorization
Brevo.configure do |config|
  # Configure API key authorization: api-key
  config.api_key['api-key'] = 'YOUR API KEY'
  # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
  # config.api_key_prefix['api-key'] = 'Bearer'
end

api_instance = Brevo::TransactionalEmailsApi.new
template_id = 789 # Integer | Id of the template
send_test_email = Brevo::SendTestEmail.new # SendTestEmail | 

begin
  # Send a template to your test list
  api_instance.send_test_template(template_id, send_test_email)
rescue Brevo::ApiError => e
  puts "Error when calling TransactionalEmailsApi->send_test_template: #{e}"
end

Using the send_test_template_with_http_info variant

This returns an Array which contains the response data (nil in this case), status code and headers.

<Array(nil, Integer, Hash)> send_test_template_with_http_info(template_id, send_test_email)

begin
  # Send a template to your test list
  data, status_code, headers = api_instance.send_test_template_with_http_info(template_id, send_test_email)
  p status_code # => 2xx
  p headers # => { ... }
  p data # => nil
rescue Brevo::ApiError => e
  puts "Error when calling TransactionalEmailsApi->send_test_template_with_http_info: #{e}"
end

Parameters

Name Type Description Notes
template_id Integer Id of the template
send_test_email SendTestEmail

Return type

nil (empty response body)

Authorization

api-key

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

send_transac_email

send_transac_email(send_smtp_email)

Send a transactional email

Examples

require 'time'
require 'brevo'
# setup authorization
Brevo.configure do |config|
  # Configure API key authorization: api-key
  config.api_key['api-key'] = 'YOUR API KEY'
  # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
  # config.api_key_prefix['api-key'] = 'Bearer'
end

api_instance = Brevo::TransactionalEmailsApi.new
send_smtp_email = Brevo::SendSmtpEmail.new # SendSmtpEmail | Values to send a transactional email

begin
  # Send a transactional email
  result = api_instance.send_transac_email(send_smtp_email)
  p result
rescue Brevo::ApiError => e
  puts "Error when calling TransactionalEmailsApi->send_transac_email: #{e}"
end

Using the send_transac_email_with_http_info variant

This returns an Array which contains the response data, status code and headers.

<Array(, Integer, Hash)> send_transac_email_with_http_info(send_smtp_email)

begin
  # Send a transactional email
  data, status_code, headers = api_instance.send_transac_email_with_http_info(send_smtp_email)
  p status_code # => 2xx
  p headers # => { ... }
  p data # => <CreateSmtpEmail>
rescue Brevo::ApiError => e
  puts "Error when calling TransactionalEmailsApi->send_transac_email_with_http_info: #{e}"
end

Parameters

Name Type Description Notes
send_smtp_email SendSmtpEmail Values to send a transactional email

Return type

CreateSmtpEmail

Authorization

api-key

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

smtp_blocked_contacts_email_delete

smtp_blocked_contacts_email_delete(email)

Unblock or resubscribe a transactional contact

Examples

require 'time'
require 'brevo'
# setup authorization
Brevo.configure do |config|
  # Configure API key authorization: api-key
  config.api_key['api-key'] = 'YOUR API KEY'
  # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
  # config.api_key_prefix['api-key'] = 'Bearer'
end

api_instance = Brevo::TransactionalEmailsApi.new
email = 'email_example' # String | contact email (urlencoded) to unblock.

begin
  # Unblock or resubscribe a transactional contact
  api_instance.smtp_blocked_contacts_email_delete(email)
rescue Brevo::ApiError => e
  puts "Error when calling TransactionalEmailsApi->smtp_blocked_contacts_email_delete: #{e}"
end

Using the smtp_blocked_contacts_email_delete_with_http_info variant

This returns an Array which contains the response data (nil in this case), status code and headers.

<Array(nil, Integer, Hash)> smtp_blocked_contacts_email_delete_with_http_info(email)

begin
  # Unblock or resubscribe a transactional contact
  data, status_code, headers = api_instance.smtp_blocked_contacts_email_delete_with_http_info(email)
  p status_code # => 2xx
  p headers # => { ... }
  p data # => nil
rescue Brevo::ApiError => e
  puts "Error when calling TransactionalEmailsApi->smtp_blocked_contacts_email_delete_with_http_info: #{e}"
end

Parameters

Name Type Description Notes
email String contact email (urlencoded) to unblock.

Return type

nil (empty response body)

Authorization

api-key

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

smtp_log_identifier_delete

smtp_log_identifier_delete(identifier)

Delete an SMTP transactional log

Examples

require 'time'
require 'brevo'
# setup authorization
Brevo.configure do |config|
  # Configure API key authorization: api-key
  config.api_key['api-key'] = 'YOUR API KEY'
  # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
  # config.api_key_prefix['api-key'] = 'Bearer'
end

api_instance = Brevo::TransactionalEmailsApi.new
identifier = 'identifier_example' # String | MessageId or Email of the transactional log(s) to delete

begin
  # Delete an SMTP transactional log
  api_instance.smtp_log_identifier_delete(identifier)
rescue Brevo::ApiError => e
  puts "Error when calling TransactionalEmailsApi->smtp_log_identifier_delete: #{e}"
end

Using the smtp_log_identifier_delete_with_http_info variant

This returns an Array which contains the response data (nil in this case), status code and headers.

<Array(nil, Integer, Hash)> smtp_log_identifier_delete_with_http_info(identifier)

begin
  # Delete an SMTP transactional log
  data, status_code, headers = api_instance.smtp_log_identifier_delete_with_http_info(identifier)
  p status_code # => 2xx
  p headers # => { ... }
  p data # => nil
rescue Brevo::ApiError => e
  puts "Error when calling TransactionalEmailsApi->smtp_log_identifier_delete_with_http_info: #{e}"
end

Parameters

Name Type Description Notes
identifier String MessageId or Email of the transactional log(s) to delete

Return type

nil (empty response body)

Authorization

api-key

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

update_smtp_template

update_smtp_template(template_id, update_smtp_template)

Update an email template

Examples

require 'time'
require 'brevo'
# setup authorization
Brevo.configure do |config|
  # Configure API key authorization: api-key
  config.api_key['api-key'] = 'YOUR API KEY'
  # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
  # config.api_key_prefix['api-key'] = 'Bearer'
end

api_instance = Brevo::TransactionalEmailsApi.new
template_id = 789 # Integer | id of the template
update_smtp_template = Brevo::UpdateSmtpTemplate.new # UpdateSmtpTemplate | values to update in transactional email template

begin
  # Update an email template
  api_instance.update_smtp_template(template_id, update_smtp_template)
rescue Brevo::ApiError => e
  puts "Error when calling TransactionalEmailsApi->update_smtp_template: #{e}"
end

Using the update_smtp_template_with_http_info variant

This returns an Array which contains the response data (nil in this case), status code and headers.

<Array(nil, Integer, Hash)> update_smtp_template_with_http_info(template_id, update_smtp_template)

begin
  # Update an email template
  data, status_code, headers = api_instance.update_smtp_template_with_http_info(template_id, update_smtp_template)
  p status_code # => 2xx
  p headers # => { ... }
  p data # => nil
rescue Brevo::ApiError => e
  puts "Error when calling TransactionalEmailsApi->update_smtp_template_with_http_info: #{e}"
end

Parameters

Name Type Description Notes
template_id Integer id of the template
update_smtp_template UpdateSmtpTemplate values to update in transactional email template

Return type

nil (empty response body)

Authorization

api-key

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json