Returns the information for all your created SMS campaigns

Code Examples

You can use as reference the code below to implement this call in your preferred language.
Check all our official API clients here

const SibApiV3Sdk = require('sib-api-v3-sdk');
const defaultClient = SibApiV3Sdk.ApiClient.instance;

let apiKey = defaultClient.authentications['api-key'];
apiKey.apiKey = 'YOUR API KEY';

let apiInstance = new SibApiV3Sdk.SMSCampaignsApi();

let opts = { 
  'status': "string",
  'startDate': new Date("YYYY-MM-DDTHH:MM:ss+00:00"),
  'endDate': new Date("YYYY-MM-DDTHH:MM:ss+00:00"),
  'limit': 50,
  'offset': 0
};

apiInstance.getSmsCampaigns(opts).then(function(data) {
  console.log('API called successfully. Returned data: ' + JSON.stringify(data));
}, function(error) {
  console.error(error);
});
<?php
require_once(__DIR__ . '/vendor/autoload.php');

$config = SendinBlue\Client\Configuration::getDefaultConfiguration()->setApiKey('api-key', 'YOUR API KEY');

$apiInstance = new SendinBlue\Client\Api\SMSCampaignsApi(
    new GuzzleHttp\Client(),
    $config
);
$status = 'sent';
$startDate = new \DateTime('2021-01-01T00:00:00+00:00');
$endDate = new \DateTime('2021-01-01T00:00:00+00:00');
$limit = 50;
$offset = 0;

try {
    $result = $apiInstance->getSmsCampaigns($status, $startDate, $endDate, $limit, $offset);
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling SMSCampaignsApi->getSmsCampaigns: ', $e->getMessage(), PHP_EOL;
}
?>
from __future__ import print_function
import time
import sib_api_v3_sdk
from sib_api_v3_sdk.rest import ApiException
from pprint import pprint

configuration = sib_api_v3_sdk.Configuration()
configuration.api_key['api-key'] = 'YOUR API KEY'

api_instance = sib_api_v3_sdk.SMSCampaignsApi(sib_api_v3_sdk.ApiClient(configuration))
status = 'string'
start_date = 'YYYY-MM-DDTHH:MM:ss+00:00'
end_date = 'YYYY-MM-DDTHH:MM:ss+00:00'
limit = 500
offset = 0

try:
    api_response = api_instance.get_sms_campaigns(status=status, start_date=start_date, end_date=end_date, limit=limit, offset=offset)
    pprint(api_response)
except ApiException as e:
    print("Exception when calling SMSCampaignsApi->get_sms_campaigns: %s\n" % e)
const SibApiV3Sdk = require('sib-api-v3-typescript');
 
let apiInstance = new SibApiV3Sdk.SMSCampaignsApi()

let apiKey = apiInstance.authentications['apiKey'];
apiKey.apiKey = 'YOUR API KEY';

let status = 'sent';
let startDate = new Date('2021-01-01T00:00:00+00:00');
let endDate = new Date('2021-01-01T00:00:00+00:00');
let limit = 50;
let offset = 0;

apiInstance.getSmsCampaigns(status,startDate,endDate,limit,offset).then(function(data) {
  console.log('API called successfully. Returned data: ' + JSON.stringify(data));
}, function(error) {
  console.error(error);
});
using sib_api_v3_sdk.Api;
using sib_api_v3_sdk.Client;
using sib_api_v3_sdk.Model;
using System;
using System.Diagnostics;

namespace Sendinblue
{
    class Program
    {
        static void Main(string[] args)
        {
            Configuration.Default.ApiKey.Add("api-key", "YOUR API KEY");

            var apiInstance = new SMSCampaignsApi();
            string status = "sent";
            string startDate = "2019-01-08T14:24:45+05:30";
            string endDate = "2019-01-10T14:24:45+05:30";
            long? limit = 10;
            long? offset = 5;
            string sort = "asc";
            try
            {
                GetSmsCampaigns result = apiInstance.GetSmsCampaigns(status, startDate, endDate, limit, offset, sort);
                Debug.WriteLine(result.ToJson());
                Console.WriteLine(result.ToJson());
                Console.ReadLine();
            }
            catch (Exception e)
            {
                Debug.WriteLine(e.Message);
                Console.WriteLine(e.Message);
                Console.ReadLine();
            }
        }
    }
}
# load the gem
require 'sib-api-v3-sdk'
# setup authorization
SibApiV3Sdk.configure do |config|
  # Configure API key authorization: api-key
  config.api_key['api-key'] = 'YOUR API KEY'
end

api_instance = SibApiV3Sdk::SMSCampaignsApi.new

opts = { 
  status: 'status_example', # String | Status of campaign.
  start_date: DateTime.iso8601('2021-02-03T04:05:06+07:00'), # String | Mandatory if endDate is used. Starting (urlencoded) UTC date-time (YYYY-MM-DDTHH:mm:ss.SSSZ) to filter the sent sms campaigns. Prefer to pass your timezone in date-time format for accurate result ( only available if either 'status' not passed and if passed is set to 'sent' )
  end_date: DateTime.iso8601('2021-02-04T04:05:06+07:00'), # String | Mandatory if startDate is used. Ending (urlencoded) UTC date-time (YYYY-MM-DDTHH:mm:ss.SSSZ) to filter the sent sms campaigns. Prefer to pass your timezone in date-time format for accurate result ( only available if either 'status' not passed and if passed is set to 'sent' )
  limit: 50, # Integer | Number limitation for the result returned
  offset: 0, # Integer | Beginning point in the list to retrieve from.
  sort: 'desc' # String | Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed
}

begin
  #Returns the information for all your created SMS campaigns
  result = api_instance.get_sms_campaigns(opts)
  p result
rescue SibApiV3Sdk::ApiError => e
  puts "Exception when calling SMSCampaignsApi->get_sms_campaigns: #{e}"
end
Language
Credentials
Header
Click Try It! to start a request and see the response here!