Upload file
Upload a file and link it to the specified Moov account.
The maximum file size is 20MB. Each account is allowed a maximum of 50 files. Acceptable file types include csv, jpg, pdf, and png.
To access this endpoint using an access token
you'll need to specify the /accounts/{accountID}/files.write scope.
POST
/accounts/{accountID}/files
curl -X POST "https://api.moov.io/accounts/{accountID}/files" \
-H "Authorization: Bearer {token}" \
-H "x-moov-version: v2024.01.00" \
--form \
-F "file=@/path/to/your/file.txt" \
-F "filePurpose=business_verification" \
-F "metadata={\"representative_id\":\"string\"}"
mc, _ := moov.NewClient()
var accountID string
file, _ := os.Open("/path/to/file.csv")
mc.UploadFile(ctx, accountID, moov.UploadFile{
FilePurpose: moov.FilePurpose_MerchantUnderwriting,
Metadata: map[string]string{
"requirement_id": "business.underwriting-documents-tier-one",
"other_keys": "for customer use",
},
Filename: "file.csv",
File: file,
})
import { openAsBlob } from "node:fs";
import { SDK } from "openapi";
const sdk = new SDK({
xMoovVersion: "v2024.01.00",
});
async function run() {
const result = await sdk.files.upload({
accountID: "221c30bd-2551-4ae4-9a14-07bf6599b728",
fileUploadRequestMultiPart: {
file: await openAsBlob("example.file"),
filePurpose: "representative_verification",
metadata: "{\"requirement_id\": \"document.individual.verification\"}",
},
});
console.log(result);
}
run();declare(strict_types=1);
require 'vendor/autoload.php';
use OpenAPI\OpenAPI;
use OpenAPI\OpenAPI\Models\Components;
$sdk = OpenAPI\SDK::builder()
->setXMoovVersion('v2024.01.00')
->build();
$fileUploadRequestMultiPart = new Components\FileUploadRequestMultiPart(
file: new Components\FileUploadRequestMultiPartFile(
fileName: 'example.file',
content: file_get_contents('example.file');,
),
filePurpose: Components\FilePurpose::RepresentativeVerification,
metadata: '{"requirement_id": "document.individual.verification"}',
);
$response = $sdk->files->upload(
accountID: '221c30bd-2551-4ae4-9a14-07bf6599b728',
fileUploadRequestMultiPart: $fileUploadRequestMultiPart
);
if ($response->fileDetails !== null) {
// handle response
}from openapi import SDK
with SDK(
x_moov_version="v2024.01.00",
) as sdk:
res = sdk.files.upload(account_id="221c30bd-2551-4ae4-9a14-07bf6599b728", file={
"file_name": "example.file",
"content": open("example.file", "rb"),
}, file_purpose="representative_verification", metadata="{\"requirement_id\": \"document.individual.verification\"}")
# Handle response
print(res)package hello.world;
import java.lang.Exception;
import java.nio.file.Paths;
import org.openapis.openapi.SDK;
import org.openapis.openapi.models.components.*;
import org.openapis.openapi.models.errors.FileValidationError;
import org.openapis.openapi.models.errors.GenericError;
import org.openapis.openapi.models.operations.UploadFileResponse;
import org.openapis.openapi.utils.Blob;
public class Application {
public static void main(String[] args) throws GenericError, FileValidationError, Exception {
SDK sdk = SDK.builder()
.xMoovVersion("v2024.01.00")
.build();
UploadFileResponse res = sdk.files().upload()
.accountID("221c30bd-2551-4ae4-9a14-07bf6599b728")
.fileUploadRequestMultiPart(FileUploadRequestMultiPart.builder()
.file(FileUploadRequestMultiPartFile.builder()
.fileName("example.file")
.content(Blob.from(Paths.get("example.file")))
.build())
.filePurpose(FilePurpose.REPRESENTATIVE_VERIFICATION)
.metadata("{\"requirement_id\": \"document.individual.verification\"}")
.build())
.call();
}
}require 'openapi'
Models = ::OpenApiSDK::Models
s = ::OpenApiSDK::SDK.new(
x_moov_version: 'v2024.01.00',
)
res = s.files.upload(account_id: '221c30bd-2551-4ae4-9a14-07bf6599b728', file_upload_request_multi_part: Models::Components::FileUploadRequestMultiPart.new(
file: Models::Components::FileUploadRequestMultiPartFile.new(
file_name: 'example.file',
content: File.binread("example.file"),
),
file_purpose: Models::Components::FilePurpose::REPRESENTATIVE_VERIFICATION,
metadata: '{"requirement_id": "document.individual.verification"}',
))
unless res.file_details.nil?
# handle response
endThe request completed successfully.
Describes a file linked to a Moov account.
{
"fileID": "string",
"fileName": "logo.png",
"accountID": "string",
"filePurpose": "representative_verification",
"fileStatus": "pending",
"metadata": "{\"error_code\": \"document-name-mismatch\", \"requirement_id\": \"document.individual.verification\", \"representative_id\": \"c63ab175-251d-497e-a267-7346d087e180\", \"comment\": \"testing comment\"",
"decisionReason": "not correct file",
"fileSizeBytes": 0,
"createdOn": "2019-08-24T14:15:22Z",
"updatedOn": "2019-08-24T14:15:22Z"
}Response headers
x-request-id
string
required
A unique identifier used to trace requests.
The server could not understand the request due to invalid syntax.
{
"error": "string"
}Response headers
x-request-id
string
required
A unique identifier used to trace requests.
The request contained missing or expired authentication.
Response headers
x-request-id
string
required
A unique identifier used to trace requests.
The user is not authorized to make the request.
Response headers
x-request-id
string
required
A unique identifier used to trace requests.
The requested resource was not found.
Response headers
x-request-id
string
required
A unique identifier used to trace requests.
The request conflicted with the current state of the target resource.
{
"error": "string"
}Response headers
x-request-id
string
required
A unique identifier used to trace requests.
The request was well-formed, but the contents failed validation. Check the request for missing or invalid fields.
{
"error": "string",
"file": "string",
"FileName": "string",
"filePurpose": "string",
"metadata": "string"
}Response headers
x-request-id
string
required
A unique identifier used to trace requests.
Request was refused due to rate limiting.
Response headers
x-request-id
string
required
A unique identifier used to trace requests.
The request failed due to an unexpected error.
Response headers
x-request-id
string
required
A unique identifier used to trace requests.
The request failed because a downstream service failed to respond.
Response headers
x-request-id
string
required
A unique identifier used to trace requests.
Headers
X-Moov-Version
string
Specify an API version.
API versioning follows the format vYYYY.QQ.BB, where
YYYYis the yearQQis the two-digit month for the first month of the quarter (e.g., 01, 04, 07, 10)BBis the build number, starting at.01, for subsequent builds in the same quarter.- For example,
v2024.01.00is the initial release of the first quarter of 2024.
- For example,
The dev version represents the most recent development state. It may include breaking changes and should be treated as a beta release.
When no version is specified, the API defaults to v2024.01.00.
Path parameters
accountID
string
required
Body
multipart/form-data
file
string<binary>
required
The file to be added. Valid types are
csv, png, jpeg, pdf.
filePurpose
string
required
The purpose of the file being uploaded.
The file's purpose.
Possible values:
business_verification,
representative_verification,
individual_verification,
merchant_underwriting,
account_requirement,
identity_verification
metadata
string
Additional metadata to be stored with the file, formatted as a JSON string.
Valid keys are representative_id, comment, requirement_id, error_code.
Response
accountID
string
required
createdOn
string<date-time>
required
fileID
string
required
fileName
string
<=64 characters
required
filePurpose
string<enum>
required
The file's purpose.
Possible values:
business_verification,
representative_verification,
individual_verification,
merchant_underwriting,
account_requirement,
identity_verification
fileSizeBytes
integer
required
fileStatus
string<enum>
required
The file's status.
Possible values:
pending,
approved,
rejected
metadata
string<json>
required
updatedOn
string<date-time>
required
decisionReason
string