API Documentation

API Documentation

Learn how to connect and integrate with our API.

Base URL

Authentication

All the API endpoints require an API key sent by the Bearer Authentication method.

Example
$ curl --request GET \
  --url 'https://notificatorsms.com/api/{endpoint}' \
  --header 'Authorization: Bearer {api_key}'

Errors

Our API uses conventional HTTP status codes to indicate the success or failure of a request.

Example
{
  "errors": [
    {
      "title": "You do not have access to the API.",
      "status": 401
    }
  ]
}
Status codes
200 Request completed successfully
400 Bad request - Required parameters are missing or invalid
401 Unauthorized - API key is missing or invalid
404 The requested resource was not found
429 Too many requests - Rate limit exceeded
500 Internal server error - this means there is a problem on our end
All API endpoint results work with the UTC timezone unless specified otherwise.

Exemples de code

Intégrez l'API rapidement avec votre langage préféré

SMS API
Envoyer un SMS
# Envoyer un SMS via l'API
curl --request POST \
  --url 'https://notificatorsms.com/api/sms' \
  --header 'Authorization: Bearer {VOTRE_API_KEY}' \
  --header 'Content-Type: multipart/form-data' \
  --form 'device_id=1' \
  --form 'sim_subscription_id=1' \
  --form 'phone_numbers=+33612345678' \
  --form 'content=Bonjour ! Ceci est un test.'
<?php
// Envoyer un SMS via l'API Notificatorsms

$api_key = 'VOTRE_API_KEY';
$base_url = 'https://notificatorsms.com/api/sms';

$data = [
    'device_id'           => 1,
    'sim_subscription_id' => 1,
    'phone_numbers'       => '+33612345678',
    'content'             => 'Bonjour ! Ceci est un test.',
];

$ch = curl_init($base_url);
curl_setopt_array($ch, [
    CURLOPT_POST           => true,
    CURLOPT_POSTFIELDS     => $data,
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_HTTPHEADER     => [
        'Authorization: Bearer ' . $api_key,
    ],
]);

$response = curl_exec($ch);
$httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);

$result = json_decode($response, true);
print_r($result);
// Envoyer un SMS via l'API (fetch)

const API_KEY = 'VOTRE_API_KEY';
const BASE_URL = 'https://notificatorsms.com/api/sms';

const formData = new FormData();
formData.append('device_id', '1');
formData.append('sim_subscription_id', '1');
formData.append('phone_numbers', '+33612345678');
formData.append('content', 'Bonjour ! Ceci est un test.');

const response = await fetch(BASE_URL, {
    method: 'POST',
    headers: {
        'Authorization': `Bearer ${API_KEY}`,
    },
    body: formData,
});

const data = await response.json();
console.log(data);
# Envoyer un SMS via l'API (requests)
import requests

API_KEY = 'VOTRE_API_KEY'
BASE_URL = 'https://notificatorsms.com/api/sms'

payload = {
    'device_id': 1,
    'sim_subscription_id': 1,
    'phone_numbers': '+33612345678',
    'content': 'Bonjour ! Ceci est un test.',
}

headers = {
    'Authorization': f'Bearer {API_KEY}',
}

response = requests.post(BASE_URL, data=payload, headers=headers)
print(response.json())
// Composable Vue 3 — useSmsApi.js
import { ref } from 'vue'

export function useSmsApi() {
  const API_KEY  = 'VOTRE_API_KEY'
  const BASE_URL = 'https://notificatorsms.com/api/sms'
  const loading  = ref(false)
  const error    = ref(null)

  async function sendSms(deviceId, simId, phones, content) {
    loading.value = true
    error.value = null

    const form = new FormData()
    form.append('device_id', deviceId)
    form.append('sim_subscription_id', simId)
    form.append('phone_numbers', phones)
    form.append('content', content)

    try {
      const res = await fetch(BASE_URL, {
        method: 'POST',
        headers: { 'Authorization': `Bearer ${API_KEY}` },
        body: form,
      })
      return await res.json()
    } catch (e) {
      error.value = e.message
    } finally {
      loading.value = false
    }
  }

  return { sendSms, loading, error }
}
Lister les contacts
# Lister tous les contacts
curl --request GET \
  --url 'https://notificatorsms.com/api/contacts/?page=1&results_per_page=25' \
  --header 'Authorization: Bearer {VOTRE_API_KEY}'
<?php
// Lister les contacts
$ch = curl_init('https://notificatorsms.com/api/contacts/?page=1');
curl_setopt_array($ch, [
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_HTTPHEADER     => [
        'Authorization: Bearer VOTRE_API_KEY',
    ],
]);
$contacts = json_decode(curl_exec($ch), true);
curl_close($ch);

foreach ($contacts['data'] as $contact) {
    echo $contact['name'] . ' — ' . $contact['phone_number'] . "\n";
}
// Lister les contacts (fetch)
const res = await fetch('https://notificatorsms.com/api/contacts/?page=1', {
    headers: {
        'Authorization': 'Bearer VOTRE_API_KEY',
    },
});
const { data, meta } = await res.json();
console.log(`Total: ${meta.total} contacts`);
data.forEach(c => console.log(c.name, c.phone_number));
# Lister les contacts
import requests

headers = {'Authorization': 'Bearer VOTRE_API_KEY'}
r = requests.get('https://notificatorsms.com/api/contacts/?page=1', headers=headers)
contacts = r.json()

for c in contacts['data']:
    print(f"{c['name']} — {c['phone_number']}")
Available endpoints