Files
This object represents files hosted on Stripe’s servers. You can upload files with the create file request (for example, when uploading dispute evidence). Stripe also creates files independently (for example, the results of a Sigma scheduled query).
Related guide: File upload guide
The File object
Attributes
- idstring
Unique identifier for the object.
- purposeenum
The purpose of the uploaded file.
- typenullable string
The returned file type (for example,
csv
,pdf
,jpg
, orpng
).
More attributes
- objectstring
- createdtimestamp
- expires_
atnullable timestamp - filenamenullable string
- linksnullable object
- sizeinteger
- titlenullable string
- urlnullable string
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
.
Parameters
- fileobjectRequired
A file to upload. Make sure that the specifications follow RFC 2388, which defines file transfers for the
multipart/form-data
protocol. - purposeenumRequired
The purpose of the uploaded file.
More parameters
- file_
link_ dataobject
Returns
Returns the file object.
Retrieve a file
Retrieves the details of an existing file object. After you supply a unique file ID, Stripe returns the corresponding file object. Learn how to access file contents.
Parameters
No parameters.
Returns
If the identifier you provide is valid, a file object returns. If not, Stripe raises an error.
List all files
Returns a list of the files that your account has access to. Stripe sorts and returns the files by their creation dates, placing the most recently created files at the top.
Parameters
- purposestring
Filter queries by the file purpose. If you don’t provide a purpose, the queries return unfiltered files.
More parameters
- createdobject
- ending_
beforestring - limitinteger
- starting_
afterstring
Returns
A dictionary with a data
property that contains an array of up to limit
files, starting after the starting_after
file. Each entry in the array is a separate file object. If there aren’t additional available files, the resulting array is empty.