Quick Reference
Quick reference for Audit1 Developer API - cheat sheet for common tasks
API Quick Reference
One-page reference for the most common API operations.
🔑 Authentication
Authorization: Bearer audit1_test_sk_1234567890abcdef1234567890abcdef| Key Prefix | Environment | Data Type |
|---|---|---|
audit1_test_sk_* | Sandbox | Test data |
audit1_live_sk_* | Production | Real data |
🌐 Base URL
https://api.audit1.info/api/v1
Same URL for both environments - environment detected from API key prefix.
📡 Endpoints
Submit Payroll Report
POST /payroll/reportsRequest:
{
"employer_id": "EMP_12345",
"period_start": "2024-01-01",
"period_end": "2024-03-31",
"employees": [
{
"employee_id": "EE_001",
"name": "John Smith",
"classification_code": "8810",
"hours_worked": 520,
"gross_wages": 26000
}
],
"payroll_data": {
"total_payroll": 26000,
"total_hours": 520,
"officer_payroll": 0,
"subcontractor_payments": 0
}
}Response (202):
{
"report_id": "PR_1234567890",
"status": "processing",
"environment": "sandbox",
"estimated_processing_time": "1-2 minutes"
}Sync Employee Changes
POST /employees/syncHire Employee:
{
"employer_id": "EMP_12345",
"employees": [
{
"employee_id": "EE_NEW_001",
"action": "hire",
"name": "Jane Doe",
"hire_date": "2024-01-15",
"classification_code": "8810",
"hourly_rate": 30.00
}
]
}Terminate Employee:
{
"employer_id": "EMP_12345",
"employees": [
{
"employee_id": "EE_001",
"action": "terminate",
"termination_date": "2024-06-30",
"termination_reason": "Resigned"
}
]
}Update Employee:
{
"employer_id": "EMP_12345",
"employees": [
{
"employee_id": "EE_001",
"action": "update",
"classification_code": "5403",
"hourly_rate": 35.00
}
]
}Check File Status
GET /files/status/:file_idResponse (200):
{
"file_id": "FILE_123",
"status": "completed",
"environment": "sandbox",
"records_processed": 50,
"processing_time": "5 minutes"
}📋 Common Headers
Authorization: Bearer YOUR_API_KEY
Content-Type: application/json
Accept: application/json🚦 Response Codes
| Code | Status | Meaning |
|---|---|---|
200 | OK | Request successful |
202 | Accepted | Processing asynchronously |
400 | Bad Request | Invalid request data |
401 | Unauthorized | Invalid/missing API key |
404 | Not Found | Resource doesn't exist |
429 | Too Many Requests | Rate limit exceeded |
500 | Server Error | Internal error |
❌ Common Errors
Invalid API Key
{
"error": "Authentication Failed",
"message": "Invalid API key format"
}Fix: Ensure key starts with audit1_test_sk_ or audit1_live_sk_
Missing Required Fields
{
"error": "Validation Error",
"message": "Missing required fields: employees"
}Fix: Include all required fields in request body
Rate Limit
{
"error": "Rate Limit Exceeded",
"message": "Too many requests. Retry after 60 seconds.",
"details": {
"retry_after": 60
}
}Fix: Implement exponential backoff retry
🔄 Retry Logic
async function retryRequest(fn, maxRetries = 3) {
for (let i = 0; i < maxRetries; i++) {
try {
return await fn();
} catch (error) {
const status = error.response?.status;
// Don't retry client errors (except rate limits)
if (status >= 400 && status < 500 && status !== 429) {
throw error;
}
// Exponential backoff: 1s, 2s, 4s
const delay = Math.pow(2, i) * 1000;
await new Promise(resolve => setTimeout(resolve, delay));
}
}
}📦 Required Fields
Payroll Report
| Field | Type | Required | Format |
|---|---|---|---|
employer_id | string | ✅ Yes | - |
period_start | string | ✅ Yes | YYYY-MM-DD |
period_end | string | ✅ Yes | YYYY-MM-DD |
employees | array | ✅ Yes | Min 1 employee |
payroll_data | object | ✅ Yes | Totals object |
Employee Object
| Field | Type | Required | Format |
|---|---|---|---|
employee_id | string | ✅ Yes | - |
name | string | ✅ Yes | - |
classification_code | string | ✅ Yes | NCCI code |
hours_worked | number | ✅ Yes | - |
gross_wages | number | ✅ Yes | - |
overtime_hours | number | ❌ No | - |
overtime_pay | number | ❌ No | - |
Employee Sync (Hire)
| Field | Type | Required |
|---|---|---|
employee_id | string | ✅ Yes |
action | string | ✅ Yes (hire) |
name | string | ✅ Yes |
hire_date | string | ✅ Yes |
classification_code | string | ✅ Yes |
hourly_rate | number | ❌ No |
Employee Sync (Terminate)
| Field | Type | Required |
|---|---|---|
employee_id | string | ✅ Yes |
action | string | ✅ Yes (terminate) |
termination_date | string | ✅ Yes |
termination_reason | string | ❌ No |
🧪 Testing
Test API Key
# Get test key from Dashboard
export AUDIT1_API_KEY="audit1_test_sk_..."
# Test request
curl -X POST https://api.audit1.info/api/v1/payroll/reports \
-H "Authorization: Bearer $AUDIT1_API_KEY" \
-H "Content-Type: application/json" \
-d @test-payload.jsonTest Payload
Save as test-payload.json:
{
"employer_id": "EMP_TEST_001",
"period_start": "2024-01-01",
"period_end": "2024-03-31",
"employees": [
{
"employee_id": "EE_TEST_001",
"name": "Test Employee",
"classification_code": "8810",
"hours_worked": 520,
"gross_wages": 26000
}
],
"payroll_data": {
"total_payroll": 26000,
"total_hours": 520,
"officer_payroll": 0,
"subcontractor_payments": 0
}
}🔐 Security Checklist
- Store API keys in environment variables
- Never commit keys to version control
- Use test keys for development
- Rotate keys every 90 days
- Monitor for unusual activity
- Use HTTPS for all requests
- Validate webhook signatures
- Implement rate limiting
- Log all API errors
📚 Quick Links
- Getting Started Guide
- Full API Reference
- Integration Examples
- Webhooks Guide
- API Keys Management
- Dashboard: Log into your portal (employer.audit1.info, payrollcompany.audit1.info, or carrier.audit1.info)
- Support
💡 Pro Tips
- Environment Detection: Same URL, different keys = different environments
- Idempotency: Use unique IDs to prevent duplicate submissions
- Error Handling: Always implement retry logic with exponential backoff
- Testing: Test in sandbox first, then move to production
- Monitoring: Track API usage and error rates
- Webhooks: Use webhooks for real-time updates instead of polling
- Batch Processing: Submit multiple reports with delay between batches
- Rate Limits: Stay under 100 requests/minute to avoid throttling
🆘 Need Help?
- Documentation: docs.audit1.info
- API Status: status.audit1.com
- Support Email: [email protected]
- Portals: employer.audit1.info | payrollcompany.audit1.info | carrier.audit1.info
Updated about 17 hours ago
