Get through with SMS in your business!

Reach out with your message
where ever your customer is!

Integrera SMS med vårt moderna RESTful API

Developer site


RESTful SMS

Description

Here you will find everything you need to connect our RESTful SMS API to your system or application. With the help of an SMS API, you can easily customize your own SMS functions. For more detailed information, press the Technical documentation button.

Code example

Below you will find code examples for sending SMS in different programming languages. To be able to call our API you need a free development account, which you can create by clicking on the button below.



      
    using (var client = new HttpClient())
    {
        client.BaseAddress = new Uri("https://api.ip1sms.com/api/");
        client.DefaultRequestHeaders.Accept.Clear();
        client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
        client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Basic", Convert.ToBase64String(Encoding.ASCII.GetBytes(string.Format("{0}:{1}", "ip1-xxxxx", "API-Key"))));

        var sms = new OutgoingSMS()
        {
            From = "iP1",
            Numbers = new List<string>() { "46123456789" },
            Contacts = new List<int>(),
            Groups = new List<int>(),
            Message = "test",
            Prio = 1,
            Email = false
        };

        HttpResponseMessage response = await client.PostAsJsonAsync("sms/send", sms);

        if (response.IsSuccessStatusCode)
        {
            Console.WriteLine("Sent");
        }
        else
        {
            Console.WriteLine("Failed, " + response.StatusCode + ": " + await response.Content.ReadAsStringAsync());
        }
    }
    
      
    $conf = array(
        'account' => 'ip1-xxxxx',
        'password' => 'apiKey',
        'apiUrl' => 'api.ip1sms.com',
        'method' => 'POST',
        'endpoint' => '/api/sms/send',
    );

    $message = array(
        'Numbers' => ['4673055555'],
        'From' => 'iP.1',
        'Message' => "Test message via iP.1's REST API",
    );

    $jsonEncodedMessage = json_encode($message);
    // Set up request options
    $options = array(
        'http' => array(
            'header'  => array(
                'Content-Type: application/json',
                'Authorization: Basic '. base64_encode($conf['account'].":".$conf['password']),
                'Content-Length: ' . strlen($jsonEncodedMessage)
            ),
            'method'  => $conf['method'],
            'content' => $jsonEncodedMessage,
        )
    );

    $url = "https://" . $conf['apiUrl'] . $conf['endpoint'];
    $context  = stream_context_create($options);
    // Send the request
    $response = file_get_contents($url, false, $context);
    // Print the response
    echo $response;
    
      
    Dim account As String = "ip1-xxxxxx"
    Dim password As String = "API-Key"

    Dim client As New HttpClient()

    client.BaseAddress = New Uri("https://api.ip1sms.com/api/")
    client.DefaultRequestHeaders.Accept.Clear()
    client.DefaultRequestHeaders.Accept.Add(New MediaTypeWithQualityHeaderValue("application/json"))

    Dim authString As String = Convert.ToBase64String(Encoding.ASCII.GetBytes($"{account}:{password}"))
    client.DefaultRequestHeaders.Authorization = New AuthenticationHeaderValue("Basic", authString)

    Dim sms As New With
        {
            Key .From = "iP1sms",
            Key .Numbers = New List(Of String)() From {"46123456789"},
            Key .Contacts = New List(Of Integer)(),
            Key .Groups = New List(Of Integer)(),
            Key .Message = "Test", Key .Email = False
        }

    Dim response As HttpResponseMessage = Await client.PostAsJsonAsync("sms/send", sms)


    End Sub`;
    

RESTful Surveys

Description

Here you will find everything you need to connect our RESTful Survey API to your system or application. With the help of a Survey API, you can easily customize your own automated customer surveys. For more detailed information, press the Technical Documentation button.

Code example

422/5000 Below you will find a simple code example for sending an existing questionnaire in different programming languages. What you need to be able to call our API is a free development account, which you can create by clicking on the button below. You can easily create a survey well signed in to the Analys-SMS app or through API call.



      
    using (var client = new HttpClient())
    {
        client.BaseAddress = new Uri("https://api.ip1sms.com/api/");
        client.DefaultRequestHeaders.Accept.Clear();
        client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
        client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Basic", Convert.ToBase64String(Encoding.ASCII.GetBytes(string.Format("{0}:{1}", "ip1-xxxxx", "API-Key"))));

        var survey = new OutgoingSurvey()
        {
            From = "iP1",
            Numbers = new List<string>() { "46123456789" },
            Contacts = new List<int>(),
            Groups = new List<int>(),
            Message = "test survey",
            Prio = 1,
            Email = false
        };

        HttpResponseMessage response = await client.PostAsJsonAsync("surveys/{survey}/send", survey);

        if (response.IsSuccessStatusCode)
        {
            Console.WriteLine("Survey Sent");
        }
        else
        {
            Console.WriteLine("Failed, " + response.StatusCode + ": " + await response.Content.ReadAsStringAsync());
        }
    }
    
      
    $conf = array(
        'account' => 'ip1-xxxxx',
        'password' => 'apiKey',
        'apiUrl' => 'api.ip1sms.com',
        'method' => 'POST',
        'endpoint' => '/surveys/{survey}/send',
    );

    $message = array(
        'Numbers' => ['4673055555'],
        'From' => 'iP.1',
        'Message' => "Test message via iP.1's REST API",
    );

    $jsonEncodedMessage = json_encode($message);
    // Set up request options
    $options = array(
        'http' => array(
            'header'  => array(
                'Content-Type: application/json',
                'Authorization: Basic '. base64_encode($conf['account'].":".$conf['password']),
                'Content-Length: ' . strlen($jsonEncodedMessage)
            ),
            'method'  => $conf['method'],
            'content' => $jsonEncodedMessage,
        )
    );

    $url = "https://" . $conf['apiUrl'] . $conf['endpoint'];
    $context  = stream_context_create($options);
    // Send the request
    $response = file_get_contents($url, false, $context);
    // Print the response
    echo $response;
    
      
    Dim account As String = "ip1-xxxxxx"
    Dim password As String = "API-Key"

    Dim client As New HttpClient()

    client.BaseAddress = New Uri("https://api.ip1sms.com/api/")
    client.DefaultRequestHeaders.Accept.Clear()
    client.DefaultRequestHeaders.Accept.Add(New MediaTypeWithQualityHeaderValue("application/json"))

    Dim authString As String = Convert.ToBase64String(Encoding.ASCII.GetBytes($"{account}:{password}"))
    client.DefaultRequestHeaders.Authorization = New AuthenticationHeaderValue("Basic", authString)

    Dim survey As New With
        {
            Key .From = "iP1sms",
            Key .Numbers = New List(Of String)() From {"46123456789"},
            Key .Contacts = New List(Of Integer)(),
            Key .Groups = New List(Of Integer)(),
            Key .Message = "Test", Key .Email = False
        }

    Dim response As HttpResponseMessage = Await client.PostAsJsonAsync("surveys/{survey}/send", survey)


    End Sub`;
    

RESTful 2FA

Description

By connecting to 2FA for example for registering new accounts, you can easily ensure that the person has entered the correct information by confirming the user's telephone number. The code is sent as a text message to the specified number in no time.

When you integrate two-factor authentication via SMS from iP.1, you automatically gain access to our global spam filter list that includes thousands of virtual numbers used in malicious bot registrations.

Code example

Below you will find code examples for creating / sending authentication and validating in different programming languages. What you need to be able to call our API is a free development account, which you can create by clicking on the button below.



SMS Gateway (Soap) Deprecated


Code example

NOTE! The API is deprecated and will no longer be further developed. We recommend that you use one of our REST APIs
Below you will find code examples for sending an SMS with our HTTP SMS Gateway in PHP. What you need to be able to call our SMS Gateway is a free development account, which you can create by clicking on the button below.


    
    $conf['apiurl'] = 'https://web.smscom.se/sendsms/sendsms.asmx?wsdl';
    $conf['mmsapiurl'] = 'https://web.smscom.se/mms/mms.asmx?wsdl';
    $conf['account'] = 'ip1-xxxxx';  
    $conf['password'] = 'API-Key'; 
    
    $conf['to'] = '46712345678'; 
    $conf['from'] = 'iP1';
    $conf['prio'] = '1';
    $conf['msg'] = 'Test message via iP.1 API (Web Service)';
    $conf['msg_at'] = "Test send at message via iP.1 API (Web Service)";
    $conf['msg_bundle'] = "Test bundle message via iP.1 API (Web Service)";

    $client = new SoapClient($conf['apiurl']);
    $mmsClient = new SoapClient($conf['mmsapiurl']);

    $result = $client->balans(array('konto'=>$conf['account'], 'passwd' => $conf['password']));
    echo 'Balnace: ' . $result->balansResult;

    $smsresult = $client->sms(array('konto'=>$conf['account'], 'passwd' => $conf['password'], 'till' => $conf['to'], 'from' => $conf['from'], 'meddelande' =>$conf['msg'], 'prio' => $conf['prio']));

    echo 'Result of SMS: ' . $smsresult->smsResult;
    

SMS Gateway (http) Deprecated


Code example

NOTE! The API is deprecated and will no longer be further developed. We recommend that you use one of our REST APIs
Below you will find code examples for sending an SMS with our HTTP SMS Gateway in PHP. What you need to be able to call our SMS Gateway is a free development account, which you can create by clicking on the button below.


    
    $conf['account'] = 'ip1-xxxx';  
    $conf['password'] = 'api-key'; 
    $conf['apiurl'] = 'https://web.smscom.se/sendsms.aspx';
    
    $conf['to'] = '4673055555';     
    $conf['from'] = 'iP.1';        
    $conf['msg'] = 'Test message via iP.1 HTTP Request';       
    $conf['prio'] = '1';

    $data = http_build_query(array('acc'=>$conf['account'],'pass'=>$conf['password'],'msg'=>  $conf['msg'],'from'=>$conf['from'],'to'=> $conf['to'],'prio'=>$conf['prio'], 'type' => ''));
            
    
    $opts = array('http' =>
        array(
            'method'  => 'GET',
            'header'  => 'Content-type: application/x-www-form-urlencoded',
            'content' => $data
        )
    );
    
    $context  = stream_context_create($opts);            
    $result = file_get_contents($conf['apiurl'] . '?' . $data, false, $context);
    
    echo 'Result/SMS ID: ' . $result;
    

Status codes SMS

Below you will find a list of all SMS status codes and description for each code. If you use several of our APIs with the same API key, you need to add support for the status codes in all of the APIs used.


Status codes

Status code Error message Description Retry with same data? Applicable API
0 Delivered to gateway The message has reached the gateway and should be considered as ‘in transit’ No (destination not final) REST, SOAP, Gateway
1 Gateway login failed   Yes, later SOAP, Gateway
3 Invalid phone number format   No SOAP, Gateway
11 Delayed delivery Will be sent in the future No (destination not final) SOAP, Gateway
12 Delayed delivery cancelled Delivery cancelled by user No SOAP, Gateway
21 Delivered to the GSM network The SMS message should be considered as ‘in transit’, may stay in this state until recipeint is connected to the GSM network or until 48 hours has passed No (destination not final) REST, SOAP, Gateway
22 Delivered to the phone The message has successfully been delivered No REST, SOAP, Gateway
41 Invalid message content   No None (Deprecated)
42 Internal error Internal error. Please contact support for more information Yes REST, SOAP, Gateway
44 Delivery failed Recipient was not on the GSM network for the 48 hour lifespan of the SMS message Yes None (Deprecated)
50 General delivery error   No SOAP, Gateway
51 Delivery to GSM network failed A radio tower failed to deliverRecipient was not on the GSM network for the 48 hour lifespan of the SMS message Yes REST, SOAP, Gateway
52 Delivery to phone failed Recipient was not on the GSM network for the 48 hour lifespan of the SMS message Yes REST, SOAP, Gateway
55 Unknown   No None (Deprecated)
60 Unknown   No None (Deprecated)
100 Insufficient credits   Refill credits first SOAP, Gateway
101 Wrong account credentials   No SOAP, Gateway
110 Parameter error   No SOAP, Gateway

Lime integrats SMS from iP.1

Besched integrats SMS from iP.1

WinEazy integrats SMS from iP.1

Flex HRM integrats SMS from iP.1

HRM Software integrats SMS from iP.1

IOL Tool integrats SMS from iP.1

Gardeco integrats SMS from iP.1

aSTRa Web integrats SMS from iP.1

Skibar systems integrats SMS from iP.1