{
  "swagger": "2.0",
  "schemes": [
    "https"
  ],
  "host": "management.azure.com",
  "info": {
    "description": "Consumption management client provides access to consumption resources for Azure Web-Direct subscriptions. Other subscription types which were not purchased directly through the Azure web portal are not supported through this preview API.",
    "title": "ConsumptionManagementClient",
    "version": "2017-04-24-preview",
    "x-apisguru-categories": [
      "cloud"
    ],
    "x-logo": {
      "url": "https://api.apis.guru/v2/cache/logo/https_assets.onestore.ms_cdnfiles_onestorerolling-1606-01000_shell_v3_images_logo_microsoft.png"
    },
    "x-origin": [
      {
        "format": "swagger",
        "url": "https://raw.githubusercontent.com/Azure/azure-rest-api-specs/master/specification/consumption/resource-manager/Microsoft.Consumption/preview/2017-04-24-preview/consumption.json",
        "version": "2.0"
      }
    ],
    "x-preferred": false,
    "x-providerName": "azure.com",
    "x-serviceName": "consumption",
    "x-tags": [
      "Azure",
      "Microsoft"
    ]
  },
  "consumes": [
    "application/json"
  ],
  "produces": [
    "application/json"
  ],
  "securityDefinitions": {
    "azure_auth": {
      "authorizationUrl": "https://login.microsoftonline.com/common/oauth2/authorize",
      "description": "Azure Active Directory OAuth2 Flow.",
      "flow": "implicit",
      "scopes": {
        "user_impersonation": "impersonate your user account"
      },
      "type": "oauth2"
    }
  },
  "security": [
    {
      "azure_auth": [
        "user_impersonation"
      ]
    }
  ],
  "parameters": {
    "apiVersionParameter": {
      "description": "Version of the API to be used with the client request. The current version is 2017-02-27-preview.",
      "in": "query",
      "name": "api-version",
      "required": true,
      "type": "string"
    },
    "subscriptionIdParameter": {
      "description": "Azure Subscription ID.",
      "in": "path",
      "name": "subscriptionId",
      "required": true,
      "type": "string"
    }
  },
  "paths": {
    "/providers/Microsoft.Consumption/operations": {
      "get": {
        "description": "Lists all of the available consumption REST API operations.",
        "operationId": "Operations_List",
        "parameters": [
          {
            "$ref": "#/parameters/apiVersionParameter"
          }
        ],
        "responses": {
          "200": {
            "description": "OK. The request has succeeded.",
            "schema": {
              "$ref": "#/definitions/OperationListResult"
            }
          },
          "default": {
            "description": "Error response describing why the operation failed.",
            "schema": {
              "$ref": "#/definitions/ErrorResponse"
            }
          }
        },
        "tags": [
          "Operations"
        ],
        "x-ms-pageable": {
          "nextLinkName": "nextLink"
        }
      }
    },
    "/{scope}/providers/Microsoft.Consumption/usageDetails": {
      "get": {
        "description": "Lists the usage details for a scope in reverse chronological order by billing period. Usage details are available via this API only for January 1, 2017 or later.",
        "externalDocs": {
          "url": "https://go.microsoft.com/fwlink/?linkid=845275"
        },
        "operationId": "UsageDetails_List",
        "parameters": [
          {
            "description": "The scope of the usage details. The scope can be '/subscriptions/{subscriptionId}' for a subscription, or '/subscriptions/{subscriptionId}/providers/Microsoft.Billing/invoices/{invoiceName}' for an invoice or '/subscriptions/{subscriptionId}/providers/Microsoft.Billing/billingPeriods/{billingPeriodName}' for a billing period.",
            "in": "path",
            "name": "scope",
            "required": true,
            "type": "string",
            "x-ms-skip-url-encoding": true
          },
          {
            "description": "May be used to expand the additionalProperties or meterDetails property within a list of usage details. By default, these fields are not included when listing usage details.",
            "in": "query",
            "name": "$expand",
            "required": false,
            "type": "string"
          },
          {
            "description": "May be used to filter usageDetails by usageEnd (Utc time). The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not currently support 'ne', 'or', or 'not'.",
            "in": "query",
            "name": "$filter",
            "required": false,
            "type": "string"
          },
          {
            "description": "Skiptoken is only used if a previous operation returned a partial result. If a previous response contains a nextLink element, the value of the nextLink element will include a skiptoken parameter that specifies a starting point to use for subsequent calls.",
            "in": "query",
            "name": "$skiptoken",
            "required": false,
            "type": "string"
          },
          {
            "description": "May be used to limit the number of results to the most recent N usageDetails.",
            "in": "query",
            "maximum": 1000,
            "minimum": 1,
            "name": "$top",
            "required": false,
            "type": "integer"
          },
          {
            "$ref": "#/parameters/apiVersionParameter"
          }
        ],
        "responses": {
          "200": {
            "description": "OK. The request has succeeded.",
            "schema": {
              "$ref": "#/definitions/UsageDetailsListResult"
            }
          },
          "default": {
            "description": "Error response describing why the operation failed.",
            "schema": {
              "$ref": "#/definitions/ErrorResponse"
            }
          }
        },
        "tags": [
          "UsageDetails"
        ],
        "x-ms-examples": {
          "UsageDetailsExpand": {
            "parameters": {
              "$expand": "meterDetails,additionalProperties",
              "$filter": "usageEnd le 2017-02-14T00:00:00Z",
              "$top": 1,
              "api-version": "2017-04-24-preview",
              "scope": "subscriptions/subid/providers/Microsoft.Billing/billingPeriods/201702-1"
            },
            "responses": {
              "200": {
                "body": {
                  "value": [
                    {
                      "id": "/subscriptions/subid/providers/Microsoft.Billing/billingPeriods/201702-1/providers/Microsoft.Consumption/usageDetails/usageDetailsId1",
                      "name": "usageDetailsId1",
                      "properties": {
                        "additionalProperties": {
                          "AppServicePlanUri": "/subscriptions/subid/resourceGroups/Default-Web-eastasia/providers/Microsoft.Web/serverfarms/DefaultServerFarm"
                        },
                        "billableQuantity": 0.00328,
                        "billingPeriodId": "/subscriptions/subid/providers/Microsoft.Billing/billingPeriods/201702-1",
                        "currency": "USD",
                        "instanceId": "/subscriptions/subid/resourceGroups/Default-Web-eastasia/providers/Microsoft.Web/sites/shared1",
                        "instanceLocation": "eastasia",
                        "instanceName": "shared1",
                        "invoiceId": "/subscriptions/subid/providers/Microsoft.Billing/invoices/201703-123456789",
                        "isEstimated": false,
                        "meterDetails": {
                          "meterCategory": "Networking",
                          "meterLocation": "Zone 2",
                          "meterName": "Data Transfer Out (GB)",
                          "pretaxStandardRate": 0.138,
                          "totalIncludedQuantity": 0,
                          "unit": "GB"
                        },
                        "meterId": "fe167397-a38d-43c3-9bb3-8e2907e56a41",
                        "pretaxCost": 0.67,
                        "usageEnd": "2017-02-13T23:59:59Z",
                        "usageQuantity": 0.00328,
                        "usageStart": "2017-02-13T00:00:00Z"
                      },
                      "tags": {
                        "dev": "tools",
                        "env": "newcrp"
                      },
                      "type": "Microsoft.Consumption/usageDetails"
                    }
                  ]
                }
              }
            }
          },
          "UsageDetailsList": {
            "parameters": {
              "api-version": "2017-04-24-preview",
              "scope": "subscriptions/subid"
            },
            "responses": {
              "200": {
                "body": {
                  "value": [
                    {
                      "id": "/subscriptions/subid/providers/Microsoft.Consumption/usageDetails/usageDetailsId1",
                      "name": "usageDetailsId1",
                      "properties": {
                        "billableQuantity": 0.00328,
                        "billingPeriodId": "/subscriptions/subid/providers/Microsoft.Billing/billingPeriods/201702-1",
                        "currency": "USD",
                        "instanceId": "/subscriptions/subid/resourceGroups/Default-Web-eastasia/providers/Microsoft.Web/sites/shared1",
                        "instanceLocation": "eastasia",
                        "instanceName": "shared1",
                        "invoiceId": "/subscriptions/subid/providers/Microsoft.Billing/invoices/201703-123456789",
                        "isEstimated": false,
                        "meterId": "fe167397-a38d-43c3-9bb3-8e2907e56a41",
                        "pretaxCost": 0.67,
                        "usageEnd": "2017-02-13T23:59:59Z",
                        "usageQuantity": 0.00328,
                        "usageStart": "2017-02-13T00:00:00Z"
                      },
                      "tags": {
                        "dev": "tools",
                        "env": "newcrp"
                      },
                      "type": "Microsoft.Consumption/usageDetails"
                    }
                  ]
                }
              }
            }
          },
          "UsageDetailsListForBillingPeriod": {
            "parameters": {
              "api-version": "2017-04-24-preview",
              "scope": "subscriptions/subid/providers/Microsoft.Billing/billingPeriods/201702-1"
            },
            "responses": {
              "200": {
                "body": {
                  "value": [
                    {
                      "id": "/subscriptions/subid/providers/Microsoft.Billing/billingPeriods/201702-1/providers/Microsoft.Consumption/usageDetails/usageDetailsId1",
                      "name": "usageDetailsId1",
                      "properties": {
                        "billableQuantity": 0.00328,
                        "billingPeriodId": "/subscriptions/subid/providers/Microsoft.Billing/billingPeriods/201702-1",
                        "currency": "USD",
                        "instanceId": "/subscriptions/subid/resourceGroups/Default-Web-eastasia/providers/Microsoft.Web/sites/shared1",
                        "instanceLocation": "eastasia",
                        "instanceName": "shared1",
                        "invoiceId": "/subscriptions/subid/providers/Microsoft.Billing/invoices/201703-123456789",
                        "isEstimated": false,
                        "meterId": "fe167397-a38d-43c3-9bb3-8e2907e56a41",
                        "pretaxCost": 0.67,
                        "usageEnd": "2017-02-13T23:59:59Z",
                        "usageQuantity": 0.00328,
                        "usageStart": "2017-02-13T00:00:00Z"
                      },
                      "tags": {
                        "dev": "tools",
                        "env": "newcrp"
                      },
                      "type": "Microsoft.Consumption/usageDetails"
                    }
                  ]
                }
              }
            }
          },
          "UsageDetailsListForInvoice": {
            "parameters": {
              "api-version": "2017-04-24-preview",
              "scope": "subscriptions/subid/providers/Microsoft.Billing/invoices/2017-03-05-123456789"
            },
            "responses": {
              "200": {
                "body": {
                  "value": [
                    {
                      "id": "/subscriptions/subid/providers/Microsoft.Billing/invoices/2017-03-05-123456789/providers/Microsoft.Consumption/usageDetails/usageDetailsId1",
                      "name": "usageDetailsId1",
                      "properties": {
                        "billableQuantity": 0.00328,
                        "billingPeriodId": "/subscriptions/subid/providers/Microsoft.Billing/billingPeriods/201702-1",
                        "currency": "USD",
                        "instanceId": "/subscriptions/subid/resourceGroups/Default-Web-eastasia/providers/Microsoft.Web/sites/shared1",
                        "instanceLocation": "eastasia",
                        "instanceName": "shared1",
                        "invoiceId": "/subscriptions/subid/providers/Microsoft.Billing/invoices/201703-123456789",
                        "isEstimated": false,
                        "meterId": "fe167397-a38d-43c3-9bb3-8e2907e56a41",
                        "pretaxCost": 0.67,
                        "usageEnd": "2017-02-13T23:59:59Z",
                        "usageQuantity": 0.00328,
                        "usageStart": "2017-02-13T00:00:00Z"
                      },
                      "tags": {
                        "dev": "tools",
                        "env": "newcrp"
                      },
                      "type": "Microsoft.Consumption/usageDetails"
                    }
                  ]
                }
              }
            }
          }
        },
        "x-ms-pageable": {
          "nextLinkName": "nextLink"
        }
      }
    }
  },
  "definitions": {
    "ErrorDetails": {
      "description": "The details of the error.",
      "properties": {
        "code": {
          "description": "Error code.",
          "readOnly": true,
          "type": "string"
        },
        "message": {
          "description": "Error message indicating why the operation failed.",
          "readOnly": true,
          "type": "string"
        },
        "target": {
          "description": "The target of the particular error.",
          "readOnly": true,
          "type": "string"
        }
      }
    },
    "ErrorResponse": {
      "description": "Error response indicates that the service is not able to process the incoming request. The reason is provided in the error message.",
      "properties": {
        "error": {
          "$ref": "#/definitions/ErrorDetails",
          "description": "The details of the error."
        }
      },
      "type": "object"
    },
    "MeterDetails": {
      "description": "The properties of the meter detail.",
      "properties": {
        "meterCategory": {
          "description": "The category of the meter, for example, 'Cloud services', 'Networking', etc..",
          "readOnly": true,
          "type": "string"
        },
        "meterLocation": {
          "description": "The location in which the Azure service is available.",
          "readOnly": true,
          "type": "string"
        },
        "meterName": {
          "description": "The name of the meter, within the given meter category",
          "readOnly": true,
          "type": "string"
        },
        "meterSubCategory": {
          "description": "The subcategory of the meter, for example, 'A6 Cloud services', 'ExpressRoute (IXP)', etc..",
          "readOnly": true,
          "type": "string"
        },
        "pretaxStandardRate": {
          "description": "The pretax listing price.",
          "format": "decimal",
          "readOnly": true,
          "type": "number"
        },
        "totalIncludedQuantity": {
          "description": "The total included quantity associated with the offer.",
          "format": "decimal",
          "readOnly": true,
          "type": "number"
        },
        "unit": {
          "description": "The unit in which the meter consumption is charged, for example, 'Hours', 'GB', etc.",
          "readOnly": true,
          "type": "string"
        }
      }
    },
    "Operation": {
      "description": "A Consumption REST API operation.",
      "properties": {
        "display": {
          "description": "The object that represents the operation.",
          "properties": {
            "operation": {
              "description": "Operation type: Read, write, delete, etc.",
              "readOnly": true,
              "type": "string"
            },
            "provider": {
              "description": "Service provider: Microsoft.Consumption.",
              "readOnly": true,
              "type": "string"
            },
            "resource": {
              "description": "Resource on which the operation is performed: UsageDetail, etc.",
              "readOnly": true,
              "type": "string"
            }
          }
        },
        "name": {
          "description": "Operation name: {provider}/{resource}/{operation}.",
          "readOnly": true,
          "type": "string"
        }
      },
      "type": "object"
    },
    "OperationListResult": {
      "description": "Result of listing consumption operations. It contains a list of operations and a URL link to get the next set of results.",
      "properties": {
        "nextLink": {
          "description": "URL to get the next set of operation list results if there are any.",
          "readOnly": true,
          "type": "string"
        },
        "value": {
          "description": "List of consumption operations supported by the Microsoft.Consumption resource provider.",
          "items": {
            "$ref": "#/definitions/Operation"
          },
          "readOnly": true,
          "type": "array"
        }
      }
    },
    "Resource": {
      "description": "The Resource model definition.",
      "properties": {
        "id": {
          "description": "Resource Id.",
          "readOnly": true,
          "type": "string"
        },
        "name": {
          "description": "Resource name.",
          "readOnly": true,
          "type": "string"
        },
        "tags": {
          "additionalProperties": {
            "type": "string"
          },
          "description": "Resource tags.",
          "readOnly": true,
          "type": "object"
        },
        "type": {
          "description": "Resource type.",
          "readOnly": true,
          "type": "string"
        }
      },
      "x-ms-azure-resource": true
    },
    "UsageDetail": {
      "allOf": [
        {
          "$ref": "#/definitions/Resource"
        }
      ],
      "description": "An usage detail resource.",
      "properties": {
        "properties": {
          "$ref": "#/definitions/UsageDetailProperties",
          "x-ms-client-flatten": true
        }
      },
      "type": "object"
    },
    "UsageDetailProperties": {
      "description": "The properties of the usage detail.",
      "properties": {
        "additionalProperties": {
          "additionalProperties": {
            "type": "string"
          },
          "description": "The list of key/value pairs for the additional properties, in the format 'key':'value' where key = the field name, and value = the field value. By default this is not populated, unless it's specified in $expand.",
          "readOnly": true,
          "type": "object"
        },
        "billableQuantity": {
          "description": "The billable usage quantity.",
          "format": "decimal",
          "readOnly": true,
          "type": "number"
        },
        "billingPeriodId": {
          "description": "The id of the billing period resource that the usage belongs to.",
          "readOnly": true,
          "type": "string"
        },
        "currency": {
          "description": "The ISO currency in which the meter is charged, for example, USD.",
          "readOnly": true,
          "type": "string"
        },
        "instanceId": {
          "description": "The uri of the resource instance that the usage is about.",
          "readOnly": true,
          "type": "string"
        },
        "instanceLocation": {
          "description": "The location of the resource instance that the usage is about.",
          "readOnly": true,
          "type": "string"
        },
        "instanceName": {
          "description": "The name of the resource instance that the usage is about.",
          "readOnly": true,
          "type": "string"
        },
        "invoiceId": {
          "description": "The id of the invoice resource that the usage belongs to.",
          "readOnly": true,
          "type": "string"
        },
        "isEstimated": {
          "description": "The estimated usage is subject to change.",
          "readOnly": true,
          "type": "boolean"
        },
        "meterDetails": {
          "$ref": "#/definitions/MeterDetails",
          "description": "The details about the meter. By default this is not populated, unless it's specified in $expand.",
          "readOnly": true
        },
        "meterId": {
          "description": "The meter id.",
          "readOnly": true,
          "type": "string"
        },
        "pretaxCost": {
          "description": "The amount of cost before tax.",
          "format": "decimal",
          "readOnly": true,
          "type": "number"
        },
        "usageEnd": {
          "description": "The end of the date time range covered by the usage detail.",
          "format": "date-time",
          "readOnly": true,
          "type": "string"
        },
        "usageQuantity": {
          "description": "The quantity of usage.",
          "format": "decimal",
          "readOnly": true,
          "type": "number"
        },
        "usageStart": {
          "description": "The start of the date time range covered by the usage detail.",
          "format": "date-time",
          "readOnly": true,
          "type": "string"
        }
      }
    },
    "UsageDetailsListResult": {
      "description": "Result of listing usage details. It contains a list of available usage details in reverse chronological order by billing period.",
      "properties": {
        "nextLink": {
          "description": "The link (url) to the next page of results.",
          "readOnly": true,
          "type": "string"
        },
        "value": {
          "description": "The list of usage details.",
          "items": {
            "$ref": "#/definitions/UsageDetail"
          },
          "readOnly": true,
          "type": "array"
        }
      }
    }
  }
}