### Receive SMS Request (XML POST) Source: https://www.netgsm.com.tr/dokuman/#api-dokumani Example XML POST request to receive SMS messages. Requires user credentials, start date, stop date, and type. ```XML
850xxxxxxx xxxxxxxx 010420260000 210420262359 0
``` -------------------------------- ### SMS Report Request (GET) Source: https://www.netgsm.com.tr/dokuman/#api-dokumani Example GET request to retrieve SMS delivery reports. Parameters include user credentials, bulk ID, type, status, and version. ```HTTP https://api.netgsm.com.tr/sms/report?usercode=850xxxxxxx&password=xxxxxx&bulkid=53545&type=0&status=100&version=2 ``` -------------------------------- ### Unsuccessful Response Example Source: https://www.netgsm.com.tr/dokuman/#api-dokumani This is an example of an unsuccessful response from the API. The 'code' field will indicate the error. ```json { "code": "XX" } ``` -------------------------------- ### Successful stip=1 Response (Package Info) Source: https://www.netgsm.com.tr/dokuman/#api-dokumani This is an example of a successful response when requesting package information (stip=1). It includes the amount and name of the package. ```json { "balance": [ { "amount": 20, "balance_name": "Adet SMS" } ] } ``` -------------------------------- ### XML POST OTP SMS Request Example Source: https://www.netgsm.com.tr/dokuman/#api-dokumani This is an example of the XML structure required to send an OTP SMS. Ensure all parameters like usercode, password, msgheader, msg, and no are correctly populated. ```xml
850xxxxxxx xxxxxxxx BASLIK
510xxxxxxx
``` -------------------------------- ### OTP SMS API Request Example Source: https://www.netgsm.com.tr/dokuman/#api-dokumani This is an example of a JSON request body for sending an OTP SMS. Ensure 'msgheader', 'msg', and 'no' are correctly populated. ```json { "msgheader": "BASLIK", "msg": "code: 1234", "no": "510XXXXXXX" } ``` -------------------------------- ### Successful stip=3 Response (Package/Credit Info) Source: https://www.netgsm.com.tr/dokuman/#api-dokumani This is an example of a successful response when requesting all package and credit information (stip=3). It lists both package amounts and credit balances. ```json { "balance": [ { "amount": 20, "balance_name": "Adet SMS" }, { "amount": "15", "balance_name": "Kredi Bakiye" } ] } ``` -------------------------------- ### WhatsApp OTP Request Example Source: https://www.netgsm.com.tr/dokuman/#api-dokumani This is an example of a request body for sending an OTP code via WhatsApp. Ensure the 'to' number is in E.164 format and the 'code' is numeric and up to 6 digits. ```json { "to": "+90510xxxxxxx", "code": "123456" } ``` -------------------------------- ### Successful stip=2 Response (Credit Info) Source: https://www.netgsm.com.tr/dokuman/#api-dokumani This is an example of a successful response when requesting credit information (stip=2). It returns a status code and the credit balance. ```json { "code": "00", "balance": "15" } ``` -------------------------------- ### SMS Length Calculation Request Example Source: https://www.netgsm.com.tr/dokuman/#api-dokumani This is an example of a request payload to calculate SMS length and size. It includes the message context, encoding type, and an option to include a custom header. ```json { "context": "Merhaba, sifreniz 123456", "encoding": 0, "customHeader": true } ``` -------------------------------- ### Voice Report API Successful Response Example (XML) Source: https://www.netgsm.com.tr/dokuman/#api-dokumani This is an example of a successful response from the Voice Report API when requesting XML format. It includes call details and metadata about the records returned. ```xml
850XXXXXXX 510XXXXXXX 08.04.2026 11:08:48 00:00:10 4 1 1 100
``` -------------------------------- ### Successful API Response Example Source: https://www.netgsm.com.tr/dokuman/#api-dokumani This JSON object represents a successful API request, indicating the message has been queued. ```json { "code": "00", "jobid": "17377215342605050417149344", "description": "queued" } ``` -------------------------------- ### Failed API Response Example Source: https://www.netgsm.com.tr/dokuman/#api-dokumani This JSON object represents a failed API request, showing an error message. ```json { "code": "XX", "jobid": null, "description": "error message desc." } ``` -------------------------------- ### Failed OTP SMS Response Example Source: https://www.netgsm.com.tr/dokuman/#api-dokumani An example of a failed response from the NetGSM API. The 'code' field indicates the error type (e.g., '30' for invalid credentials), and an 'error' message provides more detail. ```xml
30 Kullanici bilgisi bulunamadi
``` -------------------------------- ### Voice Report API Request Example (XML) Source: https://www.netgsm.com.tr/dokuman/#api-dokumani This snippet shows the structure of a request to the Voice Report API when XML output is desired. Ensure all required parameters like usercode, password, date, and direction are correctly formatted. ```xml
850xxxxxxx xxxxxxxx 150420261000 1 1
``` -------------------------------- ### Fax Report API Request Example Source: https://www.netgsm.com.tr/dokuman/#api-dokumani Use this URL format to query fax transmission statuses. Ensure all required parameters like usercode, password, and type are correctly provided. ```http https://api.netgsm.com.tr/fax/report/?usercode=850xxxxxxx&password=xxxxxxxx&bulkid=32443&type=0&status=0 ``` -------------------------------- ### Send SMS Request Example Source: https://www.netgsm.com.tr/dokuman/#api-dokumani This JSON payload demonstrates how to send a standard SMS message. Ensure all required parameters like 'msgheader' and 'messages' are correctly populated. The 'messages' array can contain multiple recipients and messages. ```json { "msgheader": "BASLIK", "messages": [ { "msg": "test1", "no": "510xxxxxxx" }, { "msg": "test2", "no": "510xxxxxxx" } ], "encoding": "TR", "iysfilter": "0", "appname": "uygulama adiniz" } ``` -------------------------------- ### Send Scheduled SMS Request Example Source: https://www.netgsm.com.tr/dokuman/#api-dokumani This JSON payload illustrates how to schedule an SMS message for future delivery. Use 'startdate' and 'stopdate' parameters with the format 'ddMMyyyyHHmm' to define the sending window. If 'startdate' is omitted, the message is sent immediately. ```json { "msgheader": "BASLIK", "messages": [ { "msg": "test1", "no": "510xxxxxxx" }, { "msg": "test2", "no": "510xxxxxxx" } ], "encoding": "TR", "startdate": "110420260100", "stopdate": "110420262200", "iysfilter": "0", "appname": "uygulama adiniz" } ``` -------------------------------- ### Send Fax Request Example Source: https://www.netgsm.com.tr/dokuman/#api-dokumani This cURL command demonstrates how to send a fax using the NetGSM API. Ensure you replace placeholder values with your actual credentials and recipient details. The 'parametre' field must be set to '2' for fax sending. ```bash curl --location 'https://api.netgsm.com.tr/fax/send' \ --header 'Content-Type: multipart/form-data' \ --form 'username="850xxxxxxx"' \ --form 'password="xxxxxxxx"' \ --form 'refid="123"' \ --form 'telefon="850xxxxxxx"' \ --form 'parametre="2"' ``` -------------------------------- ### JSON POST Request for SMS Report within Date Range Source: https://www.netgsm.com.tr/dokuman/#api-dokumani This example shows how to query SMS reports for specific job IDs within a defined date range. Both startdate and stopdate parameters are required when used together. ```json { "jobids": [ "17377215342605050417149344", "17377215342605050417149345" ], "startdate": "07.04.2026 00:00:00", "stopdate": "08.04.2026 23:59:59" } ``` -------------------------------- ### Add Address JSON Request Source: https://www.netgsm.com.tr/dokuman/#api-dokumani This is an example of a JSON request body to add multiple contact addresses. It includes header information and a data array with details for each address. ```json { "header": { "username": "850xxxxxxx", "password": "xxxxxxxx", "brandCode": "68xxxx" }, "body": { "data": [ { "type": "ARAMA", "source": "HS_CAGRI_MERKEZI", "recipient": "+905XXXXXXXXX", "status": "ONAY", "consentDate": "2020-11-05 09:40:00", "recipientType": "BIREYSEL" }, { "type": "MESAJ", "source": "HS_MESAJ", "recipient": "+905XXXXXXXXX", "status": "ONAY", "consentDate": "2020-11-05 09:40:00", "recipientType": "BIREYSEL" }, { "type": "EPOSTA", "source": "HS_WEB", "recipient": "info@netgsm.com.tr", "status": "ONAY", "consentDate": "2020-11-06 09:40:00", "recipientType": "BIREYSEL" } ] } } ``` -------------------------------- ### Sesli Mesaj İptali Source: https://www.netgsm.com.tr/dokuman/#api-dokumani İleri tarihe zamanlanmış sesli mesajlarınızı iptal etmek için bu endpoint'i kullanabilirsiniz. İptal işlemi için gerekli olan usercode, password ve bulkid bilgileri istek ile birlikte gönderilmelidir. ```APIDOC ## POST https://api.netgsm.com.tr/voicesms/edit ### Description İleri tarihe zamanlanmış sesli mesajlarınızı iptal etmenizi sağlar. ### Method POST ### Endpoint https://api.netgsm.com.tr/voicesms/edit ### Parameters #### Query Parameters - **usercode** (string) - Zorunlu - Netgsm'den hizmet alınan abone numarası. - **password** (string) - Zorunlu - API yetkisi tanımlı alt kullanıcı şifresi. - **bulkid** (string) - Zorunlu - İptal edilmek istenen, sesli mesaj gönderimi yapılırken dönen görev id'niz. ### Request Example ```php function sesliMesajiptal(){ $username = "850303xxxx"; // $password = urlencode("xxxx"); // $url= "https://api.netgsm.com.tr/voicesms/edit?usercode=312XXXXXXX&password=XXXX&bulkid=XXXXXX"; $ch = curl_init($url); curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); $http_response = curl_exec($ch); $http_code = curl_getinfo($ch, CURLINFO_HTTP_CODE); if($http_code != 200){ echo "$http_code $http_response\n"; return false; } $balanceInfo = $http_response; echo "MesajID : $balanceInfo"; return $balanceInfo; } sesliMesajiptal(); ``` ### Response #### Success Response (200) - **code** (integer) - İşlem durum kodu. - **message** (string) - İşlem sonucu hakkında bilgi veren mesaj. - **bulkid** (string) - İşlemin gerçekleştirildiği sesli mesajın id'si. #### Response Example ```json { "code": 200, "message": "bulkid iptal islemine alindi.", "bulkid": "XXXXXX" } ``` ### Error Handling - **30**: Geçersiz kullanıcı adı, şifre veya API erişim izni yok. - **40**: Verilen bulkid için ileri tarihli sesli mesaj bulunamadı. - **70**: Hatalı sorgulama (parametre hatası veya eksik zorunlu alan). ``` -------------------------------- ### 1:n SMS Request Example Source: https://www.netgsm.com.tr/dokuman/#api-dokumani This is an example of a one-to-many SMS request. It is used when sending a single message to multiple recipients. ```xml
Netgsm 850xxxxxxx xxxxxxxx 1:n BASLIK
510xxxxxxx 511xxxxxxx
``` -------------------------------- ### Ses Dosyası Yükleme API İsteği (PHP) Source: https://www.netgsm.com.tr/dokuman/#api-dokumani Sesli mesaj göndermek için ses dosyasını NetGSM API'sine yüklemek üzere kullanılır. 'username', 'password' ve 'dosya' parametrelerini içeren bir POST isteği gönderir. Dosya uzantısı '.wav' olmalıdır ve dosya boyutu maksimum 4 MB olmalıdır. ```php $target_url ="https://api.netgsm.com.tr/voicesms/upload"; $fname = ""; // dosya yolunu belirtin. $cfile = new CURLFile(realpath($fname)); $post = array ( 'dosya' => $cfile, 'username' => $username, 'password' => $password ); $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $target_url); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_HEADER, 0); curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 2); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/4.0 (compatible;)"); curl_setopt($ch, CURLOPT_HTTPHEADER,array('Content-Type: multipart/form-data')); curl_setopt($ch, CURLOPT_FRESH_CONNECT, 1); curl_setopt($ch, CURLOPT_FORBID_REUSE, 1); curl_setopt($ch, CURLOPT_TIMEOUT, 100); curl_setopt($ch, CURLOPT_POSTFIELDS, $post); $result = curl_exec ($ch); if ($result === FALSE) { echo "Error sending" . $fname . " " . curl_error($ch); curl_close ($ch); }else{ curl_close ($ch); echo "Result: " . $result; } ``` -------------------------------- ### n:n SMS Request Example Source: https://www.netgsm.com.tr/dokuman/#api-dokumani This is an example of a many-to-many SMS request. It is used when sending multiple distinct messages to multiple recipients. ```xml
Netgsm 850xxxxxxx xxxxxxxx n:n BASLIK
510xxxxxxx 511xxxxxxx ``` -------------------------------- ### Dinamik Sesli Mesaj Gönderimi Source: https://www.netgsm.com.tr/dokuman/#api-dokumani Senaryonuza göre sırası belirlenmiş şekilde gönderdiğiniz yüklü ses dosyaları ya da textlerinizle sesli mesajınız başlatılır. 1:n mantığı ile bir sesli mesajı birden fazla numaraya başlatabilirsiniz. ```APIDOC ## POST https://api.netgsm.com.tr/voicesms/send ### Description Bu endpoint, önceden yüklenmiş ses dosyaları veya metinler aracılığıyla dinamik sesli mesaj göndermek için kullanılır. Tek bir sesli mesajı birden fazla numaraya gönderme yeteneği sunar. ### Method POST ### Endpoint https://api.netgsm.com.tr/voicesms/send ### Parameters #### Query Parameters - **usercode** (string) - Zorunlu - Netgsm'den hizmet alınan abone numarası. - **password** (string) - Zorunlu - API yetkisi tanımlı alt kullanıcı şifresi. - **startdate** (string) - Opsiyonel - Gönderime başlayacağınız tarih (ddMMyyyy). - **starttime** (string) - Opsiyonel - Mesajın gönderilmeye başlanacağı saat (ssdd). - **stopdate** (string) - Opsiyonel - İki tarih arası gönderimlerde bitiş tarihi (ddMMyyyy). Başlangıç ve bitiş tarihleri arasında en az 1 saat en fazla 21 saat olmalıdır. - **stoptime** (string) - Opsiyonel - Mesaj gönderimi bitiş saati (ssdd). - **relationid** (string) - Opsiyonel - Tarafınızda belirleyeceğiniz bir random sayı ile sesli mesaj başlattığınızda, raporlama servisini sorguladığınızda dönecek olan ID. - **url** (string) - Opsiyonel - Sesli mesajın durumunun (raporunun) post edilmesini istediğiniz URL. - **key** (string) - Opsiyonel - Ses kaydının sonunda tuşa basılmasını isteyip istemediğinizi belirtir. '1' basılmasını istediğiniz anlamına gelir, '0' ise istemediğiniz anlamına gelir. - **audioid** (string) - Opsiyonel - Gönderilmek istenen ses ID'si. Sisteme daha önce yüklenmiş olmalıdır. - **text** (string) - Opsiyonel - Gönderilmek istenen metin. - **no** (string) - Zorunlu - Mesajın gönderileceği telefon numarası. - **keys** (string) - Opsiyonel - Sesli mesaj başlattıktan sonra, karşı taraftan istenen tuşlama bilgisi ile arama başlattığınız numaraya tekrar bir metin ya da ses dosyası dinletmek için kullanılır. - **keydetail** (string) - Opsiyonel - Tuşlama bilgisi ile işlem yapılacaksa gönderilir. Gönderilecek tuş bilgisi kadar bu tagi de göndermek gereklidir. - **keyinfo** (string) - Opsiyonel - Tuş bilgisi bu parametre ile gönderilir. Bu parametre sonrasında audioID ya da text bilgisi içeren parametre göndermeniz zorunludur. - **filter** (string) - Opsiyonel - Ticari içerikli sesli mesaj gönderimlerinde kullanılır. Bireysel gönderimler için '11', tacir gönderimleri için '12', bilgilendirme amaçlı gönderimler için '0' değerini almalıdır. - **ringtime** (string) - Opsiyonel - Sesli mesaj için yapılan aramada telefonun çalma süresi (min 10 - max 30 sn). ### Response #### Success Response (200) - **Kodu** (string) - Görevinizin tarih formatında bir hata olmadığını gösterir ('00'). - **123456** (string) - Gönderdiğiniz Sesli mesajın başarıyla sistemimize ulaştığını gösterir. Bu görev ID'si ile mesajınızın durumunu sorgulayabilirsiniz. #### Error Response - **30** - Geçersiz kullanıcı adı, şifre veya API erişim izni yok. - **40** - Ses dosyasının olmadığını ifade eder. - **45** - Gönderilecek telefon numarasının bulunmadığını ifade eder. - **70** - Hatalı sorgulama. Gönderilen parametrelerden birisi hatalı veya zorunlu alanlardan birinin eksik olduğunu ifade eder. ``` -------------------------------- ### Sesli Mesaj Durum Raporunu Loglama Source: https://www.netgsm.com.tr/dokuman/#api-dokumani Bu PHP fonksiyonu, gelen sesli mesaj durum bilgilerini alır ve belirtilen bir log dosyasına kaydeder. Log dizininin mevcut olup olmadığını kontrol eder ve yoksa oluşturur. ```php function log_yaz($veri,$dosya_adi) { if (!is_dir("D:/Log/")) { mkdir("D:/Log/",0700); } $dosya = "D:/Log/$dosya_adi.txt"; $dt=fopen($dosya, 'a'); if (is_writable($dosya)) { if (!$dt = fopen($dosya, 'a')) { exit; } if (fwrite($dt, $veri) === FALSE) { exit; } fclose($dt); } } $gelendegerler = file_get_contents("php://input"); $gelendegerler = html_entity_decode($gelendegerler,ENT_COMPAT,'UTF-8'); log_yaz($gelendegerler, "seslismsRapor"); // Sesli Mesaj Durum bilgisi için URL'e POST Edilecek Bilgi : /* { "bulkid": , "caller": "", "callee": "", "state": , "type": , "name": "", "creation_time": "", "start_time": "", "answer_time": "", "hangup_time": "", "bilsec": , "relationid": , "detail": { "push_button": , "survey_push_button_desc": "", "survey_taskid": , "record_link": "" } } */ ``` -------------------------------- ### JSON GET Incoming SMS Source: https://www.netgsm.com.tr/dokuman/#api-dokumani Incoming SMS messages can be queried using a JSON GET request to a service URL. This method allows for retrieving messages within a specified date and time range. ```APIDOC ## JSON GET Incoming SMS ### Description Incoming SMS messages can be queried via a JSON GET request to the service URL. If no parameters are sent, the 'seen' status applies, and each message is returned only once. Providing `startdate` and `stopdate` parameters overrides the 'seen' status and retrieves all SMS messages within the specified range. ### Method GET ### Endpoint https://api.netgsm.com.tr/sms/rest/v2/inbox ### Parameters #### Query Parameters - **startdate** (string) - Required if querying a date range. The start date and time (Format: ddMMyyyyHHmm). - **stopdate** (string) - Required if querying a date range. The end date and time (Format: ddMMyyyyHHmm). - **appname** (string) - Optional. Your application name. ### Authentication - API uses HTTP Basic Authentication. Username and password must be Base64 encoded and added to the Authorization header. ### Request Example ``` https://api.netgsm.com.tr/sms/rest/v2/inbox ``` ### Example Parameterized Request ``` https://api.netgsm.com.tr/sms/rest/v2/inbox?startdate=010420260000&stopdate=200420262359 ``` ### Response #### Success Response (200) - **code** (string) - Success code, e.g., "00". - **messages** (array) - An array of message objects. - **id** (integer) - Message ID. - **gorevId** (string) - Task ID. - **kayittar** (string) - Registration timestamp. - **mesaj** (string) - The message content. - **operator** (string) - Operator name. - **gonderen** (string) - Sender number. - **description** (string) - Success message, e.g., "success". #### Successful Example Response ```json { "code": "00", "messages": [ { "id": 121386491, "gorevId": "120210000", "kayittar": "1770000000000", "mesaj": "Mesaj metni", "operator": "Netgsm", "gonderen": "510xxxxxxx" } ], "description": "success" } ``` #### Error Response - **code** (string) - Error code (e.g., "30", "40", "50", "60", "70"). - **messages** (null) - Always null for errors. - **description** (string) - Error message description. #### Error Example Response ```json { "code": "XX", "messages": null, "description": "error message desc." } ``` ### Error Handling - **30**: Invalid username/password or API access permission denied. Also returned if requests are made from an IP outside the defined limits. - **40**: No messages to display. Messages can only be listed once if `startdate` and `stopdate` are not used. - **50**: Invalid date format. Expected format: ddmmyyyyhhmm. - **60**: The time difference between `startdate` and `stopdate` exceeds 30 days. - **70**: Invalid query. One of the provided parameters is incorrect, or a required field is missing. ``` -------------------------------- ### Sesli Mesaj İptali İstek Örneği Source: https://www.netgsm.com.tr/dokuman/#api-dokumani İleri tarihe zamanlanmış sesli mesajları iptal etmek için bu PHP cURL isteğini kullanın. 'usercode', 'password' ve 'bulkid' parametrelerini doğru şekilde doldurduğunuzdan emin olun. ```php function sesliMesajiptal(){ $username = "850303xxxx"; // $password = urlencode("xxxx"); // $url= "https://api.netgsm.com.tr/voicesms/edit?usercode=312XXXXXXX&password=XXXX&bulkid=XXXXXX"; $ch = curl_init($url); curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); $http_response = curl_exec($ch); $http_code = curl_getinfo($ch, CURLINFO_HTTP_CODE); if($http_code != 200){ echo "$http_code $http_response\n"; return false; } $balanceInfo = $http_response; echo "MesajID : $balanceInfo"; return $balanceInfo; } sesliMesajiptal(); ``` -------------------------------- ### Failed Add Address Response Source: https://www.netgsm.com.tr/dokuman/#api-dokumani This is an example of a failed response from the API. It includes an error code and a descriptive error message. ```json { "code": "XX", "error": "error message desc." } ``` -------------------------------- ### JSON POST Paket/Kredi Sorgulama Source: https://www.netgsm.com.tr/dokuman/#api-dokumani Netgsm hizmetlerinden alınan paket veya kredi bilgilerini sorgulamak için kullanılır. 'stip' parametresi ile istenen bilgi türü belirtilir. ```APIDOC ## JSON POST Paket/Kredi Sorgulama ### Description Netgsm hizmetlerinden alınan paket veya kredi bilgilerini sorgulamak için kullanılır. 'stip' parametresi ile istenen bilgi türü belirtilir. ### Method POST ### Endpoint https://api.netgsm.com.tr/balance ### Parameters #### Request Body - **usercode** (string) - Evet - Netgsm'den hizmet alınan abone numarası (Format: 850xxxxxxx, 312XXXXXXX vs.). - **password** (string) - Evet - Alt kullanıcı şifresi. (Alt kullanıcı türü "API Kullanıcısı" olan alt kullanıcıya ait şifre.) - **stip** (integer) - Evet - 1: paket/kampanya bilgisi, 2: kredi bilgisi, 3: paket/kampanya/kredi tüm varlık bilgisi almak için gönderilir. ### Request Example ```json { "usercode": "850xxxxxxx", "password":"xxxxxxxx", "stip": 1 } ``` ### Response #### Success Response (stip=1) - **balance** (array) - Paket bilgilerini içerir. - **amount** (integer) - Miktar - **balance_name** (string) - Paket Adı #### Success Response (stip=2) - **code** (string) - İleti veya Hata Durumu _00 başarılı sorgulama sonucu döner._ - **balance** (string) - Kredi Miktarı #### Success Response (stip=3) - **balance** (array) - Paket ve kredi bilgilerini içerir. - **amount** (integer/string) - Miktar - **balance_name** (string) - Varlık Türü #### Response Example (stip=1) ```json { "balance": [ { "amount": 20, "balance_name": "Adet SMS" } ] } ``` #### Response Example (stip=2) ```json { "code": "00", "balance": "15" } ``` #### Response Example (stip=3) ```json { "balance": [ { "amount": 20, "balance_name": "Adet SMS" }, { "amount": "15", "balance_name": "Kredi Bakiye" } ] } ``` #### Response Example (Error) ```json { "code": "XX" } ``` ### Error Handling - **30**: Geçersiz kullanıcı adı, şifre veya API erişim izni yok. IP sınırlaması kontrol edilmeli. - **60**: Hesabınızda tanımlı paket veya kampanya bulunmamaktadır. - **70**: Hatalı sorgulama. Parametrelerden biri hatalı veya zorunlu alan eksik. ``` -------------------------------- ### Failed WhatsApp OTP Response Source: https://www.netgsm.com.tr/dokuman/#api-dokumani This is an example of a failed response from the WhatsApp OTP API. The 'code' and 'description' fields will provide details about the error. ```json { "code": "XX", "description": "error message desc." } ``` -------------------------------- ### Failed SMS Response Example Source: https://www.netgsm.com.tr/dokuman/#api-dokumani This JSON object illustrates a failed response from an SMS operation, indicating an error code and a description of the failure. ```json { "code": "XX", "jobs": null, "description": "error message desc." } ``` -------------------------------- ### Successful SMS Response Example Source: https://www.netgsm.com.tr/dokuman/#api-dokumani This JSON object represents a successful response from an SMS operation, detailing job information and a success status. ```json { "code": "00", "jobs": [ { "jobid": "17377215342605050417149344", "number": "510xxxxxxx", "status": 1, "operator": 40, "msglen": 1, "deliveredDate": "2026-04-07 08:55:47", "errorCode": 0, "referansID": "" } ], "description": "success" } ``` -------------------------------- ### XML Post Paket/Kredi Sorgulama Source: https://www.netgsm.com.tr/dokuman/#api-dokumani Allows users to query their Netgsm account balance and package/campaign information via an XML POST request. The `stip` parameter determines the type of information retrieved (package, credit, or both). ```APIDOC ## POST https://api.netgsm.com.tr/balance ### Description Queries Netgsm account balance and package/campaign information. ### Method POST ### Endpoint https://api.netgsm.com.tr/balance ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body - **usercode** (string) - Required - Netgsm service subscriber number. - **password** (string) - Required - Sub-user password for API access. - **stip** (integer) - Required - 1: package/campaign info, 2: credit info, 3: package/campaign/credit all info. - **view** (integer) - Optional - If set to 1, returns XML results. ### Request Example ```xml
850xxxxxxx xxxxxxxx 1 1
``` ### Response #### Success Response (stip=1) - **amount** (integer) - Quantity. - **balance_name** (string) - Package Name. #### Response Example (stip=1) ```xml 20 Adet SMS ``` #### Success Response (stip=2) - **code** (string) - Message or Error Status (00 for successful query). - **balance** (integer) - Credit Amount. #### Response Example (stip=2) ```xml 00 15 ``` #### Success Response (stip=3) - **amount** (integer) - Quantity. - **balance_name** (string) - Asset Type. #### Response Example (stip=3) ```xml 20 Adet SMS 15 Kredi Bakiye ``` #### Error Handling - **code** (string) - Error code. #### Error Response Example ```xml XX ``` #### Error Codes - **30**: Invalid username, password, or API access permission denied. Also occurs if sending from an IP not included in IP restrictions. - **60**: No package or campaign defined in your account. - **70**: Invalid query. One of the sent parameters is incorrect or a required field is missing. ``` -------------------------------- ### Failed SMS Length Calculation Response Source: https://www.netgsm.com.tr/dokuman/#api-dokumani This is an example of a failed response from the SMS length calculation API. It indicates an error with a code and a description. ```json { "code": "XX", "description": "error message desc." } ``` -------------------------------- ### Successful WhatsApp OTP Response Source: https://www.netgsm.com.tr/dokuman/#api-dokumani This is an example of a successful response from the WhatsApp OTP API. A '00' code indicates success, and the 'jobid' can be used for tracking. ```json { "jobid": "wamid.HBgNOTA1MzIx...", "code": "00", "description": "success" } ```