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
| Type | Description |
|---|---|
passport | Passport copy (bio page) |
proof_of_address | Utility bill, bank statement (less than 3 months old) |
bank_reference | Bank reference letter |
cv | Curriculum vitae / resume |
incorporation_certificate | Certificate of incorporation (output document) |
memorandum | Memorandum of association |
other | Other supporting documents |
Document Statuses
| Status | Description |
|---|---|
pending | Document uploaded, awaiting review |
approved | Document reviewed and approved |
rejected | Document rejected (see rejection reason) |
File Upload Requirements
- • Maximum file size: 10 MB
- • Supported formats: PDF, JPG, PNG, JPEG
- • Use
multipart/form-datafor 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();