# Message Metrics

## Get message attributes

> Fetch message attributes using various query parameters

```json
{"openapi":"3.0.3","info":{"title":"Reporting","version":"v1"},"tags":[{"name":"metrics","description":"Provide metrics to the customers"}],"security":[{"user":[]},{"accessKey":[]}],"components":{"securitySchemes":{"user":{"description":"Provide the token that is returned upon login","scheme":"bearer","type":"http","bearerFormat":"jwt"},"accessKey":{"description":"Uses the Authorization header: 'AccessKey ' followed by your access key token (e.g., 'Authorization: AccessKey AbCdEfGhIjKlMnOpQrStUvWxYzAbCdEfGhIj')","scheme":"AccessKey","type":"http"}},"schemas":{"ByMessageResponse":{"type":"object","title":"ByMessageResponse","description":"A list of metrics by message","properties":{"ChannelID":{"type":"string"},"ChannelName":{"type":"string"},"ChannelSenderType":{"type":"string"},"CampaignID":{"type":"string"},"ChargeableUnits":{"type":"integer"},"PartCount":{"type":"integer"},"PlatformID":{"type":"string"},"Status":{"type":"string"},"FailureCode":{"type":"string"},"CreatedAt":{"type":"string","format":"date-time"},"SentAt":{"type":"string","format":"date-time"},"DeliveredAt":{"type":"string","format":"date-time"},"Direction":{"type":"string"},"From":{"type":"object","properties":{"Key":{"type":"string"},"Value":{"type":"string"},"CountryCode":{"type":"string"}}},"To":{"type":"object","properties":{"Value":{"type":"array","items":{"type":"string"}},"CountryCodes":{"type":"array","items":{"type":"string"}}}},"MessageType":{"type":"string"},"ExtraInformation":{"type":"object","properties":{"Operator":{"type":"string"},"MailboxProvider":{"type":"string"},"MailboxProviderRegion":{"type":"string"}}},"UseCase":{"type":"string"},"Activity":{"type":"object","properties":{"OpenedAt":{"type":"string","format":"date-time"},"ClickedAt":{"type":"string","format":"date-time"}}}}},"ValidationError":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{"type":"object","additionalProperties":{"oneOf":[{"type":"string"},{"type":"array","items":{"type":"string"}}]}}},"required":["code","message"]}},"responses":{"validationError":{"description":"The request did not pass validation","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ValidationError"}}}}}},"paths":{"/workspaces/{workspaceId}/reporting/messages":{"get":{"summary":"Get message attributes","operationId":"getMessages","description":"Fetch message attributes using various query parameters","tags":["metrics"],"parameters":[{"name":"periodStart","in":"query","description":"The start of the period for which to fetch metrics","required":true,"schema":{"type":"string","format":"date-time","description":"The date and time in the format 'YYYY-MM-DDTHH:MM:SSZ' or 'YYYY-MM-DDTHH:MM:SS-HH:MM'."}},{"name":"periodEnd","in":"query","description":"The end of the period for which to fetch metrics","required":false,"schema":{"type":"string","format":"date-time","description":"The date and time in the format 'YYYY-MM-DDTHH:MM:SSZ' or 'YYYY-MM-DDTHH:MM:SS-HH:MM'."}},{"name":"filter","in":"query","description":"Filter conditions for which to fetch messages. Each condition is a string in the format of 'equals(`field`,`value`)'.\nAvailable field-value pairs are\n- `channelID` - UUID, can supply multiple equals conditions for multiple channelIds\n- `campaignID` - UUID, can supply multiple equals conditions for multiple campaignIds\n- `platformID` - string, can supply multiple equals conditions for multiple platforms\n  - Common values are 'sms-messagebird', 'email-sparkpost', 'whatsapp', and 'rcs-google'. More are possible and are returned in the response.\n- `channelName` - string, exact match only.\n- `status` - string, can supply multiple equals conditions for multiple statuses\n  - Allowed values are 'invalid', 'accepted', 'processing', 'sent', 'sending_failed', 'delivered', 'delivery_failed', 'deleted', 'scheduled', or 'skipped'\n- `direction` - string, message direction \n  - Allowed values are 'in', 'out', 'invalid'\n- `receiverCountry` - string, can supply multiple equals conditions for multiple receiver countries\n  - Allowed values are ISO 3166-1 two character country codes\n- `channelSenderType` - string, can supply multiple equals conditions for multiple channel sender types\n  - Allowed values are 'long-code-number', 'short-code-number', 'alpha-number'\n- `sender` - string, can supply multiple equals conditions for multiple senders\n  - Examples include sender phone numbers or email addresses. Exact match only. If '+' is used, it must be URL encoded as '%2B'.\n- `failureCodes` - string, can supply multiple equals conditions for multiple failure codes\n  - Examples include `15001`, `14001`, `12006` etc\n","required":false,"schema":{"type":"string"}}],"responses":{"200":{"description":"An array of messages","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/ByMessageResponse"}}}}},"422":{"$ref":"#/components/responses/validationError"}}}}}}
```
