Skip to main content

Your feedback (opens in new tab) will help us to improve this service.

Customs Declarations API

REST
Version 2.0 - beta
27 May 2026
Sandbox base URL https://test-api.service.hmrc.gov.uk
Production base URL https://api.service.hmrc.gov.uk

Overview

This API allows the submission of any UCC declarations for asynchronous processing by the customs declarations service, to enable a user to have their declarations accepted by means of a single API.

The API takes any UCC declaration payload. It also allows for the submission of a cancellation request (pre-clearance) and provides a method of securely uploading additional documentation to support a declaration submission.

The file-upload endpoint is used to initiate a file upload as part of the declaration submission process. An example document you may be requested to upload could be a paper copy of a licence. This endpoint is used to initiate a file upload where a signed URL is returned by the endpoint to be used in the file upload workflow.

Errors

We use standard HTTP status codes to show whether an API request succeeded or not. They are usually in the range:

  • 200 to 299 if it succeeded, including code 202 if it was accepted by an API that needs to wait for further action
  • 400 to 499 if it failed because of a client error by your application
  • 500 to 599 if it failed because of an error on our server

Errors specific to each API are shown in the Endpoints section, under Response. See our reference guide for more on errors.

Testing

You can use the HMRC Developer Sandbox to test the Customs Declarations API. The Sandbox is an enhanced testing service that functions as a simulator of HMRC’s production environment. To use the Customs Declaration API you will need to create your own test user. To create your own test user:

  • Use the Create Test User API
  • Ensure under ‘Body’ “customs-services” is requested. To use an EORI from the Test Data Library, provide it as part of the request.
  • The first time you call this API the username and password log in box should appear (select do not have credentials, follow the steps & enter the username/password provided).
  • If successful this will prompt the grant authority to your application and select approve. If correct, you should see a 200 response showing some test data including a username, password and EORI.
  • After completing the above, if you call the Customs Declaration API, the same process should occur whereby it will ask for a username and password (Please enter the Username and Password that is in the test data generated from the step above when calling the create test user API) Please Note: 443 is the only allowed port, which means port 443 will need to be used in the callback URL.

Versioning

When an API changes in a way that is backwards-incompatible, we increase the version number of the API. See our reference guide for more on versioning.



Endpoints

Version Environments Endpoints
Version 2.0 - beta
(opens in new tab)
Sandbox 2.0 endpoints
Version 1.0 - beta
(opens in new tab)
Sandbox and Production 1.0 endpoints