openapi: 3.0.0
servers:
  - description: API server
    url: https://api.mailscript.com/v2
info:
  license:
    name: MIT
  title: Mailscript
  version: 0.4.0
  x-apisguru-categories:
    - email
  x-logo:
    url: https://mailscript.com/images/favicon.png
  x-origin:
    - format: openapi
      url: http://api.mailscript.com/v2/swagger
      version: "3.0"
  x-providerName: mailscript.com
security:
  - bearerAuth: []
paths:
  /actions:
    get:
      operationId: getAllActions
      responses:
        "200":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/GetAllActionsResponse"
          description: Successful operation
        "403":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"
          description: Bad credentials
      summary: Get all actions for the user
      tags:
        - actions
    post:
      operationId: addAction
      requestBody:
        content:
          application/json:
            schema:
              oneOf:
                - $ref: "#/components/schemas/AddActionCombineRequest"
                - $ref: "#/components/schemas/AddActionSmsRequest"
                - $ref: "#/components/schemas/AddActionWebhookRequest"
                - $ref: "#/components/schemas/AddActionDaemonRequest"
                - $ref: "#/components/schemas/AddActionSendRequest"
                - $ref: "#/components/schemas/AddActionForwardRequest"
                - $ref: "#/components/schemas/AddActionForwardRequest"
                - $ref: "#/components/schemas/AddActionReplyRequest"
                - $ref: "#/components/schemas/AddActionReplyAllRequest"
                - $ref: "#/components/schemas/AddActionAliasRequest"
        description: Add action body
        required: true
      responses:
        "201":
          content:
            application/json:
              examples:
                list:
                  value: |-
                    [
                    "hielle.com"
                    ]
              schema:
                $ref: "#/components/schemas/AddActionResponse"
          description: Successful operation
        "400":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"
          description: Failure
        "403":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"
          description: Not authorized or bad code
      summary: Add an action
      tags:
        - actions
  "/actions/{action}":
    delete:
      operationId: deleteAction
      parameters:
        - description: ID of the action
          in: path
          name: action
          required: true
          schema:
            type: string
      responses:
        "204":
          description: Successful delete operation
        "400":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"
          description: Failure
        "403":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"
          description: Bad credentials
        "404":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"
          description: Key not found
      summary: Delete an action
      tags:
        - actions
    put:
      operationId: updateAction
      parameters:
        - description: ID of action
          in: path
          name: action
          required: true
          schema:
            type: string
      requestBody:
        content:
          application/json:
            schema:
              oneOf:
                - $ref: "#/components/schemas/AddActionCombineRequest"
                - $ref: "#/components/schemas/AddActionSmsRequest"
                - $ref: "#/components/schemas/AddActionWebhookRequest"
                - $ref: "#/components/schemas/AddActionDaemonRequest"
                - $ref: "#/components/schemas/AddActionSendRequest"
                - $ref: "#/components/schemas/AddActionForwardRequest"
                - $ref: "#/components/schemas/AddActionForwardRequest"
                - $ref: "#/components/schemas/AddActionReplyRequest"
                - $ref: "#/components/schemas/AddActionReplyAllRequest"
                - $ref: "#/components/schemas/AddActionAliasRequest"
        description: Action body
        required: true
      responses:
        "200":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Key"
          description: Successful update operation
        "400":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"
          description: Failure
        "403":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"
          description: Bad credentials
        "404":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"
          description: Key not found
      summary: Update an action key
      tags:
        - actions
  /addresses:
    get:
      description: ""
      operationId: getAllAddresses
      responses:
        "200":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/GetAllAddressesResponse"
          description: successful operation
        "403":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"
          description: Bad credentials
        "405":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"
          description: Invalid input
      summary: Get all addresses you have access to
      tags:
        - addresses
    post:
      description: ""
      operationId: addAddress
      requestBody:
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/AddAddressRequest"
        description: Address body
        required: true
      responses:
        "200":
          description: successful operation
        "400":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"
          description: Internal error
        "403":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"
          description: Bad credentials
        "405":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"
          description: Invalid input
      summary: Claim a new Mailscript address
      tags:
        - addresses
  "/addresses/{address}":
    delete:
      description: ""
      operationId: deleteAddress
      parameters:
        - description: ID of address
          in: path
          name: address
          required: true
          schema:
            type: string
      responses:
        "204":
          description: successful delete operation
        "403":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"
          description: Bad credentials
        "405":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"
          description: Invalid input
      summary: Delete a mailscript address
      tags:
        - addresses
  "/addresses/{address}/keys":
    get:
      operationId: getAllKeys
      parameters:
        - description: ID of address
          in: path
          name: address
          required: true
          schema:
            type: string
      responses:
        "200":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/GetAllKeysResponse"
          description: successful operation
        "403":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"
          description: Bad credentials
        "404":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"
          description: Address not found
      summary: List address keys
      tags:
        - keys
    post:
      operationId: addKey
      parameters:
        - description: ID of address
          in: path
          name: address
          required: true
          schema:
            type: string
      requestBody:
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/AddKeyRequest"
        description: Key body
        required: true
      responses:
        "201":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/AddKeyResponse"
          description: successful operation
        "403":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"
          description: Bad credentials
        "404":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"
          description: Address not found
      summary: Add address key
      tags:
        - keys
  "/addresses/{address}/keys/{key}":
    delete:
      operationId: deleteKey
      parameters:
        - description: ID of address
          in: path
          name: address
          required: true
          schema:
            type: string
        - description: ID of key
          in: path
          name: key
          required: true
          schema:
            type: string
      responses:
        "204":
          description: Successful delete operation
        "400":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"
          description: Failure
        "403":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"
          description: Bad credentials
        "404":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"
          description: Key not found
      summary: Delete address key
      tags:
        - keys
    get:
      operationId: getKey
      parameters:
        - description: ID of address
          in: path
          name: address
          required: true
          schema:
            type: string
        - description: ID of key
          in: path
          name: key
          required: true
          schema:
            type: string
      responses:
        "200":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Key"
          description: successful operation
        "403":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"
          description: Bad credentials
        "404":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"
          description: Key not found
      summary: Get address key
      tags:
        - keys
    put:
      operationId: updateKey
      parameters:
        - description: ID of address
          in: path
          name: address
          required: true
          schema:
            type: string
        - description: ID of key
          in: path
          name: key
          required: true
          schema:
            type: string
      requestBody:
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/UpdateKeyRequest"
        description: Key body
        required: true
      responses:
        "200":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Key"
          description: Successful operation
        "400":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"
          description: Failure
        "403":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"
          description: Bad credentials
        "404":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"
          description: Key not found
      summary: Update an address key
      tags:
        - keys
  "/daemons/{daemon}/token":
    get:
      operationId: getDaemonToken
      parameters:
        - description: name of Daemon
          in: path
          name: daemon
          required: true
          schema:
            type: string
      responses:
        "200":
          content:
            application/json:
              schema:
                properties:
                  token:
                    type: string
                required:
                  - token
          description: Successful get operation
        "400":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"
          description: Failure
        "403":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"
          description: Bad credentials
      summary: Get a token for opening a daemon connection
      tags:
        - daemon
  /domains:
    get:
      description: ""
      operationId: getAllDomains
      responses:
        "200":
          content:
            application/json:
              examples:
                list:
                  value: |-
                    {
                    "list": ["hielle.com"]
                    }
              schema:
                $ref: "#/components/schemas/GetAllDomainsResponse"
          description: successful operation
        "400":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"
          description: Internal error
        "403":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"
          description: Bad credentials
        "405":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"
          description: Invalid input
      summary: Get all domains you have access to
      tags:
        - domains
    post:
      description: ""
      operationId: addDomain
      requestBody:
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/AddDomainRequest"
        description: Domain body
        required: true
      responses:
        "200":
          content:
            application/json:
              examples:
                Add:
                  value: |-
                    {
                      "id": "hielle.com",
                      "records": [
                        {
                          "type:" "TXT",
                          "name": "@",
                          "value": "ms_verify=eecbb911-d940-41ea-8fc2-2c83295f418b"
                        }
                      ]
                    }
              schema:
                $ref: "#/components/schemas/DomainResponse"
          description: successful operation
        "400":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"
          description: Internal error
        "403":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"
          description: Bad credentials
        "405":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"
          description: Invalid input
      summary: Claim a new Domain
      tags:
        - domains
  "/domains/verify/{domain}":
    get:
      description: ""
      operationId: getDomainVerify
      parameters:
        - description: Full Top-level domain name
          in: path
          name: domain
          required: true
          schema:
            type: string
      responses:
        "200":
          content:
            application/json:
              examples:
                Domain verification record:
                  value: |-
                    {
                      "id": "hielle.com",
                      "records": [
                        {
                          "type:" "TXT",
                          "name": "@",
                          "value": "ms_verify=eecbb911-d940-41ea-8fc2-2c83295f418b"
                        }
                      ]
                    }
              schema:
                $ref: "#/components/schemas/DomainResponse"
          description: successful operation
        "400":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"
          description: Internal error
        "403":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"
          description: Bad credentials
        "405":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"
          description: Invalid input
      summary: Get domain verification
      tags:
        - domains
    post:
      description: ""
      operationId: CheckDomainVerify
      parameters:
        - description: Full Top-level domain name
          in: path
          name: domain
          required: true
          schema:
            type: string
      responses:
        "200":
          content:
            application/json:
              examples:
                checkDomainVerify:
                  value: |-
                    {
                    "id":"hielle.com",
                    "success": true
                    }
              schema:
                $ref: "#/components/schemas/CheckDomainVerify"
          description: successful operation
        "400":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"
          description: Internal error
        "401":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"
          description: Authorization failed
        "403":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"
          description: Bad credentials
        "405":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"
          description: Invalid input
      summary: Check a new Domain
      tags:
        - domains
  "/domains/{domain}":
    delete:
      description: ""
      operationId: removeDomainVerify
      parameters:
        - description: Full Top-level domain name
          in: path
          name: domain
          required: true
          schema:
            type: string
      responses:
        "200":
          description: successful operation
        "400":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"
          description: Internal error
        "403":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"
          description: Bad credentials
        "405":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"
          description: Invalid input
      summary: Remove a domain
      tags:
        - domains
  /inputs:
    get:
      description: ""
      operationId: getAllInputs
      parameters:
        - in: query
          name: name
          required: false
          schema:
            type: string
      responses:
        "200":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/GetAllInputsResponse"
          description: successful operation
        "400":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"
          description: Invalid input
        "403":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"
          description: Bad credentials
      summary: Get all inputs you have access to
      tags:
        - inputs
  /integrations:
    get:
      operationId: getAllIntegrations
      responses:
        "200":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/GetAllIntegrationsResponse"
          description: Successful operation
        "403":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"
          description: Bad credentials
      summary: Get all integrations for the user
      tags:
        - integrations
  "/integrations/{integration}":
    delete:
      operationId: deleteIntegration
      parameters:
        - description: ID of the integration
          in: path
          name: integration
          required: true
          schema:
            type: string
      responses:
        "204":
          description: Successful delete operation
        "400":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"
          description: Failure
        "403":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"
          description: Bad credentials
        "404":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"
          description: Key not found
      summary: Delete an integration
      tags:
        - integrations
  /send:
    post:
      operationId: send
      requestBody:
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/SendRequest"
        description: request body
        required: true
      responses:
        "200":
          description: successful operation
        "400":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"
          description: Invalid input
        "403":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"
          description: Bad credentials
      summary: Send an email
      tags:
        - send
  /triggers:
    get:
      description: ""
      operationId: getAllTriggers
      responses:
        "200":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/GetAllTriggersResponse"
          description: successful operation
        "400":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"
          description: Invalid input
        "403":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"
          description: Bad credentials
      summary: Get all triggers you have access to
      tags:
        - triggers
    post:
      description: ""
      operationId: addTrigger
      requestBody:
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/AddTriggerRequest"
        description: Trigger body
        required: true
      responses:
        "201":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/AddTriggerResponse"
          description: successful add operation
        "400":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"
          description: Invalid input
        "403":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"
          description: Bad credentials
      summary: Setup a trigger
      tags:
        - triggers
  "/triggers/{trigger}":
    delete:
      operationId: deleteTrigger
      parameters:
        - description: ID of the trigger
          in: path
          name: trigger
          required: true
          schema:
            type: string
      responses:
        "204":
          description: Successful delete operation
        "400":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"
          description: Failure
        "403":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"
          description: Bad credentials
        "404":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"
          description: Key not found
      summary: Delete a trigger
      tags:
        - triggers
    put:
      operationId: updateTrigger
      parameters:
        - description: ID of the trigger
          in: path
          name: trigger
          required: true
          schema:
            type: string
      requestBody:
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/AddTriggerRequest"
        description: Trigger body
        required: true
      responses:
        "200":
          description: Successful update operation
        "400":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"
          description: Failure
        "403":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"
          description: Bad credentials
        "404":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"
          description: Key not found
      summary: Update a trigger
      tags:
        - triggers
  /user:
    get:
      operationId: getAuthenticatedUser
      responses:
        "200":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/User"
          description: successful operation
        "403":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"
          description: Bad credentials
      summary: Get the authenticated user
      tags:
        - user
    put:
      operationId: updateUser
      requestBody:
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/UpdateUserRequest"
        description: User body
        required: true
      responses:
        "200":
          description: Successful update operation
        "400":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"
          description: Failure
        "403":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"
          description: Bad credentials
      summary: Update a user
      tags:
        - user
  /verifications:
    get:
      operationId: getAllVerifications
      responses:
        "200":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/GetAllVerificationsResponse"
          description: Successful operation
        "403":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"
          description: Bad credentials
      summary: Get all verificats for the user
      tags:
        - verifications
    post:
      operationId: addVerification
      requestBody:
        content:
          application/json:
            schema:
              oneOf:
                - $ref: "#/components/schemas/AddEmailVerificationRequest"
                - $ref: "#/components/schemas/AddSmsVerificationRequest"
        description: Key body
        required: true
      responses:
        "201":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/AddVerificationResponse"
          description: Successful operation
        "400":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"
          description: Failure
        "403":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"
          description: Bad credentials
      summary: Start verification process for external email address or sms number
      tags:
        - verifications
  "/verifications/{verification}/verify":
    post:
      operationId: verify
      parameters:
        - description: ID of the verification entry
          in: path
          name: verification
          required: true
          schema:
            type: string
      requestBody:
        content:
          application/json:
            schema:
              oneOf:
                - $ref: "#/components/schemas/VerifyEmailRequest"
                - $ref: "#/components/schemas/VerifySmsRequest"
        description: Verify action body
        required: true
      responses:
        "200":
          description: Successful operation
        "400":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"
          description: Failure
        "403":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"
          description: Not authorized or bad code
        "404":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"
          description: Not found
      summary: Verify an email address or sms number with a code
      tags:
        - verifications
  /workflows:
    get:
      description: ""
      operationId: getAllWorkflows
      responses:
        "200":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/GetAllWorkflowsResponse"
          description: successful operation
        "403":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"
          description: Bad credentials
        "405":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"
          description: Invalid input
      summary: Get all workflows you have access to
      tags:
        - workflows
    post:
      description: ""
      operationId: addWorkflow
      requestBody:
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/AddWorkflowRequest"
        description: Workflow body
        required: true
      responses:
        "201":
          description: successful operation
        "400":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"
          description: Internal error
        "403":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"
          description: Bad credentials
        "405":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"
          description: Invalid input
      summary: Setup workflow
      tags:
        - workflows
  /workflows/set:
    post:
      operationId: setWorkflow
      requestBody:
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/SetWorkflowRequest"
        description: Set Workflow body
        required: true
      responses:
        "204":
          description: Successful update operation
        "400":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"
          description: Failure
        "403":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"
          description: Bad credentials
        "404":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"
          description: Key not found
      summary: Set a property on a workflow
      tags:
        - workflows
  "/workflows/{workflow}":
    delete:
      operationId: deleteWorkflow
      parameters:
        - description: ID of the workflow
          in: path
          name: workflow
          required: true
          schema:
            type: string
      responses:
        "204":
          description: Successful delete operation
        "400":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"
          description: Failure
        "403":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"
          description: Bad credentials
        "404":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"
          description: Key not found
      summary: Delete a workflow
      tags:
        - workflows
    put:
      operationId: updateWorkflow
      parameters:
        - description: ID of the workflow
          in: path
          name: workflow
          required: true
          schema:
            type: string
      requestBody:
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/AddWorkflowRequest"
        description: Workflow body
        required: true
      responses:
        "200":
          description: Successful update operation
        "400":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"
          description: Failure
        "403":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"
          description: Bad credentials
        "404":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"
          description: Key not found
      summary: Update an workflow
      tags:
        - workflows
  /workspaces:
    get:
      description: ""
      operationId: getAllWorkspaces
      responses:
        "200":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/GetAllWorkspacesResponse"
          description: successful operation
        "403":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"
          description: Bad credentials
        "405":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"
          description: Invalid input
      summary: Get all workspaces you have access to
      tags:
        - workspaces
    post:
      description: An attendant address will be created as well
      operationId: addWorkspace
      requestBody:
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/AddWorkspaceRequest"
        description: request body
        required: true
      responses:
        "201":
          description: successful operation
        "400":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"
          description: Bad request
        "403":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"
          description: Bad credentials
        "405":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"
          description: Invalid input
      summary: Claim a Mailscript workspace
      tags:
        - workspaces
components:
  schemas:
    ActionCombine:
      properties:
        createdAt:
          format: date-time
          type: string
        createdBy:
          type: string
        id:
          type: string
        list:
          items:
            type: string
          type: array
        name:
          type: string
        owner:
          type: string
      required:
        - id
        - name
        - owner
        - createdAt
        - createdBy
        - output
        - config
    ActionSend:
      properties:
        config:
          properties:
            html:
              type: string
            subject:
              type: string
            text:
              type: string
            type:
              type: string
          required:
            - type
            - subject
          type: object
        createdAt:
          format: date-time
          type: string
        createdBy:
          type: string
        id:
          type: string
        name:
          type: string
        output:
          type: string
        owner:
          type: string
      required:
        - id
        - name
        - owner
        - createdAt
        - createdBy
        - output
        - config
    AddActionAliasRequest:
      properties:
        config:
          properties:
            alias:
              type: string
            type:
              enum:
                - alias
              type: string
          type: object
        name:
          type: string
        type:
          enum:
            - mailscript-email
          type: string
      required:
        - name
        - type
        - config
    AddActionCombineRequest:
      properties:
        list:
          items:
            type: string
          type: array
        name:
          type: string
      required:
        - name
        - list
    AddActionDaemonRequest:
      properties:
        config:
          properties:
            body:
              type: string
            daemon:
              type: string
          required:
            - body
          type: object
        name:
          type: string
        type:
          enum:
            - daemon
          type: string
      required:
        - name
        - type
        - config
    AddActionForwardRequest:
      properties:
        config:
          properties:
            forward:
              type: string
            from:
              type: string
            key:
              type: string
            type:
              enum:
                - forward
              type: string
          required:
            - type
            - forward
            - from
            - key
          type: object
        name:
          type: string
        type:
          enum:
            - mailscript-email
          type: string
      required:
        - name
        - type
        - config
    AddActionReplyAllRequest:
      properties:
        config:
          properties:
            from:
              type: string
            html:
              type: string
            key:
              type: string
            text:
              type: string
            type:
              enum:
                - replyAll
              type: string
          required:
            - type
            - from
            - key
          type: object
        name:
          type: string
        type:
          enum:
            - mailscript-email
          type: string
      required:
        - name
        - type
        - config
    AddActionReplyRequest:
      properties:
        config:
          properties:
            from:
              type: string
            html:
              type: string
            key:
              type: string
            text:
              type: string
            type:
              enum:
                - reply
              type: string
          required:
            - type
            - from
            - key
          type: object
        name:
          type: string
        type:
          enum:
            - mailscript-email
          type: string
      required:
        - name
        - type
        - config
    AddActionResponse:
      properties:
        id:
          type: string
      required:
        - id
    AddActionSendRequest:
      properties:
        config:
          properties:
            from:
              type: string
            html:
              type: string
            key:
              type: string
            subject:
              type: string
            text:
              type: string
            to:
              type: string
            type:
              enum:
                - send
              type: string
          required:
            - send
            - subject
            - from
            - key
          type: object
        name:
          type: string
        type:
          enum:
            - mailscript-email
          type: string
      required:
        - name
        - type
        - config
    AddActionSmsRequest:
      properties:
        config:
          properties:
            number:
              type: string
            text:
              type: string
          required:
            - number
            - text
          type: object
        name:
          type: string
        type:
          enum:
            - sms
          type: string
      required:
        - name
        - type
        - config
    AddActionWebhookRequest:
      properties:
        config:
          properties:
            body:
              type: string
            opts:
              properties:
                headers:
                  type: object
                method:
                  enum:
                    - POST
                    - GET
                    - DELETE
                  type: string
              required:
                - headers
                - method
              type: object
            url:
              type: string
          required:
            - url
            - opts
            - body
          type: object
        name:
          type: string
        type:
          enum:
            - webhook
          type: string
      required:
        - name
        - type
        - config
    AddAddressRequest:
      properties:
        address:
          type: string
      required:
        - address
    AddDomainRequest:
      properties:
        domain:
          type: string
      required:
        - domain
    AddEmailVerificationRequest:
      properties:
        email:
          type: string
        type:
          enum:
            - email
          type: string
      required:
        - type
        - email
    AddKeyRequest:
      properties:
        name:
          type: string
        read:
          type: boolean
        write:
          type: boolean
      required:
        - name
        - read
        - write
    AddKeyResponse:
      properties:
        id:
          type: string
    AddSmsVerificationRequest:
      properties:
        sms:
          type: string
        type:
          enum:
            - sms
          type: string
      required:
        - type
        - sms
    AddTriggerRequest:
      properties:
        criteria:
          oneOf:
            - $ref: "#/components/schemas/Criteria"
            - $ref: "#/components/schemas/CriteriaOperand"
        name:
          type: string
      required:
        - name
        - criteria
    AddTriggerResponse:
      properties:
        id:
          type: string
      required:
        - id
    AddVerificationResponse:
      properties:
        id:
          type: string
      required:
        - id
    AddWorkflowRequest:
      properties:
        action:
          type: string
        active:
          type: boolean
        input:
          type: string
        name:
          type: string
        trigger:
          type: string
      required:
        - name
        - input
        - action
    AddWorkspaceRequest:
      properties:
        workspace:
          type: string
      required:
        - workspace
    Address:
      properties:
        createdAt:
          format: date-time
          type: string
        createdBy:
          type: string
        displayName:
          type: string
        id:
          type: string
        owner:
          type: string
      required:
        - id
        - owner
        - createdAt
        - createdBy
    CheckDomainVerify:
      properties:
        domain:
          type: string
        success:
          type: boolean
      required:
        - domain
        - success
    Criteria:
      minProperties: 1
      properties:
        domain:
          type: string
        from:
          type: string
        hasAttachments:
          type: boolean
        hasTheWords:
          type: string
        sentTo:
          type: string
        subjectContains:
          type: string
    CriteriaOperand:
      minProperties: 1
      properties:
        and:
          items:
            type: string
          type: array
        or:
          items:
            type: string
          type: array
    DomainResponse:
      properties:
        domain:
          type: string
        records:
          items:
            properties:
              name:
                type: string
              type:
                type: string
              value:
                type: string
            required:
              - type
              - name
              - value
            type: object
          type: array
      required:
        - domain
        - records
    ErrorResponse:
      properties:
        error:
          type: string
      required:
        - error
    GetAllActionsResponse:
      properties:
        list:
          items:
            oneOf:
              - $ref: "#/components/schemas/ActionSend"
              - $ref: "#/components/schemas/ActionCombine"
          type: array
      required:
        - list
    GetAllAddressesResponse:
      properties:
        list:
          items:
            oneOf:
              - $ref: "#/components/schemas/Address"
            type: object
          type: array
      required:
        - list
    GetAllDomainsResponse:
      properties:
        id:
          items:
            type: string
          type: array
      required:
        - list
    GetAllInputsResponse:
      properties:
        list:
          items:
            oneOf:
              - $ref: "#/components/schemas/MailscriptEmailInput"
          type: array
      required:
        - list
    GetAllIntegrationsResponse:
      properties:
        list:
          items:
            oneOf:
              - $ref: "#/components/schemas/Integration"
          type: array
      required:
        - list
    GetAllKeysResponse:
      properties:
        list:
          items:
            oneOf:
              - $ref: "#/components/schemas/Key"
            type: object
          type: array
      required:
        - list
    GetAllTriggersResponse:
      properties:
        list:
          items:
            oneOf:
              - $ref: "#/components/schemas/Trigger"
          type: array
      required:
        - list
    GetAllVerificationsResponse:
      properties:
        list:
          items:
            oneOf:
              - $ref: "#/components/schemas/VerificationEmail"
              - $ref: "#/components/schemas/VerificationSms"
          type: array
      required:
        - list
    GetAllWorkflowsResponse:
      properties:
        list:
          items:
            oneOf:
              - $ref: "#/components/schemas/Workflow"
            type: object
          type: array
      required:
        - list
    GetAllWorkspacesResponse:
      properties:
        list:
          items:
            oneOf:
              - $ref: "#/components/schemas/Workspace"
            type: object
          type: array
      required:
        - list
    Integration:
      properties:
        createdAt:
          format: date-time
          type: string
        id:
          type: string
        type:
          enum:
            - google
          type: string
      required:
        - id
        - type
        - createdAt
    Key:
      properties:
        createdAt:
          format: date-time
          type: string
        createdBy:
          type: string
        id:
          type: string
        name:
          type: string
        read:
          type: boolean
        write:
          type: boolean
      required:
        - id
        - name
        - read
        - write
        - createdBy
        - createdAt
    KeyValuePair:
      properties:
        key:
          type: string
        value:
          type: string
      required:
        - key
        - value
    MailscriptEmailInput:
      properties:
        address:
          type: string
        createdAt:
          format: date-time
          type: string
        createdBy:
          type: string
        id:
          type: string
        name:
          type: string
        owner:
          type: string
        type:
          enum:
            - mailescript-email
          type: string
      required:
        - id
        - name
        - type
        - owner
        - createdAt
        - createdBy
        - address
    SendRequest:
      properties:
        from:
          type: string
        html:
          type: string
        subject:
          type: string
        text:
          type: string
        to:
          type: string
      required:
        - to
        - from
        - subject
    SetWorkflowRequest:
      properties:
        id:
          type: string
        pairs:
          items:
            oneOf:
              - $ref: "#/components/schemas/KeyValuePair"
            type: object
          type: array
    Trigger:
      properties:
        createdAt:
          format: date-time
          type: string
        createdBy:
          type: string
        criteria:
          $ref: "#/components/schemas/Criteria"
        displayName:
          type: string
        id:
          type: string
        name:
          type: string
        owner:
          type: string
      required:
        - id
        - owner
        - createdAt
        - createdBy
        - name
        - criteria
    UpdateKeyRequest:
      properties:
        name:
          type: string
        read:
          type: boolean
        write:
          type: boolean
      required:
        - name
        - read
        - write
    UpdateUserRequest:
      properties:
        displayName:
          type: string
      required:
        - displayName
    User:
      properties:
        createdAt:
          format: date-time
          type: string
        displayName:
          type: string
        email:
          type: string
        id:
          type: string
        photoURL:
          type: string
      required:
        - id
        - displayName
        - email
        - createdAt
    VerificationEmail:
      properties:
        email:
          type: string
        id:
          type: string
        type:
          enum:
            - email
          type: string
        verified:
          type: boolean
        verifiedAt:
          format: date-time
          type: string
        verifiedBy:
          type: string
    VerificationSms:
      properties:
        id:
          type: string
        sms:
          type: string
        type:
          enum:
            - sms
          type: string
        verified:
          type: boolean
        verifiedAt:
          format: date-time
          type: string
        verifiedBy:
          type: string
    VerifyEmailRequest:
      properties:
        code:
          type: string
        email:
          type: string
      required:
        - email
        - code
    VerifySmsRequest:
      properties:
        code:
          type: string
        sms:
          type: string
      required:
        - sms
        - code
    Workflow:
      properties:
        action:
          type: string
        active:
          type: boolean
        createdAt:
          format: date-time
          type: string
        createdBy:
          type: string
        id:
          type: string
        input:
          type: string
        name:
          type: string
        owner:
          type: string
        trigger:
          type: string
      required:
        - id
        - name
        - owner
        - createdAt
        - createdBy
        - input
        - trigger
        - action
    Workspace:
      properties:
        createdAt:
          format: date-time
          type: string
        createdBy:
          type: string
        id:
          type: string
        owner:
          type: string
      required:
        - id
        - owner
        - createdAt
        - createdBy
  securitySchemes:
    bearerAuth:
      bearerFormat: JWT
      scheme: bearer
      type: http
