Files
Files let you attach documents and images to other objects: evidence to a dispute, attachments to an invoice and images to a product.
The File object
- Name
object
- Type
- "file",
- Description
- The object's type.
- Name
id
- Type
- string,
- Description
- Unique identifier for the object.
- Name
live
- Type
- boolean or null,
- Description
trueif the object is live, orfalseif it's in a sandbox.
- Name
created_at
- Type
- integer,
- Description
- When the object was created, in milliseconds since the Unix epoch.
- Name
name
- Type
- string,
- Description
- The name of the file.
- Name
purpose
- Type
- enum,
- Description
- The file's intended use.
- Properties
- Name
size
- Type
- integer,
- Description
- The size of the file in bytes.
The File object
Get a file
Retrieve a file by its ID.
Required parameters
- Name
id
- Type
- string,
- Description
- The ID of the file to retrieve.
Optional parameters
- Name
expand
- Type
- empty object,
- Description
- Related objects to expand in the response.
Returns
Returns the file object.
Retrieve a file
Response example
View a file
Viewing a file returns its contents. Browsers display images and PDFs, and download other files.
Required parameters
- Name
id
- Type
- string,
Returns
Returns the file’s contents.
View a file
List all files
Retrieve a paginated list of files, most recently created first.
Optional parameters
- Name
expand
- Type
- empty object,
- Description
- Related objects to expand in the response.
- Name
ending_before
- Type
- string,
- Description
- The ID of the object to list before, for pagination.
- Name
starting_after
- Type
- string,
- Description
- The ID of the object to list after, for pagination.
- Name
limit
- Type
- integer, at least 1, at most 1000, default is 50
- Description
- The maximum number of objects to return, from 1 to 1000. Defaults to 50.
- Name
filters
- Type
- object, object, or object,
- Description
- Properties
Returns
Returns a list of file objects.
List all files
Response example
Create a file
Uploading a file returns the ID that a dispute, invoice or product references. The request body is multipart/form-data, not JSON.
Files attached to a dispute as evidence must be PDF, JPEG, PNG or plain text.
Required parameters
- Name
file
- Type
- string,
- Description
- The file to upload, as binary data.
- Name
purpose
- Type
- enum,
- Description
- The file's intended use.
- Properties
Returns
Returns the file object.
Create a file
Response example
Update a file
Updating a file changes its name.
Required parameters
- Name
id
- Type
- string,
Optional parameters
- Name
name
- Type
- string,
- Description
- The name of the file.
Returns
Returns the file object.