The operations described in this section enable you to perform accounts operations.
Get billing account
GET /v2/accounts/{ran}
Get a billing account.
Request
The request has the following URI and header parameters:
| Name | Type | Description | 
|---|---|---|
| {ran} | URI string (Required) | A billing account number. | 
| X-Auth-Token | Header string (Required) | A valid authentication token associated with the particular role. | 
| Accept | Header string | Value: application/json | 
This operation does not accept a request body.
Response
Example Get billing account - Cloud: JSON response
{
  "billingAccount": {
    "accountNumber": "{ran}",
    "currency": "USD",
    "monthlyRecurringRevenue": "100.00",
    "name": "amazon",
    "link": [
     {
        "rel": "balance",
        "href": "https://billing.api.rackspacecloud.com/v2/accounts/{ran}/balance"
      },
      {
        "rel": "billing-summary",
        "href": "https://billing.api.rackspacecloud.com/v2/accounts/{ran}/billing-summary"
      },
      {
        "rel": "latestInvoice",
        "href": "https://billing.api.rackspacecloud.com/v2/accounts/{ran}/invoices/latest"
      },
      {
        "rel": "estimated_charges",
        "href": "https://billing.api.rackspacecloud.com/v2/accounts/{ran}/estimated_charges"
      }
    ]
  }
}
Sample JSON for a dedicated parent billing account:
If the billingAccount in the request is a parent billing account, the childCount is included in the response, indicating the number of child billing accounts.
The following sample shows a partial response for a dedicated parent billing account.
{
  "billingAccount": {
    ...
    ...
    ...
    "childCount": 5,
    "accountNumber": "{ran}",
    "name": "amazon",
    "link": [
         {
             "href": "https://billing.api.rackspacecloud.com/v2/accounts/{ran}/accounts",
             "rel": "childBillingAccounts"
         },
         ...
         ...
         ...
    ]
  }
}
Sample JSON for a dedicated child billing account:
If the billingAccount in the request is a child billing account, the parentAccountNumber is included in the response.
The following sample shows a partial response for a dedicated child billing account.
{
  "billingAccount": {
    ...
    ...
    ...
    "accountNumber": "{ran}",
    "parentAccountNumber": "{parentRan}",
    "name": "amazon"
  }
}
This table shows the possible response codes for this operation:
| Response code | Name | Description | 
|---|---|---|
| 200 | OK | The request succeeded. | 
| 400 | Bad Request | A general error has occurred. | 
| 401 | Unauthorized | The request has not been applied because it lacks valid authentication credentials for the target resource. The credentials are either expired or invalid. | 
| 404 | Not Found | The server could not find what was requested. | 
| 405 | Method Not Allowed | The method received in the request line is known by the origin server but is not supported by the target resource. | 
| 406 | Not Acceptable | The server cannot produce a response matching the list of acceptable values defined in the request. | 
| 415 | Unsupported Media Type | This error might result if the wrong media type is used in the cURL request. | 
| 500 | Internal Server Error | The server encountered an unexpected condition that prevented it from fulfilling the request. | 
Users with the following roles can access this API:
- identity:user-admin
- admin
- billing:admin
- observer
- billing:observer
Get child billing accounts
GET /v2/accounts/{ran}/accounts
Gets a list of child billing accounts.
Request
The request has the following URI and header parameters:
| Name | Type | Description | 
|---|---|---|
| {ran} | URI string (Required) | A billing account number. | 
| X-Auth-Token | Header string (Required) | A valid authentication token associated with the particular role. | 
| Accept | Header string | Value: application/json | 
This table shows the query parameters for the request:
| Name | Type | Description | 
|---|---|---|
| limit | Integer | An integer between 1 and 200 to specify the number of records to return. The default limit is 25 records. To learn more about pagination rules, refer to section Paginated Collections. | 
| marker | Integer | An integer between 0 and the last item of the result list. | 
This operation does not accept a request body.
Response
Example Get a list of child billing accounts: JSON response
{
  "billingAccounts": {
    "link": [
      {
        "rel": "prev",
        "href": "https://billing.api.rackspacecloud.com/v2/accounts?marker=0&limit=10"
      },
      {
        "rel": "next",
        "href": "https://billing.api.rackspacecloud.com/v2/accounts?marker=0&limit=10"
      }
    ],
    "total": 2,
    "billingAccount": [
      {
        "link": [
          {
            "rel": "self",
            "href": "https://billing.api.rackspacecloud.com/v2/accounts/{ran}"
          }
        ],
        "currency": "USD",
        "accountNumber": "{ran}",
        "parentAccountNumber": "{parentRan}",
        "name": "amazon"
      },
      {
        "link": [
          {
            "rel": "self",
            "href": "https://billing.api.rackspacecloud.com/v2/accounts/{ran}"
          }
        ],
        "currency": "USD",
        "accountNumber": "{ran}",
        "parentAccountNumber": "{parentRan}",
        "name": "amazon"
      }
    ]
  }
}
This table shows the possible response codes for this operation:
| Response code | Name | Description | 
|---|---|---|
| 200 | OK | The request succeeded. | 
| 400 | Bad Request | A general error has occurred. | 
| 401 | Unauthorized | The request has not been applied because it lacks valid authentication credentials for the target resource. The credentials are either expired or invalid. | 
| 404 | Not Found | The server could not find what was requested. | 
| 405 | Method Not Allowed | The method received in the request line is known by the origin server but is not supported by the target resource. | 
| 406 | Not Acceptable | The server cannot produce a response matching the list of acceptable values defined in the request. | 
| 415 | Unsupported Media Type | This error might result if the wrong media type is used in the cURL request. | 
| 500 | Internal Server Error | The server encountered an unexpected condition that prevented it from fulfilling the request. | 
Users with any of the following roles can access this API:
- identity:user-admin
- admin
- billing:admin
- observer
- billing:observer
Get billing account currency
GET /v2/accounts/{ran}/currency
Get a billing account currency.
Request
The request has the following URI and header parameters:
| Name | Type | Description | 
|---|---|---|
| {ran} | URI string (Required) | A billing account number. | 
| X-Auth-Token | Header string (Required) | A valid authentication token associated with the particular role. | 
| Accept | Header string | Value: application/json | 
This operation does not accept a request body.
Response
Example Get billing account currency: JSON response
{
   "billingAccount": {
      "currency": "USD",
      "link": []
   }
}
This table shows the possible response codes for this operation:
| Response code | Name | Description | 
|---|---|---|
| 200 | OK | The request succeeded. | 
| 400 | Bad Request | A general error has occurred. | 
| 401 | Unauthorized | The request has not been applied because it lacks valid authentication credentials for the target resource. The credentials are either expired or invalid. | 
| 404 | Not Found | The server could not find what was requested. | 
| 405 | Method Not Allowed | The method received in the request line is known by the origin server but is not supported by the target resource. | 
| 406 | Not Acceptable | The server cannot produce a response matching the list of acceptable values defined in the request. | 
| 415 | Unsupported Media Type | This error might result if the wrong media type is used in the cURL request. | 
| 500 | Internal Server Error | The server encountered an unexpected condition that prevented it from fulfilling the request. | 
Users with any of the following roles can access this API:
- identity:user-admin
- admin
- billing:admin
- observer
- billing:observer
Get next due date
GET /v2/accounts/{ran}/futureBill
Retrieves the due date of the first future bill for the current payment term.
Request[
The request has the following URI and header parameters:
| Name | Type | Description | 
|---|---|---|
| {ran} | URI string (Required) | A billing account number. | 
| X-Auth-Token | Header string (Required) | A valid authentication token associated with the particular role. | 
| Accept | Header string | Value: application/json | 
This operation does not accept a request body.
Response
Example Get next due date: JSON response
{
  "futureBill": {
    "nextDueDate": "2015-10-26T19:00:00.000-05:00"
  }
}
This table shows the possible response codes for this operation:
| Response code | Name | Description | 
|---|---|---|
| 200 | OK | The request succeeded. | 
| 400 | Bad Request | A general error has occurred. | 
| 401 | Unauthorized | The request has not been applied because it lacks valid authentication credentials for the target resource. The credentials are either expired or invalid. | 
| 404 | Not Found | The server could not find what was requested. | 
| 405 | Method Not Allowed | The method received in the request line is known by the origin server but is not supported by the target resource. | 
| 406 | Not Acceptable | The server cannot produce a response matching the list of acceptable values defined in the request. | 
| 415 | Unsupported Media Type | This error might result if the wrong media type is used in the cURL request. | 
| 500 | Internal Server Error | The server encountered an unexpected condition that prevented it from fulfilling the request. | 
Users with any of the following roles can access this API:
- identity:user-admin
- admin
- billing:admin
- observer
- billing:observe
