Send real letters from the Internet to anywhere in the world.
# Wednesday, April 17, 2024

Microsoft Power Automate is a process automation platform which makes automating repetitive tasks with little or no code..

If you have a Microsoft 365 subscription you probably already have access to Power Automate. Check your subscription or talk to your Microsoft partner for more details.

You may be able to automate processes such as picking up when addresses are added to a an Excel spreadsheet and then sending a PDF letter to that address that sits in SharePoint or in OneDrive.

You can send your letters to PC2Paper using Power Automate and our RESTFul JSON API by following these steps below.

In the example below we’ve setup a new Flow in Power Automate with a Manual Trigger. We are getting a PDF file to use, using the OneDrive for Business Action. You can use any action you’d like to provide a file for upload.


Add the Manual Trigger flow (you can use a different one here depending on the process you are after) and the OneDrive for Business Get File Content Action below it. If there is another Action you’d prefer to use you can use that instead. 

Uploading a PDF

We have used the HTTP Action to upload our PDF file add this below the One Drive for Business Get File Content Action. You can search for it as HTTP in the action search box, you will want the plain HTTP adaptor.


Once added you can rename this adaptor to “Upload File”


Enter the following details

  • Method: Set this to POST
  • Headers: Add the following headers and place your PC2Paper username and password (or API keys) into them
    • username
    • password
  • Queries: Over here you will want to enter “fileName” and in the value field give your file a name. You can enter anything in here and you can populate this from a previous action if you have one.
  • Body: For the body you will want to enter the following JSON

      "$content-type": "multipart/form-data",
      "$multipart": [
          "headers": {
            "Content-Disposition": "form-data: name=\"file[data]\";filename=\"testfile.pdf\""
          "body": @{body('Get_file_content')}

    Where you see this tag @{body('Get_file_content')} you will want to drag in the content from the OneDrive Action that ran before this action. You select this from the little lightening bolt that appears next to the Body text box when you click in it.


Parse the results from the PDF Upload

After you have completed the previous step you will want to add a “Parse JSON” action. We will use this to parse the JSON returned by the upload file action.


Schema: Enter the following text into the schema box.

    "type": "object",
    "properties": {
        "fileGuid": {
             "type": "string"
        "pages": {
            "type": "integer"

Content: Select the content box and then select the lightening bolt that appears next to it and select (as per the image above) the Body field from the Upload File step you did previously.

Submit Letter

Now for the final Action


Add another HTTP Action after the “Parse JSON” Action.

Enter the following details

  • Method: Select POST
  • Body: This is the same JSON example used in our JSON API example found here. Insert the below JSON into the body text

      "letterForPosting": {
        "SourceClient": "Power Automate",
        "Addresses": [
            "ReceiverName": "John Smith",
            "ReceiverAddressLine1": "1 Acme Road",
            "ReceiverAddressLine2": "My Street",
            "ReceiverAddressTownCityOrLine3": "Town",
            "ReceiverAddressCountyStateOrLine4": "County",
            "ReceiverAddressPostCode": "Postcode"
        "ReceiverCountryCode": 1,
        "Postage": 31,
        "Paper": 1,
        "Envelope": 1,
        "Extras": 0,
        "LetterBody": "Dear John, Please find my letter attached",
        "IncludeSenderAddressOnEnvelope": true,
        "SenderAddress": "22 Acme Acres\n Acme Town",
        "YourRef": "MyRef001",
        "FileAttachementGUIDs": [
      "username": "username here",
      "password": "password here"

    Ensure you changing the following in the JSON. You can read more about these fields here

    username and password: Make sure you update these with your own this can also be your API key and API secret
    FileAttachementGUIDs: For this you want to replace @{body('Parse_JSON')?['fileGuid']} with “Body fileGuid” from your Parse JSON action


    Note you can find out more about postage options and country codes in the documentation found here. The postage codes can be found using our postal calculator for a quick lookup


That’s it. Please remember to always test your integration signing up for a free test account on you can top up your free test account with the following card number 5555558265554449 (this is not a real card number as it is a test environment), use made up details for the rest of the top-up process. You can then see if the letters you send come through to your test account. Remember to change the test endpoints to our live server when you are done by changing https://test to https://www .

posted on Wednesday, April 17, 2024 8:30:11 AM (GMT Daylight Time, UTC+01:00)  #    Trackback
# Sunday, July 31, 2016

Below is an example of using our JSON API to send a letter.

Our JSON API has exactly the same fields as our SOAP API and uses the same functionality as our SOAP API.

In the example below we are sending a letter to one person with the body included as free text. You may also use HTML to format the body of your letter. The JSON below could quite easily be used straight from JavaScript or from nodejs, but could just as well be used from almost any coding language. The endpoint to post your JSON to is

    "SourceClient" : "My App name 1",
    "Addresses" :[
        {"ReceiverName": "John Smith",
        "ReceiverAddressLine1" : "1 Acme Road",
        "ReceiverAddressLine2" : "My Street",
        "ReceiverAddressTownCityOrLine3" : "Town",
        "ReceiverAddressCountyStateOrLine4" : "County",
        "ReceiverAddressPostCode" : "Postcode"}
        "ReceiverCountryCode" :1,
        "LetterBody" : "Dear Peter, 
Please find my letter attached"
        "IncludeSenderAddressOnEnvelope" : true,
        "SenderAddress" : "22 Acme Acres\n Acme Town",
        "YourRef" : "MyRef001" 
     "username" : "yourusername",
    "password" : "yourpassword"

In the above examples you will notice we use a ReceiverCountryCode you can lookup the code to use for the country you are sending to here. In the above example the country code 1 represents the UK.

For the postage options you can lookup the options you would like to use by using our postage calculator. The postage calculator will list the API options at the bottom of the page for you after you make your selection.  In the example above we have chosen Postage 31 (UK Second Class), Paper 1 (Black and White 80 gsm), Envelope 1 (Standard DL). If you would like the ability to lookup your own postage options, you can use our letter pricing API which you can find out more about here

If you'd like to include PDF's as attachment's to your letter, you can upload these and use the unique id's the website gives you to attach them to your letter.

You can upload PDF's one of three ways.


This is probably one of the easiest ways to upload your file submitting your file over HTTP POST. Simple call

In the headers of your HTTP POST place the following

  • username - This will be your PC2Paper username or API key
  • password - This will be your PC2Paper password or API secret

You will recieve a response that contains the GUID for your PDF and how many pages it has.

JSON PDF File Upload

With a JSON file upload you will need to convert what ever file you are uploading into an integer array. This can usually be done by converting your file into a byte array and then into an integer array



After successfully uploading your PDF file you should receive a response similar to the following.

  "d": {
    "__type": "UploadedFileResult:#PC2Paper.Entity.Public.Letters",
    "ErrorMessages": null,
    "FileCreatedGUID": "648b6725-a3c6-4396-b28a-33e86589aa4b",
    "Status": "OK"

Store the FileCreatedGUID somewhere as you will need this to attach it to your letter. 

SOAP PDF File Upload

If you would prefer to upload your PDF file over SOAP instead of JSON you can use this endpoint.

You can find a PHP example and C# example of how to use our SOAP API to upload a file.

Using an uploaded PDF file in your letter

After you have uploaded your PDF file using one of the two methods above you will be provided with a FileCreatedGUID for each file you upload. Construct the JSON for your letter as before but include an array of File GUIDs you would like to attach in the FileAttachementGUIDs field.

    "SourceClient" : "My PC2Paper Client",
    "Addresses" :[
        {"ReceiverName": "John Smith",
        "ReceiverAddressLine1" : "1 Acme Road",
        "ReceiverAddressLine2" : "My Street",
        "ReceiverAddressTownCityOrLine3" : "Town",
        "ReceiverAddressCountyStateOrLine4" : "County",
        "ReceiverAddressPostCode" : "Postcode"}
        "ReceiverCountryCode" :1,
        "LetterBody" : "Dear Peter, 
Please find my letter attached"
     "username" : "your username",
    "password" : "yourpassword"

You should receive the following response after submitting a successful letter.

  "d": {
    "__type": "LetterForPostingResult:#PC2Paper.Entity.Public.Letters",
    "CostOfLetter": 2.02,
    "ErrorMessages": null,
    "FundsLeftInYourAccount": 160.54,
    "LetterId": "71566",
    "Status": "OK"

Sending a letter to more than one person

If you would like to send the same letter to more than one person. Just add more people to the Addresses array.

 "Addresses" :[
        {"ReceiverName": "John Smith",
        "ReceiverAddressLine1" : "1 Acme Road",
        "ReceiverAddressLine2" : "My Street",
        "ReceiverAddressTownCityOrLine3" : "Town",
        "ReceiverAddressCountyStateOrLine4" : "County",
        "ReceiverAddressPostCode" : "Postcode"},
         {"ReceiverName": "Bob Smith",
        "ReceiverAddressLine1" : "The Gables",
        "ReceiverAddressLine2" : "Another Road",
        "ReceiverAddressTownCityOrLine3" : "Town",
        "ReceiverAddressCountyStateOrLine4" : "County",
        "ReceiverAddressPostCode" : "ZZ1 0ZZ"}
posted on Sunday, July 31, 2016 6:59:08 PM (GMT Daylight Time, UTC+01:00)  #    Trackback
# Wednesday, August 21, 2013

We've had several requests for an example on using our SOAP API, so decided to throw one together for you to get an idea of how it works.

The example below will send PDF documents as a letter with a cover letter which is written as a formatted HTML string (see the LetterBody attribute below).

To make more use of this example and to adapt it to your needs you may need to look at the Letter Pricing API along with the country code list which can all be found here.

If you would like us to advise you on what are the best options to use for postage and paper usage please contact us.

   1:  <?php
   3:  $client = new SoapClient("");
   5:  // Your PC2Paper Username and Password go below
   6:  $pc2paperUsername = "username";
   7:  $pc2paperPassword = "password";
   9:  //First we upload a PDF we wish to attach to our letter
  11:  $file = file_get_contents("C:\tempfiles\mytestfile.pdf");
  13:  //We give the pdf a friendly name
  14:  $parametersUpload->filename = "mytestFile.pdf";
  15:  $parametersUpload->fileContent = $file;
  16:  $parametersUpload->username=$pc2paperUsername;
  17:  $parametersUpload->password=$pc2paperPassword;
  19:  //We submit our PDF to PC2Paper
  20:  $uploadedFileResult = $client->UploadDocument($parametersUpload);
  22:  // Not the above return value contains the following
  23:  // $uploadedFileResult->UploadDocumentResult->ErrorMessages  (A a string array of any errors that took place)
  24:  // $uploadedFileResult->UploadDocumentResult->FileCreatedGUID (The created files GUID)0
  25:  // $uploadedFileResult->UploadDocumentResult->Status (OK or ERROR, if error check ErrorMessages array
  27:  //After our PDF has been submited we get a GUID which we store in an array to use with our letter below.
  28:  //Note you can attach multiple PDF's to your letter by adding to this array.
  29:  $fileGuidArray =  array($uploadedFileResult->UploadDocumentResult->FileCreatedGUID);
  32:  // ********** The actual Letter.
  33:  // We put an address together
  34:  $address->ReceiverName = "Tom Smith";
  35:  $address->ReceiverAddressLine1 = "Line 1 ";
  36:  $address->ReceiverAddressLine2 = "Line 2";
  37:  $address->ReceiverAddressTownCityOrLine3 = "My Town";
  38:  $address->ReceiverAddressCountyStateOrLine4 = "County";
  39:  $address->ReceiverAddressPostCode = "ZZ1 2ZZ";
  41:  // Add the address to an address array
  42:  $addressArray = array($address);
  44:  //Add the address array to our letter
  45:  $letter->Addresses = $addressArray ;
  47:  //Setup our postage options (use the LetterPosting API for these values 
  48:  //or ask us and we will be happy to provide the values based on your needs)
  51:  // 1=UK , 240=US for a list of more please refer to country.csv file from the API section of our website.
  52:  $letter->ReceiverCountryCode = 1; 
  54:  $letter->IncludeSenderAddressOnEnvelope = true;
  55:  $letter->Postage = 3; //UK First Class
  56:  $letter->Paper = 1;  // B&W Single Sides print
  57:  $letter->Extras = 0;
  58:  $letter->Envelope = 1; //Simple DL envelope
  59:  $letter->Pages = 2;
  60:  $letter->FileAttachementGUIDs = $fileGuidArray;
  62:  $letter->SenderAddress = "Peter Smith\nMy Town";
  64:  //This is the cover letter of your letter. Leave this null if you do not want a cover letter
  65:  //You may use formatted HTML in here to format your letter.
  66:  $letter->LetterBody = "<p>Hi Tom,</p> <p>This is a letter sent from PHP!</p>";
  69:  $parameters->letterForPosting = $letter;
  71:  // Your PC2Paper username and password
  72:  $parameters->username = $pc2paperUsername;
  73:  $parameters->password = $pc2paperPassword;
  75:  $result = $client->SendSubmitLetterForPosting($parameters);
  77:  // The return object will give you the following
  78:  // $result->SendSubmitLetterForPostingResult->CostOfLetter
  79:  // $result->SendSubmitLetterForPostingResult->ErrorMessages  (any errors that took place)
  80:  // $result->SendSubmitLetterForPostingResult->FundsLeftInYourAccount
  81:  // $result->SendSubmitLetterForPostingResult->LetterId
  82:  // $result->SendSubmitLetterForPostingResult->Status (OK if everything went ok or ERROR, if error check the ErrorMessages array)
  85:  print_r($result);
  86:  ?>
posted on Wednesday, August 21, 2013 9:02:50 PM (GMT Daylight Time, UTC+01:00)  #    Trackback
# Monday, August 5, 2013

We've just released a beta version of our new SOAP API which harnesses many of the features found in our recently launched Letter 2.0 writing interface.

The API enables you to:

  • Send the same letter to multiple recipient
  • Attach multiple PDF's to a letter
  • Add a cover (written in HTML) with or without PDF's

More documentation will follow soon, but for now here is an example for using the API.

The endpoint for the service can be found here
to access the WSDL simply go here

Please note the service endpoint talks about svcutil.exe, this is only applicable to Microsoft WCF users. Please also note that SOAP is a widely used XML-based protocol, it is assumed at all times that the developer is aware of SOAP or has used it. It is beyond the scope of this article to explain SOAP. If you are using .NET you can take advantage of the features available to you in WCF, if not you can still use the service as a bog standard soap service from any of the popular languages such as PHP, C#, Ruby, Delphi, Java etc. by just using the WSDL ( )

The example in this article uses C#, we will cover using the service from other languages in future, for now here are some links about SOAP in those languages.

The following example illustrates how to upload a PDF attachment and write a cover letter with our new API the sample below is in C# using Visual Studio .NET. More examples in other languages will follow.

Firstly add a new service reference to your project, ensure you use https in the service address as below.


The code for the example is below. As with our other interfaces, in order to get the correct envelope, paper, print type and postage type please refer to our Letter Pricing API or contact us with your requirements and we will be more than happy to provide suitable values for you.

   1:  using System;
   2:  using System.IO;
   3:  using System.Text;
   4:  using PC2PaperLetterCustomerAPIExample.PC2PaperAPI;
   6:  namespace PC2PaperLetterCustomerAPIExample
   7:  {
   8:      static class Program
   9:      {
  11:          static void Main()
  12:          {
  13:              SendLetter();
  14:          }
  16:          static void SendLetter()
  17:          {
  18:              //Your PC2Paper username and password go here.
  19:              string username = "yourusername";
  20:              string password = "yourpassword";
  22:              var pc2PaperAPI = new PC2PaperAPI.LetterCustomerAPIClient();
  25:              //1. First we upload the files we want to attach to our letter
  26:              //   If you don't want to attach any files you can leave this step out.
  27:              // NOTE: You can also upload files async if using WCF Async methods are enables so you don't hang a UI thread for example.
  29:              // You can add as many PDF's as you want in this way. Just remember to grab the GUID's from each submit to the server.
  30:              // below we are only attaching one.
  31:              var fileContent =
  32:                  LoadBinaryFileAsByteArray(
  33:                      @"c:\temp\testPDF.pdf");
  36:              string fileName = "testPDF.pdf";
  38:              var uploadDocumentResults = pc2PaperAPI.UploadDocument(fileName, fileContent, username, password);
  41:              if(uploadDocumentResults.Status!="OK")
  42:              {
  43:                  // Oops an error took place.
  44:                  Console.WriteLine(uploadDocumentResults.ErrorMessages.ToString());
  45:                  return;
  46:              }
  48:              //2. Create a letter to attach out PDF to.
  49:              var letter = new LetterForPosting();
  51:              letter.Addresses = new LetterAddressForPosting[]
  52:                                     {
  53:                                         new LetterAddressForPosting()
  54:                                             {
  55:                                                 ReceiverName = "Tom Smith",
  56:                                                 ReceiverAddressLine1 = "Acme Co",
  57:                                                 ReceiverAddressLine2 = "2 Acme Street",
  58:                                                 ReceiverAddressTownCityOrLine3 = "Acme Town",
  59:                                                 ReceiverAddressCountyStateOrLine4 = "State",
  60:                                                 ReceiverAddressPostCode = "ZN12 9xn"
  61:                                             }
  62:                                     };
  64:              letter.ReceiverCountryCode = 1;
  66:              letter.Envelope = 1;
  67:              letter.Postage = 3; //UK First Class
  68:              letter.Paper = 1;
  69:              letter.Extras = 0;
  70:              letter.SenderAddress = "Peter Smith\n 72 Some Road \n Some Town \n P23 123";
  71:              letter.Pages = 1;
  73:              // We are also putting a cover letter onto our letter. (The cover letter will always be in front)
  74:              // Leave the LetterBody line out if you do not wish to include one.
  75:              var bodyOfLetter = new StringBuilder();
  77:              bodyOfLetter.Append("

Dear Tom

  79:              bodyOfLetter.Append("

How are you? I'm sending you a letter via the PC2Paper API

  81:              bodyOfLetter.Append("


  83:              letter.LetterBody = bodyOfLetter.ToString();
  85:              // delete this line if you only wish to send a cover letter
  86:              letter.FileAttachementGUIDs = new string[] { uploadDocumentResults.FileCreatedGUID};
  88:             var letterSendingResult =  pc2PaperAPI.SendSubmitLetterForPosting(letter, username, password);
  90:              Console.WriteLine("Result:" + letterSendingResult.Status + " with letter id:" + letterSendingResult.LetterId);
  92:          }
  94:          static byte[] LoadBinaryFileAsByteArray(string filename)
  95:          {
  96:              var binReader = new
  97:                  BinaryReader(File.Open(filename, FileMode.Open,
  98:                                         FileAccess.Read));
  99:              binReader.BaseStream.Position = 0;
 100:              byte[] binFile =
 101:                  binReader.ReadBytes(Convert.ToInt32(binReader.BaseStream.Length));
 102:              binReader.Close();
 104:              return binFile;
 105:          }
 107:      }
 108:  }


If you have any questions, please let us know.

posted on Monday, August 5, 2013 11:01:56 PM (GMT Daylight Time, UTC+01:00)  #    Trackback
# Monday, May 4, 2009

The PC2Paper API documentation has been updated to version 3. The API now enables you to associate costs from our Letter Pricing API with letters. There is also a .NET C# example of how to use the XML RPC interface for sending PDF documents.

To find out more click here..

posted on Monday, May 4, 2009 3:27:07 PM (GMT Daylight Time, UTC+01:00)  #    Trackback
# Friday, December 12, 2008

PC2Paper have released a new Letter Pricing API which enables you to do real time price queries on letters before they are sent from your own system. You may find this useful if you are reselling the PC2Paper service and would like to provide your customers with all the pricing options available such as special delivery, different printing options, envelope selections, printing station selection etc. Given all these options the PC2Paper Letter Pricing API will give you a price for your letter which you can then use to bill your user.

For more about Letter Pricing API, please visit the API section of our web site.

posted on Friday, December 12, 2008 5:43:41 PM (GMT Standard Time, UTC+00:00)  #    Trackback
# Saturday, August 18, 2007

We have now launched a Developer section on to help developers create new applications and integrate their existing back end systems with PC2Paper's API interface, enabling easier sending of real letters from the Internet using our service.

The area consists of a chat section for developers to raise questions with us and other developers and an API documentation section. All these features will also be backed up with updates from our blog site

There are no sign up fees to use our API interface, it is enabled on all PC2Paper accounts as standard. If you are a business or just a novice programmer who would like to integrate with our service please visit our Developer section.

posted on Saturday, August 18, 2007 10:24:05 AM (GMT Daylight Time, UTC+01:00)  #    Trackback
# Wednesday, May 9, 2007

I had a chat with one of our technical guys Rob Forber yesterday about PC2Papers API interfaces and how he had just finished helping one our customers with a Delphi interface into PC2Paper. Now I'm not a technical person and all I know is that Delphi is another programming language and that he was excited by the accomplishment.

My interest is that we have helped another of our customers to interface their back office systems with our service.

For those who don't know PC2Paper API or Application Interface enables our customers to integrate their own back office systems (systems they use to run their businesses) and websites so that they can automatically send letters via our service. Over the coming months I will be getting Rob to write a few articles about how you can write your own interfaces into PC2Paper.

If you would like to know before then, please contact us

posted on Wednesday, May 9, 2007 4:10:03 PM (GMT Daylight Time, UTC+01:00)  #    Trackback