Create File
curl --request POST \
--url https://api.withflex.com/v1/files \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: multipart/form-data' \
--form purpose=account_requirement \
--form file='@example-file'import requests
url = "https://api.withflex.com/v1/files"
files = { "file": ("example-file", open("example-file", "rb")) }
payload = { "purpose": "account_requirement" }
headers = {"Authorization": "Bearer <token>"}
response = requests.post(url, data=payload, files=files, headers=headers)
print(response.text)const form = new FormData();
form.append('purpose', 'account_requirement');
form.append('file', 'string');
const options = {method: 'POST', headers: {Authorization: 'Bearer <token>'}};
options.body = form;
fetch('https://api.withflex.com/v1/files', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.withflex.com/v1/files",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"purpose\"\r\n\r\naccount_requirement\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\nstring\r\n-----011000010111000001101001--",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: multipart/form-data"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.withflex.com/v1/files"
payload := strings.NewReader("-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"purpose\"\r\n\r\naccount_requirement\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\nstring\r\n-----011000010111000001101001--")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.withflex.com/v1/files")
.header("Authorization", "Bearer <token>")
.body("-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"purpose\"\r\n\r\naccount_requirement\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\nstring\r\n-----011000010111000001101001--")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.withflex.com/v1/files")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request.body = "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"purpose\"\r\n\r\naccount_requirement\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\nstring\r\n-----011000010111000001101001--"
response = http.request(request)
puts response.read_body{
"file": {
"file_id": "ffile_01J9XR8M3K7VZ8N2YB4WJ6T0RA",
"purpose": "account_requirement",
"size": 0,
"created_at": "2026-06-15T14:30:00Z",
"expires_at": "2026-06-15T14:30:00Z"
}
}{
"code": "string",
"detail": "string"
}{
"code": "string",
"detail": "string"
}{
"code": "string",
"detail": "string"
}{
"code": "string",
"detail": "string"
}{
"detail": [
{
"loc": [
"string"
],
"msg": "string",
"type": "string"
}
]
}{
"code": "string",
"detail": "string"
}Create File
Uploads a file to Flex. The request must be a multipart/form-data upload containing a file part and a purpose part. The file must be a JPEG, PNG, or PDF no larger than 5 MB; PNGs using 16-bit depth or Adam7 interlacing are rejected. The uploaded file can then be referenced by ID elsewhere in the API, for example as evidence on a dispute. Requires the files_write scope.
POST
/
v1
/
files
Create File
curl --request POST \
--url https://api.withflex.com/v1/files \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: multipart/form-data' \
--form purpose=account_requirement \
--form file='@example-file'import requests
url = "https://api.withflex.com/v1/files"
files = { "file": ("example-file", open("example-file", "rb")) }
payload = { "purpose": "account_requirement" }
headers = {"Authorization": "Bearer <token>"}
response = requests.post(url, data=payload, files=files, headers=headers)
print(response.text)const form = new FormData();
form.append('purpose', 'account_requirement');
form.append('file', 'string');
const options = {method: 'POST', headers: {Authorization: 'Bearer <token>'}};
options.body = form;
fetch('https://api.withflex.com/v1/files', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.withflex.com/v1/files",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"purpose\"\r\n\r\naccount_requirement\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\nstring\r\n-----011000010111000001101001--",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: multipart/form-data"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.withflex.com/v1/files"
payload := strings.NewReader("-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"purpose\"\r\n\r\naccount_requirement\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\nstring\r\n-----011000010111000001101001--")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.withflex.com/v1/files")
.header("Authorization", "Bearer <token>")
.body("-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"purpose\"\r\n\r\naccount_requirement\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\nstring\r\n-----011000010111000001101001--")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.withflex.com/v1/files")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request.body = "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"purpose\"\r\n\r\naccount_requirement\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\nstring\r\n-----011000010111000001101001--"
response = http.request(request)
puts response.read_body{
"file": {
"file_id": "ffile_01J9XR8M3K7VZ8N2YB4WJ6T0RA",
"purpose": "account_requirement",
"size": 0,
"created_at": "2026-06-15T14:30:00Z",
"expires_at": "2026-06-15T14:30:00Z"
}
}{
"code": "string",
"detail": "string"
}{
"code": "string",
"detail": "string"
}{
"code": "string",
"detail": "string"
}{
"code": "string",
"detail": "string"
}{
"detail": [
{
"loc": [
"string"
],
"msg": "string",
"type": "string"
}
]
}{
"code": "string",
"detail": "string"
}Authorizations
Use a Bearer token to access this API.
Body
multipart/form-data
Multipart file upload
Upload a file for use with the Flex API (e.g. dispute evidence).
The purpose of the file (e.g. "dispute_evidence").
Available options:
account_requirement, additional_verification, business_icon, business_logo, customer_signature, dispute_evidence, document_provider_identity_document, finance_report_run, financial_account_statement, identity_document, identity_document_downloadable, issuing_regulatory_reporting, pci_document, platform_terms_of_service, selfie, sigma_scheduled_query, tax_document_user_upload, terminal_android_apk, terminal_reader_splashscreen Example:
"account_requirement"
The file to upload (JPEG, PNG, or PDF, max 5MB).
Response
Success
An envelope wrapping a single file object.
The File object.
Show child attributes
Show child attributes
Example:
{
"file_id": "ffile_01J9XR8M3K7VZ8N2YB4WJ6T0RA",
"purpose": "account_requirement",
"size": 0,
"created_at": "2026-06-15T14:30:00Z",
"expires_at": "2026-06-15T14:30:00Z"
}
⌘I