LogoLogo
ProductsDevelopersAPI ReferenceContact Us
API Reference
API Reference
  • Overview
  • Products
    • Super SIM
      • Sim Resource
        • Sim BillingPeriod subresource
      • ESimProfile Resource
      • Fleet Resource
      • NetworkAccessProfile Resource
        • NetworkAccessProfile Network Subresource
      • Network Resource
      • SettingsUpdates Resource
      • Usage Record Resource
      • SMSCommand Resource
      • IPCommand Resource
    • Programmable Wireless
      • Account UsageRecord Resource
      • Command Resource
      • DataSession Resource
      • RatePlan Resource
      • Wireless Sim Resource
      • Sim UsageRecord Resource
  • Global Resources
    • API Clients
      • Ping
      • Clients
    • Identity and Access Management
      • Account
    • Webhook
On this page

Was this helpful?

  1. Products
  2. Programmable Wireless

Command Resource

PreviousAccount UsageRecord ResourceNextDataSession Resource

Last updated 5 months ago

Was this helpful?


The Command resource enables you to exchange machine-to-machine messages with SMS-capable devices. For example, you could use a Command resource to instruct a device to take a sensor reading.

While SMS is used as the transport, the SIM does not require an addressable phone number to receive a Command. This is the major distinction from KORE's Messages resource, which can be used for conversational messaging.

Any SMS message sent from a SIM to a pre-determined phone number — see — is interpreted as a Command and sent to the Command callback URL of the .

Commands can be sent and received using the SMS text mode or binary (PDU) mode. Text-mode Commands have a maximum length of 160 single-byte characters. Binary-mode Commands have a maximum length of 140 bytes.

To receive and process a Command sent to your device, you will interface with the modem directly, probably using AT commands. You should consult with the module manufacturer's documentation for information about receiving SMS messages.


Asynchronous resources

The Command resource performs . To receive an asynchronous notification when a Command resource has finished updating, provide a callback URL, and optionally a callback method, GET or POST, when you create the Command.


Retention period

Commands are retained for 30 days from the time they are created. Commands older than 30 days will no longer be readable from this resource.


Command Properties

sid SID<DC>

The unique string that we created to identify the Command resource.

Pattern:^DC[0-9a-fA-F]{32}$

Min length:34

Max length:34


account_sid SID<AC>

The SID of the Account that created the Command resource.

Pattern:^AC[0-9a-fA-F]{32}$

Min length:34

Max length:34


sim_sid SID<DE>

The SID of the Sim resource that the Command was sent to or from.

Pattern:^DE[0-9a-fA-F]{32}$

Min length:34

Max length:34


command string PII MTL: 30 days

The message being sent to or from the SIM. For text mode messages, this can be up to 160 characters. For binary mode messages, this is a series of up to 140 bytes of data encoded using base64.


command_mode enum<string>

The mode used to send the SMS message. Can be: text or binary. The default SMS mode is text.

Possible values:

text

binary


transport enum<string>

The type of transport used. Can be: sms or ip.

Possible values:

sms

ip


delivery_receipt_requested boolean

Whether to request a delivery receipt.


status enum<string>

Possible values:

queued

sent

delivered

received

failed


direction enum<string>

The direction of the Command. Can be to_sim or from_sim. The value of to_sim is synonymous with the term mobile terminated, and from_sim is synonymous with the term mobile originated.

Possible values:

from_sim

to_sim


date_created string<date-time>


date_updated string<date-time>


url string<uri>

The absolute URL of the resource.

Status values

Status
Description

queued

The Command is queued in our network waiting to be sent to the SIM.

sent

The Command has been sent to the SIM.

delivered

The Command has been delivered to the SIM. For to_sim Commands only.

received

The Command has been received from the SIM. For from_sim Commands only.

failed

The Command has failed to be transmitted.


Create a Command resource

Creating a Command resource sends the command to the SIM.

Callback values

When you provide a callback URL, we call it when the attempt to send the Command completes.

If the CallbackMethod parameter was set to POST, or not provided, the callback parameters are delivered as HTML form parameters. If the CallbackMethod parameter was set to GET, the callback parameters are delivered as a query string.

Send a Command to a Sim


Fetch a Command resource


Read multiple Command resources

The maximum PageSize you can request when reading Commands is 100.


Delete a Command resource


Receive a Command from a SIM

When a SIM sends an SMS message to the reserved phone number 2936, a Command resource will be created, and your Commands Callback URL will be invoked. The callback request will include the following parameters.

Parameter
Description

CommandSid

The SID of this Command.

SimSid

The SIM this Command was sent by.

SimUniqueName

The sending SIM's friendly name, if it has one.

Command

The body of the Command message. In text mode, this value can be up to 160 characters of text. In binary mode, this value is a Base64 encoded byte string with a maximum size of 140 bytes.

Status

Will always be the string received.

ApiVersion

The version of the API that your initial request was made to.

AccountSid

The SID of the Account that this Command belongs to.

CommandMode

A string representing which mode the SMS was received as. May be text or binary.

The status of the Command. Can be: queued, sent, delivered, received, or failed. See for a description of each state.

The date and time in GMT when the resource was created specified in format.

The date and time in GMT when the resource was last updated specified in format.

Outgoing Command delivery is , so we recommend that you pass a callback URL when you create the new Command.

To receive a Command from a SIM — called a "mobile-originated" Command — you should create or update an existing instance and provide a CommandsCallbackUrl property. Optionally, you may also include a CommandsCallbackMethod property.

ISO 8601
ISO 8601
Sim
Sim resource
asynchronous operations
Receive a Command from a SIM
Status Values
asynchronous

Send a Command to a Sim.

post
Authorizations
Body
CommandstringRequired

The message body of the Command. Can be plain text in text mode or a Base64 encoded byte string in binary mode.

SimstringOptional

The sid or unique_name of the SIM to send the Command to.

CallbackMethodstring · enumOptional

The HTTP method we use to call callback_url. Can be: POST or GET, and the default is POST.

Possible values:
CallbackUrlstring · uriOptional

The URL we call using the callback_url when the Command has finished sending, whether the command was delivered or it failed.

CommandModestring · enumOptional

The mode to use when sending the SMS message. Can be: text or binary. The default SMS mode is text.

Possible values:
IncludeSidstringOptional

Whether to include the SID of the command in the message body. Can be: none, start, or end, and the default behavior is none. When sending a Command to a SIM in text mode, we can automatically include the SID of the Command in the message body, which could be used to ensure that the device does not process the same Command more than once. A value of start will prepend the message with the Command SID, and end will append it to the end, separating the Command SID from the message body with a space. The length of the Command SID is included in the 160 character limit so the SMS body must be 128 characters or less before the Command SID is included.

DeliveryReceiptRequestedbooleanOptional

Whether to request delivery receipt from the recipient. For Commands that request delivery receipt, the Command state transitions to 'delivered' once the server has received a delivery receipt from the device. The default value is true.

Responses
201
Data Usage List
application/json
202
Data Usage List
application/json
400
Invalid request
application/json
401
Credentials were not provided and are required to access this resource
application/json
403
Credentials were not provided and are required to access this resource
application/json
404
Resource not found
application/json
415
Credentials were not provided and are required to access this resource
application/json
422
Resource not found
application/json
500
Internal Server Error
application/json
503
Server is temporary not available
application/json
post
curl --location --globoff 'https://programmable-wireless.api.korewireless.com/v1/Commands' \
--header 'Authorization: Bearer <YOUR_AUTH_TOKEN>'
--header 'Content-Type: application/x-www-form-urlencoded' \
--header 'Accept: application/json' \
--data-urlencode 'Command=<string>' \
--data-urlencode 'Sim=<string>' \
--data-urlencode 'CallbackMethod=<http-method>' \
--data-urlencode 'CallbackUrl=<uri>' \
--data-urlencode 'CommandMode=text' \
--data-urlencode 'IncludeSid=<string>' \
--data-urlencode 'DeliveryReceiptRequested=<boolean>'
{
  "sid": "text",
  "account_sid": "text",
  "sim_sid": "text",
  "command": "text",
  "command_mode": "text",
  "transport": "sms",
  "delivery_receipt_requested": true,
  "status": "queued",
  "direction": "from_sim",
  "date_created": "2025-05-20T09:13:07.814Z",
  "date_updated": "2025-05-20T09:13:07.814Z",
  "url": "https://example.com"
}

Fetch a Command instance from your account.

get
Authorizations
Path parameters
SidstringRequired

The SID of the RatePlan resource to fetch.

Responses
200
Get Command
application/json
400
Invalid request
application/json
401
Credentials were not provided and are required to access this resource
application/json
403
Credentials were not provided and are required to access this resource
application/json
404
Resource not found
application/json
415
Credentials were not provided and are required to access this resource
application/json
422
Resource not found
application/json
500
Internal Server Error
application/json
503
Server is temporary not available
application/json
get
curl --location --globoff 'https://programmable-wireless.api.korewireless.com/v1/Commands/<string>' \
--header 'Authorization: Bearer <YOUR_AUTH_TOKEN>'
{
  "sid": "text",
  "account_sid": "text",
  "sim_sid": "text",
  "command": "text",
  "command_mode": "text",
  "transport": "sms",
  "delivery_receipt_requested": true,
  "status": "queued",
  "direction": "from_sim",
  "date_created": "2025-05-20T09:13:07.814Z",
  "date_updated": "2025-05-20T09:13:07.814Z",
  "url": "https://example.com"
}

List Commands

get
Authorizations
Query parameters
SimstringOptional

The sid or unique_name of the Sim resources to read.

Example: {"value":"sim"}
Statusstring · enum | nullableOptional

The status of the Command. Can be: queued, sent, delivered, received, or failed. See Status Values for a description of each state.

Example: {"value":"queued"}Possible values:
Directionstring · enum | nullableOptional

The direction of the Command. Can be to_sim or from_sim. The value of to_sim is synonymous with the term mobile terminated, and from_sim is synonymous with the term mobile originated.

Example: {"value":"from_sim"}Possible values:
Transportstring · enum | nullableOptional

The type of transport used. Can be: sms or ip.

Example: {"value":"ip"}Possible values:
PageSizeinteger · min: 1 · max: 1000Optional

How many resources to return in each list page. The default is 50, and the maximum is 1000.

PageintegerOptional

The page index. This value is simply for client state.

PageTokenstringOptional

The page token. This is provided by the API.

Responses
200
Data Usage List
application/json
400
Invalid request
application/json
401
Credentials were not provided and are required to access this resource
application/json
403
Credentials were not provided and are required to access this resource
application/json
404
Resource not found
application/json
415
Credentials were not provided and are required to access this resource
application/json
422
Resource not found
application/json
500
Internal Server Error
application/json
503
Server is temporary not available
application/json
get
curl --location --globoff 'https://programmable-wireless.api.korewireless.com/v1/Commands?Sim=<string>&Status=<string>&Direction=<string>&Transport=<string>&PageSize=<integer>&Page=<integer>&PageToken=<string>' \
--header 'Authorization: Bearer <YOUR_AUTH_TOKEN>'
{
  "commands": [
    {
      "sid": "text",
      "account_sid": "text",
      "sim_sid": "text",
      "command": "text",
      "command_mode": "text",
      "transport": "sms",
      "delivery_receipt_requested": true,
      "status": "queued",
      "direction": "from_sim",
      "date_created": "2025-05-20T09:13:07.814Z",
      "date_updated": "2025-05-20T09:13:07.814Z",
      "url": "https://example.com"
    }
  ],
  "meta": {
    "first_page_url": "https://example.com",
    "key": "text",
    "next_page_url": "https://example.com",
    "page": 1,
    "page_size": 1,
    "previous_page_url": "https://example.com",
    "url": "https://example.com"
  }
}

Delete a Command instance from your account.

delete
Authorizations
Path parameters
SidstringRequired

The SID of the RatePlan resource to fetch.

Responses
202
The resource was deleted successfully.
204
The resource was deleted successfully.
400
Invalid request
application/json
401
Credentials were not provided and are required to access this resource
application/json
403
Credentials were not provided and are required to access this resource
application/json
404
Resource not found
application/json
500
Internal Server Error
application/json
503
Server is temporary not available
application/json
delete
curl --location --globoff --request DELETE 'https://programmable-wireless.api.korewireless.com/v1/Commands/<string>' \
--header 'Authorization: Bearer <YOUR_AUTH_TOKEN>'

No content

  • Asynchronous resources
  • Retention period
  • Command Properties
  • Status values
  • Create a Command resource
  • Callback values
  • Send a Command to a Sim
  • POSTSend a Command to a Sim.
  • Fetch a Command resource
  • GETFetch a Command instance from your account.
  • Read multiple Command resources
  • GETList Commands
  • Delete a Command resource
  • DELETEDelete a Command instance from your account.
  • Receive a Command from a SIM