{
  "openapi": "3.0.1",
  "info": {
    "title": "Ideolve Integration API",
    "description": "These APIs can be used for integrating ideolve with third party applications.",
    "termsOfService": "https://docs.mithi.com/home/terms-of-services",
    "contact": {
      "email": "support@ideolve.com"
    },
    "license": {
      "name": "Apache 2.0",
      "url": "http://www.apache.org/licenses/LICENSE-2.0.html"
    },
    "version": "4.0.0"
  },
  "externalDocs": {
    "description": "Find out more about Ideolve",
    "url": "https://ideolve.mithi.com/"
  },
  "servers": [
    {
      "url": "https://api.ideolve.com/v4"
    }
  ],
  "tags": [
    {
      "name": "auth",
      "description": "Authenticating user"
    },
    {
      "name": "note",
      "description": "Everything about note"
    },
    {
      "name": "files",
      "description": "Attachments to note"
    },
    {
      "name": "workspaces",
      "description": "User workspaces"
    },
    {
      "name": "contacts",
      "description": "Workspace contacts"
    }
  ],
  "paths": {
    "/user/{user}/note": {
      "post": {
        "tags": [
          "note"
        ],
        "summary": "Add a new note to the user",
        "operationId": "addNote",
        "parameters": [
          {
            "name": "user",
            "in": "path",
            "description": "user email id",
            "required": true,
            "schema": {
              "type": "string",
              "format": "emailid"
            }
          }
        ],
        "requestBody": {
          "description": "Note object that needs to be added to the store",
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/InputCompositeNote"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Successful operation",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OutputCompositeNote"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized access",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UnauthorizedAccess"
                }
              }
            }
          },
          "500": {
            "description": "Error while posting note",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        },
        "security": [
          {
            "ClientId": [],
            "AppName": [],
            "ApiKey": []
          }
        ]
      }
    },
    "/user/{user}/note/{noteuuid}/files": {
      "post": {
        "tags": [
          "files"
        ],
        "summary": "Add file as an attachment to a note",
        "operationId": "addAttachment",
        "parameters": [
          {
            "name": "user",
            "in": "path",
            "description": "user email id",
            "required": true,
            "schema": {
              "type": "string",
              "format": "emailid"
            }
          },
          {
            "name": "noteuuid",
            "in": "path",
            "description": "note uuid",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "workspace",
            "in": "query",
            "description": "workspace uuid",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "requestBody": {
          "content": {
            "multipart/form-data": {
              "schema": {
                "type": "object",
                "properties": {
                  "fileuuid": {
                    "type": "string",
                    "format": "uuid"
                  },
                  "files[]": {
                    "type": "string",
                    "format": "binary"
                  },
                  "filename": {
                    "type": "string"
                  },
                  "Content-Disposition": {
                    "type": "string",
                    "default": "attachment"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful operation",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OutputFile"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized access",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UnauthorizedAccess"
                }
              }
            }
          },
          "500": {
            "description": "Error while posting note",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        },
        "security": [
          {
            "ClientId": [],
            "AppName": [],
            "ApiKey": []
          }
        ]
      }
    },
    "/user/{user}/auth": {
      "post": {
        "tags": [
          "auth"
        ],
        "summary": "Authenticates user using the API key",
        "operationId": "authUser",
        "parameters": [
          {
            "name": "user",
            "in": "path",
            "description": "user email id",
            "required": true,
            "schema": {
              "type": "string",
              "format": "emailid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successfully authenticated"
          },
          "401": {
            "description": "Unauthorized access",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UnauthorizedAccess"
                }
              }
            }
          },
          "500": {
            "description": "Error while authenticating user",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        },
        "security": [
          {
            "ClientId": [],
            "AppName": [],
            "ApiKey": []
          }
        ]
      }
    },
    "/user/{user}/workspaces": {
      "get": {
        "tags": [
          "workspaces"
        ],
        "summary": "Fetch user associated workspaces list",
        "operationId": "fetchWorkspaces",
        "parameters": [
          {
            "name": "user",
            "in": "path",
            "description": "user email id",
            "required": true,
            "schema": {
              "type": "string",
              "format": "emailid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful operation",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OutputWorkspacesList"
                },
                "examples": {
                  "Fetch workspaces for user": {
                    "value": "[\n    {\n        \"workspace\": \"Disney + Hotstar show reviews\",\n        \"workspaceuuid\": \"9113d0bd-4152-4978-9416-3e65bce64a26\",\n        \"id\": \"9113d0bd-4152-4978-9416-3e65bce64a26\",\n        \"description\": \"Reviews for shows on Disney Hotstar\"\n    },\n    {\n        \"workspace\": \"Netflix show reviews\",\n        \"workspaceuuid\": \"f331a30b-a4d6-4ff7-a88f-b2225e82b767\",\n        \"id\": \"f331a30b-a4d6-4ff7-a88f-b2225e82b767\",\n        \"description\": \"Reviews for shows on Netflix\"\n    }\n]"
                  }
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized access",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UnauthorizedAccess"
                }
              }
            }
          },
          "500": {
            "description": "Error while authenticating user",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        },
        "security": [
          {
            "ClientId": [],
            "AppName": [],
            "ApiKey": []
          }
        ]
      }
    },
    "/user/{user}/contacts": {
      "get": {
        "tags": [
          "contacts"
        ],
        "summary": "Fetch workspace contacts",
        "operationId": "fetchContacts",
        "parameters": [
          {
            "name": "user",
            "in": "path",
            "description": "user email id",
            "required": true,
            "schema": {
              "type": "string",
              "format": "emailid"
            }
          },
          {
            "name": "query",
            "in": "query",
            "description": "query to search contacts, initials of users or SHOWALL to fetch all users",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "workspace",
            "in": "query",
            "description": "workspaceuuid of the workspace",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "workspacefilter",
            "in": "query",
            "description": "use allnotes to fetch contacts across all workspaces",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful operation",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OutputContacts"
                },
                "examples": {
                  "Fetch all contacts using query=SHOWALL and workspacefilter=allnotes": {
                    "value": "[\n  {\n      \"useruuid\": \"4216906b-7f95-42d3-aa86-2501d631885f\",\n      \"displayname\": \"abuse\",\n      \"emailid\": \"abuse@mithi.com\",\n      \"id\": \"4216906b-7f95-42d3-aa86-2501d631885f\"\n  },\n  {\n      \"useruuid\": \"c0416bc1-0495-4b1a-bd8c-e3546dd7c516\",\n      \"displayname\": \"amit.kumar\",\n      \"emailid\": \"amit.kumar@mithi.com\",\n      \"id\": \"c0416bc1-0495-4b1a-bd8c-e3546dd7c516\"\n      \n  }\n]"
                  }
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized access",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UnauthorizedAccess"
                }
              }
            }
          },
          "500": {
            "description": "Error while authenticating user",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        },
        "security": [
          {
            "ClientId": [],
            "AppName": [],
            "ApiKey": []
          }
        ]
      }
    }
  },
  "components": {
    "schemas": {
      "sharewith": {
        "type": "array",
        "example": [
          {
            "user": "user email id"
          },
          {
            "group": "user's contact group"
          }
        ],
        "items": {
          "properties": {
            "user": {
              "type": "string"
            },
            "group": {
              "type": "string"
            }
          }
        }
      },
      "InputCompositeNote": {
        "type": "object",
        "required": [
          "notehtmltext"
        ],
        "properties": {
          "noteuuid": {
            "type": "string",
            "description": "The unique identifier to the note. A note is created with this unique id if provided in input. If not provided, system generates a unique id for the note.",
            "example": "60a06ac4-4255-4574-bb12-d6bbdb32e828"
          },
          "subject": {
            "type": "string",
            "description": "Title to this note",
            "example": "Title to this note"
          },
          "notehtmltext": {
            "type": "string",
            "description": "HTML text to be added to the note",
            "example": "<b>HTML content <i>to<i> this note<b>"
          },
          "notetext": {
            "type": "string",
            "description": "Note content in plain text format. Do not use this attribute if content is provided in HTML format. Used when no HTML format is provided. Optional.",
            "example": "Plain text content to this note"
          },
          "origin": {
            "type": "string",
            "description": "Origin of the note. App used to create this note. Allowed values - web, mobile",
            "example": "web-ideolve, mobile-ideolve or freshdesk"
          },
          "readonly": {
            "type": "boolean",
            "description": "Makes the note uneditable.",
            "example": true
          },
          "users": {
            "type": "object",
            "description": "Shares the note with provided users",
            "properties": {
              "sharewith": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/sharewith"
                }
              },
              "role": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/Role"
                }
              }
            },
            "example": {
              "sharewith": [
                {
                  "user": "jon.snow@got.hbo"
                },
                {
                  "user": "arya.stark@got.hbo"
                },
                {
                  "group": "lanisters"
                }
              ],
              "role": [
                {
                  "user": "jon.snow@got.hbo",
                  "role": "Shareonly"
                }
              ]
            }
          },
          "tags": {
            "description": "tags to be attached to the note",
            "example": [
              "starks",
              "got"
            ],
            "type": "array",
            "items": {
              "type": "string"
            }
          }
        }
      },
      "Note": {
        "type": "object",
        "required": [
          "notehtmltext"
        ],
        "properties": {
          "noteuuid": {
            "type": "string",
            "description": "The unique identifier to the note",
            "example": "60a06ac4-4255-4574-bb12-d6bbdb32e828"
          },
          "subject": {
            "type": "string",
            "description": "Title to this note",
            "example": "Title to this note"
          },
          "notehtmltext": {
            "type": "string",
            "description": "HTML text to be added to the note",
            "example": "<b>HTML content <i>to<i> this note<b>"
          },
          "notetext": {
            "type": "string",
            "description": "Note content in plain text format. Do not use this attribute if content is provided in HTML format. Used when no HTML format is provided. Optional.",
            "example": "Plain text content to this note"
          },
          "origin": {
            "type": "string",
            "description": "Origin of the note. App used to create this note. Allowed values - web, mobile",
            "example": "web"
          },
          "readonly": {
            "type": "boolean",
            "description": "Makes the note uneditable.",
            "example": true
          }
        }
      },
      "User": {
        "type": "object",
        "required": [
          "usersignupid",
          "useruuid"
        ],
        "properties": {
          "useruuid": {
            "type": "string"
          },
          "usersignupid": {
            "type": "string",
            "example": "jon.snow@mithi.com"
          },
          "displayname": {
            "type": "string"
          },
          "profilepic": {
            "type": "string"
          },
          "enablereport": {
            "type": "boolean"
          },
          "register": {
            "type": "boolean"
          },
          "verified": {
            "type": "boolean"
          },
          "canaccess": {
            "type": "boolean"
          },
          "showjoyride": {
            "type": "boolean"
          },
          "userinfouuid": {
            "type": "string"
          },
          "newuser": {
            "type": "boolean"
          }
        }
      },
      "Role": {
        "type": "object",
        "required": [
          "user",
          "role"
        ],
        "properties": {
          "user": {
            "type": "string"
          },
          "role": {
            "type": "string",
            "example": "Shareonly or Superadmin or Admin or Reset"
          }
        }
      },
      "OutputCompositeNote": {
        "type": "object",
        "properties": {
          "status": {
            "type": "string",
            "description": "Status of the operation",
            "default": "SUCCESS"
          },
          "note": {
            "$ref": "#/components/schemas/Note"
          },
          "sharestatus": {
            "type": "object",
            "description": "Provides the share status",
            "properties": {
              "SUCCESS": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/User"
                }
              },
              "ERROR": {
                "type": "array",
                "items": {
                  "properties": {
                    "user": {
                      "type": "string",
                      "description": "email id of the user"
                    },
                    "reason": {
                      "type": "string",
                      "description": "Provides as reason why note couldn't be shared with the user"
                    }
                  }
                }
              }
            }
          }
        }
      },
      "OutputWorkspacesList": {
        "type": "array",
        "items": {
          "properties": {
            "workspaceuuid": {
              "type": "string",
              "description": "36 digit unique id of the workspace"
            },
            "workspace": {
              "type": "string",
              "description": "Workspace name"
            },
            "description": {
              "type": "string",
              "description": "Workspace description describing what is the purpose of workspace"
            },
            "id": {
              "type": "string",
              "description": "36 digit unique id of the workspace"
            }
          }
        }
      },
      "OutputFile": {
        "type": "object",
        "properties": {
          "file": {
            "type": "object",
            "properties": {
              "fileuuid": {
                "type": "string",
                "description": "36 digit unique id of the file"
              },
              "noteuuid": {
                "type": "string",
                "description": "note uuid"
              },
              "type": {
                "type": "string",
                "description": "file type"
              },
              "filename": {
                "type": "string",
                "description": "file name"
              },
              "filesize": {
                "type": "string",
                "description": "user fiendly file size in KB / MB / GB"
              },
              "filesizeinbytes": {
                "type": "integer",
                "description": "file size in bytes"
              },
              "creationdate": {
                "type": "string",
                "description": "creation date",
                "format": "date"
              },
              "author": {
                "type": "string",
                "description": "Author name who uploaded file"
              },
              "link": {
                "type": "string",
                "description": "link to download the file"
              }
            }
          },
          "status": {
            "type": "string",
            "description": "status of the operation",
            "default": "SUCCESS"
          }
        }
      },
      "OutputContacts": {
        "type": "array",
        "items": {
          "properties": {
            "useruuid": {
              "type": "string",
              "description": "36 digit unique id of the user"
            },
            "displayname": {
              "type": "string",
              "description": "Users display name"
            },
            "emailid": {
              "type": "string",
              "description": "User's email id"
            },
            "id": {
              "type": "string",
              "description": "36 digit unique id of the user"
            }
          }
        }
      },
      "ErrorResponse": {
        "type": "object",
        "properties": {
          "status": {
            "type": "string",
            "default": "ERROR"
          },
          "reason": {
            "type": "string",
            "description": "Contains the reason why the operation failed"
          },
          "message": {
            "type": "string",
            "description": "Provides an user friendly message to be given to the end user"
          }
        }
      },
      "UnauthorizedAccess": {
        "type": "object",
        "properties": {
          "status": {
            "type": "string",
            "default": "Unauthorized"
          },
          "reason": {
            "type": "string",
            "default": "Required request headers are not present"
          }
        }
      }
    },
    "securitySchemes": {
      "ClientId": {
        "type": "apiKey",
        "name": "Client-Id",
        "in": "header"
      },
      "AppName": {
        "type": "apiKey",
        "name": "App-Name",
        "in": "header"
      },
      "ApiKey": {
        "type": "apiKey",
        "name": "connector-api-key",
        "in": "header"
      }
    }
  }
}