v1

latestOpenAPI 3.0.32026-07-23519181.2 KB
Endpoints

Submit an upload initiate request

Obtain a signed URL to upload files to.

The SuccessRedirect and ErrorRedirect fields are optional.

If you provide them when you POST your file, then the response will be an automatic redirect.

If you do not require these redirects for your application, then do not provide these redirect fields.

File upload workflow

Once you receive a successful response from this endpoint, use the information in the response to POST your file to the URL provided.

You must use multipart encoding (multipart/form-data) NOT application/x-www-form-urlencoded.

The 'file' field must be the last field in the submitted form.

Error scenarios

<table> <tbody> <tr> <td><b>Scenario</b></td> <td><b>HTTP Status</b></td> <td><b>Code</b></td> </tr> <tr> <td>Invalid XML Payload</td> <td>400 (Bad Request)</td> <td>BAD_REQUEST</td> </tr> <tr> <td>A firewall rejected the request</td> <td>403 (Payload Forbidden)</td> <td>PAYLOAD_FORBIDDEN</td> </tr> <tr> <td>Internal server error</td> <td>500 (Internal Server Error)</td> <td>INTERNAL_SERVER_ERROR</td> </tr> </tbody> </table>

For error scenarios that are common across all APIs, and for error formats, see our reference guide for more on errors.

post/customs/declarations/file-upload

Headers

Acceptstring required
Example:application/vnd.hmrc.2.0+xml

Specifies the version of the API that you want to call. See versioning.

Content-Typestring required
Example:application/xml; charset=UTF-8

Specifies the format of the request body. Must be "application/xml; charset=UTF-8" or the request will be rejected with HTTP status code 415.

X-Badge-Identifierstring
Example:ABC123

Represents the end-user who is interacting with the subscribed application.

CSPs must have an X-Badge-Identifier or X-Submitter-Identifier.

Must be 6 to 12 characters, consisting of any combination of numeric digits and/or upper-case letters.

X-Eori-Identifierstring
Example:GB123456789000

The EORI associated with the originating owner of the declaration.

CSPs must have an X-Badge-Identifier or X-Eori-Identifier.

Must be numbers and letters with a maximum length of 17 characters.