Files

This object represents files hosted on Bias servers. Use the create resource to upload files (for dispute evidence). Bias also creates files independently (for example, when ticket attachments are uploaded).

The File object

Name
object
Type
"file",
Description
Literal representing the object’s type.
Name
id
Type
string,
Description
Unique identifier for the object.
Name
live
Type
boolean,
Description
Has the value true if the object exists in a production environment or the value false if the object exists in a sandbox environment.
Name
created_at
Type
integer,
Description
Time at which the object was created. Measured in milliseconds since the Unix epoch.
Name
name
Type
string,
Description
The name of the file.
Name
purpose
Type
enum,
Description
The file’s intented use.
Array item properties
Name
size
Type
integer,
Description
The size of the file in bytes.

The File object

{
  "object": "file",
  "live": false,
  "id": "file_nwjUEfzvIm7skTF9hlH4P2",
  "created_at": 1750000000000,
  "name": "receipt.png",
  "purpose": "dispute_evidence",
  "size": 1024
}

Get a file

Retrieve a file by its ID.

Returns

Returns the file object.

Retrieve a file

const file = await bias.files.get("id");

Response example

{
  "object": "file",
  "live": false,
  "id": "file_nwjUEfzvIm7skTF9hlH4P2",
  "created_at": 1750000000000,
  "name": "receipt.png",
  "purpose": "dispute_evidence",
  "size": 1024
}

List all files

Retrieve a paginated list of files.

Optional parameters

Name
ending_before
Type
string,
Description
A cursor for use in pagination. ending_before is an object ID that results will end before. Used to move backward through the list.
Name
starting_after
Type
string,
Description
A cursor for use in pagination. starting_after is an object ID that results will start after. Used to move forward through the list.
Name
limit
Type
number, at least 1, at most 1000, default is 50
Description
Maximum number of objects to return.
Name
filters
Type
,
Description
Filters to apply to the list. Combine multiple conditions with and and or.
Child properties

Returns

Returns a list of file objects.

List all files

const file = await bias.files.list();

Response example

{
  "object": "list",
  "items": [
    {
      "object": "file",
      "live": false,
      "id": "file_nwjUEfzvIm7skTF9hlH4P2",
      "created_at": 1750000000000,
      "name": "receipt.png",
      "purpose": "dispute_evidence",
      "size": 1024
    }
  ],
  "has_more": false
}

Create a file

Upload a file for use as dispute evidence.

Requests to this endpoint must be application/multipart instead of application/json. See RFC 7578 for implementation details.

Required parameters

Name
file
Type
string,
Description
The file to upload, as binary data.
Name
purpose
Type
enum,
Description
The file’s intended use.
Array item properties

Returns

Returns the file object.

Create a file

const file = await bias.files.create({
  file: {},
  purpose: "dispute_evidence"
});

Response example

{
  "object": "file",
  "live": false,
  "id": "file_nwjUEfzvIm7skTF9hlH4P2",
  "created_at": 1750000000000,
  "name": "receipt.png",
  "purpose": "dispute_evidence",
  "size": 1024
}

Update a file

Change a file's attributes, namely its name.

Optional parameters

Name
name
Type
string,
Description
The name of the file.

Returns

Returns the file object.

Update a file

const file = await bias.files.update("id", {
  name: "receipt.png"
});

Response example

{
  "object": "file",
  "live": false,
  "id": "file_nwjUEfzvIm7skTF9hlH4P2",
  "created_at": 1750000000000,
  "name": "receipt.png",
  "purpose": "dispute_evidence",
  "size": 1024
}

Was this page helpful?

Created by Bias in California