# PostFiles

From **Stripe API**.

`POST /v1/files`

<p>To upload a file to Stripe, you’ll need to send a request of type <code>multipart/form-data</code>. The request should contain the file you would like to upload, as well as the parameters for creating a file.</p>

<p>All of Stripe’s officially supported Client libraries should have support for sending <code>multipart/form-data</code>.</p>

## Request body

- Required: true
### `multipart/form-data`

- Type: `object`

```json
{"additionalProperties":false,"properties":{"expand":{"description":"Specifies which fields in the response should be expanded.","items":{"maxLength":5000,"type":"string"},"type":"array"},"file":{"description":"A file to upload. The file should follow the specifications of RFC 2388 (which defines file transfers for the `multipart/form-data` protocol).","type":"string"},"file_link_data":{"description":"Optional parameters to automatically create a [file link](https://stripe.com/docs/api#file_links) for the newly created file.","properties":{"create":{"type":"boolean"},"expires_at":{"format":"unix-time","type":"integer"},"metadata":{"anyOf":[{"additionalProperties":{"type":"string"},"type":"object"},{"enum":[""],"type":"string"}]}},"required":["create"],"title":"file_link_creation_params","type":"object"},"purpose":{"description":"The [purpose](https://stripe.com/docs/file-upload#uploading-a-file) of the uploaded file.","enum":["account_requirement","additional_verification","business_icon","business_logo","customer_signature","dispute_evidence","identity_document","pci_document","tax_document_user_upload"],"type":"string","x-stripeBypassValidation":true}},"required":["file","purpose"],"type":"object"}
```

## Security

### `basicAuth`

- Type: `http`
- Request header: `Authorization`
- Scheme: `basic`
Send credentials in the `Authorization` request header using the `Basic` scheme.

Basic HTTP authentication. Allowed headers-- Authorization: Basic <api_key> | Authorization: Basic <base64 hash of `api_key:`>

### `bearerAuth`

- Type: `http`
- Request header: `Authorization`
- Scheme: `bearer`
- Bearer format: `auth-scheme`
Send the token in the `Authorization` request header using the `Bearer` scheme.

Bearer HTTP authentication. Allowed headers-- Authorization: Bearer <api_key>

## Responses

### `200`

Successful response.

### `application/json`

- Type: `object`

This is an object representing a file hosted on Stripe's servers. The
file may have been uploaded by yourself using the [create file](https://stripe.com/docs/api#create_file)
request (for example, when uploading dispute evidence) or it may have
been created by Stripe (for example, the results of a [Sigma scheduled
query](#scheduled_queries)).

Related guide: [File Upload Guide](https://stripe.com/docs/file-upload).

```json
{"description":"This is an object representing a file hosted on Stripe's servers. The\nfile may have been uploaded by yourself using the [create file](https://stripe.com/docs/api#create_file)\nrequest (for example, when uploading dispute evidence) or it may have\nbeen created by Stripe (for example, the results of a [Sigma scheduled\nquery](#scheduled_queries)).\n\nRelated guide: [File Upload Guide](https://stripe.com/docs/file-upload).","properties":{"created":{"description":"Time at which the object was created. Measured in seconds since the Unix epoch.","format":"unix-time","type":"integer"},"expires_at":{"description":"The time at which the file expires and is no longer available in epoch seconds.","format":"unix-time","nullable":true,"type":"integer"},"filename":{"description":"A filename for the file, suitable for saving to a filesystem.","maxLength":5000,"nullable":true,"type":"string"},"id":{"description":"Unique identifier for the object.","maxLength":5000,"type":"string"},"links":{"description":"A list of [file links](https://stripe.com/docs/api#file_links) that point at this file.","nullable":true,"properties":{"data":{"description":"Details about each object.","items":{"$ref":"#/components/schemas/file_link"},"type":"array"},"has_more":{"description":"True if this list has another page of items after this one that can be fetched.","type":"boolean"},"object":{"description":"String representing the object's type. Objects of the same type share the same value. Always has the value `list`.","enum":["list"],"type":"string"},"url":{"description":"The URL where this list can be accessed.","maxLength":5000,"type":"string"}},"required":["data","has_more","object","url"],"title":"FileFileLinkList","type":"object","x-expandableFields":["data"]},"object":{"description":"String representing the object's type. Objects of the same type share the same value.","enum":["file"],"type":"string"},"purpose":{"description":"The [purpose](https://stripe.com/docs/file-upload#uploading-a-file) of the uploaded file.","enum":["account_requirement","additional_verification","business_icon","business_logo","customer_signature","dispute_evidence","document_provider_identity_document","finance_report_run","identity_document","identity_document_downloadable","pci_document","selfie","sigma_scheduled_query","tax_document_user_upload"],"type":"string","x-stripeBypassValidation":true},"size":{"description":"The size in bytes of the file object.","type":"integer"},"title":{"description":"A user friendly title for the document.","maxLength":5000,"nullable":true,"type":"string"},"type":{"description":"The type of the file returned (e.g., `csv`, `pdf`, `jpg`, or `png`).","maxLength":5000,"nullable":true,"type":"string"},"url":{"description":"The URL from which the file can be downloaded using your live secret API key.","maxLength":5000,"nullable":true,"type":"string"}},"required":["created","id","object","purpose","size"],"title":"File","type":"object","x-expandableFields":["links"],"x-resourceId":"file"}
```

### `default`

Error response.

### `application/json`

- Type: `object`

An error response from the Stripe API

```json
{"description":"An error response from the Stripe API","properties":{"error":{"$ref":"#/components/schemas/api_errors"}},"required":["error"],"type":"object"}
```

## Request examples

### cURL

```shell
curl --request POST \
  --url https://files.stripe.com/v1/files \
  --header 'content-type: multipart/form-data' \
  --data '{
  "expand": [
    "string"
  ],
  "file": "string",
  "file_link_data": {
    "create": true,
    "expires_at": 1,
    "metadata": "string"
  },
  "purpose": "string"
}'
```
