Microsoft Azure Costs API

The Costs API from Microsoft Azure, for costs.

GitHub OpenAPI
Business capability
IT Financial Management BC-600.80

Operations 2

Each operation below carries the questions people ask an LLM about it and the instructions they give an agent to run it. Generated by API Evangelist overlay

GET /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/costs/{name} Get cost details for a DevTest lab · Microsoft Azure Get Subscriptions Subscriptionid Resourcegroups… #
Ask an LLM
“How much is my DevTest lab costing, and what is its target spend?”
“Can I expand the lab cost to include resource-level details?”
Tell an agent
Get cost {cost} for DevTest lab {lab} in subscription {subscription}, resource group {resource_group}.
Show lab {lab} cost {cost} expanded with {expand}.
PUT /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/costs/{name} Set a cost target for a DevTest lab · Microsoft Azure Put Subscriptions Subscriptionid Resourcegroups… #
Ask an LLM
“How do I set a monthly cost target and thresholds for my DevTest lab?”
“Can I replace an existing lab cost configuration?”
Tell an agent
Create cost settings {cost} for DevTest lab {lab} in subscription {subscription}, resource group {resource_group}.
Replace lab {lab} cost target {cost} with properties {properties}.

Work with this as data

Every API here is available over the APIs.io API and to AI agents over MCP.

MCP server

One button, every client — Claude, Cursor, VS Code and the rest.

https://apis.io/mcp

Tools for apis

7 MCP tools reach this
  • find_apisBrowse and filter every API in the catalog.
  • get_api_artifactsOne API's artifacts, grouped by type.
  • get_openapiThe primary OpenAPI for this API.
  • find_similar_apisAPIs that look like this one.
  • apis_io_searchSTART HERE — APIs, providers and tags for one query, each with its total.
  • resolveTurn a domain, URL or GitHub org into the provider it belongs to.
  • find_cohortsEvery scored population of providers in the catalog.
All 92 tools →

Call it yourself

curl for this page
This API
curl "https://apis.io/api/v1/apis/microsoft-azure:microsoft-azure-costs-api"
All apis
curl "https://apis.io/api/v1/apis?limit=25"

Calls without X-API-Key need no key. Calls with it need a paid plan — get a key.

Get an API key

Free tier, no form to fill in. Signing in shares your email address with us — we store it to create your key and to recognise you if you sign in with another provider. By signing up you are subscribing to the APIs.io and API Evangelist newsletters — you can unsubscribe from any issue. See our Privacy Policy and Terms.

A second provider on the same verified email joins the account you already have.

OpenAPI Specification

microsoft-azure-costs-api-openapi.yml Raw ↑
openapi: 3.2.0
info:
  version: '2018-09-15'
  title: Microsoft Azure DevTestLabsClient Costs API
  description: The DevTest Labs Client.
servers:
- url: https://management.azure.com
security:
- azure_auth:
  - user_impersonation
tags:
- name: Costs
paths:
  ? /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/costs/{name}
  : get:
      tags:
      - Costs
      description: Get cost.
      operationId: microsoftAzureCostsGet
      parameters:
      - $ref: '#/components/parameters/subscriptionId'
      - $ref: '#/components/parameters/resourceGroupName'
      - name: labName
        in: path
        description: The name of the lab.
        required: true
        schema:
          type: string
      - name: name
        in: path
        description: The name of the cost.
        required: true
        schema:
          type: string
      - name: $expand
        in: query
        description: 'Specify the $expand query. Example: ''properties($expand=labCostDetails)'''
        schema:
          type: string
      - $ref: '#/components/parameters/api-version'
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/LabCost'
        default:
          description: BadRequest
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CloudError'
      x-ms-examples:
        Costs_Get:
          $ref: ./examples/Costs_Get.json
      summary: Microsoft Azure Get Subscriptions Subscriptionid Resourcegroups…
    put:
      tags:
      - Costs
      description: Create or replace an existing cost.
      operationId: microsoftAzureCostsCreateorupdate
      parameters:
      - $ref: '#/components/parameters/subscriptionId'
      - $ref: '#/components/parameters/resourceGroupName'
      - name: labName
        in: path
        description: The name of the lab.
        required: true
        schema:
          type: string
      - name: name
        in: path
        description: The name of the cost.
        required: true
        schema:
          type: string
      - $ref: '#/components/parameters/api-version'
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/LabCost'
        '201':
          description: Created
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/LabCost'
        default:
          description: BadRequest
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CloudError'
      x-ms-examples:
        Costs_CreateOrUpdate:
          $ref: ./examples/Costs_CreateOrUpdate.json
      summary: Microsoft Azure Put Subscriptions Subscriptionid Resourcegroups…
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/LabCost'
        description: A cost item.
        required: true
components:
  parameters:
    subscriptionId:
      name: subscriptionId
      in: path
      description: The subscription ID.
      required: true
      schema:
        type: string
    api-version:
      name: api-version
      in: query
      description: Client API version.
      required: true
      schema:
        type: string
        default: '2018-09-15'
    resourceGroupName:
      name: resourceGroupName
      in: path
      description: The name of the resource group.
      required: true
      x-ms-parameter-location: method
      schema:
        type: string
  schemas:
    LabCost:
      description: A cost item.
      required:
      - properties
      type: object
      allOf:
      - $ref: '#/components/schemas/Resource'
      properties:
        properties:
          $ref: '#/components/schemas/LabCostProperties'
          description: The properties of the resource.
          x-ms-client-flatten: true
    Resource:
      description: An Azure resource.
      type: object
      properties:
        id:
          description: The identifier of the resource.
          type: string
          readOnly: true
        name:
          description: The name of the resource.
          type: string
          readOnly: true
        type:
          description: The type of the resource.
          type: string
          readOnly: true
        location:
          description: The location of the resource.
          type: string
        tags:
          description: The tags of the resource.
          type: object
          additionalProperties:
            type: string
      x-ms-azure-resource: true
    CloudErrorBody:
      description: Body of an error from a REST request.
      type: object
      properties:
        code:
          description: The error code.
          type: string
        message:
          description: The error message.
          type: string
        target:
          description: The error target.
          type: string
        details:
          description: Inner errors.
          type: array
          items:
            $ref: '#/components/schemas/CloudErrorBody'
      x-ms-external: true
    LabCostDetailsProperties:
      description: The properties of a lab cost item.
      type: object
      properties:
        date:
          format: date-time
          description: The date of the cost item.
          type: string
        cost:
          format: double
          description: The cost component of the cost item.
          type: number
        costType:
          description: The type of the cost.
          enum:
          - Unavailable
          - Reported
          - Projected
          type: string
          x-ms-enum:
            name: CostType
            modelAsString: true
    CloudError:
      description: Error from a REST request.
      type: object
      properties:
        error:
          $ref: '#/components/schemas/CloudErrorBody'
          description: The cloud error that occurred
      x-ms-external: true
    LabResourceCostProperties:
      description: The properties of a resource cost item.
      type: object
      properties:
        resourcename:
          description: The name of the resource.
          type: string
        resourceUId:
          description: The unique identifier of the resource.
          type: string
        resourceCost:
          format: double
          description: The cost component of the resource cost item.
          type: number
        resourceType:
          description: The logical resource type (ex. virtualmachine, storageaccount)
          type: string
        resourceOwner:
          description: The owner of the resource (ex. janedoe@microsoft.com)
          type: string
        resourcePricingTier:
          description: The category of the resource (ex. Premium_LRS, Standard_DS1)
          type: string
        resourceStatus:
          description: The status of the resource (ex. Active)
          type: string
        resourceId:
          description: The ID of the resource
          type: string
        externalResourceId:
          description: The ID of the external resource
          type: string
    PercentageCostThresholdProperties:
      description: Properties of a percentage cost threshold.
      type: object
      properties:
        thresholdValue:
          format: double
          description: The cost threshold value.
          type: number
    LabCostSummaryProperties:
      description: The properties of the cost summary.
      type: object
      properties:
        estimatedLabCost:
          format: double
          description: The cost component of the cost item.
          type: number
    CostThresholdProperties:
      description: Properties of a cost threshold item.
      type: object
      properties:
        thresholdId:
          description: The ID of the cost threshold item.
          type: string
        percentageThreshold:
          $ref: '#/components/schemas/PercentageCostThresholdProperties'
          description: The value of the percentage cost threshold.
        displayOnChart:
          description: Indicates whether this threshold will be displayed on cost charts.
          enum:
          - Enabled
          - Disabled
          type: string
          x-ms-enum:
            name: CostThresholdStatus
            modelAsString: true
        sendNotificationWhenExceeded:
          description: Indicates whether notifications will be sent when this threshold is exceeded.
          enum:
          - Enabled
          - Disabled
          type: string
          x-ms-enum:
            name: CostThresholdStatus
            modelAsString: true
        notificationSent:
          description: Indicates the datetime when notifications were last sent for this threshold.
          type: string
    TargetCostProperties:
      description: Properties of a cost target.
      type: object
      properties:
        status:
          description: Target cost status
          enum:
          - Enabled
          - Disabled
          type: string
          x-ms-enum:
            name: TargetCostStatus
            modelAsString: true
        target:
          format: int32
          description: Lab target cost
          type: integer
        costThresholds:
          description: Cost thresholds.
          type: array
          items:
            $ref: '#/components/schemas/CostThresholdProperties'
        cycleStartDateTime:
          format: date-time
          description: Reporting cycle start date.
          type: string
        cycleEndDateTime:
          format: date-time
          description: Reporting cycle end date.
          type: string
        cycleType:
          description: Reporting cycle type.
          enum:
          - CalendarMonth
          - Custom
          type: string
          x-ms-enum:
            name: ReportingCycleType
            modelAsString: true
    LabCostProperties:
      description: Properties of a cost item.
      type: object
      properties:
        targetCost:
          $ref: '#/components/schemas/TargetCostProperties'
          description: The target cost properties
        labCostSummary:
          $ref: '#/components/schemas/LabCostSummaryProperties'
          description: The lab cost summary component of the cost data.
          readOnly: true
        labCostDetails:
          description: The lab cost details component of the cost data.
          type: array
          items:
            $ref: '#/components/schemas/LabCostDetailsProperties'
          readOnly: true
        resourceCosts:
          description: The resource cost component of the cost data.
          type: array
          items:
            $ref: '#/components/schemas/LabResourceCostProperties'
          readOnly: true
        currencyCode:
          description: The currency code of the cost.
          type: string
        startDateTime:
          format: date-time
          description: The start time of the cost data.
          type: string
        endDateTime:
          format: date-time
          description: The end time of the cost data.
          type: string
        createdDate:
          format: date-time
          description: The creation date of the cost.
          type: string
        provisioningState:
          description: The provisioning status of the resource.
          type: string
          readOnly: true
        uniqueIdentifier:
          description: The unique immutable identifier of a resource (Guid).
          type: string
          readOnly: true
  securitySchemes:
    azure_auth:
      type: oauth2
      flows:
        implicit:
          scopes:
            user_impersonation: Access Microsoft Azure
          authorizationUrl: https://login.microsoftonline.com/common/oauth2/authorize
      description: OAuth2 Implicit Grant
x-provenance:
  method: harvested
  publisher: Microsoft Azure
  source: https://raw.githubusercontent.com/Azure/azure-rest-api-specs/master/specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/DTL.json
  note: split by refine-openapis from the provider's own published document, verified by fetch (openapi/_original/*.fetch.json);
    stamped by stamp-openapi-provenance.py (roadmap#793)