Sample - Stripe API
POST/v1/files

Create a file

To upload a file to Stripe, you need to send a request of type multipart/form-data. Include the file you want to upload in the request, and the parameters for creating a file.

All of Stripe’s officially supported Client libraries support sending multipart/form-data.

  • RetriesRetries up to 2×, 500ms backoff, 30s timeout.
  • IdempotentThe SDK sends Idempotency-Key, so a retried request is only applied once.

4 body fields
expandarray<string>optional
Specifies which fields in the response should be expanded.
filestringrequired
A file to upload. Make sure that the specifications follow RFC 2388, which defines file transfers for the `multipart/form-data` protocol.
file_link_dataobjectoptional
Optional parameters that automatically create a [file link](https://api.stripe.com#file_links) for the newly created file.
purposestringrequired
The [purpose](https://docs.stripe.com/file-upload#uploading-a-file) of the uploaded file.
Allowed:account_requirementadditional_verificationbusiness_iconbusiness_logocustomer_signaturedispute_evidenceidentity_documentissuing_regulatory_reportingpci_documentplatform_terms_of_servicetax_document_user_uploadterminal_android_apk

2 status codes
200Successful response.
createdintegerrequired
Time at which the object was created. Measured in seconds since the Unix epoch.
expires_atintegeroptional
The file expires and isn't available at this time in epoch seconds.
filenamestringoptional
The suitable name for saving the file to a filesystem.
idstringrequired
Unique identifier for the object.
linksobjectoptional
A list of [file links](https://api.stripe.com#file_links) that point at this file.
objectstringrequired
String representing the object's type. Objects of the same type share the same value.
Allowed:file
purposestringrequired
The [purpose](https://docs.stripe.com/file-upload#uploading-a-file) of the uploaded file.
Allowed:account_requirementadditional_verificationbusiness_iconbusiness_logocustomer_signaturedispute_evidencedocument_provider_identity_documentfinance_report_runfinancial_account_statementidentity_documentidentity_document_downloadableissuing_regulatory_reporting
sizeintegerrequired
The size of the file object in bytes.
titlestringoptional
A suitable title for the document.
typestringoptional
The returned file type (for example, `csv`, `pdf`, `jpg`, or `png`).
urlstringoptional
Use your live secret API key to download the file from this URL.
defaultError response.
errorobjectrequired

Error handling

Any other status is an error: Error response.