# Gets cost estimation for specified campaign

# OpenAPI definition

```json
{
  "openapi": "3.0.0",
  "info": {
    "version": "v1",
    "title": "Messages API"
  },
  "paths": {
    "/messages/v1/accounts/{accountId}/messages/cost": {
      "post": {
        "tags": [
          "Messages"
        ],
        "summary": "Gets cost estimation for specified campaign",
        "operationId": "Messages_CalculateMessageCostAsync",
        "parameters": [
          {
            "name": "accountId",
            "in": "path",
            "description": "The accountId.",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "requestBody": {
          "$ref": "#/components/requestBodies/CM.Platform.Messages.Models.ApiMessageRequest"
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CM.Platform.Messages.Models.ApiMessageCost"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/CM.Platform.Messages.Models.ApiMessageCost"
                }
              },
              "text/xml": {
                "schema": {
                  "$ref": "#/components/schemas/CM.Platform.Messages.Models.ApiMessageCost"
                }
              }
            }
          }
        }
      }
    }
  },
  "servers": [
    {
      "url": "https://api.cm.com"
    }
  ],
  "components": {
    "requestBodies": {
      "CM.Platform.Messages.Models.ApiMessageRequest": {
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/CM.Platform.Messages.Models.ApiMessageRequest"
            }
          },
          "text/json": {
            "schema": {
              "$ref": "#/components/schemas/CM.Platform.Messages.Models.ApiMessageRequest"
            }
          },
          "text/xml": {
            "schema": {
              "$ref": "#/components/schemas/CM.Platform.Messages.Models.ApiMessageRequest"
            }
          },
          "application/x-www-form-urlencoded": {
            "schema": {
              "$ref": "#/components/schemas/CM.Platform.Messages.Models.ApiMessageRequest"
            }
          }
        },
        "description": "The message object",
        "required": true
      }
    },
    "schemas": {
      "CM.Platform.Messages.Models.ApiMessageRequest": {
        "type": "object",
        "properties": {
          "isArchived": {
            "type": "boolean"
          },
          "body": {
            "type": "string"
          },
          "channels": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "countrySpecificSenders": {
            "type": "object",
            "additionalProperties": {
              "type": "string"
            }
          },
          "grouping": {
            "type": "string"
          },
          "ignoreUnsubscribes": {
            "type": "boolean"
          },
          "name": {
            "type": "string"
          },
          "recipients": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CM.Platform.Messages.Models.ApiRecipient"
            }
          },
          "recurrence": {
            "type": "string"
          },
          "content": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CM.Platform.Messages.Models.Conversation"
            }
          },
          "scheduledAtUtc": {
            "format": "date-time",
            "type": "string"
          },
          "senderPreset": {
            "format": "uuid",
            "type": "string",
            "example": "00000000-0000-0000-0000-000000000000"
          },
          "senders": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "spread": {
            "$ref": "#/components/schemas/CM.Platform.Messages.Models.ApiSpreadSettings"
          },
          "status": {
            "type": "string"
          },
          "tariff": {
            "format": "int32",
            "type": "integer"
          },
          "modifiedAtUtc": {
            "format": "date-time",
            "type": "string"
          },
          "updatedAtUtc": {
            "type": "string"
          }
        }
      },
      "CM.Platform.Messages.Models.ApiRecipient": {
        "type": "object",
        "properties": {
          "contact": {
            "format": "uuid",
            "type": "string",
            "example": "00000000-0000-0000-0000-000000000000"
          },
          "data": {
            "type": "object",
            "additionalProperties": {
              "type": "string"
            }
          },
          "group": {
            "format": "uuid",
            "type": "string",
            "example": "00000000-0000-0000-0000-000000000000"
          },
          "msisdn": {
            "type": "string"
          },
          "pushId": {
            "type": "string"
          }
        }
      },
      "CM.Platform.Messages.Models.Conversation": {
        "type": "object",
        "properties": {
          "media": {
            "$ref": "#/components/schemas/CM.Platform.Messages.Models.Media"
          },
          "whatsAppTemplate": {
            "$ref": "#/components/schemas/CM.Platform.Messages.Models.WhatsAppTemplate"
          },
          "text": {
            "type": "string"
          },
          "header": {
            "type": "string"
          },
          "footer": {
            "type": "string"
          },
          "suggestions": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CM.Platform.Messages.Models.Suggestion"
            }
          }
        }
      },
      "CM.Platform.Messages.Models.ApiSpreadSettings": {
        "type": "object",
        "properties": {
          "durationMinutes": {
            "format": "int32",
            "type": "integer"
          },
          "timeFrames": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CM.Platform.Messages.Models.ApiTimeFrame"
            }
          },
          "until": {
            "format": "date-time",
            "type": "string"
          }
        }
      },
      "CM.Platform.Messages.Models.Media": {
        "type": "object",
        "properties": {
          "mediaName": {
            "type": "string"
          },
          "mediaUri": {
            "type": "string"
          },
          "mimeType": {
            "type": "string"
          },
          "mediaType": {
            "type": "string"
          }
        }
      },
      "CM.Platform.Messages.Models.WhatsAppTemplate": {
        "type": "object",
        "properties": {
          "templateId": {
            "format": "uuid",
            "type": "string",
            "example": "00000000-0000-0000-0000-000000000000"
          },
          "languageCode": {
            "type": "string"
          },
          "components": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CM.Platform.Messages.Models.WATemplateComponent"
            }
          }
        }
      },
      "CM.Platform.Messages.Models.Suggestion": {
        "type": "object",
        "properties": {
          "type": {
            "enum": [
              "OpenUrl",
              "CalendarEvent",
              "Dial",
              "ViewLocation",
              "Reply",
              "OpenAppPage"
            ],
            "type": "string"
          },
          "label": {
            "type": "string"
          },
          "phoneNumber": {
            "type": "string"
          },
          "postbackdata": {
            "type": "string"
          },
          "url": {
            "type": "string"
          },
          "viewLocation": {
            "$ref": "#/components/schemas/CM.Platform.Messages.Models.Viewlocation"
          }
        }
      },
      "CM.Platform.Messages.Models.ApiTimeFrame": {
        "type": "object",
        "properties": {
          "days": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "startTime": {
            "type": "string"
          },
          "endTime": {
            "type": "string"
          }
        }
      },
      "CM.Platform.Messages.Models.WATemplateComponent": {
        "type": "object",
        "properties": {
          "index": {
            "type": "string"
          },
          "type": {
            "type": "string"
          },
          "subType": {
            "type": "string"
          },
          "parameters": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CM.Platform.Messages.Models.WATemplateComponentParameter"
            }
          }
        }
      },
      "CM.Platform.Messages.Models.Viewlocation": {
        "type": "object",
        "properties": {
          "latitude": {
            "type": "string"
          },
          "longitude": {
            "type": "string"
          },
          "label": {
            "type": "string"
          }
        }
      },
      "CM.Platform.Messages.Models.WATemplateComponentParameter": {
        "type": "object",
        "properties": {
          "type": {
            "type": "string"
          },
          "media": {
            "$ref": "#/components/schemas/CM.Platform.Messages.Models.Media"
          },
          "text": {
            "type": "string"
          }
        }
      },
      "CM.Platform.Messages.Models.ApiMessageCost": {
        "type": "object",
        "properties": {
          "minNumberOfPartsPerRecipient": {
            "format": "int32",
            "type": "integer"
          },
          "maxNumberOfPartsPerRecipient": {
            "format": "int32",
            "type": "integer"
          },
          "charsLeft": {
            "format": "int32",
            "type": "integer"
          },
          "charsToRemove": {
            "format": "int32",
            "type": "integer"
          },
          "countryCosts": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CM.Platform.Messages.Models.ApiCountryCost"
            }
          },
          "currency": {
            "type": "string"
          },
          "isMultipart": {
            "type": "boolean"
          },
          "messageCount": {
            "format": "int32",
            "type": "integer"
          },
          "minDeliveryTime": {
            "format": "int32",
            "type": "integer"
          },
          "recipientCount": {
            "format": "int32",
            "type": "integer"
          },
          "totalCost": {
            "format": "double",
            "type": "number"
          },
          "hasUnicode": {
            "type": "boolean"
          },
          "hasTags": {
            "type": "boolean"
          }
        }
      },
      "CM.Platform.Messages.Models.ApiCountryCost": {
        "type": "object",
        "properties": {
          "cost": {
            "format": "double",
            "type": "number"
          },
          "countryCode": {
            "type": "string"
          },
          "isMultipart": {
            "type": "boolean"
          },
          "messageCount": {
            "format": "int32",
            "type": "integer"
          },
          "recipientCount": {
            "format": "int32",
            "type": "integer"
          }
        }
      }
    }
  },
  "x-readme": {
    "explorer-enabled": true,
    "proxy-enabled": true
  },
  "_id": {
    "buffer": {
      "0": 98,
      "1": 197,
      "2": 113,
      "3": 24,
      "4": 216,
      "5": 98,
      "6": 11,
      "7": 0,
      "8": 26,
      "9": 80,
      "10": 245,
      "11": 204
    }
  }
}
```