SafePays API

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/api

Available Endpoints

Request Format

All POST requests must include:

  • Content-Type: application/json header
  • Valid JSON body with api_key field

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 CodeDescription
200Success - Request completed successfully
201Created - Resource created successfully
400Bad Request - Invalid parameters or missing fields
401Unauthorized - Invalid or missing API key
404Not Found - Resource not found
409Conflict - Resource already exists
429Too Many Requests - Rate limit exceeded
500Internal Server Error - Server error

Data Types

Currencies

Supported currency codes (ISO 4217):

  • USD - US Dollar
  • EUR - Euro
  • GBP - British Pound
  • INR - Indian Rupee
  • CAD - 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-446655440000

Pagination

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

MethodEndpointDescription
POST/customerCreate a new customer
GET/customer/{id}Get customer details and invoices
POST/invoiceCreate 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?

On this page