---
title: "Import a file"
method: POST
path: "/v4/files/import"
tags: ["Files"]
---

# Import a file

`POST /v4/files/import`

Import a file from a URL. The file will be downloaded and optionally attached to an order.

## Request body

- ImportFileV4RequestDto
  - `url` string, required
  - `orderId` string, required — The ID of the order to which the file will be attached.
  - `purpose` 'order_invoice', required — The purpose of the file.
  - `name` string — The name of the file. If not provided, the name of the file will be parsed from the URL path or Content-Disposition header..
  - `mimeType` string — The MIME type of the file. If not provided, the MIME type will be parsed from the URL response header.
  - `expectedMd5` string — The expected MD5 hash of the file. If provided, the file will be validated against the expected MD5 hash and not imported if the hash does not match.
  - `expectedSizeBytes` number — The expected number of bytes to be downloaded. If provided, the file will be validated against the expected size and not imported if the size does not match.

## Response `201`

The created order.

- FileV4ResponseDto
  - `id` string, required
  - `importUrl` string — The URL the file was imported from.
  - `importStatus` 'pending' | 'succeeded' | 'failed', required
  - `orderId` string, required
  - `purpose` string, required

---

[API](https://skmtc.net/slopepay/apis/slope-v4-api.md) · [All operations](https://skmtc.net/slopepay/apis/slope-v4-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/slopepay/slope-v4-api/revisions/cbdbc861073b/schema)
