Download OpenAPI specification:Download
The EDI Engine API offers GET and POST methods to request operational business data - converted from EDI messages received from partners - or to import data into EDI Engine to generate EDI messages.
This API reference explains each of the API endpoints, with example REST requests and responses included.
To use the EDI Engine API, you need to include a token, EDI mail box and application id with each call.
Before starting to use the EDI Engine APIs, operational events need to be mapped to EDI event types.
Mail systems define their own operational events, which can be associated with EDI event types. EDI engine allows to define mapping between these two types of events so that mail systems can extract or send business data based on operational events. The mapping can be defined only between events that are associated with the same type of mail unit types:
Mail unit type code | Description |
---|---|
MI |
Mail item |
RC |
Receptacle |
DP |
Dispatch |
CS |
Consignment |
CR |
Customs response / Referral |
CT |
Container |
PP |
Postal payment |
RS |
Referral response |
Examples of possible mapping entries:
1
shall trigger EMSEVT
EMA
message130
shall trigger RESCON
and RESDES
messagesThe event mapping configuration API allows to map one or more operational events to one same EDI event type. The following mapping allows to generate
EMSEVT
EMD
event for two different operational events:
30
operational event - EMSEVT
EMD
event42
operational event - EMSEVT
EMD
eventIn order to convert incoming EDI events to operational events, the event mapping configuration API allows to map one EDI event type to one operational event type.
The parameter preferredReverseMapping
is set to true
to define the reverse mapping.
Access to this method is authorized by token.
The mapping does not allow to specify EDI message version.
Array of objects (MappingItemDTO) Array that has all mapping data |
Success
Invalid data
Error
{- "mapping": [
- {
- "code": "1",
- "name": "Receive item from customer",
- "mailUnitType": "MI",
- "ediEvent": "EMA",
- "mailFlow": "O",
- "valid": true,
- "preferredReverseMapping": true
}
]
}
{- "responseStatus": {
- "statusCode": 0,
- "statusMessage": "string"
}, - "data": [ ]
}
Retrieves a list of mail items' business data - converted from imported EMSEVT
messages - based on query parameters
Access to this method is authorized by token.
Success
Invalid Input
Error
{- "responseStatus": {
- "statusCode": 0,
- "statusMessage": "string"
}, - "data": {
- "mailItems": [
- {
- "itemIdentifier": "EA063523423CH",
- "originCountry": "CH",
- "itemOriginOperator": "CHA",
- "itemDestinationOperator": "NZA",
- "destinationCountry": "NZ",
- "mailClass": "E",
- "productType": null,
- "customerAccountNumber": null,
- "originPostcode": "3005",
- "collectionPostcode": "3015",
- "networkEntryLocationType": 1,
- "itemLodgmentMode": 3,
- "itemCategory": null,
- "itemSubclass": "UA",
- "itemHandlingClass": null,
- "dutiableIndicator": "100",
- "customerChargingArrangement": null,
- "addressSection": {
- "placeOfOrigin": "Bern",
- "postcode": "0600",
- "placeOfDestination": "Auckland",
- "deliveryLocationType": "DS1",
- "houseIdentifier": "100a",
- "line1": "Wellington street",
- "line2": null,
- "consumerRegistrationNumber": null,
- "pickUpPointId": "Z Waiuku",
- "deliveryServiceType": null
}, - "senderInformation": {
- "telephone": "+41 123 45 56",
- "email": "sender@email.ch"
}, - "addresseeInformation": {
- "telephone": "+64 987 65 43",
- "email": "addressee@email.co.nz",
- "name": "John Doe",
- "language": "ENG"
}, - "measureInformation": {
- "grossWeight": 15.34,
- "netWeight": 12.45,
- "volume": 8.55
}, - "postagePaidInformation": {
- "amount": 25.65,
- "currency": "CHF"
}, - "cashOnDelivery": {
- "amount": null,
- "currency": null,
- "bic": null,
- "iban": null
}, - "alternativeAddress": {
- "cityTown": null,
- "houseIdentifier": null,
- "line1": null,
- "line2": null,
- "postcode": null
}, - "itemEvents": [
- {
- "operationalEventCode": "A",
- "eventTimeStamp": "2019-08-24T14:15:22Z",
- "eventOfficeOfExchange": null,
- "eventLocalOffice": "Burgernziel",
- "customsData": {
- "customsFacilityType": null,
- "customsRetentionReason": null,
- "customsOfficeID": null,
- "customsReleaseStatus": null
}, - "signatureName": null,
- "deliveryLocation": null,
- "itemArrivalStatus": null,
- "itemArrivalDirection": null,
- "processingPoint": {
- "processingPointID": "CHBRNA",
- "processingPointType": "SOR",
- "processingPointPostcode": null
}, - "exportFlow": null,
- "despatchOffice": null,
- "despatchId": null,
- "receptacleId": null,
- "reasonForReturn": null,
- "mailSource": null,
- "itemDeliveryType": null,
- "actionTaken": null,
- "actionReason": null
}
]
}
]
}
}
Imports mail item data.
Access to this method is authorized by token.
IIS limits the packet size; therefore: it is not recommented to include more than 200 mail items' data in a single call.
Success
Invalid data
Error
{- "mailItems": [
- {
- "itemIdentifier": "EA063523423CH",
- "originCountry": "CH",
- "itemOriginOperator": "CHA",
- "itemDestinationOperator": "NZA",
- "destinationCountry": "NZ",
- "mailClass": "E",
- "productType": null,
- "customerAccountNumber": null,
- "originPostcode": "3005",
- "collectionPostcode": "3015",
- "networkEntryLocationType": 1,
- "itemLodgmentMode": 3,
- "itemCategory": null,
- "itemSubclass": "UA",
- "itemHandlingClass": null,
- "dutiableIndicator": "100",
- "customerChargingArrangement": null,
- "addressSection": {
- "placeOfOrigin": "Bern",
- "postcode": "0600",
- "placeOfDestination": "Auckland",
- "deliveryLocationType": "DS1",
- "houseIdentifier": "100a",
- "line1": "Wellington street",
- "line2": null,
- "consumerRegistrationNumber": null,
- "pickUpPointId": "Z Waiuku",
- "deliveryServiceType": null
}, - "senderInformation": {
- "telephone": "+41 123 45 56",
- "email": "sender@email.ch"
}, - "addresseeInformation": {
- "telephone": "+64 987 65 43",
- "email": "addressee@email.co.nz",
- "name": "John Doe",
- "language": "ENG"
}, - "measureInformation": {
- "grossWeight": 15.34,
- "netWeight": 12.45,
- "volume": 8.55
}, - "postagePaidInformation": {
- "amount": 25.65,
- "currency": "CHF"
}, - "cashOnDelivery": {
- "amount": null,
- "currency": null,
- "bic": null,
- "iban": null
}, - "alternativeAddress": {
- "cityTown": null,
- "houseIdentifier": null,
- "line1": null,
- "line2": null,
- "postcode": null
}, - "itemEvents": [
- {
- "operationalEventCode": "A",
- "eventTimeStamp": "2019-08-24T14:15:22Z",
- "eventOfficeOfExchange": null,
- "eventLocalOffice": "Burgernziel",
- "customsData": {
- "customsFacilityType": null,
- "customsRetentionReason": null,
- "customsOfficeID": null,
- "customsReleaseStatus": null
}, - "signatureName": null,
- "deliveryLocation": null,
- "itemArrivalStatus": null,
- "itemArrivalDirection": null,
- "processingPoint": {
- "processingPointID": "CHBRNA",
- "processingPointType": "SOR",
- "processingPointPostcode": null
}, - "exportFlow": null,
- "despatchOffice": null,
- "despatchId": null,
- "receptacleId": null,
- "reasonForReturn": null,
- "mailSource": null,
- "itemDeliveryType": null,
- "actionTaken": null,
- "actionReason": null
}
]
}
]
}
{- "responseStatus": {
- "statusCode": 0,
- "statusMessage": "string"
}, - "data": [ ]
}
Imports customs declaration data.
Access to this method is authorized by token.
IIS limits the packet size; therefore: it is not recommented to include more than 200 customs declaration data in a single call.
Array of objects (CustomsDeclarationData) |
Success
Invalid data
Error
{- "customsDeclarations": [
- {
- "itemIdentifier": "CP163815968CH",
- "destinationOperator": "NLA",
- "originOperator": "CHA",
- "alternateIdentifiers": null,
- "attributeVersionNumber": 2,
- "customers": {
- "sender": {
- "identification": {
- "name": "John Smith",
- "reference": "1234567890",
- "additionalData": [
- "Office 407"
]
}, - "address": {
- "premises": {
- "line1": "Weltpoststrasse 4",
- "line2": null,
- "line3": null,
- "line4": null
}, - "countryCode": "CH",
- "city_town": "Bern",
- "postCode": "3015",
- "region": "BE"
}, - "contactDetails": {
- "emails": [
- "test_sender@upu.int"
], - "telephone": [
- "+41 123 45 67"
], - "fax": [
- "+41 123 45 68"
]
}
}, - "addressee": {
- "identification": {
- "name": "Ann Dupont",
- "reference": "99567890",
- "additionalData": [
- "HR department"
]
}, - "address": {
- "premises": {
- "line1": "Agnietenstraat 100a",
- "line2": null,
- "line3": null,
- "line4": null
}, - "countryCode": "NL",
- "city_town": "Gouda",
- "postCode": "2801",
- "region": "GZ"
}, - "contactDetails": {
- "emails": [
- "test_addressee@gmail.com"
], - "telephone": [
- "+31 765 54 32"
], - "fax": [
- "+31 765 54 31"
]
}
}
}, - "dangerousGood": {
- "hazardClass": null,
- "typeCode": null
}, - "declaredGrossWeight": 5.2,
- "measuredGrossWeight": 5.2,
- "insuredValue": {
- "currencyCode": "CHF",
- "amount": 50.25
}, - "postagePaidValue": {
- "currencyCode": "CHF",
- "amount": 16.95
}, - "additionalFee": {
- "currencyCode": "EUR",
- "amount": 5.99
}, - "customsTaxInformation": {
- "natureOfTransaction": {
- "code": "11",
- "description": null
}, - "customsProcedure": null,
- "totalDeclaredValue": {
- "currencyCode": "CHF",
- "amount": 5.2
}, - "observations": null,
- "associatedDocuments": [
- {
- "type": "380",
- "name": null,
- "identifier": null
}
], - "contentPieces": [
- {
- "pieceNumber": 1,
- "pieceNumberOfUnits": 3,
- "description": "Swiss chocolades",
- "declaredValue": {
- "currencyCode": "CHF",
- "amount": 5.2
}, - "netWeight": 5,
- "originLocationCode": "CH",
- "tariffHeading": "9999999999"
}
]
}, - "eventData": {
- "code": "XP",
- "dateTime": "2019-08-24T14:15:22Z",
- "location": {
- "code": "CH BRN",
- "function": "4"
}, - "associatedEntity": {
- "identifier": "CHZRHBNLHAGIACN50502009000196"
}, - "status": null,
- "reason": null
}
}
]
}
{- "responseStatus": {
- "statusCode": 0,
- "statusMessage": "string"
}, - "data": [ ]
}
Retrieves customs declaration business data - converted from imported ITMATT
messages - based on query parameters
Access to this method is authorized by token.
Success
Invalid Input
Error
{- "responseStatus": {
- "statusCode": 0,
- "statusMessage": "string"
}, - "data": {
- "customsDeclarations": [
- {
- "itemIdentifier": "CP163815968CH",
- "destinationOperator": "NLA",
- "originOperator": "CHA",
- "alternateIdentifiers": null,
- "attributeVersionNumber": 2,
- "customers": {
- "sender": {
- "identification": {
- "name": "John Smith",
- "reference": "1234567890",
- "additionalData": [
- null
]
}, - "address": {
- "premises": {
- "line1": null,
- "line2": null,
- "line3": null,
- "line4": null
}, - "countryCode": "CH",
- "city_town": "Bern",
- "postCode": "3015",
- "region": "BE"
}, - "contactDetails": {
- "emails": [
- null
], - "telephone": [
- null
], - "fax": [
- null
]
}
}, - "addressee": {
- "identification": {
- "name": "Ann Dupont",
- "reference": "99567890",
- "additionalData": [
- null
]
}, - "address": {
- "premises": {
- "line1": null,
- "line2": null,
- "line3": null,
- "line4": null
}, - "countryCode": "NL",
- "city_town": "Gouda",
- "postCode": "2801",
- "region": "GZ"
}, - "contactDetails": {
- "emails": [
- null
], - "telephone": [
- null
], - "fax": [
- null
]
}
}
}, - "dangerousGood": {
- "hazardClass": null,
- "typeCode": null
}, - "declaredGrossWeight": 5.2,
- "measuredGrossWeight": 5.2,
- "insuredValue": {
- "currencyCode": "CHF",
- "amount": 50.25
}, - "postagePaidValue": {
- "currencyCode": "CHF",
- "amount": 16.95
}, - "additionalFee": {
- "currencyCode": "EUR",
- "amount": 5.99
}, - "customsTaxInformation": {
- "natureOfTransaction": {
- "code": "11",
- "description": null
}, - "customsProcedure": null,
- "totalDeclaredValue": {
- "currencyCode": "CHF",
- "amount": 5.2
}, - "observations": null,
- "associatedDocuments": [
- {
- "type": "380",
- "name": null,
- "identifier": null
}
], - "contentPieces": [
- {
- "pieceNumber": 1,
- "pieceNumberOfUnits": 3,
- "description": "Swiss chocolades",
- "declaredValue": {
- "currencyCode": null,
- "amount": null
}, - "netWeight": 5,
- "originLocationCode": "CH",
- "tariffHeading": "9999999999"
}
]
}, - "eventData": {
- "code": "XP",
- "dateTime": "2019-08-24T14:15:22Z",
- "location": {
- "code": "CH BRN",
- "function": "4"
}, - "associatedEntity": {
- "identifier": "CHZRHBNLHAGIACN50502009000196"
}, - "status": null,
- "reason": null
}
}
]
}
}