{
  "openapi": "3.0.3",
  "info": {
    "version": "1.0",
    "title": "LianaAutomation REST API documentation",
    "description": "LianaAutomation REST API documentation.\n",
    "contact": {
      "name": "LianaAutomation Support",
      "url": "https://support.lianatech.com/lianaautomation/rest-api.html"
    }
  },
  "servers": [
    {
      "url": "https://rest.automation.lianacloud.com/api/v1",
      "description": "LianaAutomation Integration host"
    }
  ],
  "security": [
    {
      "OAuthBearer": []
    }
  ],
  "tags": [
    {
      "name": "Authentication",
      "description": "LianaAutomation REST API authenticates requests with OAuth 2.0 Bearer tokens.\n\n## OAuth 2.0 Bearer Token\n\nOAuth 2.0 client credentials authentication is the recommended method for\nserver-to-server integrations. A short-lived access token is obtained from the LianaCloud\ntoken service and sent as a Bearer token in the `Authorization` header.\n\n### Obtaining client credentials\n\nCreate OAuth client credentials in LianaAccount or contact your account manager.\nEach credential set is associated with a customer account and carries a set\nof permitted scopes.\n\n### Requesting an access token\n\nExchange your client credentials for an access token using the OAuth 2.0 client\ncredentials grant:\n\n```\nPOST https://tokens.lianacloud.com/token\nContent-Type: application/x-www-form-urlencoded\n\ngrant_type=client_credentials&client_id=<your-client-id>&client_secret=<your-client-secret>&scope=automation-api\n```\n\nThe token service returns a JSON response:\n\n```json\n{\n  \"access_token\": \"eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9...\",\n  \"token_type\": \"Bearer\",\n  \"expires_in\": 900,\n  \"scope\": \"automation-api\"\n}\n```\n\n### Required scope\n\nThe token must carry at least one scope from the `automation-api` namespace.\nUse `automation-api` as the scope value when requesting the token.\n\n### Making authenticated requests\n\nInclude the access token in the `Authorization` header of every request:\n\n```\nAuthorization: Bearer <access-token>\nContent-Type: application/json\n```\n\n### Token expiry\n\nAccess tokens are short-lived (the `expires_in` field in seconds shows the lifetime).\nWhen a token expires, the API returns a 401 response. Request a new token from the\ntoken service using the same client credentials.\n\n### Error responses\n\nAuthentication failures return HTTP 401. A wrong URL returns HTTP 404.\n",
      "externalDocs": {
        "description": "Full authentication guide on the Liana support site",
        "url": "https://support.lianatech.com/lianaautomation/rest-api/authentication-and-authorization.html"
      }
    },
    {
      "name": "Ping",
      "description": "Test connection",
      "externalDocs": {
        "description": "Support documentation",
        "url": "https://support.lianatech.com/lianaautomation/rest-api/authentication-and-authorization.html"
      }
    },
    {
      "name": "Import",
      "description": "Import events",
      "externalDocs": {
        "description": "Support documentation",
        "url": "https://support.lianatech.com/lianaautomation/rest-api/importing-data.html"
      }
    },
    {
      "name": "Database",
      "description": "Query database"
    },
    {
      "name": "Export",
      "description": "Export data"
    },
    {
      "name": "Segment",
      "description": "Segment management"
    }
  ],
  "paths": {
    "/pingpong": {
      "post": {
        "tags": [
          "Ping"
        ],
        "summary": "pingpong",
        "description": "This utility function can be used for verifying connections with the LianaAutomation REST API.\nThis is the first command you should try out before investing time into the more complex ones\n",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "allOf": [
                  {
                    "$ref": "#/components/schemas/PingPongIn"
                  }
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PingPongOut"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Standard400"
          },
          "404": {
            "$ref": "#/components/responses/Standard404"
          }
        }
      }
    },
    "/import": {
      "post": {
        "tags": [
          "Import"
        ],
        "summary": "import",
        "description": "Bring data to LianaAutomation from external systems.",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ImportIn"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ImportOut"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Standard400"
          },
          "404": {
            "$ref": "#/components/responses/Standard404"
          }
        }
      }
    },
    "/database/search/request": {
      "post": {
        "tags": [
          "Database"
        ],
        "summary": "search/request",
        "description": "Make a database search request",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/RequestIn"
              }
            }
          }
        },
        "responses": {
          "200": {
            "$ref": "#/components/responses/StandardHandle"
          },
          "400": {
            "$ref": "#/components/responses/Standard400"
          },
          "404": {
            "$ref": "#/components/responses/Standard404"
          }
        }
      }
    },
    "/database/search/ready": {
      "post": {
        "tags": [
          "Database"
        ],
        "summary": "search/ready",
        "description": "Check if a requested database search is completed. If the job failed, the response also has `error`: stop polling and make a new request. Results and errors are kept for about an hour. After that, and for an unknown handle, `ready` is `false` without `error`, so set an overall deadline for polling.",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/Handle"
              }
            }
          }
        },
        "responses": {
          "200": {
            "$ref": "#/components/responses/StandardReady"
          },
          "400": {
            "$ref": "#/components/responses/Standard400"
          },
          "404": {
            "$ref": "#/components/responses/Standard404"
          }
        }
      }
    },
    "/database/search/result": {
      "post": {
        "tags": [
          "Database"
        ],
        "summary": "search/result",
        "description": "Fetch search results of a finished request",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/Handle"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ResultOut"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Standard400"
          },
          "404": {
            "$ref": "#/components/responses/Standard404"
          }
        }
      }
    },
    "/database/delete/request": {
      "post": {
        "tags": [
          "Database"
        ],
        "summary": "delete/request",
        "description": "Request data to be deleted from database.",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/schemas-RequestIn"
              }
            }
          }
        },
        "responses": {
          "200": {
            "$ref": "#/components/responses/StandardHandle"
          },
          "400": {
            "$ref": "#/components/responses/Standard400"
          },
          "404": {
            "$ref": "#/components/responses/Standard404"
          }
        }
      }
    },
    "/database/delete/ready": {
      "post": {
        "tags": [
          "Database"
        ],
        "summary": "delete/ready",
        "description": "Check if a delete request is finished. If the job failed, the response also has `error`: stop polling and make a new request. Results and errors are kept for about an hour. After that, and for an unknown handle, `ready` is `false` without `error`, so set an overall deadline for polling.",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/Handle"
              }
            }
          }
        },
        "responses": {
          "200": {
            "$ref": "#/components/responses/StandardReady"
          },
          "400": {
            "$ref": "#/components/responses/Standard400"
          },
          "404": {
            "$ref": "#/components/responses/Standard404"
          }
        }
      }
    },
    "/database/delete/result": {
      "post": {
        "tags": [
          "Database"
        ],
        "summary": "delete/result",
        "description": "Returns LianaAutomation system id of the deleted items.",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/Handle"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/schemas-ResultOut"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Standard400"
          },
          "404": {
            "$ref": "#/components/responses/Standard404"
          }
        }
      }
    },
    "/export/request": {
      "post": {
        "tags": [
          "Export"
        ],
        "summary": "export/request",
        "description": "Make a request to export the contents of a given segment.",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/components-schemas-RequestIn"
              }
            }
          }
        },
        "responses": {
          "200": {
            "$ref": "#/components/responses/StandardHandle"
          },
          "400": {
            "$ref": "#/components/responses/Standard400"
          },
          "404": {
            "$ref": "#/components/responses/Standard404"
          }
        }
      }
    },
    "/export/ready": {
      "post": {
        "tags": [
          "Export"
        ],
        "summary": "export/ready",
        "description": "Check if an export request is ready. If the job failed, the response also has `error`: stop polling and make a new request. Results and errors are kept for about an hour. After that, and for an unknown handle, `ready` is `false` without `error`, so set an overall deadline for polling.",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/Handle"
              }
            }
          }
        },
        "responses": {
          "200": {
            "$ref": "#/components/responses/StandardReady"
          },
          "400": {
            "$ref": "#/components/responses/Standard400"
          },
          "404": {
            "$ref": "#/components/responses/Standard404"
          }
        }
      }
    },
    "/export/result": {
      "post": {
        "tags": [
          "Export"
        ],
        "summary": "export/result",
        "description": "Export results of a finished export request.",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/Handle"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/components-schemas-ResultOut"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Standard400"
          },
          "404": {
            "$ref": "#/components/responses/Standard404"
          }
        }
      }
    },
    "/segment/list": {
      "post": {
        "tags": [
          "Segment"
        ],
        "summary": "segment/list",
        "description": "List of segments.",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object"
              },
              "example": {}
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ListOut"
                },
                "example": [
                  {
                    "id": 1,
                    "name": "contact has a first name",
                    "description": "",
                    "hidden": true,
                    "system_name": null
                  }
                ]
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Standard400"
          },
          "404": {
            "$ref": "#/components/responses/Standard404"
          }
        }
      }
    },
    "/channel/list": {
      "post": {
        "tags": [
          "Channel"
        ],
        "summary": "channel/list",
        "description": "List of channels. Depending on channel type different fields will be returned.",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object"
              },
              "example": {}
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/schemas-ListOut"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Standard400"
          },
          "404": {
            "$ref": "#/components/responses/Standard404"
          }
        }
      }
    },
    "/channel/create": {
      "post": {
        "tags": [
          "Channel"
        ],
        "summary": "channel/create",
        "description": "Create channel. Only channels without type can be created.",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ChannelCreateIn"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SingleOut"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Standard400"
          },
          "404": {
            "$ref": "#/components/responses/Standard404"
          }
        }
      }
    },
    "/channel/edit": {
      "post": {
        "tags": [
          "Channel"
        ],
        "summary": "channel/edit",
        "description": "Edit channel. Only channels without type can be edited.",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ChannelEditIn"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SingleOut"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Standard400"
          },
          "404": {
            "$ref": "#/components/responses/Standard404"
          }
        }
      }
    },
    "/channel/delete": {
      "post": {
        "tags": [
          "Channel"
        ],
        "summary": "channel/delete",
        "description": "Delete channel. Channel can be deleted only if it doesn't have type, events and is not used in any automation or segment.",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ChannelDeleteIn"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ChannelDeleteOut"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Standard400"
          },
          "404": {
            "$ref": "#/components/responses/Standard404"
          }
        }
      }
    },
    "/report/automations/request": {
      "post": {
        "tags": [
          "Report"
        ],
        "summary": "automations/request",
        "description": "Make a automations report request",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ReportAutomationsIn"
              }
            }
          }
        },
        "responses": {
          "200": {
            "$ref": "#/components/responses/StandardHandle"
          },
          "400": {
            "$ref": "#/components/responses/Standard400"
          },
          "404": {
            "$ref": "#/components/responses/Standard404"
          }
        }
      }
    },
    "/report/automations/ready": {
      "post": {
        "tags": [
          "Report"
        ],
        "summary": "automations/ready",
        "description": "Check if a requested automations report is completed.",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/Handle"
              }
            }
          }
        },
        "responses": {
          "200": {
            "$ref": "#/components/responses/StandardReady"
          },
          "400": {
            "$ref": "#/components/responses/Standard400"
          },
          "404": {
            "$ref": "#/components/responses/Standard404"
          }
        }
      }
    },
    "/report/automations/result": {
      "post": {
        "tags": [
          "Report"
        ],
        "summary": "automations/result",
        "description": "Fetch results of a finished request",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/Handle"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ReportAutomationsOut"
                },
                "example": [
                  {
                    "id": 91,
                    "name": "Automation",
                    "enabled": true,
                    "summary": {
                      "bounces": 0,
                      "clickers": 0,
                      "clicks": 0,
                      "ctr": 0,
                      "engagement": 5,
                      "non-openers": 19,
                      "openers": 81,
                      "opens": 100,
                      "or": 81,
                      "persons": 100,
                      "person-engagement": 0,
                      "sent": 400
                    },
                    "messages": [
                      {
                        "id": 58,
                        "subject": "Message subject",
                        "rates": {
                          "current": {
                            "mailopen": {
                              "avg": 41.5,
                              "total": 41.5,
                              "trend": -88
                            },
                            "maillink": {
                              "avg": 0,
                              "total": 0,
                              "trend": 0
                            }
                          },
                          "month": {
                            "mailopen": {
                              "avg": 0,
                              "total": 0,
                              "trend": 0
                            },
                            "maillink": {
                              "avg": 0,
                              "total": 0,
                              "trend": 0
                            }
                          }
                        },
                        "graph": {
                          "mailsent": {
                            "counts": [
                              0,
                              1,
                              1
                            ],
                            "total_count": 2,
                            "highest_count": 2
                          },
                          "mailopen": {
                            "counts": [
                              1,
                              0,
                              2
                            ],
                            "ratios": [
                              20.5,
                              0,
                              1.1
                            ],
                            "total_count": 3,
                            "highest_count": 2,
                            "highest_ratio": 20.5
                          },
                          "maillink": {
                            "counts": [
                              1,
                              0,
                              1
                            ],
                            "ratios": [
                              15.5,
                              0,
                              2.5
                            ],
                            "total_count": 2,
                            "highest_count": 1,
                            "highest_ratio": 15.5
                          },
                          "categories": [
                            "2020-06-01T00:00:00+03:00",
                            "2020-07-01T00:00:00+03:00",
                            "2020-08-01T00:00:00+03:00"
                          ],
                          "highest_count": 3,
                          "highest_ratio": 20.5,
                          "interval": "month"
                        },
                        "summary": {
                          "bounces": 0,
                          "clickers": 0,
                          "clicks": 0,
                          "ctr": 0,
                          "engagement": 5,
                          "non-openers": 19,
                          "openers": 81,
                          "opens": 100,
                          "or": 81,
                          "person-engagement": 0,
                          "persons": 100,
                          "sent": 400
                        }
                      }
                    ]
                  }
                ]
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Standard400"
          },
          "404": {
            "$ref": "#/components/responses/Standard404"
          }
        }
      }
    },
    "/form/list": {
      "post": {
        "tags": [
          "Form"
        ],
        "summary": "form/list",
        "description": "List of forms.",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object"
              },
              "example": {}
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/components-schemas-ListOut"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Standard400"
          },
          "404": {
            "$ref": "#/components/responses/Standard404"
          }
        }
      }
    },
    "/info": {
      "post": {
        "tags": [
          "Info"
        ],
        "summary": "info",
        "description": "Get information about installation",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object"
              },
              "example": {}
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/InfoOut"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Standard400"
          },
          "404": {
            "$ref": "#/components/responses/Standard404"
          }
        }
      }
    }
  },
  "components": {
    "securitySchemes": {
      "OAuthBearer": {
        "type": "http",
        "scheme": "bearer",
        "bearerFormat": "JWT",
        "description": "OAuth 2.0 Bearer token obtained via the client credentials grant from\n`https://tokens.lianacloud.com`. The token must carry at least one scope in\nthe `automation-api` namespace.\n"
      }
    },
    "schemas": {
      "PingPongIn": {
        "type": "object",
        "properties": {
          "ping": {
            "type": "string",
            "example": "pong"
          }
        }
      },
      "PingPongOut": {
        "type": "object",
        "properties": {
          "pong": {
            "type": "string",
            "example": "pong"
          }
        }
      },
      "Error": {
        "type": "object",
        "properties": {
          "message": {
            "type": "string"
          },
          "status": {
            "type": "integer"
          },
          "status_message": {
            "type": "string"
          }
        }
      },
      "ImportIn": {
        "type": "object",
        "required": [
          "channel",
          "data"
        ],
        "properties": {
          "channel": {
            "type": "string",
            "description": "The channel system name or ID. Channel ID is used to track the source of the data. Can be found from LianaAutomation under Settings from the Admin Channels -page"
          },
          "no_duplicates": {
            "type": "boolean",
            "description": "If true, do not create a new duplicate event when an identical event already exists. Automations will not be triggered. Default: false",
            "example": false
          },
          "skip_automations": {
            "type": "boolean",
            "description": "If true, this import will not trigger automations. Default: false",
            "example": false
          },
          "allow_identity_update": {
            "type": "boolean",
            "description": "If true, the import can update email and sms values of the identity. Default: false",
            "example": false
          },
          "data": {
            "type": "array",
            "description": "An array of multiple identities and events related to that identity.",
            "items": {
              "type": "object",
              "required": [
                "identity",
                "events"
              ],
              "properties": {
                "identity": {
                  "description": "Identifier fields for a person. At least one property must be given",
                  "type": "object",
                  "properties": {
                    "email": {
                      "description": "Email address",
                      "type": "string"
                    },
                    "sms": {
                      "description": "SMS number",
                      "type": "string"
                    },
                    "extra1": {
                      "description": "Extra identifier 1",
                      "type": "string"
                    },
                    "token": {
                      "description": "Token (cookie from tracking script)",
                      "type": "string"
                    }
                  }
                },
                "events": {
                  "description": "Events to import for the person",
                  "type": "array",
                  "items": {
                    "type": "object",
                    "required": [
                      "verb",
                      "items"
                    ],
                    "properties": {
                      "verb": {
                        "description": "Event type. May contain only basic lowercase characters (a-z, not ä,ö,å,é,...), numbers and underscores.",
                        "type": "string",
                        "pattern": "^[a-z0-9_]+$"
                      },
                      "items": {
                        "description": "Event data as key-value pairs. Keys may contain only basic lowercase characters (a-z, not ä,ö,å,é,...), numbers, underscores and dash-characters.",
                        "type": "object",
                        "properties": {
                          "example-key1": {
                            "type": "string"
                          },
                          "example-key2": {
                            "type": "string"
                          }
                        }
                      }
                    }
                  }
                }
              }
            }
          }
        }
      },
      "ImportOut": {
        "type": "object",
        "properties": {
          "succeed": {
            "description": "Returns true when the request was successful. Not to confuse with a successful import.",
            "type": "boolean"
          },
          "handle": {
            "description": "The request handle",
            "type": "string"
          }
        }
      },
      "RequestIn": {
        "type": "object",
        "properties": {
          "channels": {
            "description": "Channels to search from",
            "type": "array",
            "items": {
              "type": "string",
              "example": "1"
            }
          },
          "verbs": {
            "description": "Event types to search for",
            "type": "array",
            "items": {
              "type": "string",
              "example": "contact"
            }
          },
          "from": {
            "description": "Event is newer than",
            "type": "string",
            "format": "date-time"
          },
          "to": {
            "description": "Event is older than",
            "type": "string",
            "format": "date-time"
          },
          "include_data": {
            "description": "Include event data in response",
            "type": "boolean"
          },
          "limit": {
            "description": "Limit event count in result. Maximum is 10000",
            "type": "integer",
            "default": 10000
          },
          "offset": {
            "description": "Offset for traversing large event counts",
            "type": "integer"
          },
          "identities": {
            "description": "Persons to search for",
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "email": {
                  "type": "string",
                  "example": "user@example.com"
                },
                "sms": {
                  "type": "string",
                  "example": "+3560101234567"
                },
                "extra1": {
                  "type": "string",
                  "example": "extra1"
                },
                "token": {
                  "type": "string",
                  "example": "abc123"
                },
                "id": {
                  "type": "integer",
                  "example": 1234
                }
              }
            }
          }
        }
      },
      "Handle": {
        "type": "object",
        "properties": {
          "handle": {
            "description": "The handle returned as response from the initial request",
            "type": "string",
            "example": "1234"
          }
        }
      },
      "Ready": {
        "type": "object",
        "properties": {
          "ready": {
            "type": "boolean",
            "example": true
          },
          "error": {
            "type": "string",
            "description": "Why the job failed. Only database searches, deletes and exports return it. A failed automation report is `ready`, and its `result` has the error."
          }
        }
      },
      "ResultOut": {
        "type": "array",
        "items": {
          "type": "object",
          "properties": {
            "at": {
              "type": "string",
              "format": "date-time"
            },
            "verb": {
              "type": "string",
              "example": "created"
            },
            "channel": {
              "type": "integer",
              "example": 2
            },
            "identity": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "integer",
                  "example": 1234
                },
                "token": {
                  "type": "string",
                  "example": "abc123"
                },
                "email": {
                  "type": "string",
                  "example": "user@example.com"
                },
                "sms": {
                  "type": "string",
                  "example": "+3580101234567"
                },
                "extra1": {
                  "type": "string",
                  "example": "extra1"
                }
              }
            },
            "data": {
              "type": "object",
              "properties": {
                "date": {
                  "type": "string",
                  "format": "date-time"
                },
                "origin": {
                  "type": "string",
                  "example": "admin.mailer.domain"
                }
              }
            }
          }
        }
      },
      "schemas-RequestIn": {
        "type": "object",
        "properties": {
          "channels": {
            "description": "Channels to delete from",
            "type": "array",
            "items": {
              "type": "string",
              "example": "1"
            }
          },
          "identities": {
            "description": "Persons to delete",
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "description": "Person ID",
                  "type": "array",
                  "items": {
                    "type": "integer",
                    "example": 1234
                  }
                },
                "email": {
                  "description": "Email address",
                  "type": "array",
                  "items": {
                    "type": "string",
                    "example": "user@example.com"
                  }
                },
                "sms": {
                  "description": "SMS number",
                  "type": "array",
                  "items": {
                    "type": "string",
                    "example": "+3580101234567"
                  }
                },
                "extra1": {
                  "description": "Extra identifier 1",
                  "type": "array",
                  "items": {
                    "type": "string",
                    "example": "extra1"
                  }
                }
              }
            }
          }
        }
      },
      "schemas-ResultOut": {
        "type": "object",
        "properties": {
          "deleted": {
            "type": "array",
            "items": {
              "type": "integer"
            },
            "example": [
              1,
              2,
              3
            ]
          }
        }
      },
      "components-schemas-RequestIn": {
        "description": "Segment ID",
        "type": "integer",
        "example": 1
      },
      "components-schemas-ResultOut": {
        "type": "array",
        "items": {
          "type": "object",
          "properties": {
            "email": {
              "type": "string",
              "example": "user@example.com"
            },
            "sms": {
              "type": "string",
              "example": "+3580101234567"
            },
            "system-event-date": {
              "type": "string",
              "format": "date-time"
            },
            "formsend-sentfrom": {
              "type": "string",
              "example": "NULL"
            },
            "id": {
              "type": "integer",
              "example": 1234
            }
          }
        }
      },
      "ListOut": {
        "type": "array",
        "items": {
          "type": "object",
          "properties": {
            "id": {
              "type": "integer",
              "example": 1
            },
            "name": {
              "type": "string",
              "example": "Contact has a first name"
            },
            "description": {
              "type": "string",
              "example": ""
            },
            "hidden": {
              "type": "boolean",
              "example": true
            },
            "system_name": {
              "type": "string",
              "nullable": true,
              "example": null
            },
            "limit_contacts": {
              "deprecated": true,
              "type": "string"
            },
            "exclude_date": {
              "deprecated": true,
              "type": "string"
            },
            "exclude_days": {
              "deprecated": true,
              "type": "string"
            }
          }
        }
      },
      "ChannelOut": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer",
            "example": 1
          },
          "name": {
            "type": "string",
            "example": "Automation"
          },
          "color": {
            "type": "string",
            "example": "#37aef3"
          },
          "front_url": {
            "type": "string",
            "example": "//t.lianacem.com"
          },
          "icon": {
            "type": "string",
            "example": ""
          },
          "tracking_enabled": {
            "type": "boolean",
            "example": true
          },
          "notes": {
            "type": "string",
            "example": ""
          },
          "system_name": {
            "type": "string",
            "example": ""
          },
          "tracking_js": {
            "type": "string",
            "example": ""
          },
          "import_js": {
            "type": "string",
            "example": ""
          },
          "gtm_url": {
            "type": "string",
            "example": "https://x.lianacem.com/t/x/gtm"
          },
          "verbs": {
            "description": "Channel event types",
            "type": "object",
            "additionalProperties": {
              "type": "boolean"
            },
            "example": {
              "contact": true,
              "formsend": false
            }
          },
          "type": {
            "type": "string",
            "example": "empty",
            "enum": [
              "empty",
              "liana_cms",
              "liana_commerce",
              "site",
              "store",
              "eventilla",
              "push_notification",
              "whatsapp"
            ]
          },
          "default_url": {
            "type": "string",
            "example": ""
          },
          "events": {
            "type": "integer",
            "example": 100
          }
        }
      },
      "schemas-ListOut": {
        "type": "array",
        "items": {
          "allOf": [
            {
              "$ref": "#/components/schemas/ChannelOut"
            }
          ]
        }
      },
      "ChannelIn": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "example": "Automation"
          },
          "color": {
            "type": "string",
            "example": "#37aef3"
          },
          "tracking_enabled": {
            "type": "boolean",
            "example": true,
            "default": false
          },
          "notes": {
            "type": "string",
            "example": ""
          }
        }
      },
      "ChannelCreateIn": {
        "allOf": [
          {
            "$ref": "#/components/schemas/ChannelIn"
          }
        ],
        "required": [
          "name"
        ]
      },
      "SingleOut": {
        "allOf": [
          {
            "$ref": "#/components/schemas/ChannelOut"
          }
        ]
      },
      "ChannelEditIn": {
        "allOf": [
          {
            "type": "object",
            "properties": {
              "id": {
                "type": "integer",
                "example": 10
              }
            }
          },
          {
            "$ref": "#/components/schemas/ChannelIn"
          }
        ],
        "required": [
          "id"
        ]
      },
      "ChannelDeleteIn": {
        "allOf": [
          {
            "type": "object",
            "properties": {
              "id": {
                "type": "integer",
                "example": 10
              }
            }
          }
        ],
        "required": [
          "id"
        ]
      },
      "ChannelDeleteOut": {
        "type": "object",
        "properties": {
          "succeed": {
            "example": true,
            "type": "boolean"
          }
        }
      },
      "ReportAutomationsIn": {
        "type": "object",
        "required": [
          "start_date",
          "end_date"
        ],
        "properties": {
          "start_date": {
            "type": "string",
            "example": "2022-02-01"
          },
          "end_date": {
            "type": "string",
            "example": "2022-02-25"
          }
        }
      },
      "ReportAutomationsSummary": {
        "type": "object",
        "properties": {
          "bounces": {
            "type": "integer",
            "description": "Bounces",
            "example": 5
          },
          "clickers": {
            "type": "integer",
            "description": "Clickers",
            "example": 2
          },
          "clicks": {
            "type": "integer",
            "description": "Clicks",
            "example": 4
          },
          "ctr": {
            "type": "number",
            "description": "Click ratio",
            "example": 25.5
          },
          "engagement": {
            "type": "integer",
            "description": "Engagement",
            "example": 4
          },
          "non-openers": {
            "type": "integer",
            "description": "Non-openers",
            "example": 6
          },
          "openers": {
            "type": "integer",
            "description": "Openers",
            "example": 2
          },
          "opens": {
            "type": "integer",
            "description": "Opens",
            "example": 3
          },
          "or": {
            "type": "number",
            "description": "Open ratio",
            "example": 25.5
          },
          "person-engagement": {
            "type": "integer",
            "description": "Person engagement",
            "example": 0
          },
          "persons": {
            "type": "integer",
            "description": "Persons",
            "example": 50
          },
          "sent": {
            "type": "integer",
            "description": "Messages sent",
            "example": 75
          }
        }
      },
      "ReportAutomationsMessageMailOpen": {
        "type": "object",
        "properties": {
          "avg": {
            "type": "number",
            "description": "Average mail open ratio",
            "example": 60
          },
          "total": {
            "type": "number",
            "description": "Total mail open ratio",
            "example": 55.5
          },
          "trend": {
            "type": "integer",
            "description": "Mail open trend",
            "example": 25
          }
        }
      },
      "ReportAutomationsMessageRatesMailClick": {
        "type": "object",
        "properties": {
          "avg": {
            "type": "number",
            "description": "Average mail click ratio",
            "example": 41.5
          },
          "total": {
            "type": "number",
            "description": "Total mail click ratio",
            "example": 45
          },
          "trend": {
            "type": "integer",
            "description": "Mail click trend",
            "example": 50
          }
        }
      },
      "ReportAutomationsMessageGraphMailSent": {
        "type": "object",
        "properties": {
          "counts": {
            "type": "array",
            "items": {
              "type": "integer"
            },
            "example": [
              5,
              1
            ]
          },
          "total_count": {
            "type": "integer",
            "example": 6
          },
          "highest_count": {
            "type": "integer",
            "example": 5
          }
        }
      },
      "ReportAutomationsMessageGraphMailOpenAndClick": {
        "type": "object",
        "properties": {
          "counts": {
            "type": "array",
            "items": {
              "type": "integer"
            },
            "example": [
              5,
              1
            ]
          },
          "ratios": {
            "type": "array",
            "items": {
              "type": "number"
            },
            "example": [
              45.5,
              10.5
            ]
          },
          "total_count": {
            "type": "integer",
            "example": 6
          },
          "highest_count": {
            "type": "integer",
            "example": 5
          },
          "highest_ratio": {
            "type": "number",
            "example": 45.5
          }
        }
      },
      "ReportAutomationsOut": {
        "type": "array",
        "items": {
          "type": "object",
          "properties": {
            "id": {
              "type": "integer",
              "description": "Automation id",
              "example": 1
            },
            "name": {
              "type": "string",
              "description": "Automation name",
              "example": "Customer automation"
            },
            "enabled": {
              "type": "boolean",
              "description": "Automation state",
              "example": true
            },
            "summary": {
              "$ref": "#/components/schemas/ReportAutomationsSummary"
            },
            "messages": {
              "type": "array",
              "items": {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "integer",
                    "description": "Message id",
                    "example": 1
                  },
                  "subject": {
                    "type": "string",
                    "description": "Message subject",
                    "example": "Subject"
                  },
                  "rates": {
                    "type": "object",
                    "properties": {
                      "current": {
                        "type": "object",
                        "properties": {
                          "mailopen": {
                            "$ref": "#/components/schemas/ReportAutomationsMessageMailOpen"
                          },
                          "maillink": {
                            "$ref": "#/components/schemas/ReportAutomationsMessageRatesMailClick"
                          }
                        }
                      },
                      "month": {
                        "type": "object",
                        "properties": {
                          "mailopen": {
                            "$ref": "#/components/schemas/ReportAutomationsMessageMailOpen"
                          },
                          "maillink": {
                            "$ref": "#/components/schemas/ReportAutomationsMessageRatesMailClick"
                          }
                        }
                      }
                    }
                  },
                  "graph": {
                    "type": "object",
                    "properties": {
                      "mailsent": {
                        "$ref": "#/components/schemas/ReportAutomationsMessageGraphMailSent"
                      },
                      "mailopen": {
                        "$ref": "#/components/schemas/ReportAutomationsMessageGraphMailOpenAndClick"
                      },
                      "maillink": {
                        "$ref": "#/components/schemas/ReportAutomationsMessageGraphMailOpenAndClick"
                      },
                      "categories": {
                        "type": "array",
                        "items": {
                          "type": "string"
                        },
                        "example": [
                          "2020-06-01T00:00:00+03:00",
                          "2020-07-01T00:00:00+03:00"
                        ]
                      },
                      "highest_count": {
                        "type": "integer",
                        "example": 5
                      },
                      "highest_ratio": {
                        "type": "number",
                        "example": 97.5
                      },
                      "interval": {
                        "type": "string",
                        "enum": [
                          "month"
                        ]
                      }
                    }
                  },
                  "summary": {
                    "$ref": "#/components/schemas/ReportAutomationsSummary"
                  }
                }
              }
            }
          }
        }
      },
      "components-schemas-ListOut": {
        "type": "array",
        "items": {
          "type": "object",
          "properties": {
            "id": {
              "type": "integer",
              "example": 1
            },
            "name": {
              "type": "string",
              "example": "Contact form"
            },
            "embed_code_with_styles": {
              "type": "string",
              "example": "<div></div><script></script>"
            },
            "embed_code_without_styles": {
              "type": "string",
              "example": "<div></div><script></script>"
            }
          }
        }
      },
      "InfoOut": {
        "type": "object",
        "properties": {
          "installation_name": {
            "type": "string",
            "example": "LianaAutomation"
          },
          "base_url": {
            "type": "string",
            "example": "https://x.lianacem.com/"
          }
        }
      }
    },
    "responses": {
      "Standard400": {
        "description": "Bad Request",
        "content": {
          "application/json": {
            "schema": {
              "allOf": [
                {
                  "$ref": "#/components/schemas/Error"
                }
              ]
            },
            "example": {
              "message": "unknown",
              "status": 400,
              "status_message": "Bad Request"
            }
          }
        }
      },
      "Standard404": {
        "description": "Not Found",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            },
            "example": {
              "message": "Not Found",
              "status": 404,
              "status_message": "Not Found"
            }
          }
        }
      },
      "StandardHandle": {
        "description": "OK",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Handle"
            },
            "example": {
              "handle": "1234"
            }
          }
        }
      },
      "StandardReady": {
        "description": "OK",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Ready"
            },
            "example": {
              "ready": true
            }
          }
        }
      }
    }
  }
}