SMSPM API - Quick Start Guide

Get started with the SMSPM SMS API in 5 minutes!


1. Get Your API Credentials

Before using the API, you need three things:

Hash - Your unique API hash identifier

  • Open the API page
  • You will see your hash displayed on the page

Token - Your API authentication token

  • Open the API page
  • Click the "Manage API Tokens" button
  • Generate a new token or use an existing one

Sender ID - The name or number that appears as the sender

  • To avoid fraud, most country carriers require Sender ID registration in advance
  • By default, smspm.com Sender ID is activated:
  • To register additional Sender IDs:
    • Go to the SMS page
    • Click the "Sender request" button
    • Submit your Sender ID for approval

Save these credentials securely - you'll need them for every API call.


2. Make Your First API Call

Option A: Quick Test (Browser/Command Line)

Copy this URL into your browser or terminal (replace YOUR_HASH and YOUR_TOKEN):

https://api.smspm.com?hash=YOUR_HASH&toNumber=37256789045&text=Hello+World&fromNumber=SMSPM.com&token=YOUR_TOKEN

Option B: Using cURL

curl "https://api.smspm.com?hash=YOUR_HASH&toNumber=37256789045&text=My+first+SMS&fromNumber=SMSPM.com&token=YOUR_TOKEN"

Option C: Using JavaScript

fetch("https://api.smspm.com", {
  method: "POST",
  headers: { "Content-Type": "application/json" },
  body: JSON.stringify({
    hash: "YOUR_HASH",
    token: "YOUR_TOKEN",
    toNumber: "37256789045",
    text: "Hello from my app!",
    fromNumber: "SMSPM.com",
  }),
})
  .then((res) => res.json())
  .then((data) => console.log("Success:", data))
  .catch((err) => console.error("Error:", err));

3. Understand the Response

Success Response:

{
  "messages": [
    {
      "id": "a7b3c4d5-e6f7-8a9b-0c1d-2e3f4a5b6c7d",
      "toNumber": "37256789045",
      "status": "Added to queue"
    }
  ]
}

Error Response:

{
  "error": "Token is required"
}

4. Send to Multiple Recipients

fetch("https://api.smspm.com", {
  method: "POST",
  headers: { "Content-Type": "application/json" },
  body: JSON.stringify({
    hash: "YOUR_HASH",
    token: "YOUR_TOKEN",
    toNumber: ["37256789045", "37257788990", "37258887766"],
    text: "Message to everyone!",
    fromNumber: "SMSPM.com",
  }),
})
  .then((res) => res.json())
  .then((data) => console.log(`Sent to ${data.messages.length} recipients`));

5. Check SMS Status (Optional)

After sending an SMS, you can check its delivery status:

// Save the SMS ID from the response
const smsId = data.messages[0].id;

// Check status
fetch("https://api.smspm.com/smsdetails", {
  method: "POST",
  headers: { "Content-Type": "application/json" },
  body: JSON.stringify({
    id: smsId,
    hash: "YOUR_HASH",
  }),
})
  .then((res) => res.json())
  .then((statusData) => {
    console.log("Status:", statusData.status);
    console.log("Price:", statusData.price, "EUR");
    console.log("Carrier:", statusData.carrier);
  });

Status values:

  • queued - Message is waiting in queue
  • submitted - Message sent to carrier
  • delivered - Successfully delivered ✅
  • failed - Delivery failed ❌

6. Essential Parameters

Parameter Required Description Example
hash ✅ Yes Your API hash 52248aec022c6d53eabe30
token ✅ Yes Your API token A1B2-C3D4-E5F6-G7H8
toNumber ✅ Yes Recipient phone (with country code, no +) 37256789045
text ✅ Yes Message content Hello World
fromNumber ✅ Yes Sender ID (must be approved) SMSPM.com

Common Issues & Solutions

❌ "Token is required"

Solution: Make sure you include the token parameter in your request

❌ "Invalid phone number"

Solution:

  • Add country code (e.g., 372 for Estonia)
  • Remove the + symbol
  • Use format: 37256789045 not +372 5678 9045

❌ "Sender number is required"

Solution: Add fromNumber parameter with an approved Sender ID

❌ "Bad sender"

Solution:

  • Add your desired Sender ID to approved list in User Account → SMS → Sender Request
  • By default, you can use SMSPM.com
  • To add more: https://app.smspm.com/app/sms → "Sender request" button

Phone Number Format

Correct formats:

  • 37256789045 (Estonia)
  • 447912345678 (UK)
  • 12125551234 (USA)

Incorrect formats:

  • +37256789045 (remove +)
  • 56789045 (missing country code)
  • +372 5678 9045 (remove + and spaces)

Next Steps

  1. Check SMS status: Use /smsdetails endpoint to track delivery
  2. Read the full documentation: API Documentation
  3. Add error handling to your code
  4. Test with Unicode messages (emoji, non-English)
  5. Implement bulk sending for efficiency (up to 100 recipients)
  6. Set up delivery callbacks - get automatic notifications when SMS is delivered

Quick Tip: Automatic Delivery Notifications

Instead of manually checking status, you can receive automatic callbacks:

fetch("https://api.smspm.com", {
  method: "POST",
  headers: { "Content-Type": "application/json" },
  body: JSON.stringify({
    hash: "YOUR_HASH",
    token: "YOUR_TOKEN",
    toNumber: "37256789045",
    text: "Hello!",
    fromNumber: "SMSPM.com",
    report: "https://yourdomain.com/sms-callback", // Your callback URL
  }),
});

Our system will automatically notify your URL when the SMS status changes!


Need Help?


Happy texting! 🚀