{
  "consumes": [
    "application/json"
  ],
  "produces": [
    "application/json"
  ],
  "schemes": [
    "http"
  ],
  "swagger": "2.0",
  "info": {
    "description": "Attention Service API",
    "title": "Attention Service",
    "termsOfService": "http://attention.tech/terms",
    "contact": {
      "name": "Attention Team",
      "url": "https://attention.tech/developers",
      "email": "johan@attention.tech"
    },
    "license": {
      "name": "Apache 2.0",
      "url": "https://www.apache.org/licenses/LICENSE-2.0.html"
    },
    "version": "1.0.0"
  },
  "host": "api.attention.tech",
  "basePath": "/",
  "paths": {
    "/": {
      "get": {
        "security": [],
        "description": "Home",
        "operationId": "home",
        "responses": {
          "200": {
            "description": "empty response"
          }
        }
      }
    },
    "/aircall/webhook": {
      "post": {
        "security": [],
        "operationId": "aircallWebhook",
        "responses": {
          "default": {
            "description": "unexpected error",
            "schema": {
              "$ref": "#/definitions/Error"
            }
          }
        }
      }
    },
    "/ameyo/webhook/{objectTypeCode}": {
      "post": {
        "security": [],
        "consumes": [
          "application/x-www-form-urlencoded",
          "application/json"
        ],
        "produces": [
          "application/json"
        ],
        "operationId": "ameyoWebhookObjectType",
        "parameters": [
          {
            "type": "string",
            "name": "objectTypeCode",
            "in": "path",
            "required": true
          },
          {
            "type": "string",
            "name": "organizationID",
            "in": "query",
            "required": true
          }
        ],
        "responses": {
          "200": {
            "description": "webhook request received",
            "schema": {
              "$ref": "#/definitions/SuccessWithMessage"
            }
          },
          "401": {
            "description": "Unauthorized",
            "schema": {
              "$ref": "#/definitions/Error"
            }
          },
          "default": {
            "description": "unexpected error",
            "schema": {
              "$ref": "#/definitions/Error"
            }
          }
        }
      }
    },
    "/bot/rc-status-webhook": {
      "post": {
        "security": [],
        "operationId": "rcStatusWebhook",
        "responses": {
          "default": {
            "description": "unexpected error",
            "schema": {
              "$ref": "#/definitions/Error"
            }
          }
        }
      }
    },
    "/bot/rc-webhook": {
      "post": {
        "security": [],
        "operationId": "rcWebhook",
        "responses": {
          "default": {
            "description": "unexpected error",
            "schema": {
              "$ref": "#/definitions/Error"
            }
          }
        }
      }
    },
    "/deepgram/callback": {
      "post": {
        "security": [],
        "operationId": "deepgramCallback",
        "responses": {
          "default": {
            "description": "unexpected error",
            "schema": {
              "$ref": "#/definitions/Error"
            }
          }
        }
      }
    },
    "/elevenlabs/callback": {
      "post": {
        "security": [],
        "operationId": "elevenlabsCallback",
        "responses": {
          "default": {
            "description": "unexpected error",
            "schema": {
              "$ref": "#/definitions/Error"
            }
          }
        }
      }
    },
    "/gladia/callback": {
      "post": {
        "security": [],
        "operationId": "gladiaCallback",
        "responses": {
          "default": {
            "description": "unexpected error",
            "schema": {
              "$ref": "#/definitions/Error"
            }
          }
        }
      }
    },
    "/google/callback": {
      "get": {
        "security": [],
        "operationId": "googleLinkAccountCallback",
        "parameters": [
          {
            "type": "string",
            "name": "code",
            "in": "query"
          },
          {
            "type": "string",
            "name": "state",
            "in": "query"
          },
          {
            "type": "string",
            "name": "error",
            "in": "query"
          }
        ],
        "responses": {
          "default": {
            "description": "unexpected error",
            "schema": {
              "$ref": "#/definitions/Error"
            }
          }
        }
      }
    },
    "/hubspot/webhook/crmrecord": {
      "post": {
        "security": [],
        "consumes": [
          "application/json"
        ],
        "produces": [
          "application/json"
        ],
        "operationId": "hubspotWebhookObjectType",
        "responses": {
          "default": {
            "description": "unexpected error",
            "schema": {
              "$ref": "#/definitions/Error"
            }
          }
        }
      }
    },
    "/install/aircall/callback": {
      "get": {
        "security": [],
        "operationId": "AircallLinkAccountCallback",
        "parameters": [
          {
            "type": "string",
            "name": "code",
            "in": "query"
          },
          {
            "type": "string",
            "name": "state",
            "in": "query"
          },
          {
            "type": "string",
            "name": "error",
            "in": "query"
          }
        ],
        "responses": {
          "default": {
            "description": "unexpected error",
            "schema": {
              "$ref": "#/definitions/Error"
            }
          }
        }
      }
    },
    "/login": {
      "post": {
        "security": [],
        "description": "Login with user and password and get an access token to talk on behalf of the user",
        "operationId": "login",
        "parameters": [
          {
            "description": "credentials to validate",
            "name": "credentials",
            "in": "body",
            "required": true,
            "schema": {
              "$ref": "#/definitions/LoginCredentials"
            }
          }
        ],
        "responses": {
          "201": {
            "description": "success response",
            "schema": {
              "$ref": "#/definitions/UserSession"
            },
            "headers": {
              "Set-Cookie": {
                "type": "string",
                "description": "Session cookie"
              }
            }
          },
          "401": {
            "description": "credentials are invalid",
            "schema": {
              "$ref": "#/definitions/Error"
            }
          },
          "default": {
            "description": "unexpected error",
            "schema": {
              "$ref": "#/definitions/Error"
            }
          }
        }
      }
    },
    "/login-events": {
      "get": {
        "description": "Returns login events for the organization. Only accessible by admin users.",
        "operationId": "getLoginEvents",
        "parameters": [
          {
            "type": "string",
            "format": "date-time",
            "description": "Filter by start date (ISO 8601 format)",
            "name": "start_date",
            "in": "query"
          },
          {
            "type": "string",
            "format": "date-time",
            "description": "Filter by end date (ISO 8601 format)",
            "name": "end_date",
            "in": "query"
          }
        ],
        "responses": {
          "200": {
            "description": "success response",
            "schema": {
              "$ref": "#/definitions/LoginCountsResponse"
            }
          },
          "401": {
            "description": "valid access token required",
            "schema": {
              "$ref": "#/definitions/Error"
            }
          },
          "403": {
            "description": "admin access required",
            "schema": {
              "$ref": "#/definitions/Error"
            }
          },
          "default": {
            "description": "unexpected error",
            "schema": {
              "$ref": "#/definitions/Error"
            }
          }
        }
      }
    },
    "/logout": {
      "post": {
        "security": [],
        "description": "Logout and clear authentication cookie",
        "operationId": "logout",
        "responses": {
          "200": {
            "description": "success response",
            "headers": {
              "Set-Cookie": {
                "type": "string",
                "description": "Clear session cookie"
              }
            }
          },
          "default": {
            "description": "unexpected error",
            "schema": {
              "$ref": "#/definitions/Error"
            }
          }
        }
      }
    },
    "/me": {
      "get": {
        "description": "Returns info about the current user",
        "operationId": "me",
        "responses": {
          "200": {
            "description": "success response",
            "schema": {
              "$ref": "#/definitions/User"
            }
          },
          "401": {
            "description": "valid access token required",
            "schema": {
              "$ref": "#/definitions/Error"
            }
          },
          "default": {
            "description": "unexpected error",
            "schema": {
              "$ref": "#/definitions/Error"
            }
          }
        }
      }
    },
    "/microsoft/callback": {
      "get": {
        "security": [],
        "operationId": "microsoftLinkAccountCallback",
        "parameters": [
          {
            "type": "string",
            "name": "code",
            "in": "query"
          },
          {
            "type": "string",
            "name": "state",
            "in": "query"
          },
          {
            "type": "string",
            "name": "error",
            "in": "query"
          }
        ],
        "responses": {
          "default": {
            "description": "unexpected error",
            "schema": {
              "$ref": "#/definitions/Error"
            }
          }
        }
      }
    },
    "/playback/notifications": {
      "post": {
        "security": [],
        "consumes": [
          "text/plain"
        ],
        "operationId": "playbackNotifications",
        "responses": {
          "default": {
            "description": "unexpected error",
            "schema": {
              "$ref": "#/definitions/Error"
            }
          }
        }
      }
    },
    "/recall/desktop-realtime": {
      "post": {
        "security": [],
        "operationId": "rcDesktopRealtime",
        "parameters": [
          {
            "type": "string",
            "description": "window_id routing key (matches recording.window_id)",
            "name": "w",
            "in": "query"
          }
        ],
        "responses": {
          "default": {
            "description": "unexpected error",
            "schema": {
              "$ref": "#/definitions/Error"
            }
          }
        }
      }
    },
    "/recall/zoom_access_token": {
      "get": {
        "security": [],
        "produces": [
          "text/plain"
        ],
        "operationId": "recallZoomAccessToken",
        "parameters": [
          {
            "type": "string",
            "name": "user_id",
            "in": "query",
            "required": true
          },
          {
            "type": "string",
            "name": "auth_token",
            "in": "query",
            "required": true
          }
        ],
        "responses": {
          "200": {
            "description": "zoom user access token",
            "schema": {
              "$ref": "#/definitions/ZoomAccessToken"
            }
          },
          "401": {
            "description": "invalid access token",
            "schema": {
              "$ref": "#/definitions/Error"
            }
          },
          "404": {
            "description": "user not found",
            "schema": {
              "$ref": "#/definitions/Error"
            }
          },
          "default": {
            "description": "unexpected error",
            "schema": {
              "$ref": "#/definitions/Error"
            }
          }
        }
      }
    },
    "/revai/callback": {
      "post": {
        "security": [],
        "operationId": "revaiCallback",
        "responses": {
          "default": {
            "description": "unexpected error",
            "schema": {
              "$ref": "#/definitions/Error"
            }
          }
        }
      }
    },
    "/ringover/callback": {
      "post": {
        "security": [],
        "operationId": "ringOverCallback",
        "responses": {
          "default": {
            "description": "unexpected error",
            "schema": {
              "$ref": "#/definitions/Error"
            }
          }
        }
      }
    },
    "/salesforce/callback": {
      "post": {
        "security": [],
        "operationId": "salesforceLinkAccountCallback",
        "parameters": [
          {
            "description": "authorization information provided by salesforce after user approval",
            "name": "body",
            "in": "body",
            "required": true,
            "schema": {
              "$ref": "#/definitions/SalesforceAuthorization"
            }
          }
        ],
        "responses": {
          "default": {
            "description": "unexpected error",
            "schema": {
              "$ref": "#/definitions/Error"
            }
          }
        }
      }
    },
    "/salesforce/webhook/event": {
      "post": {
        "security": [],
        "consumes": [
          "application/xml",
          "text/xml",
          "text/xml;charset=UTF-8",
          "application/xml;charset=UTF-8"
        ],
        "produces": [
          "text/xml;charset=UTF-8"
        ],
        "operationId": "salesforceWebhookEvent",
        "responses": {
          "200": {
            "description": "OK",
            "schema": {
              "$ref": "#/definitions/XmlResponse"
            }
          },
          "default": {
            "description": "unexpected error",
            "schema": {
              "$ref": "#/definitions/Error"
            }
          }
        }
      }
    },
    "/salesforce/webhook/{objectTypeCode}": {
      "post": {
        "security": [],
        "consumes": [
          "application/xml",
          "text/xml",
          "text/xml;charset=UTF-8",
          "application/xml;charset=UTF-8",
          "text/xml;charset=UTF-16",
          "application/xml;charset=UTF-16"
        ],
        "produces": [
          "text/xml;charset=UTF-8"
        ],
        "operationId": "salesforceWebhookObjectType",
        "parameters": [
          {
            "type": "string",
            "name": "objectTypeCode",
            "in": "path",
            "required": true
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "schema": {
              "$ref": "#/definitions/XmlResponse"
            }
          },
          "default": {
            "description": "unexpected error",
            "schema": {
              "$ref": "#/definitions/Error"
            }
          }
        }
      }
    },
    "/signup-auth-provider": {
      "post": {
        "security": [],
        "description": "Attempts to sign up a user based on auth provider access token info, and session init",
        "operationId": "signupAuthProvider",
        "responses": {
          "201": {
            "description": "success response",
            "schema": {
              "$ref": "#/definitions/UserSession"
            },
            "headers": {
              "Set-Cookie": {
                "type": "string",
                "description": "Session cookie"
              }
            }
          },
          "401": {
            "description": "credentials are invalid",
            "schema": {
              "$ref": "#/definitions/Error"
            }
          },
          "409": {
            "description": "sso attempt of sign up failed",
            "schema": {
              "$ref": "#/definitions/SSOSignupError"
            }
          },
          "default": {
            "description": "unexpected error",
            "schema": {
              "$ref": "#/definitions/Error"
            }
          }
        }
      }
    },
    "/slack/callback": {
      "get": {
        "security": [],
        "operationId": "slackLinkAccountCallback",
        "parameters": [
          {
            "type": "string",
            "name": "code",
            "in": "query"
          },
          {
            "type": "string",
            "name": "state",
            "in": "query"
          },
          {
            "type": "string",
            "name": "error",
            "in": "query"
          }
        ],
        "responses": {
          "default": {
            "description": "unexpected error",
            "schema": {
              "$ref": "#/definitions/Error"
            }
          }
        }
      }
    },
    "/ubity/callback": {
      "get": {
        "security": [],
        "operationId": "ubityCallback",
        "responses": {
          "default": {
            "description": "unexpected error",
            "schema": {
              "$ref": "#/definitions/Error"
            }
          }
        }
      }
    },
    "/webhook/recordings/petromin": {
      "post": {
        "security": [],
        "consumes": [
          "application/json"
        ],
        "operationId": "petrominRecordingsCallback",
        "parameters": [
          {
            "name": "body",
            "in": "body",
            "required": true,
            "schema": {
              "$ref": "#/definitions/PetrominRecordingsWebhookRequest"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "webhook request received",
            "schema": {
              "$ref": "#/definitions/SuccessWithMessage"
            }
          },
          "401": {
            "description": "Unauthorized",
            "schema": {
              "$ref": "#/definitions/Error"
            }
          },
          "default": {
            "description": "unexpected error",
            "schema": {
              "$ref": "#/definitions/Error"
            }
          }
        }
      }
    },
    "/zoom/account-links": {
      "get": {
        "description": "Returns a link to link a zoom account with the attention account",
        "operationId": "generateZoomLinkAccount",
        "responses": {
          "200": {
            "description": "success response",
            "schema": {
              "$ref": "#/definitions/ZoomAccountLink"
            }
          },
          "401": {
            "description": "valid access token required",
            "schema": {
              "$ref": "#/definitions/Error"
            }
          },
          "default": {
            "description": "unexpected error",
            "schema": {
              "$ref": "#/definitions/Error"
            }
          }
        }
      }
    },
    "/zoom/callback": {
      "get": {
        "security": [],
        "operationId": "zoomLinkAccountCallback",
        "parameters": [
          {
            "type": "string",
            "name": "code",
            "in": "query"
          },
          {
            "type": "string",
            "name": "state",
            "in": "query"
          },
          {
            "type": "string",
            "name": "error",
            "in": "query"
          }
        ],
        "responses": {
          "default": {
            "description": "unexpected error",
            "schema": {
              "$ref": "#/definitions/Error"
            }
          }
        }
      }
    },
    "/zoom/deauth": {
      "post": {
        "security": [],
        "description": "Removes the status of the Zoom integration of the current user",
        "operationId": "deauthZoomIntegration",
        "parameters": [
          {
            "name": "body",
            "in": "body",
            "required": true,
            "schema": {
              "$ref": "#/definitions/ZoomDeauthBody"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "deauthorization completed"
          },
          "default": {
            "description": "unexpected error",
            "schema": {
              "$ref": "#/definitions/Error"
            }
          }
        }
      }
    },
    "/zoom/status": {
      "get": {
        "description": "Returns the status of the Zoom integration of the current user",
        "operationId": "retrieveZoomIntegrationStatus",
        "responses": {
          "200": {
            "description": "status of the zoom account of the current user",
            "schema": {
              "$ref": "#/definitions/ZoomIntegrationStatus"
            }
          },
          "default": {
            "description": "unexpected error",
            "schema": {
              "$ref": "#/definitions/Error"
            }
          }
        }
      },
      "delete": {
        "description": "Removes the status of the Zoom integration of the current user",
        "operationId": "deleteZoomIntegration",
        "responses": {
          "200": {
            "description": "status of the zoom account of the current user"
          },
          "default": {
            "description": "unexpected error",
            "schema": {
              "$ref": "#/definitions/Error"
            }
          }
        }
      }
    },
    "/zoom/webhook": {
      "post": {
        "security": [],
        "operationId": "zoomWebhook",
        "responses": {
          "default": {
            "description": "unexpected error",
            "schema": {
              "$ref": "#/definitions/Error"
            }
          }
        }
      }
    }
  },
  "definitions": {
    "Error": {
      "type": "object",
      "properties": {
        "code": {
          "type": "integer",
          "format": "int32"
        },
        "error_code": {
          "description": "Stable machine-readable error code (e.g., EMAIL_NOT_VERIFIED). Optional; populated by endpoints that distinguish multiple error states behind one HTTP status.",
          "type": "string"
        },
        "message": {
          "type": "string"
        }
      }
    },
    "JSONObject": {
      "type": "string"
    },
    "LoginCountsResponse": {
      "type": "object",
      "properties": {
        "data": {
          "description": "Dictionary mapping user emails to their login count",
          "type": "object",
          "additionalProperties": {
            "type": "integer",
            "format": "int64"
          }
        }
      }
    },
    "LoginCredentials": {
      "type": "object",
      "properties": {
        "email": {
          "type": "string"
        },
        "password": {
          "type": "string"
        }
      }
    },
    "PetrominRecordingsWebhookRequest": {
      "type": "object",
      "required": [
        "callType",
        "srcPhone",
        "dstPhone",
        "dispositionClass",
        "callStartTime",
        "recordingFileUrl",
        "customerCRTId",
        "userId"
      ],
      "properties": {
        "callDirection": {
          "type": "string"
        },
        "callStartTime": {
          "type": "string"
        },
        "callType": {
          "type": "string"
        },
        "customerCRTId": {
          "type": "string"
        },
        "dispositionClass": {
          "type": "string"
        },
        "dstPhone": {
          "type": "string"
        },
        "recordingFileUrl": {
          "type": "string"
        },
        "srcPhone": {
          "type": "string"
        },
        "userId": {
          "type": "string"
        }
      }
    },
    "SSOSignupError": {
      "type": "object",
      "properties": {
        "code": {
          "type": "string"
        },
        "email": {
          "type": "string"
        },
        "message": {
          "type": "string"
        }
      }
    },
    "SalesforceAuthorization": {
      "type": "object",
      "required": [
        "code"
      ],
      "properties": {
        "code": {
          "description": "authorization code provided by salesforce, to fetch access token",
          "type": "string"
        },
        "isSandbox": {
          "description": "defines if the salesforce domain belongs to a sandbox, if not present, it is considered a production domain",
          "type": "boolean"
        },
        "organizationUUID": {
          "description": "if the action is performed by an user of a privileged org, this is the target organization to add the account",
          "type": "string"
        },
        "state": {
          "description": "signed OAuth state echoed back from the Salesforce redirect; when present, the backend derives the environment from its claims instead of the isSandbox flag",
          "type": "string"
        }
      }
    },
    "SuccessWithMessage": {
      "description": "Success message",
      "type": "string"
    },
    "User": {
      "type": "object",
      "properties": {
        "email": {
          "type": "string"
        },
        "firstName": {
          "type": "string"
        },
        "id": {
          "type": "string"
        },
        "lastName": {
          "type": "string"
        },
        "transcriptLang": {
          "type": "string"
        }
      }
    },
    "UserSession": {
      "type": "object",
      "properties": {
        "accessToken": {
          "type": "string"
        },
        "internalUser": {
          "type": "object"
        },
        "user": {
          "$ref": "#/definitions/User"
        }
      }
    },
    "XmlResponse": {
      "type": "string",
      "xml": {
        "name": "root",
        "wrapped": true
      }
    },
    "ZoomAccessToken": {
      "type": "string"
    },
    "ZoomAccountLink": {
      "type": "object",
      "properties": {
        "url": {
          "description": "the url for the user to redirect or open in a browser in order to link their Zoom account/user to their attention user(no active Attention session required in browser)",
          "type": "string"
        }
      }
    },
    "ZoomDeauthBody": {
      "type": "object",
      "properties": {
        "event": {
          "type": "string"
        },
        "payload": {
          "$ref": "#/definitions/ZoomDeauthPayload"
        }
      }
    },
    "ZoomDeauthPayload": {
      "type": "object",
      "properties": {
        "account_id": {
          "type": "string"
        },
        "client_id": {
          "type": "string"
        },
        "signature": {
          "type": "string"
        },
        "user_id": {
          "type": "string"
        }
      }
    },
    "ZoomIntegrationStatus": {
      "type": "object",
      "properties": {
        "accountInfo": {
          "description": "when zoom integration is active, it returns the information about the Zoom user that connected Attention with Zoom",
          "$ref": "#/definitions/ZoomUserInfo"
        }
      }
    },
    "ZoomUserInfo": {
      "type": "object",
      "properties": {
        "email": {
          "type": "string"
        },
        "firstName": {
          "type": "string"
        },
        "id": {
          "description": "Identifier of the Zoom user",
          "type": "string"
        },
        "lastName": {
          "type": "string"
        }
      }
    }
  },
  "securityDefinitions": {
    "Bearer": {
      "type": "apiKey",
      "name": "Authorization",
      "in": "header"
    }
  },
  "security": [
    {
      "Bearer": [
        "user"
      ]
    }
  ]
}