Show / Hide Table of Contents

    Getting Customs Docs and Invoices

    • v1
    • customs
    • docs
    • documents
    • pro
    • api
    • consignments

    This page explains the various way in which SortedPRO can return return customs documents and commercial invoices.


    Customs Docs in PRO

    When shipping internationally, SortedPRO will automatically determine if customs documentation is required for a consignment. SortedPRO can automatically generate CN22, CN23, or Commercial Invoice documents in PDF format and will determine which document is appropriate for any allocated consignment. The Customs Docs APIs enable you to retrieve the pre-generated documents.

    Note

    Following the UK's departure from the EU, certain additional consignment properties must be passed in order for PRO to generate customs documentation for UK-originating international consignments. In addition, certain carriers have their own data requirements that UK-originating international consignments must meet in order to be considered for allocation to that carrier.

    For an explanation of Brexit-related data requirements, see the Brexit Data Guide page.

    The Customs Docs API has three endpoints:

    • Get Commercial Invoice - returns a consignment's commercial invoice.
    • Get Customs Document - returns a CN22 or CN23 document for a particular package.
    • Get Customs Documents - returns all customs documents for a particular consignment.
    Caution

    You can only retrieve documents for consignments that have been allocated to a carrier. If you attempt to return labels for an unallocated consignment, PRO returns an error.

    Getting Commercial Invoices

    To call Get Commercial Invoice, send a GET request to https://api.electioapp.com/consignments/docs/commercialinvoice/{consignmentReference}. PRO returns the commercial invoice for the relevant consignment as a base-64 encoded byte array.

    Note

    For full reference information on the Get Commercial Invoice endpoint, see the API reference.

    Getting an Individual Customs Document

    To call Get Customs Document, send a GET request to https://api.electioapp.com/consignments/docs/{customsDocumentType}/{consignmentReference}/{packageReference}. The {customsDocumentType} can return either CN22 or CN23 documents.

    PRO returns the relevant document as a base-64 encoded byte array.

    Note

    For full reference information on the Get Customs Document endpoint, see the API reference.

    Next Steps

    • Learn how to get and print delivery labels at the Getting Labels page.
    • Learn how to add consignments to a carrier manifest at the Manifesting Consignments page.
    • Learn how to track consignments at the Tracking Consignments page.
    Note

    All of the URLs and examples given in this documentation relate to PRO's live production environment. To call APIs in the sandbox environment, substitute the api.electioapp.com portion of the API's base URL with apisandbox.electioapp.com. Don't forget to use your sandbox API key (as opposed to your production API key) when making the call.

    For more information on PRO's sandbox, see Using the Sandbox Environment.

    Back to top Copyright © Sorted Group 2023. Generated by DocFX