# Recommend sending time

## OpenAPI Specification

```yaml
openapi: 3.0.1
info:
  title: ''
  description: ''
  version: 1.0.0
paths:
  /v2/ml/sending/recommend_time:
    post:
      summary: Recommend sending time
      deprecated: false
      description: >-
        Recommends sending date and time in a given time frame. Prediction is
        made for each hour in the given range, and the best one is also
        explicitly returned. 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/v3/ml/sending/recommend_time"  \

        -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",
          "text": "Great title! Great content".
          "start_time": "2025-01-01 01:00:00",
          "end_time": "2025-07-01 12:00:00"
        }'

        ```


        > When successful, returns:

        ```json

        {
          "predictions": [
            {
              "timestamp": "2025-01-01 01:00:00",
              "prediction": 0.01
            },
            {
              "timestamp": "2025-01-01 02:00:00",
              "prediction": 0.05
            },
            ...
          ],
          "best_prediction": {
            "timestamp": "2025-01-01 05:00: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:
              type: object
              properties:
                channel:
                  description: Channel of sending. One of ["email", "push", "sms"].
                  $ref: '#/components/schemas/Channel'
                kpi:
                  description: KPI to predict. One of ["ctr", "open_rate"].
                  $ref: '#/components/schemas/KPI'
                text:
                  description: >-
                    Sending text. For emails, it should contain both title and
                    content, separated with a space.
                  $ref: '#/components/schemas/text'
                campaign_window: &ref_0
                  $ref: '#/components/schemas/datetime_window'
                  description: Duration of the campaign
                search_window: *ref_0
                daily_sending_window:
                  description: Allowed shipping times each day
                  type: object
                  properties:
                    end: &ref_1
                      $ref: '#/components/schemas/time'
                    start: *ref_1
                  x-apidog-refs: {}
                  x-apidog-orders:
                    - end
                    - start
                  required:
                    - end
                    - start
                  x-apidog-ignore-properties: []
                  nullable: true
              x-apidog-orders:
                - channel
                - kpi
                - text
                - campaign_window
                - search_window
                - daily_sending_window
              required:
                - channel
                - kpi
                - text
                - campaign_window
                - search_window
              x-apidog-ignore-properties: []
            example:
              channel: email
              kpi: ctr
              community_id: 3433
              text: >-
                Canis acervus maxime trepide conculco strues. Calco placeat
                ipsam tibi.
              campaign_window:
                start: '2026-04-15T00:00:00'
                end: '2026-04-29T00:00:00'
              search_window:
                start: '2026-04-13T00:00:00'
                end: '2026-04-17T00:00:00'
              daily_sending_window:
                start: '08:00:00'
                end: '21:00:00'
      responses:
        '200':
          description: ''
          content:
            application/json:
              schema:
                type: object
                properties:
                  predictions:
                    type: array
                    items: &ref_2
                      $ref: '#/components/schemas/sending%20time%20prediction'
                    description: List of predictions, one per hour
                  best_prediction: *ref_2
                x-apidog-orders:
                  - predictions
                  - best_prediction
                required:
                  - predictions
                  - best_prediction
                x-apidog-ignore-properties: []
          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-4206041-run
components:
  schemas:
    time:
      type: string
      format: time
      description: Time of day in 24-hour HH:mm:ss format, without date or timezone.
      examples:
        - '08:00:00'
      x-apidog-folder: ''
    datetime_window:
      type: object
      properties:
        end: &ref_3
          $ref: '#/components/schemas/date_time'
        start: *ref_3
      x-apidog-orders:
        - end
        - start
      required:
        - end
        - start
      x-apidog-ignore-properties: []
      x-apidog-folder: ''
    date_time:
      type: string
      format: date-time
      examples:
        - '2022-11-09T16:25:58.099512Z'
      x-apidog-folder: ''
    text:
      type: string
      description: Text of sending. If it has title and content, combine them as one text.
      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: ''
    sending time prediction:
      type: object
      properties:
        timestamp: *ref_3
        prediction:
          type: number
          description: Predicted KPI, in range [0, 100]
      x-apidog-orders:
        - timestamp
        - prediction
      required:
        - timestamp
        - prediction
      x-apidog-ignore-properties: []
      x-apidog-folder: ''
  securitySchemes: {}
servers:
  - url: https://api.mpc.dev.placewise.com
    description: Staging
security: []

```