وثائق API

دليل تكامل API للرسائل النصية من customersms.pro

RESTful API
JSON Responses
Secure Authentication

Quick Start

1

Get API Key

Contact our support team to receive your unique API key

2

Make Request

Send POST request with your API key and message data

3

Receive Response

Get detailed JSON response with delivery status

Example Request

curl -X POST https://customersms.pro/api.php \
  -H "Content-Type: application/json" \
  -d '{
    "api_key": "your_api_key_here",
    "phone": "+12125551234",
    "message": "Hello World!"
  }'

المصادقة

تتطلب جميع طلبات API مصادقة باستخدام مفتاح API. قم بتضمين مفتاح API الخاص بك في جسم الطلب.

Important Note

API keys are sensitive information. Store them securely and never expose them in client-side code. Contact info@customersms.pro to get your API key.

Authentication Example

{
  "api_key": "cspro_your_secret_key_here",
  "phone": "+12125551234",
  "message": "Your message content"
}

نقطة النهاية

نقطة النهاية

https://customersms.pro/sms_system/api.php

الطريقة

POST

نوع المحتوى

application/json

المعاملات

Parameter Type Required Description
api_key string Required مفتاح API الخاص بك
phone string/array Required رقم/أرقام الهاتف - نص أو مصفوفة
message string Required محتوى الرسالة النصية

الاستجابة

استجابة النجاح

{
  "success": true,
  "message": "SMS sending completed",
  "total_numbers": 2,
  "successful_sends": 2,
  "failed_sends": 0,
  "remaining_credits": 98,
  "results": [
    {
      "phone": "+12125551234",
      "success": true,
      "message_id": "msg_123456"
    },
    {
      "phone": "+13235554567",
      "success": true,
      "message_id": "msg_123457"
    }
  ]
}

استجابة الخطأ

{
  "success": false,
  "error": "Invalid or inactive API key",
  "code": "INVALID_API_KEY"
}

أمثلة الكود

مثال PHP

<?php
$api_url = 'https://customersms.pro/sms_system/api.php';
$api_key = 'your_api_key_here';

$data = [
    'api_key' => $api_key,
    'phone' => '+12125551234,+13235554567',
    'message' => 'Hello from customersms.pro!'
];

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $api_url);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
    'Content-Type: application/json'
]);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($data));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);

$response = curl_exec($ch);
$result = json_decode($response, true);
curl_close($ch);

if ($result['success']) {
    echo "SMS sent successfully!";
} else {
    echo "Error: " . $result['error'];
}
?>

مثال JavaScript

const sendSMS = async () => {
  const apiUrl = 'https://customersms.pro/sms_system/api.php';
  const apiKey = 'your_api_key_here';
  
  const data = {
    api_key: apiKey,
    phone: ['+12125551234', '+13235554567'],
    message: 'Hello from customersms.pro!'
  };
  
  try {
    const response = await fetch(apiUrl, {
      method: 'POST',
      headers: {
        'Content-Type': 'application/json'
      },
      body: JSON.stringify(data)
    });
    
    const result = await response.json();
    
    if (result.success) {
      console.log('SMS sent successfully!', result);
    } else {
      console.error('Error:', result.error);
    }
  } catch (error) {
    console.error('Network error:', error);
  }
};

sendSMS();

مثال Python

import requests
import json

api_url = 'https://customersms.pro/sms_system/api.php'
api_key = 'your_api_key_here'

data = {
    'api_key': api_key,
    'phone': ['+12125551234', '+13235554567'],
    'message': 'Hello from customersms.pro!'
}

headers = {
    'Content-Type': 'application/json'
}

try:
    response = requests.post(
        api_url, 
        headers=headers, 
        data=json.dumps(data)
    )
    result = response.json()
    
    if result['success']:
        print('SMS sent successfully!', result)
    else:
        print('Error:', result['error'])
        
except requests.exceptions.RequestException as e:
    print('Network error:', e)

مثال cURL

curl -X POST https://customersms.pro/sms_system/api.php \
  -H "Content-Type: application/json" \
  -d '{
    "api_key": "your_api_key_here",
    "phone": "+12125551234,+13235554567",
    "message": "Hello from customersms.pro!"
  }'

حدود المعدل

Requests per minute 100
Requests per hour 5,000
Requests per day 50,000

طلبات API محدودة بـ 100 طلب في الدقيقة لكل مفتاح API.

الدعم

Email Support

info@customersms.pro

Response Time

Within 4 hours

Availability

24/7 Support

للدعم الفني والأسئلة حول API، تواصل معنا على