Welcome to Xendit’s latest documentation. For legacy content, access the previous documentation here or the previous API reference here.

Upload file

Prev Next
Post
/files

Make a POST request to this endpoint to upload a file. We currently support uploading PNG, JPG/JPEG, PDF files of less than 10 MB.

Security
HTTP
Type Basic
Header parameters
purpose
stringRequired

Purpose of the file being uploaded

Valid values[ "KYC_DOCUMENT", "CHARGEBACK_EVIDENCE" ]
file
stringRequired

The file

Valid values[ "application/pdf", "image/png", "image/jpg", "image/jpeg" ]
Responses
200

Successful operation

postFileUpload
{
  "id": "file-ec700c1c-db17-4496-b1fb-04ebe551b412",
  "business_id": "ec700c1c-db17-4496-b1fb-04ebe551b412",
  "purpose": "CHARGEBACK_EVIDENCE",
  "created": "2020-10-08T06:38:33.479Z",
  "updated": "2020-10-08T06:38:33.479Z",
  "type": "image/png",
  "size": 10000,
  "url": "https://files.xendit.co/file-ec700c1c-db17-4496-b1fb-04ebe551b412"
}
object
id
string

Unique ID generated by Xendit for the particular file

business_id
string

Unique ID generated by Xendit for the particular file

purpose
string

Purpose of the file

created
string

UTC Timestamp of file upload in ISO format

updated
string

UTC Timestamp of last file update in ISO format

type
string

Type of the file

size
integer

Size of the file in bytes

URL
string

URL to download the file

400

Inputs are failing validation. The errors field contains details about which fields are violating validation.

object
error_code
string
Valid values[ "API_VALIDATION_ERROR", "FEATURE_NOT_AVAILABLE" ]
message
string
errors
Array
OneOf
string
string
object
object
403

API key in use does not have necessary permissions to perform the request. Please assign proper permissions for the key.

object
error_code
string
Valid values[ "RATE_LIMIT_EXCEEDED" ]
message
string
errors
Array
OneOf
string
string
object
object
413

The file size is greater than 2000000 bytes and exceeded size limits. Please compress the payload before retrying

object
error_code
string
Valid values[ "FILE_TOO_LARGE_EXCEEDED_ERROR" ]
message
string
errors
Array
OneOf
string
string
object
object
415

The file format is not supported. Please review the file type before retrying

object
error_code
string
Valid values[ "UNSUPPORTED_CONTENT_TYPE_ERROR" ]
message
string
errors
Array
OneOf
string
string
object
object
429

The file format is not supported. Please review the file type before retrying

object
error_code
string
Valid values[ "RATE_LIMIT_EXCEEDED" ]
message
string
errors
Array
OneOf
string
string
object
object