DHL

DHL Customs Documents API

Upload customs documents for paperless customs clearance

GitHub OpenAPI
Business capability
Customs Declaration Management BC-2480.20

Operations 1

Each operation below carries the questions people ask an LLM about it and the instructions they give an agent to run it. Generated by API Evangelist overlay

POST /customs-documents Upload customs documents for paperless clearance · Upload customs documents for paperless customs clearance #
Ask an LLM
“How do I upload a commercial invoice for a shipment going to a country that allows paperless customs clearance?”
“Can I submit a proforma invoice as a customs document before creating the order?”
Tell an agent
Upload customs documents {documents}.
Submit a paperless customs invoice batch {documents} for clearance.

Documentation

📖
Documentation
https://developer.dhl.com/tracking
📖
Documentation
https://developer.dhl.com/api-reference/shipment-tracking-unified-push
📖
Documentation
https://developer.dhl.com/api-reference/additional-services-dhl-freight
📖
Documentation
https://developer.dhl.com/api-reference/authentication-dhl-ecommerce-americas
📖
Documentation
https://developer.dhl.com/api-reference/authentication-api-dhl-freight
📖
Documentation
https://developer.dhl.com/api-reference/authentication-api-post-parcel-germany
📖
Documentation
https://developer.dhl.com/api-reference/datafactory-autocomplete-20-post-parcel-germany
📖
Documentation
https://developer.dhl.com/api-reference/deutsche-post-hybrid-mail-shipments-e-post-post-parcel-germany
📖
Documentation
https://developer.dhl.com/api-reference/deutsche-post-international-post-parcel-germany
📖
Documentation
https://developer.dhl.com/api-reference/deutsche-post-internetmarke-post-parcel-germany
📖
Documentation
https://developer.dhl.com/api-reference/deutsche-post-print-mailing-dispatch-preparation-post-parcel-germany
📖
Documentation
https://developer.dhl.com/api-reference/deutsche-post-print-mailing-targeting-post-parcel-germany
📖
Documentation
https://developer.dhl.com/parcel-connect
📖
Documentation
https://developer.dhl.com/api-reference/econnect-beta-dhl-ecommerce-europe
📖
Documentation
https://developer.dhl.com/api-reference/dhl-parcel-de-pickup-post-parcel-germany
📖
Documentation
https://developer.dhl.com/api-reference/dhl-parcel-de-postnumber-post-parcel-germany
📖
Documentation
https://developer.dhl.com/api-reference/dhl-parcel-de-private-shipping-post-parcel-germany
📖
Documentation
https://developer.dhl.com/api-reference/dhl-parcel-de-returns-post-parcel-germany
📖
Documentation
https://developer.dhl.com/api-reference/parcel-de-shipping-post-parcel-germany-v2
📖
Documentation
https://developer.dhl.com/api-reference/dhl-parcel-de-shipment-tracking-post-parcel-germany
📖
Documentation
https://developer.dhl.com/api-reference/dgf-document
📖
Documentation
https://developer.dhl.com/api-reference/duty-tax-dhl-ecommerce-americas
📖
Documentation
https://developer.dhl.com/api-reference/ecommerce-uk
📖
Documentation
https://developer.dhl.com/api-reference/parcel-eu
📖
Documentation
https://developer.dhl.com/api-reference/pickup-cancellation-dhl-ecommerce-india-blue-dart
📖
Documentation
https://developer.dhl.com/api-reference/price-quote-dhl-freight
📖
Documentation
https://developer.dhl.com/api-reference/print-dhl-freight
📖
Documentation
https://developer.dhl.com/api-reference/product-dhl-freight
📖
Documentation
https://developer.dhl.com/api-reference/product-and-sub-product-pickup-detail-dhl-ecommerce-india-blue-dart
📖
Documentation
https://developer.dhl.com/api-reference/product-finder-dhl-ecommerce-americas
📖
Documentation
https://developer.dhl.com/api-reference/products-api-post-parcel-germany
📖
Documentation
https://developer.dhl.com/api-reference/dgf-push-api
📖
Documentation
https://developer.dhl.com/api-reference/registration-pickup-dhl-ecommerce-india-blue-dart
📖
Documentation
https://developer.dhl.com/api-reference/return-label-dhl-ecommerce-americas
📖
Documentation
https://developer.dhl.com/api-reference/shipment-booking-dhl-freight
📖
Documentation
https://developer.dhl.com/api-reference/dgf-shipment-booking
📖
Documentation
https://developer.dhl.com/api-reference/shipment-label-dhl-global-forwarding
📖
Documentation
https://developer.dhl.com/api-reference/dgf-shipment-status
📖
Documentation
https://developer.dhl.com/api-reference/shipment-tracking-dhl-ecommerce-india-blue-dart
📖
Documentation
https://developer.dhl.com/api-reference/shipment-tracking-v2-dhl-global-forwarding
📖
Documentation
https://developer.dhl.com/api-reference/time-table-dhl-freight
📖
Documentation
https://developer.dhl.com/api-reference/tracking-dhl-ecommerce-americas

Specifications

Schemas & Data

Work with this as data

Every API here is available over the APIs.io API and to AI agents over MCP.

MCP server

One button, every client — Claude, Cursor, VS Code and the rest.

https://apis.io/mcp

Tools for apis

7 MCP tools reach this
  • find_apisBrowse and filter every API in the catalog.
  • get_api_artifactsOne API's artifacts, grouped by type.
  • get_openapiThe primary OpenAPI for this API.
  • find_similar_apisAPIs that look like this one.
  • apis_io_searchSTART HERE — APIs, providers and tags for one query, each with its total.
  • resolveTurn a domain, URL or GitHub org into the provider it belongs to.
  • find_cohortsEvery scored population of providers in the catalog.
All 92 tools →

Call it yourself

curl for this page
This API
curl "https://apis.io/api/v1/apis/dhl:dhl-customs-documents-api"
All apis
curl "https://apis.io/api/v1/apis?limit=25"

Calls without X-API-Key need no key. Calls with it need a paid plan — get a key.

Get an API key

Free tier, no form to fill in. Signing in shares your email address with us — we store it to create your key and to recognise you if you sign in with another provider. By signing up you are subscribing to the APIs.io and API Evangelist newsletters — you can unsubscribe from any issue. See our Privacy Policy and Terms.

A second provider on the same verified email joins the account you already have.

OpenAPI Specification

dhl-customs-documents-api-openapi.yml Raw ↑
openapi: 3.2.0
info:
  title: Dhl Customs Documents API
  version: 2.2.0
  description: 'Operations tagged Customs Documents across 2 of this provider''s published API definitions: dhl-parcel-de-shipping-post-parcel-germany-v2-openapi.yml, dhl-parcel-de-shipping-post-parcel-germany-v2-openapi.yml. Each path carries the servers of the definition it was published in.'
servers:
- url: https://api-eu.dhl.com/parcel/de/shipping/v2
  description: Productive Server
- url: https://api-sandbox.dhl.com/parcel/de/shipping/v2
  description: Sandbox Server
security:
- ApiKey: []
- BasicAuth: []
- OAuth2: []
tags:
- name: Customs Documents
  description: Upload customs documents for paperless customs clearance
paths:
  /customs-documents:
    post:
      tags:
      - Customs Documents
      summary: Upload customs documents for paperless customs clearance
      description: 'Uploads customs-related invoice documents (commercial invoice or proforma invoice) for international shipments.


        Documents must be uploaded before shipment creation (`POST /orders`). The response contains a `batchId` which must be provided when creating the corresponding shipment.


        Uploaded documents may be used for paperless customs clearance (`paperlessCustoms`) or to fulfill country-specific requirements for electronic invoice submission, where customs authorities require a digital copy of the invoice in addition to customs data and accompanying paper documents.


        A `batchId` can only be used for a single shipment. Reusing a `batchId` that has already been linked to a shipment results in an error.


        Only PDF documents are accepted. Each file may not exceed 1 MB and the filename must not exceed 60 characters. Up to 4 documents can be uploaded per request. Uploaded but unused documents are automatically deleted after a retention period.'
      operationId: customsDocumentsPost
      parameters:
      - name: Accept-Language
        in: header
        description: Control the APIs response language via locale abbreviation. English (en-US) and german (de-DE) are supported. If not specified, the default is english.
        schema:
          type: string
        example: de-DE
      requestBody:
        description: One or more PDF customs documents and their metadata, submitted as multipart/form-data (documents[0].documentType, documents[0].userDefinedReference, documents[0].data, documents[1]...).
        content:
          multipart/form-data:
            schema:
              $ref: '#/components/schemas/CustomsDocumentUploadRequest'
            examples:
              invoice:
                summary: Upload a customs invoice
                description: Attach a PDF file as documents[0].data. The placeholder below is not literal file content.
                value:
                  documents:
                  - documentType: Invoice
                    userDefinedReference: MyInvoiceForUs
                    data: <PDF file content>
        required: true
      responses:
        '201':
          description: Customs documents accepted
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CustomsDocumentBatchResponse'
              examples:
                uploadedInvoice:
                  summary: Customs invoice accepted
                  value:
                    batchId: 45685f64-1234-1234-b3fc-2c963f66a123
                    documents:
                    - filename: invoice_2026.pdf
                      userDefinedReference: MyInvoiceForUs
                    validationMessages: []
        '400':
          description: Bad Request - one or more documents failed validation. No batchId is created.
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/CustomsDocumentValidationResponse'
              examples:
                invalidInvoice:
                  summary: Customs invoice failed validation
                  value:
                    items:
                    - documentType: Invoice
                      validationMessages:
                      - property: data
                        validationMessage: The uploaded file is invalid.
                        validationState: Error
        '401':
          $ref: '#/components/responses/Unauthorized'
        '413':
          $ref: '#/components/responses/ContentTooLarge'
        '429':
          $ref: '#/components/responses/TooManyRequests'
        '500':
          $ref: '#/components/responses/InternalServerError'
    servers:
    - url: https://api-eu.dhl.com/parcel/de/shipping/v2
      description: Productive Server
    - url: https://api-sandbox.dhl.com/parcel/de/shipping/v2
      description: Sandbox Server
components:
  schemas:
    CustomsDocumentBatchResponse:
      required:
      - batchId
      type: object
      properties:
        batchId:
          type: string
          format: uuid
          description: Unique identifier for this batch of uploaded customs documents. Provide this value in the ''paperlessCustoms'' service attribute of POST /orders to attach the documents to a shipment. A batchId can only be consumed by one shipment.
          example: 45685f64-1234-1234-b3fc-2c963f66a123
        documents:
          type: array
          description: The accepted documents of this batch.
          items:
            $ref: '#/components/schemas/CustomsDocumentReference'
        validationMessages:
          type: array
          description: Optional warnings for the batch, for example truncated field values.
          items:
            $ref: '#/components/schemas/ValidationMessageItem'
      description: Response of a successful customs document upload.
    CustomsDocumentUploadItem:
      required:
      - documentType
      - data
      type: object
      properties:
        documentType:
          type: string
          description: Type of the customs document.
          example: Invoice
          enum:
          - Invoice
          - CN23
        userDefinedReference:
          maxLength: 60
          minLength: 0
          type: string
          description: Optional customer-defined reference for the document, e.g. an order or file reference. Values exceeding 60 characters are truncated and result in a warning.
          example: MyFile
        data:
          type: string
          format: binary
          description: The PDF file content. Only application/pdf is accepted. Maximum file size 1 MB, maximum filename length 60 characters.
      description: A single customs document and its metadata.
    CustomsDocumentReference:
      type: object
      properties:
        documentType:
          type: string
          example: Invoice
        filename:
          type: string
          example: invoice_2026.pdf
        userDefinedReference:
          type: string
          example: MyFile
      description: Reference to a single uploaded customs document.
    CustomsDocumentValidationItem:
      type: object
      properties:
        documentType:
          type: string
          example: Invoice
        validationMessages:
          type: array
          items:
            $ref: '#/components/schemas/ValidationMessageItem'
      description: Validation result for a single uploaded document.
    CustomsDocumentUploadRequest:
      type: object
      required:
      - documents
      properties:
        documents:
          minItems: 1
          maxItems: 1
          type: array
          description: List of customs documents to upload. Submitted as multipart form fields using bracket notation, e.g. documents[0].documentType, documents[0].userDefinedReference, documents[0].data, documents[1]...
          items:
            $ref: '#/components/schemas/CustomsDocumentUploadItem'
      description: Multipart/form-data request body for uploading customs documents. Currently, only one document can be uploaded per request. Support for up to four documents per request is planned for a future release.
    RequestStatus:
      type: object
      description: General status description for the attached response or response item.
      required:
      - title
      - status
      properties:
        title:
          type: string
        statusCode:
          description: The status code of the response. Usually, but not necessarliy the HTTP status code. Same as attribut "status" but deprecated. Do not use. Will be removed in the next major version.
          type: integer
          format: int32
        status:
          description: The status code of the response. Usually, but not necessarliy the HTTP status code.
          type: integer
          format: int32
        instance:
          type: string
          description: A URI reference that identifies the specific occurrence of the problem.
        detail:
          maxLength: 80
          minLength: 0
          type: string
    CustomsDocumentValidationResponse:
      type: object
      properties:
        items:
          type: array
          description: One entry per uploaded document that failed validation.
          items:
            $ref: '#/components/schemas/CustomsDocumentValidationItem'
      description: Response returned when one or more uploaded customs documents failed validation. No batchId is created in this case.
    ValidationMessageItem:
      type: object
      properties:
        property:
          type: string
          description: The property that is affected by the validation message.
          example: dimension.weight
        validationMessage:
          type: string
          description: The validation message describing the error.
          example: The weight is too high
        validationState:
          type: string
          description: The validation state resulting from the error.
          example: Error
      description: Representation of a validation message of a shipment container containing the most important information.
  responses:
    TooManyRequests:
      description: Too Many Requests
      content:
        application/problem+json:
          schema:
            $ref: '#/components/schemas/RequestStatus'
          examples:
            tooManyRequests:
              summary: Request rate limit exceeded
              value:
                title: Too Many Requests
                statusCode: 429
                status: 429
                detail: The request rate limit has been exceeded.
    ContentTooLarge:
      description: Content Too Large
      content:
        application/problem+json:
          schema:
            $ref: '#/components/schemas/RequestStatus'
          examples:
            contentTooLarge:
              summary: Request body exceeds the accepted size
              value:
                title: Content Too Large
                statusCode: 413
                status: 413
                detail: The request exceeds the maximum allowed size.
    Unauthorized:
      description: Unauthorized
      content:
        application/problem+json:
          schema:
            $ref: '#/components/schemas/RequestStatus'
          examples:
            unauthorized:
              summary: Authentication failed
              value:
                title: Unauthorized
                statusCode: 401
                status: 401
                detail: Authentication is required or the supplied credentials are invalid.
    InternalServerError:
      description: Internal Server Error
      content:
        application/problem+json:
          schema:
            $ref: '#/components/schemas/RequestStatus'
          examples:
            internalServerError:
              summary: Unexpected server error
              value:
                title: Internal Server Error
                statusCode: 500
                status: 500
                detail: An unexpected error occurred.
  securitySchemes:
    BasicAuth:
      type: http
      scheme: basic
      description: Deprecated. Do not use. Will be removed in the next major version. Credentials provided here are username and password of the partner system.
    ApiKey:
      type: apiKey
      description: API key to authorize requests. API key can be obtained at [DHL's development portal](https://developer.dhl.com).
      name: dhl-api-key
      in: header
    OAuth2:
      type: oauth2
      description: See https://developer.dhl.com/api-reference/authentication-api-post-parcel-germany. For the POST call to get a token, provide all parameters in the request body. Refer to the above link for details, or to the RFC describing OAuth2 Password Grant. After having obtained the access token, use this as Bearer token in the HTTP authorization header.
      flows:
        password:
          tokenUrl: /parcel/de/account/auth/ropc/v1/token
          scopes: {}
x-refined-from:
- dhl-parcel-de-shipping-post-parcel-germany-v2-openapi.yml
- dhl-parcel-de-shipping-post-parcel-germany-v2-openapi.yml