# Traffic

Traffic data

## GET /{contract}/traffic

> Get a high-granularity list of utilization resources for current month by default

```json
{"openapi":"3.0.0","info":{"title":"IONOS Cloud Billing API","version":"3.9.0"},"tags":[{"name":"traffic","description":"Traffic 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}"}},"IpQueryParameter":{"name":"ip","in":"query","description":"Provide report grouped by IPs","required":false,"schema":{"type":"boolean"}},"OutputQueryParameter":{"name":"output","in":"query","description":"The output format (object, array, CSV or all of them)","required":false,"schema":{"type":"string","default":"all","enum":["all","obj","arr","csv"]}}},"schemas":{"TrafficVDC":{"type":"object","properties":{"metadata":{"allOf":[{"$ref":"#/components/schemas/MetaData"},{"type":"object","properties":{"period":{"type":"string"},"unit":{"type":"string"}}}]},"trafficObj":{"type":"object","properties":{"vdc":{"type":"array","items":{"type":"object","properties":{"vdcUUID":{"type":"string","format":"uuid"},"vdcName":{"type":"string"},"dates":{"type":"array","items":{"$ref":"#/components/schemas/TrafficEntry"}}}}}}},"trafficArr":{"type":"array","items":{"type":"array","items":{"type":"string"}}},"traffic":{"type":"array","items":{"type":"string"}}}},"MetaData":{"type":"object","properties":{"contractId":{"type":"integer"},"customerId":{"type":"integer"},"reference":{"type":"string","nullable":true}}},"TrafficEntry":{"type":"object","properties":{"Date":{"type":"string","format":"date"},"In":{"type":"number"},"Out":{"type":"number"}}},"TrafficNIC":{"type":"object","properties":{"metadata":{"allOf":[{"$ref":"#/components/schemas/MetaData"},{"type":"object","properties":{"period":{"type":"string"},"unit":{"type":"string"}}}]},"trafficObj":{"type":"object","properties":{"nic":{"type":"array","items":{"type":"object","properties":{"vdcUUID":{"type":"string","format":"uuid"},"vdcName":{"type":"string"},"ip":{"type":"string"},"dates":{"type":"array","items":{"$ref":"#/components/schemas/TrafficEntry"}}}}}}},"trafficArr":{"type":"array","items":{"type":"array","items":{"type":"string"}}},"traffic":{"type":"array","items":{"type":"string"}}}}},"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}/traffic":{"get":{"tags":["traffic"],"description":"Get a high-granularity list of utilization resources for current month by default","operationId":"trafficGet","parameters":[{"$ref":"#/components/parameters/ContractParameter"},{"$ref":"#/components/parameters/IpQueryParameter"},{"$ref":"#/components/parameters/OutputQueryParameter"}],"responses":{"200":{"description":"Result data","content":{"application/json":{"schema":{"oneOf":[{"$ref":"#/components/schemas/TrafficVDC"},{"$ref":"#/components/schemas/TrafficNIC"}],"discriminator":{"propertyName":"type","mapping":{"vdc":"#/components/schemas/TrafficVDC","nic":"#/components/schemas/TrafficNIC"}}}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"422":{"$ref":"#/components/responses/Unprocessable"},"500":{"$ref":"#/components/responses/InternalError"}}}}}}
```

## GET /{contract}/traffic/{period}

> Get a high-granularity list of utilization resources for a certain period

```json
{"openapi":"3.0.0","info":{"title":"IONOS Cloud Billing API","version":"3.9.0"},"tags":[{"name":"traffic","description":"Traffic 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}"}},"PeriodParameter":{"name":"period","in":"path","description":"Period of interest in format YYYY-MM","required":true,"schema":{"type":"string","pattern":"^(\\d{4}-\\d{2}|null)$"}},"IpQueryParameter":{"name":"ip","in":"query","description":"Provide report grouped by IPs","required":false,"schema":{"type":"boolean"}},"OutputQueryParameter":{"name":"output","in":"query","description":"The output format (object, array, CSV or all of them)","required":false,"schema":{"type":"string","default":"all","enum":["all","obj","arr","csv"]}}},"schemas":{"TrafficVDC":{"type":"object","properties":{"metadata":{"allOf":[{"$ref":"#/components/schemas/MetaData"},{"type":"object","properties":{"period":{"type":"string"},"unit":{"type":"string"}}}]},"trafficObj":{"type":"object","properties":{"vdc":{"type":"array","items":{"type":"object","properties":{"vdcUUID":{"type":"string","format":"uuid"},"vdcName":{"type":"string"},"dates":{"type":"array","items":{"$ref":"#/components/schemas/TrafficEntry"}}}}}}},"trafficArr":{"type":"array","items":{"type":"array","items":{"type":"string"}}},"traffic":{"type":"array","items":{"type":"string"}}}},"MetaData":{"type":"object","properties":{"contractId":{"type":"integer"},"customerId":{"type":"integer"},"reference":{"type":"string","nullable":true}}},"TrafficEntry":{"type":"object","properties":{"Date":{"type":"string","format":"date"},"In":{"type":"number"},"Out":{"type":"number"}}},"TrafficNIC":{"type":"object","properties":{"metadata":{"allOf":[{"$ref":"#/components/schemas/MetaData"},{"type":"object","properties":{"period":{"type":"string"},"unit":{"type":"string"}}}]},"trafficObj":{"type":"object","properties":{"nic":{"type":"array","items":{"type":"object","properties":{"vdcUUID":{"type":"string","format":"uuid"},"vdcName":{"type":"string"},"ip":{"type":"string"},"dates":{"type":"array","items":{"$ref":"#/components/schemas/TrafficEntry"}}}}}}},"trafficArr":{"type":"array","items":{"type":"array","items":{"type":"string"}}},"traffic":{"type":"array","items":{"type":"string"}}}}},"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}/traffic/{period}":{"get":{"tags":["traffic"],"description":"Get a high-granularity list of utilization resources for a certain period","operationId":"trafficFindByPeriod","parameters":[{"$ref":"#/components/parameters/ContractParameter"},{"$ref":"#/components/parameters/PeriodParameter"},{"$ref":"#/components/parameters/IpQueryParameter"},{"$ref":"#/components/parameters/OutputQueryParameter"}],"responses":{"200":{"description":"Result data","content":{"application/json":{"schema":{"oneOf":[{"$ref":"#/components/schemas/TrafficVDC"},{"$ref":"#/components/schemas/TrafficNIC"}],"discriminator":{"propertyName":"type","mapping":{"vdc":"#/components/schemas/TrafficVDC","nic":"#/components/schemas/TrafficNIC"}}}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"422":{"$ref":"#/components/responses/Unprocessable"},"500":{"$ref":"#/components/responses/InternalError"}}}}}}
```
