# Core APIs

## Applications

### Submit Application

```http
POST /applications
```

**Request Body**
```json
{
  "licenseType": "TRADE_LICENSE",
  "applicantId": "DL-12345678",
  "businessName": "ABC Enterprises",
  "address": {
    "line1": "123 Main Street",
    "city": "Panaji",
    "state": "Goa",
    "pincode": "403001"
  },
  "documents": [
    { "type": "IDENTITY_PROOF", "documentId": "DOC-001" },
    { "type": "ADDRESS_PROOF", "documentId": "DOC-002" }
  ]
}
```

**Response**
```json
{
  "success": true,
  "data": {
    "applicationId": "APP-2026-00001",
    "status": "SUBMITTED",
    "submittedAt": "2026-02-09T10:30:00Z",
    "estimatedCompletion": "2026-02-16T10:30:00Z"
  }
}
```

### Get Application Status

```http
GET /applications/:applicationId
```

**Response**
```json
{
  "success": true,
  "data": {
    "applicationId": "APP-2026-00001",
    "status": "IN_REVIEW",
    "currentStage": "DOCUMENT_VERIFICATION",
    "stages": [
      { "name": "SUBMITTED", "completedAt": "2026-02-09T10:30:00Z" },
      { "name": "DOCUMENT_VERIFICATION", "startedAt": "2026-02-09T11:00:00Z" }
    ],
    "nextAction": "Awaiting document verification"
  }
}
```

### List Applications

```http
GET /applications?status=PENDING&page=1&limit=20
```

## Documents

### Upload Document

```http
POST /documents/upload
Content-Type: multipart/form-data
```

**Form Fields**
- `file`: Document file (PDF, JPG, PNG)
- `type`: Document type code
- `applicationId`: Associated application (optional)

**Response**
```json
{
  "success": true,
  "data": {
    "documentId": "DOC-2026-00001",
    "fileName": "identity_proof.pdf",
    "fileSize": 245678,
    "mimeType": "application/pdf",
    "uploadedAt": "2026-02-09T10:25:00Z"
  }
}
```

### Get Document

```http
GET /documents/:documentId
```

## Verification

### Verify Certificate

```http
GET /verify/:tokenId
```

**Response**
```json
{
  "success": true,
  "data": {
    "valid": true,
    "license": {
      "number": "GOA/TRADE/2026/00001",
      "holder": "ABC Enterprises",
      "issuedBy": "Department of Trade",
      "issuedAt": "2026-02-09",
      "validUntil": "2027-02-08"
    },
    "blockchain": {
      "tokenId": "0x1234...",
      "transactionHash": "0xabcd...",
      "blockNumber": 12345
    }
  }
}
```
