API Reference
Complete reference for all SafePays API endpoints
Overview
The SafePays API V2 provides RESTful endpoints for managing customers and processing invoices. All endpoints require authentication using your API key.
Base URL
https://app.safepays.com/apiAvailable Endpoints
Customer Management
Create and manage customer profiles
Invoice Management
Create invoices and check payment status
Webhooks
Receive real-time payment notifications
Request Format
All POST requests must include:
Content-Type: application/jsonheader- Valid JSON body with
api_keyfield
Response Format
All responses return JSON with appropriate HTTP status codes:
Success Response
{
"status": "success",
"message": "Operation completed successfully",
"data": {
// Response data
}
}Error Response
{
"error": "Error message description"
}HTTP Status Codes
| Status Code | Description |
|---|---|
| 200 | Success - Request completed successfully |
| 201 | Created - Resource created successfully |
| 400 | Bad Request - Invalid parameters or missing fields |
| 401 | Unauthorized - Invalid or missing API key |
| 404 | Not Found - Resource not found |
| 409 | Conflict - Resource already exists |
| 429 | Too Many Requests - Rate limit exceeded |
| 500 | Internal Server Error - Server error |
Data Types
Currencies
Supported currency codes (ISO 4217):
USD- US DollarEUR- EuroGBP- British PoundINR- Indian RupeeCAD- Canadian Dollar
Dates
All dates use ISO 8601 format:
- Date:
YYYY-MM-DD(e.g.,2024-12-31) - DateTime:
YYYY-MM-DD HH:MM:SS(e.g.,2024-12-31 23:59:59)
IDs
All resource IDs are UUIDs (v4):
550e8400-e29b-41d4-a716-446655440000Pagination
Currently, the API does not implement pagination. All results are returned in a single response.
Rate Limiting
See Rate Limits for detailed information.
Versioning
The API version is included in the URL path:
- Current version:
/api - Previous version:
/api/v1(deprecated)
Quick Reference
| Method | Endpoint | Description |
|---|---|---|
| POST | /customer | Create a new customer |
| GET | /customer/{id} | Get customer details and invoices |
| POST | /invoice | Create a new invoice |
| GET | /invoice/{id} | Check invoice status |
SDKs and Libraries
Official SDKs coming soon for:
- Node.js
- Python
- PHP
- Ruby
- Go
Testing
Use test API keys (prefixed with test_) to avoid creating real transactions. Test mode invoices can be marked as paid through the dashboard for webhook testing.
Need Help?
- Email: support@safepays.com
- Dashboard: https://app.safepays.com