{
  "openapi": "3.1.0",
  "info": {
    "title": "API мобильных Push-уведомлений",
    "version": "1"
  },
  "servers": [
    {
      "url": "https://mobile.retailrocket.net/mobilepush/v1"
    }
  ],
  "x-tagGroups": [
    {
      "name": "Мобильные push-уведомления",
      "tags": ["push_subscription", "push_sending"]
    },
    {
      "name": "Web push-уведомления",
      "tags": ["web_push"]
    }
  ],
  "tags": [
    {
      "name": "push_subscription",
      "x-displayName": "Подписка и отписка",
      "description": "Методы, необходимые для подписки и отписки токенов"
    },
    {
      "name": "push_sending",
      "x-displayName": "Отправка и взаимодействие",
      "description": "Методы, необходимые для отравки push-уведомлений"
    },
    {
      "name": "web_push",
      "x-displayName": "Подписка",
      "description": "Методы, необходимые для подписки на push-уведомления в вебе."
    }
  ],
  "components": {
    "securitySchemes": {},
    "parameters": {
      "PartnerId": {
        "name": "partnerId",
        "in": "query",
        "description": "Идентификатор интернет-магазина",
        "required": true,
        "schema": {
          "type": "string",
          "default": "59908d02c7d013ce40de715a"
        }
      },
      "ApiKeyOld": {
        "name": "apiKey",
        "in": "query",
        "description": "Ключ авторизации",
        "required": true,
        "schema": {
          "type": "string",
          "default": "5b333f5697a528b0184b6017"
        }
      },
      "ApiKey": {
        "name": "x-Api-Key",
        "in": "header",
        "description": "Ключ авторизации",
        "required": true,
        "schema": {
          "type": "string",
          "default": "5b333f5697a528b0184b6017"
        }
      },
      "ContentType": {
        "name": "Content-Type",
        "in": "header",
        "required": true,
        "schema": {
          "type": "string",
          "default": "application/json"
        }
      },
      "Accept": {
        "name": "accept",
        "in": "header",
        "required": true,
        "schema": {
          "type": "string",
          "default": "application/json"
        }
      },
      "partnerId": {
        "schema": {
          "type": "string",
          "description": "Идентификатор интернет-магазина",
          "default": "59908d02c7d013ce40de715a"
        }
      },
      "fcmToken": {
        "schema": {
          "type": "string",
          "description": "FCM-токен [регистрации](https://firebase.google.com/docs/cloud-messaging/manage-tokens?hl=ru)",
          "default": "fkBQTHxKKhs:AP91bHuEedxM4xFAUn0z"
        }
      },
      "fcmTokenUnsubscribe": {
        "schema": {
          "type": "string",
          "description": "FCM-токен [регистрации](https://learn.microsoft.com/ru-ru/xamarin/android/data-cloud/google-messaging/firebase-cloud-messaging)",
          "default": "fkBQTHxKKhs:AP91bHuEedxM4xFAUn0z"
        }
      },
      "fcmProjectId": {
        "schema": {
          "type": "string",
          "description": "Идентификатор проекта Firebase",
          "default": "myfcmproject-1fc2"
        }
      },
      "applicationId": {
        "schema": {
          "type": "string",
          "description": "Идентификатор вашего приложения в системе Retail Rocket",
          "default": "01GV5GME9RWNT4NZD1VG7NEFZ8"
        }
      },
      "link": {
        "schema": {
          "type": "string",
          "description": "Указатель на посетителя - пара, состоящая из произвольных строки-ключа и строки-значения (например, ключ — \"сессия пользователя\", значение — \"идентификатор сессии\")",
          "default": "{\"name\": \"phone\", \"value\": \"71231234567\"}",
          "format": "json"
        }
      },
      "timestamp": {
        "schema": {
          "type": "string",
          "description": "Дата получения события на устройстве (дата события на устройстве может отличаться от даты получения сервером этого события)",
          "default": "2023-01-15T15:53:00+00:00"
        }
      },
      "timestampOld": {
        "schema": {
          "type": "string",
          "description": "Дата получения события на устройстве (дата события на устройстве может отличаться от даты получения сервером этого события)",
          "default": "2022-09-15T15:53:00+00:00"
        }
      },
      "apnsToken": {
        "schema": {
          "type": "string",
          "description": "APNS-токен [регистрации](https://developer.apple.com/documentation/usernotifications/registering_your_app_with_apns)",
          "default": "fkBQTHxKKhs:AP91bHuEedxM4xFAUn0z"
        }
      },
      "apnsTokenUnsubscribe": {
        "schema": {
          "type": "string",
          "description": "APNS-токен [регистрации](https://developer.apple.com/documentation/usernotifications/setting_up_a_remote_notification_server/establishing_a_token-based_connection_to_apns)",
          "default": "fkBQTHxKKhs:AP91bHuEedxM4xFAUn0z"
        }
      },
      "isDevEnvironment": {
        "schema": {
          "type": "boolean",
          "description": "boolean флаг, указывающий для какого окружения предназначены эти настройки (true для dev, false для prod)",
          "default": false
        }
      },
      "huaweiToken": {
        "schema": {
          "type": "string",
          "description": "Huawei-токен",
          "default": "fkBQTHxKKhs:AP91bHuEedxM4xFAUn0z"
        }
      },
      "huaweiTokenDelete": {
        "schema": {
          "type": "string",
          "description": "Huawei токен",
          "default": "fkBQTHxKKhs:AP91bHuEedxM4xFAUn0z"
        }
      },
      "externalId": {
        "schema": {
          "type": "string",
          "description": "Идентификатор отправки в системе отправителя",
          "default": "a597a528b0184b6"
        }
      },
      "notificationId": {
        "schema": {
          "type": "string",
          "description": "Уникальный идентификатор push-уведомления в системе Retail Rocket",
          "default": "01GV5GME9RWNT4NZD1VG7NEFZ8"
        }
      }
    }
  },
  "security": [{}],
  "paths": {
    "/subscriptions/fcm": {
      "post": {
        "tags": ["push_subscription"],
        "summary": "Передача FCM-токена",
        "description": "Данный запрос предоставляет возможность передачи FCM-токена для мобильных push-уведомлений.",
        "operationId": "fcm-token-push",
        "parameters": [
          {
            "$ref": "#/components/parameters/ApiKey"
          },
          {
            "$ref": "#/components/parameters/ContentType"
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "partnerId",
                  "fcmToken",
                  "fcmProjectId",
                  "applicationId",
                  "link",
                  "timestamp"
                ],
                "properties": {
                  "partnerId": {
                    "$ref": "#/components/parameters/partnerId/schema"
                  },
                  "fcmToken": {
                    "$ref": "#/components/parameters/fcmToken/schema"
                  },
                  "fcmProjectId": {
                    "$ref": "#/components/parameters/fcmProjectId/schema"
                  },
                  "applicationId": {
                    "$ref": "#/components/parameters/applicationId/schema"
                  },
                  "link": {
                    "$ref": "#/components/parameters/link/schema"
                  },
                  "timestamp": {
                    "$ref": "#/components/parameters/timestamp/schema"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "200",
            "content": {
              "application/json": {
                "examples": {
                  "Result": {
                    "value": "{}"
                  }
                },
                "schema": {
                  "type": "object",
                  "properties": {}
                }
              }
            }
          },
          "400": {
            "description": "400",
            "content": {
              "application/json": {
                "examples": {
                  "Result": {
                    "value": "{}"
                  }
                },
                "schema": {
                  "type": "object",
                  "properties": {}
                }
              }
            }
          }
        },
        "deprecated": false
      },
      "delete": {
        "summary": "Отписка FCM-токена",
        "tags": ["push_subscription"],
        "description": "Данный запрос предоставляет возможность отписать FCM-токен от мобильных push-уведомлений.",
        "operationId": "fcm-unsubscribe",
        "parameters": [
          {
            "$ref": "#/components/parameters/ApiKey"
          },
          {
            "$ref": "#/components/parameters/ContentType"
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": ["partnerId", "fcmToken", "timestamp"],
                "properties": {
                  "partnerId": {
                    "$ref": "#/components/parameters/partnerId/schema"
                  },
                  "fcmToken": {
                    "$ref": "#/components/parameters/fcmTokenUnsubscribe/schema"
                  },
                  "timestamp": {
                    "$ref": "#/components/parameters/timestamp/schema"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "200",
            "content": {
              "application/json": {
                "examples": {
                  "Result": {
                    "value": "{}"
                  }
                },
                "schema": {
                  "type": "object",
                  "properties": {}
                }
              }
            }
          },
          "400": {
            "description": "400",
            "content": {
              "application/json": {
                "examples": {
                  "Result": {
                    "value": "{}"
                  }
                },
                "schema": {
                  "type": "object",
                  "properties": {}
                }
              }
            }
          }
        },
        "deprecated": false
      }
    },
    "/webPushSubscriptionAdded": {
      "post": {
        "summary": "Передача подписки пользователя",
        "description": "",
        "operationId": "push-notification-customer-subscription",
        "parameters": [
          {
            "$ref": "#/components/parameters/ApiKeyOld"
          },
          {
            "$ref": "#/components/parameters/PartnerId"
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": ["link", "timestamp", "endpoint", "keys"],
                "properties": {
                  "link": {
                    "$ref": "#/components/parameters/link/schema"
                  },
                  "timestamp": {
                    "$ref": "#/components/parameters/timestamp/schema"
                  },
                  "endpoint": {
                    "type": "string",
                    "description": "[URL webpush-endpoint](https://developer.mozilla.org/en-US/docs/Web/API/PushSubscription/endpoint)",
                    "default": "https://www.endpoint.net/url"
                  },
                  "keys": {
                    "type": "object",
                    "description": "[Данные push-уведомления](https://developer.mozilla.org/en-US/docs/Web/API/PushSubscription/getKey)",
                    "required": ["auth", "p256dh"],
                    "properties": {
                      "auth": {
                        "type": "string"
                      },
                      "p256dh": {
                        "type": "string"
                      }
                    }
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "200",
            "content": {
              "application/json": {
                "examples": {
                  "Result": {
                    "value": "{}"
                  }
                },
                "schema": {
                  "type": "object",
                  "properties": {}
                }
              }
            }
          },
          "400": {
            "description": "400",
            "content": {
              "application/json": {
                "examples": {
                  "Result": {
                    "value": "{}"
                  }
                },
                "schema": {
                  "type": "object",
                  "properties": {}
                }
              }
            }
          }
        },
        "deprecated": false,
        "tags": ["web_push"]
      },
      "servers": [
        {
          "url": "https://apptracking.retailrocket.ru/2.0/"
        }
      ]
    },
    "/subscriptions/apns": {
      "post": {
        "tags": ["push_subscription"],
        "summary": "Передача APNS-токена",
        "description": "Данный запрос предоставляет возможность передачи APNS-токена для мобильных push-уведомлений.",
        "operationId": "apns-token-push",
        "parameters": [
          {
            "$ref": "#/components/parameters/ApiKey"
          },
          {
            "$ref": "#/components/parameters/ContentType"
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "partnerId",
                  "apnsToken",
                  "isDevEnvironment",
                  "applicationId",
                  "link",
                  "timestamp"
                ],
                "properties": {
                  "partnerId": {
                    "$ref": "#/components/parameters/partnerId/schema"
                  },
                  "apnsToken": {
                    "$ref": "#/components/parameters/apnsToken/schema"
                  },
                  "isDevEnvironment": {
                    "$ref": "#/components/parameters/isDevEnvironment/schema"
                  },
                  "applicationId": {
                    "$ref": "#/components/parameters/applicationId/schema"
                  },
                  "link": {
                    "$ref": "#/components/parameters/link/schema"
                  },
                  "timestamp": {
                    "$ref": "#/components/parameters/timestamp/schema"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "200",
            "content": {
              "application/json": {
                "examples": {
                  "Result": {
                    "value": "{}"
                  }
                },
                "schema": {
                  "type": "object",
                  "properties": {}
                }
              }
            }
          },
          "400": {
            "description": "400",
            "content": {
              "application/json": {
                "examples": {
                  "Result": {
                    "value": "{}"
                  }
                },
                "schema": {
                  "type": "object",
                  "properties": {}
                }
              }
            }
          }
        },
        "deprecated": false
      },
      "delete": {
        "summary": "Отписка APNS-токена",
        "tags": ["push_subscription"],
        "description": "Данный запрос предоставляет возможность отписать APNS-токен от мобильных push-уведомлений.",
        "operationId": "apns-unsubscribe",
        "parameters": [
          {
            "$ref": "#/components/parameters/ApiKey"
          },
          {
            "$ref": "#/components/parameters/ContentType"
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": ["partnerId", "apnsToken", "timestamp"],
                "properties": {
                  "partnerId": {
                    "$ref": "#/components/parameters/partnerId/schema"
                  },
                  "apnsToken": {
                    "$ref": "#/components/parameters/apnsTokenUnsubscribe/schema"
                  },
                  "timestamp": {
                    "$ref": "#/components/parameters/timestamp/schema"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "200",
            "content": {
              "application/json": {
                "examples": {
                  "Result": {
                    "value": "{}"
                  }
                },
                "schema": {
                  "type": "object",
                  "properties": {}
                }
              }
            }
          },
          "400": {
            "description": "400",
            "content": {
              "application/json": {
                "examples": {
                  "Result": {
                    "value": "{}"
                  }
                },
                "schema": {
                  "type": "object",
                  "properties": {}
                }
              }
            }
          }
        },
        "deprecated": false
      }
    },
    "/subscriptions/huawei": {
      "post": {
        "tags": ["push_subscription"],
        "summary": "Передача Huawei-токена",
        "description": "Данный запрос предоставляет возможность передачи Huawei-токена для мобильных push-уведомлений.",
        "operationId": "huawei-token-subscription",
        "parameters": [
          {
            "$ref": "#/components/parameters/ApiKey"
          },
          {
            "$ref": "#/components/parameters/ContentType"
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "partnerId",
                  "huaweiToken",
                  "applicationId",
                  "link",
                  "timestamp"
                ],
                "properties": {
                  "partnerId": {
                    "$ref": "#/components/parameters/partnerId/schema"
                  },
                  "huaweiToken": {
                    "$ref": "#/components/parameters/huaweiToken/schema"
                  },
                  "applicationId": {
                    "$ref": "#/components/parameters/applicationId/schema"
                  },
                  "link": {
                    "$ref": "#/components/parameters/link/schema"
                  },
                  "timestamp": {
                    "$ref": "#/components/parameters/timestamp/schema"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "200",
            "content": {
              "application/json": {
                "examples": {
                  "Result": {
                    "value": "{}"
                  }
                },
                "schema": {
                  "type": "object",
                  "properties": {}
                }
              }
            }
          },
          "400": {
            "description": "400",
            "content": {
              "application/json": {
                "examples": {
                  "Result": {
                    "value": "{}"
                  }
                },
                "schema": {
                  "type": "object",
                  "properties": {}
                }
              }
            }
          }
        },
        "deprecated": false
      },
      "delete": {
        "tags": ["push_subscription"],
        "summary": "Отписка Huawei-токена",
        "description": "Данный запрос предоставляет возможность отписать Huawei-токен от мобильных push-уведомлений.",
        "operationId": "delete_subscriptionshuawei",
        "responses": {
          "200": {
            "description": ""
          }
        },
        "parameters": [
          {
            "$ref": "#/components/parameters/ApiKey"
          },
          {
            "$ref": "#/components/parameters/ContentType"
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "properties": {
                  "partnerId": {
                    "$ref": "#/components/parameters/partnerId/schema"
                  },
                  "timestamp": {
                    "$ref": "#/components/parameters/timestamp/schema"
                  },
                  "huaweiToken": {
                    "$ref": "#/components/parameters/huaweiTokenDelete/schema"
                  }
                },
                "type": "object",
                "required": ["partnerId", "timestamp", "huaweiToken"]
              }
            }
          }
        }
      }
    },
    "/visitorcommunications": {
      "post": {
        "tags": ["push_sending"],
        "summary": "Отправка push",
        "description": "",
        "operationId": "push-sending",
        "parameters": [
          {
            "$ref": "#/components/parameters/ApiKey"
          },
          {
            "$ref": "#/components/parameters/ContentType"
          },
          {
            "$ref": "#/components/parameters/Accept"
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": ["partnerId", "applicationId", "link"],
                "properties": {
                  "externalId": {
                    "$ref": "#/components/parameters/externalId/schema"
                  },
                  "partnerId": {
                    "$ref": "#/components/parameters/partnerId/schema"
                  },
                  "applicationId": {
                    "$ref": "#/components/parameters/applicationId/schema"
                  },
                  "pushContent": {
                    "type": "object",
                    "description": "Контент push-уведомления",
                    "properties": {
                      "title": {
                        "type": "string",
                        "description": "Заголовок уведомления",
                        "default": "Внимание"
                      },
                      "body": {
                        "type": "string",
                        "description": "Основной текст уведомления",
                        "default": "Спасибо за внимание!"
                      },
                      "imageUrl": {
                        "type": "string",
                        "description": "Ссылка на изображение",
                        "default": "https://www.example.com/image.jpg"
                      },
                      "data": {
                        "type": "array",
                        "items": {
                          "properties": {
                            "key": {
                              "type": "string",
                              "default": "key"
                            },
                            "value": {
                              "type": "string",
                              "default": "value"
                            }
                          },
                          "required": ["key", "value"],
                          "type": "object"
                        }
                      },
                      "apns": {
                        "type": "object",
                        "properties": {
                          "contentAvailable": {
                            "type": "boolean",
                            "default": true
                          }
                        }
                      }
                    }
                  },
                  "link": {
                    "$ref": "#/components/parameters/link/schema"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "200",
            "content": {
              "application/json": {
                "examples": {
                  "Result": {
                    "value": "{}"
                  }
                },
                "schema": {
                  "type": "object",
                  "properties": {}
                }
              }
            }
          },
          "400": {
            "description": "400",
            "content": {
              "application/json": {
                "examples": {
                  "Result": {
                    "value": "{}"
                  }
                },
                "schema": {
                  "type": "object",
                  "properties": {}
                }
              }
            }
          }
        },
        "deprecated": false
      }
    },
    "/tracking/trackDelivery": {
      "post": {
        "tags": ["push_sending"],
        "summary": "Отправка данных о получении push",
        "description": "При отправке push-уведомления в параметр \"data\" добавляется уникальный идентификатор \"RR_NotificationId\", необходимый для данного метода в параметре notificationId.",
        "operationId": "push-track-delivery",
        "parameters": [
          {
            "$ref": "#/components/parameters/ApiKey"
          },
          {
            "$ref": "#/components/parameters/ContentType"
          },
          {
            "$ref": "#/components/parameters/Accept"
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": ["partnerId", "notificationId", "timestamp"],
                "properties": {
                  "partnerId": {
                    "$ref": "#/components/parameters/partnerId/schema"
                  },
                  "notificationId": {
                    "$ref": "#/components/parameters/notificationId/schema"
                  },
                  "timestamp": {
                    "$ref": "#/components/parameters/timestampOld/schema"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "200",
            "content": {
              "application/json": {
                "examples": {
                  "Result": {
                    "value": "{}"
                  }
                },
                "schema": {
                  "type": "object",
                  "properties": {}
                }
              }
            }
          },
          "400": {
            "description": "400",
            "content": {
              "application/json": {
                "examples": {
                  "Result": {
                    "value": "{}"
                  }
                },
                "schema": {
                  "type": "object",
                  "properties": {}
                }
              }
            }
          }
        },
        "deprecated": false
      }
    },
    "/tracking/trackTap": {
      "post": {
        "tags": ["push_sending"],
        "summary": "Клик в push",
        "description": "При отправке push-уведомления в параметр \"data\" добавляется уникальный идентификатор \"RR_NotificationId\", необходимый для данного метода в параметре notificationId.",
        "operationId": "push-track-tap",
        "parameters": [
          {
            "$ref": "#/components/parameters/ApiKey"
          },
          {
            "$ref": "#/components/parameters/ContentType"
          },
          {
            "$ref": "#/components/parameters/Accept"
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": ["partnerId", "notificationId", "timestamp"],
                "properties": {
                  "partnerId": {
                    "$ref": "#/components/parameters/partnerId/schema"
                  },
                  "notificationId": {
                    "$ref": "#/components/parameters/notificationId/schema"
                  },
                  "timestamp": {
                    "$ref": "#/components/parameters/timestampOld/schema"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "200",
            "content": {
              "application/json": {
                "examples": {
                  "Result": {
                    "value": "{}"
                  }
                },
                "schema": {
                  "type": "object",
                  "properties": {}
                }
              }
            }
          },
          "400": {
            "description": "400",
            "content": {
              "application/json": {
                "examples": {
                  "Result": {
                    "value": "{}"
                  }
                },
                "schema": {
                  "type": "object",
                  "properties": {}
                }
              }
            }
          }
        },
        "deprecated": false
      }
    }
  },
  "x-readme": {
    "headers": [],
    "explorer-enabled": true,
    "proxy-enabled": true
  },
  "x-readme-fauxas": true
}
