API endpoint

Citizen PDF Download

Creates a downloadable file URL after package, citizen file, charge and wallet checks.

Request fields

FieldDescriptionRequired
nid_number Required string. Use the citizen NID number stored in the system. Yes
direct_download Optional boolean. When true and the local file exists, the API returns the file directly instead of JSON. Optional

All data PDF

POST /api/v1/citizen/download/all-data-pdf

Example request

curl -X POST "https://www.mosarofhosen.top/api/v1/citizen/download/all-data-pdf" \
  -H "Accept: application/json" \
  -H "Content-Type: application/json" \
  -H "X-API-KEY: your_api_key" \
  -H "X-API-SECRET: your_api_secret" \
  -d '{"nid_number":"1234567890","direct_download":false}'

Success response · HTTP 200

{
    "success": true,
    "message": "ডাউনলোড URL তৈরি হয়েছে",
    "charged": 10,
    "balance": 990,
    "file_type": "all_data_pdf",
    "file_name": "1234567890_all.pdf",
    "file_url": "https://www.mosarofhosen.top/assets/citizens/1234567890_all.pdf"
}

direct_download: true returns the local file directly when it exists. In that case the response is a file download, not the JSON example above.

NID card PDF

POST /api/v1/citizen/download/nid-card-pdf

Example request

curl -X POST "https://www.mosarofhosen.top/api/v1/citizen/download/nid-card-pdf" \
  -H "Accept: application/json" \
  -H "Content-Type: application/json" \
  -H "X-API-KEY: your_api_key" \
  -H "X-API-SECRET: your_api_secret" \
  -d '{"nid_number":"1234567890","direct_download":false}'

Success response · HTTP 200

{
    "success": true,
    "message": "ডাউনলোড URL তৈরি হয়েছে",
    "charged": 30,
    "balance": 970,
    "file_type": "nid_card_pdf",
    "file_name": "1234567890.pdf",
    "file_url": "https://www.mosarofhosen.top/assets/citizens/1234567890.pdf"
}

direct_download: true returns the local file directly when it exists. In that case the response is a file download, not the JSON example above.

Common error responses

The API returns JSON with the matching HTTP status. The message can vary according to the exact package, balance, citizen or file condition.

HTTP 401 Missing credentials

{
    "success": false,
    "message": "X-API-KEY and X-API-SECRET headers are required."
}

HTTP 403 IP not allowed

{
    "success": false,
    "message": "This server IP is not allowed for the API client."
}

HTTP 404 Citizen or file not found

{
    "success": false,
    "message": "সিটিজেন পাওয়া যায়নি"
}

HTTP 422 Package, balance or configuration error

{
    "success": false,
    "message": "No active API package was found. Purchase a package before using this service."
}

HTTP 429 Minute rate limit exceeded

{
    "success": false,
    "message": "Per-minute request limit exceeded.",
    "limit_type": "minute",
    "limit": 30,
    "used": 30,
    "remaining": 0,
    "retry_after_seconds": 42
}
Data protection: Citizen information must only be accessed and processed with proper authorization, consent and legal basis.