Resend invoice by email notification (Deprecated)#

This service is deprecated and will be removed on June 30, 2023.

Use the service with the correct name “sendAdditionalNotifications”.

To check the correct service, click here.

Use this service to resend invoices by email notification.

Service steps#

  1. Get a token from your credentials by calling the service Account/getToken;

  2. Resend notifications calling the service OutboundFinancialDocumentMaintenance/sendAditionalNotifications;

Response structure from server#

When a request is well formed and the authentication data is correct the system responds with a message envelope as follows:

	"CorrelationId": "<GUID>", /* for correlation purposes */
	"IsValid": true,           /* false in case of erros */
	"Errors": [],              /* if empty is a good signal */
	"Data": "<Service Response Data>"   /* the data retuned ex: token, invoice status, dependent on the service called */

1. Get a token (Account/getToken)#

Credentials have be given to you, according to your registration at SANDBOX or Saphety Invoice Network:

  • For Test purposes, the user and password defined at SANDBOX registration

  • For Production, the user and password defined at Saphety Invoice Network registration

Use those credentials to get a token at:

# SANDBOX - Test Environment
server_base_adress = ""

# Saphety Invoice Network - Production Environment
#server_base_adress = ""
import requests
import json

# SIN account service url
service_url = "https://" + server_base_adress + "/api/Account/getToken"

# the username and password you registerd in SIN
username = '[email protected]'
password = 'request_password'

# auhtentication data goes in payload as json
payload = {
      'Username': username,
      'Password': password
# payload goes in json, serialize the payloal object to json
# indicate in header that payload is json
headers = {
    'content-type': 'application/json'
# POST request to get a token
response = requests.request("POST", service_url, data=request_data, headers=headers)

* Note: the credentials (user and password) in this documentation were created by Saphety and can only be used in the SANDBOX environment. For tests we recommend that you use the credentials you obtained when registering with the SANDBOX.

# formating the response to json for visualization purposes only
json_response = json.loads(response.text)
print(json.dumps(json_response, indent=4))
    "CorrelationId": "1662af78-5df4-4f55-ab3e-bb071758976d",
    "IsValid": true,
    "Errors": [],
    "Data": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJuYW1laWQiOiJzaW5fYXBpX2RvY3VtZW50YXRpb25fdXNlckBzYXBoZXR5LmNvbSIsInVuaXF1ZV9uYW1lIjoic2luX2FwaV9kb2N1bWVudGF0aW9uX3VzZXJAc2FwaGV0eS5jb20iLCJzeXN0ZW1fYWRtaW4iOiJGYWxzZSIsInNlc3Npb25faWQiOiJkMjExOWZjOC03NzE0LTRmMzktOTdiNy0yOWU4Mzg5NGM5OGQiLCJjcCI6InNpbl9hcGlfZG9jdW1lbnRhdGlvbl91c2VyQHNhcGhldHkuY29tIiwicmwiOiJEZXZlbG9wZXIiLCJuYmYiOjE2NjY5Nzc5NDIsImV4cCI6MTY2NzAwNjc0MiwiaWF0IjoxNjY2OTc3ODgyLCJpc3MiOiJodHRwczovL3d3dy5zYXBoZXR5LmNvbS8iLCJhdWQiOiJodHRwczovL3d3dy5zYXBoZXR5LmNvbS9EY25TYW5kYm94In0.75FN56wQQXbSlzD6L3OgY1RosRrG_5r58MgfYFdKmNg"
# your token is at:
token = json_response["Data"];
print (token)

2. Resend PDF invoice notifications (OutboundFinancialDocumentMaintenance/sendAditionalNotifications)#

Build the service endpoint url#

In the service url you don’t need to supply anything.

# SIN service ur
service_url = """{ServerBaseUrl}/api/OutboundFinancialDocumentMaintenance/sendAditionalNotifications""".format(
service_url = "https://" + service_url
print (service_url)

Build the service body#

In the service body you need to supply some data.

  • OutboundFinancialDocumentId
    Set the OutboundFinancialDocumentId to your document.

  • DestinationEmails

    • Email: Set the client/receiver email address to send the notification

    • SendAttachment: Set whether the PDF is sent as an attachment in the notification. Allowed values for this parameter: True, False.

    • LanguageCode: Set the notification language. Format is ISO 639-1 (ex: pt)

headers = {
    'Content-Type': 'application/json',
    'Authorization': 'bearer ' + token
# payload as json
payload = {
  'OutboundFinancialDocumentId': 'fc5e547d-8537-4e05-97d5-1159c62efd6f',
  'DestinationEmails': [{
    'Email': '[email protected]',
    'SendAttachment': True,
    'LanguageCode': 'PT'

* Note : in the Sandbox environment, the notifications are sent only for the user registration email, even if within the service payload are displayed other email addresses.

Call the service resend notifications#

You will call the service endpoint url

# Send the request (POST).
response = requests.request("POST", service_url, data=request_data, headers=headers)

# formating the response to json for visualization purposes only
json_response = json.loads(response.text)
print(json.dumps(json_response, indent=4))
    "CorrelationId": "4f6b4d89-13a0-4993-b118-f16a15ade90f",
    "IsValid": true,
    "Errors": [],
    "Data": [
        "[email protected]"

Read the service response#

Now you need to read the service response and see the email send

# for loop to see all Data
formats = json_response["Data"];
print(json.dumps(formats, indent=4))