Skip to content

Latest commit

 

History

History
1390 lines (988 loc) · 48.9 KB

TransactionalEmailsApi.md

File metadata and controls

1390 lines (988 loc) · 48.9 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_batch_id GET /smtp/emailStatus/{batchId} Fetch scheduled emails by batchId
get_scheduled_email_by_message_id GET /smtp/emailStatus/{messageId} Fetch scheduled email by 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

Example

# load the gem
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'

  # Configure API key authorization: partner-key
  config.api_key['partner-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['partner-key'] = 'Bearer'
end

api_instance = Brevo::TransactionalEmailsApi.new

block_domain = Brevo::BlockDomain.new # BlockDomain | 


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

Parameters

Name Type Description Notes
block_domain BlockDomain

Return type

nil (empty response body)

Authorization

api-key, partner-key

HTTP request headers

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

create_smtp_template

CreateModel create_smtp_template(smtp_template)

Create an email template

Example

# load the gem
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'

  # Configure API key authorization: partner-key
  config.api_key['partner-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['partner-key'] = 'Bearer'
end

api_instance = Brevo::TransactionalEmailsApi.new

smtp_template = Brevo::CreateSmtpTemplate.new # CreateSmtpTemplate | values to update in transactional email template


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

Parameters

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

Return type

CreateModel

Authorization

api-key, partner-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

Example

# load the gem
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'

  # Configure API key authorization: partner-key
  config.api_key['partner-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['partner-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 "Exception when calling TransactionalEmailsApi->delete_blocked_domain: #{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, partner-key

HTTP request headers

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

delete_hardbounces

delete_hardbounces(opts)

Delete hardbounces

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

Example

# load the gem
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'

  # Configure API key authorization: partner-key
  config.api_key['partner-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['partner-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 "Exception when calling TransactionalEmailsApi->delete_hardbounces: #{e}"
end

Parameters

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

Return type

nil (empty response body)

Authorization

api-key, partner-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

Example

# load the gem
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'

  # Configure API key authorization: partner-key
  config.api_key['partner-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['partner-key'] = 'Bearer'
end

api_instance = Brevo::TransactionalEmailsApi.new

identifier = 'identifier_example' # 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 "Exception when calling TransactionalEmailsApi->delete_scheduled_email_by_id: #{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, partner-key

HTTP request headers

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

delete_smtp_template

delete_smtp_template(template_id)

Delete an inactive email template

Example

# load the gem
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'

  # Configure API key authorization: partner-key
  config.api_key['partner-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['partner-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 "Exception when calling TransactionalEmailsApi->delete_smtp_template: #{e}"
end

Parameters

Name Type Description Notes
template_id Integer id of the template

Return type

nil (empty response body)

Authorization

api-key, partner-key

HTTP request headers

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

get_aggregated_smtp_report

GetAggregatedReport 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

Example

# load the gem
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'

  # Configure API key authorization: partner-key
  config.api_key['partner-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['partner-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 "Exception when calling TransactionalEmailsApi->get_aggregated_smtp_report: #{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, partner-key

HTTP request headers

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

get_blocked_domains

GetBlockedDomains get_blocked_domains

Get the list of blocked domains

Get the list of blocked domains

Example

# load the gem
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'

  # Configure API key authorization: partner-key
  config.api_key['partner-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['partner-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 "Exception when calling TransactionalEmailsApi->get_blocked_domains: #{e}"
end

Parameters

This endpoint does not need any parameter.

Return type

GetBlockedDomains

Authorization

api-key, partner-key

HTTP request headers

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

get_email_event_report

GetEmailEventReport 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

Example

# load the gem
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'

  # Configure API key authorization: partner-key
  config.api_key['partner-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['partner-key'] = 'Bearer'
end

api_instance = Brevo::TransactionalEmailsApi.new

opts = { 
  limit: 2500, # Integer | Number limitation for the result returned
  offset: 0, # 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: 'event_example', # 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: 'desc' # 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 "Exception when calling TransactionalEmailsApi->get_email_event_report: #{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, partner-key

HTTP request headers

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

get_scheduled_email_by_batch_id

GetScheduledEmailByBatchId get_scheduled_email_by_batch_id(batch_id, opts)

Fetch scheduled emails by batchId

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

Example

# load the gem
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'

  # Configure API key authorization: partner-key
  config.api_key['partner-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['partner-key'] = 'Bearer'
end

api_instance = Brevo::TransactionalEmailsApi.new

batch_id = 'batch_id_example' # String | The batchId of scheduled emails batch (Should be a valid UUIDv4)

opts = { 
  start_date: Date.parse('2013-10-20'), # 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('2013-10-20'), # 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: 'desc', # String | Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed
  status: 'status_example', # String | Filter the records by `status` of the scheduled email batch or message.
  limit: 100, # Integer | Number of documents returned per page
  offset: 0 # Integer | Index of the first document on the page
}

begin
  #Fetch scheduled emails by batchId
  result = api_instance.get_scheduled_email_by_batch_id(batch_id, opts)
  p result
rescue Brevo::ApiError => e
  puts "Exception when calling TransactionalEmailsApi->get_scheduled_email_by_batch_id: #{e}"
end

Parameters

Name Type Description Notes
batch_id String The batchId of scheduled emails batch (Should be a valid UUIDv4)
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 [optional] [default to desc]
status String Filter the records by `status` of the scheduled email batch or message. [optional]
limit Integer Number of documents returned per page [optional] [default to 100]
offset Integer Index of the first document on the page [optional] [default to 0]

Return type

GetScheduledEmailByBatchId

Authorization

api-key, partner-key

HTTP request headers

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

get_scheduled_email_by_message_id

GetScheduledEmailByMessageId get_scheduled_email_by_message_id(message_id, opts)

Fetch scheduled email by messageId

Fetch scheduled email by messageId (Can retrieve data upto 30 days old)

Example

# load the gem
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'

  # Configure API key authorization: partner-key
  config.api_key['partner-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['partner-key'] = 'Bearer'
end

api_instance = Brevo::TransactionalEmailsApi.new

message_id = 'message_id_example' # String | The messageId of scheduled email

opts = { 
  start_date: Date.parse('2013-10-20'), # 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('2013-10-20') # 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.
}

begin
  #Fetch scheduled email by messageId
  result = api_instance.get_scheduled_email_by_message_id(message_id, opts)
  p result
rescue Brevo::ApiError => e
  puts "Exception when calling TransactionalEmailsApi->get_scheduled_email_by_message_id: #{e}"
end

Parameters

Name Type Description Notes
message_id String 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]

Return type

GetScheduledEmailByMessageId

Authorization

api-key, partner-key

HTTP request headers

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

get_smtp_report

GetReports get_smtp_report(opts)

Get your transactional email activity aggregated per day

Example

# load the gem
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'

  # Configure API key authorization: partner-key
  config.api_key['partner-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['partner-key'] = 'Bearer'
end

api_instance = Brevo::TransactionalEmailsApi.new

opts = { 
  limit: 10, # Integer | Number of documents returned per page
  offset: 0, # 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: 'desc' # 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 "Exception when calling TransactionalEmailsApi->get_smtp_report: #{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, partner-key

HTTP request headers

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

get_smtp_template

GetSmtpTemplateOverview get_smtp_template(template_id)

Returns the template information

Example

# load the gem
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'

  # Configure API key authorization: partner-key
  config.api_key['partner-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['partner-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 "Exception when calling TransactionalEmailsApi->get_smtp_template: #{e}"
end

Parameters

Name Type Description Notes
template_id Integer id of the template

Return type

GetSmtpTemplateOverview

Authorization

api-key, partner-key

HTTP request headers

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

get_smtp_templates

GetSmtpTemplates get_smtp_templates(opts)

Get the list of email templates

Example

# load the gem
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'

  # Configure API key authorization: partner-key
  config.api_key['partner-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['partner-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: 50, # Integer | Number of documents returned per page
  offset: 0, # Integer | Index of the first document in the page
  sort: 'desc' # 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 "Exception when calling TransactionalEmailsApi->get_smtp_templates: #{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, partner-key

HTTP request headers

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

get_transac_blocked_contacts

GetTransacBlockedContacts get_transac_blocked_contacts(opts)

Get the list of blocked or unsubscribed transactional contacts

Example

# load the gem
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'

  # Configure API key authorization: partner-key
  config.api_key['partner-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['partner-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: 50, # Integer | Number of documents returned per page
  offset: 0, # Integer | Index of the first document on the page
  senders: ['senders_example'], # Array<String> | Comma separated list of emails of the senders from which contacts are blocked or unsubscribed
  sort: 'desc' # 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 "Exception when calling TransactionalEmailsApi->get_transac_blocked_contacts: #{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, partner-key

HTTP request headers

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

get_transac_email_content

GetTransacEmailContent get_transac_email_content(uuid)

Get the personalized content of a sent transactional email

Example

# load the gem
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'

  # Configure API key authorization: partner-key
  config.api_key['partner-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['partner-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 "Exception when calling TransactionalEmailsApi->get_transac_email_content: #{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, partner-key

HTTP request headers

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

get_transac_emails_list

GetTransacEmailsList 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.

Example

# load the gem
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'

  # Configure API key authorization: partner-key
  config.api_key['partner-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['partner-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: 'desc', # String | Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed
  limit: 500, # Integer | Number of documents returned per page
  offset: 0 # 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 "Exception when calling TransactionalEmailsApi->get_transac_emails_list: #{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, partner-key

HTTP request headers

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

send_test_template

send_test_template(template_id, send_test_email)

Send a template to your test list

Example

# load the gem
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'

  # Configure API key authorization: partner-key
  config.api_key['partner-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['partner-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 "Exception when calling TransactionalEmailsApi->send_test_template: #{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, partner-key

HTTP request headers

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

send_transac_email

CreateSmtpEmail send_transac_email(send_smtp_email)

Send a transactional email

Example

# load the gem
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'

  # Configure API key authorization: partner-key
  config.api_key['partner-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['partner-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 "Exception when calling TransactionalEmailsApi->send_transac_email: #{e}"
end

Parameters

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

Return type

CreateSmtpEmail

Authorization

api-key, partner-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

Example

# load the gem
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'

  # Configure API key authorization: partner-key
  config.api_key['partner-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['partner-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 "Exception when calling TransactionalEmailsApi->smtp_blocked_contacts_email_delete: #{e}"
end

Parameters

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

Return type

nil (empty response body)

Authorization

api-key, partner-key

HTTP request headers

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

smtp_log_identifier_delete

smtp_log_identifier_delete(identifier)

Delete an SMTP transactional log

Example

# load the gem
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'

  # Configure API key authorization: partner-key
  config.api_key['partner-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['partner-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 "Exception when calling TransactionalEmailsApi->smtp_log_identifier_delete: #{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, partner-key

HTTP request headers

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

update_smtp_template

update_smtp_template(template_id, smtp_template)

Update an email template

Example

# load the gem
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'

  # Configure API key authorization: partner-key
  config.api_key['partner-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['partner-key'] = 'Bearer'
end

api_instance = Brevo::TransactionalEmailsApi.new

template_id = 789 # Integer | id of the template

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, smtp_template)
rescue Brevo::ApiError => e
  puts "Exception when calling TransactionalEmailsApi->update_smtp_template: #{e}"
end

Parameters

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

Return type

nil (empty response body)

Authorization

api-key, partner-key

HTTP request headers

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