NAV

SMS pošiljatelj

Avtentikacija

Vsaka zahteva mora v glavi HTTP vsebovati veljaven ključ API.

Glava Vrsta Obvezno Opis
apikey string (UUID) Da Ključ API za avtentikacijo zahteve.

Če ključ API manjka ali ni veljaven UUID, API vrne 400 Bad Request.
Če ključ API ne obstaja ali ni več veljaven, API vrne 401 Unauthorized.

apikey: 12345678-1234-1234-1234-123456789abc

Registracija pošiljatelja

Endpoint

POST https://api.lertify.app/v1/senders

Pri registraciji pošiljatelja kot telefonske številke oziroma MSISDN so dovoljene samo slovenske telefonske številke.

Če pošiljatelj že obstaja in uporabnik poskuša istega pošiljatelja ponovno registrirati, se nova registracija ne izvede. Namesto tega API vrne podatke o že obstoječem pošiljatelju.

curl -X POST "https://api.lertify.app/v1/senders" \
  -H "Content-Type: application/json" \
  -H "apikey: TVOJ_API_KLJUČ" \
  -d '{
    "value": "Lertify01",
    "type": 0,
    "channel": "SMS",
    "statusCallbackUrl": "https://example.com/sender-status"
  }'
import requests
url = "https://api.lertify.app/v1/senders"
headers = {
    "Content-Type": "application/json",
    "apikey": "TVOJ_API_KLJUČ"
}
payload = {
    "value": "Lertify01",
    "type": 0,
    "channel": "SMS",
    "statusCallbackUrl": "https://example.com/sender-status"
}
response = requests.post(url, headers=headers, json=payload)
print("HTTP status:", response.status_code)
if response.content:
    print(response.json())
<?php
$url = 'https://api.lertify.app/v1/senders';
$data = [
    'value' => 'Lertify01',
    'type' => 0,
    'channel' => 'SMS',
    'statusCallbackUrl' => 'https://example.com/sender-status'
];
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
    'Content-Type: application/json',
    'apikey: TVOJ_API_KLJUČ'
]);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($data));
$response = curl_exec($ch);
if ($response === false) {
    throw new Exception(curl_error($ch));
}
$statusCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);
echo "HTTP status: " . $statusCode . PHP_EOL;
echo $response;
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
public class RegisterSender {
    public static void main(String[] args) throws Exception {
        String json = """
            {
              "value": "Lertify01",
              "type": 0,
              "channel": "SMS",
              "statusCallbackUrl": "https://example.com/sender-status"
            }
            """;
        HttpRequest request = HttpRequest.newBuilder()
                .uri(URI.create("https://api.lertify.app/v1/senders"))
                .header("Content-Type", "application/json")
                .header("apikey", "TVOJ_API_KLJUČ")
                .POST(HttpRequest.BodyPublishers.ofString(json))
                .build();
        HttpClient client = HttpClient.newHttpClient();
        HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());
        System.out.println("HTTP status: " + response.statusCode());
        System.out.println(response.body());
    }
}
const url = "https://api.lertify.app/v1/senders";
const payload = {
  value: "Lertify01",
  type: 0,
  channel: "SMS",
  statusCallbackUrl: "https://example.com/sender-status"
};
async function registerSender() {
  const response = await fetch(url, {
    method: "POST",
    headers: {
      "Content-Type": "application/json",
      "apikey": "TVOJ_API_KLJUČ"
    },
    body: JSON.stringify(payload)
  });
  console.log("HTTP status:", response.status);
  if (response.status !== 204) {
    const data = await response.json();
    console.log(data);
  }
}
registerSender().catch(console.error);
using System;
using System.Net.Http;
using System.Text;
using System.Text.Json;
using System.Threading.Tasks;
class Program
{
    static async Task Main()
    {
        using var client = new HttpClient();
        client.DefaultRequestHeaders.Add("apikey", "TVOJ_API_KLJUČ");
        var payload = new
        {
            value = "Lertify01",
            type = 0,
            channel = "SMS",
            statusCallbackUrl = "https://example.com/sender-status"
        };
        var json = JsonSerializer.Serialize(payload);
        var content = new StringContent(json, Encoding.UTF8, "application/json");
        var response = await client.PostAsync("https://api.lertify.app/v1/senders", content);
        var responseBody = await response.Content.ReadAsStringAsync();
        Console.WriteLine($"HTTP status: {(int)response.StatusCode}");
        Console.WriteLine(responseBody);
    }
}
package main
import (
	"bytes"
	"encoding/json"
	"fmt"
	"io"
	"net/http"
)
type SenderRequest struct {
	Value             string  `json:"value"`
	Type              int     `json:"type"`
	Channel           string  `json:"channel"`
	StatusCallbackURL *string `json:"statusCallbackUrl"`
}
func main() {
	callbackURL := "https://example.com/sender-status"
	payload := SenderRequest{
		Value:             "Lertify01",
		Type:              0,
		Channel:           "SMS",
		StatusCallbackURL: &callbackURL,
	}
	jsonData, err := json.Marshal(payload)
	if err != nil {
		panic(err)
	}
	req, err := http.NewRequest(
		http.MethodPost,
		"https://api.lertify.app/v1/senders",
		bytes.NewBuffer(jsonData),
	)
	if err != nil {
		panic(err)
	}
	req.Header.Set("Content-Type", "application/json")
	req.Header.Set("apikey", "TVOJ_API_KLJUČ")
	client := &http.Client{}
	resp, err := client.Do(req)
	if err != nil {
		panic(err)
	}
	defer resp.Body.Close()
	body, err := io.ReadAll(resp.Body)
	if err != nil {
		panic(err)
	}
	fmt.Println("HTTP status:", resp.StatusCode)
	fmt.Println(string(body))
}

Zahteva

Polje Vrsta Obvezno Opis
value string Da Vrednost pošiljatelja. Pri alfanumeričnem pošiljatelju je to ime pošiljatelja. Pri pošiljatelju MSISDN je to telefonska številka.
type integer Da Vrsta pošiljatelja: 0 = alfanumerični, 1 = MSISDN.
channel string Da Kanal pošiljatelja. Podprti vrednosti, ki ju predstavlja aplikacijski model, sta SMS in Viber.
statusCallbackUrl string / null Ne Izbirni URL, povezan s povratnimi klici stanja pošiljatelja. Javni krmilnik ne preverja veljavnosti URL-ja.

Uspešen odgovor

Ko je zahteva za registracijo pošiljatelja sprejeta, API vrne
202 Accepted z ustvarjenim objektom pošiljatelja.

Polje Tip Opis
eventId UUID Enolični identifikator webhook dogodka.
senderId UUID Enolični identifikator pošiljatelja, kateremu se je spremenil status.
previousStatus string Status pošiljatelja pred spremembo.
status string Nov oziroma trenutni status pošiljatelja.
occurredAt datetime Čas nastanka spremembe statusa v UTC.
{
    "id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
    "value": "Lertify01",
    "status": "Pending",
    "channel": "SMS"
}

Potrditev pošiljatelja

Endpoint

POST https://api.lertify.app/v1/senders/confirm
curl -X POST "https://api.lertify.app/v1/senders/confirm" \
  -H "Content-Type: application/json" \
  -H "apikey: TVOJ_API_KLJUČ" \
  -d '{
    "id": "SENDER_ID",
    "confirmationCode": "123456"
  }'
import requests
url = "https://api.lertify.app/v1/senders/confirm"
headers = {
    "Content-Type": "application/json",
    "apikey": "TVOJ_API_KLJUČ"
}
payload = {
    "id": "SENDER_ID",
    "confirmationCode": "123456"
}
response = requests.post(url, headers=headers, json=payload)
print("HTTP status:", response.status_code)
if response.content:
    print(response.text)
<?php
$url = 'https://api.lertify.app/v1/senders/confirm';
$data = [
    'id' => 'SENDER_ID',
    'confirmationCode' => '123456'
];
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
    'Content-Type: application/json',
    'apikey: TVOJ_API_KLJUČ'
]);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($data));
$response = curl_exec($ch);
if ($response === false) {
    throw new Exception(curl_error($ch));
}
$statusCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);
echo "HTTP status: " . $statusCode . PHP_EOL;
if (!empty($response)) {
    echo $response;
}
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
public class ConfirmSender {
    public static void main(String[] args) throws Exception {
        String json = """
            {
              "id": "SENDER_ID",
              "confirmationCode": "123456"
            }
            """;
        HttpRequest request = HttpRequest.newBuilder()
                .uri(URI.create("https://api.lertify.app/v1/senders/confirm"))
                .header("Content-Type", "application/json")
                .header("apikey", "TVOJ_API_KLJUČ")
                .POST(HttpRequest.BodyPublishers.ofString(json))
                .build();
        HttpClient client = HttpClient.newHttpClient();
        HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());
        System.out.println("HTTP status: " + response.statusCode());
        if (!response.body().isEmpty()) {
            System.out.println(response.body());
        }
    }
}
const url = "https://api.lertify.app/v1/senders/confirm";
const payload = {
  id: "SENDER_ID",
  confirmationCode: "123456"
};
async function confirmSender() {
  const response = await fetch(url, {
    method: "POST",
    headers: {
      "Content-Type": "application/json",
      "apikey": "TVOJ_API_KLJUČ"
    },
    body: JSON.stringify(payload)
  });
  console.log("HTTP status:", response.status);
  if (!response.ok) {
    console.log(await response.text());
  }
}
confirmSender().catch(console.error);
using System;
using System.Net.Http;
using System.Text;
using System.Text.Json;
using System.Threading.Tasks;
class Program
{
    static async Task Main()
    {
        using var client = new HttpClient();
        client.DefaultRequestHeaders.Add("apikey", "TVOJ_API_KLJUČ");
        var payload = new
        {
            id = "SENDER_ID",
            confirmationCode = "123456"
        };
        var json = JsonSerializer.Serialize(payload);
        var content = new StringContent(json, Encoding.UTF8, "application/json");
        var response = await client.PostAsync("https://api.lertify.app/v1/senders/confirm", content);
        Console.WriteLine($"HTTP status: {(int)response.StatusCode}");
        var responseBody = await response.Content.ReadAsStringAsync();
        if (!string.IsNullOrEmpty(responseBody))
        {
            Console.WriteLine(responseBody);
        }
    }
}
package main
import (
	"bytes"
	"encoding/json"
	"fmt"
	"io"
	"net/http"
)
type ConfirmRequest struct {
	ID               string `json:"id"`
	ConfirmationCode string `json:"confirmationCode"`
}
func main() {
	payload := ConfirmRequest{
		ID:               "SENDER_ID",
		ConfirmationCode: "123456",
	}
	jsonData, err := json.Marshal(payload)
	if err != nil {
		panic(err)
	}
	req, err := http.NewRequest(
		http.MethodPost,
		"https://api.lertify.app/v1/senders/confirm",
		bytes.NewBuffer(jsonData),
	)
	if err != nil {
		panic(err)
	}
	req.Header.Set("Content-Type", "application/json")
	req.Header.Set("apikey", "TVOJ_API_KLJUČ")
	client := &http.Client{}
	resp, err := client.Do(req)
	if err != nil {
		panic(err)
	}
	defer resp.Body.Close()
	body, err := io.ReadAll(resp.Body)
	if err != nil {
		panic(err)
	}
	fmt.Println("HTTP status:", resp.StatusCode)
	if len(body) > 0 {
		fmt.Println(string(body))
	}
}

Potrditev - Parametri zahteve

Polje Vrsta Obvezno Opis
id UUID Da Identifikator pošiljatelja, ki ga vrne endpoint za registracijo.
confirmationCode string Da Potrditvena koda za preverjanje pošiljatelja.

Potrditev - Primer zahteve

{
    "id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
    "confirmationCode": "123456"
}

Uspešen odgovor

Ko je pošiljatelj uspešno potrjen, API vrne
200 OK s praznim telesom odgovora.

Izbris pošiljatelja

Endpoint

DELETE https://api.lertify.app/v1/senders/{senderId}
curl -X DELETE \
  "https://api.lertify.app/v1/senders/SENDER_ID" \
  -H "apikey: TVOJ_API_KLJUČ"
import requests
sender_id = "SENDER_ID"
url = f"https://api.lertify.app/v1/senders/{sender_id}"
headers = {
    "apikey": "TVOJ_API_KLJUČ"
}
response = requests.delete(url, headers=headers)
print("HTTP status:", response.status_code)
if response.content:
    print(response.text)
<?php
$senderId = 'SENDER_ID';
$url = 'https://api.lertify.app/v1/senders/' . $senderId;
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'DELETE');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
    'apikey: TVOJ_API_KLJUČ'
]);
$response = curl_exec($ch);
if ($response === false) {
    throw new Exception(curl_error($ch));
}
$statusCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);
echo "HTTP status: " . $statusCode . PHP_EOL;
if (!empty($response)) {
    echo $response;
}
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
public class DeleteSender {
    public static void main(String[] args) throws Exception {
        String senderId = "SENDER_ID";
        String url = "https://api.lertify.app/v1/senders/" + senderId;
        HttpRequest request = HttpRequest.newBuilder()
                .uri(URI.create(url))
                .header("apikey", "TVOJ_API_KLJUČ")
                .DELETE()
                .build();
        HttpClient client = HttpClient.newHttpClient();
        HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());
        System.out.println("HTTP status: " + response.statusCode());
        if (!response.body().isEmpty()) {
            System.out.println(response.body());
        }
    }
}
const senderId = "SENDER_ID";
const url = `https://api.lertify.app/v1/senders/${senderId}`;
async function deleteSender() {
  const response = await fetch(url, {
    method: "DELETE",
    headers: {
      "apikey": "TVOJ_API_KLJUČ"
    }
  });
  console.log("HTTP status:", response.status);
  if (!response.ok) {
    console.log(await response.text());
  }
}
deleteSender().catch(console.error);
using System;
using System.Net.Http;
using System.Threading.Tasks;
class Program
{
    static async Task Main()
    {
        using var client = new HttpClient();
        client.DefaultRequestHeaders.Add("apikey", "TVOJ_API_KLJUČ");
        var senderId = "SENDER_ID";
        var url = $"https://api.lertify.app/v1/senders/{senderId}";
        var response = await client.DeleteAsync(url);
        Console.WriteLine($"HTTP status: {(int)response.StatusCode}");
        var responseBody = await response.Content.ReadAsStringAsync();
        if (!string.IsNullOrEmpty(responseBody))
        {
            Console.WriteLine(responseBody);
        }
    }
}
package main
import (
	"fmt"
	"io"
	"net/http"
)
func main() {
	senderID := "SENDER_ID"
	url := "https://api.lertify.app/v1/senders/" + senderID
	req, err := http.NewRequest(http.MethodDelete, url, nil)
	if err != nil {
		panic(err)
	}
	req.Header.Set("apikey", "TVOJ_API_KLJUČ")
	client := &http.Client{}
	resp, err := client.Do(req)
	if err != nil {
		panic(err)
	}
	defer resp.Body.Close()
	body, err := io.ReadAll(resp.Body)
	if err != nil {
		panic(err)
	}
	fmt.Println("HTTP status:", resp.StatusCode)
	if len(body) > 0 {
		fmt.Println(string(body))
	}
}

Parameter poti

Parameter Vrsta Obvezno Opis
senderId UUID Da Enolični identifikator pošiljatelja, ki ga želite izbrisati.

Uspešen odgovor

Ko je pošiljatelj uspešno izbrisan, API vrne 204 No Content.

Odgovori z napakami

Stanje HTTP Opis
400 Bad Request Neveljaven ali manjkajoč UUID ključa API, neveljavni podatki
zahteve, neveljavna vrsta pošiljatelja, neuspešna potrditev,
neuspešen izbris ali druga napaka storitve pošiljateljev.
401 Unauthorized Ključ API ni veljaven.
500 Internal Server Error Prišlo je do nepričakovane neobravnavane napake strežnika.

Pri obravnavanih napakah registracije, potrditve in izbrisa ima telo
odgovora naslednjo strukturo:

{
    "error": "Sporočilo o napaki, ki ga vrne storitev"
}

Sprememba statusa (Webhook)

Če je v requestu podan webhook URL, bo sistem na ta URL poslal obvestilo ob spremembi statusa pošiljatelja.

Webhook se pošlje kot HTTP request na URL, definiran v prvotnem requestu, in vsebuje podatke o pošiljatelju ter spremembi njegovega statusa.

Telo webhook requesta

 {
  "eventId": "752602f6-0dc1-4b58-8e91-20d01dc4f77f",
  "senderId": "6a59d592-b450-442a-8ad6-40d3f9ba51e5",
  "previousStatus": "Confirmation Pending",
  "status": "Confirmed",
  "occurredAt": "2026-09-15T07:34:45.8117387Z"
} 

Opis polj

Polje Tip Opis
eventId UUID Enolični identifikator webhook dogodka.
senderId UUID Enolični identifikator pošiljatelja, kateremu se je spremenil status.
previousStatus string Status pošiljatelja pred spremembo.
status string Nov oziroma trenutni status pošiljatelja.
occurredAt datetime Čas nastanka spremembe statusa v UTC.

Primer

Če ima pošiljatelj status Confirmation Pending in je nato potrjen, bo na konfiguriran webhook URL poslan dogodek, kjer bo:

  • previousStatus nastavljen na Confirmation Pending
  • status nastavljen na Confirmed

Na ta način lahko zunanji sistem zazna spremembo statusa pošiljatelja brez periodičnega preverjanja statusa prek API-ja.

Webhook se pošlje samo v primeru, ko je bil webhook URL podan v requestu.