# Usage

Usage data

## GET /{contract}/usage

> Returns the usage of a contract

```json
{"openapi":"3.0.0","info":{"title":"IONOS Cloud Billing API","version":"3.9.0"},"tags":[{"name":"usage","description":"Usage data"}],"servers":[{"url":"https://api.ionos.com/billing","description":"Production API"}],"security":[{"basicAuth":[]},{"bearerAuth":[]}],"components":{"securitySchemes":{"basicAuth":{"type":"http","scheme":"basic"},"bearerAuth":{"type":"http","scheme":"bearer"}},"parameters":{"ContractParameter":{"name":"contract","in":"path","description":"Contract number","required":true,"schema":{"type":"integer","pattern":"[0-9]{5,10}"}},"PeriodQueryParameter":{"name":"period","in":"query","description":"Period of interest in format YYYY-MM (current month by default if not specified)","required":false,"schema":{"type":"string","pattern":"^\\d{4}-\\d{2}$"}}},"schemas":{"UsageDataCenter":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"name":{"type":"string"},"location":{"type":"string"},"meters":{"type":"array","items":{"$ref":"#/components/schemas/UsageMeter"}}}},"UsageMeter":{"type":"object","properties":{"meterId":{"type":"string","enum":["A01000","ALB1000","ALB1100","BU1100","BU1200","BU1300","BU1400","BU1500","C01000","C02000","C03000","CC1000","CR1000","CUBExxxx","CWSQL1001","CWSQL2001","CWSQL3001","CWSQL1000","CWSQL2000","DAS1000","DBPGB1000","DBPGC1000","DBPGR1000","DBPGS1000","DBPGS2000","DBPGS3000","NAT1000","NC1000","NLB1000","NLB1100","R01000","S01000","S02000","S03000","S05000","S3AU1100","S3AU1200","S3AU1300","S3RD1100","S3SU1100","S3SU1200","S3SU1300","S3TI1000","S3TI1100","S3TO1000","S3TO1100","S3TO1200","S3TO1300","S3TO1400","S3WR1100","TI1000","TO1000","WL1000","WL2000","WL3000","WL4000","WL5000","WL6000"]},"meterDesc":{"type":"string"},"quantity":{"type":"object","properties":{"quantity":{"type":"number"},"unit":{"type":"string"}}}}},"MetaData":{"type":"object","properties":{"contractId":{"type":"integer"},"customerId":{"type":"integer"},"reference":{"type":"string","nullable":true}}}},"responses":{"Unauthorized":{"description":"Unauthorized","content":{"application/json":{"schema":{"type":"object"}}}},"Forbidden":{"description":"Forbidden","content":{"application/json":{"schema":{"type":"object"}}}},"NotFound":{"description":"The contract not found or doesn't belong to the user","content":{"application/json":{"schema":{"type":"object"}}}},"Unprocessable":{"description":"Wrong period format specified","content":{"application/json":{"schema":{"type":"object"}}}},"InternalError":{"description":"Unexpected internal server error","content":{"application/json":{"schema":{"type":"object"}}}}}},"paths":{"/{contract}/usage":{"get":{"tags":["usage"],"description":"Returns the usage of a contract","operationId":"usageGet","parameters":[{"$ref":"#/components/parameters/ContractParameter"},{"$ref":"#/components/parameters/PeriodQueryParameter"}],"responses":{"200":{"description":"Result data","content":{"application/json":{"schema":{"type":"object","properties":{"startDate":{"type":"string","format":"date"},"endDate":{"type":"string","format":"date"},"datacenters":{"type":"array","items":{"$ref":"#/components/schemas/UsageDataCenter"}},"metadata":{"$ref":"#/components/schemas/MetaData"}}}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"description":"Conflict when getting the invoice data for usage calculation","content":{"application/json":{"schema":{"type":"object"}}}},"422":{"$ref":"#/components/responses/Unprocessable"},"500":{"$ref":"#/components/responses/InternalError"}}}}}}
```

## GET /{contract}/usage/{dc}

> Returns the usage of a contract for a given data-center

```json
{"openapi":"3.0.0","info":{"title":"IONOS Cloud Billing API","version":"3.9.0"},"tags":[{"name":"usage","description":"Usage data"}],"servers":[{"url":"https://api.ionos.com/billing","description":"Production API"}],"security":[{"basicAuth":[]},{"bearerAuth":[]}],"components":{"securitySchemes":{"basicAuth":{"type":"http","scheme":"basic"},"bearerAuth":{"type":"http","scheme":"bearer"}},"parameters":{"ContractParameter":{"name":"contract","in":"path","description":"Contract number","required":true,"schema":{"type":"integer","pattern":"[0-9]{5,10}"}},"DcParameter":{"name":"dc","in":"path","description":"Get data for the particular data-center ID (VDC UUID)","required":true,"schema":{"type":"string","nullable":true,"pattern":"^([a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}|null)$"}},"PeriodQueryParameter":{"name":"period","in":"query","description":"Period of interest in format YYYY-MM (current month by default if not specified)","required":false,"schema":{"type":"string","pattern":"^\\d{4}-\\d{2}$"}}},"schemas":{"UsageDataCenter":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"name":{"type":"string"},"location":{"type":"string"},"meters":{"type":"array","items":{"$ref":"#/components/schemas/UsageMeter"}}}},"UsageMeter":{"type":"object","properties":{"meterId":{"type":"string","enum":["A01000","ALB1000","ALB1100","BU1100","BU1200","BU1300","BU1400","BU1500","C01000","C02000","C03000","CC1000","CR1000","CUBExxxx","CWSQL1001","CWSQL2001","CWSQL3001","CWSQL1000","CWSQL2000","DAS1000","DBPGB1000","DBPGC1000","DBPGR1000","DBPGS1000","DBPGS2000","DBPGS3000","NAT1000","NC1000","NLB1000","NLB1100","R01000","S01000","S02000","S03000","S05000","S3AU1100","S3AU1200","S3AU1300","S3RD1100","S3SU1100","S3SU1200","S3SU1300","S3TI1000","S3TI1100","S3TO1000","S3TO1100","S3TO1200","S3TO1300","S3TO1400","S3WR1100","TI1000","TO1000","WL1000","WL2000","WL3000","WL4000","WL5000","WL6000"]},"meterDesc":{"type":"string"},"quantity":{"type":"object","properties":{"quantity":{"type":"number"},"unit":{"type":"string"}}}}},"MetaData":{"type":"object","properties":{"contractId":{"type":"integer"},"customerId":{"type":"integer"},"reference":{"type":"string","nullable":true}}}},"responses":{"Unauthorized":{"description":"Unauthorized","content":{"application/json":{"schema":{"type":"object"}}}},"Forbidden":{"description":"Forbidden","content":{"application/json":{"schema":{"type":"object"}}}},"NotFound":{"description":"The contract not found or doesn't belong to the user","content":{"application/json":{"schema":{"type":"object"}}}},"Unprocessable":{"description":"Wrong period format specified","content":{"application/json":{"schema":{"type":"object"}}}},"InternalError":{"description":"Unexpected internal server error","content":{"application/json":{"schema":{"type":"object"}}}}}},"paths":{"/{contract}/usage/{dc}":{"get":{"tags":["usage"],"description":"Returns the usage of a contract for a given data-center","operationId":"usageFindByDC","parameters":[{"$ref":"#/components/parameters/ContractParameter"},{"$ref":"#/components/parameters/DcParameter"},{"$ref":"#/components/parameters/PeriodQueryParameter"}],"responses":{"200":{"description":"Result data","content":{"application/json":{"schema":{"type":"object","properties":{"startDate":{"type":"string","format":"date"},"endDate":{"type":"string","format":"date"},"datacenters":{"type":"array","items":{"$ref":"#/components/schemas/UsageDataCenter"}},"metadata":{"$ref":"#/components/schemas/MetaData"}}}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"description":"Conflict when getting the invoice data for usage calculation","content":{"application/json":{"schema":{"type":"object"}}}},"422":{"$ref":"#/components/responses/Unprocessable"},"500":{"$ref":"#/components/responses/InternalError"}}}}}}
```
