Documents API

Upload, download, and manage entity documents

Documents are files associated with entities, such as passports, proof of address, incorporation certificates, and other legal documents. Use these endpoints to upload required documents and download existing ones.

Document Object

Document Object
{
  "id": "doc_abc123",
  "entity_id": "ent_xyz789",
  "name": "passport_john_smith.pdf",
  "document_type": "passport",
  "mime_type": "application/pdf",
  "size": 245678,
  "status": "approved",
  "uploaded_by": "user_abc123",
  "created_at": "2024-01-15T10:30:00Z",
  "updated_at": "2024-01-16T14:00:00Z"
}

Document Types

TypeDescription
passportPassport copy (bio page)
proof_of_addressUtility bill, bank statement (less than 3 months old)
bank_referenceBank reference letter
cvCurriculum vitae / resume
incorporation_certificateCertificate of incorporation (output document)
memorandumMemorandum of association
otherOther supporting documents

Document Statuses

StatusDescription
pendingDocument uploaded, awaiting review
approvedDocument reviewed and approved
rejectedDocument rejected (see rejection reason)

File Upload Requirements

  • • Maximum file size: 10 MB
  • • Supported formats: PDF, JPG, PNG, JPEG
  • • Use multipart/form-data for uploads

Endpoints

Code Examples

Upload with JavaScript

const formData = new FormData();
formData.append('file', fileInput.files[0]);
formData.append('document_type', 'passport');
formData.append('name', 'John Smith Passport');

const response = await fetch(
  'https://app.entityengine.com/api/v1/entities/ent_xyz789/documents',
  {
    method: 'POST',
    headers: {
      'Authorization': 'Bearer sk_live_abc123',
    },
    body: formData,
  }
);

const result = await response.json();
console.log('Uploaded document:', result.data.id);

Download with JavaScript

const response = await fetch(
  'https://app.entityengine.com/api/v1/entities/ent_xyz789/documents/doc_abc123/download',
  {
    headers: {
      'Authorization': 'Bearer sk_live_abc123',
    },
  }
);

const blob = await response.blob();
const url = URL.createObjectURL(blob);

// Create download link
const a = document.createElement('a');
a.href = url;
a.download = 'document.pdf';
a.click();