cURL Examples
Complete cURL examples for all API operations.
ERP / Server Integration (API Key Auth)
For ERP and server-to-server integrations, use the Public API with your API key:
export API_KEY="YOUR_API_KEY"
export TENANT_ID="YOUR_TENANT_ID"
export BASE_URL="https://dev.auxcore.net/api/v1/public"
# Test connection
curl -X POST "$BASE_URL/testConnection" \
-H "x-api-key: $API_KEY" \
-H "X-Tenant-ID: $TENANT_ID"
# Process a sale
curl -X POST "$BASE_URL/transaction" \
-H "x-api-key: $API_KEY" \
-H "X-Tenant-ID: $TENANT_ID" \
-H "Content-Type: application/json" \
-d '{
"Amount": 100.00,
"SuggestedMode": "Card",
"CardNumber": "4111111111111111",
"ExpiryMonth": "12",
"ExpiryYear": "2027",
"CVV": "123",
"BillingCustomerName": "John Doe",
"BillingEmail": "john@example.com"
}'
# Void a transaction
curl -X POST "$BASE_URL/void" \
-H "x-api-key: $API_KEY" \
-H "X-Tenant-ID: $TENANT_ID" \
-H "Content-Type: application/json" \
-d '{ "transactionId": "txn_1234567890abcdef" }'
# Refund a transaction
curl -X POST "$BASE_URL/refund" \
-H "x-api-key: $API_KEY" \
-H "X-Tenant-ID: $TENANT_ID" \
-H "Content-Type: application/json" \
-d '{ "transactionId": "txn_1234567890abcdef", "amount": 50.00 }'
# Get transaction
curl "$BASE_URL/transaction/txn_1234567890abcdef" \
-H "x-api-key: $API_KEY" \
-H "X-Tenant-ID: $TENANT_ID"
# List transactions
curl "$BASE_URL/transaction-list?page=1&limit=50" \
-H "x-api-key: $API_KEY" \
-H "X-Tenant-ID: $TENANT_ID"
Dashboard / Admin Operations (JWT Bearer Auth)
For operations requiring user-level access, obtain a JWT first:
Authentication
Login
curl -X POST https://dev.auxcore.net/api/v1/auth/login \
-H "Content-Type: application/json" \
-H "X-Tenant-ID: your-tenant-id" \
-d '{
"email": "user@example.com",
"password": "your-password"
}'
Save token:
export TOKEN=$(curl -X POST https://dev.auxcore.net/api/v1/auth/login \
-H "Content-Type: application/json" \
-H "X-Tenant-ID: your-tenant-id" \
-d '{"email": "user@example.com", "password": "your-password"}' \
| jq -r '.data.token')
Transactions
Process Sale
curl -X POST https://dev.auxcore.net/api/v1/transactions \
-H "Authorization: Bearer $TOKEN" \
-H "X-Tenant-ID: your-tenant-id" \
-H "Content-Type: application/json" \
-d '{
"type": "sale",
"amount": 100.00,
"currency": "USD",
"paymentMethod": "card",
"card": {
"number": "4111111111111111",
"expiryMonth": "12",
"expiryYear": "2027",
"cvv": "123"
},
"billing": {
"firstName": "John",
"lastName": "Doe",
"address": "123 Main St",
"city": "New York",
"state": "NY",
"zip": "10001",
"country": "US"
},
"customer": {
"email": "john@example.com"
}
}'
Authorization
curl -X POST https://dev.auxcore.net/api/v1/transactions \
-H "Authorization: Bearer $TOKEN" \
-H "X-Tenant-ID: your-tenant-id" \
-H "Content-Type: application/json" \
-d '{
"type": "auth",
"amount": 100.00,
"currency": "USD",
"card": {
"number": "4111111111111111",
"expiryMonth": "12",
"expiryYear": "2027",
"cvv": "123"
}
}'
Capture
curl -X POST https://dev.auxcore.net/api/v1/transactions/txn_abc123/capture \
-H "Authorization: Bearer $TOKEN" \
-H "X-Tenant-ID: your-tenant-id" \
-H "Content-Type: application/json" \
-d '{
"amount": 100.00
}'
Void
curl -X POST https://dev.auxcore.net/api/v1/transactions/txn_abc123/void \
-H "Authorization: Bearer $TOKEN" \
-H "X-Tenant-ID: your-tenant-id" \
-H "Content-Type: application/json" \
-d '{
"reason": "Customer cancellation"
}'
Refund
curl -X POST https://dev.auxcore.net/api/v1/transactions/txn_abc123/refund \
-H "Authorization: Bearer $TOKEN" \
-H "X-Tenant-ID: your-tenant-id" \
-H "Content-Type: application/json" \
-d '{
"amount": 50.00,
"reason": "Customer request"
}'
Get Transaction
curl https://dev.auxcore.net/api/v1/transactions/txn_abc123 \
-H "Authorization: Bearer $TOKEN" \
-H "X-Tenant-ID: your-tenant-id"
List Transactions
curl "https://dev.auxcore.net/api/v1/transactions?page=1&limit=50&status=approved" \
-H "Authorization: Bearer $TOKEN" \
-H "X-Tenant-ID: your-tenant-id"
Subscriptions
Create Subscription
curl -X POST https://dev.auxcore.net/api/v1/recurring \
-H "Authorization: Bearer $TOKEN" \
-H "X-Tenant-ID: your-tenant-id" \
-H "Content-Type: application/json" \
-d '{
"customerId": "cust_123",
"planId": "plan_monthly",
"amount": 99.00,
"frequency": "monthly",
"startDate": "2026-02-01",
"card": {
"number": "4111111111111111",
"expiryMonth": "12",
"expiryYear": "2027",
"cvv": "123"
}
}'
Pause Subscription
curl -X POST https://dev.auxcore.net/api/v1/recurring/sub_abc123/pause \
-H "Authorization: Bearer $TOKEN" \
-H "X-Tenant-ID: your-tenant-id"
Resume Subscription
curl -X POST https://dev.auxcore.net/api/v1/recurring/sub_abc123/resume \
-H "Authorization: Bearer $TOKEN" \
-H "X-Tenant-ID: your-tenant-id"
Cancel Subscription
curl -X POST https://dev.auxcore.net/api/v1/recurring/sub_abc123/cancel \
-H "Authorization: Bearer $TOKEN" \
-H "X-Tenant-ID: your-tenant-id" \
-H "Content-Type: application/json" \
-d '{
"reason": "Customer request"
}'
Invoices
Create Invoice
curl -X POST https://dev.auxcore.net/api/v1/invoices \
-H "Authorization: Bearer $TOKEN" \
-H "X-Tenant-ID: your-tenant-id" \
-H "Content-Type: application/json" \
-d '{
"customerId": "cust_123",
"amount": 500.00,
"currency": "USD",
"dueDate": "2026-02-15",
"items": [
{
"description": "Web Design Services",
"quantity": 1,
"unitPrice": 500.00
}
]
}'
Send Invoice
curl -X POST https://dev.auxcore.net/api/v1/invoices/inv_abc123/send \
-H "Authorization: Bearer $TOKEN" \
-H "X-Tenant-ID: your-tenant-id" \
-H "Content-Type: application/json" \
-d '{
"sendVia": ["email"],
"email": "customer@example.com"
}'
Download PDF
curl https://dev.auxcore.net/api/v1/invoices/inv_abc123/pdf \
-H "Authorization: Bearer $TOKEN" \
-H "X-Tenant-ID: your-tenant-id" \
-o invoice.pdf
Webhooks
Create Webhook
curl -X POST https://dev.auxcore.net/api/v1/webhooks/endpoints \
-H "Authorization: Bearer $TOKEN" \
-H "X-Tenant-ID: your-tenant-id" \
-H "Content-Type: application/json" \
-d '{
"url": "https://your-server.com/webhook",
"events": [
"transaction.approved",
"transaction.declined",
"refund.approved"
]
}'
Test Webhook
curl -X POST https://dev.auxcore.net/api/v1/webhooks/endpoints/webhook_123/test \
-H "Authorization: Bearer $TOKEN" \
-H "X-Tenant-ID: your-tenant-id" \
-H "Content-Type: application/json" \
-d '{
"eventType": "transaction.approved"
}'
Batch Operations
Create Multiple Transactions
# Using a loop
for i in {1..5}; do
curl -X POST https://dev.auxcore.net/api/v1/transactions \
-H "Authorization: Bearer $TOKEN" \
-H "X-Tenant-ID: your-tenant-id" \
-H "Content-Type: application/json" \
-d "{\"type\": \"sale\", \"amount\": $((i * 10)).00, ...}"
done
Export Transactions
curl "https://dev.auxcore.net/api/v1/transactions/export?format=csv&startDate=2026-01-01&endDate=2026-01-31" \
-H "Authorization: Bearer $TOKEN" \
-H "X-Tenant-ID: your-tenant-id" \
-o transactions.csv
Advanced Examples
Pagination Loop
page=1
while true; do
response=$(curl -s "https://dev.auxcore.net/api/v1/transactions?page=$page&limit=50" \
-H "Authorization: Bearer $TOKEN" \
-H "X-Tenant-ID: your-tenant-id")
echo "$response" | jq '.data[]'
has_more=$(echo "$response" | jq '.pagination.page < .pagination.pages')
if [ "$has_more" = "false" ]; then
break
fi
page=$((page + 1))
done
Error Handling
response=$(curl -s -w "\n%{http_code}" \
-X POST https://dev.auxcore.net/api/v1/transactions \
-H "Authorization: Bearer $TOKEN" \
-H "X-Tenant-ID: your-tenant-id" \
-d '{}')
http_code=$(echo "$response" | tail -n1)
body=$(echo "$response" | sed '$d')
if [ "$http_code" -eq 200 ]; then
echo "Success: $body"
else
echo "Error $http_code: $body"
fi
Retry with Backoff
function retry_request() {
local max_attempts=3
local attempt=1
while [ $attempt -le $max_attempts ]; do
response=$(curl -s -w "\n%{http_code}" \
-X POST https://dev.auxcore.net/api/v1/transactions \
-H "Authorization: Bearer $TOKEN" \
-d '{}')
http_code=$(echo "$response" | tail -n1)
if [ "$http_code" -eq 200 ]; then
echo "$response" | sed '$d'
return 0
fi
if [ "$http_code" -eq 429 ]; then
wait_time=$((2 ** attempt))
echo "Rate limited, waiting $wait_time seconds..."
sleep $wait_time
attempt=$((attempt + 1))
else
echo "Error: $response"
return 1
fi
done
}
retry_request
Next Steps
Need help? Contact support@auxvault.com