/api/v1/sendSend SMS (single)إرسال رسالة نصية (فردي)
Sends one SMS. The response carries the message id to use with the status and report endpoints.
يرسل رسالة نصية واحدة. يحتوي الرد على معرّف الرسالة id الذي يُستخدم مع نقطتي الحالة والتقرير.
Authentication: Bearer tokenالمصادقة: توكن Bearer
Parametersالمعاملات
Idempotency-Keyoptionalاختياريheaderترويسة · string | Optional. Retrying with the same key returns the first response (header اختياري. إعادة المحاولة بنفس المفتاح تُرجع الرد الأول (الترويسة |
X-Allow-Duplicateoptionalاختياريheaderترويسة · string | Optional. Set to اختياري. اضبطه على |
senderNamerequiredمطلوبbodyجسم · string | Sender name approved for your account (see the sender names endpoint). اسم المرسِل المعتمد على حسابك (راجع نقطة أسماء المرسلين). |
numberrequiredمطلوبbodyجسم · string | Recipient mobile number in international format, digits only (8–15 digits), e.g. رقم جوال المستلم بالصيغة الدولية، أرقام فقط (من 8 إلى 15 رقمًا)، مثال |
messageBodyrequiredمطلوبbodyجسم · string | Message text, up to 1600 characters. نص الرسالة، حتى 1600 حرفًا. |
sendAtOptionoptionalاختياريbodyجسم · string | Delivery timing. توقيت الإرسال. القيمة |
Requestمثال الطلب
curl -X POST 'https://api.corbit.sa/api/v1/send' \
-H 'Authorization: Bearer YOUR_API_TOKEN' \
-H 'Content-Type: application/json' \
-d '{
"senderName": "Mobile.SA",
"number": "966XXXXXXXXX",
"messageBody": "Your code is 4821",
"sendAtOption": "NOW"
}'const response = await fetch("https://api.corbit.sa/api/v1/send", {
method: "POST",
headers: {
"Authorization": "Bearer YOUR_API_TOKEN",
"Content-Type": "application/json"
},
body: JSON.stringify({
"senderName": "Mobile.SA",
"number": "966XXXXXXXXX",
"messageBody": "Your code is 4821",
"sendAtOption": "NOW"
})
});
const data = await response.json();
console.log(data);import requests
response = requests.post(
"https://api.corbit.sa/api/v1/send",
headers={"Authorization": "Bearer YOUR_API_TOKEN"},
json={
"senderName": "Mobile.SA",
"number": "966XXXXXXXXX",
"messageBody": "Your code is 4821",
"sendAtOption": "NOW"
},
)
print(response.json())<?php
$ch = curl_init('https://api.corbit.sa/api/v1/send');
curl_setopt_array($ch, [
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => [
'Authorization: Bearer YOUR_API_TOKEN',
'Content-Type: application/json',
],
CURLOPT_POSTFIELDS => json_encode([
'senderName' => 'Mobile.SA',
'number' => '966XXXXXXXXX',
'messageBody' => 'Your code is 4821',
'sendAtOption' => 'NOW'
]),
]);
$response = curl_exec($ch);
curl_close($ch);
echo $response;#include <stdio.h>
#include <curl/curl.h>
int main(void) {
CURL *curl = curl_easy_init();
if (curl) {
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "Authorization: Bearer YOUR_API_TOKEN");
headers = curl_slist_append(headers, "Content-Type: application/json");
curl_easy_setopt(curl, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(curl, CURLOPT_URL, "https://api.corbit.sa/api/v1/send");
curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(curl, CURLOPT_POSTFIELDS, "{\n \"senderName\": \"Mobile.SA\",\n \"number\": \"966XXXXXXXXX\",\n \"messageBody\": \"Your code is 4821\",\n \"sendAtOption\": \"NOW\"\n}");
CURLcode res = curl_easy_perform(curl);
if (res != CURLE_OK) fprintf(stderr, "curl error: %s\n", curl_easy_strerror(res));
curl_slist_free_all(headers);
curl_easy_cleanup(curl);
}
return 0;
}using System;
using System.Net.Http;
using System.Text;
var client = new HttpClient();
var request = new HttpRequestMessage(HttpMethod.Post, "https://api.corbit.sa/api/v1/send");
request.Headers.Add("Authorization", "Bearer YOUR_API_TOKEN");
request.Content = new StringContent("{\n \"senderName\": \"Mobile.SA\",\n \"number\": \"966XXXXXXXXX\",\n \"messageBody\": \"Your code is 4821\",\n \"sendAtOption\": \"NOW\"\n}", Encoding.UTF8, "application/json");
var response = await client.SendAsync(request);
Console.WriteLine(await response.Content.ReadAsStringAsync());using System;
using RestSharp;
var client = new RestClient("https://api.corbit.sa/api/v1/send");
var request = new RestRequest("", Method.Post);
request.AddHeader("Authorization", "Bearer YOUR_API_TOKEN");
request.AddStringBody("{\n \"senderName\": \"Mobile.SA\",\n \"number\": \"966XXXXXXXXX\",\n \"messageBody\": \"Your code is 4821\",\n \"sendAtOption\": \"NOW\"\n}", DataFormat.Json);
RestResponse response = await client.ExecuteAsync(request);
Console.WriteLine(response.Content);import 'package:http/http.dart' as http;
void main() async {
final response = await http.post(
Uri.parse("https://api.corbit.sa/api/v1/send"),
headers: {
"Authorization": "Bearer YOUR_API_TOKEN",
"Content-Type": "application/json",
},
body: "{\n \"senderName\": \"Mobile.SA\",\n \"number\": \"966XXXXXXXXX\",\n \"messageBody\": \"Your code is 4821\",\n \"sendAtOption\": \"NOW\"\n}",
);
print(response.body);
}package main
import (
"fmt"
"io"
"net/http"
"strings"
)
func main() {
payload := strings.NewReader(`{
"senderName": "Mobile.SA",
"number": "966XXXXXXXXX",
"messageBody": "Your code is 4821",
"sendAtOption": "NOW"
}`)
req, err := http.NewRequest("POST", "https://api.corbit.sa/api/v1/send", payload)
if err != nil {
fmt.Println(err)
return
}
req.Header.Add("Authorization", "Bearer YOUR_API_TOKEN")
req.Header.Add("Content-Type", "application/json")
res, err := http.DefaultClient.Do(req)
if err != nil {
fmt.Println(err)
return
}
defer res.Body.Close()
out, _ := io.ReadAll(res.Body)
fmt.Println(string(out))
}POST /api/v1/send HTTP/1.1
Host: api.corbit.sa
Authorization: Bearer YOUR_API_TOKEN
Content-Type: application/json
Content-Length: 122
{
"senderName": "Mobile.SA",
"number": "966XXXXXXXXX",
"messageBody": "Your code is 4821",
"sendAtOption": "NOW"
}OkHttpClient client = new OkHttpClient().newBuilder().build();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"senderName\": \"Mobile.SA\",\n \"number\": \"966XXXXXXXXX\",\n \"messageBody\": \"Your code is 4821\",\n \"sendAtOption\": \"NOW\"\n}");
Request request = new Request.Builder()
.url("https://api.corbit.sa/api/v1/send")
.method("POST", body)
.addHeader("Authorization", "Bearer YOUR_API_TOKEN")
.addHeader("Content-Type", "application/json")
.build();
Response response = client.newCall(request).execute();
System.out.println(response.body().string());HttpResponse<String> response = Unirest.post("https://api.corbit.sa/api/v1/send")
.header("Authorization", "Bearer YOUR_API_TOKEN")
.header("Content-Type", "application/json")
.body("{\n \"senderName\": \"Mobile.SA\",\n \"number\": \"966XXXXXXXXX\",\n \"messageBody\": \"Your code is 4821\",\n \"sendAtOption\": \"NOW\"\n}")
.asString();
System.out.println(response.getBody());var settings = {
"url": "https://api.corbit.sa/api/v1/send",
"method": "POST",
"timeout": 0,
"headers": {
"Authorization": "Bearer YOUR_API_TOKEN",
"Content-Type": "application/json"
},
"data": JSON.stringify({
"senderName": "Mobile.SA",
"number": "966XXXXXXXXX",
"messageBody": "Your code is 4821",
"sendAtOption": "NOW"
}),
};
$.ajax(settings).done(function (response) {
console.log(response);
});var data = JSON.stringify({
"senderName": "Mobile.SA",
"number": "966XXXXXXXXX",
"messageBody": "Your code is 4821",
"sendAtOption": "NOW"
});
var xhr = new XMLHttpRequest();
xhr.addEventListener("readystatechange", function () {
if (this.readyState === 4) {
console.log(this.responseText);
}
});
xhr.open("POST", "https://api.corbit.sa/api/v1/send");
xhr.setRequestHeader("Authorization", "Bearer YOUR_API_TOKEN");
xhr.setRequestHeader("Content-Type", "application/json");
xhr.send(data);const axios = require('axios');
const config = {
method: 'post',
url: 'https://api.corbit.sa/api/v1/send',
headers: {
"Authorization": "Bearer YOUR_API_TOKEN",
"Content-Type": "application/json"
},
data: {
"senderName": "Mobile.SA",
"number": "966XXXXXXXXX",
"messageBody": "Your code is 4821",
"sendAtOption": "NOW"
},
};
axios.request(config)
.then((response) => console.log(JSON.stringify(response.data)))
.catch((error) => console.log(error));const https = require('https');
const options = {
method: 'POST',
hostname: 'api.corbit.sa',
path: '/api/v1/send',
headers: {
"Authorization": "Bearer YOUR_API_TOKEN",
"Content-Type": "application/json"
},
};
const req = https.request(options, (res) => {
const chunks = [];
res.on('data', (chunk) => chunks.push(chunk));
res.on('end', () => console.log(Buffer.concat(chunks).toString()));
});
req.write(JSON.stringify({
"senderName": "Mobile.SA",
"number": "966XXXXXXXXX",
"messageBody": "Your code is 4821",
"sendAtOption": "NOW"
}));
req.end();var unirest = require('unirest');
unirest('POST', 'https://api.corbit.sa/api/v1/send')
.headers({
"Authorization": "Bearer YOUR_API_TOKEN",
"Content-Type": "application/json"
})
.send(JSON.stringify({
"senderName": "Mobile.SA",
"number": "966XXXXXXXXX",
"messageBody": "Your code is 4821",
"sendAtOption": "NOW"
}))
.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.raw_body);
});#import <Foundation/Foundation.h>
dispatch_semaphore_t sema = dispatch_semaphore_create(0);
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"https://api.corbit.sa/api/v1/send"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:30.0];
NSDictionary *headers = @{
@"Authorization": @"Bearer YOUR_API_TOKEN",
@"Content-Type": @"application/json"
};
[request setAllHTTPHeaderFields:headers];
request.HTTPBody = [@"{\n \"senderName\": \"Mobile.SA\",\n \"number\": \"966XXXXXXXXX\",\n \"messageBody\": \"Your code is 4821\",\n \"sendAtOption\": \"NOW\"\n}" dataUsingEncoding:NSUTF8StringEncoding];
[request setHTTPMethod:@"POST"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSLog(@"%@", [[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding]);
}
dispatch_semaphore_signal(sema);
}];
[dataTask resume];
dispatch_semaphore_wait(sema, DISPATCH_TIME_FOREVER);open Lwt
open Cohttp
open Cohttp_lwt_unix
let uri = Uri.of_string "https://api.corbit.sa/api/v1/send"
let headers = Header.of_list [
("Authorization", "Bearer YOUR_API_TOKEN");
("Content-Type", "application/json");
]
let body = Cohttp_lwt.Body.of_string "{\n \"senderName\": \"Mobile.SA\",\n \"number\": \"966XXXXXXXXX\",\n \"messageBody\": \"Your code is 4821\",\n \"sendAtOption\": \"NOW\"\n}"
let () = Lwt_main.run (
Client.call ~headers ~body `POST uri >>= fun (_, body) ->
Cohttp_lwt.Body.to_string body >|= fun s -> print_endline s)<?php
$client = new GuzzleHttp\Client();
$headers = [
'Authorization' => 'Bearer YOUR_API_TOKEN',
'Content-Type' => 'application/json',
];
$body = '{
"senderName": "Mobile.SA",
"number": "966XXXXXXXXX",
"messageBody": "Your code is 4821",
"sendAtOption": "NOW"
}';
$request = new GuzzleHttp\Psr7\Request('POST', 'https://api.corbit.sa/api/v1/send', $headers, $body);
$res = $client->sendAsync($request)->wait();
echo $res->getBody();<?php
require_once 'HTTP/Request2.php';
$request = new HTTP_Request2();
$request->setUrl('https://api.corbit.sa/api/v1/send');
$request->setMethod(HTTP_Request2::METHOD_POST);
$request->setConfig(array('follow_redirects' => TRUE));
$request->setHeader(array(
'Authorization' => 'Bearer YOUR_API_TOKEN',
'Content-Type' => 'application/json',
));
$request->setBody('{
"senderName": "Mobile.SA",
"number": "966XXXXXXXXX",
"messageBody": "Your code is 4821",
"sendAtOption": "NOW"
}');
try {
$response = $request->send();
echo $response->getBody();
} catch (HTTP_Request2_Exception $e) {
echo 'Error: ' . $e->getMessage();
}<?php
$client = new http\Client;
$request = new http\Client\Request;
$request->setRequestUrl('https://api.corbit.sa/api/v1/send');
$request->setRequestMethod('POST');
$body = new http\Message\Body;
$body->append('{
"senderName": "Mobile.SA",
"number": "966XXXXXXXXX",
"messageBody": "Your code is 4821",
"sendAtOption": "NOW"
}');
$request->setBody($body);
$request->setHeaders(array(
'Authorization' => 'Bearer YOUR_API_TOKEN',
'Content-Type' => 'application/json',
));
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();$headers = @{
'Authorization' = 'Bearer YOUR_API_TOKEN'
'Content-Type' = 'application/json'
}
$body = @'
{
"senderName": "Mobile.SA",
"number": "966XXXXXXXXX",
"messageBody": "Your code is 4821",
"sendAtOption": "NOW"
}
'@
$response = Invoke-RestMethod 'https://api.corbit.sa/api/v1/send' -Method 'POST' -Headers $headers -Body $body
$response | ConvertTo-Json -Depth 10import http.client
import json
conn = http.client.HTTPSConnection("api.corbit.sa")
payload = json.dumps({
"senderName": "Mobile.SA",
"number": "966XXXXXXXXX",
"messageBody": "Your code is 4821",
"sendAtOption": "NOW"
})
headers = {
"Authorization": "Bearer YOUR_API_TOKEN",
"Content-Type": "application/json",
}
conn.request("POST", "/api/v1/send", payload, headers)
res = conn.getresponse()
print(res.read().decode("utf-8"))library(httr)
headers = c(
'Authorization' = 'Bearer YOUR_API_TOKEN',
'Content-Type' = 'application/json'
)
body = '{
"senderName": "Mobile.SA",
"number": "966XXXXXXXXX",
"messageBody": "Your code is 4821",
"sendAtOption": "NOW"
}'
res <- VERB("POST", url = "https://api.corbit.sa/api/v1/send", body = body, add_headers(headers))
cat(content(res, 'text'))library(RCurl)
headers = c(
'Authorization' = 'Bearer YOUR_API_TOKEN',
'Content-Type' = 'application/json'
)
params = '{
"senderName": "Mobile.SA",
"number": "966XXXXXXXXX",
"messageBody": "Your code is 4821",
"sendAtOption": "NOW"
}'
res <- getURLContent("https://api.corbit.sa/api/v1/send", customrequest = "POST", postfields = params, httpheader = headers, followlocation = TRUE)
cat(res)require "uri"
require "net/http"
url = URI("https://api.corbit.sa/api/v1/send")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = "Bearer YOUR_API_TOKEN"
request["Content-Type"] = "application/json"
request.body = <<~'JSON'
{
"senderName": "Mobile.SA",
"number": "966XXXXXXXXX",
"messageBody": "Your code is 4821",
"sendAtOption": "NOW"
}
JSON
response = http.request(request)
puts response.read_bodyprintf '%s' '{
"senderName": "Mobile.SA",
"number": "966XXXXXXXXX",
"messageBody": "Your code is 4821",
"sendAtOption": "NOW"
}' | \
http --follow --timeout 3600 POST 'https://api.corbit.sa/api/v1/send' \
'Authorization:Bearer YOUR_API_TOKEN' \
'Content-Type:application/json'wget --quiet -O - \
--method POST \
--header 'Authorization: Bearer YOUR_API_TOKEN' \
--header 'Content-Type: application/json' \
--body-data '{
"senderName": "Mobile.SA",
"number": "966XXXXXXXXX",
"messageBody": "Your code is 4821",
"sendAtOption": "NOW"
}' \
'https://api.corbit.sa/api/v1/send'import Foundation
#if canImport(FoundationNetworking)
import FoundationNetworking
#endif
let semaphore = DispatchSemaphore(value: 0)
var request = URLRequest(url: URL(string: "https://api.corbit.sa/api/v1/send")!, timeoutInterval: 30)
request.httpMethod = "POST"
request.addValue("Bearer YOUR_API_TOKEN", forHTTPHeaderField: "Authorization")
request.addValue("application/json", forHTTPHeaderField: "Content-Type")
request.httpBody = "{\"senderName\":\"Mobile.SA\",\"number\":\"966XXXXXXXXX\",\"messageBody\":\"Your code is 4821\",\"sendAtOption\":\"NOW\"}".data(using: .utf8)
let task = URLSession.shared.dataTask(with: request) { data, response, error in
if let data = data {
print(String(data: data, encoding: .utf8) ?? "")
} else {
print(String(describing: error))
}
semaphore.signal()
}
task.resume()
semaphore.wait()Responsesالردود
200Acceptedتم القبول
{
"status": "Success",
"message": null,
"data": {
"message": {
"id": "8493f201-ebcc-4415-8450-18d8d8714f33",
"status": "pending"
}
}
}400Invalid requestطلب غير صالح
{
"status": "Error",
"message": "Invalid destination number: 12 (expected 8-15 digits, international format).",
"code": "VALIDATION"
}402Balance exhaustedالرصيد منتهٍ
{
"status": "Error",
"message": "Insufficient balance (0). Please top up to continue sending.",
"code": "INSUFFICIENT_BALANCE"
}409Duplicate messageرسالة مكرّرة
{
"status": "Error",
"message": "Duplicate request blocked: same client, destination, and message within the dedup window.",
"code": "DUPLICATE"
}429Rate limit exceededتجاوز حد الطلبات
{
"status": "Error",
"message": "Rate limit exceeded",
"code": "RATE_LIMIT"
}