GA4 Refund Tool - API Documentation
Complete API reference for the GA4 Refund Tool backend services
📋 Table of Contents
🌐 Base URL
Production: https://refunder.analyticsbuddy.com/api
The frontend automatically detects the environment and uses the appropriate base URL.
🔒 Authentication
The API uses session-based authentication. All protected endpoints require authentication.
Login Process
- Send credentials to /api/auth/login
- Store session cookie automatically
- Use authenticated session for protected endpoints
Session Cookie
- Name: connect.sid
- Type: HttpOnly session cookie
- Duration: 24 hours
- Security: Secure in production (HTTPS required)
🔐 Authentication Endpoints
Login with username and password.
Request:
Responses:
Logout and destroy session.
Check current authentication status.
🔍 Transaction Endpoints
⚠️ All transaction endpoints require authentication.
Validate and get transaction details.
Request:
Query Parameters:
- refresh=true - Force refresh cache
Responses:
Get transaction details by ID.
Example: /api/transactions/gundog-2514001
Clear transaction cache.
- Clear Specific: /api/transactions/cache/gundog-2514001
- Clear All: /api/transactions/cache
💳 Refund Endpoints
⚠️ All refund endpoints require authentication.
Process a refund for a transaction.
Request (Full Refund):
Request (Partial Refund):
Responses:
Check if refund exists for transaction.
Example: /api/refunds/status/gundog-2514001
Get refund history (Phase 2 feature).
⚙️ Admin Endpoints
⚠️ All admin endpoints require authentication.
Get overall system status including GCS and database health.
Check GCS integration health.
Smart refresh - checks for new data and imports if needed.
Clear all master transactions (admin only).
❌ Error Responses
Common Status Codes
| Code | Description |
|---|---|
| 400 | Bad Request (missing/invalid parameters) |
| 401 | Unauthorized (authentication required) |
| 404 | Not Found (resource doesn't exist) |
| 409 | Conflict (duplicate operation) |
| 500 | Internal Server Error |
| 503 | Service Unavailable |
Error Response Format
🏷️ Transaction ID Format
- Pattern: gundog-XXXXXX (where X is a number)
- Examples: gundog-2514001, gundog-2513999
- Valid Range: gundog-2513930 to gundog-2514264 (for mock data)