🐍 Python🇦🇺 AustraliaTax Compliance
Australian Business Compliance — ABN & GST Validation
Validate Australian Business Numbers (ABN) in Python. Check GST registration status, retrieve entity names from the ABR, and run batch validations with asyncio.gather.
Also available in Node.js
Contents
1. Validate an ABN
Use await iv.abn(value) (SDK) or GET /v0/abn?value=….
{ "valid": true, "abn": "51824753556", "formatted": "51 824 753 556", "found": true, "entityName": "Example Pty Ltd", "entityType": "Australian Private Company", "abnStatus": "Active", "abnStatusFrom": "2001-01-01", "acn": "824753556", "state": "NSW", "postcode": "2000", "gstRegistered": true, "businessNames": ["Example Trading"], "dataSource": "ABR" }
- Check
valid— mod-89 weighted checksum - Check
foundandabn_status == "Active" - Check
gst_registeredbefore issuing tax invoices - Use
formatted(XX XXX XXX XXX) on documents
2. GST registration check
result = await iv.abn(abn) if not result.gst_registered: # Cannot claim GST input tax credits from this supplier print("Supplier not GST-registered")
⚠️Not all valid ABNs are GST-registered. Small businesses below AUD 75,000 turnover may have a valid active ABN but no GST registration.
3. Entity name and type lookup
result = await iv.abn(abn) if result.found: print(f"Entity: {result.entity_name}") print(f"Type: {result.entity_type}") print(f"Active since: {result.abn_status_from}") if result.business_names: print(f"Trading names: {', '.join(result.business_names)}")
4. Batch validation with asyncio.gather
import asyncio from isvalid_sdk import IsValidConfig, create_client config = IsValidConfig(api_key="YOUR_API_KEY") iv = create_client(config) async def validate_abn(abn: str): result = await iv.abn(abn) if not result.valid: raise ValueError(f"Invalid ABN format: {abn}") if result.found and result.abn_status != "Active": raise ValueError(f"ABN is not active: {result.abn_status}") if not result.gst_registered: print(f"Warning: ABN {result.formatted} is not GST-registered") return result async def validate_batch(abns: list[str]): results = await asyncio.gather( *[iv.abn(a) for a in abns], return_exceptions=True ) return {abn: r for abn, r in zip(abns, results)} async def main(): r = await validate_abn("51824753556") print(f"Entity: {r.entity_name}") print(f"GST registered: {r.gst_registered}") print(f"State: {r.state}, Postcode: {r.postcode}") batch = await validate_batch([ "51824753556", "32057237505", "11111111111", # invalid ]) for abn, result in batch.items(): if isinstance(result, Exception): print(f"{abn}: ERROR — {result}") else: print(f"{abn}: valid={result.valid}") asyncio.run(main())
5. Edge cases
ABN cancelled or deregistered
⚠️Always check
abn_status == "Active" in addition to valid.result = await iv.abn(abn) if result.valid and result.found and result.abn_status != "Active": raise ValueError(f"ABN not active: {result.abn_status}")
Sole traders — no ACN
ℹ️Sole traders and partnerships have ABNs but no ACN. The
acn field will be None for these entity types.result = await iv.abn(abn) if result.acn: print(f"ACN: {result.acn}") else: print("No ACN — likely sole trader or partnership")
6. Summary checklist
✓Validate ABN via mod-89 checksum
✓Check found and abn_status == "Active"
✓Check gst_registered before tax invoices
✓Use formatted (XX XXX XXX XXX) on documents
✓Extract ACN for company registrations
✓Run batch lookups with asyncio.gather
✓Handle return_exceptions=True in batches
✓Handle sole traders gracefully (no ACN)