Creating a Sepire mail peice

To create a Sepire mail piece, in your application generate a document through the API while making Sepire the destination of it.

For example:

πŸ“˜

Note: When making an API call with the code below, you should replace the sample data with your own.

curl --request POST \
     --url https://api.inkit.com/v1/generate \
     --header 'Content-Type: application/json' \
     --header 'X-Inkit-API-Token: ENTER YOUR API KEY' \
     --header 'accept: application/json' \
     --data '
{
  "merge_parameters": {
    "Name": "John"
  },
  "destinations": {
    "sepire": {
      "mail_product_data": {
        "mail_type": "usps_first_class",
        "letter_address_placement": "top_first_page",
        "letter_return_envelope": false,
        "letter_perforated": 0,
        "letter_double_sided": false,
        "letter_color": false
      },
      "mail_product_name": "letter",
      "verify_address": false,
      "address_line_1": "1234 Main St.",
      "address_line_2": "#1",
      "address_city": "New York",
      "address_zip": "10001",
      "address_state": "NY",
      "address_country": "US",
      "first_name": "John",
      "last_name": "Doe"
    }
  },
  "template_id": "ENTER YOUR TEMPLATE ID"
}
'
# Import the Inkit Python package
import inkit
from inkit.exceptions import InkitResponseException

# Replace the string below with your API key
inkit.api_token = "ENTER YOUR API KEY"

try:
  # Create a PDF document from a template
  resp = inkit.Render.create(
    # Specify the ID of the template
    template_id = "ENTER YOUR TEMPLATE ID",
    # Specify the data for the Name field
    merge_parameters = {"Name": "John"},
    # Specify the Sepire properties
    destinations = {"sepire": {"mail_product_data": {"mail_type": "usps_first_class", "letter_address_placement": "top_first_page", "letter_return_envelope": False, "letter_perforated": 0, "letter_double_sided": False, "letter_color": False}, "address_line_1": "1234 Main St.", "address_line_2": "#1", "address_city": "New York", "address_state": "NY", "address_zip": "10001", "address_country": "US", "first_name": "John", "last_name": "Doe", "verify_address": False, "mail_product_name": "letter"}}
  )
  # Print the JSON repsonse of the API call
  print(resp.data)
except InkitResponseException as err:
  # Print any error
  print(err.response.data)
// Import the Inkit Node.js package
const Inkit = require("inkit");

// Replace the string below with your API key
Inkit.apiToken = "ENTER YOUR API KEY";

// Call the  PDF renderer
createRender();

// Create a PDF document from a template
async function createRender() {
    try {
        const result = await Inkit.Render.create({
            // Specify the ID of the template
            templateId: 'ENTER YOUR TEMPLATE ID',
            // Specify the data for the Name field
            mergeParameters: {"Name": "John"},
            // Specify the Sepire properties
            destinations: {"sepire": {"mail_product_data": {"mail_type": "usps_first_class", "letter_address_placement": "top_first_page", "letter_return_envelope": false, "letter_perforated": 0, "letter_double_sided": false, "letter_color": false}, "address_line_1": "1234 Main St.", "address_line_2": "#1", "address_city": "New York", "address_state": "NY", "address_zip": "10001", "address_country": "US", "first_name": "John", "last_name": "Doe", "verify_address": false, "mail_product_name": "letter"}}
        });
        // Print the JSON response of the API call
        console.log(JSON.stringify(result.data, null, 3));
    } catch (error) {
        // Print any error
        console.error(error.response.status, error.response.statusText);
    }
}
{
  "id": "rend_7pGnot4dhBUm2Re0EVQgso",
  "mail_piece_id": "mp_4IDk1YbLznzMiMjaXlXbCS"
}

πŸ“˜

Note: You need to keep track of your mail_piece_id if you want to track the status of it through the API.

You can also generate a Sepire mail piece in the API reference.