Suppliers Endpoint

Retrieve supplier data with comprehensive filtering and search capabilities.

Endpoint Details

GET /api/suppliers

Authentication Required

  • API Token: Required in URL parameter ?api_token=xxx
  • User Token: Required in Authorization header Bearer {access_token}

Query Parameters

Parameter Type Required Description
api_token string Yes Your API access token
search string No Search by supplier name or registration number
status string No Filter by status (active, inactive, pending)
limit integer No Number of results to return (default: 50, max: 500)

Response Format

Success Response (200 OK)
{
  "success": true,
  "data": {
    "suppliers": [
      {
        "supplier_id": "456",
        "supplier_name": "Supplier Corp Ltd",
        "registration_number": "2021/123456/07",
        "vat_number": "4123456789",
        "status": "active",
        "contact_person": "John Smith",
        "email": "john@supplier.com",
        "phone": "+27 11 123 4567",
        "address": {
          "street": "123 Business St",
          "city": "Johannesburg",
          "province": "Gauteng",
          "postal_code": "2000"
        },
        "created_at": "2024-01-01T10:00:00Z",
        "updated_at": "2024-01-15T14:30:00Z"
      }
    ],
    "total_count": 25,
    "returned_count": 25
  },
  "message": "Suppliers retrieved successfully"
}

Examples

Basic Request
curl -X GET "https://api.creditrisk.co.za/api/suppliers?api_token=your_token" \
-H "Authorization: Bearer your_access_token"
Search by Name
curl -X GET "https://api.creditrisk.co.za/api/suppliers?api_token=your_token&search=supplier" \
-H "Authorization: Bearer your_access_token"
Filter by Status
curl -X GET "https://api.creditrisk.co.za/api/suppliers?api_token=your_token&status=active" \
-H "Authorization: Bearer your_access_token"
Limit Results
curl -X GET "https://api.creditrisk.co.za/api/suppliers?api_token=your_token&limit=10" \
-H "Authorization: Bearer your_access_token"

Error Responses

Authentication Failed (401 Unauthorized)
{
  "success": false,
  "error": "Authentication failed",
  "message": "Invalid or expired access token"
}
Invalid Parameters (400 Bad Request)
{
  "success": false,
  "error": "Invalid parameter",
  "message": "Limit cannot exceed 500"
}

Test This Endpoint

Use the interactive testing tool to try this endpoint:

Go to API Testing