# Web Cloud › Email and Collaborative Solutions › Microsoft 365 Resellers › Subscriptions 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

> 8 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/email-and-collaborative-solutions/microsoft-365-resellers/subscriptions/

OpenAPI v1: https://api.eu.ovhcloud.com/1.0/__schemas/developer-hub-navigation/web-cloud/email-and-collaborative-solutions/microsoft-365-resellers/subscriptions.json?format=openapi3
OpenAPI v2: https://api.eu.ovhcloud.com/v2/__schemas/developer-hub-navigation/web-cloud/email-and-collaborative-solutions/microsoft-365-resellers/subscriptions.json?format=openapi3

## Operations

- `GET /saas/csp2/{serviceName}/subscription` — List subscriptions
- `GET /saas/csp2/{serviceName}/subscription/{id}` — Get a subscription
- `POST /saas/csp2/{serviceName}/subscription` — Create a subscription
- `DELETE /saas/csp2/{serviceName}/subscription/{id}` — Delete a subscription
- `GET /saas/csp2/{serviceName}/subscription/{id}/addonsSubscriptionIds` — List add-on subscriptions
- `GET /saas/csp2/{serviceName}/subscription/{id}/availableAddonLicenses` — List available add-on licenses
- `POST /saas/csp2/{serviceName}/subscription/{id}/changeQuantity` — Change a subscription quantity
- `POST /saas/csp2/{serviceName}/subscription/{id}/orderAddon` — Order an add-on subscription

## List subscriptions

`GET /1.0/saas/csp2/{serviceName}/subscription`

Link: https://developers.eu.ovhcloud.com/reference/web-cloud/email-and-collaborative-solutions/microsoft-365-resellers/subscriptions/#get-saas-csp2-servicename-subscription

**Status:** Alpha version  
**IAM actions:** `cspReseller:apiovh:subscription/get`

Returns the IDs of the subscriptions of the tenant.

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `serviceName` | path | string | yes | Service name |

### Responses

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

```json
[
  0
]
```

### Example

```bash
curl -X GET \
  "https://api.eu.ovhcloud.com/1.0/saas/csp2/{serviceName}/subscription" \
  -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("/saas/csp2/{serviceName}/subscription")

# 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("/saas/csp2/{serviceName}/subscription");

print_r($result);
?>
```

## Get a subscription

`GET /1.0/saas/csp2/{serviceName}/subscription/{id}`

Link: https://developers.eu.ovhcloud.com/reference/web-cloud/email-and-collaborative-solutions/microsoft-365-resellers/subscriptions/#get-saas-csp2-servicename-subscription-id

**Status:** Alpha version  
**IAM actions:** `cspReseller:apiovh:subscription/get`

Returns the license ID, number of licenses, status, and creation and last update dates of the subscription.

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `id` | path | integer | yes | Id |
| `serviceName` | path | string | yes | Service name |

### Responses

| Status | Type | Description |
| --- | --- | --- |
| 200 | saas.csp2.OfficeSubscription | successful operation |

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `creationDate` | string (date-time) | read-only | Creation date |
| `id` | integer | read-only | Subscription's unique identifier |
| `lastUpdate` | string (date-time) | read-only | Last update date |
| `licenseId` | integer | read-only | License's type id |
| `quantity` | integer | read-only | Number of available licenses |
| `status` | string | read-only | Subscription's status |
| `taskPendingId` | integer | read-only | Pending task's unique identifier |

```json
{
  "creationDate": "2024-01-01T12:00:00Z",
  "id": 0,
  "lastUpdate": "2024-01-01T12:00:00Z",
  "licenseId": 0,
  "quantity": 0,
  "status": "string",
  "taskPendingId": 0
}
```

### Example

```bash
curl -X GET \
  "https://api.eu.ovhcloud.com/1.0/saas/csp2/{serviceName}/subscription/{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("/saas/csp2/{serviceName}/subscription/{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("/saas/csp2/{serviceName}/subscription/{id}");

print_r($result);
?>
```

## Create a subscription

`POST /1.0/saas/csp2/{serviceName}/subscription`

Link: https://developers.eu.ovhcloud.com/reference/web-cloud/email-and-collaborative-solutions/microsoft-365-resellers/subscriptions/#post-saas-csp2-servicename-subscription

**Status:** Alpha version  
**IAM actions:** `cspReseller:apiovh:subscription/create`

Creates a subscription for `quantity` licenses of the license `licenseId`, and returns the task. Get the license IDs from orderableLicenses.

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `serviceName` | path | string | yes | Service name |

### Request body (required)

Type: `saas.csp2.SubscriptionCreation`

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `licenseId` | integer | yes | License's type unique identifier |
| `quantity` | integer | yes | Quantity of licenses to order |

```json
{
  "licenseId": 0,
  "quantity": 0
}
```

### Responses

| Status | Type | Description |
| --- | --- | --- |
| 200 | saas.csp2.OfficeTask | successful operation |

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `finishDate` | string (date-time) | read-only | Completion date |
| `function` | string | read-only | Function name |
| `id` | integer | read-only | Unique identifier of the task |
| `status` | saas.csp2.TaskStatusEnum | read-only | Task state — one of `cancelled`, `doing`, `done`, `error`, `todo` |
| `todoDate` | string (date-time) | read-only | Creation date |

```json
{
  "finishDate": "2024-01-01T12:00:00Z",
  "function": "string",
  "id": 0,
  "status": "cancelled",
  "todoDate": "2024-01-01T12:00:00Z"
}
```

### Example

```bash
curl -X POST \
  "https://api.eu.ovhcloud.com/1.0/saas/csp2/{serviceName}/subscription" \
  -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: saas.csp2.SubscriptionCreation
result = client.post("/saas/csp2/{serviceName}/subscription",
	licenseId = None, # License's type unique identifier (type: integer)
	quantity = None, # Quantity of licenses to order (type: integer)
)

# 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: saas.csp2.SubscriptionCreation
$result = $ovh->post("/saas/csp2/{serviceName}/subscription", array(
	licenseId => null, // License's type unique identifier (type: integer)
	quantity => null, // Quantity of licenses to order (type: integer)
));

print_r($result);
?>
```

## Delete a subscription

`DELETE /1.0/saas/csp2/{serviceName}/subscription/{id}`

Link: https://developers.eu.ovhcloud.com/reference/web-cloud/email-and-collaborative-solutions/microsoft-365-resellers/subscriptions/#delete-saas-csp2-servicename-subscription-id

**Status:** Alpha version  
**IAM actions:** `cspReseller:apiovh:subscription/delete`

Deletes the subscription from the tenant and returns the task.

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `id` | path | integer | yes | Id |
| `serviceName` | path | string | yes | Service name |

### Responses

| Status | Type | Description |
| --- | --- | --- |
| 200 | saas.csp2.OfficeTask | successful operation |

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `finishDate` | string (date-time) | read-only | Completion date |
| `function` | string | read-only | Function name |
| `id` | integer | read-only | Unique identifier of the task |
| `status` | saas.csp2.TaskStatusEnum | read-only | Task state — one of `cancelled`, `doing`, `done`, `error`, `todo` |
| `todoDate` | string (date-time) | read-only | Creation date |

```json
{
  "finishDate": "2024-01-01T12:00:00Z",
  "function": "string",
  "id": 0,
  "status": "cancelled",
  "todoDate": "2024-01-01T12:00:00Z"
}
```

### Example

```bash
curl -X DELETE \
  "https://api.eu.ovhcloud.com/1.0/saas/csp2/{serviceName}/subscription/{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("/saas/csp2/{serviceName}/subscription/{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("/saas/csp2/{serviceName}/subscription/{id}");

print_r($result);
?>
```

## List add-on subscriptions

`GET /1.0/saas/csp2/{serviceName}/subscription/{id}/addonsSubscriptionIds`

Link: https://developers.eu.ovhcloud.com/reference/web-cloud/email-and-collaborative-solutions/microsoft-365-resellers/subscriptions/#get-saas-csp2-servicename-subscription-id-addonssubscriptionids

**Status:** Alpha version  
**IAM actions:** `cspReseller:apiovh:subscription/addonsSubscriptionIds/get`

Returns the IDs of the add-on subscriptions attached to the subscription.

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `id` | path | integer | yes | Id |
| `serviceName` | path | string | yes | Service name |

### Responses

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

```json
[
  0
]
```

### Example

```bash
curl -X GET \
  "https://api.eu.ovhcloud.com/1.0/saas/csp2/{serviceName}/subscription/{id}/addonsSubscriptionIds" \
  -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("/saas/csp2/{serviceName}/subscription/{id}/addonsSubscriptionIds")

# 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("/saas/csp2/{serviceName}/subscription/{id}/addonsSubscriptionIds");

print_r($result);
?>
```

## List available add-on licenses

`GET /1.0/saas/csp2/{serviceName}/subscription/{id}/availableAddonLicenses`

Link: https://developers.eu.ovhcloud.com/reference/web-cloud/email-and-collaborative-solutions/microsoft-365-resellers/subscriptions/#get-saas-csp2-servicename-subscription-id-availableaddonlicenses

**Status:** Alpha version  
**IAM actions:** `cspReseller:apiovh:subscription/availableAddonLicenses/get`

Returns the IDs of the licenses that can be ordered as an add-on for the subscription.

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `id` | path | integer | yes | Id |
| `serviceName` | path | string | yes | Service name |

### Responses

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

```json
[
  0
]
```

### Example

```bash
curl -X GET \
  "https://api.eu.ovhcloud.com/1.0/saas/csp2/{serviceName}/subscription/{id}/availableAddonLicenses" \
  -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("/saas/csp2/{serviceName}/subscription/{id}/availableAddonLicenses")

# 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("/saas/csp2/{serviceName}/subscription/{id}/availableAddonLicenses");

print_r($result);
?>
```

## Change a subscription quantity

`POST /1.0/saas/csp2/{serviceName}/subscription/{id}/changeQuantity`

Link: https://developers.eu.ovhcloud.com/reference/web-cloud/email-and-collaborative-solutions/microsoft-365-resellers/subscriptions/#post-saas-csp2-servicename-subscription-id-changequantity

**Status:** Alpha version  
**IAM actions:** `cspReseller:apiovh:subscription/changeQuantity`

Sets the number of seats of the subscription to `quantity`, and returns the task.

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `id` | path | integer | yes | Id |
| `serviceName` | path | string | yes | Service name |

### Request body (required)

Type: `saas.csp2.SubscriptionChangeQuantityCreation`

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `quantity` | integer | yes | New seat quantity |

```json
{
  "quantity": 0
}
```

### Responses

| Status | Type | Description |
| --- | --- | --- |
| 200 | saas.csp2.OfficeTask | successful operation |

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `finishDate` | string (date-time) | read-only | Completion date |
| `function` | string | read-only | Function name |
| `id` | integer | read-only | Unique identifier of the task |
| `status` | saas.csp2.TaskStatusEnum | read-only | Task state — one of `cancelled`, `doing`, `done`, `error`, `todo` |
| `todoDate` | string (date-time) | read-only | Creation date |

```json
{
  "finishDate": "2024-01-01T12:00:00Z",
  "function": "string",
  "id": 0,
  "status": "cancelled",
  "todoDate": "2024-01-01T12:00:00Z"
}
```

### Example

```bash
curl -X POST \
  "https://api.eu.ovhcloud.com/1.0/saas/csp2/{serviceName}/subscription/{id}/changeQuantity" \
  -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: saas.csp2.SubscriptionChangeQuantityCreation
result = client.post("/saas/csp2/{serviceName}/subscription/{id}/changeQuantity",
	quantity = None, # New seat quantity (type: integer)
)

# 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: saas.csp2.SubscriptionChangeQuantityCreation
$result = $ovh->post("/saas/csp2/{serviceName}/subscription/{id}/changeQuantity", array(
	quantity => null, // New seat quantity (type: integer)
));

print_r($result);
?>
```

## Order an add-on subscription

`POST /1.0/saas/csp2/{serviceName}/subscription/{id}/orderAddon`

Link: https://developers.eu.ovhcloud.com/reference/web-cloud/email-and-collaborative-solutions/microsoft-365-resellers/subscriptions/#post-saas-csp2-servicename-subscription-id-orderaddon

**Status:** Alpha version  
**IAM actions:** `cspReseller:apiovh:subscription/orderAddon`

Creates an add-on subscription for the subscription, with `quantity` seats of the license `licenseId`, and returns the task. Get the license IDs from availableAddonLicenses.

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `id` | path | integer | yes | Id |
| `serviceName` | path | string | yes | Service name |

### Request body (required)

Type: `saas.csp2.SubscriptionOrderAddonCreation`

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `licenseId` | integer | yes | License id associated to this addon subscription (see subscription/<id>/availableAddonLicenses) |
| `quantity` | integer | yes | Seat quantity of the new subscription |

```json
{
  "licenseId": 0,
  "quantity": 0
}
```

### Responses

| Status | Type | Description |
| --- | --- | --- |
| 200 | saas.csp2.OfficeTask | successful operation |

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `finishDate` | string (date-time) | read-only | Completion date |
| `function` | string | read-only | Function name |
| `id` | integer | read-only | Unique identifier of the task |
| `status` | saas.csp2.TaskStatusEnum | read-only | Task state — one of `cancelled`, `doing`, `done`, `error`, `todo` |
| `todoDate` | string (date-time) | read-only | Creation date |

```json
{
  "finishDate": "2024-01-01T12:00:00Z",
  "function": "string",
  "id": 0,
  "status": "cancelled",
  "todoDate": "2024-01-01T12:00:00Z"
}
```

### Example

```bash
curl -X POST \
  "https://api.eu.ovhcloud.com/1.0/saas/csp2/{serviceName}/subscription/{id}/orderAddon" \
  -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: saas.csp2.SubscriptionOrderAddonCreation
result = client.post("/saas/csp2/{serviceName}/subscription/{id}/orderAddon",
	licenseId = None, # License id associated to this addon subscription (see subscription/<id>/availableAddonLicenses) (type: integer)
	quantity = None, # Seat quantity of the new subscription (type: integer)
)

# 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: saas.csp2.SubscriptionOrderAddonCreation
$result = $ovh->post("/saas/csp2/{serviceName}/subscription/{id}/orderAddon", array(
	licenseId => null, // License id associated to this addon subscription (see subscription/<id>/availableAddonLicenses) (type: integer)
	quantity => null, // Seat quantity of the new subscription (type: integer)
));

print_r($result);
?>
```
