Creating a billing report


To calculate Disaster Recovery compute points for the report types other than csv or html, divide the value by 3600 and round it to 2 decimal places.

To create a usage report for billing purposes, use the POST /reports endpoint. When creating the report, set the parameters.show_skus field to true to include product SKUs. If you also want to exclude the offering items without usage from the report, set the parameters.hide_zero_usage field to true.

  1. Authenticate to the cloud platform via the Python shell.

    The following variables should be available now:

    >>> base_url  # the base URL of the API
    >>> auth  # the 'Authorization' header value with the access token
    {'Authorization': 'Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiIsImtpZCI6ImMwMD...'}
    >>> tenant_id  # the UUID of the tenant to which the token provides access
  2. Define a variable named report_data, and then assign the report data to this variable:

    >>> report_data = {
    ...     "recipients": [
    ...         "ca451758-b48a-45d9-9ae6-8f1059f67619",
    ...         "ab00e527-219b-481b-b01b-311b5be0ed3c"
    ...     ],
    ...     "parameters": {
    ...         "kind": "usage_summary",
    ...         "tenant_id": tenant_id,
    ...         "level": "accounts",
    ...         "period": {
    ...             "start": "2017-05-01",
    ...             "end": "2017-05-07"
    ...         },
    ...         "formats": [
    ...             "csv",
    ...             "html"
    ...         ],
    ...         "hide_zero_usage": true,
    ...         "show_skus": true
    ...     },
    ...     "schedule": {
    ...         "type": "once"
    ...     },
    ...     "generation_date": "2017-05-08",
    ...     "result_action": "send"
    ... }


    Value type




    array of UUID strings

    Yes (if result_action is send)

    An array of UUIDs of the users who should receive the report by email.


    report parameters object


    An object of report parameters which allow to configure the report. The required parameters of this object are kind, tenant_id and level.


    report schedule object


    An object that allows to configure scheduling of the report. The required parameter of this object is type.




    Action to be done with the report. Refer to report result actions for the list of available report result actions.

  3. Convert the report_data object to a JSON text:

    >>> report_data = json.dumps(report_data, indent=4)
  4. Send a POST request with the JSON text to the /reports endpoint:

    >>> response =
    ...     f'{base_url}/reports',
    ...     headers={'Content-Type': 'application/json', **auth},
    ...     data=report_data,
    ... )
  5. Check the status code of the response:

    >>> response.status_code

    Status code 200 means that the report has been created and sent by email to specified recipients.

    A different status code means that an error has occurred. For the details, refer to “Status and error codes”.

    Also, the response body contains the report data formatted as a JSON text. When converted to an object, it will look as follows:

    >>> pprint.pprint(response.json())
    {'generation_date': '2017-05-08',
     'id': '20dffb36-d77b-45c6-b2fa-39276e98d5fc',
     'parameters': {'formats': ['csv', 'html'],
                    'kind': 'usage_summary',
                    'level': 'accounts',
                    'period': {'end': '2017-05-07', 'start': '2017-05-01'},
                    'tenant_id': 'ede9f834-70b3-476c-83d9-736f9f8c7dae'},
     'recipients': ['ca451758-b48a-45d9-9ae6-8f1059f67619',
     'result_action': 'send',
     'schedule': {'enabled': True, 'type': 'once'},
     'version': 1}
  6. [Optional] Store the UUID and revision number of the report, in case if you need to delete it:

    >>> report_id = response.json()['id']
    >>> report_id
    >>> version = response.json()['version']
    >>> version