# Offers & Services › Billing API

> Part of the OVHcloud developer hub. Index of every page and section: https://developers.eu.ovhcloud.com/llms.txt
> The Offers & Services product's sections: https://developers.eu.ovhcloud.com/reference/offers-services/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/offers-services/billing/

OpenAPI v1: https://api.eu.ovhcloud.com/1.0/__schemas/developer-hub-navigation/offers-services/billing.json?format=openapi3
OpenAPI v2: https://api.eu.ovhcloud.com/v2/__schemas/developer-hub-navigation/offers-services/billing.json?format=openapi3

## Operations

- `GET /me/billing/report/consumption` — Retrieve all billing reports of consumption
- `POST /me/billing/report/consumption` — Generate consumption billing report for a period
- `GET /me/billing/report/consumption/{taskId}` — Retrieve a consumption billing report with task id
- `GET /me/credit/balance` — Retrieve all credit balances
- `GET /me/credit/balance/{balanceName}` — Retrieve a credit balance
- `GET /me/credit/balance/{balanceName}/movement` — Retrieve movements for a specific balance
- `GET /me/credit/balance/{balanceName}/movement/{movementId}` — Retrieve a specific movement for a credit balance
- `POST /me/credit/code` — Validate a code to generate associated credit movement

## Retrieve all billing reports of consumption

`GET /1.0/me/billing/report/consumption`

Link: https://developers.eu.ovhcloud.com/reference/offers-services/billing/#get-me-billing-report-consumption

**Status:** Stable production version  
**IAM actions:** `account:apiovh:me/billing/report/consumption/get`

### Responses

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

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

### Example

```bash
curl -X GET \
  "https://api.eu.ovhcloud.com/1.0/me/billing/report/consumption" \
  -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("/me/billing/report/consumption")

# 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("/me/billing/report/consumption");

print_r($result);
?>
```

## Generate consumption billing report for a period

`POST /1.0/me/billing/report/consumption`

Link: https://developers.eu.ovhcloud.com/reference/offers-services/billing/#post-me-billing-report-consumption

**Status:** Stable production version  
**IAM actions:** `account:apiovh:me/billing/report/consumption/post`

### Request body (required)

Type: `me.billing.report.consumption.CreationRequest`

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `periodEnd` | string (date) | yes | End date of the report period |
| `periodStart` | string (date) | yes | Start date of the report period |

```json
{
  "periodEnd": "2024-01-01",
  "periodStart": "2024-01-01"
}
```

### Responses

| Status | Type | Description |
| --- | --- | --- |
| 200 | me.billing.report.consumption.CreationResponse | successful operation |

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `taskId` | string | read-only | Task id of the report |

```json
{
  "taskId": "string"
}
```

### Example

```bash
curl -X POST \
  "https://api.eu.ovhcloud.com/1.0/me/billing/report/consumption" \
  -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: me.billing.report.consumption.CreationRequest
result = client.post("/me/billing/report/consumption",
	periodEnd = None, # End date of the report period (type: string)
	periodStart = None, # Start date of the report period (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: me.billing.report.consumption.CreationRequest
$result = $ovh->post("/me/billing/report/consumption", array(
	periodEnd => null, // End date of the report period (type: string)
	periodStart => null, // Start date of the report period (type: string)
));

print_r($result);
?>
```

## Retrieve a consumption billing report with task id

`GET /1.0/me/billing/report/consumption/{taskId}`

Link: https://developers.eu.ovhcloud.com/reference/offers-services/billing/#get-me-billing-report-consumption-taskid

**Status:** Stable production version  
**IAM actions:** `account:apiovh:me/billing/report/consumption/get`

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `taskId` | path | string | yes | Task ID |

### Responses

| Status | Type | Description |
| --- | --- | --- |
| 200 | me.billing.report.Consumption | successful operation |

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `periodEnd` | string (date) | read-only | End date of the report period |
| `periodStart` | string (date) | read-only | Start date of the report period |
| `report` | string | read-only | Url of the report |
| `status` | me.billing.report.consumption.StatusEnum | read-only | Status of the report — one of `CREATING`, `ERROR`, `READY` |
| `taskId` | string | read-only | Task id of the report |

```json
{
  "periodEnd": "2024-01-01",
  "periodStart": "2024-01-01",
  "report": "string",
  "status": "CREATING",
  "taskId": "string"
}
```

### Example

```bash
curl -X GET \
  "https://api.eu.ovhcloud.com/1.0/me/billing/report/consumption/{taskId}" \
  -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("/me/billing/report/consumption/{taskId}")

# 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("/me/billing/report/consumption/{taskId}");

print_r($result);
?>
```

## Retrieve all credit balances

`GET /1.0/me/credit/balance`

Link: https://developers.eu.ovhcloud.com/reference/offers-services/billing/#get-me-credit-balance

**Status:** Stable production version  
**IAM actions:** `account:apiovh:me/credit/balance/get`

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `type` | query | me.credit.balance.TypeEnum |  | Filter by balance type — one of `BONUS`, `DEPOSIT`, `PREPAID_ACCOUNT`, `VOUCHER` |

### Responses

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

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

### Example

```bash
curl -X GET \
  "https://api.eu.ovhcloud.com/1.0/me/credit/balance" \
  -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("/me/credit/balance")

# 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("/me/credit/balance");

print_r($result);
?>
```

## Retrieve a credit balance

`GET /1.0/me/credit/balance/{balanceName}`

Link: https://developers.eu.ovhcloud.com/reference/offers-services/billing/#get-me-credit-balance-balancename

**Status:** Stable production version  
**IAM actions:** `account:apiovh:me/credit/balance/get`

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `balanceName` | path | string | yes | Balance name |

### Responses

| Status | Type | Description |
| --- | --- | --- |
| 200 | me.credit.Balance | successful operation |

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `amount` | order.Price | read-only | Balance amount |
| `amount.currencyCode` | order.CurrencyCodeEnum | read-only | Currency code — one of `AUD`, `CAD`, `CZK`, `EUR`, `GBP`, `INR`, `LTL`, `MAD`, `N/A`, `PLN`, `SGD`, `TND`, … |
| `amount.priceInUcents` | integer | read-only | Price in microcents |
| `amount.text` | string | read-only | Textual representation |
| `amount.value` | number | read-only | The effective price |
| `balanceDetails` | me.credit.balance.BalanceDetails[] | read-only | Balance details, amounts by serviceID |
| `balanceDetails[].amount` | order.Price | read-only | Balance part amount |
| `balanceDetails[].amount.currencyCode` | order.CurrencyCodeEnum | read-only | Currency code — one of `AUD`, `CAD`, `CZK`, `EUR`, `GBP`, `INR`, `LTL`, `MAD`, `N/A`, `PLN`, `SGD`, `TND`, … |
| `balanceDetails[].amount.priceInUcents` | integer | read-only | Price in microcents |
| `balanceDetails[].amount.text` | string | read-only | Textual representation |
| `balanceDetails[].amount.value` | number | read-only | The effective price |
| `balanceDetails[].balanceSubName` | string | read-only | Balance sub name |
| `balanceDetails[].expiring` | me.credit.balance.ExpiringMovement[] | read-only | Expiring parts of this balance |
| `balanceDetails[].expiring[].amount` | order.Price | read-only | Movement amount |
| `balanceDetails[].expiring[].creationDate` | string (date-time) | read-only | Movement creation date |
| `balanceDetails[].expiring[].expirationDate` | string (date-time) | read-only | Movement expiration date |
| `balanceDetails[].expiring[].lastUpdate` | string (date-time) | read-only | Movement last update |
| `balanceDetails[].expiring[].sourceObject` | me.credit.balance.movement.SubObject | read-only | Object source of this credit movement |
| `balanceDetails[].serviceId` | integer | read-only | Service ID of this balance part |
| `balanceName` | string | read-only | Balance name |
| `booked` | me.credit.balance.BookedMovement[] | read-only | Movement already booked on orders |
| `booked[].amount` | order.Price | read-only | Movement amount |
| `booked[].amount.currencyCode` | order.CurrencyCodeEnum | read-only | Currency code — one of `AUD`, `CAD`, `CZK`, `EUR`, `GBP`, `INR`, `LTL`, `MAD`, `N/A`, `PLN`, `SGD`, `TND`, … |
| `booked[].amount.priceInUcents` | integer | read-only | Price in microcents |
| `booked[].amount.text` | string | read-only | Textual representation |
| `booked[].amount.value` | number | read-only | The effective price |
| `booked[].balanceSubName` | string | read-only | Balance sub name |
| `booked[].orderId` | integer | read-only | Order ID |
| `creationDate` | string (date-time) | read-only | Balance creation date |
| `expiring` | me.credit.balance.ExpiringMovement[] | read-only | Movement expiring soon |
| `expiring[].amount` | order.Price | read-only | Movement amount |
| `expiring[].amount.currencyCode` | order.CurrencyCodeEnum | read-only | Currency code — one of `AUD`, `CAD`, `CZK`, `EUR`, `GBP`, `INR`, `LTL`, `MAD`, `N/A`, `PLN`, `SGD`, `TND`, … |
| `expiring[].amount.priceInUcents` | integer | read-only | Price in microcents |
| `expiring[].amount.text` | string | read-only | Textual representation |
| `expiring[].amount.value` | number | read-only | The effective price |
| `expiring[].creationDate` | string (date-time) | read-only | Movement creation date |
| `expiring[].expirationDate` | string (date-time) | read-only | Movement expiration date |
| `expiring[].lastUpdate` | string (date-time) | read-only | Movement last update |
| `expiring[].sourceObject` | me.credit.balance.movement.SubObject | read-only | Object source of this credit movement |
| `expiring[].sourceObject.id` | string | read-only | Sub object ID |
| `expiring[].sourceObject.name` | string | read-only | Sub object name |
| `lastUpdate` | string (date-time) | read-only | Balance last update |
| `type` | me.credit.balance.TypeEnum | read-only | Balance type — one of `BONUS`, `DEPOSIT`, `PREPAID_ACCOUNT`, `VOUCHER` |
| `usable` | boolean | read-only | Balance usable |

```json
{
  "amount": {
    "currencyCode": "AUD",
    "priceInUcents": 0,
    "text": "string",
    "value": 0
  },
  "balanceDetails": [
    {
      "amount": {
        "currencyCode": "AUD",
        "priceInUcents": 0,
        "text": "string",
        "value": 0
      },
      "balanceSubName": "string",
      "expiring": [
        {
          "amount": {
            "currencyCode": "AUD",
            "priceInUcents": 0,
            "text": "string",
            "value": 0
          },
          "creationDate": "2024-01-01T12:00:00Z",
          "expirationDate": "2024-01-01T12:00:00Z",
          "lastUpdate": "2024-01-01T12:00:00Z",
          "sourceObject": {
            "id": "string",
            "name": "string"
          }
        }
      ],
      "serviceId": 0
    }
  ],
  "balanceName": "string",
  "booked": [
    {
      "amount": {
        "currencyCode": "AUD",
        "priceInUcents": 0,
        "text": "string",
        "value": 0
      },
      "balanceSubName": "string",
      "orderId": 0
    }
  ],
  "creationDate": "2024-01-01T12:00:00Z",
  "expiring": [
    {
      "amount": {
        "currencyCode": "AUD",
        "priceInUcents": 0,
        "text": "string",
        "value": 0
      },
      "creationDate": "2024-01-01T12:00:00Z",
      "expirationDate": "2024-01-01T12:00:00Z",
      "lastUpdate": "2024-01-01T12:00:00Z",
      "sourceObject": {
        "id": "string",
        "name": "string"
      }
    }
  ],
  "lastUpdate": "2024-01-01T12:00:00Z",
  "type": "BONUS",
  "usable": true
}
```

### Example

```bash
curl -X GET \
  "https://api.eu.ovhcloud.com/1.0/me/credit/balance/{balanceName}" \
  -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("/me/credit/balance/{balanceName}")

# 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("/me/credit/balance/{balanceName}");

print_r($result);
?>
```

## Retrieve movements for a specific balance

`GET /1.0/me/credit/balance/{balanceName}/movement`

Link: https://developers.eu.ovhcloud.com/reference/offers-services/billing/#get-me-credit-balance-balancename-movement

**Status:** Stable production version  
**IAM actions:** `account:apiovh:me/credit/balance/movement/get`

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `balanceName` | path | string | yes | Balance name |

### Responses

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

```json
[
  0
]
```

### Example

```bash
curl -X GET \
  "https://api.eu.ovhcloud.com/1.0/me/credit/balance/{balanceName}/movement" \
  -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("/me/credit/balance/{balanceName}/movement")

# 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("/me/credit/balance/{balanceName}/movement");

print_r($result);
?>
```

## Retrieve a specific movement for a credit balance

`GET /1.0/me/credit/balance/{balanceName}/movement/{movementId}`

Link: https://developers.eu.ovhcloud.com/reference/offers-services/billing/#get-me-credit-balance-balancename-movement-movementid

**Status:** Stable production version  
**IAM actions:** `account:apiovh:me/credit/balance/movement/get`

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `balanceName` | path | string | yes | Balance name |
| `movementId` | path | integer | yes | Movement ID |

### Responses

| Status | Type | Description |
| --- | --- | --- |
| 200 | me.credit.balance.Movement | successful operation |

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `amount` | order.Price | read-only | Movement amount |
| `amount.currencyCode` | order.CurrencyCodeEnum | read-only | Currency code — one of `AUD`, `CAD`, `CZK`, `EUR`, `GBP`, `INR`, `LTL`, `MAD`, `N/A`, `PLN`, `SGD`, `TND`, … |
| `amount.priceInUcents` | integer | read-only | Price in microcents |
| `amount.text` | string | read-only | Textual representation |
| `amount.value` | number | read-only | The effective price |
| `balanceName` | string | read-only | Balance name |
| `creationDate` | string (date-time) | read-only | Movement creation date |
| `destinationObject` | me.credit.balance.movement.SubObject | read-only | Object destination of this credit movement |
| `destinationObject.id` | string | read-only | Sub object ID |
| `destinationObject.name` | string | read-only | Sub object name |
| `expirationDate` | string (date-time) | read-only | Movement expiration date |
| `lastUpdate` | string (date-time) | read-only | Movement last update |
| `movementId` | integer | read-only | Movement ID |
| `orderId` | integer | read-only | Order ID associated to this credit movement |
| `sourceObject` | me.credit.balance.movement.SubObject | read-only | Object source of this credit movement |
| `sourceObject.id` | string | read-only | Sub object ID |
| `sourceObject.name` | string | read-only | Sub object name |
| `type` | me.credit.balance.movement.TypeEnum | read-only | Movement type — one of `BONUS`, `CANCEL`, `CREDIT_NOTE`, `EXPIRE`, `GIFT`, `MANUAL`, `ORDER`, `REFUND`, `UNPAID`, `USE`, `VOUCHER` |

```json
{
  "amount": {
    "currencyCode": "AUD",
    "priceInUcents": 0,
    "text": "string",
    "value": 0
  },
  "balanceName": "string",
  "creationDate": "2024-01-01T12:00:00Z",
  "destinationObject": {
    "id": "string",
    "name": "string"
  },
  "expirationDate": "2024-01-01T12:00:00Z",
  "lastUpdate": "2024-01-01T12:00:00Z",
  "movementId": 0,
  "orderId": 0,
  "sourceObject": {
    "id": "string",
    "name": "string"
  },
  "type": "BONUS"
}
```

### Example

```bash
curl -X GET \
  "https://api.eu.ovhcloud.com/1.0/me/credit/balance/{balanceName}/movement/{movementId}" \
  -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("/me/credit/balance/{balanceName}/movement/{movementId}")

# 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("/me/credit/balance/{balanceName}/movement/{movementId}");

print_r($result);
?>
```

## Validate a code to generate associated credit movement

`POST /1.0/me/credit/code`

Link: https://developers.eu.ovhcloud.com/reference/offers-services/billing/#post-me-credit-code

**Status:** Stable production version  
**IAM actions:** `account:apiovh:me/credit/code/validate`

### Request body (required)

Type: `me.credit.code.Redeem`

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `inputCode` | string | yes | Code to validate |
| `serviceId` | integer |  | Restrict credit to a specific service |

```json
{
  "inputCode": "string",
  "serviceId": 0
}
```

### Responses

| Status | Type | Description |
| --- | --- | --- |
| 200 | me.credit.balance.Movement | successful operation |

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `amount` | order.Price | read-only | Movement amount |
| `amount.currencyCode` | order.CurrencyCodeEnum | read-only | Currency code — one of `AUD`, `CAD`, `CZK`, `EUR`, `GBP`, `INR`, `LTL`, `MAD`, `N/A`, `PLN`, `SGD`, `TND`, … |
| `amount.priceInUcents` | integer | read-only | Price in microcents |
| `amount.text` | string | read-only | Textual representation |
| `amount.value` | number | read-only | The effective price |
| `balanceName` | string | read-only | Balance name |
| `creationDate` | string (date-time) | read-only | Movement creation date |
| `destinationObject` | me.credit.balance.movement.SubObject | read-only | Object destination of this credit movement |
| `destinationObject.id` | string | read-only | Sub object ID |
| `destinationObject.name` | string | read-only | Sub object name |
| `expirationDate` | string (date-time) | read-only | Movement expiration date |
| `lastUpdate` | string (date-time) | read-only | Movement last update |
| `movementId` | integer | read-only | Movement ID |
| `orderId` | integer | read-only | Order ID associated to this credit movement |
| `sourceObject` | me.credit.balance.movement.SubObject | read-only | Object source of this credit movement |
| `sourceObject.id` | string | read-only | Sub object ID |
| `sourceObject.name` | string | read-only | Sub object name |
| `type` | me.credit.balance.movement.TypeEnum | read-only | Movement type — one of `BONUS`, `CANCEL`, `CREDIT_NOTE`, `EXPIRE`, `GIFT`, `MANUAL`, `ORDER`, `REFUND`, `UNPAID`, `USE`, `VOUCHER` |

```json
{
  "amount": {
    "currencyCode": "AUD",
    "priceInUcents": 0,
    "text": "string",
    "value": 0
  },
  "balanceName": "string",
  "creationDate": "2024-01-01T12:00:00Z",
  "destinationObject": {
    "id": "string",
    "name": "string"
  },
  "expirationDate": "2024-01-01T12:00:00Z",
  "lastUpdate": "2024-01-01T12:00:00Z",
  "movementId": 0,
  "orderId": 0,
  "sourceObject": {
    "id": "string",
    "name": "string"
  },
  "type": "BONUS"
}
```

### Example

```bash
curl -X POST \
  "https://api.eu.ovhcloud.com/1.0/me/credit/code" \
  -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: me.credit.code.Redeem
result = client.post("/me/credit/code",
	inputCode = None, # Code to validate (type: string)
	serviceId = None, # Restrict credit to a specific service (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: me.credit.code.Redeem
$result = $ovh->post("/me/credit/code", array(
	inputCode => null, // Code to validate (type: string)
	serviceId => null, // Restrict credit to a specific service (type: integer)
));

print_r($result);
?>
```
