Short Messages

On this page we will take a look at how to send SMS using the OneSend API and what the required and optional parameters are.

The Short Message model

The short message model contains all the information related to the sent SMS.

Properties

  • Name
    id
    Type
    string
    Description

    Unique identifier for the short message.

  • Name
    createdAt
    Type
    string
    Description

    ISO 8601 formatted date of when the short message was created.

  • Name
    from
    Type
    string
    Description

    The sender displayed in the SMS.

  • Name
    to
    Type
    string
    Description

    The number of the receiver.

  • Name
    message
    Type
    string
    Description

    The message you have sent.

  • Name
    isGsmEncoded
    Type
    boolean
    Description

    Indicates if the sent message was GSM encoded.

  • Name
    isMultiPartSms
    Type
    boolean
    Description

    Indicates if the sent message was split into multiple parts.

  • Name
    numberOfParts
    Type
    integer
    Description

    The number of parts this short message was split into.

  • Name
    senderIsPhoneNumber
    Type
    boolean
    Description

    Indicates if the sender was a phone number.

  • Name
    sendAt
    Type
    string|null
    Description

    ISO 8601 formatted date of when the short message should be send at.

  • Name
    expireAt
    Type
    string|null
    Description

    ISO 8601 formatted date of when the should stop to try sending.

  • Name
    status
    Type
    status
    Description

    Status of the short message, can be pending, delivery_success or delivery_failed


POST/api/short_messages

Create a short message

This endpoint allows you to send a new SMS using the OneSend API.

Required attributes

  • Name
    to
    Type
    string
    Description

    The number of the receiver. This has to be a valid E164 phone number.

  • Name
    from
    Type
    string
    Description

    The sender displayed in the SMS. This can be either alphanumeric (up to 11 characters) or a valid E164 phone number.

  • Name
    message
    Type
    string
    Description

    The message you want to send. One SMS can contain 160 characters if it's GSM encoded, or 70 characters if it's UCS2 encoded. The number of characters decreases further when the SMS is a multipart SMS, to 153 and 67 characters per part respectively. If you are unsure how many parts your message will produce you can use our Calculator.

Optional attributes

  • Name
    maximumNumberOfMessageParts
    Type
    integer
    Description

    The maximum number of parts the message can have. Each part counts as separate SMS and will be billed as such.

  • Name
    sendAt
    Type
    string
    Description

    ISO 8601 formatted date of when the SMS should be sent. If it's not set the SMS will send immediately.

  • Name
    expireAt
    Type
    integer
    Description

    ISO 8601 formatted date of when the SMS should be expire and the system will not try to deliver it anymore.

Request

POST
/api/short_messages
curl https://api.onesend.de/api/short_messages \
  -H "Authorization: ProjectKey {token}" \
  -d '{"to": "+491573123123123", "from": "OneSend", "message": "My first SMS"}'

Response

{
  "id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
  "createdAt": "2024-02-20T15:42:00.626Z",
  "from": "OneSend",
  "to": "+491573123123123",
  "message": "My first SMS",
  "isGsmEncoded": true,
  "isMultiPartSms": false,
  "numberOfParts": 1,
  "senderIsPhoneNumber": false,
  "status": "pending"
}

Was this page helpful?