Overview
Package for .NET Framework available
If you're using .NET Framework you can download and install our nuget package directly, see the section Tools for more information.
Sandbox - For Developers
During development and testing we recommend using our Sandbox Environment, see the section Sandbox for more information.
Format
The REST API is only using JSON; all requests body should be in JSON and all responses will be JSON. Make sure you set Request.Header.Content-Type
to “application/json”.
Sample Request (RAW)
Encoding
UTF8 is the encoding that should be used at all times.
Authorization
The API supports basic, api-key and Oauth2 client credentials authorization, and all requests must be authorized at all times.
You can use a valid api-key, bearer token or a base64 encoded string based on your user credentials to build the authorize header value. We recommend that you always use the api-key or Oauth2 approach over the base64 encoded string, you can create/revoke/reactive/remove api-keys with ease while using the base64 approach your integrations may fail if the password of the used account would ever be changed.
Using an api-key
Set the Request.Header.Authorization
value to “api-key key”, to get your key you need to generate a new API key after you've signed in to your account, you'll be able to generate and manage your API keys from the account/api section.
Sample Request (RAW)
Using Oauth2 with client credentials
First contact hejsan@ekopost.se to request a client_id and a client_secretWhen customer has a client_id and a client_secret, these need to be base64 encoded and sent to the API via POST to receive an access token which is used for subsequent calls. The base64 encoded string should be created from a string formatted like: "client_id:client_secret".
Create the base64 encoding to be used, replace client_id and client_secret with real values and make sure there are no trailing newlines and that the string is encoded literally
Then set the Request.Header.Authorization
value to “Basic base64encodedString
Sample Request (RAW)
Sample response
An access_token is valid for up to 8 hours. A new access_token can be requested any time. If a request to the API is issued with a non valid access_token a http-response with the HTTP-header 401 is returned such as HTTP/1.1 401 Unauthorized. With the use of a valid access_token request to the API can be done as the example below.
Sample Request with bearer (RAW)
Using a base64 string
Set the Request.Header.Authorization
value to “Basic auth_token”, auth_token should be replaced with a base64 encoded string formatted like: "username:password", where username is your username and password is your password.
Sample Request (RAW)
Error handling
All handled errors will result in bad request (code: 400) and the body will contain an error object for debugging and development purpose with further information how to validate the request, you can see a list of error codes in the section Error under Error code values.
Resources not found will result in not found (code: 404) and any unhandled exception will return internal error (code: 500).
Quick start
To send an envelope you must first create a campaign, then an envelope within that campaign, then create a content (read: upload a document/attachment) within that envelope, once this is done you'll have to close both the campaign and the envelope/s to mark them as ready for production, each envelope in the campaign will be printed & distributed as an individual postal item, the items will be printed & distributed on the campaign output date.
To schedule print and distribution of a envelope - follow these steps (all requests must be authorized).
- Create a campaign
Creates an empty campaign in opened state. - Create an envelope
Creates an empty envelope in opened state for the specified campaign. - Create content (document)
Creates a new document and links it to the specified envelope. - Create content (attachment)
Creates a new attachment and links it to the specified envelope. - Change the envelope state to closed
Closes the envelope and marks it as ready for print and distribution. *Note* the campaign must also be closed. - Change the campaign state to closed
Closes the campaign and marks it and all related envelopes as ready for print and distribution.
Limitations
The Content object field named data must be a PDF version 1.4, support for later versions does exist, but printing quality nor result can not be guaranteed without testing. We always recommend that you send your self a copy of the documents you'll be sending to inspect the result, any deviations should be reported to our support team.
Page margins & reserved areas
Download our content template to learn about our page margins, reserved page areas and where to place your destination adress and return adress for optimal visibility.
Campaign
Create campaign
Creates a new campaign with state opened.
Request
Parameter | Type | Description |
name | String | A friendly name to identify the campaign. |
output_date | Date | Date in UTC format representing the date when you would like your envelope printed & distributed. |
cost_center | String | Value representing an internal cost center. |
signing | Boolean | Optional Set to true if it is a digital agreement |
Sample Request (RAW)
Close campaign
Changes a campains state to closed and marks it and all related envelopes as ready for print & distribution.
Request
Parameter | Type | Description |
campaign_id | Guid | Guid that represents the specified campaign of which to change state to closed. |
Sample Request
Response
Sample response
Cancel campaign
Changes a campains state to cancelled and marks it and all related envelopes as not ready for print & distribution.
Request
Parameter | Type | Description |
campaign_id | Guid | Guid that represents the specified campaign of which to change state to cancelled. |
Sample Request
Response
Sample Response
Get campaign
Gets a campaign.
Request
Parameter | Type | Description |
campaign_id | Guid | Unique id of the campaign to retrieve. |
Sample Request
Response
Parameter | Type | Description |
id | Guid | The campaign object's unique id. |
name | String | A friendly name to identify the campaign. |
output_date | Date | Date in UTC format representing the date when you would like your envelope printed & distributed. |
cost_center | String | Value representing an internal cost center. |
envelope_count | Int | Value representing the total number of envelopes in the campaign. |
state | String | State type denominator, see the section State values for valid values. |
state_changed_at | Date | Date in UTC format representing the date when the campaign state was changed. |
created_at | Date | Date in UTC format representing the date when the campaign was created. |
Sample response
Get campaigns
Get a list of all campaigns created within a given timespan.
Request
Parameter | Type | Description |
start | Date | Optional Date in UTC format representing the start of a timespan. Remarks: Default value if not specified is today. |
stop | Date | Optional Date in UTC format representing the stop of a timespan. Remarks: Default value if not specified is tomorrow. |
name | String | Optional Name of the requested campaign. |
state | String | Optional State type denominator, see the section State values for valid values. |
Sample Request
Response
Parameter | Type | Description |
Array | An array of all Campaigns found within the given timespan. |
Sample response
The list will be in decending order based on the campaigns created_at date.
Envelope
Create envelope
Creates a new envelope with state opened linked to the specified campaign.
Request
Parameter | Type | Description |
campaign_id | Guid | Unique id of a campaign within which to create the envelope. |
Parameter | Type | Description |
name | String | A friendly name to identify the envelope. |
address | Object |
Address object that represents the destination, see the section Address objects for valid formats. Remark: In the case of a postal address, the address needs to be embedded into the uploaded document. The one exception to an embedded address is when the flag 'use_coverpage' is lit on the postal address object. A 'null' value will be treated as an address of type postal. |
postage | String | Postage type denominator, see the section Postage values for valid values. Remark: For customers registered to our Norwegian production site, this parameter can be considered redundant as it is ignored. |
plex | String | Plex type denominator, see the section Plex values for valid values. |
color | Boolean | Print the content in color (CMYK), if set to false the content will be printed in black and white. |
pu | Boolean | Personal delivery, additional service for REK |
kb | Boolean | Delivery receipt, additional service for REK |
consignor_contact | String | Email for integration with the PostNord-app and receipt mail, additional service for REK |
agent | String | Optional For use when agent |
unique_id | String | Optional Use with an external id to prevent duplication. Is per customer. |
Sample request
Response
Parameter | Type | Description |
id | Guid | The envelope object's unique id. |
name | String | A friendly name to identify the envelope. |
address | Object | Address object that represents the destination, see the section Address objects for valid formats. Remark: In the case of a postal address, the address needs to be embedded into the uploaded document. The one exception to an embedded address is when the flag 'use_coverpage' is lit on the postal address object. A 'null' value will be treated as an address of type postal. |
postage | String | Postage type denominator, see the section Postage values for valid values. |
plex | String | Plex type denominator, see the section Plex values for valid values. |
color | Boolean | Print the content in color (CMYK), if set to false the content will be printed in black and white. |
state | String | State type denominator, see the section State values for valid values. |
state_changed_at | Date | Date in UTC format representing the date when the envelope state was changed. |
created_at | Date | Date in UTC format representing the date when the envelope was created. |
transaction | Object | Transaction object that the state of the Envelop Transaction object. |
warning | String | Is in response if address is missing. If address is of type postal and the postal address not is complete an extra cost is added. |
pu | Boolean | Personal delivery, additional service for REK |
kb | Boolean | Delivery receipt, additional service for REK |
consignor_contact | String | Email for integration with the PostNord-app and receipt mail, additional service for REK |
agent | String | When agent is used |
unique_id | String | When uniqueId is used. |
failed_reason | String | May contain info if state is failed. |
Sample response
Close envelope
Changes an envelopes state to closed and marks it as ready for print & distribution.
Request
Parameter | Type | Description |
campaign_id | Guid | Unique id of a campaign. |
envelope_id | Guid | Unique id of an envelope within the campaign. |
Sample request
Response
Sample response
Cancel envelope
Changes an envelopes state to cancelled and marks it as not ready for print & distribution.
Request
Parameter | Type | Description |
campaign_id | Guid | Unique id of a campaign. |
envelope_id | Guid | Unique id of an envelope within the campaign. |
Sample request
Response
Sample response
Get envelope
Gets an envelope. See webhook alternative to get status for envelopes.
Request
Parameter | Type | Description |
campaign_id | Guid | Unique id of a campaign. |
envelope_id | Guid | Unique id of an envelope within the campaign. |
Get failed envelopes
Gets an failed envelope. Typically used to find out failed reason for rescheduled envelopes
Request
Parameter | Type | Description |
campaign_id | Guid | Unique id of a campaign. |
envelope_id | Guid | Unique id of an envelope within the campaign. |
state | String | Optional State type denominator, see the section State values for values. Valid here are state failed |
Sample request
Response
Parameter | Type | Description |
id | Guid | The envelope object's unique id. |
name | String | A friendly name to identify the envelope. |
address | Object | Address object that represents the destination, see the section Address objects for valid formats. |
postage | String | Postage type denominator, see the section Postage values for valid values. |
plex | String | Plex type denominator, see the section Plex values for valid values. |
color | String | Print the content in color (CMYK), if set to false the content will be printed in black and white. |
state | String | State type denominator, see the section State values for valid values. |
state_changed_at | Date | Date in UTC format representing the date when the envelope state was changed. |
created_at | Date | Date in UTC format representing the date when the envelope was created. |
transaction | Object | Transaction object that the state of the Envelop Transaction object. |
tracking | Object | If the envelope is a registered letter and is registered it will contain trackinginformation with parcelNo, trackingState and trackingUrl. |
warning | String | Is in response if address is missing. If address is of type postal and the postal address not is complete an extra cost is added. |
Sample response
Tracking states
(Only available for mailings with PostageType REK)
Get envelopes
Gets a list of all envelopes within a campaign.
Request
Parameter | Type | Description |
campaign_id | Guid | Unique id of a campaign. |
name | String | Optional Name of the envelope or envelopes. |
state | String | Optional State type denominator, see the section State values for valid values. |
Get failed envelopes
Gets a list of all failed envelopes within a campaign. Typically used to find fail reason for original address object when envelope has been rescheduled
Request
Parameter | Type | Description |
campaign_id | Guid | Unique id of a campaign. |
name | String | Optional Name of the envelope or envelopes. |
state | String | Optional State type denominator, see the section State values for valid values. |
address_type | String | Optional Address.$type, see Address objects for $type values. Valid here are ebank, einbox, einboxKivra and email. |
Sample request
Response
Parameter | Type | Description |
Array | An array of all Envelopes within the campaign. |
Sample response
Create content
Creates a content either as a document or attachment linked to the specified envelope, only one document can be linked to an envelope.
Request
Parameter | Type | Description |
campaign_id | Guid | Unique id of a campaign within which the envelope exists. |
envelope_id | Guid | Unique id of an envelope to add the content to. |
Parameter | Type | Description |
data | String | The original file's data as a base64encoded string. |
mime | String | The original file's mime type. |
length | Int | The original file's size in bytes. |
type | String | Content type denominator, see the Type values section for valid values. |
return_address | Boolean | Optional Set as true to add a return address on the upper left corner of the letter. (The address that will show is the return address on your account.) |
address | Object | Optional Address object that represents postal destination of returned letters, see the section Address objects. Object (postal) is the valid object. Remark: For this address to be used as a return address on the letter, return_address must also have the value 'true' |
Sample request
Sample request with return address
Response
Parameter | Type | Description |
id | Guid | The content object's unique id. |
mime | String | The original file's mime type. |
length | Int | The original file's size in bytes. |
type | String | Content type denominator, see the Type values section for valid values. |
created_at | Date | Date in UTC format representing the date when the content was created. |
return_address | Boolean | Value to show if return address was triggered.. |
Sample response
Get content
Gets an envelope content.
Request
Parameter | Type | Description |
campaign_id | Guid | Unique id of a campaign. |
envelope_id | Guid | Unique id of an envelope within the campaign. |
content_id | Guid | Unique id of a content within the envelope. |
Sample request
Response
Parameter | Type | Description |
id | Guid | The content object's unique id. |
mime | String | The original file's mime type. |
length | Int | The original file's size in bytes. |
type | String | Content type denominator, see the Type values section for valid values. |
created_at | Date | Date in UTC format representing the date when the content was created. |
Sample request
EDI - Invoice integration
Create sender
Creates a new sender
Request
Parameter | Type | Description |
Parameter | Type | Description |
Name | String | The sender's company name. |
Address1 | string | The first address line of the sender. |
Address2 | string | The second address line of the sender. |
Zip_Code | string | The zip code of the sender. |
City | string | The city of the sender. |
Country_Code | string | The country code of the sender. |
Contact_Name | string | The contact name of the sender. |
Phone | string | The phone of the sender. |
string | The email of the sender. | |
CIN | string | The corporate identity number (org no) of the sender of an EDI invoice. |
GLN | string | The global location number of the receiver of an EDI invoice. |
VAT | string | The VAT of the sender. |
Bank_Giro | string | The bankgiro of the sender. |
Plus_Giro | string | The plusgiro of the sender. |
IBAN | string | The IBAN of the sender. |
BIC | string | The BIC of the sender. |
Sample request
Response
Parameter | Type | Description |
message | string | The status message of the request |
Sample response
EDI Invitations
Get a list of sent invitation and their statuses
Request
Parameter | Type | Description |
Parameter | Type | Description |
Sample request
Response
Parameter | Type | Description |
ReceiverCin | string | ReceiverCin |
ReceiverGln | string | ReceiverGln |
DateSent | string | The date when the invitation was sent |
Status | string | The status code of the invitation |
Sample response
Status codes
registered = 1001,sent = 1002,
received = 1003,
answered = 1004,
connection_approved = 1005,
connection_denied = 1006,
reminder_sent = 1007,
insufficient_information = 1008,
unkown_status = 1009,
expired = 1010
Update and get a list of sent invitation and their statuses
Request
Parameter | Type | Description |
Parameter | Type | Description |
Sample request
Response
Parameter | Type | Description |
ReceiverCin | string | ReceiverCin |
ReceiverGln | string | ReceiverGln |
DateSent | string | The date when the invitation was sent |
Status | string | The status code of the invitation |
Sample response
Reachable
Check reachable status
Remarks: Returns 404 if the recipient is not reachable.
Remarks: Returns 200 and echoes the recipient parameter if the recipient is reachable.
Request
Parameter | Type | Description |
type | String | The type of address to check reachable status for, valid values are 'einbox', 'ebank', 'einvoice' and 'mastercard'. |
Parameter | Type | Description |
recipient | String | The search parameter used to check reachable status. |
sender | String | Optional FUI or tenantKey, id to use instead of default. |
Sample request
Response
Parameter | Type | Description |
recipient | String | Indicates success. A recipient has been found. |
Sample request
Response
Parameter | Type | Description |
recipient | String | Indicates success. A recipient has been found. |
Sample request - multiple
Response
Parameter | Type | Description |
recipients | List | Indicates success. Recipients has been found. |
Sample request
Sample request
Check ebank list status
Remarks: Returns 404 if the recipient is not reachable.
Remarks: Returns 200 and echoes the recipient parameter if the recipient is reachable.
Request
Parameter | Type | Description |
sender | String | The FUI to get ebank receivers for. |
Sample request
Response
Parameter | Type | Description |
recipient | Array | An arry of all receivers |
Sample response
Check guardians from ssn
Request
Parameter | Type | Description |
recipient | String | The SSN to get guardian receivers for. |
Sample request
Response
Parameter | Type | Description |
address_guardians | Array | An array of all receivers consists of recipient that includes SSN if reachable in digital mail box and postal address. |
Sample response
Peppol lookup
Check if recipient is in Peppol network with generic search
Request
Parameter | Type | Description |
Recipient | String | Search string. Fx. name, organisation number or VAT number |
Sample request
Response
Return list of "mathes" from the peppol network for more information see: https://directory.peppol.eu/public/locale-en_US/menuitem-docs-rest-api
Sample response
Check Einvoice Complience
Determines whether the setup of Einvoice sendouts is complete. Provides an error messages for various missing setup steps on non-success
Request
Parameter | Type | Description |
ReceiverCin | String | The corporate identity number (org no) of the sender of an EDI invoice. |
SenderCin | String | The corporate identity number (org no) of the sender of an EDI invoice. |
ReceiverGln | String | The global location number of the receiver of an EDI invoice. |
SenderGln | String | The global location number of the sender of an EDI invoice. |
Sample request
Response
Parameter | Type | Description |
ReceiverCin | String | An echo of the input parameter. |
SenderCin | String | An echo of the input parameter. |
ReceiverGln | String | An echo of the input parameter. |
SenderGln | String | An echo of the input parameter. |
Success | Boolean | A 'true' result indicates that the setup process for einvoice sendouts is complete. |
ErrorMessage | String | A message describing any required missing steps regarding einvoice setup. |
Sample response
Check Mastercard reachability
Remarks: Returns 404 if the recipient is not reachable.
Remarks: Returns 200 and echoes the recipient parameter if the recipient is reachable.
Request
Parameter | Type | Description |
first_name | String | The first name of the recipient. |
last_name | String | The last name of the recipient./td> |
street_address1 | String | The street address, first line, of the recipient. |
street_address2 | String | The street address, second line, of the recipient. |
city | String | The city of the recipient. |
zip_code | String | The zip code of the recipient. |
country_code | String | The country code of the recipient. |
phone_number | String | The phone number of the recipient. (+XX...) |
String | The email address of the recipient. | |
birth_date | String | The birth date of the recipient. |
ssn | String | The social security number of the recipient. |
Sample request
Response
Parameter | Type | Description |
response | string | The response from the reachable service |
Sample response
Objects
Campaign
Representation of a campaign that will be posted.
Object
Parameter | Type | Description |
id | Guid | The campaign object's unique id. |
name | String | A friendly name to identify the campaign. |
output_date | Date | Date in UTC format representing the date when you would like your envelope printed & distributed. |
cost_center | String | Value representing an internal cost center. |
envelope_count | Int | Value representing the total number of envelopes in the campaign. |
state | String | State type denominator, see the section State values for valid values.. |
state_changed_at | Date | Date in UTC format representing the date when the campaign state was changed. |
created_at | Date | Date in UTC format representing the date when the campaign was created. |
State values
String | Description |
opened | The campaign is opened, you can add envelope, modify or change state to cancelled. |
closed | The campaign is marked as ready for production and can not be modified. |
transferred | The campaign and all linked envelopes has been transferred to our production facility. |
completed | The campaign and all linked envelopes has been printed and posted. |
cancelled | The campaign has been closed and all linked envelopes will not be printed or distributed. |
failed | The campaign could not be produced in our facility, contact our customer service for further details. |
Envelope
Representation of an envelope that will be posted.
Object
Parameter | Type | Description |
id | Guid | The envelope object's unique id. |
name | String | A friendly name to identify the envelope. |
address | Object |
Address object that represents the destination, see the section Address objects for valid formats. Remark: In the case of a postal address, the address needs to be embedded into the uploaded document. The one exception to an embedded address is when the flag 'use_coverpage' is lit on the postal address object. A 'null' value will be treated as an address of type postal. |
postage | String |
Postage type denominator, see the section Postage values for valid values. Remark: For customers registered to our Norwegian production site, this parameter can be considered redundant as it is ignored |
plex | String | Plex type denominator, see the section Plex values for valid values. |
color | Boolean | Print the content in color (CMYK), if set to false the content will be printed in black and white. |
state | String | State type denominator, see the section State values for valid values. |
pu | Boolean | Personal delivery, additional service for REK |
consignor_contact | String | Email for integration with the PostNord-app and receipt mail, additional service for REK |
state_changed_at | Date | Date in UTC format representing the date when the envelope state was changed. |
created_at | Date | Date in UTC format representing the date when the envelope was created. |
transaction | Object | Transaction object that the state of the Envelop Transaction object. |
Sample request
Postage values
Value | Description |
priority | Your content will be delivered within one working day after it's been printed and posted. |
economy | Your content will be delivered within four working days after it's been printed and posted. |
rek | Mailings that needs to be signed by the recipient before hand out. |
protected | Mailings to recipients who have protected identities. |
Plex values
Parameter | Description |
simplex | We will only print on the front of each paper sheet. |
duplex | We will print on both the front and back of each paper sheet. |
State values
Parameter | Description |
opened | The envelope is in opened state, you can add content, modify or cancel the envelope. |
closed | The envelope is in closed state, it's marked as ready for print & distribution. |
transferred | The envelope has been transferred to our production facility, and can no longer be modified or cancelled. |
printed | The envelope has been printed in our production facility. |
posted | The envelope has been posted. |
cancelled | The envelope has been cancelled, and will not be printed or distributed. |
failed | The envelope could not be produced in our facility, contact our customer service for further information. |
Address
Object (postal)
The envelopes content will be printed and will be sent with regual postal mail. Note: The address is still required to be embedded inside the document unless the use_coverpage flag is used.
In case of Registered mail/REK, certain limitations apply to the different address rows. name and street have a max limit of 35 characters/row and postal_code a limit to five digits only (with or without blankspaces).
Parameter | Type | Description |
$type | String | Denominator for the address type, should always be set to 'postal'. Remark: this parameter must come first in the json object. |
name | String[] | The recipient's name, each string in the array is considered to be a address line. |
street | String[] | The recipient's street name, each string in the array is considered to be a address line. |
postal_code | String | The recipient's postal/zip code. |
city | String | The recipient's city name. |
country | String | The recipient's country name or country code as a ISO 3166-1 encoded alpha-2 code. See an official list of country codes. |
use_coverpage | Boolean | On true: A flyleaf page will be added to the envelope containing the address details. |
Object (email)
The envelopes content will be attached to an email and sent to the specified recipient.
Parameter | Type | Description |
$type | String | Denominator for the address type, should always be set to 'email'. Remark: this parameter must come first in the json object. |
subject | String | The value will be set as the email's subject field. |
subject | String | The recipient's email adress, to where the contents of the envelope will be sent. |
Object (einbox_kivra)
Type 'invoice.renewal' will soon be supported by Kivra.
The content will be sent to kivra inbox (einbox_kivra) owned by the recipient, if the einbox doesn't exist the envelope will be printed and posted instead.
Parameter | Type | Description | ||||||||||||||||||||||||||||||||||||
$type | String | Denominator for the address type, should always be set to 'einbox_kivra'. Remark: this parameter must come first in the json object. |
||||||||||||||||||||||||||||||||||||
recipient | String | The recipient of the einbox's social security number, to where the contents of the envelope will be sent. | ||||||||||||||||||||||||||||||||||||
subject | String | The value will be displayed as subject in the recipient's e-inbox if supported. Remarks: if a template has been specified this value will be ignored and the stored subject of the template will be used instead. |
||||||||||||||||||||||||||||||||||||
sender_id | String | Optional to set other sender then the default. | ||||||||||||||||||||||||||||||||||||
kivra_type | Int | 0: Letter (Default), 1: Invoice, 2: Letter Salary, 3: Booking, |
||||||||||||||||||||||||||||||||||||
booking | Object |
|
||||||||||||||||||||||||||||||||||||
invoice | Object |
|
Object (einbox)
The content will be sent to a digital inbox (einbox) owned by the recipient, if the einbox doesn't exist the envelope will be printed and posted instead. Used for Digipost (Norway) and MinaMeddelanden (Sweden).
Parameter | Type | Description |
$type | String | Denominator for the address type, should always be set to 'einbox'. Remark: this parameter must come first in the json object. |
recipient | String | The recipient of the einbox's social security number, to where the contents of the envelope will be sent. |
template | String | The id of a predefinied ekopost template. The stored subject and content of the template will be used instead of any subject/content specified in the request. |
subject | String | The value will be displayed as subject in the recipient's e-inbox if supported. Remarks: if a template has been specified this value will be ignored and the stored subject of the template will be used instead. |
content | String | The specified content will be displayed as html/text message in the recipients e-inbox if supported. Remarks: if a template has been specified this value will be ignored and the stored content of the template will be used instead. |
sender_id | String | Optional to set other sender then the default. |
Object (einbox_signer)
The content will be sent to a digital inbox (einbox) ,if it exist, owned by the recipient and also to a given email, if the einbox doesn't exist the document can be signed by bank-id login.
Parameter | Type | Description |
$type | String | Denominator for the address type, should always be set to 'einbox_signer'. Remark: this parameter must come first in the json object. |
info_mail | String | Email inbox that should receive information and the covenant document when all parties has signed the document. |
sender_id | String | Optional to set other sender then the default. |
signers | Object[] | Signer object that represents the signers |
signers.email | String | Email address where the link for singing the document will be sent |
signers.recipient | String | The recipient's social security number. |
signers.issuer | Boolean | The issuer of the signing document Remark: Can be true for one signer. |
Object (einvoice)
The envelopes content will be transfered electronically to the recipient.
Parameter | Type | Description |
$type | String | Denominator for the address type, should always be set to 'einvoice'. Remark: this parameter must come first in the json object. |
format | String | Format type denominator, see the section Format values for valid values. |
sender | String | Identifier of the sender, this is usually the sender's registration number. |
sender_type | String | Identifier type denominator, see the section Identifier type values for valid values. |
recipient | String | Identifier of the recipient, this is usually the recipient's registration number. |
recipient_type | String | Identifier type denominator, see the section Identifier type values for valid values. |
intermediator | String | Intermediator type denominator, see the section Intermediator values for valid values. Remark: If the recipient is using Ekopost to receive eletronic documents or the intermediator is not found or unkwon, set the value to 'null'. |
Format values
Value | Description |
svefaktura-1.0 | This represents version 1.0 of svefaktura. |
svefaktura-2.0-invoice | This represents version 2.0 of svefaktura, type invoice. |
svefaktura-2.0-creditnote | This represents version 2.0 of svefaktura, type creditnote. |
peppol-bis-billing-3.0 | This represents version 3.0 of peppol delivery. |
Identifier values
Value | Description |
SE.REGNO | This represents a swedish company registration number, format e.g. "556838-4118". |
SE.SSNNO | This represents a swedish personal social security number, format e.g. "YYMMDD-XXXX". |
GS1.GLN | This represents a global location number (GLN) based on the GS1 general specifications. |
Intermediator values
Value | Description |
peppol | Pan-European Public Procurement Online. |
Object (Navet lookup)
Ekopost need information about your Navet-connection before this can be used.
Returns postal address-object that will be transformed and used as address for current envelope.
Parameter | Type | Description |
$type | String | Denominator for the address type, should always be set to 'lookup'. Remark: this parameter must come first in the json object. |
recipient | String | Social security number |
Object (ebank)
The envelopes content will be transfered electronically to the recipients internet bank.
Parameter | Type | Description |
$type | String | Denominator for the address type, should always be set to 'ebank'. Remark: this parameter must come first in the json object. |
recipient | String | An identifier (FMI) of the recipient, the identifier is usually provided by the bank or through a lookup service. |
customer_number | String | External identifier of the customer, this is usually a number stored in the senders system. |
customer_name | String | Name of the customer. |
invoice_number | String | The external invoice number. |
reference_type | String | The external reference type used as a reference when paying the invoice, type can be either 'ocr' or 'message'. |
reference_value | String | The external reference value used as a reference when paying the invoice. |
giro_number | String | The giro account number of the payment recipient. Remark: This value should not contain dashes, only numbers. |
autogiro | Boolean | Set to true if the invoice is payed through autogiro. Remark: Setting this to true will disable manual payment of the invoice in the internet bank. |
amount | String | The total amount of the invoice. |
invoice_date | String | Date when the invoice was issued. |
due_date | String | Date when the invoice payment is due. |
issuer | String | Optional to send from this issuer instead of default issuer. |
presentation_reference | String | Optional to set presentation reference. |
Object (protected)
The envelope's content will be sent as a letter to the specified.
Parameter | Type | Description |
$type | String | Denominator for the address type, should always be set to 'protected'. Remark: this parameter must come first in the json object. |
recipient | String | The recipient's' SSN (personnummer) or other identifier. |
use_coverpage | Boolean | On true: A flyleaf page will be added to the envelope containing the address details. |
Object (mastercard)
The envelope's content will be sent as an invoice
Parameter | Type | Description |
$type | String | Denominator for the address type, should always be set to 'einvoice_mastercard'. Remark: this parameter must come first in the json object. |
sender_id | String | Your customer's id number/string |
kid | String | The KID of the invoice. |
credit_account | String | The credit account of the invoice. |
issuer | String | The issuer of the invoice. |
shipment_id | Guid | The shipment id of the invoice. |
account_number | String | The account number of the invoice. |
amount | Double | The amount of the invoice. |
due_date | String (DateTime) | The due date of the invoice. |
payment_type | String | The payment type of the invoice. One of:
EFAKTURA, EFAKTURA_AND_AVTALEGIRO, EFAKTURA_AND_EXTERNAL_AVTALEGIRO, AVTALEGIRO |
document_type | int | The document type of the invoice. One of:
0 = INVOICE, 1 = CREDIT_NOTE, 2 = REMINDER, 3 = COLLECTION_NOTICE, 4 = DUNNING, 5 = PAYMENT_REQUEST, 6 = ENFORCEMENT_WARNING |
efaktura_identifier | String | The efaktura identifier of the invoice. |
social_security_number | String | The social security_number of the invoice. |
e_faktura_reference | String | The efaktura reference of the invoice. |
minimum_amount | Double (nullable) | The minimum amount of the invoice. |
brand_name | String (nullable) | The brand name of the invoice. Must be set when sending EFAKTURA, EFAKTURA_AND_AVTALEGIRO, EFAKTURA_AND_EXTERNAL_AVTALEGIRO |
e_faktura_url | String (nullable) | The external url of the invoice. |
collection_notice_notification_email | String (nullable) | The external url of the invoice. |
collection_notice_notification_mobile_phone | String (nullable) | The external url of the invoice. |
atg_notification | Bool | The external url of the invoice. |
atg_notification_text | String (nullable) | The atg notification text of the invoice. |
atg_abbreviated_name | String (nullable) | The atg abbreviated name of the invoice. |
atg_external_reference | String (nullable) | The atg external reference of the invoice. |
Transaction
The envelopes transaction information when it changed and to what state.
Object
Parameter | Type | Description |
state | String | State type denominator, see the section State values for valid values. |
state_changed_at | Date | Date in UTC format representing the date when the campaign state was changed. |
Content
Representation of a document or an attachment that will be printed.
Object
Parameter | Type | Description |
id | Guid | The content object's unique id. |
mime | String | The original file's mime type. |
length | Int | The original file's size in bytes. |
type | String | Content type denominator, see the Type values section for valid values. |
created_at | Date | Date in UTC format representing the date when the content was created. |
Type values
Value | Description |
document | The object intance represents the main document. |
attachment | The object intance represents an attachment. |
markup | The object intance represents a xml markup. |
Error
Bad requests with http response code 400 does contains an error object with futher information about the bad request.
Object
Parameter | Type | Description |
error_code | String | Code that represents the error that occured. |
error_message | String | Description about what error occured. |
developer_message | String | Further description about the error for developers. |
Error code values
Value | Description |
0 | Invalid basic authentication token. |
100A | The envelope must contain atleast one (1) document before being closed. |
100B | The envelope must contain atleast one (1) markup before being closed. |
101 | A campaign must contain atleast one (1) envelope before being closed. |
102 | All envelopes inside a campaign must be closed before closing the campaign. |
103 | An envelope may only contain one (1) document. |
104 | An envelope may only contain content with mime of 'application/pdf'. |
105 | Could not extract or identify a postal address in the envelopes main documents. |
106 | Campaign was not found. |
107 | Could not open the main document content or find any pages. |
108 | An envelope may only contain content of type 'attachment' with mime set to 'application/pdf'. |
109 | An envelope may only contain content of type 'markup' with mime set to 'application/xml'. |
110 | An envelope may only contain one (1) markup. |
111 | Envelope was not found. |
112 | Specified country is not a valid ISO 3166-1 encoded alpha-2 code. |
113 | You have exceeded your credit limit for the month, please contact our customer service to adjust your credit limit. |
114 | The searchparams is null. |
115 | The searchparams is invalid. |
116 | The timespan is invalid. |
117 | The document size is invalid. |
118 | The attachment size is invalid. |
119 | Missing recipient. |
120 | Missing email |
121 | Can not create more envelopes in campaign |
122 | One signer needed |
123 | Email address contains invalid characters. |
124 | FUI-number is not registrered |
125 | No applicants registrered for this FUI |
126 | Not unique |
127 | Invalid data |
128 | Wrong mime for sms. Mime should be 'text/plain' |
129 | Empty data field |
130 | Sms text message not encoded into base64 |
131 | Sms recipients contains invalid phone number. |
132 | Sms does not contain any recipients |
133 | Sms "FromName" is null or empty. |
134 | Sms too many recipients (100 000 is the max limit) |
135 | Address validation error, error contains more details such as "Name too long (max 35 characters)" |
136 | Invalid contract, error contains more details. |
137 | Document content not found on the specified envelope |
138 | Recipient can not be the same as the issuer |
139 | Recipient must have a valid valuer |
140 | No setup for protected mailing, contact hejsan@ekopost.se to get started with protected mailing. |
141 | Invalid contract |
142 | Reply mail template missing |
143 | More than 50 documents over 8Mb sent current day |
Tools
Package for .NET Framework
Ekopost is quick and easy to integrate in a .NET environment using our nuget package, the package uses a fluent interface to schedule print & production.
Installation
Usage
Sandbox
The url for connecting to our sandbox environment is http://api.sandbox.ekopost.se
Remarks:
Sandbox do not use https!
Nothing that uploaded to sandbox will be sent to end customers.
Getting started
1. Create a sandbox user. Click here to create.
2. If you already have created a sandbox-user, Click here to login
3. When you have created your sandbox account, you will automatically be signed in and you can immediately manually start uploading letter for testing or start using our API (http://api.sandbox.ekopost.se) with your user information that has been sent to your e-mail you entered when registering.
Webhooks
Set up Webhooks to receive status when campaign is completed.
You can access webhook-setup in secure API-settings menu here.
Webhooks allow you to build or set up integrations which subscribe to certain Ekopost events. When one of those events is triggered, we'll send a HTTP POST payload to the webhook's configured URL. Once installed, the webhook will be triggered each time one or more subscribed events occurs.
Event
Webhooks are only subscribed to the campaign completed event for now. For example, if you subscribe to webhooks event you'll receive a payload every time a campaign is completed and statuses for all envelopes in the campaign.
Payloads
You'll get a specific payload with the envelopes id and status information.
Delivery header
HTTP POST payloads that are delivered to your webhook's configured URL endpoint will contain one special header:
X-Ekopost-Signature The HMAC hex digest of the response body. The HMAC hex digest is generated using the sha1 hash function and the secret as the HMAC key.
Example delivery
Code examples
Overview
In these examples we're using Newtonsoft.Json and Newtonsoft.Json.Linq along with RestSharp.
Variables used:
_apiKey see documentation
_host is either sandbox or production -base url
Get method used in the examples
Post method used in the examples
Sms
Sample Response (RAW)
Sample Poll Response (RAW)
Reply mail
Reply mail makes use of a "replymail-template" which the recipient folds into an envelope and returns it to the address printed on the template
Link to templateWe will add an envelope to the mailing during production.
This feature needs to be set up per customer, contact hejsan@ekopost.se for more information.
Create reply mail
Reply mail are created the same way as regular postal mailings with these exceptions
1. Campaign body should have "replymail" set to "true"
2. A replymail-template should be added as an attachment marked replymail
Protected mailing
This feature needs to be set up per customer, contact hejsan@ekopost.se for more information.
Create protected mailing
Protected mailings are created the same way as regular postal mailings with these exceptions
1. Body of create envelope request should have postage = "protected"
2. and an address object of type "protected"
3. which should have a recipient in the form of ssn/pnr
If use_coverpage is set to false, the only thing that should be visible inside the address area is the recipients ssn/pnr.