# Predict Sending Popularity

## OpenAPI Specification

```yaml
openapi: 3.0.1
info:
  title: ''
  description: ''
  version: 1.0.0
paths:
  /v2/ml/sending/predict_sending_popularity:
    post:
      summary: Predict Sending Popularity
      deprecated: false
      description: >-
        Returns predictions for selected KPI for a given sending entity. Version
        v2, with upgraded models.


        **Warning:** combination of "sms" channel and "open_rate" KPI is not
        supported.


        Text should be as shown to the end user, without any HTML.


        ## Example


        ```shell

        curl -X POST \

        "https://api.mpc.placewise.com/v2/ml/sending/predict_sending_popularity" 
        \

        -H 'Content-Type: application/json' \

        -H 'Authorization: Bearer B7t9U9tsoWsGhrv2ouUoSqpM' \

        -H 'x-product-name: default' \

        -H 'x-user-agent: CURL manual test' \

        -d '{
          "channel": "email",
          "kpi": "ctr",
          "scheduled_date": "2020-01-01",
          "sending_hour": 12,
          "text": "Great title! Great content".
        }'

        ```


        > When successful, returns:

        ```json

        {
          "baseline": 10.00,
          "prediction": 12.34,
        }

        ```
      tags:
        - API Reference/ML API/Sendings
      parameters:
        - name: Content-Type
          in: header
          description: '[Details](doc-341635)'
          required: true
          example: application/json
          schema:
            type: string
            default: application/json
            const: application/json
        - name: X-User-Agent
          in: header
          description: Arbitrary identifier of your client. [Details](doc-341635)
          required: true
          example: '{{X_USER_AGENT}}'
          schema:
            type: string
            default: '{{X_USER_AGENT}}'
        - name: X-Product-Name
          in: header
          description: API Product for API context. [Details](doc-341635)
          required: true
          example: '{{PRODUCT_NAME}}'
          schema:
            type: string
            default: '{{PRODUCT_NAME}}'
        - name: X-Loyalty-Club-Slug
          in: header
          description: LoyaltyClub for API context. [Details](doc-342138)
          required: false
          example: '{{LOYALTY_CLUB_SLUG}}'
          schema:
            type: string
            default: '{{LOYALTY_CLUB_SLUG}}'
        - name: X-Customer
          in: header
          description: Customer for API context.  [Details](doc-342139)
          required: false
          example: '{{CUSTOMER_ID}}'
          schema:
            type: string
            default: '{{CUSTOMER_ID}}'
        - name: Authorization
          in: header
          description: '[Member](doc-342129) or [User](doc-342130) Authorization.'
          required: false
          example: Bearer {{_OAUTH_TOKEN}}
          schema:
            type: string
            default: Bearer {{_OAUTH_TOKEN}}
        - name: X-Client-Authorization
          in: header
          description: '[Token](doc-342128) Authorization.'
          example: '{{API_TOKEN}}'
          schema:
            type: string
            default: '{{API_TOKEN}}'
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/PredictSendingPopularityRequest'
            example:
              channel: sms
              kpi: open_rate
              sending_date: '2024-04-20'
              sending_hour: 16
              text: >-
                Canis acervus maxime trepide conculco strues. Calco placeat
                ipsam tibi.
      responses:
        '200':
          description: ''
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PredictSendingPopularityResponse'
          headers: {}
          x-apidog-name: Success
      security: []
      x-apidog-folder: API Reference/ML API/Sendings
      x-apidog-status: released
      x-run-in-apidog: https://app.eu.apidog.com/web/project/346351/apis/api-3738710-run
components:
  schemas:
    PredictSendingPopularityRequest:
      type: object
      properties:
        channel:
          $ref: '#/components/schemas/Channel'
        kpi:
          $ref: '#/components/schemas/KPI'
        sending_date:
          $ref: '#/components/schemas/date'
        sending_hour:
          type: integer
          maximum: 23
          minimum: 0
        text:
          description: >-
            Sending text. For emails, it should contain both title and content,
            separated with a space.
          $ref: '#/components/schemas/text'
      x-apidog-orders:
        - channel
        - kpi
        - sending_date
        - sending_hour
        - text
      required:
        - channel
        - kpi
        - sending_date
        - sending_hour
        - text
      x-apidog-ignore-properties: []
      x-apidog-folder: ''
    text:
      type: string
      description: Text of sending. If it has title and content, combine them as one text.
      x-apidog-folder: ''
    date:
      type: string
      format: date
      examples:
        - '2023-01-15'
      x-apidog-folder: ''
    KPI:
      type: string
      title: kpi
      description: Channel of the sending
      enum:
        - ctr
        - open_rate
        - sms
      x-apidog-enum:
        - value: ctr
          name: kpi
          description: ''
        - value: open_rate
          name: channel
          description: ''
        - value: sms
          name: channel
          description: ''
      x-apidog-folder: ''
    Channel:
      type: string
      enum:
        - email
        - push
        - sms
      x-apidog-enum:
        - value: email
          name: channel
          description: ''
        - value: push
          name: channel
          description: ''
        - value: sms
          name: channel
          description: ''
      title: channel
      description: Channel of the sending
      x-apidog-folder: ''
    PredictSendingPopularityResponse:
      type: object
      properties:
        baseline:
          type: number
          description: Baseline of the prediction, currently historical average for that LC
        prediction:
          type: number
          description: Predicted KPI, in range [0, 100]
      x-apidog-orders:
        - baseline
        - prediction
      required:
        - baseline
        - prediction
      x-apidog-ignore-properties: []
      x-apidog-folder: ''
  securitySchemes: {}
servers:
  - url: https://api.mpc.dev.placewise.com
    description: Staging
security: []

```