Skip to main content
Document upload requires that files be uploaded first using the Files API. Use the returned file_id in this request.

Method Signature

align.customers.update(
  customerId: string,
  data: UpdateCustomerRequest
): Promise<Record<string, never>>

Parameters

customerId
string
required
The unique customer identifier (UUID format)
documents
array
required
Array of document objects to upload

Returns

Returns an empty object {} on success.

Examples

Upload ID Document and Proof of Address

import Align from "@tolbel/align";

const align = new Align({
  apiKey: process.env.ALIGN_API_KEY!,
  environment: "sandbox",
});

// Step 1: Upload files first
const idDocument = await align.files.upload({
  file: idDocumentBuffer,
  filename: "drivers-license.jpg",
  contentType: "image/jpeg",
});

const proofOfAddress = await align.files.upload({
  file: proofOfAddressBuffer,
  filename: "utility-bill.pdf",
  contentType: "application/pdf",
});

// Step 2: Update customer with documents
await align.customers.update("123e4567-e89b-12d3-a456-426614174000", {
  documents: [
    {
      file_id: idDocument.file_id,
      purpose: "id_document",
      description: "Driver's license - front",
    },
    {
      file_id: proofOfAddress.file_id,
      purpose: "proof_of_address",
      description: "Electric bill - January 2024",
    },
  ],
});

console.log("Documents uploaded successfully");

Document Purposes

PurposeDescriptionAccepted Formats
id_documentGovernment-issued ID (passport, driver’s license)JPEG, PNG, PDF
proof_of_addressUtility bill, bank statement (less than 3 months old)JPEG, PNG, PDF
proof_of_source_of_fundsBank statements, payslips, or tax returnsJPEG, PNG, PDF
business_formationCertificate of incorporation, articles of associationPDF
directors_registryList of company directorsPDF
shareholder_registryList of company shareholdersPDF
proof_of_nature_of_businessBusiness plan, website, or invoicesPDF
otherAny other supporting documentationJPEG, PNG, PDF

Error Handling

import { AlignError, AlignValidationError } from "@tolbel/align";

try {
  await align.customers.update(customerId, {
    documents: [{ file_id: "invalid-file-id", purpose: "id_document" }],
  });
} catch (error) {
  if (error instanceof AlignValidationError) {
    console.error("Invalid document data:", error.errors);
  } else if (error instanceof AlignError) {
    if (error.statusCode === 404) {
      console.error("Customer or file not found");
    } else {
      console.error(`API Error: ${error.message}`);
    }
  }
}
After uploading documents, the KYC verification process will automatically continue. Use webhooks to receive status updates.