# Web Cloud › SMS › Send & Receive API

> Part of the OVHcloud developer hub. Index of every page and section: https://developers.eu.ovhcloud.com/llms.txt
> The Web Cloud product's sections: https://developers.eu.ovhcloud.com/reference/web-cloud/llms.txt
> Everything in one file: https://developers.eu.ovhcloud.com/llms-full.txt

> 30 operations of the OVHcloud API. Calls carry `authorization: Bearer $OVH_TOKEN`; the EU host is shown, Canada and the United States answer on api.ca.ovhcloud.com and api.us.ovhcloud.com.

Page: https://developers.eu.ovhcloud.com/reference/web-cloud/sms/send-receive/

OpenAPI v1: https://api.eu.ovhcloud.com/1.0/__schemas/developer-hub-navigation/web-cloud/sms/send-receive.json?format=openapi3
OpenAPI v2: https://api.eu.ovhcloud.com/v2/__schemas/developer-hub-navigation/web-cloud/sms/send-receive.json?format=openapi3

## Operations

- `POST /sms/estimate` — Estimate a message
- `GET /sms/{serviceName}/hlr` — List HLR lookups
- `GET /sms/{serviceName}/hlr/{id}` — Get an HLR lookup
- `POST /sms/{serviceName}/hlr` — Request HLR lookups
- `GET /sms/{serviceName}/hlr/{id}/operator` — Get the receiver operator
- `GET /sms/{serviceName}/incoming` — List received SMS
- `GET /sms/{serviceName}/incoming/{id}` — Get a received SMS
- `DELETE /sms/{serviceName}/incoming/{id}` — Delete a received SMS
- `GET /sms/{serviceName}/jobs` — List pending jobs
- `GET /sms/{serviceName}/jobs/{id}` — Get a pending job
- `POST /sms/{serviceName}/jobs` — Send SMS
- `DELETE /sms/{serviceName}/jobs/{id}` — Delete a pending job
- `GET /sms/{serviceName}/outgoing/{id}/hlr` — Get the receiver operator
- `GET /sms/{serviceName}/templatesControl` — List message templates
- `GET /sms/{serviceName}/templatesControl/{name}` — Get a message template
- `POST /sms/{serviceName}/templatesControl` — Create a message template
- `DELETE /sms/{serviceName}/templatesControl/{name}` — Delete a message template
- `PUT /sms/{serviceName}/templatesControl/{name}` — Update a message template
- `POST /sms/{serviceName}/templatesControl/{name}/relaunchValidation` — Relaunch template validation
- `GET /sms/ptts` — Get a PTT code
- `GET /sms/{serviceName}/batches` — List batches
- `POST /sms/{serviceName}/batches` — Create a batch
- `GET /sms/{serviceName}/batches/{id}` — Get a batch
- `PUT /sms/{serviceName}/batches/{id}` — Update a batch
- `DELETE /sms/{serviceName}/batches/{id}` — Delete a batch
- `POST /sms/{serviceName}/batches/{id}/cancel` — Cancel a deferred batch
- `GET /sms/{serviceName}/batches/{id}/statistics` — Get batch statistics
- `GET /sms/{serviceName}/outgoing` — List sent SMS
- `GET /sms/{serviceName}/outgoing/{id}` — Get a sent SMS
- `DELETE /sms/{serviceName}/outgoing/{id}` — Delete a sent SMS

## Estimate a message

`POST /1.0/sms/estimate`

Link: https://developers.eu.ovhcloud.com/reference/web-cloud/sms/send-receive/#post-sms-estimate

**Status:** Stable production version  
**IAM actions:** `account:apiovh:sms/estimate`

Estimate a message. Returns the encoding, the length and the number of SMS parts needed to send a text message.

### Request body (required)

Type: `object`

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `message` | string | yes | The message to send |
| `noStopClause` | boolean | yes | Do not display STOP clause in the message, this requires that this is not an advertising message |
| `senderType` | sms.TypeSenderEnum | yes | Sender type that will be used to send the message — one of `alpha`, `numeric`, `shortcode`, `time2chat`, `virtual` |

```json
{
  "message": "string",
  "noStopClause": true,
  "senderType": "alpha"
}
```

### Responses

| Status | Type | Description |
| --- | --- | --- |
| 200 | sms.JobEstimate | successful operation |

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `characters` | integer |  | The number of characters the message contains, including invisible escaped characters |
| `charactersClass` | sms.EncodingEnum |  | The characters class that will be used to send the SMS, depending on characters in message — one of `7bits`, `unicode` |
| `maxCharactersPerPart` | integer |  | The number of characters every SMS part can contain, depending on characters class and quantity of parts |
| `parts` | integer |  | The quantity of SMS parts the message will be split in |

```json
{
  "characters": 0,
  "charactersClass": "7bits",
  "maxCharactersPerPart": 0,
  "parts": 0
}
```

### Example

```bash
curl -X POST \
  "https://api.eu.ovhcloud.com/1.0/sms/estimate" \
  -H "accept: application/json" \
  -H "authorization: Bearer $OVH_TOKEN" \
  -H "content-type: application/json" \
  -d '{ }'
```

```python
'''
First, install the latest release of Python wrapper: $ pip install ovh
'''
import json
import ovh

# Instantiate an OVH Client.
# You can generate new credentials with full access to your account on
# the token creation page (https://api.ovh.com/createToken/index.cgi?GET=/*&PUT=/*&POST=/*&DELETE=/*)
client = ovh.Client(
	endpoint='ovh-eu',               # Endpoint of API OVH (List of available endpoints: https://github.com/ovh/python-ovh#2-configure-your-application)
	application_key='xxxxxxxxxx',    # Application Key
	application_secret='xxxxxxxxxx', # Application Secret
	consumer_key='xxxxxxxxxx',       # Consumer Key
)

# Request body type: sms.TypeSenderEnum
result = client.post("/sms/estimate",
	message = None, # The message to send (type: text)
	noStopClause = None, # Do not display STOP clause in the message, this requires that this is not an advertising message (type: boolean)
	senderType = None, # Sender type that will be used to send the message (type: sms.TypeSenderEnum)
)

# Pretty print
print(json.dumps(result, indent=4))
```

```php
<?php
/**
 * First, download the latest release of PHP wrapper on github
 * And include this script into the folder with extracted files
 */
require __DIR__ . '/vendor/autoload.php';
use \Ovh\Api;

/**
 * Instantiate an OVH Client.
 * You can generate new credentials with full access to your account on
 * the token creation page (https://api.ovh.com/createToken/index.cgi?GET=/*&PUT=/*&POST=/*&DELETE=/*)
 */
$ovh = new Api('xxxxxxxxxx',  // Application Key
               'xxxxxxxxxx',  // Application Secret
               'ovh-eu',      // Endpoint of API OVH (List of available endpoints: https://github.com/ovh/python-ovh#2-configure-your-application)
               'xxxxxxxxxx'); // Consumer Key

// Request body type: sms.TypeSenderEnum
$result = $ovh->post("/sms/estimate", array(
	message => null, // The message to send (type: text)
	noStopClause => null, // Do not display STOP clause in the message, this requires that this is not an advertising message (type: boolean)
	senderType => null, // Sender type that will be used to send the message (type: sms.TypeSenderEnum)
));

print_r($result);
?>
```

## List HLR lookups

`GET /1.0/sms/{serviceName}/hlr`

Link: https://developers.eu.ovhcloud.com/reference/web-cloud/sms/send-receive/#get-sms-servicename-hlr

**Status:** Stable production version  
**IAM actions:** `sms:apiovh:hlr/get`

List HLR lookups. Returns the identifiers of the HLR lookups. An HLR lookup checks whether a mobile number is valid, reachable, ported or roaming.

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `serviceName` | path | string | yes | The internal name of your SMS offer |

### Responses

| Status | Type | Description |
| --- | --- | --- |
| 200 | integer[] | successful operation |

```json
[
  0
]
```

### Example

```bash
curl -X GET \
  "https://api.eu.ovhcloud.com/1.0/sms/{serviceName}/hlr" \
  -H "accept: application/json" \
  -H "authorization: Bearer $OVH_TOKEN"
```

```python
'''
First, install the latest release of Python wrapper: $ pip install ovh
'''
import json
import ovh

# Instantiate an OVH Client.
# You can generate new credentials with full access to your account on
# the token creation page (https://api.ovh.com/createToken/index.cgi?GET=/*&PUT=/*&POST=/*&DELETE=/*)
client = ovh.Client(
	endpoint='ovh-eu',               # Endpoint of API OVH (List of available endpoints: https://github.com/ovh/python-ovh#2-configure-your-application)
	application_key='xxxxxxxxxx',    # Application Key
	application_secret='xxxxxxxxxx', # Application Secret
	consumer_key='xxxxxxxxxx',       # Consumer Key
)

result = client.get("/sms/{serviceName}/hlr")

# Pretty print
print(json.dumps(result, indent=4))
```

```php
<?php
/**
 * First, download the latest release of PHP wrapper on github
 * And include this script into the folder with extracted files
 */
require __DIR__ . '/vendor/autoload.php';
use \Ovh\Api;

/**
 * Instantiate an OVH Client.
 * You can generate new credentials with full access to your account on
 * the token creation page (https://api.ovh.com/createToken/index.cgi?GET=/*&PUT=/*&POST=/*&DELETE=/*)
 */
$ovh = new Api('xxxxxxxxxx',  // Application Key
               'xxxxxxxxxx',  // Application Secret
               'ovh-eu',      // Endpoint of API OVH (List of available endpoints: https://github.com/ovh/python-ovh#2-configure-your-application)
               'xxxxxxxxxx'); // Consumer Key

$result = $ovh->get("/sms/{serviceName}/hlr");

print_r($result);
?>
```

## Get an HLR lookup

`GET /1.0/sms/{serviceName}/hlr/{id}`

Link: https://developers.eu.ovhcloud.com/reference/web-cloud/sms/send-receive/#get-sms-servicename-hlr-id

**Status:** Stable production version  
**IAM actions:** `sms:apiovh:hlr/get`

Get an HLR lookup. Returns the result of the HLR lookup: validity, reachability, portability and roaming of the number.

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `id` | path | integer | yes | HLR id |
| `serviceName` | path | string | yes | The internal name of your SMS offer |

### Responses

| Status | Type | Description |
| --- | --- | --- |
| 200 | sms.HlrLookupNumber | successful operation |

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `datetime` | string (date-time) | read-only | HLR creation datetime |
| `id` | integer | read-only | HLR id |
| `msisdn` | string | read-only | MSISDN |
| `operatorCode` | string | read-only | The {Mobile Country Code, Mobile Network Code} unique identifier |
| `ported` | boolean | read-only | Has the MSISDN been ported from its original network |
| `reachable` | boolean | read-only | Is the MSISDN currently reachable |
| `roaming` | boolean | read-only | Is the MSISDN currently roaming outside its natinal network |
| `status` | sms.HlrStatuses | read-only | Status of the HLR request — one of `doing`, `done`, `error`, `todo` |
| `valid` | boolean | read-only | Is the MSISDN valid |

```json
{
  "datetime": "2024-01-01T12:00:00Z",
  "id": 0,
  "msisdn": "string",
  "operatorCode": "string",
  "ported": true,
  "reachable": true,
  "roaming": true,
  "status": "doing",
  "valid": true
}
```

### Example

```bash
curl -X GET \
  "https://api.eu.ovhcloud.com/1.0/sms/{serviceName}/hlr/{id}" \
  -H "accept: application/json" \
  -H "authorization: Bearer $OVH_TOKEN"
```

```python
'''
First, install the latest release of Python wrapper: $ pip install ovh
'''
import json
import ovh

# Instantiate an OVH Client.
# You can generate new credentials with full access to your account on
# the token creation page (https://api.ovh.com/createToken/index.cgi?GET=/*&PUT=/*&POST=/*&DELETE=/*)
client = ovh.Client(
	endpoint='ovh-eu',               # Endpoint of API OVH (List of available endpoints: https://github.com/ovh/python-ovh#2-configure-your-application)
	application_key='xxxxxxxxxx',    # Application Key
	application_secret='xxxxxxxxxx', # Application Secret
	consumer_key='xxxxxxxxxx',       # Consumer Key
)

result = client.get("/sms/{serviceName}/hlr/{id}")

# Pretty print
print(json.dumps(result, indent=4))
```

```php
<?php
/**
 * First, download the latest release of PHP wrapper on github
 * And include this script into the folder with extracted files
 */
require __DIR__ . '/vendor/autoload.php';
use \Ovh\Api;

/**
 * Instantiate an OVH Client.
 * You can generate new credentials with full access to your account on
 * the token creation page (https://api.ovh.com/createToken/index.cgi?GET=/*&PUT=/*&POST=/*&DELETE=/*)
 */
$ovh = new Api('xxxxxxxxxx',  // Application Key
               'xxxxxxxxxx',  // Application Secret
               'ovh-eu',      // Endpoint of API OVH (List of available endpoints: https://github.com/ovh/python-ovh#2-configure-your-application)
               'xxxxxxxxxx'); // Consumer Key

$result = $ovh->get("/sms/{serviceName}/hlr/{id}");

print_r($result);
?>
```

## Request HLR lookups

`POST /1.0/sms/{serviceName}/hlr`

Link: https://developers.eu.ovhcloud.com/reference/web-cloud/sms/send-receive/#post-sms-servicename-hlr

**Status:** Stable production version  
**IAM actions:** `sms:apiovh:hlr/create`

Request HLR lookups. Requests an HLR lookup for one or several mobile numbers, given as a list or a CSV document URL. Returns the lookup identifiers and the credits used.

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `serviceName` | path | string | yes | The internal name of your SMS offer |

### Request body (required)

Type: `object`

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `receivers` | string[] |  | The receivers |
| `receiversDocumentUrl` | string |  | The receivers document url link in csv format |

```json
{
  "receivers": [
    "string"
  ],
  "receiversDocumentUrl": "string"
}
```

### Responses

| Status | Type | Description |
| --- | --- | --- |
| 200 | sms.SmsSendingReport | successful operation |

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `ids` | integer[] |  |  |
| `invalidReceivers` | string[] |  |  |
| `tag` | string |  |  |
| `totalCreditsRemoved` | number |  |  |
| `validReceivers` | string[] |  |  |

```json
{
  "ids": [
    0
  ],
  "invalidReceivers": [
    "string"
  ],
  "tag": "string",
  "totalCreditsRemoved": 0,
  "validReceivers": [
    "string"
  ]
}
```

### Example

```bash
curl -X POST \
  "https://api.eu.ovhcloud.com/1.0/sms/{serviceName}/hlr" \
  -H "accept: application/json" \
  -H "authorization: Bearer $OVH_TOKEN" \
  -H "content-type: application/json" \
  -d '{ }'
```

```python
'''
First, install the latest release of Python wrapper: $ pip install ovh
'''
import json
import ovh

# Instantiate an OVH Client.
# You can generate new credentials with full access to your account on
# the token creation page (https://api.ovh.com/createToken/index.cgi?GET=/*&PUT=/*&POST=/*&DELETE=/*)
client = ovh.Client(
	endpoint='ovh-eu',               # Endpoint of API OVH (List of available endpoints: https://github.com/ovh/python-ovh#2-configure-your-application)
	application_key='xxxxxxxxxx',    # Application Key
	application_secret='xxxxxxxxxx', # Application Secret
	consumer_key='xxxxxxxxxx',       # Consumer Key
)

result = client.post("/sms/{serviceName}/hlr",
	receivers = None, # The receivers (type: string[], nullable)
	receiversDocumentUrl = None, # The receivers document url link in csv format (type: string, nullable)
)

# Pretty print
print(json.dumps(result, indent=4))
```

```php
<?php
/**
 * First, download the latest release of PHP wrapper on github
 * And include this script into the folder with extracted files
 */
require __DIR__ . '/vendor/autoload.php';
use \Ovh\Api;

/**
 * Instantiate an OVH Client.
 * You can generate new credentials with full access to your account on
 * the token creation page (https://api.ovh.com/createToken/index.cgi?GET=/*&PUT=/*&POST=/*&DELETE=/*)
 */
$ovh = new Api('xxxxxxxxxx',  // Application Key
               'xxxxxxxxxx',  // Application Secret
               'ovh-eu',      // Endpoint of API OVH (List of available endpoints: https://github.com/ovh/python-ovh#2-configure-your-application)
               'xxxxxxxxxx'); // Consumer Key

$result = $ovh->post("/sms/{serviceName}/hlr", array(
	receivers => null, // The receivers (type: string[], nullable)
	receiversDocumentUrl => null, // The receivers document url link in csv format (type: string, nullable)
));

print_r($result);
?>
```

## Get the receiver operator

`GET /1.0/sms/{serviceName}/hlr/{id}/operator`

Link: https://developers.eu.ovhcloud.com/reference/web-cloud/sms/send-receive/#get-sms-servicename-hlr-id-operator

**Status:** Stable production version  
**IAM actions:** `sms:apiovh:hlr/operator/get`

Get the receiver operator. Returns the operator of the phone number, from the network query trace: country, country code, region, operator and network.

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `id` | path | integer | yes | HLR id |
| `serviceName` | path | string | yes | The internal name of your SMS offer |

### Responses

| Status | Type | Description |
| --- | --- | --- |
| 200 | sms.Hlr | successful operation |

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `country` | string | read-only | The country |
| `countryCode` | string | read-only | The countryCode prefix number |
| `network` | string | read-only | The network name |
| `operator` | string | read-only | The operator name |
| `region` | string | read-only | The region |

```json
{
  "country": "string",
  "countryCode": "string",
  "network": "string",
  "operator": "string",
  "region": "string"
}
```

### Example

```bash
curl -X GET \
  "https://api.eu.ovhcloud.com/1.0/sms/{serviceName}/hlr/{id}/operator" \
  -H "accept: application/json" \
  -H "authorization: Bearer $OVH_TOKEN"
```

```python
'''
First, install the latest release of Python wrapper: $ pip install ovh
'''
import json
import ovh

# Instantiate an OVH Client.
# You can generate new credentials with full access to your account on
# the token creation page (https://api.ovh.com/createToken/index.cgi?GET=/*&PUT=/*&POST=/*&DELETE=/*)
client = ovh.Client(
	endpoint='ovh-eu',               # Endpoint of API OVH (List of available endpoints: https://github.com/ovh/python-ovh#2-configure-your-application)
	application_key='xxxxxxxxxx',    # Application Key
	application_secret='xxxxxxxxxx', # Application Secret
	consumer_key='xxxxxxxxxx',       # Consumer Key
)

result = client.get("/sms/{serviceName}/hlr/{id}/operator")

# Pretty print
print(json.dumps(result, indent=4))
```

```php
<?php
/**
 * First, download the latest release of PHP wrapper on github
 * And include this script into the folder with extracted files
 */
require __DIR__ . '/vendor/autoload.php';
use \Ovh\Api;

/**
 * Instantiate an OVH Client.
 * You can generate new credentials with full access to your account on
 * the token creation page (https://api.ovh.com/createToken/index.cgi?GET=/*&PUT=/*&POST=/*&DELETE=/*)
 */
$ovh = new Api('xxxxxxxxxx',  // Application Key
               'xxxxxxxxxx',  // Application Secret
               'ovh-eu',      // Endpoint of API OVH (List of available endpoints: https://github.com/ovh/python-ovh#2-configure-your-application)
               'xxxxxxxxxx'); // Consumer Key

$result = $ovh->get("/sms/{serviceName}/hlr/{id}/operator");

print_r($result);
?>
```

## List received SMS

`GET /1.0/sms/{serviceName}/incoming`

Link: https://developers.eu.ovhcloud.com/reference/web-cloud/sms/send-receive/#get-sms-servicename-incoming

**Status:** Stable production version  
**IAM actions:** `sms:apiovh:incoming/get`

List received SMS. Returns the identifiers of the received SMS. Get a received SMS for its sender, message, date and credits used.

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `creationDatetime.from` | query | string (date-time) |  | Filter the value of creationDatetime property (>=) |
| `creationDatetime.to` | query | string (date-time) |  | Filter the value of creationDatetime property (<=) |
| `sender` | query | string |  | Filter the value of sender property (=) |
| `serviceName` | path | string | yes | The internal name of your SMS offer |
| `tag` | query | string |  | Filter the value of tag property (=) |

### Responses

| Status | Type | Description |
| --- | --- | --- |
| 200 | integer[] | successful operation |

```json
[
  0
]
```

### Example

```bash
curl -X GET \
  "https://api.eu.ovhcloud.com/1.0/sms/{serviceName}/incoming" \
  -H "accept: application/json" \
  -H "authorization: Bearer $OVH_TOKEN"
```

```python
'''
First, install the latest release of Python wrapper: $ pip install ovh
'''
import json
import ovh

# Instantiate an OVH Client.
# You can generate new credentials with full access to your account on
# the token creation page (https://api.ovh.com/createToken/index.cgi?GET=/*&PUT=/*&POST=/*&DELETE=/*)
client = ovh.Client(
	endpoint='ovh-eu',               # Endpoint of API OVH (List of available endpoints: https://github.com/ovh/python-ovh#2-configure-your-application)
	application_key='xxxxxxxxxx',    # Application Key
	application_secret='xxxxxxxxxx', # Application Secret
	consumer_key='xxxxxxxxxx',       # Consumer Key
)

result = client.get("/sms/{serviceName}/incoming")

# Pretty print
print(json.dumps(result, indent=4))
```

```php
<?php
/**
 * First, download the latest release of PHP wrapper on github
 * And include this script into the folder with extracted files
 */
require __DIR__ . '/vendor/autoload.php';
use \Ovh\Api;

/**
 * Instantiate an OVH Client.
 * You can generate new credentials with full access to your account on
 * the token creation page (https://api.ovh.com/createToken/index.cgi?GET=/*&PUT=/*&POST=/*&DELETE=/*)
 */
$ovh = new Api('xxxxxxxxxx',  // Application Key
               'xxxxxxxxxx',  // Application Secret
               'ovh-eu',      // Endpoint of API OVH (List of available endpoints: https://github.com/ovh/python-ovh#2-configure-your-application)
               'xxxxxxxxxx'); // Consumer Key

$result = $ovh->get("/sms/{serviceName}/incoming");

print_r($result);
?>
```

## Get a received SMS

`GET /1.0/sms/{serviceName}/incoming/{id}`

Link: https://developers.eu.ovhcloud.com/reference/web-cloud/sms/send-receive/#get-sms-servicename-incoming-id

**Status:** Stable production version  
**IAM actions:** `sms:apiovh:incoming/get`

Get a received SMS. Returns the received SMS: sender, message, reception date, credits used and tag. The tag groups SMS for filtering and export.

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `id` | path | integer | yes | Id of the object |
| `serviceName` | path | string | yes | The internal name of your SMS offer |

### Responses

| Status | Type | Description |
| --- | --- | --- |
| 200 | sms.Incoming | successful operation |

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `creationDatetime` | string (date-time) | read-only |  |
| `credits` | number | read-only |  |
| `id` | integer | read-only |  |
| `message` | string | read-only |  |
| `sender` | string | read-only |  |
| `tag` | string | read-only |  |

```json
{
  "creationDatetime": "2024-01-01T12:00:00Z",
  "credits": 0,
  "id": 0,
  "message": "string",
  "sender": "string",
  "tag": "string"
}
```

### Example

```bash
curl -X GET \
  "https://api.eu.ovhcloud.com/1.0/sms/{serviceName}/incoming/{id}" \
  -H "accept: application/json" \
  -H "authorization: Bearer $OVH_TOKEN"
```

```python
'''
First, install the latest release of Python wrapper: $ pip install ovh
'''
import json
import ovh

# Instantiate an OVH Client.
# You can generate new credentials with full access to your account on
# the token creation page (https://api.ovh.com/createToken/index.cgi?GET=/*&PUT=/*&POST=/*&DELETE=/*)
client = ovh.Client(
	endpoint='ovh-eu',               # Endpoint of API OVH (List of available endpoints: https://github.com/ovh/python-ovh#2-configure-your-application)
	application_key='xxxxxxxxxx',    # Application Key
	application_secret='xxxxxxxxxx', # Application Secret
	consumer_key='xxxxxxxxxx',       # Consumer Key
)

result = client.get("/sms/{serviceName}/incoming/{id}")

# Pretty print
print(json.dumps(result, indent=4))
```

```php
<?php
/**
 * First, download the latest release of PHP wrapper on github
 * And include this script into the folder with extracted files
 */
require __DIR__ . '/vendor/autoload.php';
use \Ovh\Api;

/**
 * Instantiate an OVH Client.
 * You can generate new credentials with full access to your account on
 * the token creation page (https://api.ovh.com/createToken/index.cgi?GET=/*&PUT=/*&POST=/*&DELETE=/*)
 */
$ovh = new Api('xxxxxxxxxx',  // Application Key
               'xxxxxxxxxx',  // Application Secret
               'ovh-eu',      // Endpoint of API OVH (List of available endpoints: https://github.com/ovh/python-ovh#2-configure-your-application)
               'xxxxxxxxxx'); // Consumer Key

$result = $ovh->get("/sms/{serviceName}/incoming/{id}");

print_r($result);
?>
```

## Delete a received SMS

`DELETE /1.0/sms/{serviceName}/incoming/{id}`

Link: https://developers.eu.ovhcloud.com/reference/web-cloud/sms/send-receive/#delete-sms-servicename-incoming-id

**Status:** Stable production version  
**IAM actions:** `sms:apiovh:incoming/delete`

Delete a received SMS. Deletes the received SMS from the history. It no longer appears in the list of received SMS.

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `id` | path | integer | yes | Id of the object |
| `serviceName` | path | string | yes | The internal name of your SMS offer |

### Responses

| Status | Type | Description |
| --- | --- | --- |
| 200 | — | successful operation |

### Example

```bash
curl -X DELETE \
  "https://api.eu.ovhcloud.com/1.0/sms/{serviceName}/incoming/{id}" \
  -H "accept: application/json" \
  -H "authorization: Bearer $OVH_TOKEN"
```

```python
'''
First, install the latest release of Python wrapper: $ pip install ovh
'''
import json
import ovh

# Instantiate an OVH Client.
# You can generate new credentials with full access to your account on
# the token creation page (https://api.ovh.com/createToken/index.cgi?GET=/*&PUT=/*&POST=/*&DELETE=/*)
client = ovh.Client(
	endpoint='ovh-eu',               # Endpoint of API OVH (List of available endpoints: https://github.com/ovh/python-ovh#2-configure-your-application)
	application_key='xxxxxxxxxx',    # Application Key
	application_secret='xxxxxxxxxx', # Application Secret
	consumer_key='xxxxxxxxxx',       # Consumer Key
)

result = client.delete("/sms/{serviceName}/incoming/{id}")

# Pretty print
print(json.dumps(result, indent=4))
```

```php
<?php
/**
 * First, download the latest release of PHP wrapper on github
 * And include this script into the folder with extracted files
 */
require __DIR__ . '/vendor/autoload.php';
use \Ovh\Api;

/**
 * Instantiate an OVH Client.
 * You can generate new credentials with full access to your account on
 * the token creation page (https://api.ovh.com/createToken/index.cgi?GET=/*&PUT=/*&POST=/*&DELETE=/*)
 */
$ovh = new Api('xxxxxxxxxx',  // Application Key
               'xxxxxxxxxx',  // Application Secret
               'ovh-eu',      // Endpoint of API OVH (List of available endpoints: https://github.com/ovh/python-ovh#2-configure-your-application)
               'xxxxxxxxxx'); // Consumer Key

$result = $ovh->delete("/sms/{serviceName}/incoming/{id}");

print_r($result);
?>
```

## List pending jobs

`GET /1.0/sms/{serviceName}/jobs`

Link: https://developers.eu.ovhcloud.com/reference/web-cloud/sms/send-receive/#get-sms-servicename-jobs

**Status:** Stable production version  
**IAM actions:** `sms:apiovh:jobs/get`

List pending jobs. Returns the identifiers of the SMS waiting to be sent. Get a pending job for its receiver, message, number of SMS parts and credits.

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `serviceName` | path | string | yes | The internal name of your SMS offer |

### Responses

| Status | Type | Description |
| --- | --- | --- |
| 200 | integer[] | successful operation |

```json
[
  0
]
```

### Example

```bash
curl -X GET \
  "https://api.eu.ovhcloud.com/1.0/sms/{serviceName}/jobs" \
  -H "accept: application/json" \
  -H "authorization: Bearer $OVH_TOKEN"
```

```python
'''
First, install the latest release of Python wrapper: $ pip install ovh
'''
import json
import ovh

# Instantiate an OVH Client.
# You can generate new credentials with full access to your account on
# the token creation page (https://api.ovh.com/createToken/index.cgi?GET=/*&PUT=/*&POST=/*&DELETE=/*)
client = ovh.Client(
	endpoint='ovh-eu',               # Endpoint of API OVH (List of available endpoints: https://github.com/ovh/python-ovh#2-configure-your-application)
	application_key='xxxxxxxxxx',    # Application Key
	application_secret='xxxxxxxxxx', # Application Secret
	consumer_key='xxxxxxxxxx',       # Consumer Key
)

result = client.get("/sms/{serviceName}/jobs")

# Pretty print
print(json.dumps(result, indent=4))
```

```php
<?php
/**
 * First, download the latest release of PHP wrapper on github
 * And include this script into the folder with extracted files
 */
require __DIR__ . '/vendor/autoload.php';
use \Ovh\Api;

/**
 * Instantiate an OVH Client.
 * You can generate new credentials with full access to your account on
 * the token creation page (https://api.ovh.com/createToken/index.cgi?GET=/*&PUT=/*&POST=/*&DELETE=/*)
 */
$ovh = new Api('xxxxxxxxxx',  // Application Key
               'xxxxxxxxxx',  // Application Secret
               'ovh-eu',      // Endpoint of API OVH (List of available endpoints: https://github.com/ovh/python-ovh#2-configure-your-application)
               'xxxxxxxxxx'); // Consumer Key

$result = $ovh->get("/sms/{serviceName}/jobs");

print_r($result);
?>
```

## Get a pending job

`GET /1.0/sms/{serviceName}/jobs/{id}`

Link: https://developers.eu.ovhcloud.com/reference/web-cloud/sms/send-receive/#get-sms-servicename-jobs-id

**Status:** Stable production version  
**IAM actions:** `sms:apiovh:jobs/get`

Get a pending job. Returns the SMS waiting to be sent: receiver, message, number of SMS parts and credits.

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `id` | path | integer | yes | Id of the object |
| `serviceName` | path | string | yes | The internal name of your SMS offer |

### Responses

| Status | Type | Description |
| --- | --- | --- |
| 200 | sms.Job | successful operation |

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `creationDatetime` | string (date-time) | read-only |  |
| `credits` | number | read-only |  |
| `deliveredAt` | string (date-time) | read-only |  |
| `deliveryReceipt` | integer | read-only |  |
| `differedDelivery` | integer | read-only |  |
| `id` | integer | read-only |  |
| `message` | string | read-only |  |
| `messageLength` | integer | read-only |  |
| `numberOfSms` | integer | read-only |  |
| `ptt` | integer | read-only |  |
| `receiver` | string | read-only |  |
| `sender` | string | read-only |  |
| `sentAt` | string (date-time) | read-only |  |

```json
{
  "creationDatetime": "2024-01-01T12:00:00Z",
  "credits": 0,
  "deliveredAt": "2024-01-01T12:00:00Z",
  "deliveryReceipt": 0,
  "differedDelivery": 0,
  "id": 0,
  "message": "string",
  "messageLength": 0,
  "numberOfSms": 0,
  "ptt": 0,
  "receiver": "string",
  "sender": "string",
  "sentAt": "2024-01-01T12:00:00Z"
}
```

### Example

```bash
curl -X GET \
  "https://api.eu.ovhcloud.com/1.0/sms/{serviceName}/jobs/{id}" \
  -H "accept: application/json" \
  -H "authorization: Bearer $OVH_TOKEN"
```

```python
'''
First, install the latest release of Python wrapper: $ pip install ovh
'''
import json
import ovh

# Instantiate an OVH Client.
# You can generate new credentials with full access to your account on
# the token creation page (https://api.ovh.com/createToken/index.cgi?GET=/*&PUT=/*&POST=/*&DELETE=/*)
client = ovh.Client(
	endpoint='ovh-eu',               # Endpoint of API OVH (List of available endpoints: https://github.com/ovh/python-ovh#2-configure-your-application)
	application_key='xxxxxxxxxx',    # Application Key
	application_secret='xxxxxxxxxx', # Application Secret
	consumer_key='xxxxxxxxxx',       # Consumer Key
)

result = client.get("/sms/{serviceName}/jobs/{id}")

# Pretty print
print(json.dumps(result, indent=4))
```

```php
<?php
/**
 * First, download the latest release of PHP wrapper on github
 * And include this script into the folder with extracted files
 */
require __DIR__ . '/vendor/autoload.php';
use \Ovh\Api;

/**
 * Instantiate an OVH Client.
 * You can generate new credentials with full access to your account on
 * the token creation page (https://api.ovh.com/createToken/index.cgi?GET=/*&PUT=/*&POST=/*&DELETE=/*)
 */
$ovh = new Api('xxxxxxxxxx',  // Application Key
               'xxxxxxxxxx',  // Application Secret
               'ovh-eu',      // Endpoint of API OVH (List of available endpoints: https://github.com/ovh/python-ovh#2-configure-your-application)
               'xxxxxxxxxx'); // Consumer Key

$result = $ovh->get("/sms/{serviceName}/jobs/{id}");

print_r($result);
?>
```

## Send SMS

`POST /1.0/sms/{serviceName}/jobs`

Link: https://developers.eu.ovhcloud.com/reference/web-cloud/sms/send-receive/#post-sms-servicename-jobs

**Status:** Stable production version  
**IAM actions:** `sms:apiovh:jobs/create`

Send SMS. Sends an SMS to one or several receivers, given as a list, a CSV document URL or a receiver list. Sending can be delayed, and a validity period drops the message if it is not delivered in time.

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `serviceName` | path | string | yes | The internal name of your SMS offer |

### Request body (required)

Type: `object`

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `charset` | sms.CharsetEnum |  | The sms coding — one of `UTF-8` |
| `class` | sms.ClassEnum |  | Deprecated: The sms class — one of `flash`, `phoneDisplay`, `sim`, `toolkit` |
| `coding` | sms.CodingEnum |  | Deprecated: the coding is deduced from the message and its charset — one of `7bit`, `8bit` |
| `differedPeriod` | integer |  | The time -in minute(s)- to wait before sending the message |
| `message` | string | yes | The sms message |
| `noStopClause` | boolean |  | Do not display STOP clause in the message, this requires that this is not an advertising message |
| `priority` | sms.PriorityEnum |  | The priority of the message — one of `high`, `low`, `medium`, `veryLow` |
| `receivers` | string[] |  | The receivers list |
| `receiversDocumentUrl` | string |  | The receivers document url link in csv format |
| `receiversSlotId` | string |  | The receivers document slot id |
| `sender` | string |  | The sender |
| `senderForResponse` | boolean |  | Set the flag to send a special sms which can be reply by the receiver (smsResponse). |
| `tag` | string |  | The identifier group tag |
| `validityPeriod` | integer |  | The maximum time -in minute(s)- before the message is dropped |

```json
{
  "charset": "UTF-8",
  "class": "flash",
  "coding": "7bit",
  "differedPeriod": 0,
  "message": "string",
  "noStopClause": true,
  "priority": "high",
  "receivers": [
    "string"
  ],
  "receiversDocumentUrl": "string",
  "receiversSlotId": "string",
  "sender": "string",
  "senderForResponse": true,
  "tag": "string",
  "validityPeriod": 0
}
```

### Responses

| Status | Type | Description |
| --- | --- | --- |
| 200 | sms.SmsSendingReportUser | successful operation |

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `creditsLeft` | number |  |  |
| `ids` | integer[] |  |  |
| `invalidReceivers` | string[] |  |  |
| `tag` | string |  |  |
| `totalCreditsRemoved` | number |  |  |
| `validReceivers` | string[] |  |  |

```json
{
  "creditsLeft": 0,
  "ids": [
    0
  ],
  "invalidReceivers": [
    "string"
  ],
  "tag": "string",
  "totalCreditsRemoved": 0,
  "validReceivers": [
    "string"
  ]
}
```

### Example

```bash
curl -X POST \
  "https://api.eu.ovhcloud.com/1.0/sms/{serviceName}/jobs" \
  -H "accept: application/json" \
  -H "authorization: Bearer $OVH_TOKEN" \
  -H "content-type: application/json" \
  -d '{ }'
```

```python
'''
First, install the latest release of Python wrapper: $ pip install ovh
'''
import json
import ovh

# Instantiate an OVH Client.
# You can generate new credentials with full access to your account on
# the token creation page (https://api.ovh.com/createToken/index.cgi?GET=/*&PUT=/*&POST=/*&DELETE=/*)
client = ovh.Client(
	endpoint='ovh-eu',               # Endpoint of API OVH (List of available endpoints: https://github.com/ovh/python-ovh#2-configure-your-application)
	application_key='xxxxxxxxxx',    # Application Key
	application_secret='xxxxxxxxxx', # Application Secret
	consumer_key='xxxxxxxxxx',       # Consumer Key
)

result = client.post("/sms/{serviceName}/jobs",
	charset = None, # The sms coding (type: sms.CharsetEnum, nullable)
	class = None, # Deprecated: The sms class (type: sms.ClassEnum, nullable)
	coding = None, # Deprecated: the coding is deduced from the message and its charset (type: sms.CodingEnum, nullable)
	differedPeriod = None, # The time -in minute(s)- to wait before sending the message (type: long, nullable)
	message = None, # The sms message (type: string)
	noStopClause = None, # Do not display STOP clause in the message, this requires that this is not an advertising message (type: boolean, nullable)
	priority = None, # The priority of the message (type: sms.PriorityEnum, nullable)
	receivers = None, # The receivers list (type: string[], nullable)
	receiversDocumentUrl = None, # The receivers document url link in csv format (type: string, nullable)
	receiversSlotId = None, # The receivers document slot id (type: string, nullable)
	sender = None, # The sender (type: string, nullable)
	senderForResponse = None, # Set the flag to send a special sms which can be reply by the receiver (smsResponse). (type: boolean, nullable)
	tag = None, # The identifier group tag (type: string, nullable)
	validityPeriod = None, # The maximum time -in minute(s)- before the message is dropped (type: long, nullable)
)

# Pretty print
print(json.dumps(result, indent=4))
```

```php
<?php
/**
 * First, download the latest release of PHP wrapper on github
 * And include this script into the folder with extracted files
 */
require __DIR__ . '/vendor/autoload.php';
use \Ovh\Api;

/**
 * Instantiate an OVH Client.
 * You can generate new credentials with full access to your account on
 * the token creation page (https://api.ovh.com/createToken/index.cgi?GET=/*&PUT=/*&POST=/*&DELETE=/*)
 */
$ovh = new Api('xxxxxxxxxx',  // Application Key
               'xxxxxxxxxx',  // Application Secret
               'ovh-eu',      // Endpoint of API OVH (List of available endpoints: https://github.com/ovh/python-ovh#2-configure-your-application)
               'xxxxxxxxxx'); // Consumer Key

$result = $ovh->post("/sms/{serviceName}/jobs", array(
	charset => null, // The sms coding (type: sms.CharsetEnum, nullable)
	class => null, // Deprecated: The sms class (type: sms.ClassEnum, nullable)
	coding => null, // Deprecated: the coding is deduced from the message and its charset (type: sms.CodingEnum, nullable)
	differedPeriod => null, // The time -in minute(s)- to wait before sending the message (type: long, nullable)
	message => null, // The sms message (type: string)
	noStopClause => null, // Do not display STOP clause in the message, this requires that this is not an advertising message (type: boolean, nullable)
	priority => null, // The priority of the message (type: sms.PriorityEnum, nullable)
	receivers => null, // The receivers list (type: string[], nullable)
	receiversDocumentUrl => null, // The receivers document url link in csv format (type: string, nullable)
	receiversSlotId => null, // The receivers document slot id (type: string, nullable)
	sender => null, // The sender (type: string, nullable)
	senderForResponse => null, // Set the flag to send a special sms which can be reply by the receiver (smsResponse). (type: boolean, nullable)
	tag => null, // The identifier group tag (type: string, nullable)
	validityPeriod => null, // The maximum time -in minute(s)- before the message is dropped (type: long, nullable)
));

print_r($result);
?>
```

## Delete a pending job

`DELETE /1.0/sms/{serviceName}/jobs/{id}`

Link: https://developers.eu.ovhcloud.com/reference/web-cloud/sms/send-receive/#delete-sms-servicename-jobs-id

**Status:** Stable production version  
**IAM actions:** `sms:apiovh:jobs/delete`

Delete a pending job. Cancels the sending of an SMS that is still waiting to be sent, such as a delayed SMS. Sent SMS are in the sent SMS history.

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `id` | path | integer | yes | Id of the object |
| `serviceName` | path | string | yes | The internal name of your SMS offer |

### Responses

| Status | Type | Description |
| --- | --- | --- |
| 200 | — | successful operation |

### Example

```bash
curl -X DELETE \
  "https://api.eu.ovhcloud.com/1.0/sms/{serviceName}/jobs/{id}" \
  -H "accept: application/json" \
  -H "authorization: Bearer $OVH_TOKEN"
```

```python
'''
First, install the latest release of Python wrapper: $ pip install ovh
'''
import json
import ovh

# Instantiate an OVH Client.
# You can generate new credentials with full access to your account on
# the token creation page (https://api.ovh.com/createToken/index.cgi?GET=/*&PUT=/*&POST=/*&DELETE=/*)
client = ovh.Client(
	endpoint='ovh-eu',               # Endpoint of API OVH (List of available endpoints: https://github.com/ovh/python-ovh#2-configure-your-application)
	application_key='xxxxxxxxxx',    # Application Key
	application_secret='xxxxxxxxxx', # Application Secret
	consumer_key='xxxxxxxxxx',       # Consumer Key
)

result = client.delete("/sms/{serviceName}/jobs/{id}")

# Pretty print
print(json.dumps(result, indent=4))
```

```php
<?php
/**
 * First, download the latest release of PHP wrapper on github
 * And include this script into the folder with extracted files
 */
require __DIR__ . '/vendor/autoload.php';
use \Ovh\Api;

/**
 * Instantiate an OVH Client.
 * You can generate new credentials with full access to your account on
 * the token creation page (https://api.ovh.com/createToken/index.cgi?GET=/*&PUT=/*&POST=/*&DELETE=/*)
 */
$ovh = new Api('xxxxxxxxxx',  // Application Key
               'xxxxxxxxxx',  // Application Secret
               'ovh-eu',      // Endpoint of API OVH (List of available endpoints: https://github.com/ovh/python-ovh#2-configure-your-application)
               'xxxxxxxxxx'); // Consumer Key

$result = $ovh->delete("/sms/{serviceName}/jobs/{id}");

print_r($result);
?>
```

## Get the receiver operator

`GET /1.0/sms/{serviceName}/outgoing/{id}/hlr`

Link: https://developers.eu.ovhcloud.com/reference/web-cloud/sms/send-receive/#get-sms-servicename-outgoing-id-hlr

**Status:** Stable production version  
**IAM actions:** `sms:apiovh:outgoing/hlr/get`

Get the receiver operator. Returns the operator of the phone number, from the network query trace: country, country code, region, operator and network.

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `id` | path | integer | yes | Id of the object |
| `serviceName` | path | string | yes | The internal name of your SMS offer |

### Responses

| Status | Type | Description |
| --- | --- | --- |
| 200 | sms.Hlr | successful operation |

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `country` | string | read-only | The country |
| `countryCode` | string | read-only | The countryCode prefix number |
| `network` | string | read-only | The network name |
| `operator` | string | read-only | The operator name |
| `region` | string | read-only | The region |

```json
{
  "country": "string",
  "countryCode": "string",
  "network": "string",
  "operator": "string",
  "region": "string"
}
```

### Example

```bash
curl -X GET \
  "https://api.eu.ovhcloud.com/1.0/sms/{serviceName}/outgoing/{id}/hlr" \
  -H "accept: application/json" \
  -H "authorization: Bearer $OVH_TOKEN"
```

```python
'''
First, install the latest release of Python wrapper: $ pip install ovh
'''
import json
import ovh

# Instantiate an OVH Client.
# You can generate new credentials with full access to your account on
# the token creation page (https://api.ovh.com/createToken/index.cgi?GET=/*&PUT=/*&POST=/*&DELETE=/*)
client = ovh.Client(
	endpoint='ovh-eu',               # Endpoint of API OVH (List of available endpoints: https://github.com/ovh/python-ovh#2-configure-your-application)
	application_key='xxxxxxxxxx',    # Application Key
	application_secret='xxxxxxxxxx', # Application Secret
	consumer_key='xxxxxxxxxx',       # Consumer Key
)

result = client.get("/sms/{serviceName}/outgoing/{id}/hlr")

# Pretty print
print(json.dumps(result, indent=4))
```

```php
<?php
/**
 * First, download the latest release of PHP wrapper on github
 * And include this script into the folder with extracted files
 */
require __DIR__ . '/vendor/autoload.php';
use \Ovh\Api;

/**
 * Instantiate an OVH Client.
 * You can generate new credentials with full access to your account on
 * the token creation page (https://api.ovh.com/createToken/index.cgi?GET=/*&PUT=/*&POST=/*&DELETE=/*)
 */
$ovh = new Api('xxxxxxxxxx',  // Application Key
               'xxxxxxxxxx',  // Application Secret
               'ovh-eu',      // Endpoint of API OVH (List of available endpoints: https://github.com/ovh/python-ovh#2-configure-your-application)
               'xxxxxxxxxx'); // Consumer Key

$result = $ovh->get("/sms/{serviceName}/outgoing/{id}/hlr");

print_r($result);
?>
```

## List message templates

`GET /1.0/sms/{serviceName}/templatesControl`

Link: https://developers.eu.ovhcloud.com/reference/web-cloud/sms/send-receive/#get-sms-servicename-templatescontrol

**Status:** Stable production version  
**IAM actions:** `sms:apiovh:templatesControl/get`

List message templates. Returns the message templates. Sending SMS to the United States requires a template validated by a moderator.

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `serviceName` | path | string | yes | The internal name of your SMS offer |

### Responses

| Status | Type | Description |
| --- | --- | --- |
| 200 | string[] | successful operation |

```json
[
  "string"
]
```

### Example

```bash
curl -X GET \
  "https://api.eu.ovhcloud.com/1.0/sms/{serviceName}/templatesControl" \
  -H "accept: application/json" \
  -H "authorization: Bearer $OVH_TOKEN"
```

```python
'''
First, install the latest release of Python wrapper: $ pip install ovh
'''
import json
import ovh

# Instantiate an OVH Client.
# You can generate new credentials with full access to your account on
# the token creation page (https://api.ovh.com/createToken/index.cgi?GET=/*&PUT=/*&POST=/*&DELETE=/*)
client = ovh.Client(
	endpoint='ovh-eu',               # Endpoint of API OVH (List of available endpoints: https://github.com/ovh/python-ovh#2-configure-your-application)
	application_key='xxxxxxxxxx',    # Application Key
	application_secret='xxxxxxxxxx', # Application Secret
	consumer_key='xxxxxxxxxx',       # Consumer Key
)

result = client.get("/sms/{serviceName}/templatesControl")

# Pretty print
print(json.dumps(result, indent=4))
```

```php
<?php
/**
 * First, download the latest release of PHP wrapper on github
 * And include this script into the folder with extracted files
 */
require __DIR__ . '/vendor/autoload.php';
use \Ovh\Api;

/**
 * Instantiate an OVH Client.
 * You can generate new credentials with full access to your account on
 * the token creation page (https://api.ovh.com/createToken/index.cgi?GET=/*&PUT=/*&POST=/*&DELETE=/*)
 */
$ovh = new Api('xxxxxxxxxx',  // Application Key
               'xxxxxxxxxx',  // Application Secret
               'ovh-eu',      // Endpoint of API OVH (List of available endpoints: https://github.com/ovh/python-ovh#2-configure-your-application)
               'xxxxxxxxxx'); // Consumer Key

$result = $ovh->get("/sms/{serviceName}/templatesControl");

print_r($result);
?>
```

## Get a message template

`GET /1.0/sms/{serviceName}/templatesControl/{name}`

Link: https://developers.eu.ovhcloud.com/reference/web-cloud/sms/send-receive/#get-sms-servicename-templatescontrol-name

**Status:** Stable production version  
**IAM actions:** `sms:apiovh:templatesControl/get`

Get a message template. Returns the message template: pattern, activity, status and moderator comment.

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `name` | path | string | yes | Name of the template |
| `serviceName` | path | string | yes | The internal name of your SMS offer |

### Responses

| Status | Type | Description |
| --- | --- | --- |
| 200 | sms.TemplateControl | successful operation |

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `activity` | sms.TypeTemplateEnum |  | Specify the kind of template — one of `alerting`, `authentification`, `transactional` |
| `comment` | string | read-only | Message sent by the moderator |
| `datetime` | string (date-time) | read-only | Template creation datetime |
| `description` | string |  | Template description |
| `message` | string |  | Message pattern to be moderated. Use "#VALUE#" format for dynamic text area. |
| `name` | string |  | Name of the template |
| `status` | sms.StatusSenderEnum |  | Template status — one of `disable`, `enable`, `refused`, `waitingValidation` |

```json
{
  "activity": "alerting",
  "comment": "string",
  "datetime": "2024-01-01T12:00:00Z",
  "description": "string",
  "message": "string",
  "name": "string",
  "status": "disable"
}
```

### Example

```bash
curl -X GET \
  "https://api.eu.ovhcloud.com/1.0/sms/{serviceName}/templatesControl/{name}" \
  -H "accept: application/json" \
  -H "authorization: Bearer $OVH_TOKEN"
```

```python
'''
First, install the latest release of Python wrapper: $ pip install ovh
'''
import json
import ovh

# Instantiate an OVH Client.
# You can generate new credentials with full access to your account on
# the token creation page (https://api.ovh.com/createToken/index.cgi?GET=/*&PUT=/*&POST=/*&DELETE=/*)
client = ovh.Client(
	endpoint='ovh-eu',               # Endpoint of API OVH (List of available endpoints: https://github.com/ovh/python-ovh#2-configure-your-application)
	application_key='xxxxxxxxxx',    # Application Key
	application_secret='xxxxxxxxxx', # Application Secret
	consumer_key='xxxxxxxxxx',       # Consumer Key
)

result = client.get("/sms/{serviceName}/templatesControl/{name}")

# Pretty print
print(json.dumps(result, indent=4))
```

```php
<?php
/**
 * First, download the latest release of PHP wrapper on github
 * And include this script into the folder with extracted files
 */
require __DIR__ . '/vendor/autoload.php';
use \Ovh\Api;

/**
 * Instantiate an OVH Client.
 * You can generate new credentials with full access to your account on
 * the token creation page (https://api.ovh.com/createToken/index.cgi?GET=/*&PUT=/*&POST=/*&DELETE=/*)
 */
$ovh = new Api('xxxxxxxxxx',  // Application Key
               'xxxxxxxxxx',  // Application Secret
               'ovh-eu',      // Endpoint of API OVH (List of available endpoints: https://github.com/ovh/python-ovh#2-configure-your-application)
               'xxxxxxxxxx'); // Consumer Key

$result = $ovh->get("/sms/{serviceName}/templatesControl/{name}");

print_r($result);
?>
```

## Create a message template

`POST /1.0/sms/{serviceName}/templatesControl`

Link: https://developers.eu.ovhcloud.com/reference/web-cloud/sms/send-receive/#post-sms-servicename-templatescontrol

**Status:** Stable production version  
**IAM actions:** `sms:apiovh:templatesControl/create`

Create a message template. Creates a message template and submits it to moderation. Sending SMS to the United States requires a validated template.

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `serviceName` | path | string | yes | The internal name of your SMS offer |

### Request body (required)

Type: `object`

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `activity` | sms.TypeTemplateEnum | yes | Specify the kind of template — one of `alerting`, `authentification`, `transactional` |
| `description` | string |  | Template description |
| `message` | string | yes | Message pattern to be moderated. Use "#VALUE#" format for dynamic text area. |
| `name` | string | yes | Name of the template |
| `reason` | string |  | Message seen by the moderator |

```json
{
  "activity": "alerting",
  "description": "string",
  "message": "string",
  "name": "string",
  "reason": "string"
}
```

### Responses

| Status | Type | Description |
| --- | --- | --- |
| 200 | — | successful operation |

### Example

```bash
curl -X POST \
  "https://api.eu.ovhcloud.com/1.0/sms/{serviceName}/templatesControl" \
  -H "accept: application/json" \
  -H "authorization: Bearer $OVH_TOKEN" \
  -H "content-type: application/json" \
  -d '{ }'
```

```python
'''
First, install the latest release of Python wrapper: $ pip install ovh
'''
import json
import ovh

# Instantiate an OVH Client.
# You can generate new credentials with full access to your account on
# the token creation page (https://api.ovh.com/createToken/index.cgi?GET=/*&PUT=/*&POST=/*&DELETE=/*)
client = ovh.Client(
	endpoint='ovh-eu',               # Endpoint of API OVH (List of available endpoints: https://github.com/ovh/python-ovh#2-configure-your-application)
	application_key='xxxxxxxxxx',    # Application Key
	application_secret='xxxxxxxxxx', # Application Secret
	consumer_key='xxxxxxxxxx',       # Consumer Key
)

# Request body type: string
result = client.post("/sms/{serviceName}/templatesControl",
	activity = None, # Specify the kind of template (type: sms.TypeTemplateEnum)
	description = None, # Template description (type: string, nullable)
	message = None, # Message pattern to be moderated. Use "#VALUE#" format for dynamic text area. (type: string)
	name = None, # Name of the template (type: string)
	reason = None, # Message seen by the moderator (type: string, nullable)
)

# Pretty print
print(json.dumps(result, indent=4))
```

```php
<?php
/**
 * First, download the latest release of PHP wrapper on github
 * And include this script into the folder with extracted files
 */
require __DIR__ . '/vendor/autoload.php';
use \Ovh\Api;

/**
 * Instantiate an OVH Client.
 * You can generate new credentials with full access to your account on
 * the token creation page (https://api.ovh.com/createToken/index.cgi?GET=/*&PUT=/*&POST=/*&DELETE=/*)
 */
$ovh = new Api('xxxxxxxxxx',  // Application Key
               'xxxxxxxxxx',  // Application Secret
               'ovh-eu',      // Endpoint of API OVH (List of available endpoints: https://github.com/ovh/python-ovh#2-configure-your-application)
               'xxxxxxxxxx'); // Consumer Key

// Request body type: string
$result = $ovh->post("/sms/{serviceName}/templatesControl", array(
	activity => null, // Specify the kind of template (type: sms.TypeTemplateEnum)
	description => null, // Template description (type: string, nullable)
	message => null, // Message pattern to be moderated. Use "#VALUE#" format for dynamic text area. (type: string)
	name => null, // Name of the template (type: string)
	reason => null, // Message seen by the moderator (type: string, nullable)
));

print_r($result);
?>
```

## Delete a message template

`DELETE /1.0/sms/{serviceName}/templatesControl/{name}`

Link: https://developers.eu.ovhcloud.com/reference/web-cloud/sms/send-receive/#delete-sms-servicename-templatescontrol-name

**Status:** Stable production version  
**IAM actions:** `sms:apiovh:templatesControl/delete`

Delete a message template. Deletes the message template from the SMS account, whatever its moderation status.

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `name` | path | string | yes | Name of the template |
| `serviceName` | path | string | yes | The internal name of your SMS offer |

### Responses

| Status | Type | Description |
| --- | --- | --- |
| 200 | — | successful operation |

### Example

```bash
curl -X DELETE \
  "https://api.eu.ovhcloud.com/1.0/sms/{serviceName}/templatesControl/{name}" \
  -H "accept: application/json" \
  -H "authorization: Bearer $OVH_TOKEN"
```

```python
'''
First, install the latest release of Python wrapper: $ pip install ovh
'''
import json
import ovh

# Instantiate an OVH Client.
# You can generate new credentials with full access to your account on
# the token creation page (https://api.ovh.com/createToken/index.cgi?GET=/*&PUT=/*&POST=/*&DELETE=/*)
client = ovh.Client(
	endpoint='ovh-eu',               # Endpoint of API OVH (List of available endpoints: https://github.com/ovh/python-ovh#2-configure-your-application)
	application_key='xxxxxxxxxx',    # Application Key
	application_secret='xxxxxxxxxx', # Application Secret
	consumer_key='xxxxxxxxxx',       # Consumer Key
)

result = client.delete("/sms/{serviceName}/templatesControl/{name}")

# Pretty print
print(json.dumps(result, indent=4))
```

```php
<?php
/**
 * First, download the latest release of PHP wrapper on github
 * And include this script into the folder with extracted files
 */
require __DIR__ . '/vendor/autoload.php';
use \Ovh\Api;

/**
 * Instantiate an OVH Client.
 * You can generate new credentials with full access to your account on
 * the token creation page (https://api.ovh.com/createToken/index.cgi?GET=/*&PUT=/*&POST=/*&DELETE=/*)
 */
$ovh = new Api('xxxxxxxxxx',  // Application Key
               'xxxxxxxxxx',  // Application Secret
               'ovh-eu',      // Endpoint of API OVH (List of available endpoints: https://github.com/ovh/python-ovh#2-configure-your-application)
               'xxxxxxxxxx'); // Consumer Key

$result = $ovh->delete("/sms/{serviceName}/templatesControl/{name}");

print_r($result);
?>
```

## Update a message template

`PUT /1.0/sms/{serviceName}/templatesControl/{name}`

Link: https://developers.eu.ovhcloud.com/reference/web-cloud/sms/send-receive/#put-sms-servicename-templatescontrol-name

**Status:** Stable production version  
**IAM actions:** `sms:apiovh:templatesControl/edit`

Update a message template. Updates the message template: description, message pattern with #VALUE# dynamic areas, and kind (alerting, authentification or transactional).

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `name` | path | string | yes | Name of the template |
| `serviceName` | path | string | yes | The internal name of your SMS offer |

### Request body (required)

Type: `sms.TemplateControl`

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `activity` | sms.TypeTemplateEnum |  | Specify the kind of template — one of `alerting`, `authentification`, `transactional` |
| `comment` | string | read-only | Message sent by the moderator |
| `datetime` | string (date-time) | read-only | Template creation datetime |
| `description` | string |  | Template description |
| `message` | string |  | Message pattern to be moderated. Use "#VALUE#" format for dynamic text area. |
| `name` | string |  | Name of the template |
| `status` | sms.StatusSenderEnum |  | Template status — one of `disable`, `enable`, `refused`, `waitingValidation` |

```json
{
  "activity": "alerting",
  "description": "string",
  "message": "string",
  "name": "string",
  "status": "disable"
}
```

### Responses

| Status | Type | Description |
| --- | --- | --- |
| 200 | — | successful operation |

### Example

```bash
curl -X PUT \
  "https://api.eu.ovhcloud.com/1.0/sms/{serviceName}/templatesControl/{name}" \
  -H "accept: application/json" \
  -H "authorization: Bearer $OVH_TOKEN" \
  -H "content-type: application/json" \
  -d '{ }'
```

```python
'''
First, install the latest release of Python wrapper: $ pip install ovh
'''
import json
import ovh

# Instantiate an OVH Client.
# You can generate new credentials with full access to your account on
# the token creation page (https://api.ovh.com/createToken/index.cgi?GET=/*&PUT=/*&POST=/*&DELETE=/*)
client = ovh.Client(
	endpoint='ovh-eu',               # Endpoint of API OVH (List of available endpoints: https://github.com/ovh/python-ovh#2-configure-your-application)
	application_key='xxxxxxxxxx',    # Application Key
	application_secret='xxxxxxxxxx', # Application Secret
	consumer_key='xxxxxxxxxx',       # Consumer Key
)

# Request body type: sms.TemplateControl
result = client.put("/sms/{serviceName}/templatesControl/{name}",
	activity = None, # Specify the kind of template (type: sms.TypeTemplateEnum)
	description = None, # Template description (type: string)
	message = None, # Message pattern to be moderated. Use "#VALUE#" format for dynamic text area. (type: string)
	name = None, # Name of the template (type: string)
	status = None, # Template status (type: sms.StatusSenderEnum)
)

# Pretty print
print(json.dumps(result, indent=4))
```

```php
<?php
/**
 * First, download the latest release of PHP wrapper on github
 * And include this script into the folder with extracted files
 */
require __DIR__ . '/vendor/autoload.php';
use \Ovh\Api;

/**
 * Instantiate an OVH Client.
 * You can generate new credentials with full access to your account on
 * the token creation page (https://api.ovh.com/createToken/index.cgi?GET=/*&PUT=/*&POST=/*&DELETE=/*)
 */
$ovh = new Api('xxxxxxxxxx',  // Application Key
               'xxxxxxxxxx',  // Application Secret
               'ovh-eu',      // Endpoint of API OVH (List of available endpoints: https://github.com/ovh/python-ovh#2-configure-your-application)
               'xxxxxxxxxx'); // Consumer Key

// Request body type: sms.TemplateControl
$result = $ovh->put("/sms/{serviceName}/templatesControl/{name}", array(
	activity => null, // Specify the kind of template (type: sms.TypeTemplateEnum)
	description => null, // Template description (type: string)
	message => null, // Message pattern to be moderated. Use "#VALUE#" format for dynamic text area. (type: string)
	name => null, // Name of the template (type: string)
	status => null, // Template status (type: sms.StatusSenderEnum)
));

print_r($result);
?>
```

## Relaunch template validation

`POST /1.0/sms/{serviceName}/templatesControl/{name}/relaunchValidation`

Link: https://developers.eu.ovhcloud.com/reference/web-cloud/sms/send-receive/#post-sms-servicename-templatescontrol-name-relaunchvalidation

**Status:** Stable production version  
**IAM actions:** `sms:apiovh:templatesControl/relaunchValidation`

Relaunch template validation. Submits the message template to moderation again after a refusal, with an updated message pattern and description.

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `name` | path | string | yes | Name of the template |
| `serviceName` | path | string | yes | The internal name of your SMS offer |

### Request body (required)

Type: `object`

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `description` | string | yes | Template description |
| `message` | string | yes | Message pattern to be moderated. Use "#VALUE#" format for dynamic text area |

```json
{
  "description": "string",
  "message": "string"
}
```

### Responses

| Status | Type | Description |
| --- | --- | --- |
| 200 | — | successful operation |

### Example

```bash
curl -X POST \
  "https://api.eu.ovhcloud.com/1.0/sms/{serviceName}/templatesControl/{name}/relaunchValidation" \
  -H "accept: application/json" \
  -H "authorization: Bearer $OVH_TOKEN" \
  -H "content-type: application/json" \
  -d '{ }'
```

```python
'''
First, install the latest release of Python wrapper: $ pip install ovh
'''
import json
import ovh

# Instantiate an OVH Client.
# You can generate new credentials with full access to your account on
# the token creation page (https://api.ovh.com/createToken/index.cgi?GET=/*&PUT=/*&POST=/*&DELETE=/*)
client = ovh.Client(
	endpoint='ovh-eu',               # Endpoint of API OVH (List of available endpoints: https://github.com/ovh/python-ovh#2-configure-your-application)
	application_key='xxxxxxxxxx',    # Application Key
	application_secret='xxxxxxxxxx', # Application Secret
	consumer_key='xxxxxxxxxx',       # Consumer Key
)

result = client.post("/sms/{serviceName}/templatesControl/{name}/relaunchValidation",
	description = None, # Template description (type: string)
	message = None, # Message pattern to be moderated. Use "#VALUE#" format for dynamic text area (type: string)
)

# Pretty print
print(json.dumps(result, indent=4))
```

```php
<?php
/**
 * First, download the latest release of PHP wrapper on github
 * And include this script into the folder with extracted files
 */
require __DIR__ . '/vendor/autoload.php';
use \Ovh\Api;

/**
 * Instantiate an OVH Client.
 * You can generate new credentials with full access to your account on
 * the token creation page (https://api.ovh.com/createToken/index.cgi?GET=/*&PUT=/*&POST=/*&DELETE=/*)
 */
$ovh = new Api('xxxxxxxxxx',  // Application Key
               'xxxxxxxxxx',  // Application Secret
               'ovh-eu',      // Endpoint of API OVH (List of available endpoints: https://github.com/ovh/python-ovh#2-configure-your-application)
               'xxxxxxxxxx'); // Consumer Key

$result = $ovh->post("/sms/{serviceName}/templatesControl/{name}/relaunchValidation", array(
	description => null, // Template description (type: string)
	message => null, // Message pattern to be moderated. Use "#VALUE#" format for dynamic text area (type: string)
));

print_r($result);
?>
```

## Get a PTT code

`GET /1.0/sms/ptts`

Link: https://developers.eu.ovhcloud.com/reference/web-cloud/sms/send-receive/#get-sms-ptts

**Status:** Stable production version

Get a PTT code. Returns the meaning of a PTT code. The PTT code is the delivery status code of an SMS, given in the ptt field of sent SMS and pending jobs.

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `ptt` | query | integer | yes | The premium transaction tracking code |

### Responses

| Status | Type | Description |
| --- | --- | --- |
| 200 | sms.PttDetails | successful operation |

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `comment` | string |  | Ptt informations |
| `description` | string |  | Ptt short description |
| `duration` | sms.PttDurationTypeEnum |  | Ptt volatility type — one of `indeterminated`, `permanent`, `temporary` |

```json
{
  "comment": "string",
  "description": "string",
  "duration": "indeterminated"
}
```

### Example

```bash
curl -X GET \
  "https://api.eu.ovhcloud.com/1.0/sms/ptts" \
  -H "accept: application/json" \
  -H "authorization: Bearer $OVH_TOKEN"
```

```python
'''
First, install the latest release of Python wrapper: $ pip install ovh
'''
import json
import ovh

# Instantiate an OVH Client.
# You can generate new credentials with full access to your account on
# the token creation page (https://api.ovh.com/createToken/index.cgi?GET=/*&PUT=/*&POST=/*&DELETE=/*)
client = ovh.Client(
	endpoint='ovh-eu',               # Endpoint of API OVH (List of available endpoints: https://github.com/ovh/python-ovh#2-configure-your-application)
	application_key='xxxxxxxxxx',    # Application Key
	application_secret='xxxxxxxxxx', # Application Secret
	consumer_key='xxxxxxxxxx',       # Consumer Key
)

result = client.get("/sms/ptts")

# Pretty print
print(json.dumps(result, indent=4))
```

```php
<?php
/**
 * First, download the latest release of PHP wrapper on github
 * And include this script into the folder with extracted files
 */
require __DIR__ . '/vendor/autoload.php';
use \Ovh\Api;

/**
 * Instantiate an OVH Client.
 * You can generate new credentials with full access to your account on
 * the token creation page (https://api.ovh.com/createToken/index.cgi?GET=/*&PUT=/*&POST=/*&DELETE=/*)
 */
$ovh = new Api('xxxxxxxxxx',  // Application Key
               'xxxxxxxxxx',  // Application Secret
               'ovh-eu',      // Endpoint of API OVH (List of available endpoints: https://github.com/ovh/python-ovh#2-configure-your-application)
               'xxxxxxxxxx'); // Consumer Key

$result = $ovh->get("/sms/ptts");

print_r($result);
?>
```

## List batches

`GET /1.0/sms/{serviceName}/batches`

Link: https://developers.eu.ovhcloud.com/reference/web-cloud/sms/send-receive/#get-sms-servicename-batches

**Status:** Stable production version  
**IAM actions:** `sms:apiovh:batches/get`

Returns the batches of the SMS account.

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `serviceName` | path | string | yes | The internal name of your SMS offer |

### Responses

| Status | Type | Description |
| --- | --- | --- |
| 200 | sms.Batch[] | successful operation |

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `accountID` | integer | read-only | SMS account ID |
| `createdAt` | string (date-time) | read-only | Creation datetime |
| `errors` | sms.BatchError[] | read-only | Details on error(s) on the batch, if any |
| `errors[].message` | string | read-only | Error message |
| `errors[].receiver` | string | read-only | Receiver that triggered the error |
| `estimatedCredits` | number | read-only | The estimated cost of the batch in credits |
| `finishedAt` | string (date-time) | read-only | Datetime when the batch finished processing SMSs |
| `from` | string | read-only | SMS sender |
| `id` | string (uuid) | read-only | Batch ID |
| `message` | string | read-only | SMS message |
| `name` | string | read-only | Batch name |
| `processedRecords` | integer | read-only | Number of processed records in this batch |
| `receivers` | phoneNumber[] | read-only | SMS receivers list |
| `sentAt` | string (date-time) | read-only | Datetime when the SMSs of the batch are sent (based on deferred time if exists) |
| `slotID` | string | read-only | Slot ID |
| `startedAt` | string (date-time) | read-only | Datetime when the batch started processing SMSs |
| `status` | sms.BatchStatusEnum | read-only | Batch status — one of `CANCELED`, `CANCELING`, `COMPLETED`, `FAILED`, `INSERTED`, `INSERTING`, `PENDING`, `TO_CANCEL` |
| `totalRecords` | integer | read-only | Total number of records in this batch |
| `updatedAt` | string (date-time) | read-only | Last update datetime |

```json
[
  {
    "accountID": 0,
    "createdAt": "2024-01-01T12:00:00Z",
    "errors": [
      {
        "message": "string",
        "receiver": "string"
      }
    ],
    "estimatedCredits": 0,
    "finishedAt": "2024-01-01T12:00:00Z",
    "from": "string",
    "id": "00000000-0000-0000-0000-000000000000",
    "message": "string",
    "name": "string",
    "processedRecords": 0,
    "receivers": [
      "string"
    ],
    "sentAt": "2024-01-01T12:00:00Z",
    "slotID": "string",
    "startedAt": "2024-01-01T12:00:00Z",
    "status": "CANCELED",
    "totalRecords": 0,
    "updatedAt": "2024-01-01T12:00:00Z"
  }
]
```

### Example

```bash
curl -X GET \
  "https://api.eu.ovhcloud.com/1.0/sms/{serviceName}/batches" \
  -H "accept: application/json" \
  -H "authorization: Bearer $OVH_TOKEN"
```

```python
'''
First, install the latest release of Python wrapper: $ pip install ovh
'''
import json
import ovh

# Instantiate an OVH Client.
# You can generate new credentials with full access to your account on
# the token creation page (https://api.ovh.com/createToken/index.cgi?GET=/*&PUT=/*&POST=/*&DELETE=/*)
client = ovh.Client(
	endpoint='ovh-eu',               # Endpoint of API OVH (List of available endpoints: https://github.com/ovh/python-ovh#2-configure-your-application)
	application_key='xxxxxxxxxx',    # Application Key
	application_secret='xxxxxxxxxx', # Application Secret
	consumer_key='xxxxxxxxxx',       # Consumer Key
)

result = client.get("/sms/{serviceName}/batches")

# Pretty print
print(json.dumps(result, indent=4))
```

```php
<?php
/**
 * First, download the latest release of PHP wrapper on github
 * And include this script into the folder with extracted files
 */
require __DIR__ . '/vendor/autoload.php';
use \Ovh\Api;

/**
 * Instantiate an OVH Client.
 * You can generate new credentials with full access to your account on
 * the token creation page (https://api.ovh.com/createToken/index.cgi?GET=/*&PUT=/*&POST=/*&DELETE=/*)
 */
$ovh = new Api('xxxxxxxxxx',  // Application Key
               'xxxxxxxxxx',  // Application Secret
               'ovh-eu',      // Endpoint of API OVH (List of available endpoints: https://github.com/ovh/python-ovh#2-configure-your-application)
               'xxxxxxxxxx'); // Consumer Key

$result = $ovh->get("/sms/{serviceName}/batches");

print_r($result);
?>
```

## Create a batch

`POST /1.0/sms/{serviceName}/batches`

Link: https://developers.eu.ovhcloud.com/reference/web-cloud/sms/send-receive/#post-sms-servicename-batches

**Status:** Stable production version  
**IAM actions:** `sms:apiovh:batches/create`

Creates a batch that sends one message to a list of receivers or to a receiver list. Set a sender, or ask for one that allows replies. Sending can be deferred to a later date.

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `serviceName` | path | string | yes | The internal name of your SMS offer |

### Request body (required)

Type: `sms.BatchParams`

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `class` | sms.BatchClassEnum |  | Deprecated: SMS class — one of `FLASH`, `PHONE`, `SIM` |
| `deferred` | string (date-time) |  | SMS deferred sending date |
| `from` | string |  | SMS sender. Either "from" or "senderForResponse" must be passed |
| `message` | string | yes | SMS message |
| `name` | string |  | Batch name |
| `noStop` | boolean |  | STOP clause not needed |
| `senderForResponse` | boolean |  | Ask to compute a sender that allows response. Either "from" or "senderForResponse" must be passed |
| `slotID` | string |  | SMS receivers slot ID. Either "to" or "slotID" must be passed |
| `tag` | string |  | SMS tag |
| `to` | phoneNumber[] |  | SMS receivers list. Either "to" or "slotID" must be passed |

```json
{
  "class": "FLASH",
  "deferred": "2024-01-01T12:00:00Z",
  "from": "string",
  "message": "string",
  "name": "string",
  "noStop": true,
  "senderForResponse": true,
  "slotID": "string",
  "tag": "string",
  "to": [
    "string"
  ]
}
```

### Responses

| Status | Type | Description |
| --- | --- | --- |
| 200 | sms.Batch | successful operation |

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `accountID` | integer | read-only | SMS account ID |
| `createdAt` | string (date-time) | read-only | Creation datetime |
| `errors` | sms.BatchError[] | read-only | Details on error(s) on the batch, if any |
| `errors[].message` | string | read-only | Error message |
| `errors[].receiver` | string | read-only | Receiver that triggered the error |
| `estimatedCredits` | number | read-only | The estimated cost of the batch in credits |
| `finishedAt` | string (date-time) | read-only | Datetime when the batch finished processing SMSs |
| `from` | string | read-only | SMS sender |
| `id` | string (uuid) | read-only | Batch ID |
| `message` | string | read-only | SMS message |
| `name` | string | read-only | Batch name |
| `processedRecords` | integer | read-only | Number of processed records in this batch |
| `receivers` | phoneNumber[] | read-only | SMS receivers list |
| `sentAt` | string (date-time) | read-only | Datetime when the SMSs of the batch are sent (based on deferred time if exists) |
| `slotID` | string | read-only | Slot ID |
| `startedAt` | string (date-time) | read-only | Datetime when the batch started processing SMSs |
| `status` | sms.BatchStatusEnum | read-only | Batch status — one of `CANCELED`, `CANCELING`, `COMPLETED`, `FAILED`, `INSERTED`, `INSERTING`, `PENDING`, `TO_CANCEL` |
| `totalRecords` | integer | read-only | Total number of records in this batch |
| `updatedAt` | string (date-time) | read-only | Last update datetime |

```json
{
  "accountID": 0,
  "createdAt": "2024-01-01T12:00:00Z",
  "errors": [
    {
      "message": "string",
      "receiver": "string"
    }
  ],
  "estimatedCredits": 0,
  "finishedAt": "2024-01-01T12:00:00Z",
  "from": "string",
  "id": "00000000-0000-0000-0000-000000000000",
  "message": "string",
  "name": "string",
  "processedRecords": 0,
  "receivers": [
    "string"
  ],
  "sentAt": "2024-01-01T12:00:00Z",
  "slotID": "string",
  "startedAt": "2024-01-01T12:00:00Z",
  "status": "CANCELED",
  "totalRecords": 0,
  "updatedAt": "2024-01-01T12:00:00Z"
}
```

### Example

```bash
curl -X POST \
  "https://api.eu.ovhcloud.com/1.0/sms/{serviceName}/batches" \
  -H "accept: application/json" \
  -H "authorization: Bearer $OVH_TOKEN" \
  -H "content-type: application/json" \
  -d '{ }'
```

```python
'''
First, install the latest release of Python wrapper: $ pip install ovh
'''
import json
import ovh

# Instantiate an OVH Client.
# You can generate new credentials with full access to your account on
# the token creation page (https://api.ovh.com/createToken/index.cgi?GET=/*&PUT=/*&POST=/*&DELETE=/*)
client = ovh.Client(
	endpoint='ovh-eu',               # Endpoint of API OVH (List of available endpoints: https://github.com/ovh/python-ovh#2-configure-your-application)
	application_key='xxxxxxxxxx',    # Application Key
	application_secret='xxxxxxxxxx', # Application Secret
	consumer_key='xxxxxxxxxx',       # Consumer Key
)

# Request body type: sms.BatchParams
result = client.post("/sms/{serviceName}/batches",
	class = None, # Deprecated: SMS class (type: sms.BatchClassEnum)
	deferred = None, # SMS deferred sending date (type: string)
	from = None, # SMS sender. Either "from" or "senderForResponse" must be passed (type: string)
	message = None, # SMS message (type: string)
	name = None, # Batch name (type: string)
	noStop = None, # STOP clause not needed (type: boolean)
	senderForResponse = None, # Ask to compute a sender that allows response. Either "from" or "senderForResponse" must be passed (type: boolean)
	slotID = None, # SMS receivers slot ID. Either "to" or "slotID" must be passed (type: string)
	tag = None, # SMS tag (type: string)
	to = None, # SMS receivers list. Either "to" or "slotID" must be passed (type: array)
)

# Pretty print
print(json.dumps(result, indent=4))
```

```php
<?php
/**
 * First, download the latest release of PHP wrapper on github
 * And include this script into the folder with extracted files
 */
require __DIR__ . '/vendor/autoload.php';
use \Ovh\Api;

/**
 * Instantiate an OVH Client.
 * You can generate new credentials with full access to your account on
 * the token creation page (https://api.ovh.com/createToken/index.cgi?GET=/*&PUT=/*&POST=/*&DELETE=/*)
 */
$ovh = new Api('xxxxxxxxxx',  // Application Key
               'xxxxxxxxxx',  // Application Secret
               'ovh-eu',      // Endpoint of API OVH (List of available endpoints: https://github.com/ovh/python-ovh#2-configure-your-application)
               'xxxxxxxxxx'); // Consumer Key

// Request body type: sms.BatchParams
$result = $ovh->post("/sms/{serviceName}/batches", array(
	class => null, // Deprecated: SMS class (type: sms.BatchClassEnum)
	deferred => null, // SMS deferred sending date (type: string)
	from => null, // SMS sender. Either "from" or "senderForResponse" must be passed (type: string)
	message => null, // SMS message (type: string)
	name => null, // Batch name (type: string)
	noStop => null, // STOP clause not needed (type: boolean)
	senderForResponse => null, // Ask to compute a sender that allows response. Either "from" or "senderForResponse" must be passed (type: boolean)
	slotID => null, // SMS receivers slot ID. Either "to" or "slotID" must be passed (type: string)
	tag => null, // SMS tag (type: string)
	to => null, // SMS receivers list. Either "to" or "slotID" must be passed (type: array)
));

print_r($result);
?>
```

## Get a batch

`GET /1.0/sms/{serviceName}/batches/{id}`

Link: https://developers.eu.ovhcloud.com/reference/web-cloud/sms/send-receive/#get-sms-servicename-batches-id

**Status:** Stable production version  
**IAM actions:** `sms:apiovh:batches/get`

Returns the batch: message, sender, receivers, status, estimated credits and errors.

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `id` | path | string (uuid) | yes | Id |
| `serviceName` | path | string | yes | The internal name of your SMS offer |

### Responses

| Status | Type | Description |
| --- | --- | --- |
| 200 | sms.Batch | successful operation |

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `accountID` | integer | read-only | SMS account ID |
| `createdAt` | string (date-time) | read-only | Creation datetime |
| `errors` | sms.BatchError[] | read-only | Details on error(s) on the batch, if any |
| `errors[].message` | string | read-only | Error message |
| `errors[].receiver` | string | read-only | Receiver that triggered the error |
| `estimatedCredits` | number | read-only | The estimated cost of the batch in credits |
| `finishedAt` | string (date-time) | read-only | Datetime when the batch finished processing SMSs |
| `from` | string | read-only | SMS sender |
| `id` | string (uuid) | read-only | Batch ID |
| `message` | string | read-only | SMS message |
| `name` | string | read-only | Batch name |
| `processedRecords` | integer | read-only | Number of processed records in this batch |
| `receivers` | phoneNumber[] | read-only | SMS receivers list |
| `sentAt` | string (date-time) | read-only | Datetime when the SMSs of the batch are sent (based on deferred time if exists) |
| `slotID` | string | read-only | Slot ID |
| `startedAt` | string (date-time) | read-only | Datetime when the batch started processing SMSs |
| `status` | sms.BatchStatusEnum | read-only | Batch status — one of `CANCELED`, `CANCELING`, `COMPLETED`, `FAILED`, `INSERTED`, `INSERTING`, `PENDING`, `TO_CANCEL` |
| `totalRecords` | integer | read-only | Total number of records in this batch |
| `updatedAt` | string (date-time) | read-only | Last update datetime |

```json
{
  "accountID": 0,
  "createdAt": "2024-01-01T12:00:00Z",
  "errors": [
    {
      "message": "string",
      "receiver": "string"
    }
  ],
  "estimatedCredits": 0,
  "finishedAt": "2024-01-01T12:00:00Z",
  "from": "string",
  "id": "00000000-0000-0000-0000-000000000000",
  "message": "string",
  "name": "string",
  "processedRecords": 0,
  "receivers": [
    "string"
  ],
  "sentAt": "2024-01-01T12:00:00Z",
  "slotID": "string",
  "startedAt": "2024-01-01T12:00:00Z",
  "status": "CANCELED",
  "totalRecords": 0,
  "updatedAt": "2024-01-01T12:00:00Z"
}
```

### Example

```bash
curl -X GET \
  "https://api.eu.ovhcloud.com/1.0/sms/{serviceName}/batches/{id}" \
  -H "accept: application/json" \
  -H "authorization: Bearer $OVH_TOKEN"
```

```python
'''
First, install the latest release of Python wrapper: $ pip install ovh
'''
import json
import ovh

# Instantiate an OVH Client.
# You can generate new credentials with full access to your account on
# the token creation page (https://api.ovh.com/createToken/index.cgi?GET=/*&PUT=/*&POST=/*&DELETE=/*)
client = ovh.Client(
	endpoint='ovh-eu',               # Endpoint of API OVH (List of available endpoints: https://github.com/ovh/python-ovh#2-configure-your-application)
	application_key='xxxxxxxxxx',    # Application Key
	application_secret='xxxxxxxxxx', # Application Secret
	consumer_key='xxxxxxxxxx',       # Consumer Key
)

result = client.get("/sms/{serviceName}/batches/{id}")

# Pretty print
print(json.dumps(result, indent=4))
```

```php
<?php
/**
 * First, download the latest release of PHP wrapper on github
 * And include this script into the folder with extracted files
 */
require __DIR__ . '/vendor/autoload.php';
use \Ovh\Api;

/**
 * Instantiate an OVH Client.
 * You can generate new credentials with full access to your account on
 * the token creation page (https://api.ovh.com/createToken/index.cgi?GET=/*&PUT=/*&POST=/*&DELETE=/*)
 */
$ovh = new Api('xxxxxxxxxx',  // Application Key
               'xxxxxxxxxx',  // Application Secret
               'ovh-eu',      // Endpoint of API OVH (List of available endpoints: https://github.com/ovh/python-ovh#2-configure-your-application)
               'xxxxxxxxxx'); // Consumer Key

$result = $ovh->get("/sms/{serviceName}/batches/{id}");

print_r($result);
?>
```

## Update a batch

`PUT /1.0/sms/{serviceName}/batches/{id}`

Link: https://developers.eu.ovhcloud.com/reference/web-cloud/sms/send-receive/#put-sms-servicename-batches-id

**Status:** Stable production version  
**IAM actions:** `sms:apiovh:batches/edit`

Updates the batch name.

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `id` | path | string (uuid) | yes | Id |
| `serviceName` | path | string | yes | The internal name of your SMS offer |

### Request body (required)

Type: `sms.BatchUpdateParams`

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `name` | string | yes | Batch name |

```json
{
  "name": "string"
}
```

### Responses

| Status | Type | Description |
| --- | --- | --- |
| 200 | sms.Batch | successful operation |

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `accountID` | integer | read-only | SMS account ID |
| `createdAt` | string (date-time) | read-only | Creation datetime |
| `errors` | sms.BatchError[] | read-only | Details on error(s) on the batch, if any |
| `errors[].message` | string | read-only | Error message |
| `errors[].receiver` | string | read-only | Receiver that triggered the error |
| `estimatedCredits` | number | read-only | The estimated cost of the batch in credits |
| `finishedAt` | string (date-time) | read-only | Datetime when the batch finished processing SMSs |
| `from` | string | read-only | SMS sender |
| `id` | string (uuid) | read-only | Batch ID |
| `message` | string | read-only | SMS message |
| `name` | string | read-only | Batch name |
| `processedRecords` | integer | read-only | Number of processed records in this batch |
| `receivers` | phoneNumber[] | read-only | SMS receivers list |
| `sentAt` | string (date-time) | read-only | Datetime when the SMSs of the batch are sent (based on deferred time if exists) |
| `slotID` | string | read-only | Slot ID |
| `startedAt` | string (date-time) | read-only | Datetime when the batch started processing SMSs |
| `status` | sms.BatchStatusEnum | read-only | Batch status — one of `CANCELED`, `CANCELING`, `COMPLETED`, `FAILED`, `INSERTED`, `INSERTING`, `PENDING`, `TO_CANCEL` |
| `totalRecords` | integer | read-only | Total number of records in this batch |
| `updatedAt` | string (date-time) | read-only | Last update datetime |

```json
{
  "accountID": 0,
  "createdAt": "2024-01-01T12:00:00Z",
  "errors": [
    {
      "message": "string",
      "receiver": "string"
    }
  ],
  "estimatedCredits": 0,
  "finishedAt": "2024-01-01T12:00:00Z",
  "from": "string",
  "id": "00000000-0000-0000-0000-000000000000",
  "message": "string",
  "name": "string",
  "processedRecords": 0,
  "receivers": [
    "string"
  ],
  "sentAt": "2024-01-01T12:00:00Z",
  "slotID": "string",
  "startedAt": "2024-01-01T12:00:00Z",
  "status": "CANCELED",
  "totalRecords": 0,
  "updatedAt": "2024-01-01T12:00:00Z"
}
```

### Example

```bash
curl -X PUT \
  "https://api.eu.ovhcloud.com/1.0/sms/{serviceName}/batches/{id}" \
  -H "accept: application/json" \
  -H "authorization: Bearer $OVH_TOKEN" \
  -H "content-type: application/json" \
  -d '{ }'
```

```python
'''
First, install the latest release of Python wrapper: $ pip install ovh
'''
import json
import ovh

# Instantiate an OVH Client.
# You can generate new credentials with full access to your account on
# the token creation page (https://api.ovh.com/createToken/index.cgi?GET=/*&PUT=/*&POST=/*&DELETE=/*)
client = ovh.Client(
	endpoint='ovh-eu',               # Endpoint of API OVH (List of available endpoints: https://github.com/ovh/python-ovh#2-configure-your-application)
	application_key='xxxxxxxxxx',    # Application Key
	application_secret='xxxxxxxxxx', # Application Secret
	consumer_key='xxxxxxxxxx',       # Consumer Key
)

# Request body type: sms.BatchUpdateParams
result = client.put("/sms/{serviceName}/batches/{id}",
	name = None, # Batch name (type: string)
)

# Pretty print
print(json.dumps(result, indent=4))
```

```php
<?php
/**
 * First, download the latest release of PHP wrapper on github
 * And include this script into the folder with extracted files
 */
require __DIR__ . '/vendor/autoload.php';
use \Ovh\Api;

/**
 * Instantiate an OVH Client.
 * You can generate new credentials with full access to your account on
 * the token creation page (https://api.ovh.com/createToken/index.cgi?GET=/*&PUT=/*&POST=/*&DELETE=/*)
 */
$ovh = new Api('xxxxxxxxxx',  // Application Key
               'xxxxxxxxxx',  // Application Secret
               'ovh-eu',      // Endpoint of API OVH (List of available endpoints: https://github.com/ovh/python-ovh#2-configure-your-application)
               'xxxxxxxxxx'); // Consumer Key

// Request body type: sms.BatchUpdateParams
$result = $ovh->put("/sms/{serviceName}/batches/{id}", array(
	name => null, // Batch name (type: string)
));

print_r($result);
?>
```

## Delete a batch

`DELETE /1.0/sms/{serviceName}/batches/{id}`

Link: https://developers.eu.ovhcloud.com/reference/web-cloud/sms/send-receive/#delete-sms-servicename-batches-id

**Status:** Stable production version  
**IAM actions:** `sms:apiovh:batches/delete`

Deletes the batch.

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `id` | path | string (uuid) | yes | Id |
| `serviceName` | path | string | yes | The internal name of your SMS offer |

### Responses

| Status | Type | Description |
| --- | --- | --- |
| 200 | — | successful operation |

### Example

```bash
curl -X DELETE \
  "https://api.eu.ovhcloud.com/1.0/sms/{serviceName}/batches/{id}" \
  -H "accept: application/json" \
  -H "authorization: Bearer $OVH_TOKEN"
```

```python
'''
First, install the latest release of Python wrapper: $ pip install ovh
'''
import json
import ovh

# Instantiate an OVH Client.
# You can generate new credentials with full access to your account on
# the token creation page (https://api.ovh.com/createToken/index.cgi?GET=/*&PUT=/*&POST=/*&DELETE=/*)
client = ovh.Client(
	endpoint='ovh-eu',               # Endpoint of API OVH (List of available endpoints: https://github.com/ovh/python-ovh#2-configure-your-application)
	application_key='xxxxxxxxxx',    # Application Key
	application_secret='xxxxxxxxxx', # Application Secret
	consumer_key='xxxxxxxxxx',       # Consumer Key
)

result = client.delete("/sms/{serviceName}/batches/{id}")

# Pretty print
print(json.dumps(result, indent=4))
```

```php
<?php
/**
 * First, download the latest release of PHP wrapper on github
 * And include this script into the folder with extracted files
 */
require __DIR__ . '/vendor/autoload.php';
use \Ovh\Api;

/**
 * Instantiate an OVH Client.
 * You can generate new credentials with full access to your account on
 * the token creation page (https://api.ovh.com/createToken/index.cgi?GET=/*&PUT=/*&POST=/*&DELETE=/*)
 */
$ovh = new Api('xxxxxxxxxx',  // Application Key
               'xxxxxxxxxx',  // Application Secret
               'ovh-eu',      // Endpoint of API OVH (List of available endpoints: https://github.com/ovh/python-ovh#2-configure-your-application)
               'xxxxxxxxxx'); // Consumer Key

$result = $ovh->delete("/sms/{serviceName}/batches/{id}");

print_r($result);
?>
```

## Cancel a deferred batch

`POST /1.0/sms/{serviceName}/batches/{id}/cancel`

Link: https://developers.eu.ovhcloud.com/reference/web-cloud/sms/send-receive/#post-sms-servicename-batches-id-cancel

**Status:** Stable production version  
**IAM actions:** `sms:apiovh:batches/cancel`

Cancels a batch scheduled for later. Only possible if no SMS of the batch has been sent yet.

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `id` | path | string (uuid) | yes | Id |
| `serviceName` | path | string | yes | The internal name of your SMS offer |

### Responses

| Status | Type | Description |
| --- | --- | --- |
| 200 | sms.Batch | successful operation |

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `accountID` | integer | read-only | SMS account ID |
| `createdAt` | string (date-time) | read-only | Creation datetime |
| `errors` | sms.BatchError[] | read-only | Details on error(s) on the batch, if any |
| `errors[].message` | string | read-only | Error message |
| `errors[].receiver` | string | read-only | Receiver that triggered the error |
| `estimatedCredits` | number | read-only | The estimated cost of the batch in credits |
| `finishedAt` | string (date-time) | read-only | Datetime when the batch finished processing SMSs |
| `from` | string | read-only | SMS sender |
| `id` | string (uuid) | read-only | Batch ID |
| `message` | string | read-only | SMS message |
| `name` | string | read-only | Batch name |
| `processedRecords` | integer | read-only | Number of processed records in this batch |
| `receivers` | phoneNumber[] | read-only | SMS receivers list |
| `sentAt` | string (date-time) | read-only | Datetime when the SMSs of the batch are sent (based on deferred time if exists) |
| `slotID` | string | read-only | Slot ID |
| `startedAt` | string (date-time) | read-only | Datetime when the batch started processing SMSs |
| `status` | sms.BatchStatusEnum | read-only | Batch status — one of `CANCELED`, `CANCELING`, `COMPLETED`, `FAILED`, `INSERTED`, `INSERTING`, `PENDING`, `TO_CANCEL` |
| `totalRecords` | integer | read-only | Total number of records in this batch |
| `updatedAt` | string (date-time) | read-only | Last update datetime |

```json
{
  "accountID": 0,
  "createdAt": "2024-01-01T12:00:00Z",
  "errors": [
    {
      "message": "string",
      "receiver": "string"
    }
  ],
  "estimatedCredits": 0,
  "finishedAt": "2024-01-01T12:00:00Z",
  "from": "string",
  "id": "00000000-0000-0000-0000-000000000000",
  "message": "string",
  "name": "string",
  "processedRecords": 0,
  "receivers": [
    "string"
  ],
  "sentAt": "2024-01-01T12:00:00Z",
  "slotID": "string",
  "startedAt": "2024-01-01T12:00:00Z",
  "status": "CANCELED",
  "totalRecords": 0,
  "updatedAt": "2024-01-01T12:00:00Z"
}
```

### Example

```bash
curl -X POST \
  "https://api.eu.ovhcloud.com/1.0/sms/{serviceName}/batches/{id}/cancel" \
  -H "accept: application/json" \
  -H "authorization: Bearer $OVH_TOKEN"
```

```python
'''
First, install the latest release of Python wrapper: $ pip install ovh
'''
import json
import ovh

# Instantiate an OVH Client.
# You can generate new credentials with full access to your account on
# the token creation page (https://api.ovh.com/createToken/index.cgi?GET=/*&PUT=/*&POST=/*&DELETE=/*)
client = ovh.Client(
	endpoint='ovh-eu',               # Endpoint of API OVH (List of available endpoints: https://github.com/ovh/python-ovh#2-configure-your-application)
	application_key='xxxxxxxxxx',    # Application Key
	application_secret='xxxxxxxxxx', # Application Secret
	consumer_key='xxxxxxxxxx',       # Consumer Key
)

result = client.post("/sms/{serviceName}/batches/{id}/cancel")

# Pretty print
print(json.dumps(result, indent=4))
```

```php
<?php
/**
 * First, download the latest release of PHP wrapper on github
 * And include this script into the folder with extracted files
 */
require __DIR__ . '/vendor/autoload.php';
use \Ovh\Api;

/**
 * Instantiate an OVH Client.
 * You can generate new credentials with full access to your account on
 * the token creation page (https://api.ovh.com/createToken/index.cgi?GET=/*&PUT=/*&POST=/*&DELETE=/*)
 */
$ovh = new Api('xxxxxxxxxx',  // Application Key
               'xxxxxxxxxx',  // Application Secret
               'ovh-eu',      // Endpoint of API OVH (List of available endpoints: https://github.com/ovh/python-ovh#2-configure-your-application)
               'xxxxxxxxxx'); // Consumer Key

$result = $ovh->post("/sms/{serviceName}/batches/{id}/cancel");

print_r($result);
?>
```

## Get batch statistics

`GET /1.0/sms/{serviceName}/batches/{id}/statistics`

Link: https://developers.eu.ovhcloud.com/reference/web-cloud/sms/send-receive/#get-sms-servicename-batches-id-statistics

**Status:** Stable production version  
**IAM actions:** `sms:apiovh:batches/statistics/get`

Returns the batch statistics: delivered, sent, pending, failed and stoplisted SMS, and the credits used.

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `id` | path | string (uuid) | yes | Id |
| `serviceName` | path | string | yes | The internal name of your SMS offer |

### Responses

| Status | Type | Description |
| --- | --- | --- |
| 200 | sms.BatchStatistics | successful operation |

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `credits` | number | read-only | The cost of the batch in credits, computed during batch processing |
| `delivered` | integer | read-only | Number of SMS that are delivered |
| `estimatedCredits` | number | read-only | The estimated cost of the batch in credits, computed before batch processing |
| `failed` | integer | read-only | Number of SMS in error |
| `id` | string (uuid) | read-only | Batch ID |
| `pending` | integer | read-only | Number of SMS that are in pending status |
| `sent` | integer | read-only | Number of SMS that are sent to the broker |
| `stoplisted` | integer | read-only | Number of SMS that received a STOP by the receiver |

```json
{
  "credits": 0,
  "delivered": 0,
  "estimatedCredits": 0,
  "failed": 0,
  "id": "00000000-0000-0000-0000-000000000000",
  "pending": 0,
  "sent": 0,
  "stoplisted": 0
}
```

### Example

```bash
curl -X GET \
  "https://api.eu.ovhcloud.com/1.0/sms/{serviceName}/batches/{id}/statistics" \
  -H "accept: application/json" \
  -H "authorization: Bearer $OVH_TOKEN"
```

```python
'''
First, install the latest release of Python wrapper: $ pip install ovh
'''
import json
import ovh

# Instantiate an OVH Client.
# You can generate new credentials with full access to your account on
# the token creation page (https://api.ovh.com/createToken/index.cgi?GET=/*&PUT=/*&POST=/*&DELETE=/*)
client = ovh.Client(
	endpoint='ovh-eu',               # Endpoint of API OVH (List of available endpoints: https://github.com/ovh/python-ovh#2-configure-your-application)
	application_key='xxxxxxxxxx',    # Application Key
	application_secret='xxxxxxxxxx', # Application Secret
	consumer_key='xxxxxxxxxx',       # Consumer Key
)

result = client.get("/sms/{serviceName}/batches/{id}/statistics")

# Pretty print
print(json.dumps(result, indent=4))
```

```php
<?php
/**
 * First, download the latest release of PHP wrapper on github
 * And include this script into the folder with extracted files
 */
require __DIR__ . '/vendor/autoload.php';
use \Ovh\Api;

/**
 * Instantiate an OVH Client.
 * You can generate new credentials with full access to your account on
 * the token creation page (https://api.ovh.com/createToken/index.cgi?GET=/*&PUT=/*&POST=/*&DELETE=/*)
 */
$ovh = new Api('xxxxxxxxxx',  // Application Key
               'xxxxxxxxxx',  // Application Secret
               'ovh-eu',      // Endpoint of API OVH (List of available endpoints: https://github.com/ovh/python-ovh#2-configure-your-application)
               'xxxxxxxxxx'); // Consumer Key

$result = $ovh->get("/sms/{serviceName}/batches/{id}/statistics");

print_r($result);
?>
```

## List sent SMS

`GET /1.0/sms/{serviceName}/outgoing`

Link: https://developers.eu.ovhcloud.com/reference/web-cloud/sms/send-receive/#get-sms-servicename-outgoing

**Status:** Stable production version  
**IAM actions:** `sms:apiovh:outgoing/get`

Returns the identifiers of the SMS sent from the account.

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `batchID` | query | string (uuid) |  | Filter on batch id property (=) |
| `creationDatetime.from` | query | string (date-time) |  | Filter on creationDatetime property (>=) |
| `creationDatetime.to` | query | string (date-time) |  | Filter on creationDatetime property (<=) |
| `deliveryReceipt` | query | integer |  | Filter on deliveryReceipt property (=) |
| `differedDelivery` | query | integer |  | Filter on differedDelivery property (=) |
| `messageID` | query | string (uuid) |  | Filter on message id property (=) |
| `ptt` | query | integer |  | Filter on ptt property (=) |
| `receiver` | query | string |  | Filter on receiver property (=) |
| `sender` | query | string |  | Filter on sender property (=) |
| `serviceName` | path | string | yes | The internal name of your SMS offer |
| `tag` | query | string |  | Filter on tag property (=) |

### Responses

| Status | Type | Description |
| --- | --- | --- |
| 200 | integer[] | successful operation |

```json
[
  0
]
```

### Example

```bash
curl -X GET \
  "https://api.eu.ovhcloud.com/1.0/sms/{serviceName}/outgoing" \
  -H "accept: application/json" \
  -H "authorization: Bearer $OVH_TOKEN"
```

```python
'''
First, install the latest release of Python wrapper: $ pip install ovh
'''
import json
import ovh

# Instantiate an OVH Client.
# You can generate new credentials with full access to your account on
# the token creation page (https://api.ovh.com/createToken/index.cgi?GET=/*&PUT=/*&POST=/*&DELETE=/*)
client = ovh.Client(
	endpoint='ovh-eu',               # Endpoint of API OVH (List of available endpoints: https://github.com/ovh/python-ovh#2-configure-your-application)
	application_key='xxxxxxxxxx',    # Application Key
	application_secret='xxxxxxxxxx', # Application Secret
	consumer_key='xxxxxxxxxx',       # Consumer Key
)

result = client.get("/sms/{serviceName}/outgoing")

# Pretty print
print(json.dumps(result, indent=4))
```

```php
<?php
/**
 * First, download the latest release of PHP wrapper on github
 * And include this script into the folder with extracted files
 */
require __DIR__ . '/vendor/autoload.php';
use \Ovh\Api;

/**
 * Instantiate an OVH Client.
 * You can generate new credentials with full access to your account on
 * the token creation page (https://api.ovh.com/createToken/index.cgi?GET=/*&PUT=/*&POST=/*&DELETE=/*)
 */
$ovh = new Api('xxxxxxxxxx',  // Application Key
               'xxxxxxxxxx',  // Application Secret
               'ovh-eu',      // Endpoint of API OVH (List of available endpoints: https://github.com/ovh/python-ovh#2-configure-your-application)
               'xxxxxxxxxx'); // Consumer Key

$result = $ovh->get("/sms/{serviceName}/outgoing");

print_r($result);
?>
```

## Get a sent SMS

`GET /1.0/sms/{serviceName}/outgoing/{id}`

Link: https://developers.eu.ovhcloud.com/reference/web-cloud/sms/send-receive/#get-sms-servicename-outgoing-id

**Status:** Stable production version  
**IAM actions:** `sms:apiovh:outgoing/get`

Returns the sent SMS: receiver, message, delivery status, number of SMS parts and credits used.

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `id` | path | integer | yes | Id |
| `serviceName` | path | string | yes | The internal name of your SMS offer |

### Responses

| Status | Type | Description |
| --- | --- | --- |
| 200 | sms.Outgoing | successful operation |

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `creationDatetime` | string (date-time) | read-only |  |
| `credits` | number | read-only |  |
| `deliveredAt` | string (date-time) | read-only |  |
| `deliveryReceipt` | integer | read-only |  |
| `differedDelivery` | integer | read-only |  |
| `id` | integer | read-only |  |
| `message` | string | read-only |  |
| `messageLength` | integer | read-only |  |
| `numberOfSms` | integer | read-only |  |
| `ptt` | integer | read-only |  |
| `receiver` | string | read-only |  |
| `sender` | string | read-only |  |
| `sentAt` | string (date-time) | read-only |  |
| `tag` | string | read-only |  |
| `tariffCode` | string | read-only | Tariff code applied on the sms |

```json
{
  "creationDatetime": "2024-01-01T12:00:00Z",
  "credits": 0,
  "deliveredAt": "2024-01-01T12:00:00Z",
  "deliveryReceipt": 0,
  "differedDelivery": 0,
  "id": 0,
  "message": "string",
  "messageLength": 0,
  "numberOfSms": 0,
  "ptt": 0,
  "receiver": "string",
  "sender": "string",
  "sentAt": "2024-01-01T12:00:00Z",
  "tag": "string",
  "tariffCode": "string"
}
```

### Example

```bash
curl -X GET \
  "https://api.eu.ovhcloud.com/1.0/sms/{serviceName}/outgoing/{id}" \
  -H "accept: application/json" \
  -H "authorization: Bearer $OVH_TOKEN"
```

```python
'''
First, install the latest release of Python wrapper: $ pip install ovh
'''
import json
import ovh

# Instantiate an OVH Client.
# You can generate new credentials with full access to your account on
# the token creation page (https://api.ovh.com/createToken/index.cgi?GET=/*&PUT=/*&POST=/*&DELETE=/*)
client = ovh.Client(
	endpoint='ovh-eu',               # Endpoint of API OVH (List of available endpoints: https://github.com/ovh/python-ovh#2-configure-your-application)
	application_key='xxxxxxxxxx',    # Application Key
	application_secret='xxxxxxxxxx', # Application Secret
	consumer_key='xxxxxxxxxx',       # Consumer Key
)

result = client.get("/sms/{serviceName}/outgoing/{id}")

# Pretty print
print(json.dumps(result, indent=4))
```

```php
<?php
/**
 * First, download the latest release of PHP wrapper on github
 * And include this script into the folder with extracted files
 */
require __DIR__ . '/vendor/autoload.php';
use \Ovh\Api;

/**
 * Instantiate an OVH Client.
 * You can generate new credentials with full access to your account on
 * the token creation page (https://api.ovh.com/createToken/index.cgi?GET=/*&PUT=/*&POST=/*&DELETE=/*)
 */
$ovh = new Api('xxxxxxxxxx',  // Application Key
               'xxxxxxxxxx',  // Application Secret
               'ovh-eu',      // Endpoint of API OVH (List of available endpoints: https://github.com/ovh/python-ovh#2-configure-your-application)
               'xxxxxxxxxx'); // Consumer Key

$result = $ovh->get("/sms/{serviceName}/outgoing/{id}");

print_r($result);
?>
```

## Delete a sent SMS

`DELETE /1.0/sms/{serviceName}/outgoing/{id}`

Link: https://developers.eu.ovhcloud.com/reference/web-cloud/sms/send-receive/#delete-sms-servicename-outgoing-id

**Status:** Stable production version  
**IAM actions:** `sms:apiovh:outgoing/delete`

Deletes the sent SMS from the history.

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `id` | path | integer | yes | Id |
| `serviceName` | path | string | yes | The internal name of your SMS offer |

### Responses

| Status | Type | Description |
| --- | --- | --- |
| 200 | — | successful operation |

### Example

```bash
curl -X DELETE \
  "https://api.eu.ovhcloud.com/1.0/sms/{serviceName}/outgoing/{id}" \
  -H "accept: application/json" \
  -H "authorization: Bearer $OVH_TOKEN"
```

```python
'''
First, install the latest release of Python wrapper: $ pip install ovh
'''
import json
import ovh

# Instantiate an OVH Client.
# You can generate new credentials with full access to your account on
# the token creation page (https://api.ovh.com/createToken/index.cgi?GET=/*&PUT=/*&POST=/*&DELETE=/*)
client = ovh.Client(
	endpoint='ovh-eu',               # Endpoint of API OVH (List of available endpoints: https://github.com/ovh/python-ovh#2-configure-your-application)
	application_key='xxxxxxxxxx',    # Application Key
	application_secret='xxxxxxxxxx', # Application Secret
	consumer_key='xxxxxxxxxx',       # Consumer Key
)

result = client.delete("/sms/{serviceName}/outgoing/{id}")

# Pretty print
print(json.dumps(result, indent=4))
```

```php
<?php
/**
 * First, download the latest release of PHP wrapper on github
 * And include this script into the folder with extracted files
 */
require __DIR__ . '/vendor/autoload.php';
use \Ovh\Api;

/**
 * Instantiate an OVH Client.
 * You can generate new credentials with full access to your account on
 * the token creation page (https://api.ovh.com/createToken/index.cgi?GET=/*&PUT=/*&POST=/*&DELETE=/*)
 */
$ovh = new Api('xxxxxxxxxx',  // Application Key
               'xxxxxxxxxx',  // Application Secret
               'ovh-eu',      // Endpoint of API OVH (List of available endpoints: https://github.com/ovh/python-ovh#2-configure-your-application)
               'xxxxxxxxxx'); // Consumer Key

$result = $ovh->delete("/sms/{serviceName}/outgoing/{id}");

print_r($result);
?>
```
