فراز اس ام اس مستندات وب‌سرویس

Home › Send SMS

Send Pattern-Based SMS — FarazSMS SMS web service

POST https://api.iranpayamak.com/ws/v1/sms/pattern

Purpose: Send a templated message (OTP, verification codes, transaction alerts). Fastest path and never queued — use this for one-time codes.

Send a pattern-based message, the pattern UID must be creadted and get from user panel.

Authentication

This endpoint requires the Api-Key header — get the key from the FarazSMS panel. The header name is case-sensitive and the key must never travel in a query string.

Request fields

  • code (string) — required
  • attributes (array) — optional
  • schedule (string) — optional — Optional. Omit it or send null to send immediately. A future "YYYY-MM-DD HH:MM:SS" schedules the send — the message is accepted and its cost is reserved at submit time, and it is delivered at that moment, not now. A past date is rejected with a validation error.
  • line_number (string) — required
  • number_format (string) — required — english | persian
  • recipient (string) — required — Like: 09120000000

Notes for this endpoint

  • Prerequisite: the pattern must already be created and approved in the panel.
  • Every variable the pattern declares must appear in attributes; a missing one returns “فیلد X باید ارسال شود”. An empty value is fine, a missing key is not.
  • Value types are free unless the variable is declared int in the panel, in which case the value must be numeric. An unquoted number (41597) is fine.
  • ⚠️ If a value is longer than the length declared for that variable in the panel, the message is diverted to human approval instead of being sent instantly — the response is still success, but nothing goes out until an operator approves it. Size your pattern variables for your longest real value.
  • code is the pattern UID from the panel.
  • Keys in attributes must exactly match the pattern's variable names.
  • line_number is the sender line (default 90008361), recipient without +98.
  • Use this for OTP — it's fast and never queued.
  • number_format is english or persian (never en/fa).
  • Omit schedule for an immediate send; a future date schedules it and charges now.
  • in-queue means accepted, not delivered — check send_request/{id}/items with the returned data.id.

Example body

{
  "code": "SJ3FgPrE0C",
  "attributes": {
    "var1": "1",
    "var2": "2"
  },
  "recipient": "09120000000",
  "line_number": "50002178584000",
  "number_format": "english"
}

Responses

  • 201 — Pattern message sent successfully.

Related endpoints in Send SMS

All FarazSMS web services · llms.txt · OpenAPI