API Documentation

Complete API reference for Ez.Lease document generation services. Integrate lease generation into your applications.

Updated: August 2, 2025

🚀 RESTful API

Ez.Lease provides a comprehensive REST API for integrating document generation into your applications. Generate leases, notices, and other legal documents programmatically.

API Access

Sign in to generate API keys

Create secure API keys to access Ez.Lease programmatically

Sign In

Authentication

Secure API access using Bearer tokens and API keys.

Authorization: Bearer YOUR_API_KEY
Content-Type: application/json

Rate Limits

Fair usage limits to ensure service quality for all users.

Document Generation: 100/hour
Template Queries: 1000/hour
Status Checks: 500/hour

Integration Example

See how easy it is to integrate Ez.Lease into your contact management app with our simple 3-step workflow

1

Generate Document

Collect tenant & property data
Format as JSON payload
POST to /api/generate
{"jobId": "pdf-abc123"}
2

Check Status

Poll with jobId
Monitor progress
Wait for completion
{"status": "processing"}
3

Download Document

Receive download URL
Fetch final document
Deliver to user
{"downloadUrl": "/api/..."}

Quick Integration Code

// Step 1: Generate document
const response = await fetch('/api/generate', {
  method: 'POST',
  headers: {
    'Authorization': 'Bearer YOUR_API_KEY',
    'Content-Type': 'application/json'
  },
  body: JSON.stringify({
    type: 'lease',
    format: 'pdf',
    data: { /* your tenant/property data */ }
  })
});
const { jobId } = await response.json();

// Step 2: Poll for completion
const checkStatus = async () => {
  const statusResponse = await fetch(`/api/generate?jobId=${jobId}`, {
    headers: { 'Authorization': 'Bearer YOUR_API_KEY' }
  });
  const status = await statusResponse.json();
  
  if (status.status === 'completed') {
    // Step 3: Document ready for download!
    window.open(status.downloadUrl);
  } else if (status.status === 'processing') {
    setTimeout(checkStatus, 2000); // Check again in 2 seconds
  }
};
checkStatus();

Fast Integration

Get up and running in minutes

Secure & Reliable

Enterprise-grade security

Legal Compliance

State-specific templates

API Endpoints

Generate Document (Async)

POST /api/generate

Generate a new legal document using the specified template and data. Returns a job ID for async processing.

Request Body:

{
  "type": "lease",
  "format": "pdf",
  "data": {
    "property": {
      "address": "123 Main St",
      "city": "Los Angeles",
      "state": "CA",
      "zipCode": "90210",
      "propertyType": "single-family",
      "bedrooms": 3,
      "bathrooms": 2,
      "furnished": false,
      "petsAllowed": true,
      "smokingAllowed": false
    },
    "landlord": {
      "type": "landlord",
      "firstName": "John",
      "lastName": "Doe",
      "email": "john@example.com",
      "phone": "(555) 123-4567"
    },
    "tenants": [{
      "type": "tenant",
      "firstName": "Jane",
      "lastName": "Smith",
      "email": "jane@example.com",
      "phone": "(555) 987-6543"
    }],
    "terms": {
      "startDate": "2025-01-01",
      "endDate": "2025-12-31",
      "monthlyRent": 2500,
      "securityDeposit": 2500,
      "lateFee": 50,
      "gracePeriod": 5,
      "paymentDueDate": 1,
      "paymentMethods": ["check", "bank_transfer"],
      "utilitiesIncluded": ["water", "trash"],
      "maintenanceResponsibilities": {
        "landlord": ["Major repairs", "HVAC maintenance"],
        "tenant": ["Light bulb replacement", "Basic cleaning"]
      }
    },
    "addenda": {
      "leadPaint": true,
      "petPolicy": true,
      "customClauses": ["No smoking in common areas"],
      "rulesAndRegulations": ["Quiet hours: 10 PM - 8 AM"]
    }
  }
}

Response (202 Accepted):

{
  "jobId": "pdf-abc123-def456",
  "status": "processing",
  "format": "pdf"
}

Check Document Status

GET /api/generate?jobId=abc123

Check the status of a document generation job using the job ID.

Query Parameters:

  • jobId - Job ID returned from generate endpoint (required)

Response (Processing):

{
  "jobId": "pdf-abc123-def456",
  "status": "processing",
  "startTime": 1704067200000,
  "format": "pdf"
}

Response (Completed):

{
  "jobId": "pdf-abc123-def456",
  "status": "completed",
  "downloadUrl": "/api/download/lease-1704067200.pdf",
  "startTime": 1704067200000,
  "format": "pdf"
}

Response (Failed):

{
  "jobId": "pdf-abc123-def456",
  "status": "failed",
  "error": "Template not found for lease in state: XY",
  "startTime": 1704067200000,
  "format": "pdf"
}

Get Available Templates

GET /api/templates

Retrieve a list of available document templates for a specific state.

Query Parameters:

  • state - Two-letter state code (e.g., "CA", "NY")
  • type - Document type filter (optional)

Response:

{
  "success": true,
  "templates": [
    {
      "id": "lease-agreement",
      "name": "Residential Lease Agreement",
      "state": "CA",
      "type": "lease",
      "description": "Standard residential lease agreement",
      "requiredFields": ["property", "landlord", "tenant", "lease"],
      "formats": ["pdf", "docx"],
      "credits": { "pdf": 2, "docx": 1 }
    }
  ]
}

Check Credit Balance

GET /api/credits

Check your current credit balance and usage statistics.

Response:

{
  "remainingCredits": 47,
  "soonestExpiry": "2025-08-09T22:34:06Z"
}

Check Template Availability

GET /api/templates/check

Check if a specific template is available for a state and document type.

Query Parameters:

  • state - Two-letter state code (required, e.g., "CA", "NY")
  • type - Document type (required, e.g., "lease", "rent-increase")

Response:

{
  "available": true,
  "state": "CA",
  "type": "lease",
  "message": "Template lease is available for CA"
}

Get User Documents

GET /api/documents

Retrieve a list of documents generated by the authenticated user.

Response:

[
  {
    "id": "doc-uuid-1",
    "doc_type": "lease",
    "format": "pdf",
    "s3_key": "documents/user123/1704067200-lease.pdf",
    "size_kb": 245,
    "created_at": "2025-01-01T12:00:00Z"
  },
  {
    "id": "doc-uuid-2",
    "doc_type": "rent_increase",
    "format": "docx",
    "s3_key": "documents/user123/1704153600-rent_increase.docx",
    "size_kb": 89,
    "created_at": "2025-01-02T12:00:00Z"
  }
]

Error Codes

400 Bad Request - Invalid parameters
401 Unauthorized - Invalid API key
402 Payment Required - Insufficient credits
429 Too Many Requests - Rate limit exceeded
500 Internal Server Error - Contact support

SDKs & Libraries

JavaScript/Node.js SDK
Python SDK
PHP SDK
Ruby SDK
Coming Soon: Official SDKs are in development. Currently use standard HTTP requests.

Getting Started

1

Get API Key

Sign up and generate your API key from the dashboard

2

Purchase Credits

Buy a credit pack to start generating documents

3

Start Building

Make your first API call and integrate with your app

API Guidelines

  • Always use HTTPS for API requests to ensure data security
  • Store API keys securely and never expose them in client-side code
  • Implement proper error handling and retry logic for production use
  • Monitor your credit usage to avoid service interruptions